Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible bug in findIsotopesWithValidation #56

Open
breidan opened this issue May 29, 2020 · 2 comments
Open

Possible bug in findIsotopesWithValidation #56

breidan opened this issue May 29, 2020 · 2 comments

Comments

@breidan
Copy link

breidan commented May 29, 2020

Running findIsotopesWithValidation on a xsAnnotate 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 the sn column. This leads to snValues of NA which subsequently in function findIsotopesForPS causes isotopeProportionFits to be assigned a NA instead of a TRUE/FALSE.
A solution could be to set na.rm=TRUE for the median which calculates snValues for the different groups. Just like it is done for the calculation of intValues.

Cheers

@sneumann
Copy link
Owner

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

@breidan
Copy link
Author

breidan commented May 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants