lgatto / MSnbase

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

Error in `sampleNames<-`(`*tmp*`, value = value) #559

Closed Jasper472 closed 2 years ago

Jasper472 commented 2 years ago

When trying to run the code according to this page in bioconductor

I get an error when running the line:

sampleNames(qnt) <- reporterNames(TMT6) Error in sampleNames<-(*tmp*, value = value) : number of new names (6) should equal number of rows in AnnotatedDataFrame (0)

I was able to read the data directly from the file using the code you provided. I tried running it as version 0.9 as well but it does not seem to help. What could be the problem?

The code I use now is:

library(MSnbase)

qnt <- readMzTabData("F063721.dat-mztab.txt", what = "PEP") sampleNames(qnt) <- reporterNames(TMT6)

on the file: F063721.dat-mztab.txt

Jasper472 commented 2 years ago

Here is the output of sessionInfo: sessionInfo_output.txt

lgatto commented 2 years ago

I didn't realise that mzTab file was from PXD000001. You need to use the following code:

> readMzTabData_v0.9("F063721.dat-mztab.txt", what = "PEP")
MSnSet (storageMode: lockedEnvironment)
assayData: 1528 features, 6 samples 
  element names: exprs 
protocolData: none
phenoData
  sampleNames: sub[1] sub[2] ... sub[6] (6 total)
  varLabels: abundance
  varMetadata: labelDescription
featureData
  featureNames: 1 2 ... 1528 (1528 total)
  fvarLabels: sequence accession ... uri (14 total)
  fvarMetadata: labelDescription
experimentData: use 'experimentData(object)'
Annotation:  
- - - Processing information - - -
mzTab read: Thu Nov 18 10:18:31 2021 
 MSnbase version: 2.20.1 
Warning message:
Version 0.9 is deprecated. Please see '?readMzTabData' and '?MzTab' for details. 
Jasper472 commented 2 years ago

Thank you! It works. I think the warning message from version9 made me wrongly assume that it was not working with that before either.