Antibiotic resistant genes are widely present in many bacteria, as these tiny bugs can develop antibiotic resistance to survive in the presence of antibiotics or acquire antibiotic resistant genes from other bacteria through horizontal gene transfer. I hypothesize that the genetic relationship of bacteria can be determined based on the presence of antibiotic resistance genes in these microbes. In this project, I selected 11 antibiotic resistance genes to screen various bacterial genera using the Basic Local Alignment Search Tool (BLAST). Among the screened bacteria, Candidatus has 8 antibiotic resistance genes and six genera/phyla including Escherichia, Klebsiella, Amycolatopsis, Acinetobacter, Choloroflexota and Pseudomonadota have 5 resistant genes. I also found that a number of bacterial genera/phyla share the same antibiotic resistance genes, such as Pseudomonas and Acinetobacter that share four antibiotic resistance genes, suggesting that these two genera are genetically closely related or antibiotic resistance gene transfer has occurred between these two genera. This project thus provides a useful approach to understand the genetic relationship of antibiotic resistant bacteria, which will allow us to better understand and prevent the emergence of superbugs.
Antibiotic-resistant bacteria pose a serious threat to human health. The wide use of antibiotics worldwide forces bacteria to evolve for survival. They can either develop antibiotic resistance through long-term contact with antibiotics or acquire antibiotic resistance genes from other bacteria in the microbial community. Understanding how antibiotic-resistant bacteria relate to each other can help researchers develop new approaches to prevent the emergence of superbugs. This project aims to use computational tools to analyze the presence of antibiotic-resistant genes in a variety of bacteria to understand the relatedness of antibiotic-resistant bacteria.

Glossary

BLAST: Basic Local Alignment Search Tool, finds the closest match to a genome or protein sequence.
​Genome/protein sequence: the genes or protein sequences that are present in a bacterial cell's DNA
​CARD: The Comprehensive Antibiotic Resistance Database. CARD is a database of antibiotic resistance genes, their products and their associated phenotypes.
​Phenotype: Observable appearance

Parsing the Data to find Bacteria Name

Antibiotic Resistance happens when bacteria develop mechanisms to resist antibiotics. The results of a BLAST search are downloadable as a text file containing information about every sequence in NCBI which "matched" the query sequence (here an antibiotic resistance gene) according to set parameters.
Make the data into an association. Import the BLAST results:
In[]:=
importResults=CloudGet/@"ermCfile"CloudObject[
https://www.wolframcloud.com/obj/2aa4fc83-b680-4ab0-b236-2a2
03dfacf13
],"ermEfile"CloudObject[
https://www.wolframcloud.com/obj/885a6460-71a1-41c8-a878-087d0d452d2c
],"aacIdfile"CloudObject[
https://www.wolframcloud.com/obj/b0169eb2-ed00-400c-b3bf-91272d3a10e3
],"fomAfile"CloudObject[
https://www.wolframcloud.com/obj/ef49683b-4951-44ba-bc72-3c2ab77e8f38
],"atpEfile"CloudObject[
https://www.wolframcloud.com/obj/4c0df238-766d-4988-a288-c56d36ffb276
],"catB10"CloudObject[
https://www.wolframcloud.com/obj/dbea507d-6cc6-4444-a384-7501f2416786
],"LC231"CloudObject[
https://www.wolframcloud.com/obj/9853c7a4-0597-489e-b9a4-8ed325c0a76c
],"cfrBfile"CloudObject[
https://www.wolframcloud.com/obj/5a3f2749-cb93-4ad7-b3ef-1e6c7ca68e26
],"dfrvfile"CloudObject[
https://www.wolframcloud.com/obj/628ea1b8-4122-4491-9534-b615eec18a9f
],"rphAfile"CloudObject[
https://www.wolframcloud.com/obj/e8dc2f54-2b95-479d-8c5d-84e1e97bce8f
],"rphBfile"CloudObject[
https://www.wolframcloud.com/obj/65fd9a89-3fdf-4503-b960-9f9b1df9862f
];
Show snippet of data structure:
In[]:=
StringTake[importResults[[1]],975]
Out[]=
5>WP_115056535.1 23S ribosomal RNA methyltransferase Erm [Staphylococcus aureus]MNKKNIKDSQNFITSKHHINEILRNVHLNTNDNIIEIGSGKGHFTFELAKRCNYVTAIEIDPKLCRITKNKLIEYENFQVINKDILQFKFPKNKSYKIYGNIPYNISTDIIRKIVFESTATESYLIVEYGFAKRLLNTNRSLALFLMTEVDISILSMVPREYFHPKPKVNSSLIRLNRKKSRISHKDKQKYNYFVMKWVNKEYKKIFTKNQFNNSLKHAGIDDLNNISFEQFLSLFNSYKLFNK>HCX0352894.1 23S rRNA (adenine(2058)-N(6))-methyltransferase Erm(C) [Staphylococcus aureus]MNEKNIKHSQNFITSKHNIDKIMTNIRLNEHDNIFEIGSGKGHFTLELVQRCNFVTAIEIDHKLCKTTENKLVDHDNFQVLNKDILQFKDSIADEIYLIVEYGFAKRLLNTKRSLALFLMAEVDISILSMVPREYFHPKPKVNSSLIRLNRKKSRISHKDKQKYNYFVMKWVNKEYKKIFTKNQFNNSLKHAGIDDLNNISFEQFLSLFNSYKLFNK>WP_283534512.1 23S ribosomal RNA methyltransferase Erm [Ligilactobacillus animalis]MNKKNIKDSQNFITSKRNIDKIMTNISLNEHDNIFEIGSGKGHFTLELAKRCNYVTAIEIDPKLCRITKNKLIEYENFQVINKDILQFKFPKNKSYKIYGNIPYNISTDIIRKIVFESTATESYLIVEYGFAKRLLNTNRSLALFLMTEVDISILSKIPREYFHPKPRVNSSLIVLKRHPSKISLKDRKQYENFVMKWVNKEYKKIFTKNQFNKSLKHAGIDDLNNISFEQFLSLFNSYKLFNR
For this project I selected 11 antibiotic resistance sequences from CARD. They are ermC, ermE, aacId, fomA, atpE, catB10, LC231, cfrB, dfrv, rphA, and rphB. (The links to the antibiotic resistant protein sequences are in the references.) We want the name of the bacteria, which can be found inside the brackets. Each sequence is headed with a metadata line beginning with the ">" character.
Split the string by ">" characters into a list of strings, then unselect any Strings that say Plasmid or Vector:
In[]:=
splitResults[x_]:=Select[StringSplit[x,">"],!StringContainsQ[#,"Plasmid"|"Vector",IgnoreCase->True]&]
Find all words that are within square brackets. Then delete duplicates:
In[]:=
isolateResults[x_]:=DeleteDuplicates[StringTrim[Flatten[StringCases[x,"["~~__~~"]"]],"["|"]"]];
Find any words that start with a capital letter followed by lower case letters. If it doesn't match that criteria nothing will show up in the output:
In[]:=
sortResults[x_String]:=First[StringCases[x,RegularExpression["[A-Z][a-z]+"]],Nothing]
Isolate the name of the bacteria then delete the duplicates:
In[]:=
assocResults=Map[DeleteDuplicates[Flatten[Map[sortResults/@#&,isolateResults/@splitResults[#]]]]&,importResults];
Delete any that contain the word bacteria:
In[]:=
bacteriaDelete[x_]:=Select[x,!StringContainsQ[#,"Bacteria",IgnoreCase->True]&]
In[]:=
assocofResults=bacteriaDelete/@assocResults;
Show a section of assocofResults, specifically, all of the bacteria that have the ermC gene:
In[]:=
assocResults[[1]]
Out[]=
{Staphylococcus,Ligilactobacillus,Moraxella,Staphylococcaceae,Lactobacillales,Lactobacillus,Pasteurellaceae,Escherichia,Aerococcus,Enterococcus,Enterobacteriaceae,Clostridium,Bacteria,Streptococcus,Salmonella,Limosilactobacillus,Eggerthella,Lysinibacillus,Virgibacillus,Globicatella,Dolosigranulum,Caldibacillus,Gracilibacillus,Mammaliicoccus,Bacilli,Bacillales,Amphibacillus,Bacillota,Tepidanaerobacter,Piscibacillus,Dolosicoccus,Lederbergia,Caudoviricetes,Flavobacterium,Acetivibrio,Bacteroides,Bacteroidales,Candidatus,Klebsiella,Oceanobacillus,Bacteroidaceae,Prevotella,Phocaeicola,Listeria,Pseudogracilibacillus,Aliicoccus,Paraprevotella,Patescibacteria,Zoogloea,Lacticaseibacillus,Syntrophomonadaceae,Clostridiales,Enterobacter,Peptostreptococcus,Jeotgalicoccus,Tetragenococcus,Clostridioides}

Make Graph

Now that we have the bacteria's name, we can start identifying the closest related bacteria in this dataset. To find the closest related bacteria, we have to find the permutations of every bacteria that shares the same sequence and then find the Intersection (how many times do the same bacteria share the same gene). Then using a graph, we can get a visualization of how many genes bacteria share with each other. We can then use this information to see how closely related the bacteria are to other bacteria.
Find permutations of every pair of keys. Then Delete Duplicates once its been sorted:
In[]:=
genePermutations=DeleteDuplicatesBy[Permutations[Keys[assocofResults],{2}],Sort];
Finds the intersection of the the keys:
In[]:=
permResults[{x_,y_}]:=Intersection[assocofResults[x],assocofResults[y]]
Find the intersection of each permutation:
In[]:=
interpermResults=permResults[#]&/@genePermutations;
Turns each finished intersection/permutation into a rule:
In[]:=
replaceCommas[a_]:=Replace[a,{x_,y_}:>Rule[x,y],{1}]
All of the bacteria that are not permutations of two, will not be turned into rules. Grabrules removes those that aren't rules:
In[]:=
grabRules[x_]:=Select[x,MatchQ[#,_Rule]&]
Tooltip is a function that allows you to see the Vertex Name when you hover over the Vertex.
Plot the graph using GrapPlot. With VertexLabels in a Tooltip:
resultGraph[x_]:=GraphPlot[Flatten[grabRules/@Map[replaceCommas,DeleteDuplicatesBy[Permutations[#,{2}],Sort]&/@x]],{VertexLabels->Placed[Automatic,Tooltip],GraphLayout->"RadialEmbedding"}]
In[]:=
resultGraph[interpermResults]
Out[]=

Table of Antibiotic Resistance

We can now use the data we have to find how many antibiotic resistance genes the bacteria have. The genes in this dataset are all antibiotic resistance genes. We can find the number of antibiotic resistance genes by looking at how many times it shows up in assocofResults. By counting how many times each bacteria shows up, we can find how many antibiotic resistant genes they have out of the 11 that were tested. The table below shows the results. We can see that Candidatus has 8 out of the 11 antibiotic resistance genes. While Escherichia, Klebsiella, Amycolatopsis, Acinetobacter, Chloroflexota, and Pseudomonadota all have 5 out of the 11 antibiotic resistance genes in this dataset.
We find the values of the list of genera we then turn it into a list and sort it based on their value. Then gather by the values and sort:
In[]:=
tableResults2=Sort[GatherBy[Normal[Counts[Flatten[Values[assocofResults]]]],Values]];
Use String Riffle and Thread to get rid of the curly brackets around the list and get it into the correct format for Grid. Use Grid and Frame All to make a table. The table shows how many antibiotic resistance genes a bacteria has. The table shows the first twenty and then tells how many there still are.
Define processing function:
In[]:=
resultsTable[x_]:={Flatten[#[[1]]],#[[2]][[1]]}&/@Thread[{Keys[x],Values[x]}]
Format the table for readability:
In[]:=
maxLengthResults=30;​​Grid[Map[{If[Length[#[[1]]]>maxLengthResults,Join[Take[#[[1]],UpTo[maxLengthResults]],{"<<"<>ToString[Length[#[[1]]]-maxLengthResults]<>">>"}],#[[1]]],#[[2]]}&,resultsTable[tableResults2]],{Frame->All,Alignment->Left}]
Out[]=
{Candidatus}
8
{Escherichia,Klebsiella,Amycolatopsis,Acinetobacter,Chloroflexota,Pseudomonadota}
5
{Staphylococcus,Salmonella,Lysinibacillus,Bacillota,Enterobacter,Micromonospora,Streptomyces,Actinomycetia,Pseudomonas,Acidobacteriota,Myxococcales,Bacillus,Clostridia,Paenibacillus}
4
{Clostridium,Virgibacillus,Bacillales,Lederbergia,Bacteroides,Clostridiales,Saccharopolyspora,Nocardia,Streptosporangium,Rhodococcus,Dactylosporangium,Glycomyces,Leptolyngbya,Hydrogenophaga,Gemmatimonadota,Variovorax,Luteimonas,Corallococcus,Burkholderiales,Citrobacter,Devosia,Anaerolineae,Raoultella,Serratia,Aeromonas,Brevibacillus,Shewanella,Chloroflexi,Anaerolineales,Lachnospiraceae,<<13>>}
3
{Moraxella,Lactobacillales,Enterococcus,Streptococcus,Mammaliicoccus,Bacteroidales,Clostridioides,Aeromicrobium,Actinomadura,Sphaerisporangium,Plantactinospora,Nocardiopsis,Nonomuraea,Spongiactinospora,Planomonospora,Bailinhaonella,Thermomonospora,Microtetraspora,Acrocarpospora,Streptosporangiales,Planobispora,Phytohabitans,Streptomonospora,Actinoplanes,Stackebrandtia,Couchioplanes,Actinomycetales,Wenjunlia,Verrucosispora,Pseudomonadaceae,<<99>>}
2
{Ligilactobacillus,Staphylococcaceae,Lactobacillus,Pasteurellaceae,Aerococcus,Limosilactobacillus,Eggerthella,Globicatella,Dolosigranulum,Caldibacillus,Gracilibacillus,Bacilli,Amphibacillus,Tepidanaerobacter,Piscibacillus,Dolosicoccus,Caudoviricetes,Flavobacterium,Acetivibrio,Oceanobacillus,Bacteroidaceae,Prevotella,Phocaeicola,Listeria,Pseudogracilibacillus,Aliicoccus,Paraprevotella,Zoogloea,Lacticaseibacillus,Syntrophomonadaceae,<<693>>}
1
How Related Bacteria Are To Each Other
Bacteria use Horizontal Gene Transfer to pass genetic information to other bacteria. This genetic information often includes antibiotic resistance genes. To find how related they are, look at the number of shared genes. We can do this by looking at assocofResults and counting how many times two bacteria have the same gene.
Sort the bacteria into order based on how many times they share a gene with another bacteria. Turn the association of bacteria gene sharing into a list. Put the sorted list into a Grid and takes the first 20 of each:
Below is a table of the number of genes from the dataset bacteria share with each other. There are six bacteria that share four antibiotic resistance genes. This includes Chloroflexota and Clostridia.
Format the table for readability:
Conclusion
Visualization of the bacteria shared genes showed us that Candidatus has the most antibiotic resistance genes in the dataset. Through further analysis we found out that Candidatus has eight antibiotic resistance genes followed by Escherichia, Klebsiella, Amycolatopsis, Acinetobacter, Chloroflexota, and Pseudomonadota which have five. There are six pairs of bacteria that share four antibiotic resistance genes. They are
Chloroflexota and Clostridia, Candidatus and Myxococcales, Pseudomonas and Acinetobacter, Escherichia and Enterobacter, Escherichia and Klebsiella, Escherichia and Candidatus. Because the dataset is small, the results cannot be used to accurately predict how related bacteria are. But, if more genes and data were to be used, this method can be used to identify antibiotic resistant bacteria and find out how closely related they are to other bacteria.
Future Work
1
.
Test more antibiotic resistance genes to get more accurate results.
2
.
Further analyze the results based on the phylum, family, class, order, genus and species
3
.
Analyze the presence of mobile genetic element in the bacteria that share the same antibiotic resistance genes to better understand horizontal gene transfer.
Acknowledgements
I want to thank the staff, directors, TAs, mentors and Mr. Stephen Wolfram for making the Wolfram High School Summer Research Program possible. I also want to thank Isabel Skidmore for being an amazing mentor.
References
https://blast.ncbi.nlm.nih.gov/Blast.cgi
​https://card.mcmaster.ca/​
​https://www.ncbi.nlm.nih.gov/protein/AAR21614.1 : Aac3Id
​https://www.ncbi.nlm.nih.gov/protein/AUW27807.1 : ErmC
​https://www.ncbi.nlm.nih.gov/protein/CAB60001.1 : ErmE
​https://www.ncbi.nlm.nih.gov/protein/APB03218.1 :LC231
​https://www.ncbi.nlm.nih.gov/protein/AOY10467.1 :DfrV
​https://www.ncbi.nlm.nih.gov/protein/BAA32493.1 :fomA
​https://www.ncbi.nlm.nih.gov/protein/ACL13298.1 :CATB10
​https://www.ncbi.nlm.nih.gov/protein/ABC24999.1 :AtpE
​https://www.ncbi.nlm.nih.gov/protein/CDF47262.1 :cfrB
​https://www.ncbi.nlm.nih.gov/protein/APB03222.1 :RphB
​https://www.ncbi.nlm.nih.gov/protein/AIA08936.1 :RPHA
​https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4536854/ :Horizontal Gene Transfer

CITE THIS NOTEBOOK

Analysis of bacterial relatedness through their antibiotic resistance genes​
by Angela Zhan​
Wolfram Community, STAFF PICKS, July 13, 2023
​https://community.wolfram.com/groups/-/m/t/2963571