Error when subsetting a RaggedExperiment by GenomicRanges
1
0
Entering edit mode
@carlosruiz-8222
Last seen 5.2 years ago
Spain/Barcelona/CREAL

Hi,

I am currently working with RaggedExperiment. I am interested in selecting only the regions of RaggedExperiment that are included in a GenomicRanges. Despite this functionality is included in the vignette and the manual, I have not been able to apply it to my dataset. It does not work with a toy example either:

library(RaggedExperiment)
library(GenomicRanges)

# Create toy RaggedExperiment
sample1 <- GRanges(c(A = "chr1:1-10:-", B = "chr1:8-14:+", C = "chr2:15-18:+"), score = 3:5)
sample2 <- GRanges(c(D = "chr1:1-10:-", E = "chr2:11-18:+"), score = 1:2)
colDat <- DataFrame(id = 1:2)
ragexp <- RaggedExperiment(sample1 = sample1, sample2 = sample2, colData = colDat)

range <- GRanges("chr1:3-10")
subsetByOverlaps(ragexp, range)
Error: subscript is a logical vector with out-of-bounds TRUE values
traceback()
11: stop(wmsg(...), call. = FALSE)
10: .subscript_error("subscript is a logical vector with out-of-bounds ", 
        "TRUE values")
9: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append, 
       allow.NAs = allow.NAs)
8: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append, 
       allow.NAs = allow.NAs)
7: normalizeSingleBracketSubscript(i, x)
6: extractROWS(x, i)
5: extractROWS(x, i)
4: ranges[xor(o, invert), ]
3: ranges[xor(o, invert), ]
2: subsetByOverlaps(ragexp, range)
1: subsetByOverlaps(ragexp, range)

 

However, this error is not raised if the range used to subset does not overlap with the RaggedExperiment:

range <- GRanges("chr1:90-100")
subsetByOverlaps(ragexp, range)
GRanges object with 0 ranges and 0 metadata columns:
  seqnames    ranges strand
<Rle> <IRanges>  <Rle>
  -------
  seqinfo: 1 sequence from an unspecified genome; no seqlengths

 

Is there anything I am doing wrong? Thanks,

Carlos

> sessionInfo()
R version 3.4.0 (2017-04-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

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

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

other attached packages:
[1] RaggedExperiment_1.2.3 GenomicRanges_1.30.0   GenomeInfoDb_1.14.0    IRanges_2.12.0        
[5] S4Vectors_0.16.0       BiocGenerics_0.24.0   

loaded via a namespace (and not attached):
 [1] lattice_0.20-35            matrixStats_0.52.2         bitops_1.0-6              
 [4] grid_3.4.0                 BiocInstaller_1.28.0       zlibbioc_1.24.0           
 [7] XVector_0.18.0             Matrix_1.2-11              tools_3.4.0               
[10] Biobase_2.38.0             RCurl_1.95-4.8             DelayedArray_0.4.0        
[13] compiler_3.4.0             SummarizedExperiment_1.8.0 GenomeInfoDbData_0.99.1   

 

raggedexperiment genomicranges • 815 views
ADD COMMENT
0
Entering edit mode
@marcel-ramos-7325
Last seen 3 days ago
United States

Hi Carlos,

Thank you for your report. This is indeed a bug in the subsetByOverlaps,RaggedExperiment,Vector-method.

This was fixed in version 1.2.4 in release and 1.3.7  in devel.

Regards,

Marcel

ADD COMMENT

Login before adding your answer.

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