I'm not sure exactly what you're asking. But something like:

reduce(slice(coverage(x), 2), min.gapwidth=2)

might get you close.

Michael

On Wed, Sep 8, 2010 at 4:34 PM, Kunbin Qu <[email protected]> wrote:

> Hi,
>
> I have multiple IRanges separated by certain distance which I would like
> to merge by REDUCE with the parameter min.gapwidth. If an IRange is
> within the min.gapwidth, but the coverage is too low, say, only 1 or 2
> across, I'd like to skip it, ie,  do not perform REDUCE. Could anyone
> suggest a good way to do it? Thanks.
>
> -Kunbin
>
> Example like the following:
>
> > x<-IRanges(c(1,1,2,3,3,7,10,10,11), c(2,3,3,4,5,8,11,12,13))
> > x
> IRanges of length 9
>    start end width
> [1]     1   2     2
> [2]     1   3     3
> [3]     2   3     2
> [4]     3   4     2
> [5]     3   5     3
> [6]     7   8     2
> [7]    10  11     2
> [8]    10  12     3
> [9]    11  13     3
> > coverage(x)
> 'integer' Rle of length 13 with 12 runs
>  Lengths: 1 1 1 1 1 1 2 1 1 1 1 1
>  Values : 2 3 4 2 1 0 1 0 2 3 2 1
> > xr<-reduce(x, min.gapwidth=2)
> > xr
> IRanges of length 1
>    start end width
> [1]     1  13    13
>
> IRange No. 6 is the weak link with a coverage of 1 in the middle, but it
> links IRanges 1 to 5 with IRanges 7 to 9 to cause only one IRange after
> REDUCE.
>
> I'd like to avoid this, so REDUCE will result two clusters, one from
> IRanges 1 to 5, another from IRanges 7 to 9.
>
>
> ______________________________________________________________________
> The contents of this electronic message, including any attachments, are
> intended only for the use of the individual or entity to which they are
> addressed and may contain confidential information. If you are not the
> intended recipient, you are hereby notified that any use, dissemination,
> distribution, or copying of this message or any attachment is strictly
> prohibited. If you have received this transmission in error, please send an
> e-mail to [email protected] and delete this message, along with
> any attachments, from your computer.
>        [[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