On Fri, Oct 15, 2010 at 4:48 PM, joseph <jdsandjd@yahoo.com> wrote:

> Hello
> I have an IRanges object ir1:
> ir1 <- IRanges(c(100,500), c(200,600))
> > ir1
> IRanges of length 2
>    start end width
> [1]   100 200   101
> [2]   500 600   101
>
> can you please show me how to use flank() to create a second IRanges object
> ir2
> with coordinates that are 50 upstream of ir1 'start' and 20 downstream of
> the
> same ir1 'start'?
>
>
This really isn't possible with flank() all by itself unfortunately. With
both = TRUE, it will define a range that overlaps the start, but it's
symmetric, not 50/20.

You can define ranges for the 50bp upstream of start:

upstream <- flank(x, 50)

And then resize to 70, anchoring on the start, so that they extend 20 into
the gene:

resize(upstream, 70)

Note that you'll want to use GRanges, not IRanges, to do this based on the
strand (and thus the direction of transcription).

If you're just going to use IRanges, just do:

IRanges(start(x) - 50, width = 70)

ir2 should look like this:
>    start end width
> [1]    50  120    71
> [2]    450 520    71
>
> Thanks
> joseph
>
>
>
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor@stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
>

	[[alternative HTML version deleted]]

