1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/d88ca4e4646c/
changeset: d88ca4e4646c
user: jgoecks
date: 2012-05-22 01:08:37
summary: Summary tree code tending: add todos and comments, remove version.
affected #: 1 file
diff -r bdb5318e6d30cf78e7ab40205779909af22c45b6 -r d88ca4e4646c6bd3e601bd8f37fcb813385b3b45 lib/galaxy/visualization/tracks/summary.py
--- a/lib/galaxy/visualization/tracks/summary.py
+++ b/lib/galaxy/visualization/tracks/summary.py
@@ -1,18 +1,17 @@
'''
-Summary tree data structure for aggregation
-
-10/20/2010: Changed version to 2 as we no longer look at bottom level, for better performance
+Summary tree data structure for feature aggregation across large genomic regions.
'''
import sys, os
import cPickle
-VERSION = 2
+# TODO: What are the performance implications of setting min level to 1? Data
+# structure size and/or query speed? It would be nice to have level 1 data
+# so that client does not have to compute it.
MIN_LEVEL = 2
class SummaryTree:
def __init__( self, block_size, levels, draw_cutoff, detail_cutoff ):
- self.version = VERSION
self.chrom_blocks = {}
self.levels = levels
self.draw_cutoff = draw_cutoff
@@ -26,20 +25,22 @@
def insert_range( self, chrom, start, end ):
""" Inserts a feature at chrom:start-end into the tree. """
+
+ # Get or set up chrom blocks.
if chrom in self.chrom_blocks:
blocks = self.chrom_blocks[ chrom ]
else:
blocks = self.chrom_blocks[ chrom ] = {}
self.chrom_stats[ chrom ] = {}
- for level in range( MIN_LEVEL, self.levels+1 ):
+ for level in range( MIN_LEVEL, self.levels + 1 ):
blocks[ level ] = {}
-
- for level in range( MIN_LEVEL, self.levels+1 ):
+ # Insert feature into all matching blocks at all levels.
+ for level in range( MIN_LEVEL, self.levels + 1 ):
block_level = blocks[ level ]
starting_block = self.find_block( start, level )
ending_block = self.find_block( end, level )
- for block in range( starting_block, ending_block+1 ):
+ for block in range( starting_block, ending_block + 1 ):
if block in block_level:
block_level[ block ] += 1
else:
@@ -47,6 +48,10 @@
def finish( self ):
""" Checks for cutoff and only stores levels above it """
+
+ # TODO: not storing all counts is lossy. To fix, store all counts
+ # and then dynamically set draw/detail level either on load or
+ # use cutoffs in query function.
for chrom, blocks in self.chrom_blocks.iteritems():
cur_best = 999
for level in range( self.levels, MIN_LEVEL-1, -1 ):
@@ -75,11 +80,11 @@
elif "draw_level" in stats and level <= stats[ "draw_level" ]:
return "draw"
blocks = self.chrom_blocks[ chrom ]
- results = [ ]
+ results = []
multiplier = self.block_size ** level
starting_block = self.find_block( start, level )
ending_block = self.find_block( end, level )
- for block in range( starting_block, ending_block+1 ):
+ for block in range( starting_block, ending_block + 1 ):
if block in blocks[ level ]:
results.append( ( block * multiplier, blocks[ level ][ block ] ) )
return results
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/bdb5318e6d30/
changeset: bdb5318e6d30
user: jgoecks
date: 2012-05-21 18:42:53
summary: Trackster: better comments and help text.
affected #: 2 files
diff -r 5096491eaff782116eed1640e350ab9fe1444460 -r bdb5318e6d30cf78e7ab40205779909af22c45b6 lib/galaxy/visualization/tracks/summary.py
--- a/lib/galaxy/visualization/tracks/summary.py
+++ b/lib/galaxy/visualization/tracks/summary.py
@@ -21,9 +21,11 @@
self.chrom_stats = {}
def find_block( self, num, level ):
+ """ Returns block that num is in for level. """
return ( num / self.block_size ** level )
def insert_range( self, chrom, start, end ):
+ """ Inserts a feature at chrom:start-end into the tree. """
if chrom in self.chrom_blocks:
blocks = self.chrom_blocks[ chrom ]
else:
@@ -44,7 +46,7 @@
block_level[ block ] = 1
def finish( self ):
- ''' Checks for cutoff and only stores levels above it '''
+ """ Checks for cutoff and only stores levels above it """
for chrom, blocks in self.chrom_blocks.iteritems():
cur_best = 999
for level in range( self.levels, MIN_LEVEL-1, -1 ):
@@ -65,6 +67,7 @@
self.chrom_blocks[ chrom ] = dict( [ ( key, value ) for key, value in blocks.iteritems() if key >= cur_best ] )
def query( self, chrom, start, end, level ):
+ """ Queries tree for data. """
if chrom in self.chrom_blocks:
stats = self.chrom_stats[ chrom ]
if "detail_level" in stats and level <= stats[ "detail_level" ]:
@@ -84,6 +87,7 @@
return None
def write( self, filename ):
+ """ Writes tree to file. """
self.finish()
cPickle.dump( self, open( filename, 'wb' ), 2 )
diff -r 5096491eaff782116eed1640e350ab9fe1444460 -r bdb5318e6d30cf78e7ab40205779909af22c45b6 static/scripts/trackster.js
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -415,8 +415,8 @@
DATA_ERROR = "There was an error in indexing this dataset. ",
DATA_NOCONVERTER = "A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",
DATA_NONE = "No data for this chrom/contig.",
- DATA_PENDING = "Preparing data. This is very fast for a small dataset but can take a long time for a large dataset. \
- If visualization is saved and closed, preparation will continue in the background.",
+ DATA_PENDING = "Preparing data. This can take a while for a large dataset. \
+ If the visualization is saved and closed, preparation will continue in the background.",
DATA_CANNOT_RUN_TOOL = "Tool cannot be rerun: ",
DATA_LOADING = "Loading data...",
DATA_OK = "Ready for display",
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.
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/60d7ff733697/
changeset: 60d7ff733697
user: jgoecks
date: 2012-05-15 15:17:36
summary: Remove genomes initialization code because it's no longer needed.
affected #: 1 file
diff -r c22bb0df586a95eae52701a7b44a678aed002b8e -r 60d7ff733697d1be532b042acb9410ed4405c978 lib/galaxy/visualization/tracks/genomes.py
--- a/lib/galaxy/visualization/tracks/genomes.py
+++ b/lib/galaxy/visualization/tracks/genomes.py
@@ -176,10 +176,6 @@
Returns true if there is reference data for the specified dbkey. If dbkey is custom,
dbkey_owner is needed to determine if there is reference data.
"""
- # Initialize built-in builds if necessary.
- if not self.available_genomes:
- self._init_references( trans )
-
# Look for key in built-in builds.
if dbkey in self.available_genomes:
# There is built-in reference data.
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.