Entering edit mode
Hi,
Say you have something like this RleListexample
RleList of length 4
$seq1
integer-Rle of length 1575 with 42 runs
Lengths: 982 1 1 2 3 2 2 1 1 1 ... 1 1 1 2 1 1 3 1 531
Values : 0 2 3 6 8 10 12 13 15 17 ... 12 11 10 8 7 5 4 2 0
$seq2
integer-Rle of length 1584 with 1 run
Lengths: 1584
Values : 0
$seq1
integer-Rle of length 1575 with 42 runs
Lengths: 982 1 1 2 3 2 2 1 1 1 ... 1 1 1 2 1 1 3 1 531
Values : 0 2 3 6 8 10 12 13 15 17 ... 12 11 10 8 7 5 4 2 0
$seq2
integer-Rle of length 1584 with 1 run
Lengths: 1584
Values : 0
How would you add or average the values of only the seq1 RLEs into one single RLE object?
When I try sum(RleListexample) it collapses everything into one number. When I try RleListexample$seq1 it doesn't provide me with the two RLEs in the list it just provides me with one.
Hi, thanks but the answer collapses the RLE into one number. I need to find the average RLE in an RLElist. IE for two sets of coverage data. Combine them into one set and then average it out for mean coverage.
thanks
Maybe you are looking for something like
(RleListexample[1:2] + RleListexample[3:4]) / 2
? As Chris suggested, it's probably more usual to think of averaging two separate objectscool it works for individual RLEs. I might need to do something with lists though.