[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circumvent finalize error #21

Merged
merged 1 commit into from
Mar 23, 2014
Merged

circumvent finalize error #21

merged 1 commit into from
Mar 23, 2014

Conversation

sgibb
Copy link
Collaborator
@sgibb sgibb commented Mar 23, 2014

Dear Laurent,

as already mentioned in one of my last emails I always get the following error using my branch https://github.com/sgibb/MSnbase/tree/addIdentificationData :

s <- readMSData(c("Thermo_Hela_PRTC_1_MS2cent.mzML","Thermo_Hela_PRTC_2_MS2cent.mzML"))
Reading 13193 MS2 spectra from file Thermo_Hela_PRTC_1_MS2cent.mzML
  |=====================================================================================| 100%
Reading 13265 MS2 spectra from file Thermo_Hela_PRTC_2_MS2cent.mzML
  |=====================================================================================| 100%
Error in (function (x)  : attempt to apply non-function
Caching...
Creating 'MSnExp' object

traceback()
1: (function (x)
  x$.self$finalize())(<environment>)

It is very crazy because the error is thrown but R doesn't stop. The MSnExp
object is created correctly, e.g.:

validObject(s)
[1] TRUE

length(spectra(s))
[1] 26458

i <- addIdentificationData(s, c("Thermo_Hela_PRTC_1_MS2cent.mzid","Thermo_Hela_PRTC_2_MS2cent.mzid"))
dim(fData(i))
[1] 26458    26

The master branch (MSnbase == 1.11.10) does not show this error.

Just for documentation: a similar error was described for Reference Classes by Martin Morgan in 2011
https://stat.ethz.ch/pipermail/r-devel/2011-December/062773.html

Via git bisect I tried to find the commit which introduced the error. I run git bisect twice and get the following commit both times: sgibb@22358bd
I am total confused because this commit has nothing to do with readMSData and in fact I did not changed/touched readMSData.R at all.

Using R's debug function I could identify the following line throwing the error (

fl <- sapply(assaydata, fromFile)
):

fl <- sapply(assaydata, fromFile)

I do not understand why this error occurs. According to https://stat.ethz.ch/pipermail/r-devel/2011-December/062773.html it has something to do with the methods package (and ReferenceClasses which are not involved in this line). That's why I decided to access the slot fromFile directly and avoid the use of the fromFile,Spectrum-method. And that fixes the error for me.

As I already mentioned I do not understand why the error occurs and I am not sure that my workaround is reasonable.

Could you reproduce the error using my addIdentificationData branch? What is your opinion about this workaround?

Best wishes,

Sebastian

@lgatto lgatto merged commit a309ec9 into lgatto:master Mar 23, 2014
@sgibb sgibb deleted the finalizeError branch March 23, 2014 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants