[Bioc-sig-seq] Sorting RangedData

Ivan Gregoretti ivangreg at gmail.com
Wed Feb 10 00:38:53 CET 2010


It works.

Indeed, I actually constructed the instance in sorted fashion but it
got 're-ordered' by the function annotatePeakInBatch() from package
ChIPpeakAnno. It's a very minor downside the package I believe.

Thank you,

Ivan


Ivan Gregoretti, PhD
National Institute of Diabetes and Digestive and Kidney Diseases
National Institutes of Health
5 Memorial Dr, Building 5, Room 205.
Bethesda, MD 20892. USA.
Phone: 1-301-496-1592
Fax: 1-301-496-9878


On Tue, Feb 9, 2010 at 6:30 PM, Michael Lawrence
<lawrence.michael at gene.com> wrote:
>
>
> On Tue, Feb 9, 2010 at 3:21 PM, Ivan Gregoretti <ivangreg at gmail.com> wrote:
>>
>> Hi everybody,
>>
>> How do you sort a RangedData instance by start values?
>>
>>
>>
>> For instance, I have this example
>>
>> AannotatedRd[,0]
>>
>> RangedData with 10112 rows and 0 value columns across 25 spaces
>>             space               ranges |
>>      <character>            <IRanges> |
>> 00029        chr1 [15794022, 15797422] |
>> 00003        chr1 [ 5073247,  5076647] |
>> 00004        chr1 [ 5503788,  5507188] |
>> 00008        chr1 [ 6950752,  6954152] |
>> 00010        chr1 [ 9072689,  9076089] |
>> 00011        chr1 [ 9533772,  9537172] |
>> 00019        chr1 [11535104, 11538504] |
>> 00020        chr1 [11542979, 11546379] |
>> 00021        chr1 [12113768, 12117168] |
>> 00028        chr1 [14635606, 14639006] |
>> ...
>> <10102 more rows>
>>
>> (The next chromosome looks equally disordered)
>>
>> As you can see, the first row should not be at the top of the list.
>>
>> If this was a data.frame instance, I could solve it in no time with order().
>>
>> How do you sort RangedData instances by start values (while keeping spaces
>> separated)?
>>
>
> rd[order(space(rd), start(rd)),] should work. Might be easier to construct it sorted.
>
> Michael
>
>>
>> Thank you,
>>
>> Ivan Gregoretti, PhD
>> National Institute of Diabetes and Digestive and Kidney Diseases
>> National Institutes of Health
>> 5 Memorial Dr, Building 5, Room 205.
>> Bethesda, MD 20892. USA.
>> Phone: 1-301-496-1592
>> Fax: 1-301-496-9878
>>
>>        [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-sig-sequencing mailing list
>> Bioc-sig-sequencing at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>



More information about the Bioc-sig-sequencing mailing list