CAMERA error: $ operator not defined for this S4 class
2
6
Entering edit mode
@scottwalmsley-8321
Last seen 9.4 years ago
United States

Hi, I am trying to run findIsotopes from package CAMERA.

The following error, I believe related to igraph is produced (sessionInfo follows). Is there a fix for this, or am I doing something wrong here. The error repeats with attached code, as well as when called on other data.  Thanks in advance.

>library(CAMERA)

>  file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
>  xs   <- xcmsSet(file, method="centWave", ppm=30, peakwidth=c(5,10))

 Detecting mass traces at 30 ppm ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 456 m/z ROI's.

 Detecting chromatographic peaks ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 126  Peaks.
>  an   <- xsAnnotate(xs)
>  an   <- groupFWHM(an)
Start grouping after retention time.
Created 14 pseudospectra.
>  an   <- findIsotopes(an)
Error in x$membership : $ operator not defined for this S4 class

 

> traceback()
5: groups.default(object@xcmsSet)
4: groups(object@xcmsSet)
3: nrow(groups(object@xcmsSet))
2: findIsotopes(an)
1: findIsotopes(an)

The sessionInfo():

R version 3.2.1 (2015-06-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] CAMERA_1.24.0       igraph_1.0.1        xcms_1.44.0        
[4] ProtGenerics_1.0.0  mzR_2.2.1           Rcpp_0.11.6        
[7] Biobase_2.28.0      BiocGenerics_0.14.0

loaded via a namespace (and not attached):
 [1] graph_1.46.0        Formula_1.2-1       cluster_2.0.2      
 [4] magrittr_1.5        MASS_7.3-41         splines_3.2.1      
 [7] munsell_0.4.2       colorspace_1.2-6    lattice_0.20-31    
[10] stringr_1.0.0       plyr_1.8.3          tools_3.2.1        
[13] nnet_7.3-10         grid_3.2.1          gtable_0.1.2       
[16] latticeExtra_0.6-26 survival_2.38-2     RBGL_1.44.0        
[19] digest_0.6.8        gridExtra_0.9.1     RColorBrewer_1.1-2
[22] reshape2_1.4.1      ggplot2_1.0.1       acepack_1.3-3.3    
[25] codetools_0.2-11    rpart_4.1-10        stringi_0.5-5      
[28] scales_0.2.5        Hmisc_3.16-0        stats4_3.2.1       
[31] foreign_0.8-64      proto_0.3-10       

 

 

 

 

 

 

 

software error CAMERA • 7.0k views
ADD COMMENT
1
Entering edit mode

Based the analysis of findIsotopes on another computer, and browsing the session info from the other helpful comments,  it was found that rolling back R to 3.1.1 and igraph to version 0.7.1 regains findIsotopes functionality. Note that my install of Bioconductor and CAMERA on another computer in 2014 automatically installed igraph to the previous, compatible version. Reinstalling R today to version 3.1.1 on the workstation where the error was produced, and then installing bioconductor and camera,  installs igraph v 1.0.1.  After this,the function findIsotopes() does not work (see first session below).
Downloading igraph 0.7.1 and then updating that package by zip file does work (see second session).   I did not test this igraph rollback on R.3.2.1, so it may work there.

Since it seems there is an underlying and greater root cause for the error, I will not post this as answered yet, but consider this a temporary workaround. There are other warnings in the load of camera based on mzR and Rcpp, so as a user, I may try to roll back Rcpp as well on my system.


FIRST SESSION:   R3.1.1, igraph 1.0.1
> file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
>  xs   <- xcmsSet(file, method="centWave", ppm=30, peakwidth=c(5,10))

 Detecting mass traces at 30 ppm ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 456 m/z ROI's.

 Detecting chromatographic peaks ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 126  Peaks.
>  an   <- xsAnnotate(xs)
>  an   <- groupFWHM(an)
Start grouping after retention time.
Created 14 pseudospectra.
>  an   <- findIsotopes(an)
Error in x$membership : $ operator not defined for this S4 class

> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] CAMERA_1.22.0        igraph_1.0.1         xcms_1.42.0         
[4] mzR_2.0.0            Rcpp_0.11.6          Biobase_2.26.0      
[7] BiocGenerics_0.12.1  BiocInstaller_1.16.5

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3     cluster_2.0.2       codetools_0.2-11   
 [4] colorspace_1.2-6    digest_0.6.8        foreign_0.8-65     
 [7] Formula_1.2-1       ggplot2_1.0.1       graph_1.44.1       
[10] grid_3.1.1          gridExtra_0.9.1     gtable_0.1.2       
[13] Hmisc_3.16-0        lattice_0.20-31     latticeExtra_0.6-26
[16] magrittr_1.5        MASS_7.3-42         munsell_0.4.2      
[19] nnet_7.3-10         plyr_1.8.3          proto_0.3-10       
[22] RBGL_1.42.0         RColorBrewer_1.1-2  reshape2_1.4.1     
[25] rpart_4.1-10        scales_0.2.5        splines_3.1.1      
[28] stats4_3.1.1        stringi_0.5-5       stringr_1.0.0      
[31] survival_2.38-3     tools_3.1.1      

 

SECOND SESSION:   R3.1.1, igraph 0.7.1
DOES WORK  ==>

> file <- system.file('mzdata/MM14.mzdata', package = "CAMERA")
>  xs   <- xcmsSet(file, method="centWave", ppm=30, peakwidth=c(5,10))

 Detecting mass traces at 30 ppm ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 456 m/z ROI's.

 Detecting chromatographic peaks ...
 % finished: 0 10 20 30 40 50 60 70 80 90 100
 126  Peaks.
>  an   <- xsAnnotate(xs)
>  an   <- groupFWHM(an)
Start grouping after retention time.
Created 14 pseudospectra.
>  an   <- findIsotopes(an)
Generating peak matrix!
Run isotope peak annotation
 % finished: 20  50  60  70  80  90  100  
Found isotopes: 32


> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] CAMERA_1.22.0       igraph_0.7.1        xcms_1.42.0        
[4] mzR_2.0.0           Rcpp_0.11.6         Biobase_2.26.0     
[7] BiocGenerics_0.12.1

loaded via a namespace (and not attached):
 [1] acepack_1.3-3.3     cluster_2.0.2       codetools_0.2-11   
 [4] colorspace_1.2-6    digest_0.6.8        foreign_0.8-65     
 [7] Formula_1.2-1       ggplot2_1.0.1       graph_1.44.1       
[10] grid_3.1.1          gridExtra_0.9.1     gtable_0.1.2       
[13] Hmisc_3.16-0        lattice_0.20-31     latticeExtra_0.6-26
[16] magrittr_1.5        MASS_7.3-42         munsell_0.4.2      
[19] nnet_7.3-10         plyr_1.8.3          proto_0.3-10       
[22] RBGL_1.42.0         RColorBrewer_1.1-2  reshape2_1.4.1     
[25] rpart_4.1-10        scales_0.2.5        splines_3.1.1      
[28] stats4_3.1.1        stringi_0.5-5       stringr_1.0.0      
[31] survival_2.38-3     tools_3.1.1     

 

ADD REPLY
0
Entering edit mode

Hi

I could also find a temporal solution with R 3.2.1. I use to keep previous packages installation when I update R, so l load previous igraph and CAMERA packages and I am able to perform findIsotopes().

library(xcms)
library(igraph, lib.loc = "/home/R/3.1")
library(CAMERA, lib.loc = "/home/R/3.1")

cdffiles <- file.path(dataDir,"cdf.mzXML")
msSet <- xcmsSet(files = cdffiles, method = "centWave", ppm = 15, peakwidth = c(5,12), snthresh = 10)

Detecting mass traces at 15 ppm ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100
  2385 m/z ROI's.

  Detecting chromatographic peaks ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100
  276  Peaks.

an <- xsAnnotate(msSet)
anF <- groupFWHM(an, perfwhm = 0.6)

Start grouping after retention time.
 Created 73 pseudospectra.

anI <- findIsotopes(anF, mzabs = 0.001)

Generating peak matrix!
 Run isotope peak annotation
  % finished: 10  20  30  40  50  60  70  80  90  100
 Found isotopes: 45

R version 3.2.1 (2015-06-18)
 Platform: x86_64-pc-linux-gnu (64-bit)
 Running under: Ubuntu 14.04.2 LTS

 locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
 [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

 attached base packages:
 [1] parallel  stats     graphics  grDevices utils     datasets  methods
 [8] base

 other attached packages:
 [1] CAMERA_1.20.0       igraph_0.7.0        ggplot2_1.0.1
 [4] xcms_1.44.0         Biobase_2.28.0      ProtGenerics_1.0.0
 [7] BiocGenerics_0.14.0 mzR_2.2.1           Rcpp_0.11.6

 loaded via a namespace (and not attached):
  [1] graph_1.42.0        Formula_1.2-1       cluster_2.0.2
  [4] magrittr_1.5        splines_3.2.1       MASS_7.3-42
  [7] munsell_0.4.2       lattice_0.20-29     colorspace_1.2-6
 [10] stringr_1.0.0       plyr_1.8.3          tools_3.2.1
 [13] nnet_7.3-10         grid_3.2.1          gtable_0.1.2
 [16] latticeExtra_0.6-26 survival_2.38-3     RBGL_1.40.0
 [19] digest_0.6.8        gridExtra_0.9.1     RColorBrewer_1.1-2
 [22] reshape2_1.4.1      acepack_1.3-3.3     codetools_0.2-11
 [25] rpart_4.1-10        stringi_0.5-5       compiler_3.2.1
 [28] Hmisc_3.16-0        scales_0.2.5        stats4_3.2.1
 [31] foreign_0.8-64      proto_0.3-10

.libPaths()

[1] "/home/R/3.2"
[2] "/home/R/3.1"
[3] "/usr/local/lib/R/site-library"
[4] "/usr/lib/R/site-library"
[5] "/usr/lib/R/library"

 

But this solution is tricky, you have to be sure you don't have two versions of the same package in the two library locations. For the moment I have created a .Renviron file (see help(Startup) for info) so I don't have to use this lib.loc option in all my scripts

 

ADD REPLY
0
Entering edit mode

I am having the same problem:

library(CAMERA)
Warning message:
 replacing previous import by ‘igraph::groups’ when loading ‘CAMERA’

msSet <- xcmsSet(files = cdffiles, method = "centWave", ppm = 15, peakwidth = c(5,12), snthresh = 10)                                                                                                                               

  Detecting mass traces at 15 ppm ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100
  2385 m/z ROI's.

  Detecting chromatographic peaks ...
  % finished: 0 10 20 30 40 50 60 70 80 90 100
  276  Peaks.

an <- xsAnnotate(msSet)
anF <- groupFWHM(an, perfwhm = 0.6)
Start grouping after retention time.
 Created 73 pseudospectra.

anI <- findIsotopes(anF, mzabs = 0.001)
Error in x$membership : $ operator not defined for this S4 class

R version 3.2.1 (2015-06-18)
 Platform: x86_64-pc-linux-gnu (64-bit)
 Running under: Ubuntu 14.04.2 LTS

 locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
 [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

 attached base packages:
 [1] grid      parallel  stats     graphics  grDevices utils     datasets
 [8] methods   base

 other attached packages:
  [1] ggplot2_1.0.1       gtable_0.1.2        CAMERA_1.24.0
  [4] igraph_1.0.1        xcms_1.44.0         Biobase_2.28.0
  [7] ProtGenerics_1.0.0  BiocGenerics_0.14.0 mzR_2.2.1
 [10] Rcpp_0.11.6

 loaded via a namespace (and not attached):
  [1] graph_1.46.0        Formula_1.2-1       cluster_2.0.2
  [4] magrittr_1.5        MASS_7.3-42         splines_3.2.1
  [7] munsell_0.4.2       colorspace_1.2-6    lattice_0.20-31
 [10] stringr_1.0.0       plyr_1.8.3          tools_3.2.1
 [13] nnet_7.3-10         latticeExtra_0.6-26 survival_2.38-3
 [16] RBGL_1.44.0         digest_0.6.8        gridExtra_0.9.1
 [19] RColorBrewer_1.1-2  reshape2_1.4.1      acepack_1.3-3.3
 [22] codetools_0.2-11    rpart_4.1-10        stringi_0.5-5
 [25] compiler_3.2.1      scales_0.2.5        Hmisc_3.16-0
 [28] stats4_3.2.1        foreign_0.8-64      proto_0.3-10

 

ADD REPLY
0
Entering edit mode

Same problem here:

> library(CAMERA)

Loading required package: igraph

 

Attaching package: ‘igraph’

 

The following object is masked from ‘package:xcms’:

 

    groups

 

The following objects are masked from ‘package:BiocGenerics’:

 

    normalize, union

 

The following objects are masked from ‘package:stats’:

 

    decompose, spectrum

 

The following object is masked from ‘package:base’:

 

    union

 

Warning message:

replacing previous import by ‘igraph::groups’ when loading ‘CAMERA’

> #Create an xsAnnotate object

> xsa <- xsAnnotate(xset4)

Error in x$membership : $ operator not defined for this S4 class

 

> sessionInfo()

R version 3.2.1 (2015-06-18)

Platform: x86_64-pc-linux-gnu (64-bit)

Running under: Ubuntu 14.04.2 LTS

 

locale:

[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C         LC_TIME=C            LC_COLLATE=C         LC_MONETARY=C      

 [6] LC_MESSAGES=C        LC_PAPER=C           LC_NAME=C            LC_ADDRESS=C         LC_TELEPHONE=C     

[11] LC_MEASUREMENT=C     LC_IDENTIFICATION=C

 

attached base packages:

[1] parallel  stats     graphics  grDevices utils     datasets  methods   base    

 

other attached packages:

[1] CAMERA_1.24.0       igraph_1.0.1        xcms_1.44.0         Biobase_2.28.0      ProtGenerics_1.0.0  BiocGenerics_0.14.0

[7] mzR_2.2.1           Rcpp_0.11.6       

 

loaded via a namespace (and not attached):

[1] graph_1.46.0        Formula_1.2-1       cluster_2.0.2       magrittr_1.5        MASS_7.3-42         splines_3.2.1     

 [7] munsell_0.4.2       colorspace_1.2-6    lattice_0.20-31     stringr_1.0.0       plyr_1.8.3          tools_3.2.1       

[13] nnet_7.3-10         grid_3.2.1          gtable_0.1.2        latticeExtra_0.6-26 survival_2.38-3     RBGL_1.44.0       

[19] digest_0.6.8        gridExtra_0.9.1     RColorBrewer_1.1-2  reshape2_1.4.1      ggplot2_1.0.1       acepack_1.3-3.3   

[25] codetools_0.2-11    rpart_4.1-10        stringi_0.5-5       scales_0.2.5        Hmisc_3.16-0        stats4_3.2.1      

[31] foreign_0.8-64      proto_0.3-10       

ADD REPLY
0
Entering edit mode

Here is the output of traceback():

> traceback()
4: groups.default(xs)
3: groups(xs)
2: getPeaks_selection(xs)
1: xsAnnotate(xset4)
ADD REPLY
0
Entering edit mode

I tried to reproduce with pretty much the exact same sessionInfo() (a different windows version was the only difference) and could not. I have asked the CAMERA maintainer to take a look at this thread.

 

ADD REPLY
2
Entering edit mode
ckuhl ▴ 20
@ckuhl-8169
Last seen 9.4 years ago

I created a bugfix for this problem, which should properly imports the methods from igraph now. This is commited to the release and devel branch. They new version should be build tomorrow.

ADD COMMENT
1
Entering edit mode
@martin-morgan-1513
Last seen 4 months ago
United States

The problem is that the CAMERA package imports 'xcms::groups', as well as all symbols from the igraph package. The igraph package now defines a 'groups' S3 generic, and it is 'seen' from within CAMERA, as hinted by the warning about replacing previous imports. The solution (I think the CAMERA maintainer will address this) is to selectively import from 'igraph', or to explicitly invoke xcms::groups() in the CAMERA code. As a workaround, after loading CAMERA, one can re-define the 'groups' import to be xcms::groups, as

library(CAMERA)
imports = parent.env(getNamespace("CAMERA"))
unlockBinding("groups", imports)
imports[["groups"]] = xcms::groups
lockBinding("groups", imports)

 

 

ADD COMMENT
0
Entering edit mode

Great! Thanks, Martin! That solves my problems!

ADD REPLY

Login before adding your answer.

Traffic: 585 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6