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.