IRanges, Partitioning by End function not found.
1
1
Entering edit mode
ben.ward ▴ 30
@benward-7169
Last seen 8.1 years ago
United Kingdom

Hi, in my package I have a method which subsets a DNAStringSet:

 

setGeneric("subsetSites",
          function(object, index){
            standardGeneric("subsetSites")
          }
)

setMethod("subsetSites",
          signature("DNAStringSet", "integer"),
          function(object, index){
            index <- rep.int(list(index), length(object))
            return(object[index])
          }
)

 

This works in a script with Biostrings and IRanges:

library(Biostrings)
library(IRanges)

setGeneric("subsetSites",
           function(object, index){
             standardGeneric("subsetSites")
           }
)

setMethod("subsetSites",
          signature("DNAStringSet", "integer"),
          function(object, index){
            index <- rep.int(list(index), length(object))
            return(object[index])
          }
)

dna <-
  DNAStringSet(readDNAMultipleAlignment(filepath =
                             system.file("extdata",
                                         "msx2_mRNA.aln",
                                         package="Biostrings"),
                           format="clustal"))

sub <- subsetSites(dna, 1:50)

 

However, when subsetSites is a non-exported functions for internal use in my package it does not work - even when Biostrings and IRanges are imported, and so stuff in their namespaces should be "visible" to the package namespace:

Error in end(PartitioningByEnd(x)) :
  error in evaluating the argument 'x' in selecting a method for function 'end': Error: could not find function "PartitioningByEnd"

This is confusing since PartitioningByEnd looks like it is exported from IRanges. I have import(Biostrings)
 and import(IRanges) in my namespace file.

Imports:
    Biostrings,IRanges

Is in the description file.

 

Thanks,

Ben.

IRanges Biostrings • 990 views
ADD COMMENT
3
Entering edit mode
@martin-morgan-1513
Last seen 3 days ago
United States

Ask questions about package development on the Bioc-devel mailing list (mentioned on the Developers page of the Bioconductor web site).

For package development, be sure that you are using the 'devel' version of Bioconductor, and that your packages are up-to-date (e.g., via BiocInstaller::biocValid()).

Report sessionInfo().

Provide a reproducible example. For your case I created a branch of my 'PkgA' repository and have

/tmp$ git clone git@github.com:mtmorgan/PkgA.git -b PartitioningByEnd-import
Cloning into 'PkgA'...
remote: Counting objects: 17, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 17 (delta 0), reused 0 (delta 0), pack-reused 11
Receiving objects: 100% (17/17), done.
Resolving deltas: 100% (2/2), done.
Checking connectivity... done.
/tmp$ cd PkgA/
/tmp/PkgA$ R CMD INSTALL .
Bioconductor version 3.3 (BiocInstaller 1.21.2), ?biocLite for help
* installing to library '/home/mtmorgan/R/x86_64-pc-linux-gnu-library/3.3'
* installing *source* package 'PkgA' ...
** R
** preparing package for lazy loading
** help
No man pages found in package  'PkgA'
*** installing help indices
** building package indices
** testing if installed package can be loaded
Bioconductor version 3.3 (BiocInstaller 1.21.2), ?biocLite for help
* DONE (PkgA)
/tmp/PkgA$ R --vanilla -e "PkgA::doit()"
> PkgA::doit(); sessionInfo()
  A DNAStringSet instance of length 8
    width seq                                               names               
[1]    50 -----TCCCGTCTCCGCAGCAAA...TTTGAGTCGCCGCTGCCGGGTTG gi|84452153|ref|N...
[2]    50 -----------------------...----------------------- gi|208431713|ref|...
[3]    50 -----------------------...----------------------- gi|118601823|ref|...
[4]    50 ----------------------A...TTGGAGTCTTCGCTTGAGAGTTG gi|114326503|ref|...
[5]    50 -----------------------...----------------------- gi|119220589|ref|...
[6]    50 -----------------------...----------------------- gi|148540149|ref|...
[7]    50 --------------CGGCTCCGC...CCTCACTCGCGCAGTCCCCGCGC gi|45383056|ref|N...
[8]    50 GGGGGAGACTTCAGAAGTTGTTG...CTCCGCTGATAACAGTTGAGATG gi|213515133|ref|...

/tmp/PkgA$ R -e "loadNamespace('PkgA'); sessionInfo()"
> loadNamespace('PkgA'); sessionInfo()
R Under development (unstable) (2016-01-12 r69936)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

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

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

loaded via a namespace (and not attached):
[1] zlibbioc_1.17.0     IRanges_2.5.19      XVector_0.11.2     
[4] parallel_3.3.0      Biostrings_2.39.6   S4Vectors_0.9.18   
[7] BiocGenerics_0.17.3 stats4_3.3.0        PkgA_0.0.2      

 

ADD COMMENT

Login before adding your answer.

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