Learning, visualizing and exploring 16S rRNA structure using an attention-based deep neural network

PLoS Comput Biol. 2021 Sep 22;17(9):e1009345. doi: 10.1371/journal.pcbi.1009345. eCollection 2021 Sep.


Recurrent neural networks with memory and attention mechanisms are widely used in natural language processing because they can capture short and long term sequential information for diverse tasks. We propose an integrated deep learning model for microbial DNA sequence data, which exploits convolutional neural networks, recurrent neural networks, and attention mechanisms to predict taxonomic classifications and sample-associated attributes, such as the relationship between the microbiome and host phenotype, on the read/sequence level. In this paper, we develop this novel deep learning approach and evaluate its application to amplicon sequences. We apply our approach to short DNA reads and full sequences of 16S ribosomal RNA (rRNA) marker genes, which identify the heterogeneity of a microbial community sample. We demonstrate that our implementation of a novel attention-based deep network architecture, Read2Pheno, achieves read-level phenotypic prediction. Training Read2Pheno models will encode sequences (reads) into dense, meaningful representations: learned embedded vectors output from the intermediate layer of the network model, which can provide biological insight when visualized. The attention layer of Read2Pheno models can also automatically identify nucleotide regions in reads/sequences which are particularly informative for classification. As such, this novel approach can avoid pre/post-processing and manual interpretation required with conventional approaches to microbiome sequence classification. We further show, as proof-of-concept, that aggregating read-level information can robustly predict microbial community properties, host phenotype, and taxonomic classification, with performance at least comparable to conventional approaches. An implementation of the attention-based deep learning network is available at https://github.com/EESI/sequence_attention (a python package) and https://github.com/EESI/seq2att (a command line tool).

Publication types

  • Research Support, Non-U.S. Gov't
  • Research Support, U.S. Gov't, Non-P.H.S.

MeSH terms

  • Algorithms
  • Computational Biology
  • Databases, Genetic
  • Deep Learning*
  • Gastrointestinal Microbiome / genetics
  • Host Microbial Interactions / genetics
  • Humans
  • Inflammatory Bowel Diseases / microbiology
  • Microbiota / genetics*
  • Natural Language Processing
  • Neural Networks, Computer*
  • Phenotype
  • Prevotella / classification
  • Prevotella / genetics
  • Prevotella / isolation & purification
  • Proof of Concept Study
  • RNA, Ribosomal, 16S / classification
  • RNA, Ribosomal, 16S / genetics*


  • RNA, Ribosomal, 16S

Grants and funding

GR received fundings from National Science Foundation (https://www.nsf.gov/). The grant numbers awarded to GR are #1919691, #1936791 and #2107108 from NSF. GR received computational resources support from Extreme Science and Engineering Discovery Environment (XSEDE: https://www.xsede.org/) and XSEDE is supported by National Science Foundation (NSF: https://www.nsf.gov/) grant number #ACI-1548562. Specifically, it used the Bridges and Bridges-2 system, which are supported by NSF award number ACI-1445606 and ACI-1928147 respectively, at the Pittsburgh Supercomputing Center (PSC). The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript.