Bioconductor / GenomicRanges

Representation and manipulation of genomic intervals
https://bioconductor.org/packages/GenomicRanges
43 stars 18 forks source link

GPos - Error in getClass(x) : “UnstitchedGPos” is not a defined class #29

Closed peterblattmann closed 5 years ago

peterblattmann commented 5 years ago

We get an error in the Vignette of our DominoEffect package since a few days and it seems due to the GPos function.

Here is the printout if I replicate the error:

R version 3.6.0 (2019-04-26) -- "Planting of a Tree"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(DominoEffect)
> data("SnpData", package = "DominoEffect")
> chr_info <- paste("chr", SnpData$Chr_name,":", 
+                   SnpData$Position_on_chr, "-", 
+                   SnpData$Position_on_chr, sep = "")
> head(chr_info)
[1] "chr1:150917624-150917624" "chr1:150936280-150936280" "chr1:169823521-169823521" "chr1:169823718-169823718" "chr1:169823790-169823790"
[6] "chr1:17256626-17256626"  
> snp_data <- GenomicRanges::GPos(chr_info, stitch = FALSE)
Error in getClass(x) : “UnstitchedGPos” is not a defined class
> traceback()
6: stop(gettextf("%s is not a defined class", dQuote(Class)), domain = NA)
5: getClass(x)
4: getSlots(x_class)
3: S4Vectors:::normarg_mcols(mcols, Class, ans_len)
2: new_GRanges(Class, seqnames = seqnames, ranges = pos, strand = strand, 
       mcols = mcols, seqinfo = seqinfo)
1: GenomicRanges::GPos(chr_info, stitch = FALSE)
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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

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

loaded via a namespace (and not attached):
 [1] zlibbioc_1.31.0        compiler_3.6.0         IRanges_2.19.10        XVector_0.25.0         parallel_3.6.0        
 [6] tools_3.6.0            GenomicRanges_1.37.12  GenomeInfoDbData_1.2.1 RCurl_1.95-4.12        S4Vectors_0.23.13     
[11] BiocGenerics_0.31.4    GenomeInfoDb_1.21.1    bitops_1.0-6           stats4_3.6.0          

Now if I load the GenomicRanges package, the error does not happen anymore:

> library(GenomicRanges)
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: ‘BiocGenerics’

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

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

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

    IQR, mad, sd, var, xtabs

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

    anyDuplicated, append, as.data.frame, basename, cbind, colnames, dirname, do.call, duplicated, eval, evalq, Filter, Find,
    get, grep, grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int,
    Position, rank, rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply, union, unique, unsplit, which, which.max,
    which.min

Loading required package: S4Vectors

Attaching package: ‘S4Vectors’

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

    expand.grid

Loading required package: IRanges

Attaching package: ‘IRanges’

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

    windows

Loading required package: GenomeInfoDb
> snp_data <- GenomicRanges::GPos(chr_info, stitch = FALSE)
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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

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

other attached packages:
[1] GenomicRanges_1.37.12 GenomeInfoDb_1.21.1   IRanges_2.19.10       S4Vectors_0.23.13     BiocGenerics_0.31.4  

loaded via a namespace (and not attached):
[1] zlibbioc_1.31.0        compiler_3.6.0         XVector_0.25.0         tools_3.6.0            GenomeInfoDbData_1.2.1 RCurl_1.95-4.12       
[7] bitops_1.0-6  

So I am not sure how to interpret this, but I think there is some function that is not loaded if I only access the GPos function but can be accessed when I have loaded the GenomicRanges package. To avoid the error in building our Vignette, I guess I would need to import this functionality as well into our package. So far I import the following functions:

importFrom(GenomicRanges, GPos, mcols, pos)

Any idea why the error happens and how we can avoid getting the error in the future in our Vignette when we call the GPos function? Thanks for your help! If something is unclear please feel free to contact me.

hpages commented 5 years ago

Thanks for the report. This should be fixed in GenomicRanges 1.37.13 (see commit c8c2ef02f1b53fd5fa7b172f2887cacb388aee38).

H.