HCBravoLab / metagenomeSeq

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

Output multiple taxonomic rank columns using MRcoefs #2

Closed kfontanez closed 10 years ago

kfontanez commented 10 years ago

I used the MRcoefs function to print the differentially abundant features in my dataset. However, I am only able to see one column of my taxonomic ranks which is not helpful for taxa that don't have a name at that rank (in this case, Genus). Is it possible to output multiple columns for example $Class and $Genus at the same time?

code:

taxa=sapply(strsplit(as.character(fData(Morethan10_obj)$Genus),split=","), function(i) {i[length(i)]}) MRcoefs(fit,taxa=taxa,coef=2,adjust.method="fdr",uniqueNames=TRUE) TreattypeLive pValue adjPvalue Alteromonas:1 9.456810 0.0009543425 0.4235163 Alcanivorax:1 7.386425 0.0076021288 0.4235163 Salinimonas:1 6.367855 0.0030901300 0.4235163 character(0):24 6.125422 0.0026719425 0.4235163 Marinobacter:1 6.109879 0.1102054068 0.4255193 character(0):23 6.094290 0.0186990480 0.4235163 Alteromonadales bacterium TW-7:1 5.603409 0.0441813941 0.4235163 Methylophaga:1 5.571849 0.1538143609 0.4450678 Pseudoalteromonas:1 5.515201 0.0303001389 0.4235163 character(0):22 5.402941 0.0248044687 0.4235163

Thank you! Kristina

jnpaulson commented 10 years ago

Hi Kristina!

Thanks for the comment. The code to do what you're asking would be (assuming 1) the Genus/Class are the labels and 2) you need to split the vector with a comma). If you can provide an example of the output when you display the MRexperiment object I can give a more concise response:

obj = Morethan10_obj gen = strsplit(as.character(fData(obj)$Genus),split=",") cls = strsplit(as.character(fData(obj)$Class),split=",") taxa = paste(cls,gen,sep=":") MRcoefs(fit,taxa=taxa,coef=2,adjust.method="fdr",uniqueNames=TRUE)

Please reopen the ticket if this doesn't help.