While bacteria do not have sex like multicellular organisms, there are several processes by which they obtain new genes: conjugation, transformation, and transduction. Conjugation can occur between two appropriate bacterial strains when one (or both) extends hairlike projections called pili to contact the other. The chromosome, or part of one, may be transferred from one bacterium to the other. In addition, plasmids can be exchanged through these pili. Some bacteria can take up DNA from the environment, a process called transformation. The DNA can then be incorporated into the host chromosome.
Some bacterial viruses, called phages, can carry out transduction. With some phages, the virus temporarily integrates into the host chromosome. When it releases itself, it may carry some part of the host DNA with it. When it goes on to infect another cell, this extra DNA may be left behind in the next round of integration and release. Other phages, called generalized transducers, package fragments of the chromosome into the phage instead of their own genome. When the transducing phage infects a new cell, they inject bacterial DNA. These phages lack their own genome and are unable to replicate in the new cell. The inserted bacterial DNA may recombine (join in with) the host bacterial chromosome.