bam2CTSS function error from CAGEr package
1
0
Entering edit mode
@pengcheng-yang-6055
Last seen 3.6 years ago
China

During testing CAGEr package, following is the error message from `bam2CTSS` function.

> i.bam <- CAGEr:::import.bam("/path/to/file.bam",filetype="bam")
 
        -> Filtering out low quality reads...
> 
> i.ctss <- CAGEr:::bam2CTSS(i.bam,removeFirstG=TRUE,correctSystematicG=FALSE,genome="BSgenome.Bterrestris.bcm.bter1")
        -> Removing the first base of the reads if 'G' and not aligned to the genome...
Error in checkSlotAssignment(object, name, value) : 
  assignment of an object of class "IRanges" is not valid for slot 'ranges' in an object of class "GPos"; is(value, "IPos") is not TRUE

Could anyone help me out?

>  sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.5 (Santiago)

Matrix products: default
BLAS: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRblas.so
LAPACK: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRlapack.so

locale:
[1] C

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

other attached packages:
 [1] BSgenome.Bterrestris.bcm.bter1_1.1 BSgenome_1.48.0                   
 [3] rtracklayer_1.40.6                 GenomicAlignments_1.16.0          
 [5] SummarizedExperiment_1.10.1        DelayedArray_0.6.6                
 [7] BiocParallel_1.14.2                matrixStats_0.54.0                
 [9] Biobase_2.40.0                     Rsamtools_1.32.3                  
[11] Biostrings_2.48.0                  XVector_0.20.0                    
[13] GenomicRanges_1.32.7               GenomeInfoDb_1.16.0               
[15] IRanges_2.14.12                    S4Vectors_0.18.3                  
[17] BiocGenerics_0.26.0                CAGEr_1.22.3                      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19               stringdist_0.9.5.1        
 [3] lattice_0.20-35            gtools_3.8.1              
 [5] digest_0.6.17              mime_0.6                  
 [7] R6_2.3.0                   plyr_1.8.4                
 [9] ggplot2_3.0.0              pillar_1.3.0              
[11] zlibbioc_1.26.0            rlang_0.2.2               
[13] lazyeval_0.2.1             data.table_1.11.8         
[15] vegan_2.5-2                Matrix_1.2-14             
[17] splines_3.5.0              RCurl_1.95-4.11           
[19] munsell_0.5.0              shiny_1.1.0               
[21] compiler_3.5.0             httpuv_1.4.5              
[23] mgcv_1.8-23                htmltools_0.3.6           
[25] tibble_1.4.2               GenomeInfoDbData_1.1.0    
[27] XML_3.98-1.16              reshape_0.8.7             
[29] permute_0.9-4              crayon_1.3.4              
[31] later_0.7.5                MASS_7.3-49               
[33] bitops_1.0-6               grid_3.5.0                
[35] nlme_3.1-137               xtable_1.8-3              
[37] gtable_0.2.0               magrittr_1.5              
[39] scales_1.0.0               KernSmooth_2.23-15        
[41] stringi_1.2.4              som_0.3-5.1               
[43] promises_1.0.1             MultiAssayExperiment_1.0.1
[45] tools_3.5.0                colorspace_1.3-2          
[47] cluster_2.0.7-1            shinydashboard_0.7.0      
[49] beanplot_1.2               memoise_1.1.0             
[51] VGAM_1.0-6 

 

cager • 2.7k views
ADD COMMENT
1
Entering edit mode

Please do not use the import.bam function directly: it is a private function that is not exported in the namespace, and is not intended for direct use.  Instead, create a CAGEr object as explained in the package's vignette.  In case you do not need the complexity of a CAGEr object, have a look at more generic packages, such as GenomicAlignments or RSamtools.

ADD REPLY
0
Entering edit mode

Hi Charles Plessy, I have tested the example code for create CAGEexp, but failed with the following error message: invalid name for slot of class "CAGEexp": colData Thank you!

 

> library("BSgenome.Drerio.UCSC.danRer7")
> library(CAGEr)
> inputFiles = list.files( system.file("extdata", package = "CAGEr")
+     , "ctss$"
+     , full.names = TRUE)
> ce <- CAGEexp( genomeName     = "BSgenome.Drerio.UCSC.danRer7"
+     , inputFiles     = inputFiles
+     , inputFilesType = "ctss"
+     , sampleLabels   = sub( ".chr17.ctss", "", basename(inputFiles))
+     ) 
Error in .nextMethod(.Object, metadata = metadata, colData = colData,  : 
  invalid name for slot of class "CAGEexp": colData
> 
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.3 (Santiago)

Matrix products: default
BLAS: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRblas.so
LAPACK: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRlapack.so

locale:
[1] C

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

other attached packages:
 [1] BSgenome.Drerio.UCSC.danRer7_1.4.0 BSgenome_1.48.0                   
 [3] rtracklayer_1.40.6                 Biostrings_2.48.0                 
 [5] XVector_0.20.0                     GenomicRanges_1.32.7              
 [7] GenomeInfoDb_1.16.0                IRanges_2.14.12                   
 [9] S4Vectors_0.18.3                   BiocGenerics_0.26.0               
[11] CAGEr_1.22.3                      

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19                stringdist_0.9.5.1         
 [3] lattice_0.20-35             Rsamtools_1.32.3           
 [5] gtools_3.8.1                digest_0.6.17              
 [7] mime_0.6                    R6_2.3.0                   
 [9] plyr_1.8.4                  ggplot2_3.0.0              
[11] pillar_1.3.0                zlibbioc_1.26.0            
[13] rlang_0.2.2                 lazyeval_0.2.1             
[15] data.table_1.11.8           vegan_2.5-2                
[17] Matrix_1.2-14               splines_3.5.0              
[19] BiocParallel_1.14.2         RCurl_1.95-4.11            
[21] munsell_0.5.0               shiny_1.1.0                
[23] DelayedArray_0.6.6          compiler_3.5.0             
[25] httpuv_1.4.5                mgcv_1.8-23                
[27] htmltools_0.3.6             SummarizedExperiment_1.10.1
[29] tibble_1.4.2                GenomeInfoDbData_1.1.0     
[31] matrixStats_0.54.0          XML_3.98-1.16              
[33] reshape_0.8.7               permute_0.9-4              
[35] crayon_1.3.4                later_0.7.5                
[37] GenomicAlignments_1.16.0    MASS_7.3-49                
[39] bitops_1.0-6                grid_3.5.0                 
[41] nlme_3.1-137                xtable_1.8-3               
[43] gtable_0.2.0                magrittr_1.5               
[45] scales_1.0.0                KernSmooth_2.23-15         
[47] stringi_1.2.4               som_0.3-5.1                
[49] promises_1.0.1              MultiAssayExperiment_1.0.1 
[51] tools_3.5.0                 Biobase_2.40.0             
[53] colorspace_1.3-2            cluster_2.0.7-1            
[55] shinydashboard_0.7.0        beanplot_1.2               
[57] memoise_1.1.0               VGAM_1.0-6           
ADD REPLY
1
Entering edit mode

As explained in point 3.1 of the vignette, you also need:

library("MultiAssayExperiment")
library("SummarizedExperiment")
ADD REPLY
0
Entering edit mode

Hi Charles Plessy, the error remain after I loaded the two packages.

> search()
 [1] ".GlobalEnv"                          
 [2] "package:SummarizedExperiment"        
 [3] "package:DelayedArray"                
 [4] "package:BiocParallel"                
 [5] "package:matrixStats"                 
 [6] "package:Biobase"                     
 [7] "package:MultiAssayExperiment"        
 [8] "package:BSgenome.Drerio.UCSC.danRer7"
 [9] "package:BSgenome"                    
[10] "package:rtracklayer"                 
[11] "package:Biostrings"                  
[12] "package:XVector"                     
[13] "package:GenomicRanges"               
[14] "package:GenomeInfoDb"                
[15] "package:IRanges"                     
[16] "package:S4Vectors"                   
[17] "package:stats4"                      
[18] "package:BiocGenerics"                
[19] "package:parallel"                    
[20] "package:CAGEr"                       
[21] "package:stats"                       
[22] "package:graphics"                    
[23] "package:grDevices"                   
[24] "package:utils"                       
[25] "package:datasets"                    
[26] "package:methods"                     
[27] "Autoloads"                           
[28] "package:base"                        
> 
> ls()
[1] "inputFiles"
> ce <- CAGEexp( genomeName     = "BSgenome.Drerio.UCSC.danRer7"
+     , inputFiles     = inputFiles
+     , inputFilesType = "ctss"
+     , sampleLabels   = sub( ".chr17.ctss", "", basename(inputFiles))
+     )   
Error in .nextMethod(.Object, metadata = metadata, colData = colData,  : 
  invalid name for slot of class "CAGEexp": colData
ADD REPLY
1
Entering edit mode

Judging from their version numbers, the SummarizedExperiment and MultiAssayExperiment packages seem quite outdated on your system. Can you update them to the current Bioconductor release ?

ADD REPLY
0
Entering edit mode

Hi Charless Plessy, I have updated MultiAssayExperiment from 1.0.1 to 1.6.0,  and SummarizedExperiment has already in the latest version 1.10.1. But the error remain.

> library("BSgenome.Drerio.UCSC.danRer7")
> library("MultiAssayExperiment")
> library("SummarizedExperiment")
> library(CAGEr)
> inputFiles = list.files( system.file("extdata", package = "CAGEr")
+                 , "ctss$"
+                 , full.names = TRUE)
c> ce <- CAGEexp( genomeName     = "BSgenome.Drerio.UCSC.danRer7"
+                 , inputFiles     = inputFiles
+                 , inputFilesType = "ctss"
+                 , sampleLabels   = sub( ".chr17.ctss", "", basename(inputFiles))
+                 )
Error in .nextMethod(.Object, metadata = metadata, colData = colData,  : 
  invalid name for slot of class "CAGEexp": colData
> sessionInfo()
R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.5 (Santiago)

Matrix products: default
BLAS: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRblas.so
LAPACK: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRlapack.so

locale:
[1] C

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

other attached packages:
 [1] CAGEr_1.22.3                       SummarizedExperiment_1.10.1       
 [3] DelayedArray_0.6.6                 BiocParallel_1.14.2               
 [5] matrixStats_0.54.0                 Biobase_2.40.0                    
 [7] MultiAssayExperiment_1.6.0         BSgenome.Drerio.UCSC.danRer7_1.4.0
 [9] BSgenome_1.48.0                    rtracklayer_1.40.6                
[11] Biostrings_2.48.0                  XVector_0.20.0                    
[13] GenomicRanges_1.32.7               GenomeInfoDb_1.16.0               
[15] IRanges_2.14.12                    S4Vectors_0.18.3                  
[17] BiocGenerics_0.26.0               

loaded via a namespace (and not attached):
 [1] stringdist_0.9.5.1       gtools_3.8.1             purrr_0.2.5             
 [4] splines_3.5.0            lattice_0.20-35          colorspace_1.3-2        
 [7] mgcv_1.8-23              beanplot_1.2             XML_3.98-1.16           
[10] rlang_0.2.2              pillar_1.3.0             glue_1.3.0              
[13] GenomeInfoDbData_1.1.0   plyr_1.8.4               zlibbioc_1.26.0         
[16] munsell_0.5.0            gtable_0.2.0             VGAM_1.0-6              
[19] memoise_1.1.0            permute_0.9-4            Rcpp_0.12.19            
[22] KernSmooth_2.23-15       scales_1.0.0             som_0.3-5.1             
[25] vegan_2.5-2              Rsamtools_1.32.3         ggplot2_3.0.0           
[28] digest_0.6.17            stringi_1.2.4            grid_3.5.0              
[31] tools_3.5.0              bitops_1.0-6             magrittr_1.5            
[34] RCurl_1.95-4.11          lazyeval_0.2.1           tibble_1.4.2            
[37] cluster_2.0.7-1          crayon_1.3.4             tidyr_0.8.1             
[40] MASS_7.3-49              Matrix_1.2-14            data.table_1.11.8       
[43] reshape_0.8.7            nlme_3.1-137             GenomicAlignments_1.16.0
[46] compiler_3.5.0
ADD REPLY
0
Entering edit mode

Hi Charless Plessy, I have updated all the packages (after I have update the R version from 4.3 to 5.0), but the error remained the same.

ADD REPLY
1
Entering edit mode

Please confirm that you are updating packages using BiocInstaller::biocLite(), and that your package installation is correct based on BiocInstaller::biocValid().

Please also start a new R session and load only the packages required for the commands that you are trying to execute, to simplify the situation during debugging.

ADD REPLY
0
Entering edit mode

Hi Martin Morgan, thank you for your comments. I have updated (reinstalled) all the packages after updating R from 4.3 to 5.0 with install.packages(). This issue has been reported else (https://community.rstudio.com/t/rcpp-was-installed-by-an-r-version-with-different-internals/9968 ). The biocValid() pointed out that three packages were outdated. These three packages can not be updated due to the gcc verision conflict. However, they don't influence the running of CAGEr. The error remain the same. 

Thank you all! There maybe some error of my installation.

> biocValid()

* sessionInfo()

R version 3.5.0 (2018-04-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server release 6.3 (Santiago)

Matrix products: default
BLAS: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRblas.so
LAPACK: /histor/kang/yangpc/soft/R/R_soft/lib64/R/lib/libRlapack.so

locale:
[1] C

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

other attached packages:
 [1] BiocInstaller_1.30.0               CAGEr_1.22.3                      
 [3] SummarizedExperiment_1.10.1        DelayedArray_0.6.6                
 [5] BiocParallel_1.14.2                matrixStats_0.54.0                
 [7] Biobase_2.40.0                     MultiAssayExperiment_1.6.0        
 [9] BSgenome.Drerio.UCSC.danRer7_1.4.0 BSgenome_1.48.0                   
[11] rtracklayer_1.40.6                 Biostrings_2.48.0                 
[13] XVector_0.20.0                     GenomicRanges_1.32.7              
[15] GenomeInfoDb_1.16.0                IRanges_2.14.12                   
[17] S4Vectors_0.18.3                   BiocGenerics_0.26.0               

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.19             stringdist_0.9.5.1       lattice_0.20-35         
 [4] tidyr_0.8.1              Rsamtools_1.32.3         gtools_3.8.1            
 [7] assertthat_0.2.0         digest_0.6.17            R6_2.3.0                
[10] plyr_1.8.4               ggplot2_3.0.0            pillar_1.3.0            
[13] zlibbioc_1.26.0          rlang_0.2.2              lazyeval_0.2.1          
[16] data.table_1.11.8        vegan_2.5-2              Matrix_1.2-14           
[19] splines_3.5.0            RCurl_1.95-4.11          munsell_0.5.0           
[22] compiler_3.5.0           pkgconfig_2.0.2          mgcv_1.8-23             
[25] tidyselect_0.2.4         tibble_1.4.2             GenomeInfoDbData_1.1.0  
[28] XML_3.98-1.16            reshape_0.8.7            permute_0.9-4           
[31] crayon_1.3.4             dplyr_0.7.6              GenomicAlignments_1.16.0
[34] MASS_7.3-49              bitops_1.0-6             grid_3.5.0              
[37] nlme_3.1-137             gtable_0.2.0             magrittr_1.5            
[40] scales_1.0.0             KernSmooth_2.23-15       stringi_1.2.4           
[43] som_0.3-5.1              bindrcpp_0.2.2           tools_3.5.0             
[46] glue_1.3.0               purrr_0.2.5              colorspace_1.3-2        
[49] cluster_2.0.7-1          beanplot_1.2             memoise_1.1.0           
[52] VGAM_1.0-6               bindr_0.1.1             

Library path directories:
  /histor/kang/yangpc/soft/R/R_soft/lib64/R/library 

* Out-of-date packages
              Package        
RcppArmadillo "RcppArmadillo"
Rmpi          "Rmpi"         
edgeR         "edgeR"        
              LibPath                                             Installed    
RcppArmadillo "/histor/kang/yangpc/soft/R/R_soft/lib64/R/library" "0.6.100.0.0"
Rmpi          "/histor/kang/yangpc/soft/R/R_soft/lib64/R/library" "0.6-5"      
edgeR         "/histor/kang/yangpc/soft/R/R_soft/lib64/R/library" "3.18.1"     
              Built   ReposVer     
RcppArmadillo "3.3.2" "0.9.100.5.0"
Rmpi          "3.2.2" "0.6-7"      
edgeR         "3.5.0" "3.22.5"     
              Repository                                              
RcppArmadillo "https://cran.rstudio.com/src/contrib"                  
Rmpi          "https://cran.rstudio.com/src/contrib"                  
edgeR         "https://bioconductor.org/packages/3.7/bioc/src/contrib"

update with biocLite()

Error: 3 package(s) out of date
ADD REPLY
1
Entering edit mode

In a new session, I have

> library(CAGEr)
> CAGEexp
class generator function for class “CAGEexp” from package ‘CAGEr’
function (...)
new("CAGEexp", ...)
<bytecode: 0x7faf493f3b78>
<environment: namespace:CAGEr>
> getClass("CAGEexp")
Class "CAGEexp" [package "CAGEr"]

Slots:

Name:  ExperimentList        colData      sampleMap       metadata
Class: ExperimentList      DataFrame      DataFrame            ANY

Name:           drops
Class:           list

Extends: "MultiAssayExperiment", "CAGEr"

What do you have?

ADD REPLY
0
Entering edit mode

Hi Martin Morgan, maybe this is the reason.  In my case the slots contain "pData", but "colData" in your case.

 

> library(CAGEr)
> CAGEexp
class generator function for class "CAGEexp" from package 'CAGEr'
function (...) 
new("CAGEexp", ...)
<bytecode: 0x1d8c6550>
<environment: namespace:CAGEr>
> getClass("CAGEexp")
Class "CAGEexp" [package "CAGEr"]

Slots:
                                                                  
Name:  ExperimentList          pData      sampleMap       metadata
Class: ExperimentList      DataFrame      DataFrame            ANY
                     
Name:           drops
Class:           list

Extends: "MultiAssayExperiment", "CAGEr"

 

ADD REPLY
1
Entering edit mode

Perhaps you need to restart in a fresh R session so that the upgrade of MultiAsssayExperiment and SummarizedExperiment has its effect.

ADD REPLY
0
Entering edit mode

After switch CAGEr from version 1.22.3 to 1.22.0, I got the same as Martin's. 

> getClass("CAGEexp")
Class "CAGEexp" [package "CAGEr"]

Slots:
                                                                  
Name:  ExperimentList        colData      sampleMap       metadata
Class: ExperimentList      DataFrame      DataFrame            ANY
                     
Name:           drops
Class:           list

Extends: "MultiAssayExperiment", "CAGEr"

 

ADD REPLY
1
Entering edit mode
@pengcheng-yang-6055
Last seen 3.6 years ago
China

This problem should be resolved as Charles Plessy said that through creating CAGEr class. The CAGEr documentation has detailed the steps (http://www.bioconductor.org/packages/release/bioc/vignettes/CAGEr/inst/doc/CAGEexp.html). However, in my case, I am stuck when running the function CAGEexp.

Update1

As Martin Morgan has suggested, I switch the version of CAGEr from 1.22.3 to 1.22.0 (http://www.bioconductor.org/packages/3.7/bioc/src/contrib/Archive/CAGEr/CAGEr_1.22.0.tar.gz), the error disappeared and the CAGEexp could be run successfully!

Update2

After reinstalled CAGEr version 1.22.3, the function CAGEexp could be run succesfully! I think this is caused by my recent days updating R from 4.3 to 5.0, during this process, I have reinstalled all the packages.

Thank you Martin Morgan and Charles Plessy!

ADD COMMENT
1
Entering edit mode

It's confusing to mark this with a check mark. The check mark means that this answer solves your problem. But you say that you still have a problem...

ADD REPLY
0
Entering edit mode

Thank you Martin Morgan, following your suggestion, I have resolved this problem by switch CAGEr from version 1.22.3 to 1.22.0.

ADD REPLY
1
Entering edit mode

I have

> packageVersion("CAGEr")
[1] ‘1.22.3’

Somehow you seem to have had a 'stale' version of the class definition. Maybe you were saving the environment of your previous session, or just needed to restart R? At any rate I think the key was to restart a _clean_ session.

ADD REPLY
0
Entering edit mode

OK! As you say, the totally reinstalling version 1.22.3 and running in a new directory resolved this problem. 

ADD REPLY

Login before adding your answer.

Traffic: 554 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