galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
February 2011
- 1 participants
- 166 discussions
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/21cdfab7b813/
changeset: r5035:21cdfab7b813
user: natefoo
date: 2011-02-09 22:46:30
summary: A fix for DRMs which can apparently cause a drmaa.InternalException in cases where the job is finished normally. If there are other conditions which raise this exception, failures may go undetected. The drmaa runner is not in active use by the development team, so please report problems with this change.
affected #: 1 file (278 bytes)
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
0
commit/galaxy-central: natefoo: More comprehensive conflict resolution for eggs that are dependencies of other eggs, and eggs which conflict with system versions.
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b69b84f67337/
changeset: r5034:b69b84f67337
user: natefoo
date: 2011-02-09 22:31:43
summary: More comprehensive conflict resolution for eggs that are dependencies of other eggs, and eggs which conflict with system versions.
affected #: 1 file (1.8 KB)
--- a/lib/galaxy/eggs/__init__.py Wed Feb 09 16:29:50 2011 -0500
+++ b/lib/galaxy/eggs/__init__.py Wed Feb 09 16:31:43 2011 -0500
@@ -36,12 +36,13 @@
"""
Contains information about locating and downloading eggs.
"""
- def __init__( self, name=None, version=None, tag=None, url=None, platform=None ):
+ def __init__( self, name=None, version=None, tag=None, url=None, platform=None, crate=None ):
self.name = name
self.version = version
self.tag = tag
self.url = url
self.platform = platform
+ self.crate = crate
self.distribution = None
self.dir = None
if self.name is not None and self.version is not None:
@@ -145,37 +146,68 @@
log.debug( "Removed conflicting egg: %s" % doppelganger )
def resolve( self ):
try:
- return pkg_resources.working_set.resolve( ( self.distribution.as_requirement(), ), env, self.fetch )
+ rval = []
+ # resolve this egg and its dependencies
+ dists = pkg_resources.working_set.resolve( ( self.distribution.as_requirement(), ), env, self.fetch )
+ for dist in dists:
+ # if any of the resolved dependencies should be managed eggs but are being pulled from the wrong path, fix them
+ if dist.project_name in self.crate.all_names and not os.path.realpath( dist.location ).startswith( os.path.realpath( self.dir ) ):
+ # TODO: like eggs.require(), this breaks requirement versioning
+ subdists = self.version_conflict( dist, dist.as_requirement() )
+ if type( subdists ) == list:
+ rval.extend( subdists )
+ else:
+ rval.append( subdists )
+ else:
+ rval.append( dist )
+ return rval
except pkg_resources.DistributionNotFound, e:
# If this statement is true, it means we do have the requested egg,
# just not one (or more) of its deps.
if e.args[0].project_name != self.distribution.project_name:
- log.warning( "Warning: %s (a dependant egg of %s) cannot be fetched" % ( e.args[0].project_name, self.distribution.project_name ) )
+ log.warning( "Warning: %s (a dependent egg of %s) cannot be fetched" % ( e.args[0].project_name, self.distribution.project_name ) )
return ( self.distribution, )
else:
raise EggNotFetchable( self )
except pkg_resources.VersionConflict, e:
# there's a conflicting egg on the path, remove it
- dist = e.args[0]
- # use the canonical path for comparisons
- location = os.path.realpath( dist.location )
- for entry in pkg_resources.working_set.entries:
- if os.path.realpath( entry ) == location:
- pkg_resources.working_set.entries.remove( entry )
- break
- else:
- location = entry = None
- del pkg_resources.working_set.by_key[dist.key]
- if entry is not None:
- pkg_resources.working_set.entry_keys[entry] = []
- if entry in sys.path:
- sys.path.remove(entry)
- r = pkg_resources.working_set.resolve( ( self.distribution.as_requirement(), ), env, self.fetch )
- if location is not None and not location.endswith( '.egg' ):
- # re-add the path if it's a non-egg dir, in case more deps live there
- pkg_resources.working_set.entries.append( location )
- sys.path.append( location )
- return r
+ return self.version_conflict( e.args[0], e.args[1] )
+ def version_conflict( self, conflict_dist, conflict_req ):
+ # since this conflict may be for a dependent egg, find the correct egg from the crate
+ if conflict_dist.project_name == self.distribution.project_name:
+ egg = self
+ dist = egg.distribution
+ elif conflict_dist.project_name in self.crate.all_names:
+ egg = self.crate[conflict_dist.project_name]
+ dist = egg.distribution
+ else:
+ # should not happen, but just in case
+ egg = None
+ dist = conflict_dist
+ # use the canonical path to locate and remove the conflict from the working set
+ location = os.path.realpath( conflict_dist.location )
+ for entry in pkg_resources.working_set.entries:
+ if os.path.realpath( entry ) == location:
+ pkg_resources.working_set.entries.remove( entry )
+ break
+ else:
+ location = entry = None
+ del pkg_resources.working_set.by_key[conflict_dist.key]
+ # remove the conflict from sys.path
+ if entry is not None:
+ pkg_resources.working_set.entry_keys[entry] = []
+ if entry in sys.path:
+ sys.path.remove(entry)
+ # if the conflict is a dpeendent egg, fetch that specific egg
+ if egg:
+ r = pkg_resources.working_set.resolve( ( dist.as_requirement(), ), env, egg.fetch )
+ else:
+ r = pkg_resources.working_set.resolve( ( dist.as_requirement(), ), env )
+ # re-add the path if it's a non-egg dir, in case more deps live there
+ if location is not None and not location.endswith( '.egg' ):
+ pkg_resources.working_set.entries.append( location )
+ sys.path.append( location )
+ return r
def require( self ):
try:
dists = self.resolve()
@@ -215,7 +247,7 @@
platform = self.platform or '-'.join( ( py, pkg_resources.get_platform() ) )
else:
platform = self.py_platform or py
- egg = egg_class( name, version, tag, url, platform )
+ egg = egg_class( name=name, version=version, tag=tag, url=url, platform=platform, crate=self )
self.eggs[name] = egg
@property
def config_missing( self ):
@@ -331,7 +363,7 @@
return False
def get_env():
- env = pkg_resources.Environment( platform=pkg_resources.get_platform() )
+ env = pkg_resources.Environment( search_path='', platform=pkg_resources.get_platform() )
for dist in pkg_resources.find_distributions( os.path.join( galaxy_dir, 'eggs' ), False ):
env.add( dist )
return env
@@ -340,6 +372,8 @@
def require( req_str ):
c = Crate()
req = pkg_resources.Requirement.parse( req_str )
+ # TODO: This breaks egg version requirements. Not currently a problem, but
+ # it could become one.
try:
return c[req.project_name].require()
except KeyError:
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
0
commit/galaxy-central: natefoo: Fixes for scrambling python-daemon and pysam.
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ad054a328b74/
changeset: r5033:ad054a328b74
user: natefoo
date: 2011-02-09 22:29:50
summary: Fixes for scrambling python-daemon and pysam.
affected #: 3 files (67 bytes)
--- a/dist-eggs.ini Wed Feb 09 16:18:56 2011 -0500
+++ b/dist-eggs.ini Wed Feb 09 16:29:50 2011 -0500
@@ -96,5 +96,6 @@
; don't build these eggs on these platforms:
[ignore]
GeneTrack = py2.4
+python-daemon = py2.4
pysam = py2.4-solaris-2.8-sun4u_32-ucs2 py2.5-solaris-2.8-sun4u_32-ucs2 py2.6-solaris-2.8-sun4u_32-ucs2 py2.4-solaris-2.8-sun4u_64-ucs2 py2.5-solaris-2.8-sun4u_64-ucs2 py2.6-solaris-2.8-sun4u_64-ucs2
ctypes = py2.5-linux-i686-ucs2 py2.5-linux-i686-ucs4 py2.6-linux-i686-ucs2 py2.6-linux-i686-ucs4 py2.5-linux-x86_64-ucs2 py2.5-linux-x86_64-ucs4 py2.6-linux-x86_64-ucs2 py2.6-linux-x86_64-ucs4 py2.5-macosx-10.3-fat-ucs2 py2.6-macosx-10.3-fat-ucs2 py2.6-macosx-10.6-universal-ucs2 py2.5-solaris-2.10-i86pc_32-ucs2 py2.6-solaris-2.10-i86pc_32-ucs2 py2.5-solaris-2.10-i86pc_64-ucs2 py2.6-solaris-2.10-i86pc_64-ucs2 py2.5-solaris-2.8-sun4u_32-ucs2 py2.6-solaris-2.8-sun4u_32-ucs2 py2.5-solaris-2.8-sun4u_64-ucs2 py2.6-solaris-2.8-sun4u_64-ucs2
--- a/scripts/scramble/scripts/pysam-solaris.py Wed Feb 09 16:18:56 2011 -0500
+++ b/scripts/scramble/scripts/pysam-solaris.py Wed Feb 09 16:29:50 2011 -0500
@@ -24,6 +24,7 @@
cc = get_solaris_compiler()
if cc == 'cc':
os.environ['CFLAGS'] = '-xc99=all'
+ os.environ['LDFLAGS'] = '-lsocket -lnsl'
# do it
execfile( "setup.py", globals(), locals() )
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
0
commit/galaxy-central: greg: Optimize the printed output of the 0074... migration script.
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/c366f4f232ea/
changeset: r5032:c366f4f232ea
user: greg
date: 2011-02-09 22:18:56
summary: Optimize the printed output of the 0074... migration script.
affected #: 1 file (29 bytes)
--- a/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py Wed Feb 09 15:42:42 2011 -0500
+++ b/lib/galaxy/model/migrate/versions/0074_add_purged_column_to_library_dataset_table.py Wed Feb 09 16:18:56 2011 -0500
@@ -48,10 +48,10 @@
cmd = "SELECT * FROM library_dataset WHERE deleted = %s;" % boolean_true()
deleted_lds = db_session.execute( cmd ).fetchall()
for row in deleted_lds:
- print "Processing LibraryDataset id: ", int( row.id )
cmd = "SELECT * FROM library_dataset_dataset_association WHERE library_dataset_id = %d AND library_dataset_dataset_association.deleted = %s;" % ( int( row.id ), boolean_false() )
active_lddas = db_session.execute( cmd ).fetchall()
if not active_lddas:
+ print "Updating purged column to True for LibraryDataset id : ", int( row.id )
cmd = "UPDATE library_dataset SET purged = %s WHERE id = %d;" % ( boolean_true(), int( row.id ) )
db_session.execute( cmd )
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
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/909e158e2e3a/
changeset: r5031:909e158e2e3a
user: dan
date: 2011-02-09 21:42:42
summary: Add metabolicMine datasource tool.
affected #: 2 files (50 bytes)
--- a/tool_conf.xml.sample Wed Feb 09 15:42:09 2011 -0500
+++ b/tool_conf.xml.sample Wed Feb 09 15:42:42 2011 -0500
@@ -17,6 +17,7 @@
<tool file="data_source/modmine.xml" /><tool file="data_source/ratmine.xml" /><tool file="data_source/yeastmine.xml" />
+ <tool file="data_source/metabolicmine.xml" /><tool file="data_source/worm_modencode.xml" /><tool file="data_source/wormbase.xml" /><tool file="data_source/wormbase_test.xml" />
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
0
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/2626e0f79dc2/
changeset: r5030:2626e0f79dc2
user: greg
date: 2011-02-09 21:42:09
summary: Add a purged column to the LibraryDataset table - a LibraryDataset is marked purged when all associated LibraryDatasetDatasetAssociations are marked deleted. Fix the cleanup_datasets.py script to more correclty handle the lifecycle of LibraryDatasets.
affected #: 4 files (4.3 KB)
--- a/lib/galaxy/model/__init__.py Wed Feb 09 13:24:35 2011 -0500
+++ b/lib/galaxy/model/__init__.py Wed Feb 09 15:42:09 2011 -0500
@@ -1106,14 +1106,6 @@
name = property( get_name, set_name )
def display_name( self ):
self.library_dataset_dataset_association.display_name()
- def get_purged( self ):
- return self.library_dataset_dataset_association.dataset.purged
- def set_purged( self, purged ):
- if purged:
- raise Exception( "Not implemented" )
- if not purged and self.purged:
- raise Exception( "Cannot unpurge once purged" )
- purged = property( get_purged, set_purged )
def get_api_value( self, view='collection' ):
# Since this class is a proxy to rather complex attributes we want to
# display in other objects, we can't use the simpler method used by
--- a/lib/galaxy/model/mapping.py Wed Feb 09 13:24:35 2011 -0500
+++ b/lib/galaxy/model/mapping.py Wed Feb 09 15:42:09 2011 -0500
@@ -255,7 +255,8 @@
Column( "update_time", DateTime, default=now, onupdate=now ),
Column( "name", TrimmedString( 255 ), key="_name", index=True ), #when not None/null this will supercede display in library (but not when imported into user's history?)
Column( "info", TrimmedString( 255 ), key="_info" ), #when not None/null this will supercede display in library (but not when imported into user's history?)
- Column( "deleted", Boolean, index=True, default=False ) )
+ Column( "deleted", Boolean, index=True, default=False ),
+ Column( "purged", Boolean, index=True, default=False ) )
LibraryDatasetDatasetAssociation.table = Table( "library_dataset_dataset_association", metadata,
Column( "id", Integer, primary_key=True ),
--- a/scripts/cleanup_datasets/cleanup_datasets.py Wed Feb 09 13:24:35 2011 -0500
+++ b/scripts/cleanup_datasets/cleanup_datasets.py Wed Feb 09 15:42:09 2011 -0500
@@ -22,6 +22,43 @@
assert sys.version_info[:2] >= ( 2, 4 )
def main():
+ """
+ Managing library datasets is a bit complex, so here is a scenario that hopefully provides clarification. The complexities
+ of handling library datasets is mostly contained in the delete_datasets() method in this script.
+
+ Assume we have 1 library dataset with: LibraryDatasetDatasetAssociation -> LibraryDataset and Dataset
+ At this point, we have the following database column values:
+
+ LibraryDatasetDatasetAssociation deleted: False
+ LibraryDataset deleted: False, purged: False
+ Dataset deleted: False purged: False
+
+ 1. A user deletes the assumed dataset above from a data library via a UI menu option.
+ This action results in the following database column values (changes from previous step marked with *):
+
+ LibraryDatasetDatasetAssociation deleted: False
+ LibraryDataset deleted: True*, purged: False
+ Dataset deleted: False, purged: False
+
+ 2. After the number of days configured for the delete_datasets() method (option -6 below) have passed, execution
+ of the delete_datasets() method results in the following database column values (changes from previous step marked with *):
+
+ LibraryDatasetDatasetAssociation deleted: True*
+ LibraryDataset deleted: True, purged: True*
+ Dataset deleted: True*, purged: False
+
+ 3. After the number of days configured for the purge_datasets() method (option -3 below) have passed, execution
+ of the purge_datasets() method results in the following database column values (changes from previous step marked with *):
+
+ LibraryDatasetDatasetAssociation deleted: True
+ LibraryDataset deleted: True, purged: True
+ Dataset deleted: True, purged: True* (dataset file removed from disk if -r flag is used)
+
+ This scenario is about as simple as it gets. Keep in mind that a Dataset object can have many HistoryDatasetAssociations
+ and many LibraryDatasetDatasetAssociations, and a LibraryDataset can have many LibraryDatasetDatasetAssociations.
+ Another way of stating it is: LibraryDatasetDatasetAssociation objects map LibraryDataset objects to Dataset objects,
+ and Dataset objects may be mapped to History objects via HistoryDatasetAssociation objects.
+ """
parser = OptionParser()
parser.add_option( "-d", "--days", dest="days", action="store", type="int", help="number of days (60)", default=60 )
parser.add_option( "-r", "--remove_from_disk", action="store_true", dest="remove_from_disk", help="remove datasets from disk when purged", default=False )
@@ -215,40 +252,70 @@
whereclause = app.model.HistoryDatasetAssociation.table.c.update_time < cutoff_time,
from_obj = [ sa.outerjoin( app.model.Dataset.table,
app.model.HistoryDatasetAssociation.table ) ] )
- library_dataset_ids_query = sa.select( ( app.model.Dataset.table.c.id,
- app.model.Dataset.table.c.state ),
- whereclause = app.model.LibraryDatasetDatasetAssociation.table.c.update_time < cutoff_time,
- from_obj = [ sa.outerjoin( app.model.Dataset.table,
- app.model.LibraryDatasetDatasetAssociation.table ) ] )
+ library_dataset_ids_query = sa.select( ( app.model.LibraryDataset.table.c.id,
+ app.model.LibraryDataset.table.c.deleted ),
+ whereclause = app.model.LibraryDataset.table.c.update_time < cutoff_time,
+ from_obj = [ app.model.LibraryDataset.table ] )
else:
# We really only need the id column here, but sqlalchemy barfs when trying to select only 1 column
history_dataset_ids_query = sa.select( ( app.model.Dataset.table.c.id,
app.model.Dataset.table.c.state ),
- whereclause = sa.and_( app.model.Dataset.table.c.deleted == False,
- app.model.HistoryDatasetAssociation.table.c.update_time < cutoff_time,
- app.model.HistoryDatasetAssociation.table.c.deleted == True ),
+ whereclause = and_( app.model.Dataset.table.c.deleted == False,
+ app.model.HistoryDatasetAssociation.table.c.update_time < cutoff_time,
+ app.model.HistoryDatasetAssociation.table.c.deleted == True ),
from_obj = [ sa.outerjoin( app.model.Dataset.table,
app.model.HistoryDatasetAssociation.table ) ] )
- library_dataset_ids_query = sa.select( ( app.model.Dataset.table.c.id,
- app.model.Dataset.table.c.state ),
- whereclause = sa.and_( app.model.Dataset.table.c.deleted == False,
- app.model.LibraryDatasetDatasetAssociation.table.c.update_time < cutoff_time,
- app.model.LibraryDatasetDatasetAssociation.table.c.deleted == True ),
- from_obj = [ sa.outerjoin( app.model.Dataset.table,
- app.model.LibraryDatasetDatasetAssociation.table ) ] )
- history_dataset_ids = [ row.id for row in history_dataset_ids_query.execute() ]
- library_dataset_ids = [ row.id for row in library_dataset_ids_query.execute() ]
- dataset_ids = history_dataset_ids + library_dataset_ids
- skip = []
+ library_dataset_ids_query = sa.select( ( app.model.LibraryDataset.table.c.id,
+ app.model.LibraryDataset.table.c.deleted ),
+ whereclause = and_( app.model.LibraryDataset.table.c.deleted == True,
+ app.model.LibraryDataset.table.c.purged == False,
+ app.model.LibraryDataset.table.c.update_time < cutoff_time ),
+ from_obj = [ app.model.LibraryDataset.table ] )
deleted_dataset_count = 0
deleted_instance_count = 0
+ skip = []
+ # Handle library datasets. This is a bit tricky, so here's some clarification. We have a list of all
+ # LibraryDatasets that were marked deleted before our cutoff_time, but have not yet been marked purged.
+ # A LibraryDataset object is marked purged when all of it's LibraryDatasetDatasetAssociations have been
+ # marked deleted. When a LibraryDataset has been marked purged, it can never be undeleted in the data
+ # library. We have several steps to complete here. For each LibraryDataset, get it's associated Dataset
+ # and add it to our accrued list of Datasets for later processing. We mark as deleted all of it's
+ # LibraryDatasetDatasetAssociations. Then we mark the LibraryDataset as purged. We then process our
+ # list of Datasets.
+ library_dataset_ids = [ row.id for row in library_dataset_ids_query.execute() ]
+ dataset_ids = []
+ for library_dataset_id in library_dataset_ids:
+ print "######### Processing LibraryDataset id:", library_dataset_id
+ # Get the LibraryDataset and the current LibraryDatasetDatasetAssociation objects
+ ld = app.sa_session.query( app.model.LibraryDataset ).get( library_dataset_id )
+ ldda = ld.library_dataset_dataset_association
+ # Append the associated Dataset object's id to our list of dataset_ids
+ dataset_ids.append( ldda.dataset_id )
+ # Mark all of the LibraryDataset's associated LibraryDatasetDatasetAssociation objects' as deleted
+ if not ldda.deleted:
+ ldda.deleted = True
+ app.sa_session.add( ldda )
+ print "Marked associated LibraryDatasetDatasetAssociation id %d as deleted" % ldda.id
+ for expired_ldda in ld.expired_datasets:
+ if not expired_ldda.deleted:
+ expired_ldda.deleted = True
+ app.sa_session.add( expired_ldda )
+ print "Marked associated expired LibraryDatasetDatasetAssociation id %d as deleted" % ldda.id
+ # Mark the LibraryDataset as purged
+ ld.purged = True
+ app.sa_session.add( ld )
+ print "Marked LibraryDataset id %d as purged" % ld.id
+ app.sa_session.flush()
+ # Add all datasets associated with Histories to our list
+ dataset_ids.extend( [ row.id for row in history_dataset_ids_query.execute() ] )
+ # Process each of the Dataset objects
for dataset_id in dataset_ids:
print "######### Processing dataset id:", dataset_id
dataset = app.sa_session.query( app.model.Dataset ).get( dataset_id )
if dataset.id not in skip and _dataset_is_deletable( dataset ):
deleted_dataset_count += 1
for dataset_instance in dataset.history_associations + dataset.library_associations:
- print "Associated Dataset instance: ", dataset_instance.__class__.__name__, dataset_instance.id
+ # Mark each associated HDA as deleted
_purge_dataset_instance( dataset_instance, app, remove_from_disk, include_children=True, info_only=info_only, is_deletable=True )
deleted_instance_count += 1
skip.append( dataset.id )
@@ -293,7 +360,7 @@
# A dataset_instance is either a HDA or an LDDA. Purging a dataset instance marks the instance as deleted,
# and marks the associated dataset as deleted if it is not associated with another active DatsetInstance.
if not info_only:
- print "Deleting dataset_instance ", str( dataset_instance ), " id ", dataset_instance.id
+ print "Marking as deleted: ", dataset_instance.__class__.__name__, " id ", dataset_instance.id
dataset_instance.mark_deleted( include_children = include_children )
dataset_instance.clear_associated_files()
app.sa_session.add( dataset_instance )
@@ -312,8 +379,8 @@
return not bool( dataset.active_history_associations or dataset.active_library_associations )
def _delete_dataset( dataset, app, remove_from_disk, info_only=False, is_deletable=False ):
- #marks a base dataset as deleted, hdas/ldas associated with dataset can no longer be undeleted
- #metadata files attached to associated dataset Instances is removed now
+ # Marks a base dataset as deleted, hdas/lddas associated with dataset can no longer be undeleted.
+ # Metadata files attached to associated dataset Instances is removed now.
if not is_deletable and not _dataset_is_deletable( dataset ):
print "This Dataset (%i) is not deletable, associated Metadata Files will not be removed.\n" % ( dataset.id )
else:
@@ -324,9 +391,9 @@
for metadata_file in app.sa_session.query( app.model.MetadataFile ) \
.filter( app.model.MetadataFile.table.c.hda_id==hda.id ):
metadata_files.append( metadata_file )
- for lda in dataset.library_associations:
+ for ldda in dataset.library_associations:
for metadata_file in app.sa_session.query( app.model.MetadataFile ) \
- .filter( app.model.MetadataFile.table.c.lda_id==lda.id ):
+ .filter( app.model.MetadataFile.table.c.lda_id==ldda.id ):
metadata_files.append( metadata_file )
for metadata_file in metadata_files:
print "The following metadata files attached to associations of Dataset '%s' have been purged:" % dataset.id
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
0
commit/galaxy-central: kanwei: trackster: Recalc slots no matter what level it's on since it's fast enough
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/397c31931ce5/
changeset: r5029:397c31931ce5
user: kanwei
date: 2011-02-09 19:24:35
summary: trackster: Recalc slots no matter what level it's on since it's fast enough
affected #: 1 file (85 bytes)
--- a/static/scripts/trackster.js Wed Feb 09 13:11:28 2011 -0500
+++ b/static/scripts/trackster.js Wed Feb 09 13:24:35 2011 -0500
@@ -2321,9 +2321,8 @@
}
// Calculate new slots incrementally for this new chunk of data and update height if necessary.
- var inc_scale = (w_scale < 0.0001 ? 1/this.view.zoom_res : w_scale);
- required_height = this.incremental_slots(inc_scale, result.data, no_label, mode) * y_scale + min_height;
- slots = this.inc_slots[inc_scale];
+ required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
+ slots = this.inc_slots[w_scale];
}
canvas.get(0).width = width + left_offset;
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
0
commit/galaxy-central: kellyv: Added bwa_index_color.loc to buildbot setup config
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/249962c12b39/
changeset: r5028:249962c12b39
user: kellyv
date: 2011-02-09 19:11:28
summary: Added bwa_index_color.loc to buildbot setup config
affected #: 1 file (42 bytes)
--- a/buildbot_setup.sh Wed Feb 09 12:36:40 2011 -0500
+++ b/buildbot_setup.sh Wed Feb 09 13:11:28 2011 -0500
@@ -39,6 +39,7 @@
/galaxy/data/location/bowtie_indices.loc
/galaxy/data/location/bowtie_indices_color.loc
/galaxy/data/location/bwa_index.loc
+/galaxy/data/location/bwa_index_color.loc
/galaxy/data/location/codingSnps.loc
/galaxy/data/location/encode_datasets.loc
/galaxy/home/universe/encode_feature_partitions
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
0
commit/galaxy-central: kellyv: Adding several genomes to the manual builds list
by Bitbucket 09 Feb '11
by Bitbucket 09 Feb '11
09 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/f1aae174d106/
changeset: r5027:f1aae174d106
user: kellyv
date: 2011-02-09 18:36:40
summary: Adding several genomes to the manual builds list
affected #: 1 file (2.6 KB)
--- a/tool-data/shared/ucsc/manual_builds.txt Tue Feb 08 18:07:27 2011 -0500
+++ b/tool-data/shared/ucsc/manual_builds.txt Wed Feb 09 12:36:40 2011 -0500
@@ -665,8 +665,30 @@
shewOnei Shewanella oneidensis MR-1 plasmid_pMR-1=161613,chr=4969803
15217 Human herpesvirus 1 NC_001806=152261
lMaj5 Leishmania major 2005 chr1=268984,chr2=355714,chr3=384518,chr4=441313,chr5=465823,chr6=516874,chr7=596348,chr8=574972,chr9=573441,chr10=570864,chr11=582575,chr12=675347,chr13=654604,chr14=622648,chr15=629514,chr16=714659,chr17=684831,chr18=739751,chr19=702212,chr20=742551,chr21=772974,chr22=716608,chr23=772567,chr24=840950,chr25=912849,chr26=1091579,chr27=1130447,chr28=1160128,chr29=1212674,chr30=1403454,chr31=1484336,chr32=1604650,chr33=1583673,chr34=1866754,chr35=2090491,chr36=2682183
-arabidopsis Arabidopsis thaliana TAIR9
+arabidopsis Arabidopsis thaliana TAIR9 chr1=30427671,chr2=19698289,chr3=23459830,chr4=18585056,chr5=26975502
arabidopsis_tair8 Arabidopsis thaliana TAIR8
araTha1 Arabidopsis thaliana TAIR7
-mm5 Mouse May 2004 (mm5)
-Sscrofa9.58 Pig May 2010 (SGSC Sscrofa9.58)
+mm5 Mouse May 2004
+Sscrofa9.58 Pig May 2010 chr1=79819395,chr2=66741929,chr3=145240301,chr4=57436344,chr5=134546103,chr6=136414062,chr7=64400339,chr8=77440658,chr9=54314914,chr10=295534705,chr11=16613,chr12=123604780,chr13=140138492,chr14=100521970,chr15=136259946,chr16=125876292,chr17=123310171,chr18=132473591,chrM=119990671,chrX=148515138
+AaegL1 Mosquito (Aedes aegypti)
+AgamP3 Mosquito (Anopheles gambiae) chr3L=41963435,chr2L=49364325,chrX=24393108,chr2R=61545105,chrY_unplaced=237045,chr3R=53200684,chrUn=42389979,chrM=15363
+CpipJ1 Mosquito (Culex quinquefasciatus)
+IscaW1 Deer Tick (Ixodes scapularis)
+PhumU1 Head Louse (Pediculus humanus)
+bosTauMd3 Cow Aug. 2009 (UMD3.1)
+droWil1 D. willistoni Feb. 2006
+droAna3 D. ananassae Feb. 2006
+droEre2 D. erecta Feb. 2006
+droGri2 D. grimshawi Feb. 2006
+droMoj3 D. mojavensis Feb. 2006
+droSec1 D. sechellia Oct. 2005
+droSim1 D. simulans Apr. 2005 chrU=15797150,chr4=949497,chrYh_random=100575,chr3R=27517382,chr3R_random=1307089,chr3L=22553184,chr2L=22036055,chr2h_random=3178526,chrX_random=5698898,chrXh_random=84659,chrX=17042790,chr4_random=134295,chr2R=19596830,chr2R_random=2996586,chr3L_random=1049610,chr2L_random=909653,chrM=14972,chr3h_random=1452968
+droVir3 D. virilis Feb. 2006
+Bombyx_mori_p50T_2.0 Silkworm
+oryza_sativa_japonica_nipponbare_IRGSP4.0 Rice (Oryza sativa ssp. japonica var. Nipponbare) chr1=30357780,chr10=32124789,chr11=30039014,chr12=35863200,chr2=37257345,chr3=36823111,chr4=45064769,chr5=134525,chr6=23843360,chr7=28530027,chr8=27757321,chr9=30828668,chrM=23661561,plastid=490520
+Schizosaccharomyces_pombe_1.1 Fission Yeast (S. pombe) chrII=4539804,chrIII=2452883,chrI=5579133,chrM=19431
+Xanthomonas_oryzae_PXO99A Xanthomonas oryzae pv. oryzae PXO99A chr=5240075
+eschColi_EC4115 Escherichia coli EC4115 chr=5572075,plasmid_pO157=94644,plasmid_pEC4115=37452
+eschColi_TW14359 Escherichia coli TW14359 chr=5528136,plasmid_pO157=94601
+pUC18 pUC18 Plasmid
+nomLeu1 Gibbon chr1=245538060,chr10=135320619,chr10_random=51011,chr11=134551115,chr12=132397767,chr12_random=336702,chr13=114140689,chr14=106383727,chr15=100373758,chr15_random=814500,chr16=88836341,chr16_random=121782,chr17=78641643,chr17_random=2617017,chr18=76124575,chr19=63791437,chr19_random=297341,chr1_random=3502083,chr2=242756806,chr20=62432189,chr21=47019833,chr22=49520868,chr22_random=31530,chr2_random=335351,chr3=199337376,chr3_random=950829,chr4=191633586,chr4_random=923474,chr5=180612635,chr5_random=150620,chr6=170839170,chr6_random=1837487,chr7=158619002,chr7_random=805938,chr8=146283503,chr8_random=649034,chr9=138402467,chr9_random=1315712,chrUn=217400297,chrX=154793867,chrX_random=1690203,chrY=57470892
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
0
commit/galaxy-central: kanwei: Make left and right panels openable to 1000px, up from 400px
by Bitbucket 08 Feb '11
by Bitbucket 08 Feb '11
08 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/bf9758428206/
changeset: r5026:bf9758428206
user: kanwei
date: 2011-02-09 00:07:27
summary: Make left and right panels openable to 1000px, up from 400px
affected #: 3 files (238 bytes)
--- a/static/scripts/galaxy.panels.js Tue Feb 08 17:45:03 2011 -0500
+++ b/static/scripts/galaxy.panels.js Tue Feb 08 18:07:27 2011 -0500
@@ -8,6 +8,9 @@
}
}
+var MIN_PANEL_WIDTH = 100,
+ MAX_PANEL_WIDTH = 1000;
+
function make_left_panel( panel_el, center_el, border_el ) {
var hidden = false;
var saved_size = null;
@@ -54,7 +57,7 @@
}).bind( "drag", function( e, d ) {
x = d.offsetX;
// Limit range
- x = Math.min( 400, Math.max( 100, x ) );
+ x = Math.min( MAX_PANEL_WIDTH, Math.max( MIN_PANEL_WIDTH, x ) );
// Resize
if ( hidden ) {
$( panel_el ).css( "left", 0 );
@@ -74,9 +77,10 @@
};
function make_right_panel( panel_el, center_el, border_el ) {
- var hidden = false;
- var hidden_by_tool = false;
- var saved_size = null;
+ var hidden = false,
+ hidden_by_tool = false,
+ saved_size = null;
+
var resize = function( x ) {
$( panel_el ).css( "width", x );
$( center_el ).css( "right", x+9 );
@@ -136,8 +140,8 @@
x = d.offsetX;
w = $(window).width();
// Limit range
- x = Math.min( w - 100, x );
- x = Math.max( w - 400, x );
+ x = Math.min( w - MIN_PANEL_WIDTH, x );
+ x = Math.max( w - MAX_PANEL_WIDTH, x );
// Resize
if ( hidden ) {
$( panel_el ).css( "right", 0 );
--- a/static/scripts/packed/galaxy.panels.js Tue Feb 08 17:45:03 2011 -0500
+++ b/static/scripts/packed/galaxy.panels.js Tue Feb 08 18:07:27 2011 -0500
@@ -1,1 +1,1 @@
-function ensure_dd_helper(){if($("#DD-helper").length==0){$("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}function make_left_panel(h,c,e){var g=false;var f=null;var d=function(i){var j=i;if(i<0){i=0}$(h).css("width",i);$(e).css("left",j);$(c).css("left",i+7);if(document.recalc){document.recalc()}};var a=function(){if(g){$(e).removeClass("hover");$(e).animate({left:f},"fast");$(h).css("left",-f).show().animate({left:0},"fast",function(){d(f);$(e).removeClass("hidden")});g=false}else{f=$(e).position().left;$(c).css("left",$(e).innerWidth());if(document.recalc){document.recalc()}$(e).removeClass("hover");$(h).animate({left:-f},"fast");$(e).animate({left:-1},"fast",function(){$(this).addClass("hidden")});g=true}};$(e).bind("dragstart",function(){$("#DD-helper").show()}).bind("dragend",function(){$("#DD-helper").hide()}).bind("drag",function(i,j){x=j.offsetX;x=Math.min(400,Math.max(100,x));if(g){$(h).css("left",0);$(e).removeClass("hidden");g=false}d(x)}).bind("dragclickonly",function(){a()}).find("div").show();var b=function(i){if((g&&i=="show")||(!g&&i=="hide")){a()}};return{force_panel:b}}function make_right_panel(a,e,h){var j=false;var g=false;var c=null;var d=function(k){$(a).css("width",k);$(e).css("right",k+9);$(h).css("right",k).css("left","");if(document.recalc){document.recalc()}};var i=function(){if(j){$(h).removeClass("hover");$(h).animate({right:c},"fast");$(a).css("right",-c).show().animate({right:0},"fast",function(){d(c);$(h).removeClass("hidden")});j=false}else{c=$(document).width()-$(h).position().left-$(h).outerWidth();$(e).css("right",$(h).innerWidth()+1);if(document.recalc){document.recalc()}$(h).removeClass("hover");$(a).animate({right:-c},"fast");$(h).animate({right:-1},"fast",function(){$(this).addClass("hidden")});j=true}g=false};var b=function(k){var l=$(e).width()-(j?c:0);if(l<k){if(!j){i();g=true}}else{if(g){i();g=false}}};$(h).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(){$("#DD-helper").show()}).bind("dragend",function(){$("#DD-helper").hide()}).bind("drag",function(k,l){x=l.offsetX;w=$(window).width();x=Math.min(w-100,x);x=Math.max(w-400,x);if(j){$(a).css("right",0);$(h).removeClass("hidden");j=false}d(w-x-$(this).outerWidth())}).bind("dragclickonly",function(){i()}).find("div").show();var f=function(k){if((j&&k=="show")||(!j&&k=="hide")){i()}};return{handle_minwidth_hint:b,force_panel:f}}function hide_modal(){$(".dialog-box-container").fadeOut(function(){$("#overlay").hide();$(".dialog-box").find(".body").children().remove()})}function show_modal(h,c,f,d,g){if(h){$(".dialog-box").find(".title").html(h);$(".dialog-box").find(".unified-panel-header").show()}else{$(".dialog-box").find(".unified-panel-header").hide()}var a=$(".dialog-box").find(".buttons").html("");if(f){$.each(f,function(b,i){a.append($("<button/>").text(b).click(i));a.append(" ")});a.show()}else{a.hide()}var a=$(".dialog-box").find(".extra_buttons").html("");if(d){$.each(d,function(b,i){a.append($("<button/>").text(b).click(i));a.append(" ")});a.show()}else{a.hide()}if(c=="progress"){c=$("<img/>").attr("src",image_path+"/yui/rel_interstitial_loading.gif")}var e=$(".dialog-box").find(".body");e.css("min-width","");$(".dialog-box").find(".body").html(c);if(!$(".dialog-box-container").is(":visible")){$("#overlay").show();$(".dialog-box-container").fadeIn()}e.css("min-width",e.width());if(g){g()}}function show_in_overlay(c){var d=c.width||"600";var b=c.height||"400";var a=c.scroll||"auto";$("#overlay-background").bind("click.overlay",function(){hide_modal();$("#overlay-background").unbind("click.overlay")});show_modal(null,$("<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='"+image_path+"/closebox.png'><iframe style='margin: 0; padding: 0;' src='"+c.url+"' width='"+d+"' height='"+b+"' scrolling='"+a+"' frameborder='0'></iframe></div>"));$("#close_button").bind("click",function(){hide_modal()})}$(function(){$(".tab").each(function(){var a=$(this).children(".submenu");if(a.length>0){if($.browser.msie){a.prepend("<iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; filter:Alpha(Opacity='0');\"></iframe>")}$(this).hover(function(){a.show()},function(){a.hide()});a.click(function(){a.hide()})}})});function user_changed(a,b){if(a){$(".loggedin-only").show();$(".loggedout-only").hide();$("#user-email").text(a);if(b){$(".admin-only").show()}}else{$(".loggedin-only").hide();$(".loggedout-only").show();$(".admin-only").hide()}};
\ No newline at end of file
+function ensure_dd_helper(){if($("#DD-helper").length==0){$("<div id='DD-helper'/>").css({background:"white",opacity:0,zIndex:9000,position:"absolute",top:0,left:0,width:"100%",height:"100%"}).appendTo("body").hide()}}var MIN_PANEL_WIDTH=100,MAX_PANEL_WIDTH=1000;function make_left_panel(h,c,e){var g=false;var f=null;var d=function(i){var j=i;if(i<0){i=0}$(h).css("width",i);$(e).css("left",j);$(c).css("left",i+7);if(document.recalc){document.recalc()}};var a=function(){if(g){$(e).removeClass("hover");$(e).animate({left:f},"fast");$(h).css("left",-f).show().animate({left:0},"fast",function(){d(f);$(e).removeClass("hidden")});g=false}else{f=$(e).position().left;$(c).css("left",$(e).innerWidth());if(document.recalc){document.recalc()}$(e).removeClass("hover");$(h).animate({left:-f},"fast");$(e).animate({left:-1},"fast",function(){$(this).addClass("hidden")});g=true}};$(e).bind("dragstart",function(){$("#DD-helper").show()}).bind("dragend",function(){$("#DD-helper").hide()}).bind("drag",function(i,j){x=j.offsetX;x=Math.min(MAX_PANEL_WIDTH,Math.max(MIN_PANEL_WIDTH,x));if(g){$(h).css("left",0);$(e).removeClass("hidden");g=false}d(x)}).bind("dragclickonly",function(){a()}).find("div").show();var b=function(i){if((g&&i=="show")||(!g&&i=="hide")){a()}};return{force_panel:b}}function make_right_panel(a,e,h){var j=false,g=false,c=null;var d=function(k){$(a).css("width",k);$(e).css("right",k+9);$(h).css("right",k).css("left","");if(document.recalc){document.recalc()}};var i=function(){if(j){$(h).removeClass("hover");$(h).animate({right:c},"fast");$(a).css("right",-c).show().animate({right:0},"fast",function(){d(c);$(h).removeClass("hidden")});j=false}else{c=$(document).width()-$(h).position().left-$(h).outerWidth();$(e).css("right",$(h).innerWidth()+1);if(document.recalc){document.recalc()}$(h).removeClass("hover");$(a).animate({right:-c},"fast");$(h).animate({right:-1},"fast",function(){$(this).addClass("hidden")});j=true}g=false};var b=function(k){var l=$(e).width()-(j?c:0);if(l<k){if(!j){i();g=true}}else{if(g){i();g=false}}};$(h).hover(function(){$(this).addClass("hover")},function(){$(this).removeClass("hover")}).bind("dragstart",function(){$("#DD-helper").show()}).bind("dragend",function(){$("#DD-helper").hide()}).bind("drag",function(k,l){x=l.offsetX;w=$(window).width();x=Math.min(w-MIN_PANEL_WIDTH,x);x=Math.max(w-MAX_PANEL_WIDTH,x);if(j){$(a).css("right",0);$(h).removeClass("hidden");j=false}d(w-x-$(this).outerWidth())}).bind("dragclickonly",function(){i()}).find("div").show();var f=function(k){if((j&&k=="show")||(!j&&k=="hide")){i()}};return{handle_minwidth_hint:b,force_panel:f}}function hide_modal(){$(".dialog-box-container").fadeOut(function(){$("#overlay").hide();$(".dialog-box").find(".body").children().remove()})}function show_modal(h,c,f,d,g){if(h){$(".dialog-box").find(".title").html(h);$(".dialog-box").find(".unified-panel-header").show()}else{$(".dialog-box").find(".unified-panel-header").hide()}var a=$(".dialog-box").find(".buttons").html("");if(f){$.each(f,function(b,i){a.append($("<button/>").text(b).click(i));a.append(" ")});a.show()}else{a.hide()}var a=$(".dialog-box").find(".extra_buttons").html("");if(d){$.each(d,function(b,i){a.append($("<button/>").text(b).click(i));a.append(" ")});a.show()}else{a.hide()}if(c=="progress"){c=$("<img/>").attr("src",image_path+"/yui/rel_interstitial_loading.gif")}var e=$(".dialog-box").find(".body");e.css("min-width","");$(".dialog-box").find(".body").html(c);if(!$(".dialog-box-container").is(":visible")){$("#overlay").show();$(".dialog-box-container").fadeIn()}e.css("min-width",e.width());if(g){g()}}function show_in_overlay(c){var d=c.width||"600";var b=c.height||"400";var a=c.scroll||"auto";$("#overlay-background").bind("click.overlay",function(){hide_modal();$("#overlay-background").unbind("click.overlay")});show_modal(null,$("<div style='margin: -5px;'><img id='close_button' style='position:absolute;right:-17px;top:-15px;src='"+image_path+"/closebox.png'><iframe style='margin: 0; padding: 0;' src='"+c.url+"' width='"+d+"' height='"+b+"' scrolling='"+a+"' frameborder='0'></iframe></div>"));$("#close_button").bind("click",function(){hide_modal()})}$(function(){$(".tab").each(function(){var a=$(this).children(".submenu");if(a.length>0){if($.browser.msie){a.prepend("<iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; filter:Alpha(Opacity='0');\"></iframe>")}$(this).hover(function(){a.show()},function(){a.hide()});a.click(function(){a.hide()})}})});function user_changed(a,b){if(a){$(".loggedin-only").show();$(".loggedout-only").hide();$("#user-email").text(a);if(b){$(".admin-only").show()}}else{$(".loggedin-only").hide();$(".loggedout-only").show();$(".admin-only").hide()}};
\ No newline at end of file
--- a/static/scripts/packed/trackster.js Tue Feb 08 17:45:03 2011 -0500
+++ b/static/scripts/packed/trackster.js Tue Feb 08 18:07:27 2011 -0500
@@ -1,1 +1,1 @@
-CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",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="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var k=$("<div class='form-row' />").appendTo(a);k.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){k.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var i=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(i);var j=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(i).appendTo(k).bind("click",function(l){i.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){i.hide();$(document).unbind("click.color-picker")});l.stopPropagation()})}else{k.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(this.dataset_check_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom,low:a.view.max_low,high:a.view.max_high},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").attr("id",d+"_error");c.text("View error");$("#"+d+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b==="data"){a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};h["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();o.is_overview=true;o.set_overview();for(var i in j.tracks){if(j.tracks[i]!==o){j.tracks[i].is_overview=false}}};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var l=this.view.low,f=this.view.high,h=f-l,e=this.view.resolution;var o=$("<div style='position: relative;'></div>"),q=this.content_div.width()/h;this.content_div.append(o);this.max_height=0;var b=Math.floor(l/e/DENSITY);var k=0;while((b*DENSITY*e)<f){var m=this.content_div.width()+"_"+q+"_"+b;var d=this.tile_cache.get(m);var j=b*DENSITY*this.view.resolution;var p=j+DENSITY*this.view.resolution;if(!a&&d){this.show_tile(d,o,j)}else{this.delayed_draw(a,m,j,p,b,e,o,q,k)}b+=1}var c=this;var n=setInterval(function(){if(k===0){var t=c.content_div.children();var s=false;for(var u=t.length-1,r=0;u>=r;u--){var w=$(t[u]);if(s){w.remove()}else{if(w.children().length!==0){s=true}}}for(var v=0;v<c.filters.length;v++){c.filters[v].update_ui_elt()}clearInterval(n)}},50);for(var g=0;g<this.child_tracks.length;g++){this.child_tracks[g].draw(a)}},delayed_draw:function(b,h,g,j,c,e,i,k,f){var d=this;var a=setTimeout(function(){if(g<=d.view.high&&j>=d.view.low){var l;if(!b){l=d.tile_cache.get(h)}if(!l){l=d.draw_tile(e,c,i,k);if(l){var m=$("<div class='track-tile'>").prepend(l);if(l.hasClass(FILTERABLE_CLASS)){m.addClass(FILTERABLE_CLASS)}l=m}}if(l){d.tile_cache.set(h,l);d.show_tile(l,i,g)}}delete f--},50);f++},show_tile:function(a,f,d){var b=this;var c=this.view.high-this.view.low,g=this.content_div.width()/c,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,d,p){var r=this.inc_slots[a];if(!r||(r.mode!==p)){r={};r.w_scale=a;r.mode=p;this.inc_slots[a]=r;this.s_e_by_tile[a]={}}var l=r.w_scale,x=[],y=[],j=0,n=this.view.max_low;for(var v=0,w=h.length;v<w;v++){var g=h[v],k=g[0];if(r[k]!==undefined){j=Math.max(j,r[k]);y.push(r[k])}else{x.push(v)}}var q=this.s_e_by_tile[a];var m=function(D,E){var C;for(var B=0,F;B<=MAX_FEATURE_DEPTH;B++){C=true;F=q[B];if(F!==undefined){for(var z=0,A=F.length;z<A;z++){var i=F[z];if(E>i[0]&&D<i[1]){C=false;break}}}if(C){break}}if(C){return B}else{return -1}};for(var v=0,w=x.length;v<w;v++){var g=h[x[v]],k=g[0],t=g[1],b=g[2],o=g[3],c=Math.floor((t-n)*l),f=Math.ceil((b-n)*l),u=CONTEXT.measureText(o).width,e;if(o!==undefined&&!d){u+=(LABEL_SPACING+4);if(c-u>=0){c-=u;e="left"}else{f+=u;e="right"}}var s=m(c,f);if(s<0){}if(s>=0){slot=q[s];if(slot===undefined){slot=q[s]=[]}slot.push([c,f]);r[k]=s;j=Math.max(j,s)}else{}}return j},rect_or_text:function(r,l,u,b,q,j,g,f){r.textAlign="center";var d=0,s=0,p=Math.round(l/2);for(var m=0,t=j.length;m<t;m++){var k=j[m],e="MIDNSHP=X"[k[0]],n=k[1];if(e==="H"||e==="S"){d-=n}var h=q+d,x=Math.floor(Math.max(0,(h-u)*l)),i=Math.floor(Math.max(0,(h+n-u)*l));switch(e){case"H":break;case"S":case"M":case"=":var o=g.slice(s,s+n);if((this.mode==="Pack"||this.mode==="Auto")&&g!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+1,i-x,9);r.fillStyle=CONNECTOR_COLOR;for(var v=0,a=o.length;v<a;v++){if(h+v>=u&&h+v<=b){var w=Math.floor(Math.max(0,(h+v-u)*l));r.fillText(o[v],w+this.left_offset+p,f+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+(this.mode!="Dense"?4:5),i-x,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}s+=n;break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(x+this.left_offset,f+5,i-x,1);break;case"D":r.fillStyle="red";r.fillRect(x+this.left_offset,f+4,i-x,3);break;case"P":break;case"I":s+=n;break;case"X":s+=n;break}d+=n}},draw_tile:function(ah,n,r,ax){var M=n*DENSITY*ah,am=(n+1)*DENSITY*ah,L=am-M;var H=this.data_cache.get_data(M,am,this.mode);if(H===undefined||H==="pending"||(this.mode!=="Auto"&&H.dataset_type==="summary_tree")){this.data_queue[[M,am]]=true;this.get_data(M,am);return}var a=Math.ceil(L*ax),aj=this.prefs.label_color,h=this.prefs.block_color,q=this.mode,v=25,ad,X=this.left_offset,aw,C,ay;var p=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(p)}p=$(p);if(H.dataset_type==="summary_tree"){C=this.summary_draw_height}else{if(q==="Dense"){C=v;ay=DENSE_TRACK_HEIGHT}else{if(q==="Squish"){ay=SQUISH_TRACK_HEIGHT;ad=true}else{if(q==="Pack"){ay=PACK_TRACK_HEIGHT;ad=false}else{if(H.extra_info==="no_detail"){ay=(H.track_type==="bai"?SQUISH_TRACK_HEIGHT:NO_DETAIL_TRACK_HEIGHT);ad=true}else{ay=PACK_TRACK_HEIGHT;ad=false}}}var w=(ax<0.0001?1/this.view.zoom_res:ax);C=this.incremental_slots(w,H.data,ad,q)*ay+v;aw=this.inc_slots[w]}}p.get(0).width=a+X;p.get(0).height=C;r.parent().css("height",Math.max(this.height_px,C)+"px");var I=p.get(0).getContext("2d");I.fillStyle=h;I.font=this.default_font;I.textAlign="right";this.container_div.find(".yaxislabel").remove();if(H.dataset_type=="summary_tree"){var aa=H.data,K=H.max,b=Math.ceil(H.delta*ax);var o=$("<div />").addClass("yaxislabel");o.text(K);o.css({position:"absolute",top:"22px",left:"10px"});o.prependTo(this.container_div);for(var aq=0,G=aa.length;aq<G;aq++){var ac=Math.floor((aa[aq][0]-M)*ax);var ab=aa[aq][1];if(!ab){continue}var an=ab/K*this.summary_draw_height;I.fillStyle="black";I.fillRect(ac+X,this.summary_draw_height-an,b,an);var Z=4;if(this.prefs.show_counts&&(I.measureText(ab).width+Z)<b){I.fillStyle="#666";I.textAlign="center";I.fillText(ab,ac+X+(b/2),10)}}return p}if(H.message){p.css({border:"solid red","border-width":"2px 2px 2px 0px"});I.fillStyle="red";I.textAlign="left";I.fillText(H.message,100+X,ay);return p}for(var au=0;au<this.filters.length;au++){if(H.data.length&&this.filters[au].applies_to(H.data[0])){p.addClass(FILTERABLE_CLASS);break}}var av=H.data;var ap=0;for(var aq=0,G=av.length;aq<G;aq++){var T=av[aq],Q=T[0],at=T[1],af=T[2],N=T[3];if(this.mode!="Dense"&&aw[Q]===undefined){continue}var ae=false;var V;for(var au=0;au<this.filters.length;au++){V=this.filters[au];V.update_attrs(T);if(!V.keep(T)){ae=true;break}}if(ae){continue}if(at<=am&&af>=M){if(H.dataset_type=="interval_index"){af-=1}var ag=Math.floor(Math.max(0,(at-M)*ax)),J=Math.ceil(Math.min(a,Math.max(0,(af-M)*ax))),Y=(q==="Dense"?1:(1+aw[Q]))*ay;var F,ak,O=null,az=null;if(H.dataset_type==="bai"){I.fillStyle=h;if(T[5] instanceof Array){var D=Math.floor(Math.max(0,(T[4][0]-M)*ax)),P=Math.ceil(Math.min(a,Math.max(0,(T[4][1]-M)*ax))),B=Math.floor(Math.max(0,(T[5][0]-M)*ax)),u=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-M)*ax)));if(T[4][1]>=M&&T[4][0]<=am&&T[4][2]){this.rect_or_text(I,ax,M,am,T[4][0],T[4][2],T[4][3],Y)}if(T[5][1]>=M&&T[5][0]<=am&&T[5][2]){this.rect_or_text(I,ax,M,am,T[5][0],T[5][2],T[5][3],Y)}if(B>P){I.fillStyle=CONNECTOR_COLOR;I.dashedLine(P+X,Y+5,X+B,Y+5)}}else{I.fillStyle=h;this.rect_or_text(I,ax,M,am,at,T[4],T[5],Y)}if(q!=="Dense"&&!ad&&at>M){I.fillStyle=this.prefs.label_color;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+X+LABEL_SPACING,Y+8)}else{I.textAlign="right";I.fillText(N,ag+X-LABEL_SPACING,Y+8)}I.fillStyle=h}}else{if(H.dataset_type==="interval_index"){if(q=="Auto"){if(T.length<=4){q="Squish"}else{q="Pack"}}if(q=="Dense"){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,DENSE_FEATURE_HEIGHT)}else{if(T.length<=4){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,DENSE_FEATURE_HEIGHT)}else{var E=T[5],W=T[6],ai=T[7],g=T[8];if(W&&ai){O=Math.floor(Math.max(0,(W-M)*ax));az=Math.ceil(Math.min(a,Math.max(0,(ai-M)*ax)))}var ar,R;if(q=="Squish"){ar=1;R=SQUISH_FEATURE_HEIGHT}else{ar=5;R=PACK_FEATURE_HEIGHT}if(!g){if(T.strand){if(T.strand=="+"){I.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){I.fillStyle=LEFT_STRAND_INV}}}else{I.fillStyle=CONNECTOR_COLOR}I.fillRect(ag+X,Y+(R-ar)/2+1,J-ag,R)}else{var A,S;if(q=="Squish"){I.fillStyle=CONNECTOR_COLOR;A=Y+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;S=1}else{if(E){var A=Y;var S=R;if(E=="+"){I.fillStyle=RIGHT_STRAND}else{if(E=="-"){I.fillStyle=LEFT_STRAND}}}else{I.fillStyle=CONNECTOR_COLOR;A+=(SQUISH_FEATURE_HEIGHT/2)+1;S=1}}I.fillRect(ag+X,A,J-ag,S);for(var ao=0,e=g.length;ao<e;ao++){var t=g[ao],d=Math.floor(Math.max(0,(t[0]-M)*ax)),U=Math.ceil(Math.min(a,Math.max((t[1]-M)*ax)));if(d>U){continue}I.fillStyle=h;I.fillRect(d+X,Y+(R-ar)/2+1,U-d,ar);if(O!==undefined&&!(d>az||U<O)){var al=Math.max(d,O),z=Math.min(U,az-1);I.fillRect(al+X,Y+1,z-al,R)}}}if(q=="Pack"&&at>M){I.fillStyle=aj;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,ag-2+X,Y+8)}I.fillStyle=h}}}}else{if(H.dataset_type==="vcf"){if(ad){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,1)}else{var s=T[4],m=T[5],c=T[6];F=9;ak=1;I.fillRect(ag+X,Y,J-ag,F);if(q!=="Dense"&&N!==undefined&&at>M){I.fillStyle=aj;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,ag-2+X,Y+8)}I.fillStyle=h}var l=s+" / "+m;if(at>M&&I.measureText(l).width<(J-ag)){I.fillStyle="white";I.textAlign="center";I.fillText(l,X+ag+(J-ag)/2,Y+8);I.fillStyle=h}}}}}ap++}}return p}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
+CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,PACK_SPACING=5,DEFAULT_FONT="9px Monaco, Lucida Console, monospace",DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",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="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}CONTEXT=DUMMY_CANVAS.getContext("2d");CONTEXT.font=DEFAULT_FONT;PX_PER_CHAR=CONTEXT.measureText("A").width;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var k=$("<div class='form-row' />").appendTo(a);k.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){k.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var i=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(i);var j=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(i).appendTo(k).bind("click",function(l){i.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){i.hide();$(document).unbind("click.color-picker")});l.stopPropagation()})}else{k.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(this.dataset_check_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom,low:a.view.max_low,high:a.view.max_high},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").attr("id",d+"_error");c.text("View error");$("#"+d+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b==="data"){a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};h["Set as overview"]=function(){j.overview_viewport.find("canvas").remove();o.is_overview=true;o.set_overview();for(var i in j.tracks){if(j.tracks[i]!==o){j.tracks[i].is_overview=false}}};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(a){var l=this.view.low,f=this.view.high,h=f-l,e=this.view.resolution;var o=$("<div style='position: relative;'></div>"),q=this.view.container.width()/h;this.content_div.append(o);this.max_height=0;var b=Math.floor(l/e/DENSITY);var k=0;while((b*DENSITY*e)<f){var m=this.content_div.width()+"_"+q+"_"+b;var d=this.tile_cache.get(m);var j=b*DENSITY*this.view.resolution;var p=j+DENSITY*this.view.resolution;if(!a&&d){this.show_tile(d,o,j)}else{this.delayed_draw(a,m,j,p,b,e,o,q)}b+=1}var c=this;var n=setInterval(function(){if(k===0){var t=c.content_div.children();var s=false;for(var u=t.length-1,r=0;u>=r;u--){var w=$(t[u]);if(s){w.remove()}else{if(w.children().length!==0){s=true}}}for(var v=0;v<c.filters.length;v++){c.filters[v].update_ui_elt()}clearInterval(n)}},50);for(var g=0;g<this.child_tracks.length;g++){this.child_tracks[g].draw(a)}},delayed_draw:function(b,g,f,i,c,e,h,j){var d=this;var a=setTimeout(function(){if(f<=d.view.high&&i>=d.view.low){var k;if(!b){k=d.tile_cache.get(g)}if(!k){k=d.draw_tile(e,c,h,j);if(k){var l=$("<div class='track-tile'>").prepend(k);if(k.hasClass(FILTERABLE_CLASS)){l.addClass(FILTERABLE_CLASS)}k=l}}if(k){d.tile_cache.set(g,k);d.show_tile(k,h,f)}}},50)},show_tile:function(a,f,d){var b=this;var c=this.view.high-this.view.low,g=this.content_div.width()/c,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font=DEFAULT_FONT;this.inc_slots={};this.data_queue={};this.start_end_dct={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,j,d,q){var r=this.inc_slots[a];if(!r||(r.mode!==q)){r={};r.w_scale=a;r.mode=q;this.inc_slots[a]=r;this.start_end_dct[a]={}}var m=r.w_scale,x=[],y=[],k=0,o=this.view.max_low;for(var v=0,w=j.length;v<w;v++){var h=j[v],l=h[0];if(r[l]!==undefined){k=Math.max(k,r[l]);y.push(r[l])}else{x.push(v)}}var e=this.start_end_dct[a];var n=function(D,E){for(var C=0;C<=MAX_FEATURE_DEPTH;C++){var A=false,F=e[C];if(F!==undefined){for(var z=0,B=F.length;z<B;z++){var i=F[z];if(E>i[0]&&D<i[1]){A=true;break}}}if(!A){return C}}return -1};for(var v=0,w=x.length;v<w;v++){var h=j[x[v]],l=h[0],t=h[1],b=h[2],p=h[3],c=Math.floor((t-o)*m),g=Math.ceil((b-o)*m),u=CONTEXT.measureText(p).width,f;if(p!==undefined&&!d){u+=(LABEL_SPACING+PACK_SPACING);if(c-u>=0){c-=u;f="left"}else{g+=u;f="right"}}var s=n(c,g);if(s>=0){if(e[s]===undefined){e[s]=[]}e[s].push([c,g]);r[l]=s;k=Math.max(k,s)}else{}}return k},rect_or_text:function(r,l,u,b,q,j,g,f){r.textAlign="center";var d=0,s=0,p=Math.round(l/2);for(var m=0,t=j.length;m<t;m++){var k=j[m],e="MIDNSHP=X"[k[0]],n=k[1];if(e==="H"||e==="S"){d-=n}var h=q+d,x=Math.floor(Math.max(0,(h-u)*l)),i=Math.floor(Math.max(0,(h+n-u)*l));switch(e){case"H":break;case"S":case"M":case"=":var o=g.slice(s,s+n);if((this.mode==="Pack"||this.mode==="Auto")&&g!==undefined&&l>PX_PER_CHAR){r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+1,i-x,9);r.fillStyle=CONNECTOR_COLOR;for(var v=0,a=o.length;v<a;v++){if(h+v>=u&&h+v<=b){var w=Math.floor(Math.max(0,(h+v-u)*l));r.fillText(o[v],w+this.left_offset+p,f+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+(this.mode!="Dense"?4:5),i-x,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}s+=n;break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(x+this.left_offset,f+5,i-x,1);break;case"D":r.fillStyle="red";r.fillRect(x+this.left_offset,f+4,i-x,3);break;case"P":break;case"I":s+=n;break;case"X":s+=n;break}d+=n}},draw_tile:function(ah,n,r,ax){var M=n*DENSITY*ah,am=(n+1)*DENSITY*ah,L=am-M;var H=this.data_cache.get_data(M,am,this.mode);if(H===undefined||H==="pending"||(this.mode!=="Auto"&&H.dataset_type==="summary_tree")){this.data_queue[[M,am]]=true;this.get_data(M,am);return}var a=Math.ceil(L*ax),aj=this.prefs.label_color,h=this.prefs.block_color,q=this.mode,v=25,ad,X=this.left_offset,aw,C,ay;var p=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(p)}p=$(p);if(H.dataset_type==="summary_tree"){C=this.summary_draw_height}else{if(q==="Dense"){C=v;ay=DENSE_TRACK_HEIGHT}else{if(q==="Squish"){ay=SQUISH_TRACK_HEIGHT;ad=true}else{if(q==="Pack"){ay=PACK_TRACK_HEIGHT;ad=false}else{if(H.extra_info==="no_detail"){ay=(H.track_type==="bai"?SQUISH_TRACK_HEIGHT:NO_DETAIL_TRACK_HEIGHT);ad=true}else{ay=PACK_TRACK_HEIGHT;ad=false}}}var w=(ax<0.0001?1/this.view.zoom_res:ax);C=this.incremental_slots(w,H.data,ad,q)*ay+v;aw=this.inc_slots[w]}}p.get(0).width=a+X;p.get(0).height=C;r.parent().css("height",Math.max(this.height_px,C)+"px");var I=p.get(0).getContext("2d");I.fillStyle=h;I.font=this.default_font;I.textAlign="right";this.container_div.find(".yaxislabel").remove();if(H.dataset_type=="summary_tree"){var aa=H.data,K=H.max,b=Math.ceil(H.delta*ax);var o=$("<div />").addClass("yaxislabel");o.text(K);o.css({position:"absolute",top:"22px",left:"10px"});o.prependTo(this.container_div);for(var aq=0,G=aa.length;aq<G;aq++){var ac=Math.floor((aa[aq][0]-M)*ax);var ab=aa[aq][1];if(!ab){continue}var an=ab/K*this.summary_draw_height;I.fillStyle="black";I.fillRect(ac+X,this.summary_draw_height-an,b,an);var Z=4;if(this.prefs.show_counts&&(I.measureText(ab).width+Z)<b){I.fillStyle="#666";I.textAlign="center";I.fillText(ab,ac+X+(b/2),10)}}return p}if(H.message){p.css({border:"solid red","border-width":"2px 2px 2px 0px"});I.fillStyle="red";I.textAlign="left";I.fillText(H.message,100+X,ay);return p}for(var au=0;au<this.filters.length;au++){if(H.data.length&&this.filters[au].applies_to(H.data[0])){p.addClass(FILTERABLE_CLASS);break}}var av=H.data;var ap=0;for(var aq=0,G=av.length;aq<G;aq++){var T=av[aq],Q=T[0],at=T[1],af=T[2],N=T[3];if(this.mode!="Dense"&&aw[Q]===undefined){continue}var ae=false;var V;for(var au=0;au<this.filters.length;au++){V=this.filters[au];V.update_attrs(T);if(!V.keep(T)){ae=true;break}}if(ae){continue}if(at<=am&&af>=M){if(H.dataset_type=="interval_index"){af-=1}var ag=Math.floor(Math.max(0,(at-M)*ax)),J=Math.ceil(Math.min(a,Math.max(0,(af-M)*ax))),Y=(q==="Dense"?1:(1+aw[Q]))*ay;var F,ak,O=null,az=null;if(H.dataset_type==="bai"){I.fillStyle=h;if(T[5] instanceof Array){var D=Math.floor(Math.max(0,(T[4][0]-M)*ax)),P=Math.ceil(Math.min(a,Math.max(0,(T[4][1]-M)*ax))),B=Math.floor(Math.max(0,(T[5][0]-M)*ax)),u=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-M)*ax)));if(T[4][1]>=M&&T[4][0]<=am&&T[4][2]){this.rect_or_text(I,ax,M,am,T[4][0],T[4][2],T[4][3],Y)}if(T[5][1]>=M&&T[5][0]<=am&&T[5][2]){this.rect_or_text(I,ax,M,am,T[5][0],T[5][2],T[5][3],Y)}if(B>P){I.fillStyle=CONNECTOR_COLOR;I.dashedLine(P+X,Y+5,X+B,Y+5)}}else{I.fillStyle=h;this.rect_or_text(I,ax,M,am,at,T[4],T[5],Y)}if(q!=="Dense"&&!ad&&at>M){I.fillStyle=this.prefs.label_color;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+X+LABEL_SPACING,Y+8)}else{I.textAlign="right";I.fillText(N,ag+X-LABEL_SPACING,Y+8)}I.fillStyle=h}}else{if(H.dataset_type==="interval_index"){if(q=="Auto"){if(T.length<=4){q="Squish"}else{q="Pack"}}if(q=="Dense"){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,DENSE_FEATURE_HEIGHT)}else{if(T.length<=4){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,DENSE_FEATURE_HEIGHT)}else{var E=T[5],W=T[6],ai=T[7],g=T[8];if(W&&ai){O=Math.floor(Math.max(0,(W-M)*ax));az=Math.ceil(Math.min(a,Math.max(0,(ai-M)*ax)))}var ar,R;if(q=="Squish"){ar=1;R=SQUISH_FEATURE_HEIGHT}else{ar=5;R=PACK_FEATURE_HEIGHT}if(!g){if(T.strand){if(T.strand=="+"){I.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){I.fillStyle=LEFT_STRAND_INV}}}else{I.fillStyle=CONNECTOR_COLOR}I.fillRect(ag+X,Y+(R-ar)/2+1,J-ag,R)}else{var A,S;if(q=="Squish"){I.fillStyle=CONNECTOR_COLOR;A=Y+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;S=1}else{if(E){var A=Y;var S=R;if(E=="+"){I.fillStyle=RIGHT_STRAND}else{if(E=="-"){I.fillStyle=LEFT_STRAND}}}else{I.fillStyle=CONNECTOR_COLOR;A+=(SQUISH_FEATURE_HEIGHT/2)+1;S=1}}I.fillRect(ag+X,A,J-ag,S);for(var ao=0,e=g.length;ao<e;ao++){var t=g[ao],d=Math.floor(Math.max(0,(t[0]-M)*ax)),U=Math.ceil(Math.min(a,Math.max((t[1]-M)*ax)));if(d>U){continue}I.fillStyle=h;I.fillRect(d+X,Y+(R-ar)/2+1,U-d,ar);if(O!==undefined&&!(d>az||U<O)){var al=Math.max(d,O),z=Math.min(U,az-1);I.fillRect(al+X,Y+1,z-al,R)}}}if(q=="Pack"&&at>M){I.fillStyle=aj;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+X+LABEL_SPACING,Y+8)}else{I.textAlign="right";I.fillText(N,ag+X-LABEL_SPACING,Y+8)}I.fillStyle=h}}}}else{if(H.dataset_type==="vcf"){if(ad){I.fillStyle=h;I.fillRect(ag+X,Y+5,J-ag,1)}else{var s=T[4],m=T[5],c=T[6];F=9;ak=1;I.fillRect(ag+X,Y,J-ag,F);if(q!=="Dense"&&N!==undefined&&at>M){I.fillStyle=aj;if(n===0&&ag-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+X,Y+8)}else{I.textAlign="right";I.fillText(N,ag-2+X,Y+8)}I.fillStyle=h}var l=s+" / "+m;if(at>M&&I.measureText(l).width<(J-ag)){I.fillStyle="white";I.textAlign="center";I.fillText(l,X+ag+(J-ag)/2,Y+8);I.fillStyle=h}}}}}ap++}}return p}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
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
0