Herve, thanks for your help.  To follow up some more, is there a way to
directly specify the start and end in coverage(), without using shift and
width?

Or alternatively, as Martin suggests,

r <- IRanges(start = c(30, 60, 70, 100), width = c(20, 18, 20, 18))
roi = IRanges(c(60, 68), width=5)  ## 'regions of interest'
v = Views(coverage(r), roi)

but in this case, extract the coverage information from v in the above
example?

Thanks,
Andrew


2010/6/25 Hervé Pagès <[email protected]>

> Hi Andrew,
>
> One way to specify directly the window of interest when calling
> coverage() is to use the 'shift' and 'width' arguments.
> 'shift' allows you to shift the ranges contained in the first
> argument to the left (negative shift) or to the right (positive
> shift) before extracting the coverage:
>
> ## Coverage from positions 60 to 65:
> > as.integer(coverage(r, shift=-59, width=6))
> [1] 1 1 1 1 1 1
>
> ## Coverage from positions 68 to 73:
> > as.integer(coverage(r, shift=-67, width=6))
> [1] 1 1 2 2 2 2
>
> Note that coverage(r, shift=-59, width=6) is equivalent to
> coverage(shift(r, -59), width=6).
>
> Cheers,
> H.
>
>
>
> On 06/23/2010 02:02 PM, Andrew Yee wrote:
>
>> Hi, I'm trying to figure out the coverage for a specific range.
>>
>> Take for example,
>>
>> r<- IRanges(start = c(30, 60, 70, 100), width = c(20, 18, 20, 18))
>>
>> I'm interested in the coverage from positions 60 to 65, which in this case
>> is 1.  I'm also interested in the coverage say from positions 68 to 73,
>> which goes from 1 to 2.
>>
>> While I can use coverage(r) and then use runLength() and runValue() to
>> ultimately extract this information, is there a way to use coverage so
>> that
>> you can directly specify the positions of interest?
>>
>> Thanks,
>> Andrew
>>
>>  sessionInfo()
>>>
>> R version 2.11.0 (2010-04-22)
>> x86_64-unknown-linux-gnu
>>
>> locale:
>>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> other attached packages:
>> [1] IRanges_1.6.0
>>
>> loaded via a namespace (and not attached):
>> [1] tools_2.11.0
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-sig-sequencing mailing list
>> [email protected]
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>>
>
>

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing

Reply via email to