# [BioC] Calculate Outer Positions of GappedAlignmentPairs

Valerie Obenchain vobencha at fhcrc.org
Wed Mar 20 18:05:50 CET 2013

```Hello,

There are a couple of existing methods of GappedAlignmentPairs that may

Using 'galp' from the man page as an example,

example(GappedAlignmentPairs)
> class(galp)
[1] "GappedAlignmentPairs"
attr(,"package")
[1] "GenomicRanges"
> length(galp)
[1] 1572

To get your furthest outer positions, pull out the start of the
left-most pair and the end of the right-most pair:

outer <- cbind(start(left(galp)), end(right(galp)))
[,1] [,2]
[1,]   36  219
[2,]   49  259
[3,]   51  262
[4,]   60  259
[5,]   60  269
[6,]   61  282

For coverage, the left and right pair can be extracted and coerced to a
GRAnges which retains introns in each pair as part of the range.

grleft <- granges(left(galp))
grright <- granges(right(galp))

If we implemented a granges,GappedAlignmentPairs it should return
something of the same length. To do this we'd have to merge the pair
ranges which would then include the space between the ranges which I
don't think we want. Right?

As an fyi, another potentially useful function is introns(). This
returns a GRangesList of all intron ranges for each pair.

introns <- introns(galp)

Valerie

On 03/19/2013 09:44 PM, Michael Lawrence wrote:
> It would make sense for this to be granges,GappedAlignmentPairs. Want to
> contribute it?
>
> Michael
>
>
> On Tue, Mar 19, 2013 at 5:59 PM, Dario Strbenac <d.strbenac at garvan.org.au>wrote:
>
>> Hello,
>>
>> I would like to calculate the furthest outer positions of the mapped read
>> pairs. That is, the lowest and highest mapped coordinate of a read. In a
>> later step, I want to get a coverage estimate that also includes coverage
>> of the spliced out intron parts. I couldn't find any function already in
>> GenomicRanges. I made my own code to create a GRanges object of these
>> simple ranges, but was curious about any API functionality I overlooked
>> that could do this.
>>
>> Thanks,
>>             Dario.
>>
>> --------------------------------------
>> Dario Strbenac
>> PhD Student
>> University of Sydney
>> Camperdown NSW 2050
>> Australia
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>

```