rformassspectrometry / Spectra

Low level infrastructure to handle MS spectra
https://rformassspectrometry.github.io/Spectra/
34 stars 24 forks source link

compareSpectra function error #218

Open YANGJJ93research opened 2 years ago

YANGJJ93research commented 2 years ago

I was trying to using massbank backend in Spectra after data preprocessing by MSnbase packages. After using "chromPeakSpectra" with "return.type=spectra", the error popped up like this. felt like the compare functions in both packages went into a collision? May I know any way to use the specific compareSpectra function in Spectra? > res <- compareSpectra(mbank_sub,query_spectra,ppm=20) Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘compareSpectra’ for signature ‘"Spectra", "Spectra"’

jorainer commented 2 years ago

Yes, compareSpectra is defined both in MSnbase and Spectra - you could explicitely call the one from Spectra using res <- Spectra::compareSpectra(mbank_sub, query_spectra, ppm = 20).

I've also just finished a new (short) tutorial of using the MetaboAnnotatio package we're currently developing for MS/MS spectra matching including its use in an xcms-based analysis workflow. It's included in the SpectraTutorials page (the MS/MS Spectra Matching with MetaboAnnotation article).

YANGJJ93research commented 2 years ago

Thanks a lot. There is also an error for ppm function from "filterPrecursorMz". Please kindly find the error below. "Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘ppm’ for signature ‘"numeric"’".

YANGJJ93research commented 2 years ago

btw, I enjoyed your workshop on youtube a lot. Thanks a lot for your help!

jorainer commented 2 years ago

Regarding the error - maybe you need to load the MsCoreUtils package - the problem is again thata ppm is defined both in xcms as well as in MsCoreUtils.

YANGJJ93research commented 2 years ago

thanks. i think i installed the package in my environment. Nevertheless, i will try a reinstallation and get back to you.