dada2 icon indicating copy to clipboard operation
dada2 copied to clipboard

Removing singletons after pair merging in the Seqtab table

Open Callahan-McG opened this issue 2 years ago • 2 comments

Hello, I am a novice when it comes to R so excuse this basic question. I have been following the dada2 pipeline and have created the seqtab.nochim after pair merging and removing singletons. I noticed that I have 20 or so singletons when running the dim(seqtab.nochim) command.

So my question is, how do I remove these from my data set?

Here is my code chunk: seqtab <- makeSequenceTable(merged, orderBy='abundance') abundance_table <- table(nchar(getSequences(seqtab))) seqtab.nochim <- removeBimeraDenovo(seqtab, method = "consensus", multithread=TRUE, verbose = TRUE) dim(seqtab.nochim) sum(seqtab.nochim)/sum(seqtab)

Thank you for the help!!!

Callahan-McG avatar Mar 22 '22 20:03 Callahan-McG

The number of reads corresponding to each ASV across the whole study is available by taking the colSums of the seqtab, since each column is a different ASV. So, to remove all ASVs present only once (or less) across all samples:

is1 <- colSums(seqtab.nochim) <= 1
seqtab.no1 <- seqtab.nochim[,!is1]

benjjneb avatar Mar 22 '22 20:03 benjjneb

Thank you so much for your help! This worked.

Callahan-McG avatar Mar 22 '22 21:03 Callahan-McG