tdepke / CluMSID

Clustering of MS² Spectra for Metabolite Identification
MIT License
10 stars 3 forks source link

mergeMS2Spectra doesn't work for some of the peaktables #5

Open zmahnoor14 opened 3 years ago

zmahnoor14 commented 3 years ago

Hello,

I am using CluMSID for its basic two functions:

extractMS2spectra

ms2list <- extractMS2spectra(posModeFile.mzML) ms2list[[1]]

An object of class "MS2spectrum" id:
annotation:
precursor: 98.51205 retention time: 30.17588 polarity: negative MS2 spectrum with 28 fragment peaks neutral loss pattern with 0 neutral losses

So, first issue is that it reads the positive file as negative (but correctly detects negative files as negative)

Then I use a peak table that looks like this:

ID | mzmed | rtmed chr | dbl | dbl

M_1 | 98.51205 | 31.8 M_2 | 115.96410 | 32.4 M_3 | 97.93247 | 33.0 . . .

and use the second function which is: mergeMS2spectra

featlist2 <- mergeMS2spectra(ms2list, peaktable = inclusion_list, exclude_unmatched = TRUE)

This is the error message:

Error in names(x) <- value: Attribute 'names' [4] must have the same length as the vector [0]. Traceback:

  1. mergeMS2spectra(ms2list, peaktable = inclusion_list, exclude_unmatched = TRUE)
  2. colnames<-(*tmp*, value = c("mz", "rt", "med.mz", "med.rt"))

Note: This second function works fine with some mzml files and their peak lists and doesn't work with others. I made sure to see if there is any difference in the input data I give to the second function, but both that work and that do not work have same data class.

Can you guide me why I encounter this error and is there a solution?

Kind Regards, Mahnoor

sneumann commented 1 year ago

Hi, was that fixed in e75ab8a2b6537a8aa68ad5b6a6cab9af03ae4881 ? Yours, Steffen