HCBravoLab / metagenomeSeq

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

Error : At least one NA normalization factors #49

Closed TsStef closed 7 years ago

TsStef commented 7 years ago

Hello, I am trying to analyse differential abundances of bacterial taxa in subways. Using fitFeatureModel(). First I subset the MRexperiment object, keeping three levels of the factor "surface_type":

obj1 <- obj[, which(pData(obj)$surface_type %in% selected)]

After that I normalized the data, using default options. When fitting the model I got that error massage

Error in fitFeatureModel(obj, mod) : At least one NA normalization factors

But when I check for NA, I got: is.na(normFactors(obj1))

SRR3545898 SRR3545941 SRR3546351 SRR3546354 SRR3546358 SRR3546361 SRR3546371 SRR3546380 FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE

Can you, please, give me a hint where is my fault! Thank you!

hcorrada commented 7 years ago

Do you get the same error on the data without subsetting to the selected surface types?

TsStef commented 7 years ago

I did not get any error, when analyzing the "sampling_place" (which has just two levels). However I decided to subset the data, because there was a message:

Can't analyze currently

Probably because the factor has more than three levels. I found that line:

if(ncol(mmCount)>3){ stop("Can't analyze currently.") }

So I decided to analyze a subset of three surfaces. And then I got that error.

hcorrada commented 7 years ago

Maybe re-leveling the 'surface_type' column helps:

obj1 <- obj[, which(pData(obj)$surface_type %in% selected)]
pData(obj1)$surface_type <- factor(pData(obj1)$surface_type)
TsStef commented 7 years ago

Thanks I will try. And could you tell the reason for the "Can't analyze currently" error? Is it the factor's levels or there is another reason?

hcorrada commented 7 years ago

Ok, let us know how it goes. The fitFeatureModel model is only supported for two level factor comparisons, which gives rise to the error.