benjjneb / decontam

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

Reading in data as a phyloseq object using readRDS() #72

Open NaomiHuntley opened 4 years ago

NaomiHuntley commented 4 years ago

Dear All,

I am looking at the Decontam vignette but I am stuck at the beginning where you read in the data with the following code:

ps <- readRDS(system.file("extdata", "MUClite.rds", package="decontam"))

I am familiar with reading in data as a phyloseq object, using the code:

ps <- phyloseq(otu_table(as.matrix(ASV), taxa_are_rows=TRUE), sample_data(meta), tax_table(as.matrix(tax)))

However, the issue I am having is if I read in the data as a phyloseq object in the manner that I did before, I do not have the quant_reading column that seems to be an important component in the remaining steps. Can you please help me to understand what the inputs should be in the code in your vignette?

Thank you! Naomi

benjjneb commented 4 years ago

Can you clarify: You are trying to follow the tutorial? But... you are adding an additoinal step with ps <- phyloseq(...) into the tutorial workflow? Or... are you trying to appply this workflow to your own data and that is the problem?

NaomiHuntley commented 4 years ago

I am trying to follow the tutorial on my own data to read in the data using the code:

ps <- readRDS(system.file("extdata", "MUClite.rds", package="decontam")) but I do not know what the inputs should be for my own data for "extdata" and "MUClite.rds"

benjjneb commented 4 years ago

For your own data there shouldn't even be a "extdata" or "MUClite.rds" probably. Those are directories and filenames intended to read in an example phyloseq object.

For your data, have you generated a phyloseq object already? If so, that's what to work with. Doest it include data about the DNA concentrations in each sample? If so, under what column name?

NaomiHuntley commented 4 years ago

Yes I made a ps object using this code:

ps <- phyloseq(otu_table(as.matrix(ASV), taxa_are_rows=TRUE), sample_data(meta), tax_table(as.matrix(tax)))

So I think the problem is that I do not have the quant_reading column the same way that your ps object did.

benjjneb commented 4 years ago

Yes, if you don't have that column in your meta data.frame. then it won't work exactly as written. Is that data in another form or under another name in that data.frame? If so, you can potentially just change the name of the colum in the code and apply the tutorial workflow. If not, then you don't have the necessary information in your data.