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.

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

Reply via email to