jcapelladesto / geoRge

geoRge: a computational tool for stable isotope labelling detection in LC/MS-based untargeted metabolomics
GNU General Public License v3.0
10 stars 6 forks source link

Problem running geoRge without different condition classes #4

Closed sneumann closed 7 years ago

sneumann commented 8 years ago

Hi, the following code triggers an Error in apply(meanintensities, 2, function(x) all(x < PuInc.int.lim)) : dim(X) must have a positive length . Jordi can reproduce the issue and is working on it. Yours, Steffen

library(xcms)
library(geoRge)
data(mtbls213)

sampclass(mtbls213) <- c(rep("CELL_Glc12_05mM_Normo", 6), rep("CELL_Glc13_05mM_Normo", 6))
s1 <- PuInc_seeker(XCMSet=mtbls213,ULtag="CELL_Glc12",Ltag="CELL_Glc13",sep.pos="f")

s2 <- basepeak_finder(PuIncR=s1,XCMSet=mtbls213,ULtag="CELL_Glc12",Ltag="CELL_Glc13",
  sep.pos="f",UL.atomM=12.0,L.atomM=13.003355,
  ppm.s=6.5,Basepeak.minInt=2000)
jcapelladesto commented 8 years ago

Dear Steffen,

Could you please confirm if the problem with 1 condition only is solved for you.

Thank you,

Jordi

sneumann commented 8 years ago

Hi Jordi, no, I am afraid not, but currently I don't have access to the actual error message, but will send an updated example. Yours, Steffen

sneumann commented 8 years ago

So the issue is that conditions is empty after this little magic:

conditions <- levels(classv)
if(sep.pos=="f"){
    conditions <- gsub(paste(ULtag,separator,sep=""),"",conditions)[-grep(paste(Ltag,separator,sep=""),conditions)]
    }else{
    conditions <- gsub(paste(separator,ULtag,sep=""),"",conditions)[-grep(paste(separator,Ltag,sep=""),conditions)]
}

We have:

> classv
 [1] Lab13   Lab13   Lab13   Lab13   Lab13   Lab13   Lab13   Lab13   NoLab12 NoLab12 NoLab12 NoLab12 NoLab12 NoLab12 NoLab12 NoLab12
Levels: Lab13 NoLab12
> conditions
[1] "Lab13"   "NoLab12"

and parameters

XCMSet=xset3
XCMSmode="maxo"
ULtag="NoLab12"
Ltag="Lab13"
separator="_"
sep.pos=1
fc.threshold=1.2
p.value.threshold=0.05
PuInc.int.lim=5000

Hope that helps, yours, Steffen

sneumann commented 8 years ago

So, the minimum code to reproduce the remaining issue is

library(xcms)
library(geoRge)
data("mtbls213")
sampclass(mtbls213) <- c(rep("Glc12", 6), rep("Glc13", 6))
s1 <- PuInc_seeker(XCMSet=mtbls213,ULtag="Glc12",Ltag="Glc13",sep.pos="f")

What about using the phenoData() ? Users would provide the column name that contains the labeling, so no need to do the manual parsing. Yours, Steffen

jcapelladesto commented 8 years ago

Dear Steffen,

The way I corrected the function in last patch does not work if there is no separator ("_") next to the sampclasses vector. Also, the value for sep.pos needs to be either "f" for front or "b" for back, which means if the ULtag/Ltag are found before or after the separator.

So even if this does not work:

data("mtbls213")
sampclass(mtbls213) <- c(rep("Glc12", 6), rep("Glc13", 6))
s1 <- PuInc_seeker(XCMSet=mtbls213,ULtag="Glc12",Ltag="Glc13",sep.pos="f")

This is solved by adding, "_A" at the end of each of sampclasses:

data("mtbls213")
sampclass(mtbls213) <- c(rep("Glc12_A", 6), rep("Glc13_A", 6))
s1 <- PuInc_seeker(XCMSet=mtbls213,ULtag="Glc12",Ltag="Glc13",sep.pos="f")

I will try to modify the code so it works in the case you brought up, but if you need to run geoRge asap, adding a separator followed by a short string should work for you.