decontam icon indicating copy to clipboard operation
decontam copied to clipboard

Some batches contain zero or one samples.

Open nhg12 opened this issue 3 years ago • 8 comments

Hi

I am trying to use decontam on my data and I keep getting this error:

Error in isContaminant(physeq2, method = "frequency", conc = "quant_reading") : Some batches contain zero or one sample.

I have checked my data there are no zero quantity values and I have removed the samples with zero OTUs.

What can be going wrong? Please help

nhg12 avatar Jul 23 '20 03:07 nhg12

Do any of your batches contain one sample or less?

You can inspect that by table(my_data_frame$batch-column)

benjjneb avatar Jul 23 '20 03:07 benjjneb

It gives this error: Error in table(otu_table$batch - column) : object 'column' not found

nhg12 avatar Jul 23 '20 03:07 nhg12

This is what I have been doing so far: ##load data in R## I've converted the BIOM ASVs file form QIIME to TSV and then to csv to load in R otu_table <- read.csv(file.choose(), header= TRUE, row.names = 1) taxonomy <- read.csv(file.choose(), header=T, row.names = 1) sample_data <- read.csv(file.choose(), row.names = 1, header =T)

###converted to a phyloseq object ###

count_tab <- otu_table(otu_table, taxa_are_rows=T) sample_info <- sample_data(sample_data) physeq2 <- phyloseq(count_tab, sample_info)

run with decontam

contamdf.freq <- isContaminant(physeq2, method="frequency", conc="quant_reading")

and then it gives me the error

Error in isContaminant(physeq2, method = "frequency", conc = "quant_reading") : Some batches contain zero or one sample.

nhg12 avatar Jul 23 '20 04:07 nhg12

How many samples are in physeq2? You can just physeq2 to get a summary of what's stored in that object.

benjjneb avatar Jul 23 '20 17:07 benjjneb

phyloseq-class experiment-level object otu_table() OTU Table: [ 8397 taxa and 1 samples ] sample_data() Sample Data: [ 1 samples by 2 sample variables ]

nhg12 avatar Jul 24 '20 02:07 nhg12

That's the problem. Your physeq2 object has just one sample in it. This is probably an issue with how you are exporting data from QIIME and importing it into R.

benjjneb avatar Jul 24 '20 13:07 benjjneb

HI

So the files that I upload have all the samples. I then do this:

count_tab <- otu_table(otu_table, taxa_are_rows=T) sample_info <- sample_data(sample_data) physeq2 <- phyloseq(count_tab, sample_info)

This is when it considers them as 1 sample. What am I doing wrong?

I have made a biom file and then a tsv file and then a csv file to import in R

nhg12 avatar Jul 27 '20 03:07 nhg12

I'm not sure. Is this being exported from QIIME2? If so I think they have developed documentation about how to export QIIME2 data into R as a phyloseq object that you should take a look at.

In fact someone's made an R pakage for just that purpose: https://github.com/jbisanz/qiime2R

benjjneb avatar Jul 27 '20 16:07 benjjneb