# Assembly and binning lesson learner questions
###### tags: `stamps2022`
[toc]
Below I've typed up the questions that the learners asked using their pink sticky notes. I've tried to sort them into general categories.
## General questions
+ **Is there any step that involves PCR in metagenomic sequencing, and if so, how?**
+ Typically yes (Mike *thinks* this is most typical, but not certain). Random hexamer or nonamer primers are added in order to try to amplify "everything" to generate larger quantities of DNA. (Daniel is one of our participants who might know more about this)
+ Some sequencing technologies rely on PCR in the sequencing process (e.g., Illumina). The random priming protocol described above is frequently used for low input DNA samples such as single cell sequencing.
+ **both forward and reverse reads are sequenced, but are they processed together?**
+ Usually, yes. Because PE reads add information about what reads belong together, tools like to take advantage of this information to produce more accurate outputs (e.g. longer contigs)
+ **When should you use metagenomics vs. 16S sequencing?**
+ [Here](https://astrobiomike.github.io/misc/amplicon_and_metagen) is a good overview of what each is and isn't useful for. But for a general response (with the usual caveate that things can always be more nuanced than general responses allow for, ha), if we are interested in generating hypotheses about potential functions, metagenomics is the better way to go as amplicon sequencing (of typical marker-genes like 16S) does not directly tell us anything about functional genes. But even if eventually trying to to a place to talk about potential functions, amplicon sequencing might be a useful way to first deal with many, many samples e.g. between treatments or across environmental gradients to then help us decide which samples to explore more deeply with metagenomics or other methods.
+ Here's another great source! https://merenlab.org/momics/
+ **I'm still sort of confused how you can establish identity of a sequence without a reference database (exclusively de novo)**
+ I (Mike) would say I agree with what you're thinking in that we can't establish the identity of a sequence without a reference database (if by identity we mean something like a taxonomic label or a functional annotation). But we can assemble, analyze, and group things without dependence on any reference database.
## Tools and parameters
+ **Pros/cons to different methods/tools and how to choose them**
+ See below!
+ **I am always worried about whether I am using the right tool for the right job, specially when tools are always evolving.**
+ This is a hard problem. I (Taylor) would say you have to start _somewhere_. There are a few strategies you can use to figure out where:
+ Read the literature and find a couple papers that have done something similar to what you've done. Look at the tools that they used to do it, and those are probably reasonable tools. Maybe focus on papers published in the last ~3 years, and you'll probably largely see tools that are still popular in the field.
+ Read review papers that compare and contrast tools. Look for statements of when tools do well. However, be careful about papers where the authors are evaluating their own tool, as they can find or create data sets where their tool will always do best. This isn't a problem, just something to be aware of
+ Ask on twitter! This is an astonishingly great way to get a lot of rapid feedback from experts and other opiononate people
+ Otherwise leverage your network...which now includes STAMPS2022. The slack will stay open indefinitely (?), and people often lurk for many months or years after the course. A lot of the instructors are on twitter too.
+ Also, try a few tools and see if they give you what you need (and also if they differ a lot from each other in terms of results, which should raise warning flags). More important than figuring out which tool to use, is to develop "sanity checks" that will tell you whether a tool gives you the right answer (see the discussion below about evaluating assemblies).
## Assembly
+ **How to evaluate assembly**
+ Some ideas:
+ Length of contigs -- it's useful to know how fragmented or contiguous an assembly is, even if you don't necessarily want to strive for very long in every case.
+ Re: length of contigs -- means and medians usually don't mean much since there are many small contigs that drag those values down, and ultimately make different assemblies difficult or impossible to compare to each other. Instead you can use various versions of metrics that focus on the large contigs. N50 is one such number -- it is the size of the largest contig C such that the sizes of all contigs larger than C add up to half of the genome size. For a metagenome you may not know what the "metagenome size" means, but you can use the same idea, substituting some appropriate cumulative assembly size. For example, N1M could represent the size of the largest contig C such that the sizes of all contigs larger than C add up to 1 Mbp.
+ "Read recruitment" -- the number of reads that map back to the assembly. How many of the reads in your metagenome end up actually being represented by the assembly?
+ You could taxonomically classify the reads, and then taxonomically classify the assembly (see the sourmash tutorial!). How many taxons get dropped out?
+ I (taylor) think that how you evaluate an assembly may depend on your use case, but the things above will help you "get to know" your assembly, which is helpful.
+ **What is the "scaffold" in the gaps between contigs?**
+ I'm (taylor) interpretting this question to ask what a scaffold is. Sometimes, the gap between paired end reads is large enough that 1) we know that two chunks of DNA occur next to each other in a genome and 2) The contig that one paired end read maps to assembles, and the contig that another paired end read maps to also assembles, but the paired end reads map to _different_ contigs. If we know our paired end insertion size is ~400 bp, we can _scaffold_ these contigs together, stringing them together with Ns.
+ Given that library sizes are fairly small nowadays (400-600bp), the gaps tend to be quite small, probably less than about 200bp.
+ **A clarification regarding the three different assembly methods**
+ Greedy approach: repeatedly find a pair of sequences that have a large amount of overlap and merging the two sequences into one longer sequence.
+ https://www.youtube.com/watch?v=KO2UaG8eKEw
+ Overlap lay out consensus: Reads are provided to the algorithm. Overlapping regions are identified. Each read is graphed as a node and the overlaps are represented as edges joining the two nodes involved. The algorithm determines the best path through the graph (Hamiltonian path). Redundant information (i.e., unused nodes and edges) is discarded. This process is carried out multiple times and resulting sequences are combined to give the final consensus sequence that represents the genome. ([source](https://www.researchgate.net/publication/26266221_Computational_Biology_Methods_and_Their_Application_to_the_Comparative_Genomics_of_Endocellular_Symbiotic_Bacteria_of_Insects/figures?lo=1))
+ https://www.youtube.com/watch?v=hB2i_Uwm-HQ
+ de bruijn graph: break reads down into k-mers. Each k-mer becomes a node in the graph. Identify all k - 1 overlaps between all k-mers, and draw edges between these nodes in the graph.
+ https://www.youtube.com/watch?v=OY9Q_rUCGDw
+ **Assembly methods**
+ See above :)
+ **Is assembly very different for short and long reads?**
+ Yes and no :) All (?) short and long read assemblers use one of three same basic approaches (outlined above):
+ overlap layout consensus
+ de bruijn graphs
+ greedy approach
+ In short reads, because they're so short and many of the reads don't span repetitive or complex regions, de Bruijn graphs work best. In a de Bruijn graph, each sequence (e.g. k = 31) only occurs once in the graph. This means that repetitive regions get collapsed, which isn't a problem for short reads bc we can't resolve them anyway. In long reads, we don't want to collapse repetitive regions that we have sequenced through, so the overlap layout consensus method ends up working better. The other heuristics for short vs long read assembly _do_ vary greatly, but they also vary by tool.
+ **What are some strategies to assemble HVR regions of genomes?**
+ This is a great question, highly variable regions are really hard to assemble! I (Taylor) don't have a great answer, but there are two strategies you might look into:
+ Assembly graphs to resolve these regions, a la [metacherchant](https://academic.oup.com/bioinformatics/article/34/3/434/4575138)
+ If the HVR is in a gene sequence that encodes for a protein, use a protein assembler like [PLASS](https://www.nature.com/articles/s41592-019-0437-4)
+ **what are some caveats to a co-assembly? In terms of trying to associate a MAG to a specific environment condition/sample?**
+ I'd say (Mike) that the same caveats that apply to a single assembly also apply to a co-assembly, in that what we are recovering are representations of things from super-closely related populations – e.g., we don't get 1 genome, we get a representative genome comprised of multiple genomes of a super-closely related population. Generally speaking, this may be happening to a greater extent with a co-assembly depending on what our samples are that we are co-assembling, but it definitely is not always happening to a greater extent than with individual assemblies). This is because even a single sample can host very diverse populations, or multiple samples may all hold the same \*not-very-diverse populations. And ultimately the sequence diversity affects what the assembler does, and the assembler doesn't know or care if it is trying to assemble multiple samples or one. Co-assembly can also make it easier to compare across our samples (as we then have one reference assembly for all samples that we can then map our reads and check for things like differential abundance of functions). When to co-assemble and when not is definitiely one of those fun questions that is not straightforward :+1:
+ A side-effect of strain variability (which is amplified in a co-assembly) is that the assembly may end up more fragmented as the assembler gets confused by the ambiguity. There are no good ways currently to do co-assembly well, so the results will be highly dependent on how well behaved your datasets are.
+ Another issue with co-assembly is run-time. MegaHit, which is one of the fastest assemblers, can run for over a day on even single metagenomes, so once you mix multiple samples you may quickly run out of time or memory.
## Binning
+ **What is binning (still don't understand)? Can QIIME2 be used for binning?**
+ "Binning" is attempting to group contigs (longer stretches of DNA we assembled from individual reads) into groups that we think represents a very closely related population of genomes (like what we might generally consider "the same microbe", even though there are some variations in their individual genomes). There is a nice slide at the top of [this page](https://astrobiomike.github.io/genomics/metagen_anvio) (just beneath the first busy overview figure) that might help.
+ QIIME2 is an infrastructure that incorporates many tools developed by many people that can be used outside of QIIME2 also. I don't think is has much built in for metagenomics yet, so likely no binning capabilities (it is primarily amplicon focused).
+ **How does it go from contigs to assembly bins?**
+ There is a nice slide at the top of [this page](https://astrobiomike.github.io/genomics/metagen_anvio) (just beneath the first busy overview figure) that might help.
+ **Tetramernucleotide frequency**
+ A tetramer is a k-mer of length 4. So ATCG, ATCC, ATCT, ATCA ... There are 256 of these nucleotide combinations. Because eco-evolutionary forces act on both GC content and codon usage, each genome has a tendency to use a specific set of tetramers more than others. This leads to varying abundances of these 4-mers in a genome. These abundances can be used to cluster genomes, or contigs from genomes, thereby separating that genome from any other genome. Binners take advantage of this signal, which is consistent across a genome, to group contigs together. However, this signal is squirelly enough that you need at least 2000-2500 base pairs for this to work well.
+ **Using tetramernucleotide frequency to bin**
+ See above :)
+ **What is the importance of GC content and 'k-mer', and how are these used for evaluation?**
+ See above :)
+ **How binning works...is k-mer frequency different enough between species/strains?**
+ Not always, probably usually not. But this is why "coverage" is so powerful. There is a nice slide at the top of [this page](https://astrobiomike.github.io/genomics/metagen_anvio) (just beneath the first busy overview figure) that might help (Mike's answer).
+ **How can we tell quality of binning based on FASTQ file**
+ Answer: You can't! The FASTQ file contains the raw reads, and while these are used to build the assembly and to generate coverages that are used to bin the contigs, there isn't a direct and clear way to determine the quality of the bin from the fastq file alone.
+ **If the level (strain, species, etc) of binning is up to us to decide**
+ No, it's not. You may be able to tune the binning parameters a bit to form less or more conservative bins, but generally the binning approach is "unsupervised", i.e., it clusters contigs based on how similar they are in terms of coverage profiles and k-mer frequencies.
+ **Does binning happen at the genome or chromosome level?**
+ Binning happens at the level of the assembly, which is composed on contiguous sequences. In theory, a contig could represent a full genome or a chromosome, or part of a genome or a chromosome. So in a way, it happens at both levels.
+ One major caveat with binning is that horizontally-transfered DNA (e.g., pro-phage regions) have different nucleotide composition than the main chromosome, and they tend not to be included in the bins.
## K-mers
+ **What k-mers are and why they are useful**
+ A k-mer is a word of length k in a nucleotide (or amino acid) sequences. See Titus' [lecture](https://github.com/mblstamps/stamps2022/blob/main/kmers_and_sourmash/2022-stamps-assembly-free%20class.pdf)/[tutorial](https://hackmd.io/vYaK2UngTWSkKmcpQMP6NA?view) for more information about k-mers!
+ **K-mers -- do you have to break up your reads more to have this?**
+ Yes, however the user doesn't usually do this themselves. Each tool will break down the reads into the k-mers of whatever length they need them.
## Complex environments
+ **I am still confused about how I can use metagenomics if I am working with a very diverse, less well characterized environment.**
+ I think it depends a lot on your environment. Here are some strategies below, and you might need to try...all of them to find one that works :laugh:
+ de novo metagenome assembly & binning, e.g. with ATLAS
+ you could try something like PLASS to assemble in protein space. Amino acids often have less micro-diversity, and this could help you get _something_ out. We have found that PLASS often outputs combinatorial amino acid sequences, so you might need some aggressive clustering to work with the results.
+ Assembly graphs! see the answers below if you want to try any of these approaches. Also feel free to reach out on the STAMPS slack if you want support with this...an outsized proportion of the STAMPS instructors have used assembly graphs compared to the population (Amy idk if thats a real statistical statement)
+ **How to approach *de novo* sequencing in ocean environment when there are few references**
+ See above - de novo assembly or ASV/OTU clustering does not require you to know the references. Phylogenetic analyses can help you figure out where to place the "unknown". Also, a lot of projects are using single cell data to help figure out which chunks of DNA in the environment are actually coming from a single organism.
## :tada: Assembly graphs :tada:
+ **How to read/interpret a metagenome assembly graph**
+ [Here](https://spacegraphcats.github.io/spacegraphcats/0a-primer/) is a primer on metagenomes and assembly graphs
+ I want to build and analyze assembly graphs myself
+ https://spacegraphcats.github.io
+ I want to run workflows that have been run before and see if they work for me
+ https://github.com/spacegraphcats/2018-paper-spacegraphcats: metagenome bin completion (e.g. scooping in reads that didn't assemble)
+ https://github.com/dib-lab/2021-metapangenome-example (metapangenome analysis with assembly graphs)
+ https://github.com/dib-lab/2022-dominating-set-differential-abundance-example (differential abundance analysis on the graph)
+ I want to learn more about the biological results that can come out of assembly graph analysis
+ https://www.biorxiv.org/content/10.1101/2022.06.30.498290v1
+ https://genomebiology.biomedcentral.com/articles/10.1186/s13059-020-02066-4
+ https://www.biorxiv.org/content/10.1101/2022.06.27.497795v1