[Bioc-sig-seq] AlignedRead and complex subsetting

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Sep 1 00:53:58 CEST 2009

Hi Ivan,

On Aug 31, 2009, at 4:54 PM, Ivan Gregoretti wrote:

> Hello Everybody,
> How do you subset an AlignedRead instance to keep (or reject) tags
> that lay within a set of genomic regions?
> Example
> Lets say that I have an AlignedRead instance called aln.
> Now let's say that I have a set of positions in BED style:
> (chromosome, start end)
> ch1 1000000 1000050
> chrX 20000000 20100000
> ...(many more)...
> We can imagine that I have the BED set loaded as a data frame.
> Is it possible to pick from aln only the tags within (or outside) the
> features defined in the table described above?

I think that you should convert your BED file to an IRanges object,  
and use overlap with your ranges + your readAligned object to get what  
your after. See Martin's post about something like this in this thread:


To get the reads *outside* of your ranges, maybe you can call the  
``gaps`` on your bed/ranges and then do the same thing ...  or  
perhaps  ``setdiff(ranges, aln)`` might work, too? (where aln is your  
IRanges converted alignedRead object (if necessary)).


Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact

More information about the Bioc-sig-sequencing mailing list