HCBravoLab / metagenomeSeq

Statistical analysis for sparse high-throughput sequencing
64 stars 20 forks source link

Warning sample with one or zero features #77

Closed biobee closed 4 years ago

biobee commented 4 years ago

Hi,

With metagenomeSeq v 1.28.2, i do:

obj <- loadBiom("OTU_mc2000.biom") #no samples with depth < 2000

assayData: 1526 features, 256 samples sum(colSums(obj) == 0) [1] 0 sum(colSums(obj) >= 2000) [1] 256

Why does the following if all samples do have at least 2000 reads?

cumNormStatFast(obj) Error in cumNormStatFast(obj) : Warning sample with one or zero features

cumNormStat(obj) Default value being used. [1] 0.5

biobee commented 4 years ago

After checking the R code, it made sense. By chance, there was 1 sample with 9000 reads all in a single feature.

hlfreund commented 3 years ago

Hi there! I seem to be having this same issue and cannot figure out the problem.

I don't have any samples with 0 features, and dropped all of the singletons in my ASV table - yet I keep getting the same error.

> ITS_ASV_counts<-ITS_ASV_counts[which(rowSums(ITS_ASV_counts) > 1),which(colSums(ITS_ASV_counts) > 1)] # drop 0s and singletons 
> min(rowSums(ITS_ASV_counts))
[1] 2
> min(colSums(ITS_ASV_counts))
[1] 5
> sum(colSums(ITS_ASV_counts)==1) # sanity check
[1] 0
> 
> its_ASV_counts_mr<-newMRexperiment(ITS_ASV_counts) # *** samples - columns, OTUs - rows (not vegan format); newMRexperiment creates MRexperiment object
> 
> ITS_ASV_count_css<-cumNorm(its_ASV_counts_mr, p = (cumNormStatFast(its_ASV_counts_mr))) # Cumulative sum scaling factors: Calculates each column's quantile and calculates the sum up to and including that quantile.
Error in cumNormStatFast(its_ASV_counts_mr) : 
  Warning sample with one or zero features

Any clarity with this would be so helpful, thank you!