lgatto / MSnbase

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

Error in addIdentificationData #531

Closed InduKhatri closed 3 years ago

InduKhatri commented 3 years ago

Hello,

I have been trying to merge the quantification data with the feature data frame in a following way:

# Loading the peaks generated using Peptide Shaker from raw files rawms <- readMgfData("CRC_iTRAQ_24.mgf", centroided=FALSE, verbose = FALSE) bp <- MulticoreParam(2L) qntms <- quantify(rawms, reporters = iTRAQ4, method = "trap", BPPARAM = bp)

# Loading the identity file generated using Peptide Shaker mzidentity <- mzID("CRC_24_mz.mzid") flatResults <- flatten(mzidentity)

# Filtering the identity files with assignemnts of corresponding columns flatResults1 <- filterIdentificationDataFrame(flatResults,accession = "accession", rank="rank", decoy ="isdecoy",spectrumID ="spectrumid")

# Combining the data Combined <- addIdentificationData(object=qntms, id = flatResults1 )

However, I get the following error: Error in filterIdentificationDataFrame(id, accession = accession, rank = rank, : argument "decoy" is missing, with no default

decoy is assigned in filterIdentificationDataFrame and the filtering was perfromed accordingly, but the error is still about decoy.

Please let me know if more information is required.

lgatto commented 3 years ago

I believe you need to specify decoy = "isdecoy" in addIdentificationData.

Note that you can also pass the mzid file name directly to addIdentificationData(), rather than loading, flattening and filtering yourself.

InduKhatri commented 3 years ago

I tried it in the format you mentioned but I still get an error. Can you suggest what to do in this case?

Combined <- addIdentificationData(object=qntms, id = mzidentity, decoy="isdecoy",accession = "accession", rank="rank",spectrumID ="spectrumid")

Error in h(simpleError(msg, call)) : error in evaluating the argument 'X' in selecting a method for function 'sapply': non-character argument

lgatto commented 3 years ago

Try addIdentificationData(object = qntms, id = "CRC_24_mz.mzid").

Note that this code will load your data with mzR instead of mzID - not sure if this will matter for you.

InduKhatri commented 3 years ago

"mzR" or "mzID" does not matter. I want to add the fData to the object

Using above suggestion, I still get the following error.

Error in (function (cond) : error in evaluating the argument 'X' in selecting a method for function 'lapply': bad lexical cast: source type value could not be interpreted as target

lgatto commented 3 years ago

Hmmm, no clue what that error means. Could you share the mgf and mzid files?

InduKhatri commented 3 years ago

I have put the file on WeTransfer as it was larger than the allowed file size.

https://we.tl/t-RzXdSrwOzn

lgatto commented 3 years ago

mzR isn't able to parse your mzid file (that what produces the error) - this sometimes happens with some software. So it does matter.

The following seems to work:

addIdentificationData(object = qntms, id =  flatResults1,
                      spectrumID = "spectrumid",
                      decoy = NULL,
                      rank = NULL,
                      desc = "description",
                      pepseq = "pepseq",
                      acc = "accession",
                      fcol = "TITLE",
                      icol = "spectrum title")
InduKhatri commented 3 years ago

Thank you! This is helpful.