Entering edit mode
                    Andrew Jaffe
        
    
        ▴
    
    120
        @andrew-jaffe-4820
        Last seen 11.2 years ago
        
    I'm having a problem maintaining the ordering of?my GRanges object
when I lift it over using rtracklayer::liftOver. For example:
> g # my regions
GRanges with 5 ranges and 0 elementMetadata values
    seqnames                 ranges strand |
       <rle>              <iranges>  <rle> |
[1]    chr19 [ 13130686,  13133039]      * |
[2]     chr4 [160026138, 160028079]      * |
[3]    chr12 [ 65671230,  65672140]      * |
[4]     chr8 [ 19615409,  19616461]      * |
[5]    chr14 [ 99706752,  99708661]      * |
> chain = import.chain("hg19ToHg18.over.chain") # from UCSC
> lifted = liftOver(g, chain) # suppressed unmatched chrs
> lifted
GRanges with 5 ranges and 0 elementMetadata values
    seqnames                 ranges strand |
       <rle>              <iranges>  <rle> |
[1]     chr4 [160245588, 160247529]      * |
[2]     chr8 [ 19659689,  19660741]      * |
[3]    chr12 [ 63957497,  63958407]      * |
[4]    chr14 [ 98776505,  98778414]      * |
[5]    chr19 [ 12991686,  12994039]      * |
This is just a toy example with 5 regions all on different
chromosomes, but with real data where there are multiple regions per
chromosome, I am unable to determine the resulting matched lifted data
for a particular region. Is there any way to preserve the ordering of
my original list in the liftOver output? Presorting by chromosome and
position might work 99% of time, but the ordering of some regions
might shift during the liftOver, and I would not be able to tell if
this occurred.
Thanks a lot,
Andrew Jaffe
                    
                
                