system
Given the following post, respond as if you're commenting on Reddit:
human
Eli5: how does DNA code editing work?
gpt
I assume you mean how we genetically modify organisms?

Step one is obviously to figure out which gene you either want to insert or remove.  That's just long, tedious work sequencing the genome and then doing experiments to figure out what each gene does.  Think this bit of DNA codes for a certain protein?  Get rid of that bit, let the organism grow, and see if it still makes that protein.  If not, your hypothesis was correct!  We can use all kinds of chemistry, including borrowing the enzymes that living things use to copy and edit their own DNA, to chop up the DNA we want to insert into something else and isolate the section we want.  We can use other enzymes and chemistry to combine different pieces to make bigger, more complicated sections of DNA that code for multiple proteins.

To actually manipulate the genes, we have a couple different methods.  One of the coolest things is almost literally a "DNA gun".  It launches your bits of code (the base pairs) at the target cell's nucleus with a lot of energy, smashing into its DNA, hopefully with enough energy to smash them together.  Obviously, this has some problems: you may not get them to merge together, you may just smash everything to bits.  You may also end up putting your new code in a bad spot on the DNA, that either means it can't get used, or messed up an important bit of code that was already there so the organism can't grow correctly.  After firing your DNA gun, you sit back and wait to see if it grows and how it grows to see if you got the results you want.  If you did, you save that specimen and let it reproduce, preserving the change in new generations.

The more accurate way that we use now is to use a species of bacteria (*Agrobacterium tumifaciens*) to insert the DNA.  The bacteria almost works like a virus, inserting part of its own DNA into the plants it infects.  Normally, this means the plant starts growing tumors and dies.  But when we genetically modify the plants, first we change the bacteria's DNA to the code we want the plant to have.  Then we infect the plant with the bacteria, which inserts that new code we want the plant to have, then it dies off, leaving us with our new plant.  This is way better than bombarding the plant's DNA because we can modify the bacteria to target parts of the plant DNA that we want changed, making it far more accurate.  It's also far more likely to, you know, not smash the target DNA to bits.  To change the *bacteria's* DNA, we use the same bombardment techniques, but recall that part of the step is to grow the organism to make sure it has the DNA we want in it: that's very time-consuming for a plant like corn that takes years to mature.  But bacteria grow in hours or days, so it's far easier to check.  In addition, the bacteria DNA is a lot simpler, so it's much easier to affect the part we want.  We also sometimes use a type of virus called bacteriophages - viruses that only infect bacteria.  Viruses work by changing DNA, right?  So get the virus to insert its DNA (which we've modified) into the bacteria, which then inserts it into the plant.  Viruses are even easier to work with than bacteria, because they're not truly alive it's harder to mess them up and "kill" them.