[BioC] IRanges: as.matrix.RangesMatching not found with NAMESPACE

Michael Dondrup Michael.Dondrup at uni.no
Thu Mar 25 15:03:26 CET 2010


Hi,

I made a package depending on IRanges. When I try to use as.matrix on a RangesMatching object,
there is an error message, if I don't have a NAMESPACE or I just source the file it works. Am I doing something wrong?
I made a reproducible example, used package skeleton to build the package for this.
The whole test -package is available at:

http://www.bccs.uni.no/~mdo041/anRpackage/


#require (IRanges)

doit <- function() {
  query <- IRanges(c(1, 4, 9), c(5, 7, 10))
  subject <- IRanges(c(2, 2, 10), c(2, 3, 12))
  tree <- IntervalTree(subject)

  ## check if it works?
  ol = findOverlaps(query, tree, multiple = TRUE) # c(2, NA, 3)
  print (ol)
  print (typeof(ol))
  as.matrix(ol)
}

NAMESPACE:
exportPattern("^[[:alpha:]]+")



Here is the output:


> library(anRpackage)
Loading required package: IRanges

Attaching package: 'IRanges'


	The following object(s) are masked from package:base :

	 Map,
	 cbind,
	 mapply,
	 order,
	 pmax,
	 pmax.int,
	 pmin,
	 pmin.int,
	 rbind,
	 rep.int,
	 table 

> doit()
An object of class "RangesMatching"
Slot "matchMatrix":
     query subject
[1,]     1       2
[2,]     1       1
[3,]     3       3

Slot "DIM":
[1] 3 3

[1] "S4"
Error in as.vector(data) : 
  no method for coercing this S4 class to a vector


And that is the output when there is no NAMESPACE

> library(anRpackage)
Loading required package: IRanges

Attaching package: 'IRanges'


	The following object(s) are masked from package:base :

	 Map,
	 cbind,
	 mapply,
	 order,
	 pmax,
	 pmax.int,
	 pmin,
	 pmin.int,
	 rbind,
	 rep.int,
	 table 

> doit()             
An object of class "RangesMatching"
Slot "matchMatrix":
     query subject
[1,]     1       2
[2,]     1       1
[3,]     3       3

Slot "DIM":
[1] 3 3

[1] "S4"
     query subject
[1,]     1       2
[2,]     1       1
[3,]     3       3
> 


> sessionInfo()
R version 2.10.1 (2009-12-14) 
x86_64-apple-darwin9.8.0 

locale:
[1] C

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

other attached packages:
[1] anRpackage_1.0 IRanges_1.4.16

loaded via a namespace (and not attached):
[1] tools_2.10.1
> 


Best



Michael Dondrup
Post-doctoral researcher
Uni BCCS
Thormøhlensgate 55, N-5008 Bergen, Norway



More information about the Bioconductor mailing list