Hi Michael,
I can't reproduce this:
> library(GenomicRanges)
> chrs <- c(chr1=20, chr2=20)
> grA <- GRanges("chr1", IRanges(1,10), strand="*", seqlengths=chrs)
> grB <- GRanges("chr2", IRanges(11,15), strand="*", seqlengths=chrs)
> setdiff(grA, grB)
GRanges with 1 range and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 [1, 10] *
---
seqlengths:
chr1 chr2
20 20
Some core packages have been updated since your original post so that
could explain why the problem is gone now. See my session info below.
Cheers,
H.
> sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-linux-gnu (64-bit)
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=C LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicRanges_1.13.39 XVector_0.1.0 IRanges_1.19.28
[4] BiocGenerics_0.7.4
loaded via a namespace (and not attached):
[1] stats4_3.0.1
On 08/29/2013 08:48 AM, Michael Stadler wrote:
Dear masters of genomic ranges,
Since a few days, I am getting an error in Bioc 2.13 when comparing two
GRanges objects by setdiff():
chrs <- c(chr1=20, chr2=20)
grA <- GRanges("chr1", IRanges(1,10), strand="*", seqlengths=chrs)
grB <- GRanges("chr2", IRanges(11,15), strand="*", seqlengths=chrs)
setdiff(grA, grB)
Warning messages:
1: In ans[] <- x :
number of items to replace is not a multiple of replacement length
2: In ans[] <- x :
number of items to replace is not a multiple of replacement length
Error in gaps(union(gaps(x, end = seqlengths), y), end = seqlengths) :
error in evaluating the argument 'x' in selecting a method for
function 'gaps': Error in union(gaps(x, end = seqlengths), y) :
error in evaluating the argument 'x' in selecting a method for
function 'union': Error in Rle(strand(listNameMatrix[2L, ]), k) :
error in evaluating the argument 'values' in selecting a method for
function 'Rle': Error in .local(x, ...) : strand values must be in '+'
'-' '*'
This is in:
sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicRanges_1.13.38 XVector_0.1.0 IRanges_1.19.27
[4] BiocGenerics_0.7.4 RColorBrewer_1.0-5
loaded via a namespace (and not attached):
[1] stats4_3.0.1
The same code runs fine for Bioc 2.12:
chrs <- c(chr1=20, chr2=20)
grA <- GRanges("chr1", IRanges(1,10), strand="*", seqlengths=chrs)
grB <- GRanges("chr2", IRanges(11,15), strand="*", seqlengths=chrs)
setdiff(grA, grB)
GRanges with 1 range and 0 metadata columns:
seqnames ranges strand
<Rle> <IRanges> <Rle>
[1] chr1 [1, 10] *
---
seqlengths:
chr1 chr2
20 20
for:
sessionInfo()
R version 3.0.1 (2013-05-16)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods
[8] base
other attached packages:
[1] GenomicRanges_1.12.4 IRanges_1.18.2 BiocGenerics_0.7.0
[4] RColorBrewer_1.0-5
loaded via a namespace (and not attached):
[1] stats4_3.0.1
Would anybody have an idea what could be wrong?
Kind regards,
Michael
_______________________________________________ Bioc-devel at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/bioc-devel
Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fhcrc.org Phone: (206) 667-5791 Fax: (206) 667-1319