Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using decontam with SE object, is there a way to remove contaminant sequences? #374

Open
AnnaKaisanLahti opened this issue Jun 21, 2023 · 2 comments
Assignees

Comments

@AnnaKaisanLahti
Copy link

While decontam functions isContaminant and isNotContaminant are made available for SummarizedExperiment object, is there adaptation for prune_taxa() function for SE object? In other words, I was able to identify the contaminants in the SE object but not able to remove them. One solution was to convert SE to phyloseq object, identify and remove contaminant sequences and then convert back to SE object, but that is not horribly convenient.

@TuomasBorman
Copy link
Contributor

Hello!

Does this work for your purpose?


library(TreeSummarizedExperiment)

# Toy data
tse <- makeTSE()

# Plot original tree
plot(rowTree(tse))

# "Find" contaminants (get just randomly which are "contaminated")
contaminant <- sample(c(TRUE, FALSE), nrow(tse), replace = TRUE)

# Prune tree
tse_sub <- subsetByLeaf(tse, rowLeaf = rowLinks(tse)[ contaminant , "nodeLab"])       

# Plot the subsetted tree
plot(rowTree(tse_sub))

-Tuomas

@antagomir
Copy link
Member

Perhaps to add example in OMA under subsection "Removing contaminated sequences" or something?

Unless I am mistaken, this example is showing how to keep contaminated sequences only. Perhaps showing how to keep non-contaminated sequences only would be more directly helpful?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

4 participants