commit/galaxy-central: jgoecks: Fixes for sorting and merging genomic regions during visual analysis.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/c54ebfe2c008/ changeset: c54ebfe2c008 user: jgoecks date: 2012-12-21 22:08:16 summary: Fixes for sorting and merging genomic regions during visual analysis. affected #: 1 file diff -r 692a1e8b69998d99465838cb5c8b1d56f3a37d2d -r c54ebfe2c0086b6e690e98a958e2d41ecf722bec lib/galaxy/webapps/galaxy/api/tools.py --- a/lib/galaxy/webapps/galaxy/api/tools.py +++ b/lib/galaxy/webapps/galaxy/api/tools.py @@ -158,17 +158,16 @@ if len( regions ) > 1: # Sort by chrom name, start so that data is not fetched out of order. - regions.sort( key=lambda r: r.chrom ) - regions.sort( key=lambda r: r.start ) - + regions = sorted(regions, key=lambda r: (r.chrom.lower(), r.start)) + # Merge overlapping regions so that regions do not overlap # and hence data is not included multiple times. prev = regions[0] cur = regions[1] index = 1 while True: - if cur.start <= prev.end: - # Found overlapping regions, so join them. + if cur.chrom == prev.chrom and cur.start <= prev.end: + # Found overlapping regions, so join them into prev. prev.end = cur.end del regions[ index ] else: @@ -182,7 +181,7 @@ break else: cur = regions[ index ] - + run_on_regions = True # Dataset check. Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket