GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Tutorials Tutorials
Hangyoung Kim edited this page
Your new friends! MMseqs2 ultra fast and sensitive protein search, Linclust clustering huge protein sequence sets in linear time and Plass Protein-level assembly to increases protein sequence recovery from complex metagenomes. Here you will learn the basic usage of MMseqs2 as well as expert tricks to take advantage of the ability of chaining different MMseqs2 modules to produce custom workflows. We will use Conda to setup all required software for this tutorial. If you haven't setup Conda yet, please do so first and then execute: The generic syntax for The help text of If you are using Bash as your shell, you can activate tab-auto-completion of commands and parameters: A 61-year-old man was admitted in December 2016 with bilateral headache, gait instability, lethargy, and confusion. Because of multiple tick bites in the preceding 2 weeks, he was prescribed the antibiotic doxycycline for presumed Lyme disease. Over the next 48 hours, he developed worsening confusion, weakness, and ataxia. He returned to the referring hospital and was admitted. He lived in a heavily wooded area in New Hampshire, had frequent tick exposures, and worked as a construction contractor in basements with uncertain rodent and bat exposures. His symptoms were diagnosed as Encephalitis and the causative agent --- not known.
This pathogen is usually confirmed by a screening antibody test, followed by a plaque reduction neutralization test. However, this takes 5 weeks, which was too slow to affect the patient's care. As traditional tests done in the first week of the patient's hospital stay did not reveal any conclusive disease cause, the doctors were running out of options. Therefore a novel metagenomic analysis was performed. Metagenomic sequencing from cerebrospinal fluid was performed on hospital day 8. It returned 14 million short nucleotide sequences (reads). The authors of the study removed all human reads using Kraken (Wood and Salzberg 2014) and released a much smaller set of 226,908 reads on the SRA (https://www.ncbi.nlm.nih.gov/sra/docs/). Kraken extracts short nucleotide subsequences of length k, also called k-mers, and compares them to a reference database where k-mers point to taxonomic labels. In case of exact matching it is able to assign taxonomy.
We will use the sequence search tool MMseqs2 (Steinegger and Soeding 2017) to find the cause of this patient's disease. MMseqs2 translates the nucleotide reads to putative protein fragments, searches against a protein reference database and assigns taxonomic labels based on the found reference database hits.
To not spoil the mystery too early, we prepared a FASTA file containing the reads. Download this file first: The sequencing machine returns paired-end reads where sequencing starts in opposite directions from two close-by points to cover the same genomic region. Some of these paired reads overlap enough to be merged into a single read with FLASH (Magoc and Salzberg 2011). We will also need a reference database of proteins. For this we will use the Swiss-Prot which is the manually curated, high-quality part of the Uniprot (UniProt Consortium 2014) protein reference database. We are using this smaller subset of about 500,000 proteins, since the full Uniprot with over 175,000,000 sequences requires too many computational resources. Each protein in Uniprot has a taxonomic label. Let us prepare this database: Through a similarity search we will transfer the annotation of the reference protein to our unknown reads. MMseqs2 will create a result database in your current working directory.
This database consists of files, whose names start with In this file you see for every read a numeric taxonomic identifier, a
taxonomic rank and a taxonomic label. However, due to the large number
of reads, it is hard to gain insight by skimming the file. MMseqs2
offers a module to summarize the data into a single file
MMseqs2 can also generate an interactive visualization of the data using Krona (Ondov, Bergman, and Phillippy 2011). Adapt the previous call to generate a Krona report: This generates a Look up the following encephalitis causing agents in Wikipedia.
We now want to take a closer look only at the reads of the pathogen. To filter the result database, we will need the pathogen's numeric taxonomic identifier. Use the NCBI Taxonomy Browser to find it, by searching for its name.
Now we can call a different MMseqs2 module to retrieve only the reads that belong to this pathogen. Replace XXX with the number(s) you just found. If you found multiple, concatenate them with a comma character. We now get a list of all queries that were filtered out, meaning they were annotated as pathogenic. With a few more commands we can convert our taxonomic labels back into a FASTA file:
We want to try to recover the protein sequences of the pathogen.
We will use the protein assembly method Plass (Steinegger, Mirdita, and Söding 2019) to find overlapping reads and generate whole proteins out of the best matching ones. Take a look at the generated FASTA file
Plass will uncover a lot of variation in the reads and output many similar proteins. We can use the sequence clustering module in MMseqs2 to get only representative sequences. You will see three files starting with
Take a look at the last one
We will look for known protein domains to identify the proteins we found. Instead of the MMseqs2 command line, we use the MMseqs2 webserver, which will visualize the results. Paste the content of the FASTA file containing the representative sequences into the webserver and make sure to select all three target databases (PFAM, PDB, Uniclust): https://search.mmseqs.com
Despite being able to identify the causative agent. The pathogen is very hard to treat. The patient had minimal neurological recovery and was discharged to an acute care facility on hospital day 30. Seven months after discharge, he was reportedly able to nod his head to questions and slightly move his upper extremities and toes. You can find the publication about this patient and dataset here (Piantadosi et al. 2018). Please look at it only after trying to answer the questions yourself. UniProt Consortium. 2014. "UniProt: A Hub for Protein Information." Nucleic Acids Research 43 (D1): D204--D212. Magoc, Tanja, and Steven L. Salzberg. 2011. "FLASH: Fast Length Adjustment of Short Reads to Improve Genome Assemblies." Bioinformatics 27 (21): 2957--63. Ondov, Brian D, Nicholas H Bergman, and Adam M Phillippy. 2011. "Interactive metagenomic visualization in a Web browser." BMC Bioinformatics 12 (1): 385. Piantadosi, Anne, Sanjat Kanjilal, Vijay Ganesh, Arjun Khanna, Emily P Hyle, Jonathan Rosand, Tyler Bold, et al. 2018. "Rapid Detection of Powassan Virus in a Patient With Encephalitis by Metagenomic Sequencing." Clinical Infectious Diseases 66 (5): 789--92. Steinegger, Martin, Milot Mirdita, and Johannes Söding. 2019. "Protein-level assembly increases protein sequence recovery from metagenomic samples manyfold." Nature Methods 16 (7): 603--6. Steinegger, Martin, and Johannes Soeding. 2017. "MMseqs2: Sensitive Protein Sequence Searching for the Analysis of Massive Data Sets." bioRxiv, 079681. Wood, Derrick E, and Steven L Salzberg. 2014. "Kraken: ultrafast metagenomic sequence classification using exact alignments." Genome Biology 15 (3): R46. Download an example input contig and create a MMseqs2 database: Use If you wish to examine the 19 annotated proteins coded on this contig, you can download them too (they won't be used in the tutorial):
As you can see by examining the files with the swissprot prefix, the downloaded database is an MMseqs2 seqTaxDb (read more about the format). The following command runs the 4-step contig taxonomy workflow. It extracts protein fragments in six frames and searches them against SwissProt using the accelerate 2bLCA method ( The raw Let's take a closer look at the assignment: The contig has been assigned at the species level to taxid 4932 (Saccharomyces cerevisiae). The assignment is based on 32 protein fragments, which passed the fast prefilter selection (step II of the TaxPerContig algorithm). Of these, all 32 fragments received a label and of these, 30 agree with the label assigned to the contig (i.e., they were assigned to species 4932 or to a strain below it). The fraction of This visualization can be created for the contigs assignments as well as for the fragment assignments to see the distribution of labels among them. To create a Krona ( To create a Kraken report ( The MMseqs2 Wiki provides further information about other taxonomic modules in MMseqs2 (e.g., creating subdbs of a seqTaxDb) and the various parameter values (e.g., controlling the LCA modes). We will show on a human gut metagenomic dataset (SRA run We use Plass to assemble a catalogue of protein sequences directly from the reads, without the nucleic assembly step. It recovers 2 to 10 times more protein sequences from complex metagenomes than other state-of-the-art methods and can assemble huge datasets. First we will load the dataset from the SRA with Alternatively, the reads can be downloaded directly from the European Nucleotide Archives's download server: The standard genomic assemblies prevent many reads to assemble due to low coverage and micro-diversity. To run this protein-level assembly, use the command or type As a matter of comparison, run the usual pipeline using MegaHit for genomic assembly: Then extract proteins using Prodigal in metagenomics mode: Take a look at the FASTA files produced by Plass and Prodigal. To check
the number of detected proteins, you can count the number of FASTA
headers (lines beginning with the Since Plass assembles with replacement of reads, the catalogue will
contain some redundancy. You can reduce this catalogue by clustering it,
for instance, to 90% of sequence identity, and asking for the
representative sequence that cover at least 95% of the members. For
this, you can either use the Both the default MMseqs2 clustering and Linclust link two sequences by an edge based on three local alignment criteria:
You can count the number of cluster representatives in the FASTA file
The previous You can convert a FASTA file to the MMseqs2 database format using: This generates several files: a data file
MMseqs2 database format, through which all MMseqs2 modules can be easily and efficiently chained. The corresponding headers are stored in a separate database with a The The The format of this index file is tab-separated and reports one line per entry in the database, specifying a unique key (column 1), the offset and the length of the corresponding data (columns 2 and 3 respectively). As we will make use of the efficient structure later on in the tutorial, you can already take a look at the index file structure with: Let's re-run the clustering of the catalogue database with our fresh database: This creates a cluster database where each entry has the key of its representative sequence, and whose data consists of the list of keys of its members: Note: This is a general principle in MMseqs2: the keys are always consistent between databases (input and output, clustering and sequence databases, and potentially intermediate files. Therefore, to count the number of clusters, you can count the number of lines in the index file using: To get domain annotation for your protein catalogue, we search the sequences against a database of Pfam profiles. To do this, we have to setup this profile database first: Now we can annotate our sequences against this database: You can post-process the annotation file to retrieve only annotations of high confidence: An advanced way to extract the entries that did not get a reliable annotation uses the fact that if no hit was found for a given sequence, the corresponding entry in the data file will be empty, resulting in a data length of 1 (for the null byte) in the index file: You can compare (time and number of annotation) with HMMER3. However, we have to again create the database first: We will take advantage of MMseqs2's modular architecture to create a workflow (bash script) that calls MMseqs2 tools to deeply cluster a set of proteins. Let's first create a cascaded clustering workflow: after a first clustering step, the representative sequences of each of the clusters are searched against each other and the result of the search is again clustered. By repeating this procedure iteratively, one gets a deeper clustering of the original set. Try to code complete the following script: Try your script with 3 steps, and check the clustering depth (number of clusters) at each step: What do you notice? To make a deeper clustering of your protein set, one idea is to create a
cascaded clustering where the sequence search at every iteration is
replaced by a profile to sequence search (more sensitive search than
sequence to sequence searches). Write your own workflow that will be
using the Did you manage to cluster more deeply? You can get the distribution of your cluster sizes by calling: Compare this clustering to your first cascaded clustering. Let's check the most abundant genes in our dataset. To this end, we want to map the ORFs from the reads to the protein catalogue, and count the number of hits on each of the proteins. Write an MMseqs2 workflow that:
We can use Based on the explanation of the Linclust algorithm, try to code its workflow using:
Take a look at the real Linclust workflow.
This version is slightly more involved as it integrates a redundancy
reduction step (the We hope that you are more familiar with the MMseqs2 environment, and that you enjoy its modularity and flexibility for creating new workflows. Due to time and virtual machine constraints we chose a rather small metagenomic dataset, but using MMseqs2 on bigger datasets should convince you of its scalability. Eddy, Sean R. 2009. "A New Generation of Homology Search Tools Based on Probabilistic Inference." In Genome Informatics 2009: Genome Informatics Series Vol. 23, 205--11. World Scientific. Hyatt, Doug, Gwo-Liang Chen, Philip F LoCascio, Miriam L Land, Frank W Larimer, and Loren J Hauser. 2010. "Prodigal: Prokaryotic Gene Recognition and Translation Initiation Site Identification." BMC Bioinformatics 11 (1): 119. Li, Dinghua, Chi-Man Liu, Ruibang Luo, Kunihiko Sadakane, and Tak-Wah Lam. 2015. "MEGAHIT: An Ultra-Fast Single-Node Solution for Large and Complex Metagenomics Assembly via Succinct de Bruijn Graph." Bioinformatics 31 (10): 1674--6. Steinegger, Martin, Milot Mirdita, and Johannes Söding. 2019. "Protein-Level Assembly Increases Protein Sequence Recovery from Metagenomic Samples Manyfold." Nature Methods 16 (7) 603-609. Steinegger, Martin, and Johannes Söding. 2017. "MMseqs2 Enables Sensitive Protein Sequence Searching for the Analysis of Massive Data Sets." Nature Biotechnology 35 (11): 1026. Steinegger, Martin, and Johannes Söding. 2018. "Clustering Huge Protein Sequence Sets in Linear Time." Nature Communications 9 (1): 2542. |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |