lgatto / MSnbase

Base Classes and Functions for Mass Spectrometry and Proteomics
http://lgatto.github.io/MSnbase/
123 stars 50 forks source link

invalid class “MIAPE” object: invalid object for slot "instrumentModel" in class "MIAPE": got class "list", should be or extend class "character" from Autotuner #603

Open v-v1150n opened 2 weeks ago

v-v1150n commented 2 weeks ago

Hi, I have seen issues here about cdf files and "MIAPE" object: errors. This is my situation currently: I'm using the Autotuner suite to find out the best parameters, https://github.com/KujawinskiLaboratory/Autotuner

My source file is a cdf file The error message I get is as follows:

Error in validObject(.Object) : invalid class "MIAPE" object: invalid object for slot "instrumentModel" in class "MIAPE": got class "list", should be or extend class "character"

Since there has been no response from the author of Autotuner, and my own programming skills are not very good, I am not sure how to modify their code. After I checked their source code, I saw that they use the read function readMSData of MSnbase. So I was wondering if there is a connection that can solve this problem. https://github.com/KujawinskiLaboratory/Autotuner/blob/b3642602f208461973d6a98b58c2220d44f84d0c/R/Autotuner-class.R#L29

lgatto commented 2 weeks ago

Indeed, they use MSnbase for several operations, including reading data in. Could you share a cdf file to see what happens.

v-v1150n commented 2 weeks ago

Of course, no problem, here is the link to the file: https://drive.google.com/file/d/1W-1QM39ngptvN0LtHjiszydztTdE6dug/view?usp=share_link

The following are the results of the current file reading:

image
lgatto commented 2 weeks ago

The function you use if from the MsExperiment package - that's not what Autotune uses.

Autotune uses MSnbase::readMSData(), as shown below:

> MSnbase::readMSData("~/Downloads/20140327_B-169_S043_1.cdf", msLevel. = 1, mode = "onDisk")
Polarity can not be extracted from netCDF files, please set manually the polarity with the 'polarity' method.
MSn experiment data ("OnDiskMSnExp")
Object size in memory: 6.35 Mb
- - - Spectra data - - -
 MS level(s): 1 
 Number of spectra: 18005 
 MSn retention times: 0:00 - 29:57 minutes
- - - Processing information - - -
Data loaded [Sat Jun 15 05:53:01 2024] 
Filter: select MS level(s) 1. [Sat Jun 15 05:53:01 2024] 
 MSnbase version: 2.30.1 
- - - Meta data  - - -
phenoData
  rowNames: 20140327_B-169_S043_1.cdf
  varLabels: sampleNames
  varMetadata: labelDescription
Loaded from:
  20140327_B-169_S043_1.cdf 
protocolData: none
featureData
  featureNames: F1.S00001 F1.S00002 ... F1.S18005 (18005 total)
  fvarLabels: fileIdx spIdx ... spectrum (35 total)
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'

which works.

The error that you show is related to the experiment data and/or instrument models encoded in the resulting object, which are fine:

> experimentData(x)
Instrument : 
  Model:  (1) 
  Manufacturer: U (1) 
  Customisations:  
  Use 'msInfo(object)' for more MIAPE-MS information.
Experiment data
  Experimenter name:  
  Laboratory:  
  Contact information:  
  Contact email:  
  Title:  
  URL:  
  PMIDs:  
  No abstract available.
> instrumentModel(x)
[1] ""

Have you run Autotuner with multiple files, and (probably) with more parameters, then only that file? Please give me the exact code that lead to the error, or I won't be able to help.

v-v1150n commented 2 weeks ago

This is the result of me reading the archive using readMSData:

image

This is my result using Autotuner:

image image image

Currently I only use these three files as my experimental data. Do I need to provide any other information for your reference? thanks for your help

lgatto commented 2 weeks ago

You have the error when reading the the 2 first files in. The 3rd one, that you shared with me, works.

Could you share one of the first two.

v-v1150n commented 2 weeks ago

https://drive.google.com/file/d/1xizO3QNrcRg_f9uDfZMlRJRWDhY3CnwN/view?usp=share_link https://drive.google.com/file/d/146023iKkJ3n4i9x_t5tjn7I5VrzsvOQn/view?usp=share_link

Here is the 2 first files, thanks for your help