Thanks, that worked beautifully. I ended up doing the following:

 

tileranges <- unlist(tileGenome(seqinfo(snps), tilewidth=500))

hits.df <- as.data.frame(findOverlaps(tileranges, snps))

 

I can then subset tileranges and snps with hits.df$queryHits or
hits.df$subjectHits to retrieve all the information in the original
Granges object.

Although not overlapping sliding windows (these are more "bins") I think
it might be good enough for my purposes.

Best,

 

-          Stefano

 

 

 

From: Michael Lawrence [mailto:lawrence.michael@gene.com] 
Sent: 09 March 2014 00:44
To: Stefano Iantorno
Cc: bioconductor@r-project.org
Subject: Re: [BioC] Help with sliding window analysis on GRanges object

 

I just realized that this will not scale well for the whole genome. So
you might just want to summarize with the Rle utilities or take 500bp
around each SNP to form your windows. Depends on your goal.

Michael

 

On Sat, Mar 8, 2014 at 9:38 PM, Michael Lawrence <michafla@gene.com>
wrote:

One way would to be generate the GRanges for the sliding windows and use
findOverlaps to get the list of indices. 

Something like this:

tiles <- unlist(tileGenome(seqinfo(snps), tilewidth=1L))

windows <- resize(tiles, 500L) # you will get a warning about trimming

answer <- as.list(findOverlaps(windows, snps))

Good luck. I also like Martin's answer if all you want is e.g. a count.

 

We might want to think about an argument to tileGenome or some mechanism
for generating a sliding tiling, in addition to the disjoint tiling.

Michael

 

 

 

On Sat, Mar 8, 2014 at 1:41 PM, Stefano Iantorno <si3@sanger.ac.uk>
wrote:

Hello



I am trying to conduct a sliding window analysis on a GRanges object. My
ranges are a list of 60272 single nucleotide positions representing high
confidence SNPs stored as IRanges object. I would like to retrieve the
list of GRanges row IDs for each  500bp window in the genome
(overlapping windows).



All the documentation I could find on sliding window functions such as
runsum, runmean, etc are all for Rle objects.



Any idea where to start from? I can't figure out a way to pick windows
in the IRanges object across intervals, since each interval is
represented by a start and end position (same genomic position since
it's a single nucleotide long).



Any help will be greatly appreciated.



Thanks



-          Stefano




--
 The Wellcome Trust Sanger Institute is operated by Genome Research
 Limited, a charity registered in England with number 1021457 and a
 company registered in England with number 2742969, whose registered
 office is 215 Euston Road, London, NW1 2BE.



        [[alternative HTML version deleted]]

_______________________________________________
Bioconductor mailing list
Bioconductor@r-project.org
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor








-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 



	[[alternative HTML version deleted]]

