On Wed, Sep 9, 2009 at 6:18 PM, Dario Strbenac <D.Strbenac@garvan.org.au>wrote:

> Hello,
>
> I'm trying to create a RangesList of intervals around the TSSs. So far, I
> have :
>
> startPositions <- as.numeric(apply(TSSDataTable, 1, function(x)
> ifelse(x$strand=="+", x$start, x$end)))
> strand2numeric <- c(-1,1)
> names(strand2numeric) <- c("-","+")
> TSSranges <- mapply(IRanges, start=split(startPositions -
> strand2numeric[TSSDataTable$strand]*upstream, TSSDataTable$chr),
> end=split(startPositions + strand2numeric[TSSDataTable$strand]*downstream,
> TSSDataTable$chr), names=split(TSSDataTable$name, TSSDataTable$chr))
>
> TSSL <- do.call(RangesList, TSSranges)
>
> Now, I'm stuck when the IRanges constructor gets start > end for - strand
> TSSs. Is there any way to do this easily without resorting to rewriting the
> code with for loops ?
>
>
Just received this message, even though it's dated 5 days ago.

I'm a little confused as to your goal. IRanges will not support start < (end
- 1), so you'll need to store the strand information separately, e.g. with a
RangedData object.

Something like:
RangedData(IRanges(startPositions - upstream, startPositions + downstream),
                   strand = TSSDataTable$strand, space = TSSDataTable$chr)

Note that the GenomicFeatures experimental data package already has this
information for the UCSC predicted TSS's.

Michael



> Thanks, Dario.
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> Bioc-sig-sequencing@r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>

	[[alternative HTML version deleted]]

