Open breidan opened 4 years ago
Hi, thanks for reporting. I might vaguely recall that NA indeed causes issues, maybe there should've been a proper error message to run fillPeaks. Yours, Steffen
Hi Steffen,
because I had applied fillPeaks
to my xcmsSet
I investigated a bit further and am certain now that it is a bug.
findIsotopesWithValidation
assigns intValues
with a median(...,na.rm=TRUE)
from groupval(object@xcmsSet)
. Then it assigns snValues
with a median(...)
with the default na.rm=FALSE
from object@xcmsSet@peaks
. Downstream the division of intValues/snValues
defines the value of isotopeProportionFits
.
I am investigating FTMS data which inherently might have empty scan regions where fillPeaks
even with the most relaxed settings will not find peaks. That will generate NAs in the sn
column of xcmsSet@peaks but remove all NAs in groupval(object@xcmsSet)
.
So I am between a rock and a hard place now: run fillPeaks
, introduce NAs in the sn
column and findIsotopesWithValidation
will fail. Or don't run fillPeaks
, no NAs in sn
but groupval(object@xcmsSet)
with only NAs in some groups. That will return an NA
in intValues
and also make findIsotopesWithValidation
fail.
Setting median(..., na.rm = TRUE)
for the assignment of snValues
will resolve this for all cases where there is at least one sn
value in a group. And it certainly works for my data.
EDIT: I just realized that I had set object@sample
to a certain single sample index. If set to the default NA
findIsotopesWithValidation
will run through with my data set if I DO NOT run fillPeaks
over my data.
Running
findIsotopesWithValidation
on axsAnnotate
object it throws the error:Fehler in if (!isotopeProportionFits) { : Fehlender Wert, wo TRUE/FALSE nötig ist
(sorry German locale :-)) I believe the reason is that object@xcmsSet@peaks contains NAs in thesn
column. This leads tosnValues
of NA which subsequently in functionfindIsotopesForPS
causesisotopeProportionFits
to be assigned a NA instead of a TRUE/FALSE. A solution could be to setna.rm=TRUE
for themedian
which calculatessnValues
for the different groups. Just like it is done for the calculation ofintValues
.Cheers