Explain: Mapping - AndreaRP/METAGENOMICS GitHub Wiki

Theory

So we already understand what our reads are and why we need to trim them.

But even beautifully trimmed reads by their own are little more than just random letters. In order to get information from them we must observe them in a context. For our purpose, the context is the identity of the organism they come from and their location in it's genome.

Alignment and mapping

Aligning consists in comparing each of our reads to a reference sequence. The concept is as simple as that (even if the algorithm is not). When mapping, the algorithm will try to find a segment in the reference sequence which matches the read (tolerating a certain amount of mismatches); ideally each read would match only one position in the reference genome, thus providing us with the context we were looking for.

Alignment image

Imagine we are mapping our reads with the virus database. If one of the reads aligned perfectly with part of the reference sequence of 'Human influenza A (H7N9)' we could be reasonably sure that that read came from that virus, which was present in the sample; and we would know exactly in what position in the genome it was.

Of course, in real life matters are not so simple. Sequencing and mapping errors are common (not to mention contamination and other methodology errors), and we have to be prepared to accept some degree of uncertainty into our analysis. For instance, when mapping, the same read can be aligned to more than one reference and we must rely on the next steps of the analysis to get a reasonably accurate taxonomic classification.

Hands on

Previously, in Metaganomics....

Before being able to start mapping, you should have performed a quality control of your raw reads. Neatness is important!

Mapping

So we have trimmed the reads and we are ready to find out what our samples are hiding. The next thing we should do is deciding to what organism each read belongs. Of course, there are thousands of possibilities so we will start by loosely assigning reads to broad categories; that is where mapping comes in. The following steps explain briefly how to achieve this.

1. Host filtering

The first thing to do is getting rid of the host reads. We already know the host DNA is there, and we don't want it confusing the computer and meddling with the rest of the analysis. Here you can get instructions to filter the host off your reads.

2. Lax classification

Once we have only non-host reads we can start assigning the reads to taxonomy groups. This software differentiates between 4 main groups, more by convenience than anything strictly formal. We find that researchers usually want to focus on one the following categories, so we have separated them to make things just a little bit easier:

  • Bacteria: gets the reads assigned to bacteria after mapping against the bacteria reference genomes. It uses both 16S classification and Whole Genomes.
  • Virus: gets the reads assigned to virus after mapping against the virus reference genomes.
  • Fungi: gets the reads assigned to fungi after mapping against the fungi reference genomes. It uses both ITS classification and Whole Genomes.
  • Parasite: gets the reads assigned to parasites after mapping against the parasites reference genomes. It maps against invertebrate and protozoa Whole Genome references.

Please note there is no specific order in which the group classification must be done, they can even be run simultaneously.

IMPORTANT! You can run one or more than one mapping scripts, but keep in mind that you will only be able to proceed to more precise organism classification if the corresponding mapping has been previously done. That is, if you run fungi and virus mapping scripts you will be able to find out later on which virus strains and fungi species there are in your sample but not which bacteria or parasites.