TAGME from ASV fasta file



Data description

The data used for this tutorial are the output of the DADA2 Tutorial. The raw data are those used in Mothur Miseq SOP
It consist of:

  • ASVs.fasta - Unique sequences produced by DADA2 pipeline
  • otu_table.txt - OTU table generated from BIOM file. This kind of file can be produced by pipelines such as Qiime or Vsearch.
  • seqtab.nochim.R - The R variable containing the final table of DADA2 pipeline.

Download files

  • Download example files:
    • Link, or
    • Command line:
wget http://mandi.minas.fiocruz.br/TAGME/examples/examples.tar.gz
  • Download models for the primers used in the article: 515F and 806R
    • Link, or
    • Command line:
wget http://mandi.minas.fiocruz.br/TAGME/models/515F-806R.tar.gz
  • Uncompress files:
tar -zvxf examples.tar.gz
tar -zvxf 515F-806R.tar.gz

R environment

The next steps are performed into R environment, that includes Rstudio.

  • Load library
Taxonomic classification
  • Run taxonomic prediction with parameters:
    • file = "examples/ASVs.fasta", is the FASTA file containing the ASVs, OTUs or Unique sequences to be classified.
    • db = "515F-806R/", is the directory containing the downloaded RDS and TXT files.
    • specificity = 0.8, is the DEFAULT value that uses the Score cutoff corresponding to 80% specificity
    • batch = 50000, is the DEFAULT value limiting the number of assigned sequences per batch. Lower values consume less memory.
> library(tagme)
> taxonomy = tagmeFromFasta(file = "examples/ASVs.fasta", db = "515F-806R/")
Loading required package: randomForest
randomForest 4.6-14
Type rfNews() to see new features/changes/bug fixes.
Loading required package: seqinr
Starting Species... 29  assigned

Starting Genus... 139  assigned

Starting Family... 201  assigned

Starting Order... 224  assigned

Starting Class... 227  assigned

Starting Phylum... 228  assigned

Starting Domain... 232  assigned

Printing Unassigned...

The output is a variable containing the predicted taxonomy. The Taxonomy column is the predicted classification, the Ratio column contains the Score for the classification.

|   |seqID |Taxonomy                                                                                                                              | Best| Second|     Ratio|
|:--|:-----|:-------------------------------------------------------------------------------------------------------------------------------------|----:|------:|---------:|
|21 |sq21  |k__Bacteria;p__Firmicutes;c__Bacilli;o__Lactobacillales;f__Lactobacillaceae;g__Lactobacillus;s__Lactobacillus reuteri                 | 0.99|   0.01|  6.563063|
|27 |sq27  |k__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;f__Ruminococcaceae;g__Oscillibacter;s__Clostridium leptum                    | 0.46|   0.02|  2.080839|
|34 |sq34  |k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Staphylococcaceae;g__Staphylococcus;s__Staphylococcus aureus                    | 0.80|   0.18|  1.721602|
|44 |sq44  |k__Bacteria;p__Proteobacteria;c__Gammaproteobacteria;o__Pseudomonadales;f__Moraxellaceae;g__Acinetobacter;s__Acinetobacter baumannii  | 1.00|   0.00| 10.000000|
|47 |sq47  |k__Bacteria;p__Firmicutes;c__Bacilli;o__Bacillales;f__Bacillaceae;g__Bacillus;s__Bacillus cereus                                      | 0.95|   0.04|  4.341363|
|53 |sq53  |k__Bacteria;p__Epsilonbacteraeota;c__Campylobacteria;o__Campylobacterales;f__Helicobacteraceae;g__Helicobacter;s__Helicobacter pylori | 0.99|   0.01|  6.563063|
Load OTU table

The OTU table was generated from a BIOM file. The BIOM file can be generated by pipelines such as Qiime, or from UC files produced by UParse or Vsearch. E.g. in bash commands: biom from-uc -i map.uc -o otu_table.biom. The BIOM file is converted to TXT file:
biom convert -i otu_table.biom -o otu_table.txt --to-tsv

The TXT file is loaded into a variable in R environment:

data = read.table(file = "examples/otu_table.txt", head = T, sep = "\t", comment.char = "$", skip = 1, row.names = 1)

|    | F3D0| F3D141| F3D142| F3D143| F3D144| F3D145| F3D146| F3D147| F3D148| F3D149| F3D150| F3D1| F3D2| F3D3| F3D5| F3D6| F3D7| F3D8| F3D9| Mock|
|:---|----:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|----:|----:|----:|----:|----:|----:|----:|----:|----:|
|sq1 |  579|    444|    289|    228|    421|    645|    325|   1495|    863|    883|    317|  405| 3488|  993|  327| 1015|  648|  272|  511|    0|
|sq2 |  345|    362|    304|    176|    277|    489|    230|   1215|    729|    779|    229|  353| 1587|  602|  268|  674|  504|  352|  423|    0|
|sq3 |  449|    345|    158|    204|    302|    522|    254|    913|    581|    723|    399|  231| 1175|  465|  284|  588|  438|  349|  482|    0|
|sq4 |  430|    502|    164|    231|    357|    583|    388|   1089|    853|    897|    471|   69|  472|  200|  158|  404|  314|  147|  206|    0|
|sq5 |  154|    189|    180|    130|    104|    307|    179|    453|    443|    417|    169|  140|  338|  402|  151|  476|  470|  582|  596|    0|
|sq6 |  470|    331|    181|    244|    353|    476|    275|   1182|    872|    637|    216|   41|  115|   25|   23|   17|   11|    0|    0|    0|
Split Taxonomy into DataFrame

Splits assigned taxonomy into 7 taxa: Domain, Phylum, Class, Order, Family, Genus and Specie. Generates a data frame with 7 columns that can be loaded into Phyloseq analysis.

|     |Domain   |Phylum             |Class               |Order             |Family            |Genus          |Specie                  |
|:----|:--------|:------------------|:-------------------|:-----------------|:-----------------|:--------------|:-----------------------|
|sq21 |Bacteria |Firmicutes         |Bacilli             |Lactobacillales   |Lactobacillaceae  |Lactobacillus  |Lactobacillus reuteri   |
|sq27 |Bacteria |Firmicutes         |Clostridia          |Clostridiales     |Ruminococcaceae   |Oscillibacter  |Clostridium leptum      |
|sq34 |Bacteria |Firmicutes         |Bacilli             |Bacillales        |Staphylococcaceae |Staphylococcus |Staphylococcus aureus   |
|sq44 |Bacteria |Proteobacteria     |Gammaproteobacteria |Pseudomonadales   |Moraxellaceae     |Acinetobacter  |Acinetobacter baumannii |
|sq47 |Bacteria |Firmicutes         |Bacilli             |Bacillales        |Bacillaceae       |Bacillus       |Bacillus cereus         |
|sq53 |Bacteria |Epsilonbacteraeota |Campylobacteria     |Campylobacterales |Helicobacteraceae |Helicobacter   |Helicobacter pylori     |
Summarize by Genus

Sums the counts of all sequences that belong to the same taxon.

data.summarized = summarize.by.level(count.table = data, taxonomy = taxonomy, level = "Genus", taxa.are.rows = TRUE)
|                                    | F3D0| F3D141| F3D142| F3D143| F3D144| F3D145| F3D146| F3D147| F3D148| F3D149| F3D150| F3D1| F3D2| F3D3| F3D5| F3D6| F3D7| F3D8| F3D9| Mock|
|:-----------------------------------|----:|------:|------:|------:|------:|------:|------:|------:|------:|------:|------:|----:|----:|----:|----:|----:|----:|----:|----:|----:|
|A2                                  |   16|     66|     12|     39|     38|     44|    113|     48|     12|     18|     10|   15|   21|    0|    0|   35|    0|   40|   69|    0|
|ASF356                              |   17|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|   11|   21|    9|    0|    9|    5|    8|    0|    0|
|Acetatifactor                       |    0|      0|      0|      0|      0|      0|     10|     15|      0|     12|     10|    9|    9|    0|    0|   13|    0|   11|    7|    0|
|Acetitomaculum                      |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    3|   20|    0|    0|    4|    0|    0|   15|    0|
|Acinetobacter                       |    0|      0|      0|      0|      0|      5|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  397|
|Actinomyces                         |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  325|
|Akkermansia                         |   10|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    7|    0|    0|    0|    0|    0|    0|    0|
|Alistipes                           |  184|    321|     89|     83|     41|    125|     71|     75|    507|    515|    120|  190| 1211|  381|  207|  261|  213|  286|  438|    0|
|Anaeroplasma                        |   84|      0|      0|      0|      0|      3|      0|     26|      0|      0|      0|   48|   81|   15|    0|    6|   19|   11|   30|    0|
|Anaerotruncus                       |    0|     15|      0|      5|     11|     10|     16|     11|     18|     35|     17|    0|    9|    0|    0|    6|    3|    7|    7|    0|
|Bacillus                            |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  368|
|Bacteroides                         |  154|    189|    180|    130|    104|    307|    179|    453|    443|    417|    169|  140|  338|  402|  151|  476|  470|  582|  596|  254|
|Bifidobacterium                     |   24|     16|     28|     10|     21|      7|      3|     29|     68|     28|     19|    0|    4|   16|    0|    0|    0|    0|    0|    0|
|Blautia                             |    5|     12|      0|      9|      0|      0|     14|     50|      7|     24|     11|   23|   18|    7|   12|   12|    7|   15|   23|    0|
|Butyricicoccus                      |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    9|    0|    0|    0|    0|    0|    9|    0|
|Clostridium sensu stricto 1         |  128|      6|      4|      3|      6|     19|      0|     18|     31|     13|      6|    0|    0|    0|    0|    0|    0|    0|    0|  300|
|Coprococcus 3                       |    4|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|Enterococcus                        |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  181|
|Enterorhabdus                       |    3|      0|      0|      0|      0|      4|      0|     11|      9|     15|      0|    3|   10|    4|    4|    0|    2|    3|    0|    0|
|Escherichia-Shigella                |    0|      0|      0|      0|      0|      0|      0|      5|      0|      0|      0|    2|    6|    0|    4|    0|    2|    3|    0|  179|
|Eubacterium coprostanoligenes group |   21|      0|      0|      0|      0|      0|      0|      0|     11|      4|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|Eubacterium nodatum group           |    5|      8|      8|      7|      8|     21|      5|     37|     13|     12|      8|   11|   55|   43|    6|   23|   26|   21|   26|    0|
|Eubacterium xylanophilum group      |    0|      0|      0|      0|      0|      0|      0|      0|      0|     13|      0|    0|   37|   22|   16|   11|    0|    0|    0|    0|
|Family XIII UCG-001                 |    0|      0|      0|      0|      0|      3|      0|      4|      4|      7|      0|    9|   10|    0|    4|    4|    0|    0|    5|    0|
|GCA-900066575                       |   19|      0|      0|      0|      0|      0|     11|     16|      5|      0|      0|    7|   22|    0|   14|    9|    0|    0|   25|    0|
|Helicobacter                        |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  348|
|Lachnoclostridium                   |  137|    144|     35|     82|     22|     13|    103|    170|    146|    440|    221|  119|  219|   31|   82|   74|   32|   80|  101|    0|
|Lachnospiraceae FCS020 group        |   11|      0|      0|      0|      0|      0|      0|     13|      7|     11|      9|    6|   12|    0|    5|    8|    0|    9|    7|    0|
|Lachnospiraceae NK4A136 group       |  983|    246|     73|     87|     75|     87|    235|    418|    391|    482|    224| 1038| 2160|  228|  639|  668|  215|  601|  863|    0|
|Lachnospiraceae UCG-001             |   91|      6|      0|      0|      0|      0|      0|      0|      0|      8|      0|  117|  293|   15|   96|   62|   23|   74|   95|    0|
|Lachnospiraceae UCG-006             |   10|     31|      5|     12|     13|     24|     38|     11|     53|    101|     38|   79|   90|   22|   64|   36|    8|   25|   41|    0|
|Lachnospiraceae UCG-008             |   10|     10|      0|     12|      0|      0|      7|     78|     25|     55|     11|   12|   29|   12|    9|   38|    0|    6|   12|    0|
|Lactobacillus                       |  111|    225|    145|    133|    330|    378|    199|    716|    541|    715|    144|  284|  415|  388|  119|  496|  172|  281|  235|  103|
|Listeria                            |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  150|
|Neisseria                           |    0|      0|      0|      0|      2|      4|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  289|
|Oscillibacter                       |  116|      9|      0|     14|     20|     24|     83|     67|     22|     52|     38|  154|  354|   34|  101|  156|   61|   83|  115|    0|
|Porphyromonas                       |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|   97|
|Pseudomonas                         |    8|      0|      0|      0|      0|      2|      0|      0|      5|      0|      0|    7|   14|    0|    2|    5|    0|    5|    6|  140|
|Rhodobacter                         |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|   52|
|Roseburia                           |  118|     41|      0|     12|      6|      5|     72|     71|     47|    132|     61|  108|  271|   38|   27|   62|   14|   71|   72|    0|
|Ruminiclostridium                   |   62|      7|      0|     11|     10|      9|     34|     63|     18|     13|     43|   69|  139|   12|   47|   69|   25|   56|   85|    0|
|Ruminiclostridium 5                 |   85|      8|      6|      8|     14|     11|     19|     42|     21|     44|     13|   69|  190|    6|   29|   64|   12|   19|   38|    0|
|Ruminiclostridium 9                 |   55|      0|     15|     14|     14|     18|     26|     78|     27|     17|      0|   43|  156|   15|   13|   11|   11|   27|   39|    0|
|Ruminococcaceae UCG-005             |    0|      0|      0|      0|      0|      7|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|Ruminococcaceae UCG-014             |    0|      4|     11|      0|     12|     16|     11|     38|     12|      7|      9|    0|    0|   11|    3|    0|    2|   11|   12|    0|
|Staphylococcus                      |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|  590|
|Streptococcus                       |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    6|    7|    7|    0|    0|    0|    0|    0|  384|
|Turicibacter                        |   80|    103|     52|     40|    113|    126|     35|    306|    270|    177|     30|    0|   17|   24|   36|    0|    0|    6|    0|    0|
|Tyzzerella 3                        |   11|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    0|    0|    7|    0|    3|   10|    0|
|unclassified_Atopobiaceae           |    0|      0|      0|      0|      0|      0|      0|      3|      0|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Bacteria               |   71|      6|      7|      0|      9|      7|      3|     41|     55|      4|      5|  116|  434|  344|   17|   93|   47|   46|   61|  112|
|unclassified_Bacteroidales          | 3153|   2781|   1636|   1492|   2389|   4088|   2058|   8894|   5933|   5822|   2384| 1429| 8670| 3221| 1719| 3584| 2667| 1647| 2313|    0|
|unclassified_Bacteroidia            |    0|      0|      3|     10|      0|     15|      0|     15|     11|      4|      4|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Christensenellaceae    |    7|      0|      4|      0|      0|      5|      0|      5|      4|      6|      6|    0|    5|    0|    0|    0|    0|    3|    0|    0|
|unclassified_Clostridiaceae 1       |    0|      0|      5|      0|      0|      0|      0|      0|      5|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Clostridiales          |   76|     17|      0|      0|      0|      6|      6|     12|     16|     14|      0|   10|   49|   21|   11|    9|   19|   12|   42|    0|
|unclassified_Coriobacteriales       |    0|      0|      0|      0|      0|      0|      2|      3|      0|      2|      0|    0|    0|    0|    0|    0|    0|    0|    3|    0|
|unclassified_Erysipelotrichaceae    |    0|      0|      2|      0|      0|      0|      0|      4|      2|      0|      0|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Firmicutes             |    0|     29|     23|     24|     16|     18|      5|     58|     94|     34|     14|    0|    0|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Lachnospiraceae        |  384|    338|     61|    161|     42|    113|    327|    397|    436|    941|    441|  723| 1182|   97|  211|  297|   95|  407|  524|    0|
|unclassified_Nostocales             |    0|      0|      5|      0|      0|      0|      0|      0|      0|      0|      0|    0|    0|    5|    0|    0|    0|   13|    0|    0|
|unclassified_Oxyphotobacteria       |    0|      0|      0|      0|      0|      0|      0|      0|      0|      0|      0|    0|    5|    0|    0|    0|    0|    0|    6|    0|
|unclassified_Peptococcaceae         |   26|     65|     14|      0|     16|     25|     30|    121|    192|    126|     65|   12|   53|   29|   31|   32|   49|   31|   47|    0|
|unclassified_Rikenellaceae          |  217|    146|     98|    111|    146|    258|    147|    560|    432|    301|     98|   40|   41|    0|    0|    0|    0|    0|    0|    0|
|unclassified_Ruminococcaceae        |   32|      9|      0|      6|      0|     10|     14|      6|     24|     25|     12|   74|  136|   17|   19|   23|    0|   31|   28|    0|
|unclassified_Saccharimonadaceae     |    0|      5|      0|      3|     10|      3|      3|     18|     18|      7|      0|   31|    6|   15|   18|   16|   18|   13|   10|    0|