benjjneb / decontam

Simple statistical identification and removal of contaminants in marker-gene and metagenomics sequencing data
https://benjjneb.github.io/decontam/
147 stars 25 forks source link

Export data from prevalent option #119

Closed K-Gutierrez closed 2 years ago

K-Gutierrez commented 2 years ago

Hi, this is an excellent program for checking contamination in amplicon sequencing samples. I am new in R, so I am following this tutorial: https://benjjneb.github.io/decontam/vignettes/decontam_intro.html#putting-it-all-together

I have two questions:

1) How can I remove the contaminants using the prevalence option, I am looking for a similar command such as you wrote in the Frequency section:

$ps

phyloseq-class experiment-level object

otu_table() OTU Table: [ 1951 taxa and 569 samples ]

sample_data() Sample Data: [ 569 samples by 6 sample variables ]

tax_table() Taxonomy Table: [ 1951 taxa by 6 taxonomic ranks ]

$ps.noncontam <- prune_taxa(!contamdf.freq$contaminant, ps) ps.noncontam

phyloseq-class experiment-level object

otu_table() OTU Table: [ 1893 taxa and 569 samples ]

sample_data() Sample Data: [ 569 samples by 6 sample variables ]

tax_table() Taxonomy Table: [ 1893 taxa by 6 taxonomic ranks ]

2) I would like to use the combined method. What is the command that I need to run?

Thanks in advance.

benjjneb commented 2 years ago

On (1), You would use the same command to remove the taxa idenfied as contaminants, whatever methods you are using. All of them create a TRUE/FALSE vector in the $contaminant column of the returned data.frame that indicates the classified contaminants.

On (2), just set isContaminant(..., method="combined"). You'll also need to provide both the conc and neg arguments to the function as well (see the argument descriptions in ?isContaminant).

K-Gutierrez commented 2 years ago

Awesome! thanks so much for your answer :)