Many bacteria show a wide range of social traits involved in both cooperation and conflict with other individuals. We are paritcularly interested in understanding how these behaviorus can evolve in bacteria. Many genes involved in microbial sociality can be transferred between cells in a process known as horizontal gene transfer. In many pathogenic bacteria, for example, plasmids carry genes involved in virulence and antibiotic resistance, and can thus be transferred horizontally. This raises the question as to why cells don’t keep these genes if they benefit them. We build mathematical and computational models, and analyze sequence data from bacterial genomes, in order to understand why plasmids and phages are so important in bacterial social evolution and pathogenicity.