[BioC] loop over IRanges spaces

Yvan yvan.strahm at uni.no
Wed Apr 21 15:07:35 CEST 2010


Hello List,

I am confused about  how to loop over a rangedData object.
I have this rangedData

RangedData with 61 rows and 1 value column across 3 spaces
          space     ranges |     score
<character> <IRanges> | <numeric>
1   SCAFFOLD_1 [  8,   8] |  -0.09405

and the spaces are

"SCAFFOLD_1"   "SCAFFOLD_10"  "SCAFFOLD_100"

using aggregate it is possible to apply a function to one of the space

aggregate(rd["SCAFFOLD_1"]$score, start = 
1:(length(rd["SCAFFOLD_1"]$score)-w+1), width = w, FUN = sum)

but how can I apply the aggregate to all space without a for loop ?

And it is possible to add a column sum "on the fly" or should I create a 
vector "sum" containing values for all spaces and the recreate a 
rangedData object with this extra column?


Thanks for your help and patience
yvan



More information about the Bioconductor mailing list