width(GRanges) increases after randomizeRegions(..) in package RegioneR
1
0
Entering edit mode
Ludo Pagie ▴ 40
@ludo-pagie-6130
Last seen 8.8 years ago

Hi all,

I want to compare overlap of 2 sets of genomic features to a case where one set is randomly distributed over the genome. For this I'm using the function randomizeRegions(..) in the package regioneR. The width of the randomized regions is 1 longer than the width of the input regions. Indeed the function computes the end position of the randomized regions as:<font face="monospace"> </font><font face="monospace" style="line-height: 1.6;">new.end <- </font>new.pos[["start"]] + len, where,  len <- width(oldRegion), ignoring the fact that GRanges computes width as end - start + 1.
I know I'm using an outdated version of the package (because the installed BioC is old) but I checked the source of the newest version and it appears not to have changed this. Am I overlooking something?

grts, Ludo

require(GenomicRanges)
orgR <- GRanges('chr1', IRanges(10, 19), strand='*')
width(orgR)
require(regioneR)
newR <- randomizeRegions(orgR)
width(newR)
width(newR) == width(orgR)+1
​

> sessionInfo()
R version 3.2.1 (2015-06-18)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.1 LTS

locale:
[1] C

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

other attached packages:
 [1] BSgenome.Hsapiens.UCSC.hg19.masked_1.3.99
 [2] BSgenome.Hsapiens.UCSC.hg19_1.4.0        
 [3] regioneR_1.0.3                           
 [4] BSgenome_1.36.0                          
 [5] rtracklayer_1.28.2                       
 [6] Biostrings_2.36.1                        
 [7] XVector_0.8.0                            
 [8] GenomicRanges_1.20.3                     
 [9] GenomeInfoDb_1.4.0                       
[10] IRanges_2.2.1                            
[11] S4Vectors_0.6.0                          
[12] BiocGenerics_0.14.0                      
[13] memoise_0.2.1                            

loaded via a namespace (and not attached):
 [1] zlibbioc_1.14.0         GenomicAlignments_1.4.1 BiocParallel_1.2.1     
 [4] tools_3.2.1             DBI_0.3.1               lambda.r_1.1.7         
 [7] futile.logger_1.4.1     digest_0.6.8            futile.options_1.0.0   
[10] bitops_1.0-6            RCurl_1.95-4.6          RSQLite_1.0.0          
[13] Rsamtools_1.20.1        XML_3.98-1.1           

 

genomicranges regioneR width • 1.1k views
ADD COMMENT
0
Entering edit mode
bernatgel ▴ 150
@bernatgel-7226
Last seen 10 months ago
Spain

Hi Ludo,

You are completely right. This was a bug in the randomizeRegions code.

I've fixed it and commited the changes to the release branch (Bioconductor 3.2) and so the new version regioneR 1.2.1 should be available on Bioconductor tomorrow.

In addition, if you are using an older version of regioneR I would strongly recommend moving to the release version, since randomizeRegions was updated and can be much faster for a large number of regions.

Thanks for reporting this bug

Bernat

ADD COMMENT

Login before adding your answer.

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