[Bioc-sig-seq] Creating TSS Regions IRanges with Strand Information

Dario Strbenac D.Strbenac at garvan.org.au
Thu Sep 10 03:18:09 CEST 2009


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 ?

Thanks, Dario.



More information about the Bioc-sig-sequencing mailing list