commit/galaxy-central: jgoecks: Cleanup for previous commit, 565476ce4f03, mainly to further comment and simplify code and avoid going to index multiple times.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/24c6e925acaf/ changeset: 24c6e925acaf user: jgoecks date: 2012-08-16 00:09:48 summary: Cleanup for previous commit, 565476ce4f03, mainly to further comment and simplify code and avoid going to index multiple times. affected #: 1 file diff -r 565476ce4f0301d23538d87aeef805edc099badf -r 24c6e925acaf6b0dc8b52126ed295dcec35de2a6 lib/galaxy/visualization/tracks/data_providers.py --- a/lib/galaxy/visualization/tracks/data_providers.py +++ b/lib/galaxy/visualization/tracks/data_providers.py @@ -985,28 +985,31 @@ # To do this, need to increase end to next base and request number of points. num_points = end - start + 1 end += 1 - - result = summarize_region( bbi, chrom, start, end, num_points ) else: # # The goal is to sample the region between start and end uniformly - # using N data points. The challenge is that the size of sampled + # using ~N data points. The challenge is that the size of sampled # intervals rarely is full bases, so sampling using N points will - # leave the end of the region unsampled. To recitify this, samples - # beyond N are taken at the end of the interval. + # leave the end of the region unsampled due to remainders for each + # interval. To recitify this, a new N is calculated based on the + # step size that covers as much of the region as possible. + # + # However, this still leaves some of the region unsampled. This + # could be addressed by repeatedly sampling remainder using a + # smaller and smaller step_size, but that would require iteratively + # going to BBI, which could be time consuming. # - # Do initial summary. + # Start with N samples. num_points = N - result = summarize_region( bbi, chrom, start, end, num_points ) - - # Do summary of remaining part of region. step_size = ( end - start ) / num_points - new_start = start + step_size * num_points - new_num_points = min( ( end - new_start ) / step_size, end - start ) - if new_num_points is not 0: - result.extend( summarize_region( bbi, chrom, new_start, end, new_num_points ) ) - #TODO: progressively reduce step_size to generate more datapoints. + # Add additional points to sample in the remainder not covered by + # the initial N samples. + remainder_start = start + step_size * num_points + additional_points = ( end - remainder_start ) / step_size + num_points += additional_points + + result = summarize_region( bbi, chrom, start, end, num_points ) # Cleanup and return. f.close() 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