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
October 2012
- 1 participants
- 194 discussions
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/7b3a7a3ea9af/
changeset: 7b3a7a3ea9af
user: smcmanus
date: 2012-10-03 00:30:08
summary: Cleanup
affected #: 3 files
diff -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 -r 7b3a7a3ea9afc3de218c7c5f2c52cdfa717ee5c5 lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -321,31 +321,23 @@
log.exception( '(%s) Failed to change ownership of %s, failing' % ( job.id, self.working_directory ) )
return self.fail( job.info, stdout=stdout, stderr=stderr, exit_code=tool_exit_code )
- log.debug( "############## JobWrapper.finish: %s exit code"
- % ( "None" if None == tool_exit_code else str(tool_exit_code)))
# if the job was deleted, don't finish it
if job.state == job.states.DELETED or job.state == job.states.ERROR:
- # ERROR at this point means the job was deleted by an administrator.
# SM: Note that, at this point, the exit code must be saved in case
# there was an error. Errors caught here could mean that the job
# was deleted by an administrator (based on old comments), but it
# could also mean that a job was broken up into tasks and one of
- # the tasks failed. So
+ # the tasks failed. So include the stderr, stdout, and exit code:
return self.fail( job.info, stderr=stderr, stdout=stdout, exit_code=tool_exit_code )
# Check the tool's stdout, stderr, and exit code for errors, but only
# if the job has not already been marked as having an error.
# The job's stdout and stderr will be set accordingly.
- log.debug( "############## JobWrapper.finish: Post-check exit code: %s/%s"
- % ( ( "None" if None == tool_exit_code else str(tool_exit_code) ),
- ( "None" if None == job.exit_code else str(job.exit_code) ) ) )
if job.states.ERROR != job.state:
if ( self.check_tool_output( stdout, stderr, tool_exit_code, job )):
job.state = job.states.OK
else:
job.state = job.states.ERROR
- log.debug( "############## JobWrapper.finish: Post-check exit code: %s"
- % ( "None" if None == tool_exit_code else str(tool_exit_code)))
if self.version_string_cmd:
version_filename = self.get_version_string_path()
@@ -471,8 +463,6 @@
# is either incorrect or has the wrong semantics.
if None != tool_exit_code:
job.exit_code = tool_exit_code
- log.debug( "############## JobWrapper.finish: storing %s exit code"
- % ( "None" if None == job.exit_code else str(job.exit_code)))
# custom post process setup
inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
diff -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 -r 7b3a7a3ea9afc3de218c7c5f2c52cdfa717ee5c5 lib/galaxy/jobs/runners/local.py
--- a/lib/galaxy/jobs/runners/local.py
+++ b/lib/galaxy/jobs/runners/local.py
@@ -143,10 +143,7 @@
# Finish the job!
try:
- #job_wrapper.finish( stdout, stderr, exit_code )
- # DELETEME: This is for testing how null exit codes are handled:
- log.debug( "############## Finishing job - None exit code" )
- job_wrapper.finish( stdout, stderr, None )
+ job_wrapper.finish( stdout, stderr, exit_code )
except:
log.exception("Job wrapper finish method failed")
job_wrapper.fail("Unable to finish job", exception=True)
diff -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 -r 7b3a7a3ea9afc3de218c7c5f2c52cdfa717ee5c5 lib/galaxy/jobs/runners/tasks.py
--- a/lib/galaxy/jobs/runners/tasks.py
+++ b/lib/galaxy/jobs/runners/tasks.py
@@ -64,7 +64,7 @@
# thing as the last task to complete, which could be added later.
# o if a task fails, then the job will fail and the failing task's
# exit code will become the job's exit code.
- job_exit_code = ""
+ job_exit_code = None
# If we were able to get a command line, run the job. ( must be passed to tasks )
if command_line:
@@ -112,17 +112,14 @@
# Deleted tasks are not included right now.
#
while tasks_complete is False:
- log.debug( "************ Rechecking tasks" )
count_complete = 0
tasks_complete = True
for tw in task_wrappers:
task_state = tw.get_state()
- log.debug( "***** Checking task %d: state %s"
- % (tw.task_id, task_state) )
if ( model.Task.states.ERROR == task_state ):
job_exit_code = tw.get_exit_code()
- log.debug( "Canceling job %d: Task %s returned an error (exit code %d)"
- % ( tw.job_id, tw.task_id, job_exit_code ) )
+ log.debug( "Canceling job %d: Task %s returned an error"
+ % ( tw.job_id, tw.task_id ) )
self.cancel_job( job_wrapper, task_wrappers )
tasks_complete = True
break
@@ -136,8 +133,6 @@
if sleep_time < 8:
sleep_time *= 2
import time
- log.debug( "####################### Finished with tasks; job exit code: %d" % job_exit_code )
-
job_wrapper.reclaim_ownership() # if running as the actual user, change ownership before merging.
log.debug('execution finished - beginning merge: %s' % command_line)
stdout, stderr = splitter.do_merge(job_wrapper, task_wrappers)
@@ -164,7 +159,6 @@
# Finish the job
try:
- log.debug( "$$$$$$$$$$$$$$ job_exit_code before finish: %d" % job_exit_code )
job_wrapper.finish( stdout, stderr, job_exit_code )
except:
log.exception("Job wrapper finish method failed")
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 commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/3d07a7800f9a/
changeset: 3d07a7800f9a
user: smcmanus
date: 2012-10-03 00:20:12
summary: The task runner now chooses an exit code based on the tasks' exit codes - if the tasks are successful, then the last exit code scanned is chosen, and if a task fails then the first scanned failing task's exit code is chosen. The JobWrapper's fail method also stores stdout, stderr, and the exit code if they're available, though this will currently only applies to when a Job using the task runner fails. A null/None exit code is also now supported.
affected #: 4 files
diff -r 6d45fd1d830ee85edcdc07ba93831c316102e81a -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 lib/galaxy/jobs/__init__.py
--- a/lib/galaxy/jobs/__init__.py
+++ b/lib/galaxy/jobs/__init__.py
@@ -204,7 +204,7 @@
self.version_string_cmd = self.tool.version_string_cmd
return extra_filenames
- def fail( self, message, exception=False ):
+ def fail( self, message, exception=False, stdout="", stderr="", exit_code=None ):
"""
Indicate job failure by setting state and message on all output
datasets.
@@ -249,6 +249,20 @@
job.state = job.states.ERROR
job.command_line = self.command_line
job.info = message
+ # TODO: Put setting the stdout, stderr, and exit code in one place
+ # (not duplicated with the finish method).
+ if ( len( stdout ) > 32768 ):
+ stdout = stdout[:32768]
+ log.info( "stdout for job %d is greater than 32K, only first part will be logged to database" % job.id )
+ job.stdout = stdout
+ if ( len( stderr ) > 32768 ):
+ stderr = stderr[:32768]
+ log.info( "stderr for job %d is greater than 32K, only first part will be logged to database" % job.id )
+ job.stderr = stderr
+ # Let the exit code be Null if one is not provided:
+ if ( exit_code != None ):
+ job.exit_code = exit_code
+
self.sa_session.add( job )
self.sa_session.flush()
#Perform email action even on failure.
@@ -290,7 +304,7 @@
self.sa_session.add( job )
self.sa_session.flush()
- def finish( self, stdout, stderr, tool_exit_code=0 ):
+ def finish( self, stdout, stderr, tool_exit_code=None ):
"""
Called to indicate that the associated command has been run. Updates
the output datasets based on stderr and stdout from the command, and
@@ -300,25 +314,38 @@
self.sa_session.expunge_all()
job = self.get_job()
+ # TODO: After failing here, consider returning from the function.
try:
self.reclaim_ownership()
except:
- self.fail( job.info )
log.exception( '(%s) Failed to change ownership of %s, failing' % ( job.id, self.working_directory ) )
+ return self.fail( job.info, stdout=stdout, stderr=stderr, exit_code=tool_exit_code )
+ log.debug( "############## JobWrapper.finish: %s exit code"
+ % ( "None" if None == tool_exit_code else str(tool_exit_code)))
# if the job was deleted, don't finish it
if job.state == job.states.DELETED or job.state == job.states.ERROR:
- #ERROR at this point means the job was deleted by an administrator.
- return self.fail( job.info )
+ # ERROR at this point means the job was deleted by an administrator.
+ # SM: Note that, at this point, the exit code must be saved in case
+ # there was an error. Errors caught here could mean that the job
+ # was deleted by an administrator (based on old comments), but it
+ # could also mean that a job was broken up into tasks and one of
+ # the tasks failed. So
+ return self.fail( job.info, stderr=stderr, stdout=stdout, exit_code=tool_exit_code )
# Check the tool's stdout, stderr, and exit code for errors, but only
# if the job has not already been marked as having an error.
# The job's stdout and stderr will be set accordingly.
+ log.debug( "############## JobWrapper.finish: Post-check exit code: %s/%s"
+ % ( ( "None" if None == tool_exit_code else str(tool_exit_code) ),
+ ( "None" if None == job.exit_code else str(job.exit_code) ) ) )
if job.states.ERROR != job.state:
if ( self.check_tool_output( stdout, stderr, tool_exit_code, job )):
job.state = job.states.OK
else:
job.state = job.states.ERROR
+ log.debug( "############## JobWrapper.finish: Post-check exit code: %s"
+ % ( "None" if None == tool_exit_code else str(tool_exit_code)))
if self.version_string_cmd:
version_filename = self.get_version_string_path()
@@ -358,7 +385,6 @@
# TODO: The context['stderr'] holds stderr's contents. An error
# only really occurs if the job also has an error. So check the
# job's state:
- #if context['stderr']:
if job.states.ERROR == job.state:
dataset.blurb = "error"
elif dataset.has_data():
@@ -435,12 +461,18 @@
self.sa_session.flush()
# Save stdout and stderr
if len( job.stdout ) > 32768:
- log.error( "stdout for job %d is greater than 32K, only first part will be logged to database" % job.id )
+ log.info( "stdout for job %d is greater than 32K, only first part will be logged to database" % job.id )
job.stdout = job.stdout[:32768]
if len( job.stderr ) > 32768:
- log.error( "stderr for job %d is greater than 32K, only first part will be logged to database" % job.id )
+ log.info( "stderr for job %d is greater than 32K, only first part will be logged to database" % job.id )
job.stderr = job.stderr[:32768]
- job.exit_code = tool_exit_code
+ # The exit code will be null if there is no exit code to be set.
+ # This is so that we don't assign an exit code, such as 0, that
+ # is either incorrect or has the wrong semantics.
+ if None != tool_exit_code:
+ job.exit_code = tool_exit_code
+ log.debug( "############## JobWrapper.finish: storing %s exit code"
+ % ( "None" if None == job.exit_code else str(job.exit_code)))
# custom post process setup
inp_data = dict( [ ( da.name, da.dataset ) for da in job.input_datasets ] )
out_data = dict( [ ( da.name, da.dataset ) for da in job.output_datasets ] )
@@ -513,26 +545,27 @@
# that range, then apply the error level and add a message.
# If we've reached a fatal error rule, then stop.
max_error_level = galaxy.tools.StdioErrorLevel.NO_ERROR
- for stdio_exit_code in self.tool.stdio_exit_codes:
- if ( tool_exit_code >= stdio_exit_code.range_start and
- tool_exit_code <= stdio_exit_code.range_end ):
- # Tack on a generic description of the code
- # plus a specific code description. For example,
- # this might prepend "Job 42: Warning: Out of Memory\n".
- code_desc = stdio_exit_code.desc
- if ( None == code_desc ):
- code_desc = ""
- tool_msg = ( "%s: Exit code %d: %s" % (
- galaxy.tools.StdioErrorLevel.desc( stdio_exit_code.error_level ),
- tool_exit_code,
- code_desc ) )
- log.info( "Job %s: %s" % (job.get_id_tag(), tool_msg) )
- stderr = tool_msg + "\n" + stderr
- max_error_level = max( max_error_level,
- stdio_exit_code.error_level )
- if ( max_error_level >=
- galaxy.tools.StdioErrorLevel.FATAL ):
- break
+ if tool_exit_code != None:
+ for stdio_exit_code in self.tool.stdio_exit_codes:
+ if ( tool_exit_code >= stdio_exit_code.range_start and
+ tool_exit_code <= stdio_exit_code.range_end ):
+ # Tack on a generic description of the code
+ # plus a specific code description. For example,
+ # this might prepend "Job 42: Warning (Out of Memory)\n".
+ code_desc = stdio_exit_code.desc
+ if ( None == code_desc ):
+ code_desc = ""
+ tool_msg = ( "%s: Exit code %d (%s)" % (
+ galaxy.tools.StdioErrorLevel.desc( stdio_exit_code.error_level ),
+ tool_exit_code,
+ code_desc ) )
+ log.info( "Job %s: %s" % (job.get_id_tag(), tool_msg) )
+ stderr = tool_msg + "\n" + stderr
+ max_error_level = max( max_error_level,
+ stdio_exit_code.error_level )
+ if ( max_error_level >=
+ galaxy.tools.StdioErrorLevel.FATAL ):
+ break
if max_error_level < galaxy.tools.StdioErrorLevel.FATAL:
# We'll examine every regex. Each regex specifies whether
@@ -1013,6 +1046,11 @@
self.sa_session.refresh( task )
return task.state
+ def get_exit_code( self ):
+ task = self.get_task()
+ self.sa_session.refresh( task )
+ return task.exit_code
+
def set_runner( self, runner_url, external_id ):
task = self.get_task()
self.sa_session.refresh( task )
@@ -1022,7 +1060,7 @@
self.sa_session.add( task )
self.sa_session.flush()
- def finish( self, stdout, stderr, tool_exit_code=0 ):
+ def finish( self, stdout, stderr, tool_exit_code=None ):
# DBTODO integrate previous finish logic.
# Simple finish for tasks. Just set the flag OK.
"""
@@ -1032,7 +1070,8 @@
"""
# This may have ended too soon
log.debug( 'task %s for job %d ended; exit code: %d'
- % (self.task_id, self.job_id, tool_exit_code) )
+ % (self.task_id, self.job_id,
+ tool_exit_code if tool_exit_code != None else -256 ) )
# default post job setup_external_metadata
self.sa_session.expunge_all()
task = self.get_task()
diff -r 6d45fd1d830ee85edcdc07ba93831c316102e81a -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 lib/galaxy/jobs/runners/local.py
--- a/lib/galaxy/jobs/runners/local.py
+++ b/lib/galaxy/jobs/runners/local.py
@@ -111,11 +111,8 @@
if sleep_time < 8:
# So we don't stat every second
sleep_time *= 2
- # Reap the process and get the exit code. The exit code should
- # only be None if the process isn't finished, but check anyway.
- exit_code = proc.wait() # reap
- if None == exit_code:
- exit_code = 0
+ # Reap the process and get the exit code.
+ exit_code = proc.wait()
stdout_file.seek( 0 )
stderr_file.seek( 0 )
stdout = stdout_file.read( 32768 )
@@ -146,7 +143,10 @@
# Finish the job!
try:
- job_wrapper.finish( stdout, stderr, exit_code )
+ #job_wrapper.finish( stdout, stderr, exit_code )
+ # DELETEME: This is for testing how null exit codes are handled:
+ log.debug( "############## Finishing job - None exit code" )
+ job_wrapper.finish( stdout, stderr, None )
except:
log.exception("Job wrapper finish method failed")
job_wrapper.fail("Unable to finish job", exception=True)
diff -r 6d45fd1d830ee85edcdc07ba93831c316102e81a -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 lib/galaxy/jobs/runners/tasks.py
--- a/lib/galaxy/jobs/runners/tasks.py
+++ b/lib/galaxy/jobs/runners/tasks.py
@@ -56,6 +56,16 @@
job_wrapper.fail( "failure preparing job", exception=True )
log.exception("failure running job %d" % job_wrapper.job_id)
return
+
+ # This is the job's exit code, which will depend on the tasks'
+ # exit code. The overall job's exit code will be one of two values:
+ # o if the job is successful, then the last task scanned will be
+ # used to determine the exit code. Note that this is not the same
+ # thing as the last task to complete, which could be added later.
+ # o if a task fails, then the job will fail and the failing task's
+ # exit code will become the job's exit code.
+ job_exit_code = ""
+
# If we were able to get a command line, run the job. ( must be passed to tasks )
if command_line:
try:
@@ -69,7 +79,9 @@
job_wrapper.fail("Job Splitting Failed, no match for '%s'" % job_wrapper.tool.parallelism)
return
tasks = splitter.do_split(job_wrapper)
- # Not an option for now. Task objects don't *do* anything useful yet, but we'll want them tracked outside this thread to do anything.
+ # Not an option for now. Task objects don't *do* anything
+ # useful yet, but we'll want them tracked outside this thread
+ # to do anything.
# if track_tasks_in_database:
task_wrappers = []
for task in tasks:
@@ -100,25 +112,31 @@
# Deleted tasks are not included right now.
#
while tasks_complete is False:
+ log.debug( "************ Rechecking tasks" )
count_complete = 0
tasks_complete = True
for tw in task_wrappers:
task_state = tw.get_state()
+ log.debug( "***** Checking task %d: state %s"
+ % (tw.task_id, task_state) )
if ( model.Task.states.ERROR == task_state ):
- log.debug( "Canceling job %d: Task %d returned an error"
- % ( tw.job_id, tw.task_id ) )
+ job_exit_code = tw.get_exit_code()
+ log.debug( "Canceling job %d: Task %s returned an error (exit code %d)"
+ % ( tw.job_id, tw.task_id, job_exit_code ) )
self.cancel_job( job_wrapper, task_wrappers )
tasks_complete = True
break
elif not task_state in completed_states:
tasks_complete = False
else:
+ job_exit_code = tw.get_exit_code()
count_complete = count_complete + 1
if tasks_complete is False:
sleep( sleep_time )
if sleep_time < 8:
sleep_time *= 2
import time
+ log.debug( "####################### Finished with tasks; job exit code: %d" % job_exit_code )
job_wrapper.reclaim_ownership() # if running as the actual user, change ownership before merging.
log.debug('execution finished - beginning merge: %s' % command_line)
@@ -146,7 +164,8 @@
# Finish the job
try:
- job_wrapper.finish( stdout, stderr )
+ log.debug( "$$$$$$$$$$$$$$ job_exit_code before finish: %d" % job_exit_code )
+ job_wrapper.finish( stdout, stderr, job_exit_code )
except:
log.exception("Job wrapper finish method failed")
job_wrapper.fail("Unable to finish job", exception=True)
diff -r 6d45fd1d830ee85edcdc07ba93831c316102e81a -r 3d07a7800f9af46e46c1f3ad3f0fe432949f3b51 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -134,7 +134,7 @@
self.post_job_actions = []
self.imported = False
self.handler = None
- self.exit_code = 0
+ self.exit_code = None
# TODO: Add accessors for members defined in SQL Alchemy for the Job table and
# for the mapper defined to the Job table.
@@ -317,10 +317,9 @@
self.task_runner_name = None
self.task_runner_external_id = None
self.job = job
- # SM: Using default empty strings avoids None exceptions later on.
self.stdout = ""
self.stderr = ""
- self.exit_code = 0
+ self.exit_code = None
self.prepare_input_files_cmd = prepare_files_cmd
def get_param_values( self, app ):
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: carlfeberhard: scatterplot: controls to client-side template
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/6d45fd1d830e/
changeset: 6d45fd1d830e
user: carlfeberhard
date: 2012-10-02 23:29:06
summary: scatterplot: controls to client-side template
affected #: 4 files
diff -r f66f88b2f743e3b3733e00756f7655003bf1880f -r 6d45fd1d830ee85edcdc07ba93831c316102e81a static/scripts/templates/compiled/template-visualization-scatterplotControlForm.js
--- /dev/null
+++ b/static/scripts/templates/compiled/template-visualization-scatterplotControlForm.js
@@ -0,0 +1,51 @@
+(function() {
+ var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
+templates['template-visualization-scatterplotControlForm'] = template(function (Handlebars,depth0,helpers,partials,data) {
+ helpers = helpers || Handlebars.helpers;
+ var buffer = "", stack1, foundHelper, functionType="function", escapeExpression=this.escapeExpression, self=this;
+
+function program1(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n <option value=\"";
+ foundHelper = helpers.index;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.index; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\">";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</option>\n ";
+ return buffer;}
+
+function program3(depth0,data) {
+
+ var buffer = "", stack1, foundHelper;
+ buffer += "\n <option value=\"";
+ foundHelper = helpers.index;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.index; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\">";
+ foundHelper = helpers.name;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "</option>\n ";
+ return buffer;}
+
+ buffer += "\n<div id=\"loading-indicator\" style=\"display: none;\">\n <img class=\"loading-img\" src=\"";
+ foundHelper = helpers.loadingIndicatorImagePath;
+ if (foundHelper) { stack1 = foundHelper.call(depth0, {hash:{}}); }
+ else { stack1 = depth0.loadingIndicatorImagePath; stack1 = typeof stack1 === functionType ? stack1() : stack1; }
+ buffer += escapeExpression(stack1) + "\" />\n <span class=\"loading-message\"></span>\n</div>\n\n";
+ buffer += "\n<div id=\"chart-settings\">\n\n ";
+ buffer += "\n <div id=\"x-column-input\">\n <label for=\"\">Data column for X: </label>\n <select name=\"x-column\">\n ";
+ stack1 = depth0.availableColumns;
+ stack1 = helpers.each.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(1, program1, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\n </select>\n </div>\n <div id=\"y-column-input\">\n <label for=\"\">Data column for Y: </label>\n <select name=\"y-column\">\n ";
+ stack1 = depth0.availableColumns;
+ stack1 = helpers.each.call(depth0, stack1, {hash:{},inverse:self.noop,fn:self.program(3, program3, data)});
+ if(stack1 || stack1 === 0) { buffer += stack1; }
+ buffer += "\n </select>\n </div>\n \n <input id=\"render-button\" type=\"button\" value=\"Draw\" />\n <div class=\"clear\"></div>\n</div>";
+ return buffer;});
+})();
\ No newline at end of file
diff -r f66f88b2f743e3b3733e00756f7655003bf1880f -r 6d45fd1d830ee85edcdc07ba93831c316102e81a static/scripts/templates/visualization-templates.html
--- /dev/null
+++ b/static/scripts/templates/visualization-templates.html
@@ -0,0 +1,33 @@
+<script type="text/template" class="template-visualization" id="template-visualization-scatterplotControlForm">
+
+{{! loading indicator - initially hidden }}
+<div id="loading-indicator" style="display: none;">
+ <img class="loading-img" src="{{loadingIndicatorImagePath}}" />
+ <span class="loading-message"></span>
+</div>
+
+{{! main controls }}
+<div id="chart-settings">
+
+ {{! column selector containers }}
+ <div id="x-column-input">
+ <label for="">Data column for X: </label>
+ <select name="x-column">
+ {{#each availableColumns}}
+ <option value="{{index}}">{{name}}</option>
+ {{/each}}
+ </select>
+ </div>
+ <div id="y-column-input">
+ <label for="">Data column for Y: </label>
+ <select name="y-column">
+ {{#each availableColumns}}
+ <option value="{{index}}">{{name}}</option>
+ {{/each}}
+ </select>
+ </div>
+
+ <input id="render-button" type="button" value="Draw" />
+ <div class="clear"></div>
+</div>
+</script>
diff -r f66f88b2f743e3b3733e00756f7655003bf1880f -r 6d45fd1d830ee85edcdc07ba93831c316102e81a static/scripts/viz/scatterplot.js
--- a/static/scripts/viz/scatterplot.js
+++ b/static/scripts/viz/scatterplot.js
@@ -1,7 +1,8 @@
define([
"../libs/underscore",
"../libs/d3",
- "../mvc/base-mvc"
+ "../mvc/base-mvc",
+ "../templates/compiled/template-visualization-scatterplotControlForm"
], function(){
/* =============================================================================
@@ -389,7 +390,7 @@
* Scatterplot control UI as a backbone view
*
*/
-var ScatterplotView = BaseView.extend( LoggableMixin ).extend({
+var ScatterplotControlForm = BaseView.extend( LoggableMixin ).extend({
//logger : console,
tagName : 'form',
className : 'scatterplot-settings-form',
@@ -418,48 +419,31 @@
},
render : function(){
- //TODO: to template
var view = this,
- html = '',
- columnHtml = '';
+ html = '';
// build column select controls for each x, y (based on name if available)
- // ugh...hafta preprocess
- this.dataset.metadata_column_types = this.dataset.metadata_column_types.split( ', ' );
- _.each( this.dataset.metadata_column_types, function( type, index ){
+ var formData = {
+ loadingIndicatorImagePath : this.loadingIndicatorImagePath,
+ config : this.chartConfig,
+ availableColumns : []
+ };
+ _.each( this.dataset.metadata_column_types.split( ', ' ), function( type, index ){
// use only numeric columns
if( type === 'int' || type === 'float' ){
+ //TODO: using 0-based indeces
var name = 'column ' + index;
// label with the name if available
if( view.dataset.metadata_column_names ){
name = view.dataset.metadata_column_names[ index ];
}
- columnHtml += '<option value="' + index + '">' + name + '</option>';
+ formData.availableColumns.push({ index: index, name: name });
}
});
-
- // loading indicator - initially hidden
- html += '<div id="loading-indicator" style="display: none;">';
- html += '<img class="loading-img" src=' + this.loadingIndicatorImagePath + ' />';
- html += '<span class="loading-message"></span>';
- html += '</div>';
-
- // column selector containers
- html += '<div id="x-column-input">';
- html += '<label for="">Data column for X: </label><select name="x-column">' + columnHtml + '</select>';
- html += '</div>';
-
- html += '<div id="y-column-input">';
- html += '<label for="">Data column for Y: </label><select name="y-column">' + columnHtml + '</select>';
- html += '</div>';
-
- html += '<input id="render-button" type="button" value="Draw" />';
- html += '<div class="clear"></div>';
-
//TODO: other vals: max_vals, start_val, pagination
+ html = ScatterplotControlForm.templates.form( formData );
this.$el.append( html );
- this.$el.find( '#render-button' );
return this;
},
@@ -509,13 +493,15 @@
url : url,
dataType : 'json',
success : function( response ){
+ // save the endpoint (number of next line, fileptr) for this object
//TODO: server sends back an endpoint, cache for next pagination request
+ view.endpoint = response.endpoint;
+
view.showLoadingIndicator( 'Rendering...' );
- // save the endpoint (number of next line, fileptr) for this object
- view.endpoint = response.endpoint;
view.plot.render( response.data, response.meta );
view.hideLoadingIndicator();
},
+
error : function( xhr, status, error ){
view.hideLoadingIndicator();
alert( 'ERROR:' + status + '\n' + error );
@@ -523,9 +509,14 @@
});
}
});
+ScatterplotControlForm.templates = CompiledTemplateLoader.getTemplates({
+ 'visualization-templates.html' : {
+ form : 'template-visualization-scatterplotControlForm'
+ }
+});
//==============================================================================
return {
- //TwoVarScatterplot : TwoVarScatterplot,
- ScatterplotView : ScatterplotView
+ TwoVarScatterplot : TwoVarScatterplot,
+ ScatterplotControlForm : ScatterplotControlForm
};});
\ No newline at end of file
diff -r f66f88b2f743e3b3733e00756f7655003bf1880f -r 6d45fd1d830ee85edcdc07ba93831c316102e81a templates/visualization/scatterplot.mako
--- a/templates/visualization/scatterplot.mako
+++ b/templates/visualization/scatterplot.mako
@@ -4,18 +4,19 @@
${parent.stylesheets()}
<style type="text/css">
+/*TODO: use/move into base.less*/
+* { margin: 0px; padding: 0px; }
+#chart-header {
+ padding : 8px;
+ background-color: #ebd9b2;
+}
.title {
- margin: 0px;
- padding: 8px;
- background-color: #ebd9b2;
- border: 2px solid #ebd9b2;
}
-.subtitle {
- margin: 0px;
- padding: 0px 8px 8px 16px;
- background-color: #ebd9b2;
+#chart-header .subtitle {
+ margin: -4px 0px 0px 4px;
+ padding : 0;
color: white;
font-size: small;
}
@@ -28,7 +29,7 @@
padding-top: 1em;
}
-#chart-settings-form > * {
+#chart-settings > * {
margin: 8px;
}
@@ -96,7 +97,7 @@
//?? hmmmm
//kwargs = ${h.to_json_string( kwargs )};
- var settingsForm = new scatterplot.ScatterplotView({
+ var settingsForm = new scatterplot.ScatterplotControlForm({
dataset : hda,
el : $( '#chart-settings-form' ),
apiDatasetsURL : apiDatasetsURL,
@@ -112,8 +113,10 @@
</%def><%def name="body()">
- <h2 class="title">Scatterplot of '${hda['name']}'</h2>
- <p class="subtitle">${hda['misc_info']}</p>
+ <div id="chart-header">
+ <h2 class="title">Scatterplot of '${hda['name']}'</h2>
+ <p class="subtitle">${hda['misc_info']}</p>
+ </div><div id="chart-holder"></div><div id="chart-settings-form"></div></%def>
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
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/f66f88b2f743/
changeset: f66f88b2f743
user: carlfeberhard
date: 2012-10-02 22:37:45
summary: basic.py, ColumnDataProvider: altered return format to be array of column arrays (opposed to array or rows); compute min, max of each column on server; scatterplot: altered to use that format;
affected #: 4 files
diff -r 369a941393909434e0efb5c84dd831e5ab096095 -r f66f88b2f743e3b3733e00756f7655003bf1880f lib/galaxy/visualization/data_providers/basic.py
--- a/lib/galaxy/visualization/data_providers/basic.py
+++ b/lib/galaxy/visualization/data_providers/basic.py
@@ -92,22 +92,26 @@
and self.original_dataset.metadata.comment_lines ):
start_val = int( self.original_dataset.metadata.comment_lines ) + 1
- response = {}
- response[ 'data' ] = data = []
-
#TODO bail if columns None, not parsable, not within meta.columns
# columns is an array of ints for now (should handle column names later)
columns = from_json_string( columns )
- assert( all([ column < self.original_dataset.metadata.columns for column in columns ]) ),(
- "column index (%d) must be less" % ( column )
+ for column in columns:
+ assert( ( column < self.original_dataset.metadata.columns )
+ and ( column >= 0 ) ),(
+ "column index (%d) must be positive and less" % ( column )
+ " than the number of columns: %d" % ( self.original_dataset.metadata.columns ) )
-
-
#print columns, start_val, max_vals, skip_comments, kwargs
- # alter meta by column_selectors (if any)
+ # set up the response, column lists
+ response = {}
+ response[ 'data' ] = data = [ [] for column in columns ]
+ response[ 'meta' ] = meta = [ { 'min': None, 'max': None } for column in columns ]
+
+ column_types = [ self.original_dataset.metadata.column_types[ column ] for column in columns ]
+
+ # function for casting by column_types
def cast_val( val, type ):
- """ Cast value based on type. """
+ """ Cast value based on type. Return None if can't be cast """
if type == 'int':
try: val = int( val )
except: return None
@@ -119,21 +123,30 @@
f = open( self.original_dataset.file_name )
#TODO: add f.seek if given fptr in kwargs
for count, line in enumerate( f ):
+
+ # check line v. desired start, end
if count < start_val:
continue
-
if ( count - start_val ) >= max_vals:
break
fields = line.split()
fields_len = len( fields )
- #TODO: this will return the wrong number of columns for abberrant lines
- line_data = [ cast_val( fields[c], self.original_dataset.metadata.column_types[c] )
- for c in columns if ( c < fields_len ) ]
- data.append( line_data )
+ #NOTE: this will return None/null for abberrant column values (including bad indeces)
+ for index, column in enumerate( columns ):
+ column_val = None
+ if column < fields_len:
+ column_val = cast_val( fields[ column ], column_types[ index ] )
+ if column_val != None:
+ if( meta[ index ][ 'min' ] == None
+ or column_val < meta[ index ][ 'min' ] ):
+ meta[ index ][ 'min' ] = column_val
+ if( meta[ index ][ 'max' ] == None
+ or column_val > meta[ index ][ 'max' ] ):
+ meta[ index ][ 'max' ] = column_val
+ data[ index ].append( column_val )
response[ 'endpoint' ] = dict( last_line=( count - 1 ), file_ptr=f.tell() )
f.close()
return response
-
diff -r 369a941393909434e0efb5c84dd831e5ab096095 -r f66f88b2f743e3b3733e00756f7655003bf1880f lib/galaxy/webapps/galaxy/api/datasets.py
--- a/lib/galaxy/webapps/galaxy/api/datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/datasets.py
@@ -56,7 +56,7 @@
rval = dataset.get_api_value()
except Exception, e:
- rval = "Error in dataset API at listing contents"
+ rval = "Error in dataset API at listing contents: " + str( e )
log.error( rval + ": %s" % str(e), exc_info=True )
trans.response.status = 500
return rval
diff -r 369a941393909434e0efb5c84dd831e5ab096095 -r f66f88b2f743e3b3733e00756f7655003bf1880f static/scripts/packed/viz/scatterplot.js
--- a/static/scripts/packed/viz/scatterplot.js
+++ b/static/scripts/packed/viz/scatterplot.js
@@ -1,1 +1,1 @@
-define(["../libs/underscore","../libs/d3","../mvc/base-mvc"],function(){function b(f){var i=this,d=10,h=7,g=10,e=8,c=5;this.log=function(){if(this.debugging&&console&&console.debug){var j=Array.prototype.slice.call(arguments);j.unshift(this.toString());console.debug.apply(null,j)}};this.log("new TwoVarScatterplot:",f);this.defaults={id:"TwoVarScatterplot",containerSelector:"body",maxDataPoints:30000,bubbleRadius:4,entryAnimDuration:500,xNumTicks:10,yNumTicks:10,xAxisLabelBumpY:40,yAxisLabelBumpX:-35,width:500,height:500,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,xMin:null,xMax:null,yMin:null,yMax:null,xLabel:"X",yLabel:"Y"};this.config=_.extend({},this.defaults,f);this.updateConfig=function(j){_.extend(this.config,j)};this.toString=function(){return this.config.id};this.translateStr=function(j,k){return"translate("+j+","+k+")"};this.rotateStr=function(k,j,l){return"rotate("+k+","+j+","+l+")"};this.svg=d3.select(this.config.containerSelector).append("svg:svg").attr("class","chart").style("display","none");this.content=this.svg.append("svg:g").attr("class","content");this.xAxis=this.content.append("g").attr("class","axis").attr("id","x-axis");this.xAxisLabel=this.xAxis.append("text").attr("class","axis-label").attr("id","x-axis-label");this.yAxis=this.content.append("g").attr("class","axis").attr("id","y-axis");this.yAxisLabel=this.yAxis.append("text").attr("class","axis-label").attr("id","y-axis-label");this.log("built svg:",d3.selectAll("svg"));this.adjustChartDimensions=function(m,k,j,l){m=m||0;k=k||0;j=j||0;l=l||0;this.svg.attr("width",this.config.width+(this.config.marginRight+k)+(this.config.marginLeft+l)).attr("height",this.config.height+(this.config.marginTop+m)+(this.config.marginBottom+j)).style("display","block");this.content=this.svg.select("g.content").attr("transform",this.translateStr(this.config.marginLeft+l,this.config.marginTop+m))};this.preprocessData=function(j){return j.slice(0,this.config.maxDataPoints)};this.setUpDomains=function(j,k){this.xMin=this.config.xMin||d3.min(j);this.xMax=this.config.xMax||d3.max(j);this.yMin=this.config.yMin||d3.min(k);this.yMax=this.config.yMax||d3.max(k)};this.setUpScales=function(){this.xScale=d3.scale.linear().domain([this.xMin,this.xMax]).range([0,this.config.width]),this.yScale=d3.scale.linear().domain([this.yMin,this.yMax]).range([this.config.height,0])};this.setUpXAxis=function(){this.xAxisFn=d3.svg.axis().scale(this.xScale).ticks(this.config.xNumTicks).orient("bottom");this.xAxis.attr("transform",this.translateStr(0,this.config.height)).call(this.xAxisFn);this.xLongestLabel=d3.max(_.map([this.xMin,this.xMax],function(j){return(String(j)).length}));if(this.xLongestLabel>=c){this.xAxis.selectAll("g").filter(":nth-child(odd)").style("display","none")}this.xAxisLabel.attr("x",this.config.width/2).attr("y",this.config.xAxisLabelBumpY).attr("text-anchor","middle").text(this.config.xLabel)};this.setUpYAxis=function(){this.yAxisFn=d3.svg.axis().scale(this.yScale).ticks(this.config.yNumTicks).orient("left");this.yAxis.call(this.yAxisFn);this.log("yAxis:",this.yAxis);var j=this.yAxis.selectAll("text").filter(function(n,m){return m!==0});this.yLongestLabel=d3.max(j[0].map(function(n,m){return(d3.select(n).text()).length}))||0;var k=d+(this.yLongestLabel*h)+e+g;this.config.yAxisLabelBumpX=-(k-g);if(this.config.marginLeft<k){var l=(k)-this.config.marginLeft;l=(l<0)?(0):(l);this.log("adjusting:",l);this.adjustChartDimensions(0,0,0,l)}this.yAxisLabel.attr("x",this.config.yAxisLabelBumpX).attr("y",this.config.height/2).attr("text-anchor","middle").attr("transform",this.rotateStr(-90,this.config.yAxisLabelBumpX,this.config.height/2)).text(this.config.yLabel)};this.renderGrid=function(){this.vGridLines=this.content.selectAll("line.v-grid-line").data(this.xScale.ticks(this.xAxisFn.ticks()[0]));this.vGridLines.enter().append("svg:line").classed("grid-line v-grid-line",true);this.vGridLines.attr("x1",this.xScale).attr("y1",0).attr("x2",this.xScale).attr("y2",this.config.height);this.vGridLines.exit().remove();this.hGridLines=this.content.selectAll("line.h-grid-line").data(this.yScale.ticks(this.yAxisFn.ticks()[0]));this.hGridLines.enter().append("svg:line").classed("grid-line h-grid-line",true);this.hGridLines.attr("x1",0).attr("y1",this.yScale).attr("x2",this.config.width).attr("y2",this.yScale);this.hGridLines.exit().remove()};this.glyphEnterState=function(j){};this.glyphFinalState=function(j){};this.glyphExitState=function(j){};this.renderDatapoints=function(j,m){var l=function(o,n){return i.xScale(j[n])};var k=function(o,n){return i.yScale(m[n])};this.datapoints=this.content.selectAll(".glyph").data(j);this.datapoints.enter().append("svg:circle").attr("class","glyph").attr("cx",l).attr("cy",0).attr("r",0);this.datapoints.transition().duration(this.config.entryAnimDuration).attr("cx",l).attr("cy",k).attr("r",this.config.bubbleRadius);this.datapoints.exit().transition().duration(this.config.entryAnimDuration).attr("cy",this.config.height).attr("r",0).style("fill-opacity",0).remove()};this.render=function(j,k){this.log("renderScatterplot",j.length,k.length,this.config);j=this.preprocessData(j);k=this.preprocessData(k);this.setUpDomains(j,k);this.setUpScales();this.adjustChartDimensions();this.setUpXAxis();this.setUpYAxis();this.renderGrid();this.renderDatapoints(j,k)}}var a=BaseView.extend(LoggableMixin).extend({tagName:"form",className:"scatterplot-settings-form",loadingIndicatorImagePath:(galaxy_paths.get("image_path")+"/loading_large_white_bg.gif"),events:{"click #render-button":"renderScatterplot"},initialize:function(c){if(!c||!c.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=c.dataset}this.apiDatasetsURL=c.apiDatasetsURL;this.chartConfig=c.chartConfig||{};this.log("this.chartConfig:",this.chartConfig);this.plot=new b(this.chartConfig)},render:function(){var c=this,e="",d="";this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ");_.each(this.dataset.metadata_column_types,function(h,g){if(h==="int"||h==="float"){var f="column "+g;if(c.dataset.metadata_column_names){f=c.dataset.metadata_column_names[g]}d+='<option value="'+g+'">'+f+"</option>"}});e+='<div id="loading-indicator" style="display: none;">';e+='<img class="loading-img" src='+this.loadingIndicatorImagePath+" />";e+='<span class="loading-message"></span>';e+="</div>";e+='<div id="x-column-input">';e+='<label for="">Data column for X: </label><select name="x-column">'+d+"</select>";e+="</div>";e+='<div id="y-column-input">';e+='<label for="">Data column for Y: </label><select name="y-column">'+d+"</select>";e+="</div>";e+='<input id="render-button" type="button" value="Draw" />';e+='<div class="clear"></div>';this.$el.append(e);this.$el.find("#render-button");return this},showLoadingIndicator:function(c){c=c||"";this.$el.find("div#loading-indicator").children(".loading-message").text(c);this.$el.find("div#loading-indicator").show("fast")},hideLoadingIndicator:function(){this.$el.find("div#loading-indicator").hide("fast")},renderScatterplot:function(){var d=this,e=this.apiDatasetsURL+"/"+this.dataset.id+"?data_type=raw_data&",i=this.$el.find('[name="x-column"]'),j=i.val(),g=i.children('[value="'+j+'"]').text(),h=this.$el.find('[name="y-column"]'),f=h.val(),c=h.children('[value="'+f+'"]').text();this.log(g,c);this.chartConfig.xLabel=g;this.chartConfig.yLabel=c;d.plot.updateConfig(this.chartConfig);e+=jQuery.param({columns:"["+[j,f]+"]"});this.log("url:",e);this.showLoadingIndicator("Fetching data...");jQuery.ajax({url:e,dataType:"json",success:function(k){d.showLoadingIndicator("Rendering...");d.endpoint=k.endpoint;d.plot.render(_.map(k.data,function(l){return l[0]}),_.map(k.data,function(l){return l[1]}));d.hideLoadingIndicator()},error:function(m,k,l){d.hideLoadingIndicator();alert("ERROR:"+k+"\n"+l)}})}});return{ScatterplotView:a}});
\ No newline at end of file
+define(["../libs/underscore","../libs/d3","../mvc/base-mvc"],function(){function b(f){var i=this,d=10,h=7,g=10,e=8,c=5;this.log=function(){if(this.debugging&&console&&console.debug){var j=Array.prototype.slice.call(arguments);j.unshift(this.toString());console.debug.apply(null,j)}};this.log("new TwoVarScatterplot:",f);this.defaults={id:"TwoVarScatterplot",containerSelector:"body",maxDataPoints:30000,bubbleRadius:4,entryAnimDuration:500,xNumTicks:10,yNumTicks:10,xAxisLabelBumpY:40,yAxisLabelBumpX:-35,width:500,height:500,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,xMin:null,xMax:null,yMin:null,yMax:null,xLabel:"X",yLabel:"Y"};this.config=_.extend({},this.defaults,f);this.updateConfig=function(j){_.extend(this.config,j)};this.toString=function(){return this.config.id};this.translateStr=function(j,k){return"translate("+j+","+k+")"};this.rotateStr=function(k,j,l){return"rotate("+k+","+j+","+l+")"};this.svg=d3.select(this.config.containerSelector).append("svg:svg").attr("class","chart").style("display","none");this.content=this.svg.append("svg:g").attr("class","content");this.xAxis=this.content.append("g").attr("class","axis").attr("id","x-axis");this.xAxisLabel=this.xAxis.append("text").attr("class","axis-label").attr("id","x-axis-label");this.yAxis=this.content.append("g").attr("class","axis").attr("id","y-axis");this.yAxisLabel=this.yAxis.append("text").attr("class","axis-label").attr("id","y-axis-label");this.log("built svg:",d3.selectAll("svg"));this.adjustChartDimensions=function(m,k,j,l){m=m||0;k=k||0;j=j||0;l=l||0;this.svg.attr("width",this.config.width+(this.config.marginRight+k)+(this.config.marginLeft+l)).attr("height",this.config.height+(this.config.marginTop+m)+(this.config.marginBottom+j)).style("display","block");this.content=this.svg.select("g.content").attr("transform",this.translateStr(this.config.marginLeft+l,this.config.marginTop+m))};this.preprocessData=function(j){return(j.length>this.config.maxDataPoints)?(j.slice(0,this.config.maxDataPoints)):(j)};this.setUpDomains=function(j,l,k){this.log("setUpDomains");this.xMin=this.config.xMin||(k)?(k[0].min):(d3.min(j));this.xMax=this.config.xMax||(k)?(k[0].max):(d3.max(j));this.yMin=this.config.yMin||(k)?(k[1].min):(d3.min(l));this.yMax=this.config.yMax||(k)?(k[1].max):(d3.max(l))};this.setUpScales=function(){this.xScale=d3.scale.linear().domain([this.xMin,this.xMax]).range([0,this.config.width]),this.yScale=d3.scale.linear().domain([this.yMin,this.yMax]).range([this.config.height,0])};this.setUpXAxis=function(){this.xAxisFn=d3.svg.axis().scale(this.xScale).ticks(this.config.xNumTicks).orient("bottom");this.xAxis.attr("transform",this.translateStr(0,this.config.height)).call(this.xAxisFn);this.xLongestLabel=d3.max(_.map([this.xMin,this.xMax],function(j){return(String(j)).length}));if(this.xLongestLabel>=c){this.xAxis.selectAll("g").filter(":nth-child(odd)").style("display","none")}this.xAxisLabel.attr("x",this.config.width/2).attr("y",this.config.xAxisLabelBumpY).attr("text-anchor","middle").text(this.config.xLabel)};this.setUpYAxis=function(){this.yAxisFn=d3.svg.axis().scale(this.yScale).ticks(this.config.yNumTicks).orient("left");this.yAxis.call(this.yAxisFn);this.log("yAxis:",this.yAxis);var j=this.yAxis.selectAll("text").filter(function(n,m){return m!==0});this.yLongestLabel=d3.max(j[0].map(function(n,m){return(d3.select(n).text()).length}))||0;var k=d+(this.yLongestLabel*h)+e+g;this.config.yAxisLabelBumpX=-(k-g);if(this.config.marginLeft<k){var l=(k)-this.config.marginLeft;l=(l<0)?(0):(l);this.log("adjusting:",l);this.adjustChartDimensions(0,0,0,l)}this.yAxisLabel.attr("x",this.config.yAxisLabelBumpX).attr("y",this.config.height/2).attr("text-anchor","middle").attr("transform",this.rotateStr(-90,this.config.yAxisLabelBumpX,this.config.height/2)).text(this.config.yLabel)};this.renderGrid=function(){this.vGridLines=this.content.selectAll("line.v-grid-line").data(this.xScale.ticks(this.xAxisFn.ticks()[0]));this.vGridLines.enter().append("svg:line").classed("grid-line v-grid-line",true);this.vGridLines.attr("x1",this.xScale).attr("y1",0).attr("x2",this.xScale).attr("y2",this.config.height);this.vGridLines.exit().remove();this.hGridLines=this.content.selectAll("line.h-grid-line").data(this.yScale.ticks(this.yAxisFn.ticks()[0]));this.hGridLines.enter().append("svg:line").classed("grid-line h-grid-line",true);this.hGridLines.attr("x1",0).attr("y1",this.yScale).attr("x2",this.config.width).attr("y2",this.yScale);this.hGridLines.exit().remove()};this.glyphEnterState=function(j){};this.glyphFinalState=function(j){};this.glyphExitState=function(j){};this.renderDatapoints=function(j,m){var l=function(o,n){return i.xScale(j[n])};var k=function(o,n){return i.yScale(m[n])};this.datapoints=this.content.selectAll(".glyph").data(j);this.datapoints.enter().append("svg:circle").attr("class","glyph").attr("cx",l).attr("cy",0).attr("r",0);this.datapoints.transition().duration(this.config.entryAnimDuration).attr("cx",l).attr("cy",k).attr("r",this.config.bubbleRadius);this.datapoints.exit().transition().duration(this.config.entryAnimDuration).attr("cy",this.config.height).attr("r",0).style("fill-opacity",0).remove()};this.render=function(k,l){var j=k[0],m=k[1];this.log("renderScatterplot",j.length,m.length,this.config);j=this.preprocessData(j);m=this.preprocessData(m);this.setUpDomains(j,m,l);this.log("xMin, xMax, yMin, yMax:",this.xMin,this.xMax,this.yMin,this.yMax);this.setUpScales();this.adjustChartDimensions();this.setUpXAxis();this.setUpYAxis();this.renderGrid();this.renderDatapoints(j,m)}}var a=BaseView.extend(LoggableMixin).extend({tagName:"form",className:"scatterplot-settings-form",loadingIndicatorImagePath:(galaxy_paths.get("image_path")+"/loading_large_white_bg.gif"),events:{"click #render-button":"renderScatterplot"},initialize:function(c){if(!c||!c.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=c.dataset}this.apiDatasetsURL=c.apiDatasetsURL;this.chartConfig=c.chartConfig||{};this.log("this.chartConfig:",this.chartConfig);this.plot=new b(this.chartConfig)},render:function(){var c=this,e="",d="";this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ");_.each(this.dataset.metadata_column_types,function(h,g){if(h==="int"||h==="float"){var f="column "+g;if(c.dataset.metadata_column_names){f=c.dataset.metadata_column_names[g]}d+='<option value="'+g+'">'+f+"</option>"}});e+='<div id="loading-indicator" style="display: none;">';e+='<img class="loading-img" src='+this.loadingIndicatorImagePath+" />";e+='<span class="loading-message"></span>';e+="</div>";e+='<div id="x-column-input">';e+='<label for="">Data column for X: </label><select name="x-column">'+d+"</select>";e+="</div>";e+='<div id="y-column-input">';e+='<label for="">Data column for Y: </label><select name="y-column">'+d+"</select>";e+="</div>";e+='<input id="render-button" type="button" value="Draw" />';e+='<div class="clear"></div>';this.$el.append(e);this.$el.find("#render-button");return this},showLoadingIndicator:function(c){c=c||"";this.$el.find("div#loading-indicator").children(".loading-message").text(c);this.$el.find("div#loading-indicator").show("fast")},hideLoadingIndicator:function(){this.$el.find("div#loading-indicator").hide("fast")},renderScatterplot:function(){var d=this,e=this.apiDatasetsURL+"/"+this.dataset.id+"?data_type=raw_data&",i=this.$el.find('[name="x-column"]'),j=i.val(),g=i.children('[value="'+j+'"]').text(),h=this.$el.find('[name="y-column"]'),f=h.val(),c=h.children('[value="'+f+'"]').text();this.log(g,c);this.chartConfig.xLabel=g;this.chartConfig.yLabel=c;d.plot.updateConfig(this.chartConfig);e+=jQuery.param({columns:"["+[j,f]+"]"});this.log("url:",e);this.showLoadingIndicator("Fetching data...");jQuery.ajax({url:e,dataType:"json",success:function(k){d.showLoadingIndicator("Rendering...");d.endpoint=k.endpoint;d.plot.render(k.data,k.meta);d.hideLoadingIndicator()},error:function(m,k,l){d.hideLoadingIndicator();alert("ERROR:"+k+"\n"+l)}})}});return{ScatterplotView:a}});
\ No newline at end of file
diff -r 369a941393909434e0efb5c84dd831e5ab096095 -r f66f88b2f743e3b3733e00756f7655003bf1880f static/scripts/viz/scatterplot.js
--- a/static/scripts/viz/scatterplot.js
+++ b/static/scripts/viz/scatterplot.js
@@ -158,14 +158,16 @@
// ........................................................ data and scales
this.preprocessData = function( data ){
// set a cap on the data, limit to first n points
- return data.slice( 0, this.config.maxDataPoints );
+ return ( data.length > this.config.maxDataPoints )? ( data.slice( 0, this.config.maxDataPoints ) ): ( data );
};
- this.setUpDomains = function( xCol, yCol ){
- this.xMin = this.config.xMin || d3.min( xCol );
- this.xMax = this.config.xMax || d3.max( xCol );
- this.yMin = this.config.yMin || d3.min( yCol );
- this.yMax = this.config.yMax || d3.max( yCol );
+ this.setUpDomains = function( xCol, yCol, meta ){
+ this.log( 'setUpDomains' );
+ // configuration takes priority, otherwise meta (from the server) if passed, last-resort: compute it here
+ this.xMin = this.config.xMin || ( meta )?( meta[0].min ):( d3.min( xCol ) );
+ this.xMax = this.config.xMax || ( meta )?( meta[0].max ):( d3.max( xCol ) );
+ this.yMin = this.config.yMin || ( meta )?( meta[1].min ):( d3.min( yCol ) );
+ this.yMax = this.config.yMax || ( meta )?( meta[1].max ):( d3.max( yCol ) );
};
this.setUpScales = function(){
@@ -352,8 +354,12 @@
//this.log( this.datapoints, 'glyphs rendered' );
};
- this.render = function( xCol, yCol ){
+ this.render = function( columnData, meta ){
//pre: columns passed are numeric
+ //pre: at least two columns are passed
+ //assume: first column is x, second column is y, any remaining aren't used
+ var xCol = columnData[0],
+ yCol = columnData[1];
this.log( 'renderScatterplot', xCol.length, yCol.length, this.config );
//pre: xCol.len == yCol.len
@@ -363,8 +369,8 @@
//this.log( 'xCol len', xCol.length, 'yCol len', yCol.length );
//TODO: compute min, max on server.
- this.setUpDomains( xCol, yCol );
- //this.log( 'xMin, xMax, yMin, yMax:', this.xMin, this.xMax, this.yMin, this.yMax );
+ this.setUpDomains( xCol, yCol, meta );
+ this.log( 'xMin, xMax, yMin, yMax:', this.xMin, this.xMax, this.yMin, this.yMax );
this.setUpScales();
this.adjustChartDimensions();
@@ -505,12 +511,9 @@
success : function( response ){
//TODO: server sends back an endpoint, cache for next pagination request
view.showLoadingIndicator( 'Rendering...' );
+ // save the endpoint (number of next line, fileptr) for this object
view.endpoint = response.endpoint;
- view.plot.render(
- // pull apart first two regardless of number of columns
- _.map( response.data, function( columns ){ return columns[0]; } ),
- _.map( response.data, function( columns ){ return columns[1]; } )
- );
+ view.plot.render( response.data, response.meta );
view.hideLoadingIndicator();
},
error : function( xhr, status, error ){
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: carlfeberhard: scatterplot: improved adj. for varying y-axis sizes; pack scripts
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/369a94139390/
changeset: 369a94139390
user: carlfeberhard
date: 2012-10-02 21:36:56
summary: scatterplot: improved adj. for varying y-axis sizes; pack scripts
affected #: 8 files
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/libs/underscore.js
--- a/static/scripts/packed/libs/underscore.js
+++ b/static/scripts/packed/libs/underscore.js
@@ -1,1 +1,1 @@
-(function(){var w=this;var k=w._;var E={};var D=Array.prototype,g=Object.prototype,r=Function.prototype;var I=D.push,o=D.slice,y=D.concat,B=D.unshift,d=g.toString,j=g.hasOwnProperty;var M=D.forEach,q=D.map,F=D.reduce,c=D.reduceRight,b=D.filter,C=D.every,p=D.some,n=D.indexOf,l=D.lastIndexOf,u=Array.isArray,f=Object.keys,G=r.bind;var N=function(O){if(O instanceof N){return O}if(!(this instanceof N)){return new N(O)}this._wrapped=O};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=N}exports._=N}else{w._=N}N.VERSION="1.4.0";var J=N.each=N.forEach=function(T,S,R){if(M&&T.forEach===M){T.forEach(S,R)}else{if(T.length===+T.length){for(var Q=0,O=T.length;Q<O;Q++){if(S.call(R,T[Q],Q,T)===E){return}}}else{for(var P in T){if(N.has(T,P)){if(S.call(R,T[P],P,T)===E){return}}}}}};N.map=N.collect=function(R,Q,P){var O=[];if(q&&R.map===q){return R.map(Q,P)}J(R,function(U,S,T){O[O.length]=Q.call(P,U,S,T)});return O};N.reduce=N.foldl=N.inject=function(S,R,O,Q){var P=arguments.length>2;if(F&&S.reduce===F){if(Q){R=N.bind(R,Q)}return P?S.reduce(R,O):S.reduce(R)}J(S,function(V,T,U){if(!P){O=V;P=true}else{O=R.call(Q,O,V,T,U)}});if(!P){throw new TypeError("Reduce of empty array with no initial value")}return O};N.reduceRight=N.foldr=function(U,R,O,Q){var P=arguments.length>2;if(c&&U.reduceRight===c){if(Q){R=N.bind(R,Q)}return arguments.length>2?U.reduceRight(R,O):U.reduceRight(R)}var T=U.length;if(T!==+T){var S=N.keys(U);T=S.length}J(U,function(X,V,W){V=S?S[--T]:--T;if(!P){O=U[V];P=true}else{O=R.call(Q,O,U[V],V,W)}});if(!P){throw new TypeError("Reduce of empty array with no initial value")}return O};N.find=N.detect=function(R,Q,P){var O;A(R,function(U,S,T){if(Q.call(P,U,S,T)){O=U;return true}});return O};N.filter=N.select=function(R,Q,P){var O=[];if(b&&R.filter===b){return R.filter(Q,P)}J(R,function(U,S,T){if(Q.call(P,U,S,T)){O[O.length]=U}});return O};N.reject=function(R,Q,P){var O=[];J(R,function(U,S,T){if(!Q.call(P,U,S,T)){O[O.length]=U}});return O};N.every=N.all=function(R,Q,P){Q||(Q=N.identity);var O=true;if(C&&R.every===C){return R.every(Q,P)}J(R,function(U,S,T){if(!(O=O&&Q.call(P,U,S,T))){return E}});return !!O};var A=N.some=N.any=function(R,Q,P){Q||(Q=N.identity);var O=false;if(p&&R.some===p){return R.some(Q,P)}J(R,function(U,S,T){if(O||(O=Q.call(P,U,S,T))){return E}});return !!O};N.contains=N.include=function(Q,P){var O=false;if(n&&Q.indexOf===n){return Q.indexOf(P)!=-1}O=A(Q,function(R){return R===P});return O};N.invoke=function(P,Q){var O=o.call(arguments,2);return N.map(P,function(R){return(N.isFunction(Q)?Q:R[Q]).apply(R,O)})};N.pluck=function(P,O){return N.map(P,function(Q){return Q[O]})};N.where=function(P,O){if(N.isEmpty(O)){return[]}return N.filter(P,function(R){for(var Q in O){if(O[Q]!==R[Q]){return false}}return true})};N.max=function(R,Q,P){if(!Q&&N.isArray(R)&&R[0]===+R[0]&&R.length<65535){return Math.max.apply(Math,R)}if(!Q&&N.isEmpty(R)){return -Infinity}var O={computed:-Infinity};J(R,function(V,S,U){var T=Q?Q.call(P,V,S,U):V;T>=O.computed&&(O={value:V,computed:T})});return O.value};N.min=function(R,Q,P){if(!Q&&N.isArray(R)&&R[0]===+R[0]&&R.length<65535){return Math.min.apply(Math,R)}if(!Q&&N.isEmpty(R)){return Infinity}var O={computed:Infinity};J(R,function(V,S,U){var T=Q?Q.call(P,V,S,U):V;T<O.computed&&(O={value:V,computed:T})});return O.value};N.shuffle=function(R){var Q;var P=0;var O=[];J(R,function(S){Q=N.random(P++);O[P-1]=O[Q];O[Q]=S});return O};var a=function(O){return N.isFunction(O)?O:function(P){return P[O]}};N.sortBy=function(R,Q,O){var P=a(Q);return N.pluck(N.map(R,function(U,S,T){return{value:U,index:S,criteria:P.call(O,U,S,T)}}).sort(function(V,U){var T=V.criteria;var S=U.criteria;if(T!==S){if(T>S||T===void 0){return 1}if(T<S||S===void 0){return -1}}return V.index<U.index?-1:1}),"value")};var t=function(T,S,P,R){var O={};var Q=a(S);J(T,function(W,U){var V=Q.call(P,W,U,T);R(O,V,W)});return O};N.groupBy=function(Q,P,O){return t(Q,P,O,function(R,S,T){(N.has(R,S)?R[S]:(R[S]=[])).push(T)})};N.countBy=function(Q,P,O){return t(Q,P,O,function(R,S,T){if(!N.has(R,S)){R[S]=0}R[S]++})};N.sortedIndex=function(V,U,R,Q){R=R==null?N.identity:a(R);var T=R.call(Q,U);var O=0,S=V.length;while(O<S){var P=(O+S)>>>1;R.call(Q,V[P])<T?O=P+1:S=P}return O};N.toArray=function(O){if(!O){return[]}if(O.length===+O.length){return o.call(O)}return N.values(O)};N.size=function(O){return(O.length===+O.length)?O.length:N.keys(O).length};N.first=N.head=N.take=function(Q,P,O){return(P!=null)&&!O?o.call(Q,0,P):Q[0]};N.initial=function(Q,P,O){return o.call(Q,0,Q.length-((P==null)||O?1:P))};N.last=function(Q,P,O){if((P!=null)&&!O){return o.call(Q,Math.max(Q.length-P,0))}else{return Q[Q.length-1]}};N.rest=N.tail=N.drop=function(Q,P,O){return o.call(Q,(P==null)||O?1:P)};N.compact=function(O){return N.filter(O,function(P){return !!P})};var x=function(P,Q,O){J(P,function(R){if(N.isArray(R)){Q?I.apply(O,R):x(R,Q,O)}else{O.push(R)}});return O};N.flatten=function(P,O){return x(P,O,[])};N.without=function(O){return N.difference(O,o.call(arguments,1))};N.uniq=N.unique=function(U,T,S,R){var P=S?N.map(U,S,R):U;var Q=[];var O=[];J(P,function(W,V){if(T?(!V||O[O.length-1]!==W):!N.contains(O,W)){O.push(W);Q.push(U[V])}});return Q};N.union=function(){return N.uniq(y.apply(D,arguments))};N.intersection=function(P){var O=o.call(arguments,1);return N.filter(N.uniq(P),function(Q){return N.every(O,function(R){return N.indexOf(R,Q)>=0})})};N.difference=function(P){var O=y.apply(D,o.call(arguments,1));return N.filter(P,function(Q){return !N.contains(O,Q)})};N.zip=function(){var O=o.call(arguments);var R=N.max(N.pluck(O,"length"));var Q=new Array(R);for(var P=0;P<R;P++){Q[P]=N.pluck(O,""+P)}return Q};N.object=function(S,Q){var O={};for(var R=0,P=S.length;R<P;R++){if(Q){O[S[R]]=Q[R]}else{O[S[R][0]]=S[R][1]}}return O};N.indexOf=function(S,Q,R){var P=0,O=S.length;if(R){if(typeof R=="number"){P=(R<0?Math.max(0,O+R):R)}else{P=N.sortedIndex(S,Q);return S[P]===Q?P:-1}}if(n&&S.indexOf===n){return S.indexOf(Q,R)}for(;P<O;P++){if(S[P]===Q){return P}}return -1};N.lastIndexOf=function(R,Q,P){if(l&&R.lastIndexOf===l){return R.lastIndexOf(Q,P)}var O=(P!=null?P:R.length);while(O--){if(R[O]===Q){return O}}return -1};N.range=function(T,R,S){if(arguments.length<=1){R=T||0;T=0}S=arguments[2]||1;var P=Math.max(Math.ceil((R-T)/S),0);var O=0;var Q=new Array(P);while(O<P){Q[O++]=T;T+=S}return Q};var H=function(){};N.bind=function e(R,P){var Q,O;if(R.bind===G&&G){return G.apply(R,o.call(arguments,1))}if(!N.isFunction(R)){throw new TypeError}O=o.call(arguments,2);return Q=function(){if(!(this instanceof Q)){return R.apply(P,O.concat(o.call(arguments)))}H.prototype=R.prototype;var T=new H;var S=R.apply(T,O.concat(o.call(arguments)));if(Object(S)===S){return S}return T}};N.bindAll=function(P){var O=o.call(arguments,1);if(O.length==0){O=N.functions(P)}J(O,function(Q){P[Q]=N.bind(P[Q],P)});return P};N.memoize=function(Q,P){var O={};P||(P=N.identity);return function(){var R=P.apply(this,arguments);return N.has(O,R)?O[R]:(O[R]=Q.apply(this,arguments))}};N.delay=function(P,Q){var O=o.call(arguments,2);return setTimeout(function(){return P.apply(null,O)},Q)};N.defer=function(O){return N.delay.apply(N,[O,1].concat(o.call(arguments,1)))};N.throttle=function(Q,R){var P,T,U,V,S,W;var O=N.debounce(function(){S=V=false},R);return function(){P=this;T=arguments;var X=function(){U=null;if(S){W=Q.apply(P,T)}O()};if(!U){U=setTimeout(X,R)}if(V){S=true}else{V=true;W=Q.apply(P,T)}O();return W}};N.debounce=function(Q,S,P){var R,O;return function(){var W=this,V=arguments;var U=function(){R=null;if(!P){O=Q.apply(W,V)}};var T=P&&!R;clearTimeout(R);R=setTimeout(U,S);if(T){O=Q.apply(W,V)}return O}};N.once=function(Q){var O=false,P;return function(){if(O){return P}O=true;P=Q.apply(this,arguments);Q=null;return P}};N.wrap=function(O,P){return function(){var Q=[O];I.apply(Q,arguments);return P.apply(this,Q)}};N.compose=function(){var O=arguments;return function(){var P=arguments;for(var Q=O.length-1;Q>=0;Q--){P=[O[Q].apply(this,P)]}return P[0]}};N.after=function(P,O){if(P<=0){return O()}return function(){if(--P<1){return O.apply(this,arguments)}}};N.keys=f||function(Q){if(Q!==Object(Q)){throw new TypeError("Invalid object")}var P=[];for(var O in Q){if(N.has(Q,O)){P[P.length]=O}}return P};N.values=function(Q){var O=[];for(var P in Q){if(N.has(Q,P)){O.push(Q[P])}}return O};N.pairs=function(Q){var P=[];for(var O in Q){if(N.has(Q,O)){P.push([O,Q[O]])}}return P};N.invert=function(Q){var O={};for(var P in Q){if(N.has(Q,P)){O[Q[P]]=P}}return O};N.functions=N.methods=function(Q){var P=[];for(var O in Q){if(N.isFunction(Q[O])){P.push(O)}}return P.sort()};N.extend=function(O){J(o.call(arguments,1),function(P){for(var Q in P){O[Q]=P[Q]}});return O};N.pick=function(P){var Q={};var O=y.apply(D,o.call(arguments,1));J(O,function(R){if(R in P){Q[R]=P[R]}});return Q};N.omit=function(Q){var R={};var P=y.apply(D,o.call(arguments,1));for(var O in Q){if(!N.contains(P,O)){R[O]=Q[O]}}return R};N.defaults=function(O){J(o.call(arguments,1),function(P){for(var Q in P){if(O[Q]==null){O[Q]=P[Q]}}});return O};N.clone=function(O){if(!N.isObject(O)){return O}return N.isArray(O)?O.slice():N.extend({},O)};N.tap=function(P,O){O(P);return P};var K=function(V,U,P,Q){if(V===U){return V!==0||1/V==1/U}if(V==null||U==null){return V===U}if(V instanceof N){V=V._wrapped}if(U instanceof N){U=U._wrapped}var S=d.call(V);if(S!=d.call(U)){return false}switch(S){case"[object String]":return V==String(U);case"[object Number]":return V!=+V?U!=+U:(V==0?1/V==1/U:V==+U);case"[object Date]":case"[object Boolean]":return +V==+U;case"[object RegExp]":return V.source==U.source&&V.global==U.global&&V.multiline==U.multiline&&V.ignoreCase==U.ignoreCase}if(typeof V!="object"||typeof U!="object"){return false}var O=P.length;while(O--){if(P[O]==V){return Q[O]==U}}P.push(V);Q.push(U);var X=0,Y=true;if(S=="[object Array]"){X=V.length;Y=X==U.length;if(Y){while(X--){if(!(Y=K(V[X],U[X],P,Q))){break}}}}else{var T=V.constructor,R=U.constructor;if(T!==R&&!(N.isFunction(T)&&(T instanceof T)&&N.isFunction(R)&&(R instanceof R))){return false}for(var W in V){if(N.has(V,W)){X++;if(!(Y=N.has(U,W)&&K(V[W],U[W],P,Q))){break}}}if(Y){for(W in U){if(N.has(U,W)&&!(X--)){break}}Y=!X}}P.pop();Q.pop();return Y};N.isEqual=function(P,O){return K(P,O,[],[])};N.isEmpty=function(P){if(P==null){return true}if(N.isArray(P)||N.isString(P)){return P.length===0}for(var O in P){if(N.has(P,O)){return false}}return true};N.isElement=function(O){return !!(O&&O.nodeType===1)};N.isArray=u||function(O){return d.call(O)=="[object Array]"};N.isObject=function(O){return O===Object(O)};J(["Arguments","Function","String","Number","Date","RegExp"],function(O){N["is"+O]=function(P){return d.call(P)=="[object "+O+"]"}});if(!N.isArguments(arguments)){N.isArguments=function(O){return !!(O&&N.has(O,"callee"))}}if(typeof(/./)!=="function"){N.isFunction=function(O){return typeof O==="function"}}N.isFinite=function(O){return N.isNumber(O)&&isFinite(O)};N.isNaN=function(O){return N.isNumber(O)&&O!=+O};N.isBoolean=function(O){return O===true||O===false||d.call(O)=="[object Boolean]"};N.isNull=function(O){return O===null};N.isUndefined=function(O){return O===void 0};N.has=function(P,O){return j.call(P,O)};N.noConflict=function(){w._=k;return this};N.identity=function(O){return O};N.times=function(R,Q,P){for(var O=0;O<R;O++){Q.call(P,O)}};N.random=function(P,O){if(O==null){O=P;P=0}return P+(0|Math.random()*(O-P+1))};var m={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};m.unescape=N.invert(m.escape);var L={escape:new RegExp("["+N.keys(m.escape).join("")+"]","g"),unescape:new RegExp("("+N.keys(m.unescape).join("|")+")","g")};N.each(["escape","unescape"],function(O){N[O]=function(P){if(P==null){return""}return(""+P).replace(L[O],function(Q){return m[O][Q]})}});N.result=function(O,Q){if(O==null){return null}var P=O[Q];return N.isFunction(P)?P.call(O):P};N.mixin=function(O){J(N.functions(O),function(P){var Q=N[P]=O[P];N.prototype[P]=function(){var R=[this._wrapped];I.apply(R,arguments);return s.call(this,Q.apply(N,R))}})};var z=0;N.uniqueId=function(O){var P=z++;return O?O+P:P};N.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var v=/(.)^/;var h={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"};var i=/\\|'|\r|\n|\t|\u2028|\u2029/g;N.template=function(W,R,Q){Q=N.defaults({},Q,N.templateSettings);var S=new RegExp([(Q.escape||v).source,(Q.interpolate||v).source,(Q.evaluate||v).source].join("|")+"|$","g");var T=0;var O="__p+='";W.replace(S,function(Y,Z,X,ab,aa){O+=W.slice(T,aa).replace(i,function(ac){return"\\"+h[ac]});O+=Z?"'+\n((__t=("+Z+"))==null?'':_.escape(__t))+\n'":X?"'+\n((__t=("+X+"))==null?'':__t)+\n'":ab?"';\n"+ab+"\n__p+='":"";T=aa+Y.length});O+="';\n";if(!Q.variable){O="with(obj||{}){\n"+O+"}\n"}O="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+O+"return __p;\n";try{var P=new Function(Q.variable||"obj","_",O)}catch(U){U.source=O;throw U}if(R){return P(R,N)}var V=function(X){return P.call(this,X,N)};V.source="function("+(Q.variable||"obj")+"){\n"+O+"}";return V};N.chain=function(O){return N(O).chain()};var s=function(O){return this._chain?N(O).chain():O};N.mixin(N);J(["pop","push","reverse","shift","sort","splice","unshift"],function(O){var P=D[O];N.prototype[O]=function(){var Q=this._wrapped;P.apply(Q,arguments);if((O=="shift"||O=="splice")&&Q.length===0){delete Q[0]}return s.call(this,Q)}});J(["concat","join","slice"],function(O){var P=D[O];N.prototype[O]=function(){return s.call(this,P.apply(this._wrapped,arguments))}});N.extend(N.prototype,{chain:function(){this._chain=true;return this},value:function(){return this._wrapped}})}).call(this);
\ No newline at end of file
+(function(){var x=this;var t=x._;var b={};var j=Array.prototype,D=Object.prototype,G=Function.prototype;var v=j.slice,z=j.unshift,y=D.toString,p=D.hasOwnProperty;var n=j.forEach,i=j.map,B=j.reduce,e=j.reduceRight,m=j.filter,a=j.every,A=j.some,w=j.indexOf,f=j.lastIndexOf,c=Array.isArray,C=Object.keys,k=G.bind;var F=function(I){return new g(I)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports){exports=module.exports=F}exports._=F}else{x._=F}F.VERSION="1.3.1";var d=F.each=F.forEach=function(N,M,L){if(N==null){return}if(n&&N.forEach===n){N.forEach(M,L)}else{if(N.length===+N.length){for(var K=0,I=N.length;K<I;K++){if(K in N&&M.call(L,N[K],K,N)===b){return}}}else{for(var J in N){if(F.has(N,J)){if(M.call(L,N[J],J,N)===b){return}}}}}};F.map=F.collect=function(L,K,J){var I=[];if(L==null){return I}if(i&&L.map===i){return L.map(K,J)}d(L,function(O,M,N){I[I.length]=K.call(J,O,M,N)});if(L.length===+L.length){I.length=L.length}return I};F.reduce=F.foldl=F.inject=function(M,L,I,K){var J=arguments.length>2;if(M==null){M=[]}if(B&&M.reduce===B){if(K){L=F.bind(L,K)}return J?M.reduce(L,I):M.reduce(L)}d(M,function(P,N,O){if(!J){I=P;J=true}else{I=L.call(K,I,P,N,O)}});if(!J){throw new TypeError("Reduce of empty array with no initial value")}return I};F.reduceRight=F.foldr=function(M,L,I,K){var J=arguments.length>2;if(M==null){M=[]}if(e&&M.reduceRight===e){if(K){L=F.bind(L,K)}return J?M.reduceRight(L,I):M.reduceRight(L)}var N=F.toArray(M).reverse();if(K&&!J){L=F.bind(L,K)}return J?F.reduce(N,L,I,K):F.reduce(N,L)};F.find=F.detect=function(L,K,J){var I;r(L,function(O,M,N){if(K.call(J,O,M,N)){I=O;return true}});return I};F.filter=F.select=function(L,K,J){var I=[];if(L==null){return I}if(m&&L.filter===m){return L.filter(K,J)}d(L,function(O,M,N){if(K.call(J,O,M,N)){I[I.length]=O}});return I};F.reject=function(L,K,J){var I=[];if(L==null){return I}d(L,function(O,M,N){if(!K.call(J,O,M,N)){I[I.length]=O}});return I};F.every=F.all=function(L,K,J){var I=true;if(L==null){return I}if(a&&L.every===a){return L.every(K,J)}d(L,function(O,M,N){if(!(I=I&&K.call(J,O,M,N))){return b}});return I};var r=F.some=F.any=function(L,K,J){K||(K=F.identity);var I=false;if(L==null){return I}if(A&&L.some===A){return L.some(K,J)}d(L,function(O,M,N){if(I||(I=K.call(J,O,M,N))){return b}});return !!I};F.include=F.contains=function(K,J){var I=false;if(K==null){return I}if(w&&K.indexOf===w){return K.indexOf(J)!=-1}I=r(K,function(L){return L===J});return I};F.invoke=function(J,K){var I=v.call(arguments,2);return F.map(J,function(L){return(F.isFunction(K)?K||L:L[K]).apply(L,I)})};F.pluck=function(J,I){return F.map(J,function(K){return K[I]})};F.max=function(L,K,J){if(!K&&F.isArray(L)){return Math.max.apply(Math,L)}if(!K&&F.isEmpty(L)){return -Infinity}var I={computed:-Infinity};d(L,function(P,M,O){var N=K?K.call(J,P,M,O):P;N>=I.computed&&(I={value:P,computed:N})});return I.value};F.min=function(L,K,J){if(!K&&F.isArray(L)){return Math.min.apply(Math,L)}if(!K&&F.isEmpty(L)){return Infinity}var I={computed:Infinity};d(L,function(P,M,O){var N=K?K.call(J,P,M,O):P;N<I.computed&&(I={value:P,computed:N})});return I.value};F.shuffle=function(K){var I=[],J;d(K,function(N,L,M){if(L==0){I[0]=N}else{J=Math.floor(Math.random()*(L+1));I[L]=I[J];I[J]=N}});return I};F.sortBy=function(K,J,I){return F.pluck(F.map(K,function(N,L,M){return{value:N,criteria:J.call(I,N,L,M)}}).sort(function(O,N){var M=O.criteria,L=N.criteria;return M<L?-1:M>L?1:0}),"value")};F.groupBy=function(K,L){var I={};var J=F.isFunction(L)?L:function(M){return M[L]};d(K,function(O,M){var N=J(O,M);(I[N]||(I[N]=[])).push(O)});return I};F.sortedIndex=function(N,M,K){K||(K=F.identity);var I=0,L=N.length;while(I<L){var J=(I+L)>>1;K(N[J])<K(M)?I=J+1:L=J}return I};F.toArray=function(I){if(!I){return[]}if(I.toArray){return I.toArray()}if(F.isArray(I)){return v.call(I)}if(F.isArguments(I)){return v.call(I)}return F.values(I)};F.size=function(I){return F.toArray(I).length};F.first=F.head=function(K,J,I){return(J!=null)&&!I?v.call(K,0,J):K[0]};F.initial=function(K,J,I){return v.call(K,0,K.length-((J==null)||I?1:J))};F.last=function(K,J,I){if((J!=null)&&!I){return v.call(K,Math.max(K.length-J,0))}else{return K[K.length-1]}};F.rest=F.tail=function(K,I,J){return v.call(K,(I==null)||J?1:I)};F.compact=function(I){return F.filter(I,function(J){return !!J})};F.flatten=function(J,I){return F.reduce(J,function(K,L){if(F.isArray(L)){return K.concat(I?L:F.flatten(L))}K[K.length]=L;return K},[])};F.without=function(I){return F.difference(I,v.call(arguments,1))};F.uniq=F.unique=function(M,L,K){var J=K?F.map(M,K):M;var I=[];F.reduce(J,function(N,P,O){if(0==O||(L===true?F.last(N)!=P:!F.include(N,P))){N[N.length]=P;I[I.length]=M[O]}return N},[]);return I};F.union=function(){return F.uniq(F.flatten(arguments,true))};F.intersection=F.intersect=function(J){var I=v.call(arguments,1);return F.filter(F.uniq(J),function(K){return F.every(I,function(L){return F.indexOf(L,K)>=0})})};F.difference=function(J){var I=F.flatten(v.call(arguments,1));return F.filter(J,function(K){return !F.include(I,K)})};F.zip=function(){var I=v.call(arguments);var L=F.max(F.pluck(I,"length"));var K=new Array(L);for(var J=0;J<L;J++){K[J]=F.pluck(I,""+J)}return K};F.indexOf=function(M,K,L){if(M==null){return -1}var J,I;if(L){J=F.sortedIndex(M,K);return M[J]===K?J:-1}if(w&&M.indexOf===w){return M.indexOf(K)}for(J=0,I=M.length;J<I;J++){if(J in M&&M[J]===K){return J}}return -1};F.lastIndexOf=function(K,J){if(K==null){return -1}if(f&&K.lastIndexOf===f){return K.lastIndexOf(J)}var I=K.length;while(I--){if(I in K&&K[I]===J){return I}}return -1};F.range=function(N,L,M){if(arguments.length<=1){L=N||0;N=0}M=arguments[2]||1;var J=Math.max(Math.ceil((L-N)/M),0);var I=0;var K=new Array(J);while(I<J){K[I++]=N;N+=M}return K};var h=function(){};F.bind=function H(L,J){var K,I;if(L.bind===k&&k){return k.apply(L,v.call(arguments,1))}if(!F.isFunction(L)){throw new TypeError}I=v.call(arguments,2);return K=function(){if(!(this instanceof K)){return L.apply(J,I.concat(v.call(arguments)))}h.prototype=L.prototype;var N=new h;var M=L.apply(N,I.concat(v.call(arguments)));if(Object(M)===M){return M}return N}};F.bindAll=function(J){var I=v.call(arguments,1);if(I.length==0){I=F.functions(J)}d(I,function(K){J[K]=F.bind(J[K],J)});return J};F.memoize=function(K,J){var I={};J||(J=F.identity);return function(){var L=J.apply(this,arguments);return F.has(I,L)?I[L]:(I[L]=K.apply(this,arguments))}};F.delay=function(J,K){var I=v.call(arguments,2);return setTimeout(function(){return J.apply(J,I)},K)};F.defer=function(I){return F.delay.apply(F,[I,1].concat(v.call(arguments,1)))};F.throttle=function(N,P){var L,I,O,M,K;var J=F.debounce(function(){K=M=false},P);return function(){L=this;I=arguments;var Q=function(){O=null;if(K){N.apply(L,I)}J()};if(!O){O=setTimeout(Q,P)}if(M){K=true}else{N.apply(L,I)}J();M=true}};F.debounce=function(I,K){var J;return function(){var N=this,M=arguments;var L=function(){J=null;I.apply(N,M)};clearTimeout(J);J=setTimeout(L,K)}};F.once=function(K){var I=false,J;return function(){if(I){return J}I=true;return J=K.apply(this,arguments)}};F.wrap=function(I,J){return function(){var K=[I].concat(v.call(arguments,0));return J.apply(this,K)}};F.compose=function(){var I=arguments;return function(){var J=arguments;for(var K=I.length-1;K>=0;K--){J=[I[K].apply(this,J)]}return J[0]}};F.after=function(J,I){if(J<=0){return I()}return function(){if(--J<1){return I.apply(this,arguments)}}};F.keys=C||function(K){if(K!==Object(K)){throw new TypeError("Invalid object")}var J=[];for(var I in K){if(F.has(K,I)){J[J.length]=I}}return J};F.values=function(I){return F.map(I,F.identity)};F.functions=F.methods=function(K){var J=[];for(var I in K){if(F.isFunction(K[I])){J.push(I)}}return J.sort()};F.extend=function(I){d(v.call(arguments,1),function(J){for(var K in J){I[K]=J[K]}});return I};F.defaults=function(I){d(v.call(arguments,1),function(J){for(var K in J){if(I[K]==null){I[K]=J[K]}}});return I};F.clone=function(I){if(!F.isObject(I)){return I}return F.isArray(I)?I.slice():F.extend({},I)};F.tap=function(J,I){I(J);return J};function E(L,K,J){if(L===K){return L!==0||1/L==1/K}if(L==null||K==null){return L===K}if(L._chain){L=L._wrapped}if(K._chain){K=K._wrapped}if(L.isEqual&&F.isFunction(L.isEqual)){return L.isEqual(K)}if(K.isEqual&&F.isFunction(K.isEqual)){return K.isEqual(L)}var O=y.call(L);if(O!=y.call(K)){return false}switch(O){case"[object String]":return L==String(K);case"[object Number]":return L!=+L?K!=+K:(L==0?1/L==1/K:L==+K);case"[object Date]":case"[object Boolean]":return +L==+K;case"[object RegExp]":return L.source==K.source&&L.global==K.global&&L.multiline==K.multiline&&L.ignoreCase==K.ignoreCase}if(typeof L!="object"||typeof K!="object"){return false}var P=J.length;while(P--){if(J[P]==L){return true}}J.push(L);var N=0,I=true;if(O=="[object Array]"){N=L.length;I=N==K.length;if(I){while(N--){if(!(I=N in L==N in K&&E(L[N],K[N],J))){break}}}}else{if("constructor" in L!="constructor" in K||L.constructor!=K.constructor){return false}for(var M in L){if(F.has(L,M)){N++;if(!(I=F.has(K,M)&&E(L[M],K[M],J))){break}}}if(I){for(M in K){if(F.has(K,M)&&!(N--)){break}}I=!N}}J.pop();return I}F.isEqual=function(J,I){return E(J,I,[])};F.isEmpty=function(J){if(F.isArray(J)||F.isString(J)){return J.length===0}for(var I in J){if(F.has(J,I)){return false}}return true};F.isElement=function(I){return !!(I&&I.nodeType==1)};F.isArray=c||function(I){return y.call(I)=="[object Array]"};F.isObject=function(I){return I===Object(I)};F.isArguments=function(I){return y.call(I)=="[object Arguments]"};if(!F.isArguments(arguments)){F.isArguments=function(I){return !!(I&&F.has(I,"callee"))}}F.isFunction=function(I){return y.call(I)=="[object Function]"};F.isString=function(I){return y.call(I)=="[object String]"};F.isNumber=function(I){return y.call(I)=="[object Number]"};F.isNaN=function(I){return I!==I};F.isBoolean=function(I){return I===true||I===false||y.call(I)=="[object Boolean]"};F.isDate=function(I){return y.call(I)=="[object Date]"};F.isRegExp=function(I){return y.call(I)=="[object RegExp]"};F.isNull=function(I){return I===null};F.isUndefined=function(I){return I===void 0};F.has=function(J,I){return p.call(J,I)};F.noConflict=function(){x._=t;return this};F.identity=function(I){return I};F.times=function(L,K,J){for(var I=0;I<L;I++){K.call(J,I)}};F.escape=function(I){return(""+I).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};F.mixin=function(I){d(F.functions(I),function(J){s(J,F[J]=I[J])})};var l=0;F.uniqueId=function(I){var J=l++;return I?I+J:J};F.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/;var q=function(I){return I.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};F.template=function(L,K){var M=F.templateSettings;var I="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+L.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(M.escape||u,function(N,O){return"',_.escape("+q(O)+"),'"}).replace(M.interpolate||u,function(N,O){return"',"+q(O)+",'"}).replace(M.evaluate||u,function(N,O){return"');"+q(O).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var J=new Function("obj","_",I);if(K){return J(K,F)}return function(N){return J.call(this,N,F)}};F.chain=function(I){return F(I).chain()};var g=function(I){this._wrapped=I};F.prototype=g.prototype;var o=function(J,I){return I?F(J).chain():J};var s=function(I,J){g.prototype[I]=function(){var K=v.call(arguments);z.call(K,this._wrapped);return o(J.apply(F,K),this._chain)}};F.mixin(F);d(["pop","push","reverse","shift","sort","splice","unshift"],function(I){var J=j[I];g.prototype[I]=function(){var K=this._wrapped;J.apply(K,arguments);var L=K.length;if((I=="shift"||I=="splice")&&L===0){delete K[0]}return o(K,this._chain)}});d(["concat","join","slice"],function(I){var J=j[I];g.prototype[I]=function(){return o(J.apply(this._wrapped,arguments),this._chain)}});g.prototype.chain=function(){this._chain=true;return this};g.prototype.value=function(){return this._wrapped}}).call(this);
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/viz/circster.js
--- a/static/scripts/packed/viz/circster.js
+++ b/static/scripts/packed/viz/circster.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","libs/d3","viz/visualization"],function(i,k,j){var e=function(){this.initialize&&this.initialize.apply(this,arguments)};e.extend=Backbone.Model.extend;var l=Backbone.Model.extend({is_visible:function(p,m){var n=p.getBoundingClientRect(),o=$("svg")[0].getBoundingClientRect();if(n.right<0||n.left>o.right||n.bottom<0||n.top>o.bottom){return false}return true}});var f=Backbone.Model.extend({defaults:{prefs:{color:"#ccc"}}});var b=Backbone.View.extend({className:"circster",initialize:function(m){this.total_gap=m.total_gap;this.genome=m.genome;this.dataset_arc_height=m.dataset_arc_height;this.track_gap=5;this.label_arc_height=20},render:function(){var u=this,r=this.dataset_arc_height,m=u.$el.width(),t=u.$el.height(),n=Math.min(m,t)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap)-(this.label_arc_height+this.track_gap),s=this.model.get("tracks");var p=k.select(u.$el[0]).append("svg").attr("width",m).attr("height",t).attr("pointer-events","all").append("svg:g").call(k.behavior.zoom().on("zoom",function(){p.attr("transform","translate("+k.event.translate+") scale("+k.event.scale+")");var v=new l(),w={};s.each(function(x){w[x.id]=[]});k.selectAll("path.chrom-data").filter(function(y,x){return v.is_visible(this,p)}).each(function(z,x){var y=$.data(this,"chrom_data");w[y.track.id].push(y.chrom)})})).attr("transform","translate("+m/2+","+t/2+")").append("svg:g");s.each(function(v,x){var z=n+x*(r+u.track_gap),w=(v.get("track_type")==="LineTrack"?g:h);var y=new w({track:v,track_index:x,radius_start:z,radius_end:z+r,genome:u.genome,total_gap:u.total_gap});y.render(p)});var q=n+s.length*(r+u.track_gap)+u.track_gap;var o=new a({track:new f(),track_index:s.length,radius_start:q,radius_end:q,genome:u.genome,total_gap:u.total_gap});o.render(p)}});var c=e.extend({initialize:function(m){this.options=m;this.options.bg_stroke="ccc";this.options.bg_fill="ccc"},render:function(r){var o=r.append("g").attr("id","parent-"+this.options.track_index);var m=this._chroms_layout(),s=this.options.radius_start,p=this.options.radius_end,t=k.svg.arc().innerRadius(s).outerRadius(p),n=o.selectAll("g").data(m).enter().append("svg:g");n.append("path").attr("d",t).style("stroke",this.options.bg_stroke).style("fill",this.options.bg_fill).append("title").text(function(v){return v.data.chrom});this.render_data(o);var u=this.options.track.get("prefs"),q=u.block_color;if(!q){q=u.color}o.selectAll("path.chrom-data").style("stroke",q).style("fill",q)},_chroms_layout:function(){var n=this.options.genome.get_chroms_info(),p=k.layout.pie().value(function(r){return r.len}).sort(null),q=p(n),m=this.options.total_gap/n.length,o=i.map(q,function(t,s){var r=t.endAngle-m;t.endAngle=(r>t.startAngle?r:t.startAngle);return t});return o},render_chrom_data:function(o,p,q,n,r,m){},render_data:function(q){var v=this,u=this._chroms_layout(),o=this.options.track,n=this.options.radius_start,s=this.options.radius_end,t=o.get_genome_wide_data(this.options.genome),r=i.zip(u,t),m=this.get_bounds(t),p=i.map(r,function(w){var x=w[0],y=w[1];return v.render_chrom_data(q,x,y,n,s,m.min,m.max)});return p}});var a=c.extend({initialize:function(m){this.options=m;this.options.bg_stroke="fff";this.options.bg_fill="fff"},render_data:function(n){var m=n.selectAll("g");m.selectAll("path").attr("id",function(o){return"label-"+o.data.chrom});m.append("svg:text").filter(function(o){return o.endAngle-o.startAngle>0.08}).attr("text-anchor","middle").append("svg:textPath").attr("xlink:href",function(o){return"#label-"+o.data.chrom}).attr("startOffset","25%").text(function(o){return o.data.chrom})}});var d=c.extend({render_quantitative_data:function(q,w,p,t,s,o,u){var r=k.scale.linear().domain([o,u]).range([t,s]);var n=k.scale.linear().domain([0,p.length]).range([w.startAngle,w.endAngle]);var y=k.svg.line.radial().interpolate("linear").radius(function(z){return r(z[1])}).angle(function(A,z){return n(z)});var m=k.svg.area.radial().interpolate(y.interpolate()).innerRadius(r(0)).outerRadius(y.radius()).angle(y.angle());var v=q.datum(p),x=v.append("path").attr("class","chrom-data").attr("d",m);$.data(x[0][0],"chrom_data",{track:this.options.track,chrom:w.data.chrom})},get_bounds:function(){}});var h=d.extend({render_chrom_data:function(o,r,p,n,s,q,m){if(!p||typeof p==="string"){return null}return this.render_quantitative_data(o,r,p.data,n,s,q,m)},get_bounds:function(n){var m=i.map(n,function(o){if(!o||typeof o==="string"){return 0}return o.max});return{min:0,max:(m&&typeof m!=="string"?i.max(m):0)}}});var g=d.extend({render_chrom_data:function(o,r,p,n,t,q,m){var s=p.data;if(s.length===0){return}return this.render_quantitative_data(o,r,s,n,t,q,m)},get_bounds:function(n){var m=i.flatten(i.map(n,function(o){if(o){return i.map(o.data,function(q){return q[1]})}else{return 0}}));return{min:i.min(m),max:i.max(m)}}});return{CircsterView:b}});
\ No newline at end of file
+define(["libs/underscore","libs/d3","viz/visualization"],function(i,k,j){var f=function(){this.initialize&&this.initialize.apply(this,arguments)};f.extend=Backbone.Model.extend;var l=Backbone.Model.extend({is_visible:function(p,m){var n=p.getBoundingClientRect(),o=$("svg")[0].getBoundingClientRect();if(n.right<0||n.left>o.right||n.bottom<0||n.top>o.bottom){return false}return true}});var e=Backbone.Model.extend({defaults:{prefs:{color:"#ccc"}}});var b=Backbone.View.extend({className:"circster",initialize:function(m){this.total_gap=m.total_gap;this.genome=m.genome;this.dataset_arc_height=m.dataset_arc_height;this.track_gap=5;this.label_arc_height=20;this.scale=1},render:function(){var v=this,s=this.dataset_arc_height,m=v.$el.width(),u=v.$el.height(),n=Math.min(m,u)/2-this.model.get("tracks").length*(this.dataset_arc_height+this.track_gap)-(this.label_arc_height+this.track_gap),t=this.model.get("tracks"),p=t.map(function(w,y){var z=n+y*(s+v.track_gap),x=(w.get("track_type")==="LineTrack"?g:h);return new x({track:w,track_index:y,radius_bounds:[z,z+s],genome:v.genome,total_gap:v.total_gap})});var q=k.select(v.$el[0]).append("svg").attr("width",m).attr("height",u).attr("pointer-events","all").append("svg:g").call(k.behavior.zoom().on("zoom",function(){var w=k.event.scale;q.attr("transform","translate("+k.event.translate+") scale("+w+")");if(v.scale!==w){if(v.zoom_drag_timeout){clearTimeout(v.zoom_drag_timeout)}v.zoom_drag_timeout=setTimeout(function(){i.each(p,function(x){x.update_scale(w)})},400)}})).attr("transform","translate("+m/2+","+u/2+")").append("svg:g");i.each(p,function(w){w.render(q)});var r=n+t.length*(s+v.track_gap)+v.track_gap;var o=new a({track:new e(),track_index:t.length,radius_bounds:[r,r],genome:v.genome,total_gap:v.total_gap});o.render(q)}});var c=f.extend({initialize:function(m){this.options=m;this.options.bg_stroke="ccc";this.options.bg_fill="ccc";this.options.chroms_layout=this._chroms_layout();this.options.data_bounds=this.get_data_bounds(this.options.track.get_genome_wide_data(this.options.genome));this.options.scale=1;this.options.parent_elt=null},render:function(q){this.options.parent_elt=q.append("g").attr("id","parent-"+this.options.track_index);var p=this.options.parent_elt;var o=this.options.chroms_layout,s=k.svg.arc().innerRadius(this.options.radius_bounds[0]).outerRadius(this.options.radius_bounds[1]),m=p.selectAll("g").data(o).enter().append("svg:g");m.append("path").attr("d",s).style("stroke",this.options.bg_stroke).style("fill",this.options.bg_fill).append("title").text(function(t){return t.data.chrom});this._render_data(p);var n=this.options.track.get("prefs"),r=n.block_color;if(!r){r=n.color}p.selectAll("path.chrom-data").style("stroke",r).style("fill",r)},update_scale:function(p){var o=this.options.scale;this.options.scale=p;if(p<=o){return}var n=this,m=new l();this.options.parent_elt.selectAll("path.chrom-data").filter(function(r,q){return m.is_visible(this)}).each(function(v,s){var u=k.select(this),r=u.attr("chrom"),t=n.options.genome.get_chrom_region(r),q=n.options.track.get("data_manager").get_more_detailed_data(t,"Coverage",0,p);$.when(q).then(function(z){u.remove();n._update_data_bounds();var y=i.find(n.options.chroms_layout,function(A){return A.data.chrom===r});var w=n.options.track.get("prefs"),x=w.block_color;if(!x){x=w.color}n._render_chrom_data(n.options.parent_elt,y,z).style("stroke",x).style("fill",x)})});return n},_update_data_bounds:function(){this.options.data_bounds=this.get_data_bounds(this.options.track.get_genome_wide_data(this.options.genome))},_render_data:function(p){var o=this,n=this.options.chroms_layout,m=this.options.track,s=m.get_genome_wide_data(this.options.genome),q=i.zip(n,s),r=i.map(q,function(t){var u=t[0],v=t[1];return o._render_chrom_data(p,u,v)});return p},_render_chrom_data:function(m,n,o){},_compute_path_data:function(m,n){},_chroms_layout:function(){var n=this.options.genome.get_chroms_info(),p=k.layout.pie().value(function(r){return r.len}).sort(null),q=p(n),m=this.options.total_gap/n.length,o=i.map(q,function(t,s){var r=t.endAngle-m;t.endAngle=(r>t.startAngle?r:t.startAngle);return t});return o}});var a=c.extend({initialize:function(m){this.options=m;this.options.bg_stroke="fff";this.options.bg_fill="fff";this.options.chroms_layout=this._chroms_layout()},_render_data:function(n){var m=n.selectAll("g");m.selectAll("path").attr("id",function(o){return"label-"+o.data.chrom});m.append("svg:text").filter(function(o){return o.endAngle-o.startAngle>0.08}).attr("text-anchor","middle").append("svg:textPath").attr("xlink:href",function(o){return"#label-"+o.data.chrom}).attr("startOffset","25%").text(function(o){return o.data.chrom})}});var d=c.extend({_render_chrom_data:function(m,p,n){if(!n||typeof n==="string"||n.data.length===0){return null}var q=this._compute_path_data(p,n.data);var o=m.datum(n.data),r=o.append("path").attr("class","chrom-data").attr("chrom",p.data.chrom).attr("d",q);return r},_compute_path_data:function(o,p){var m=k.scale.linear().domain(this.options.data_bounds).range(this.options.radius_bounds);var q=k.scale.linear().domain([0,p.length]).range([o.startAngle,o.endAngle]);var n=k.svg.line.radial().interpolate("linear").radius(function(r){return m(r[1])}).angle(function(s,r){return q(r)});return k.svg.area.radial().interpolate(n.interpolate()).innerRadius(m(0)).outerRadius(n.radius()).angle(n.angle())},get_data_bounds:function(m){}});var h=d.extend({get_data_bounds:function(n){var m=i.map(n,function(o){if(!o||typeof o==="string"){return 0}return o.max});return[0,(m&&typeof m!=="string"?i.max(m):0)]}});var g=d.extend({get_data_bounds:function(n){var m=i.flatten(i.map(n,function(o){if(o){return i.map(o.data,function(q){return q[1]})}else{return 0}}));return[i.min(m),i.max(m)]}});return{CircsterView:b}});
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/viz/scatterplot.js
--- a/static/scripts/packed/viz/scatterplot.js
+++ b/static/scripts/packed/viz/scatterplot.js
@@ -1,1 +1,1 @@
-define(["../libs/underscore","../libs/d3","../mvc/base-mvc"],function(){function b(e){var h=this,g=10,f=12,d=8,c=5;this.log=function(){if(this.debugging&&console&&console.debug){var i=Array.prototype.slice.call(arguments);i.unshift(this.toString());console.debug.apply(null,i)}};this.log("new TwoVarScatterplot:",e);this.defaults={id:"TwoVarScatterplot",containerSelector:"body",maxDataPoints:30000,bubbleRadius:4,entryAnimDuration:500,xNumTicks:10,yNumTicks:10,xAxisLabelBumpY:40,yAxisLabelBumpX:-35,width:500,height:500,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,xMin:null,xMax:null,yMin:null,yMax:null,xLabel:"X",yLabel:"Y"};this.config=_.extend({},this.defaults,e);this.updateConfig=function(i){_.extend(this.config,i)};this.toString=function(){return this.config.id};this.translateStr=function(i,j){return"translate("+i+","+j+")"};this.rotateStr=function(j,i,k){return"rotate("+j+","+i+","+k+")"};this.svg=d3.select(this.config.containerSelector).append("svg:svg").attr("class","chart").style("display","none");this.content=this.svg.append("svg:g").attr("class","content");this.xAxis=this.content.append("g").attr("class","axis").attr("id","x-axis");this.xAxisLabel=this.xAxis.append("text").attr("class","axis-label").attr("id","x-axis-label");this.yAxis=this.content.append("g").attr("class","axis").attr("id","y-axis");this.yAxisLabel=this.yAxis.append("text").attr("class","axis-label").attr("id","y-axis-label");this.log("built svg:",d3.selectAll("svg"));this.adjustChartDimensions=function(){this.svg.attr("width",this.config.width+(this.config.marginRight+this.config.marginLeft)).attr("height",this.config.height+(this.config.marginTop+this.config.marginBottom)).style("display","block");this.content=this.svg.select("g.content").attr("transform",this.translateStr(this.config.marginLeft,this.config.marginTop))};this.preprocessData=function(i){return i.slice(0,this.config.maxDataPoints)};this.setUpDomains=function(i,j){this.xMin=this.config.xMin||d3.min(i);this.xMax=this.config.xMax||d3.max(i);this.yMin=this.config.yMin||d3.min(j);this.yMax=this.config.yMax||d3.max(j)};this.setUpScales=function(){this.xScale=d3.scale.linear().domain([this.xMin,this.xMax]).range([0,this.config.width]),this.yScale=d3.scale.linear().domain([this.yMin,this.yMax]).range([this.config.height,0])};this.setUpXAxis=function(){this.xAxisFn=d3.svg.axis().scale(this.xScale).ticks(this.config.xNumTicks).orient("bottom");this.xAxis.attr("transform",this.translateStr(0,this.config.height)).call(this.xAxisFn);this.log("xAxis:",this.xAxis);this.xLongestLabel=d3.max(_.map([this.xMin,this.xMax],function(i){return(String(i)).length}));this.log("xLongestLabel:",this.xLongestLabel);if(this.xLongestLabel>=c){this.xAxis.selectAll("g").filter(":nth-child(odd)").style("display","none")}this.xAxisLabel.attr("x",this.config.width/2).attr("y",this.config.xAxisLabelBumpY).attr("text-anchor","middle").text(this.config.xLabel);this.log("xAxisLabel:",this.xAxisLabel)};this.setUpYAxis=function(){this.yAxisFn=d3.svg.axis().scale(this.yScale).ticks(this.config.yNumTicks).orient("left");this.yAxis.call(this.yAxisFn);this.log("yAxis:",this.yAxis);this.yLongestLabel=d3.max(_.map([this.yMin,this.yMax],function(j){return(String(j)).length}));this.log("yLongestLabel:",this.yLongestLabel);var i=this.yLongestLabel*g+(d);if(this.config.yAxisLabelBumpX>-(i)){this.config.yAxisLabelBumpX=-(i)}if(this.config.marginLeft<i){this.config.marginLeft=i+f;this.adjustChartDimensions()}this.log("this.config.yAxisLableBumpx, this.config.marginLeft:",this.config.yAxisLabelBumpX,this.config.marginLeft);this.yAxisLabel.attr("x",this.config.yAxisLabelBumpX).attr("y",this.config.height/2).attr("text-anchor","middle").attr("transform",this.rotateStr(-90,this.config.yAxisLabelBumpX,this.config.height/2)).text(this.config.yLabel);this.log("yAxisLabel:",this.yAxisLabel)};this.renderGrid=function(){this.vGridLines=this.content.selectAll("line.v-grid-line").data(this.xScale.ticks(this.xAxisFn.ticks()[0]));this.vGridLines.enter().append("svg:line").classed("grid-line v-grid-line",true);this.vGridLines.attr("x1",this.xScale).attr("y1",0).attr("x2",this.xScale).attr("y2",this.config.height);this.vGridLines.exit().remove();this.log("vGridLines:",this.vGridLines);this.hGridLines=this.content.selectAll("line.h-grid-line").data(this.yScale.ticks(this.yAxisFn.ticks()[0]));this.hGridLines.enter().append("svg:line").classed("grid-line h-grid-line",true);this.hGridLines.attr("x1",0).attr("y1",this.yScale).attr("x2",this.config.width).attr("y2",this.yScale);this.hGridLines.exit().remove();this.log("hGridLines:",this.hGridLines)};this.glyphEnterState=function(i){};this.glyphFinalState=function(i){};this.glyphExitState=function(i){};this.renderDatapoints=function(i,l){var k=function(n,m){return h.xScale(i[m])};var j=function(n,m){return h.yScale(l[m])};this.datapoints=this.content.selectAll(".glyph").data(i);this.datapoints.enter().append("svg:circle").attr("class","glyph").attr("cx",k).attr("cy",0).attr("r",0);this.datapoints.transition().duration(this.config.entryAnimDuration).attr("cx",k).attr("cy",j).attr("r",this.config.bubbleRadius);this.datapoints.exit().transition().duration(this.config.entryAnimDuration).attr("cy",this.config.height).attr("r",0).style("fill-opacity",0).remove();this.log(this.datapoints,"glyphs rendered")};this.render=function(i,j){this.log("renderScatterplot",i.length,j.length,this.config);i=this.preprocessData(i);j=this.preprocessData(j);this.log("xCol len",i.length,"yCol len",j.length);this.setUpDomains(i,j);this.log("xMin, xMax, yMin, yMax:",this.xMin,this.xMax,this.yMin,this.yMax);this.setUpScales();this.adjustChartDimensions();this.setUpXAxis();this.setUpYAxis();this.renderGrid();this.renderDatapoints(i,j)}}var a=BaseView.extend(LoggableMixin).extend({tagName:"form",className:"scatterplot-settings-form",events:{"click #render-button":"renderScatterplot"},initialize:function(c){if(!c||!c.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=c.dataset}this.apiDatasetsURL=c.apiDatasetsURL;this.chartConfig=c.chartConfig||{};this.log("this.chartConfig:",this.chartConfig);this.plot=new b(this.chartConfig)},render:function(){var c=this,e="",d="";this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ");_.each(this.dataset.metadata_column_types,function(h,g){if(h==="int"||h==="float"){var f="column "+g;if(c.dataset.metadata_column_names){f=c.dataset.metadata_column_names[g]}d+='<option value="'+g+'">'+f+"</column>"}});e+='<div id="x-column-input">';e+='<label for="">Data column for X: </label><select name="x-column">'+d+"</select>";e+="</div>";e+='<div id="y-column-input">';e+='<label for="">Data column for Y: </label><select name="y-column">'+d+"</select>";e+="</div>";e+='<input id="render-button" type="button" value="Draw" />';e+='<div class="clear"></div>';this.$el.append(e);this.$el.find("#render-button");return this},renderScatterplot:function(){var d=this,e=this.apiDatasetsURL+"/"+this.dataset.id+"?data_type=raw_data&",i=this.$el.find('[name="x-column"]'),j=i.val(),g=i.children('[value="'+j+'"]').text(),h=this.$el.find('[name="y-column"]'),f=h.val(),c=h.children('[value="'+f+'"]').text();this.log(g,c);this.chartConfig.xLabel=g;this.chartConfig.yLabel=c;d.plot.updateConfig(this.chartConfig);e+=jQuery.param({columns:"["+[j,f]+"]"});this.log("url:",e);jQuery.ajax({url:e,dataType:"json",success:function(k){d.endpoint=k.endpoint;d.plot.render(_.map(k.data,function(l){return l[0]}),_.map(k.data,function(l){return l[1]}))},error:function(m,k,l){alert("ERROR:"+k+"\n"+l)}})}});return{ScatterplotView:a}});
\ No newline at end of file
+define(["../libs/underscore","../libs/d3","../mvc/base-mvc"],function(){function b(f){var i=this,d=10,h=7,g=10,e=8,c=5;this.log=function(){if(this.debugging&&console&&console.debug){var j=Array.prototype.slice.call(arguments);j.unshift(this.toString());console.debug.apply(null,j)}};this.log("new TwoVarScatterplot:",f);this.defaults={id:"TwoVarScatterplot",containerSelector:"body",maxDataPoints:30000,bubbleRadius:4,entryAnimDuration:500,xNumTicks:10,yNumTicks:10,xAxisLabelBumpY:40,yAxisLabelBumpX:-35,width:500,height:500,marginTop:50,marginRight:50,marginBottom:50,marginLeft:50,xMin:null,xMax:null,yMin:null,yMax:null,xLabel:"X",yLabel:"Y"};this.config=_.extend({},this.defaults,f);this.updateConfig=function(j){_.extend(this.config,j)};this.toString=function(){return this.config.id};this.translateStr=function(j,k){return"translate("+j+","+k+")"};this.rotateStr=function(k,j,l){return"rotate("+k+","+j+","+l+")"};this.svg=d3.select(this.config.containerSelector).append("svg:svg").attr("class","chart").style("display","none");this.content=this.svg.append("svg:g").attr("class","content");this.xAxis=this.content.append("g").attr("class","axis").attr("id","x-axis");this.xAxisLabel=this.xAxis.append("text").attr("class","axis-label").attr("id","x-axis-label");this.yAxis=this.content.append("g").attr("class","axis").attr("id","y-axis");this.yAxisLabel=this.yAxis.append("text").attr("class","axis-label").attr("id","y-axis-label");this.log("built svg:",d3.selectAll("svg"));this.adjustChartDimensions=function(m,k,j,l){m=m||0;k=k||0;j=j||0;l=l||0;this.svg.attr("width",this.config.width+(this.config.marginRight+k)+(this.config.marginLeft+l)).attr("height",this.config.height+(this.config.marginTop+m)+(this.config.marginBottom+j)).style("display","block");this.content=this.svg.select("g.content").attr("transform",this.translateStr(this.config.marginLeft+l,this.config.marginTop+m))};this.preprocessData=function(j){return j.slice(0,this.config.maxDataPoints)};this.setUpDomains=function(j,k){this.xMin=this.config.xMin||d3.min(j);this.xMax=this.config.xMax||d3.max(j);this.yMin=this.config.yMin||d3.min(k);this.yMax=this.config.yMax||d3.max(k)};this.setUpScales=function(){this.xScale=d3.scale.linear().domain([this.xMin,this.xMax]).range([0,this.config.width]),this.yScale=d3.scale.linear().domain([this.yMin,this.yMax]).range([this.config.height,0])};this.setUpXAxis=function(){this.xAxisFn=d3.svg.axis().scale(this.xScale).ticks(this.config.xNumTicks).orient("bottom");this.xAxis.attr("transform",this.translateStr(0,this.config.height)).call(this.xAxisFn);this.xLongestLabel=d3.max(_.map([this.xMin,this.xMax],function(j){return(String(j)).length}));if(this.xLongestLabel>=c){this.xAxis.selectAll("g").filter(":nth-child(odd)").style("display","none")}this.xAxisLabel.attr("x",this.config.width/2).attr("y",this.config.xAxisLabelBumpY).attr("text-anchor","middle").text(this.config.xLabel)};this.setUpYAxis=function(){this.yAxisFn=d3.svg.axis().scale(this.yScale).ticks(this.config.yNumTicks).orient("left");this.yAxis.call(this.yAxisFn);this.log("yAxis:",this.yAxis);var j=this.yAxis.selectAll("text").filter(function(n,m){return m!==0});this.yLongestLabel=d3.max(j[0].map(function(n,m){return(d3.select(n).text()).length}))||0;var k=d+(this.yLongestLabel*h)+e+g;this.config.yAxisLabelBumpX=-(k-g);if(this.config.marginLeft<k){var l=(k)-this.config.marginLeft;l=(l<0)?(0):(l);this.log("adjusting:",l);this.adjustChartDimensions(0,0,0,l)}this.yAxisLabel.attr("x",this.config.yAxisLabelBumpX).attr("y",this.config.height/2).attr("text-anchor","middle").attr("transform",this.rotateStr(-90,this.config.yAxisLabelBumpX,this.config.height/2)).text(this.config.yLabel)};this.renderGrid=function(){this.vGridLines=this.content.selectAll("line.v-grid-line").data(this.xScale.ticks(this.xAxisFn.ticks()[0]));this.vGridLines.enter().append("svg:line").classed("grid-line v-grid-line",true);this.vGridLines.attr("x1",this.xScale).attr("y1",0).attr("x2",this.xScale).attr("y2",this.config.height);this.vGridLines.exit().remove();this.hGridLines=this.content.selectAll("line.h-grid-line").data(this.yScale.ticks(this.yAxisFn.ticks()[0]));this.hGridLines.enter().append("svg:line").classed("grid-line h-grid-line",true);this.hGridLines.attr("x1",0).attr("y1",this.yScale).attr("x2",this.config.width).attr("y2",this.yScale);this.hGridLines.exit().remove()};this.glyphEnterState=function(j){};this.glyphFinalState=function(j){};this.glyphExitState=function(j){};this.renderDatapoints=function(j,m){var l=function(o,n){return i.xScale(j[n])};var k=function(o,n){return i.yScale(m[n])};this.datapoints=this.content.selectAll(".glyph").data(j);this.datapoints.enter().append("svg:circle").attr("class","glyph").attr("cx",l).attr("cy",0).attr("r",0);this.datapoints.transition().duration(this.config.entryAnimDuration).attr("cx",l).attr("cy",k).attr("r",this.config.bubbleRadius);this.datapoints.exit().transition().duration(this.config.entryAnimDuration).attr("cy",this.config.height).attr("r",0).style("fill-opacity",0).remove()};this.render=function(j,k){this.log("renderScatterplot",j.length,k.length,this.config);j=this.preprocessData(j);k=this.preprocessData(k);this.setUpDomains(j,k);this.setUpScales();this.adjustChartDimensions();this.setUpXAxis();this.setUpYAxis();this.renderGrid();this.renderDatapoints(j,k)}}var a=BaseView.extend(LoggableMixin).extend({tagName:"form",className:"scatterplot-settings-form",loadingIndicatorImagePath:(galaxy_paths.get("image_path")+"/loading_large_white_bg.gif"),events:{"click #render-button":"renderScatterplot"},initialize:function(c){if(!c||!c.dataset){throw ("ScatterplotView requires a dataset")}else{this.dataset=c.dataset}this.apiDatasetsURL=c.apiDatasetsURL;this.chartConfig=c.chartConfig||{};this.log("this.chartConfig:",this.chartConfig);this.plot=new b(this.chartConfig)},render:function(){var c=this,e="",d="";this.dataset.metadata_column_types=this.dataset.metadata_column_types.split(", ");_.each(this.dataset.metadata_column_types,function(h,g){if(h==="int"||h==="float"){var f="column "+g;if(c.dataset.metadata_column_names){f=c.dataset.metadata_column_names[g]}d+='<option value="'+g+'">'+f+"</option>"}});e+='<div id="loading-indicator" style="display: none;">';e+='<img class="loading-img" src='+this.loadingIndicatorImagePath+" />";e+='<span class="loading-message"></span>';e+="</div>";e+='<div id="x-column-input">';e+='<label for="">Data column for X: </label><select name="x-column">'+d+"</select>";e+="</div>";e+='<div id="y-column-input">';e+='<label for="">Data column for Y: </label><select name="y-column">'+d+"</select>";e+="</div>";e+='<input id="render-button" type="button" value="Draw" />';e+='<div class="clear"></div>';this.$el.append(e);this.$el.find("#render-button");return this},showLoadingIndicator:function(c){c=c||"";this.$el.find("div#loading-indicator").children(".loading-message").text(c);this.$el.find("div#loading-indicator").show("fast")},hideLoadingIndicator:function(){this.$el.find("div#loading-indicator").hide("fast")},renderScatterplot:function(){var d=this,e=this.apiDatasetsURL+"/"+this.dataset.id+"?data_type=raw_data&",i=this.$el.find('[name="x-column"]'),j=i.val(),g=i.children('[value="'+j+'"]').text(),h=this.$el.find('[name="y-column"]'),f=h.val(),c=h.children('[value="'+f+'"]').text();this.log(g,c);this.chartConfig.xLabel=g;this.chartConfig.yLabel=c;d.plot.updateConfig(this.chartConfig);e+=jQuery.param({columns:"["+[j,f]+"]"});this.log("url:",e);this.showLoadingIndicator("Fetching data...");jQuery.ajax({url:e,dataType:"json",success:function(k){d.showLoadingIndicator("Rendering...");d.endpoint=k.endpoint;d.plot.render(_.map(k.data,function(l){return l[0]}),_.map(k.data,function(l){return l[1]}));d.hideLoadingIndicator()},error:function(m,k,l){d.hideLoadingIndicator();alert("ERROR:"+k+"\n"+l)}})}});return{ScatterplotView:a}});
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/viz/sweepster.js
--- a/static/scripts/packed/viz/sweepster.js
+++ b/static/scripts/packed/viz/sweepster.js
@@ -1,1 +1,1 @@
-define(["libs/d3","viz/trackster/util","viz/visualization","viz/trackster/tracks","mvc/tools","mvc/data"],function(o,f,n,h,g,d){var m=Backbone.Model.extend({defaults:{inputs:null,values:null}});var p=Backbone.RelationalModel.extend({defaults:{tool:null,tree_data:null},initialize:function(r){var q=this;this.get("tool").get("inputs").each(function(s){if(!s.get_samples()){return}s.on("change:min change:max change:num_samples",function(t){if(t.get("in_ptree")){q.set_tree_data()}},q);s.on("change:in_ptree",function(t){if(t.get("in_ptree")){q.add_param(t)}else{q.remove_param(t)}q.set_tree_data()},q)});if(r.config){_.each(r.config,function(t){var s=q.get("tool").get("inputs").find(function(u){return u.get("name")===t.name});q.add_param(s);s.set(t)})}},add_param:function(q){if(q.get("ptree_index")){return}q.set("in_ptree",true);q.set("ptree_index",this.get_tree_params().length)},remove_param:function(q){q.set("in_ptree",false);q.set("ptree_index",null);_(this.get_tree_params()).each(function(r,s){r.set("ptree_index",s+1)})},set_tree_data:function(){var r=_.map(this.get_tree_params(),function(t){return{param:t,samples:t.get_samples()}});var q=0,s=function(w,t){var y=w[t],x=y.param,v=x.get("label"),u=y.samples;if(w.length-1===t){return _.map(u,function(z){return{id:q++,name:z,param:x,value:z}})}return _.map(u,function(z){return{id:q++,name:z,param:x,value:z,children:s(w,t+1)}})};this.set("tree_data",{name:"Root",id:q++,children:(r.length!==0?s(r,0):null)})},get_tree_params:function(){return _(this.get("tool").get("inputs").where({in_ptree:true})).sortBy(function(q){return q.get("ptree_index")})},get_num_leaves:function(){return this.get_tree_params().reduce(function(q,r){return q*r.get_samples().length},1)},get_node_settings:function(u){var s=this.get("tool").get_inputs_dict();var v=u.parent;if(v){while(v.depth!==0){s[v.param.get("name")]=v.value;v=v.parent}}var q=this,r=function(x,w){if(x.param){w[x.param.get("name")]=x.value}if(!x.children){return new m({inputs:q.get("tool").get("inputs"),values:w})}else{return _.flatten(_.map(x.children,function(y){return r(y,_.clone(w))}))}},t=r(u,s);if(!_.isArray(t)){t=[t]}return t},get_connected_nodes:function(s){var t=function(u){if(!u.children){return u}else{return _.flatten([u,_.map(u.children,function(v){return t(v)})])}};var r=[],q=s.parent;while(q){r.push(q);q=q.parent}return _.flatten([r,t(s)])},get_leaf:function(r){var s=this.get("tree_data"),q=function(t){return _.find(t,function(u){return r[u.param.get("name")]===u.value})};while(s.children){s=q(s.children)}return s},toJSON:function(){return this.get_tree_params().map(function(q){return{name:q.get("name"),min:q.get("min"),max:q.get("max"),num_samples:q.get("num_samples")}})}});var c=Backbone.RelationalModel.extend({defaults:{track:null,mode:"Pack",settings:null,regions:null},relations:[{type:Backbone.HasMany,key:"regions",relatedModel:n.GenomeRegion}],initialize:function(q){if(q.track){var r=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},q.track);this.set("track",h.object_from_template(r,{},null))}},same_settings:function(q){var r=this.get("settings"),s=q.get("settings");for(var t in r){if(!s[t]||r[t]!==s[t]){return false}}return true},toJSON:function(){return{track:this.get("track").to_dict(),settings:this.get("settings"),regions:this.get("regions")}}});var a=Backbone.Collection.extend({model:c});var i=n.Visualization.extend({defaults:_.extend({},n.Visualization.prototype.defaults,{dataset:null,tool:null,parameter_tree:null,regions:null,tracks:null,default_mode:"Pack"}),relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:d.Dataset},{type:Backbone.HasOne,key:"tool",relatedModel:g.Tool},{type:Backbone.HasMany,key:"regions",relatedModel:n.GenomeRegion},{type:Backbone.HasMany,key:"tracks",relatedModel:c}],initialize:function(q){var r=this.get("tool").copy(true);this.set("tool_with_samplable_inputs",r);this.set("parameter_tree",new p({tool:r,config:q.tree_config}))},add_track:function(q){this.get("tracks").add(q)},toJSON:function(){return{id:this.get("id"),title:"Parameter exploration for dataset '"+this.get("dataset").get("name")+"'",type:"sweepster",dataset_id:this.get("dataset").id,tool_id:this.get("tool").id,regions:this.get("regions").toJSON(),tree_config:this.get("parameter_tree").toJSON(),tracks:this.get("tracks").toJSON()}}});var l=Backbone.View.extend({tagName:"tr",TILE_LEN:250,initialize:function(q){this.canvas_manager=q.canvas_manager;this.render();this.model.on("change:track change:mode",this.draw_tiles,this)},render:function(){var v=this.model.get("settings"),r=v.get("values"),t=$("<td/>").addClass("settings").appendTo(this.$el),s=$("<div/>").addClass("track-info").hide().appendTo(t);s.append($("<div/>").css("font-weight","bold").text("Track Settings"));v.get("inputs").each(function(x){s.append(x.get("label")+": "+r[x.get("name")]+"<br/>")});var q=this,w=$("<button/>").appendTo(s).text("Run on complete dataset").click(function(){s.toggle();q.trigger("run_on_dataset",v)});var u=create_icon_buttons_menu([{title:"Settings",icon_class:"gear track-settings",on_click:function(){s.toggle()}},{title:"Remove",icon_class:"cross-circle",on_click:function(){q.$el.remove();$(".bs-tooltip").remove()}}]);t.prepend(u.$el);this.model.get("regions").each(function(){q.$el.append($("<td/>").addClass("tile").html($("<img/>").attr("src",galaxy_paths.get("image_path")+"/loading_large_white_bg.gif")))});if(this.model.get("track")){this.draw_tiles()}},draw_tiles:function(){var r=this,q=this.model.get("track"),t=this.model.get("regions"),s=this.$el.find("td.tile");if(!q){return}$.when(q.data_manager.data_is_ready()).then(function(u){t.each(function(x,w){var v=x.length()/r.TILE_LEN,z=1/v,y=r.model.get("mode");$.when(q.data_manager.get_data(x,y,v,{})).then(function(B){var A=r.canvas_manager.new_canvas();A.width=r.TILE_LEN;A.height=q.get_canvas_height(B,y,z,A.width);q.draw_tile(B,A.getContext("2d"),y,v,x,z);$(s[w]).empty().append(A)})})})}});var b=Backbone.View.extend({number_input_template:'<div class="form-row-input sweep"><input class="min" type="text" size="6" value="<%= min %>"> - <input class="max" type="text" size="6" value="<%= max %>"> samples: <input class="num_samples" type="text" size="1" value="<%= num_samples %>"></div>',select_input_template:'<div class="form-row-input sweep"><%= options %></div>',initialize:function(q){this.$el=q.tool_row;this.render()},render:function(){var r=this.model,v=r.get("type"),x=this.$el.find(".form-row-input"),t=null;x.find(":input").change(function(){r.set("value",$(this).val())});if(v==="number"){t=$(_.template(this.number_input_template,this.model.toJSON()))}else{if(v==="select"){var s=_.map(this.$el.find("select option"),function(y){return $(y).val()}),u=s.join(", ");t=$(_.template(this.select_input_template,{options:u}))}}t.insertAfter(x);var q=this,w=create_icon_buttons_menu([{title:"Add parameter to tree",icon_class:"plus-button",on_click:function(){r.set("in_ptree",true);x.hide();t.show();$(this).hide();q.$el.find(".icon-button.toggle").show()}},{title:"Remove parameter from tree",icon_class:"toggle",on_click:function(){r.set("in_ptree",false);t.hide();x.show();$(this).hide();q.$el.find(".icon-button.plus-button").show()}}],{});this.$el.prepend(w.$el);if(r.get("in_ptree")){x.hide();q.$el.find(".icon-button.plus-button").hide()}else{q.$el.find(".icon-button.toggle").hide();t.hide()}_.each(["min","max","num_samples"],function(y){t.find("."+y).change(function(){r.set(y,parseFloat($(this).val()))})})}});var k=Backbone.View.extend({className:"tree-design",initialize:function(q){this.render()},render:function(){var s=new g.ToolFormView({model:this.model.get("tool")});s.render();this.$el.append(s.$el);var r=this,q=r.model.get("tool").get("inputs");this.$el.find(".form-row").not(".form-actions").each(function(t){var u=new b({model:q.at(t),tool_row:$(this)})})}});var j=Backbone.View.extend({className:"tool-parameter-tree",initialize:function(q){this.model.on("change:tree_data",this.render,this)},render:function(){this.$el.children().remove();var y=this.model.get_tree_params();if(!y.length){return}this.width=100*(2+y.length);this.height=15*this.model.get_num_leaves();var x=this;var w=o.layout.cluster().size([this.height,this.width-160]);var s=o.svg.diagonal().projection(function(z){return[z.y,z.x]});var q=w.nodes(this.model.get("tree_data"));var t=_.uniq(_.pluck(q,"y"));_.each(y,function(B,A){var z=t[A+1],C=$("#center").position().left;x.$el.append($("<div>").addClass("label").text(B.get("label")).css("left",z+C))});var r=o.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height+30).append("g").attr("transform","translate(40, 20)");var v=r.selectAll("path.link").data(w.links(q)).enter().append("path").attr("class","link").attr("d",s);var u=r.selectAll("g.node").data(q).enter().append("g").attr("class","node").attr("transform",function(z){return"translate("+z.y+","+z.x+")"}).on("mouseover",function(A){var z=_.pluck(x.model.get_connected_nodes(A),"id");u.filter(function(B){return _.find(z,function(C){return C===B.id})!==undefined}).style("fill","#f00")}).on("mouseout",function(){u.style("fill","#000")});u.append("circle").attr("r",9);u.append("text").attr("dx",function(z){return z.children?-12:12}).attr("dy",3).attr("text-anchor",function(z){return z.children?"end":"start"}).text(function(z){return z.name})}});var e=Backbone.View.extend({className:"Sweepster",helpText:"<div><h4>Getting Started</h4><ol><li>Create a parameter tree by using the icons next to the tool's parameter names to add or remove parameters.<li>Adjust the tree by using parameter inputs to select min, max, and number of samples<li>Run the tool with different settings by clicking on tree nodes</ol></div>",initialize:function(r){this.canvas_manager=new n.CanvasManager(this.$el.parents("body"));this.tool_param_tree_view=new j({model:this.model.get("parameter_tree")});this.track_collection_container=$("<table/>").addClass("tracks");this.model.get("parameter_tree").on("change:tree_data",this.handle_node_clicks,this);var q=this;this.model.get("tracks").each(function(s){s.get("track").view=q});this.block_color=f.get_random_color();this.reverse_strand_color=f.get_random_color([this.block_color,"#ffffff"])},render:function(){var w=new k({model:this.model.get("parameter_tree")});$("#left").append(w.$el);var z=this,t=z.model.get("regions"),x=$("<tr/>").appendTo(this.track_collection_container);t.each(function(A){x.append($("<th>").text(A.toString()))});x.children().first().attr("colspan",2);var u=$("<div>").addClass("tiles");$("#right").append(u.append(this.track_collection_container));z.model.get("tracks").each(function(A){z.add_track(A)});var y=$(this.helpText).addClass("help"),v=create_icon_buttons_menu([{title:"Close",icon_class:"cross-circle",on_click:function(){$(".bs-tooltip").remove();y.remove()}}]);y.prepend(v.$el.css("float","right"));$("#center").append(y);this.tool_param_tree_view.render();$("#center").append(this.tool_param_tree_view.$el);this.handle_node_clicks();var s=create_icon_buttons_menu([{icon_class:"chevron-expand",title:"Set display mode"},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location="${h.url_for( controller='visualization', action='list' )}"}}],{tooltip_config:{placement:"bottom"}});var r=["Squish","Pack"],q={};_.each(r,function(A){q[A]=function(){z.model.set("default_mode",A);z.model.get("tracks").each(function(B){B.set("mode",A)})}});make_popupmenu(s.$el.find(".chevron-expand"),q);s.$el.attr("style","float: right");$("#right .unified-panel-header-inner").append(s.$el)},run_tool_on_dataset:function(r){var q=this.model.get("tool"),t=q.get("name"),s=this.model.get("dataset");q.set_input_values(r.get("values"));$.when(q.rerun(s)).then(function(u){});show_modal("Running "+t+" on complete dataset",t+" is running on dataset '"+s.get("name")+"'. Outputs are in the dataset's history.",{Ok:function(){hide_modal()}})},add_track:function(t){var r=this,s=this.model.get("parameter_tree");r.model.add_track(t);var q=new l({model:t,canvas_manager:r.canvas_manager});q.on("run_on_dataset",r.run_tool_on_dataset,r);r.track_collection_container.append(q.$el);q.$el.hover(function(){var v=s.get_leaf(t.get("settings").get("values"));var u=_.pluck(s.get_connected_nodes(v),"id");o.select(r.tool_param_tree_view.$el[0]).selectAll("g.node").filter(function(w){return _.find(u,function(x){return x===w.id})!==undefined}).style("fill","#f00")},function(){o.select(r.tool_param_tree_view.$el[0]).selectAll("g.node").style("fill","#000")});return t},handle_node_clicks:function(){var q=this,r=this.model.get("parameter_tree"),t=this.model.get("regions"),s=o.select(this.tool_param_tree_view.$el[0]).selectAll("g.node");s.on("click",function(z,w){var v=q.model.get("tool"),y=q.model.get("dataset"),x=r.get_node_settings(z),u=$.Deferred();if(x.length>=10){show_modal("Whoa there cowboy!","You clicked on a node to try "+q.model.get("tool").get("name")+" with "+x.length+" different combinations of settings. You can only run 10 jobs at a time.",{Ok:function(){hide_modal();u.resolve(false)}})}else{u.resolve(true)}$.when(u).then(function(A){if(!A){return}var B=_.map(x,function(C){var D=new c({settings:C,regions:t,mode:q.model.get("default_mode")});q.add_track(D);return D});_.each(B,function(D,C){setTimeout(function(){v.set_input_values(D.get("settings").get("values"));$.when(v.rerun(y,t)).then(function(F){var G=_.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},F.first().get("track_config")),E=h.object_from_template(G,q,null);E.data_manager.set("data_type","raw_data");E.prefs.block_color=q.block_color;E.prefs.reverse_strand_color=q.reverse_strand_color;D.set("track",E)})},C*10000)})})})}});return{SweepsterVisualization:i,SweepsterVisualizationView:e}});
\ No newline at end of file
+define(["libs/underscore","libs/d3","viz/trackster/util","viz/visualization","viz/trackster/tracks","mvc/tools","mvc/data"],function(m,q,f,o,h,g,d){var n=Backbone.Model.extend({defaults:{inputs:null,values:null}});var p=Backbone.RelationalModel.extend({defaults:{tool:null,tree_data:null},initialize:function(s){var r=this;this.get("tool").get("inputs").each(function(t){if(!t.get_samples()){return}t.on("change:min change:max change:num_samples",function(u){if(u.get("in_ptree")){r.set_tree_data()}},r);t.on("change:in_ptree",function(u){if(u.get("in_ptree")){r.add_param(u)}else{r.remove_param(u)}r.set_tree_data()},r)});if(s.config){m.each(s.config,function(u){var t=r.get("tool").get("inputs").find(function(v){return v.get("name")===u.name});r.add_param(t);t.set(u)})}},add_param:function(r){if(r.get("ptree_index")){return}r.set("in_ptree",true);r.set("ptree_index",this.get_tree_params().length)},remove_param:function(r){r.set("in_ptree",false);r.set("ptree_index",null);m(this.get_tree_params()).each(function(s,t){s.set("ptree_index",t+1)})},set_tree_data:function(){var s=m.map(this.get_tree_params(),function(u){return{param:u,samples:u.get_samples()}});var r=0,t=function(x,u){var z=x[u],y=z.param,w=y.get("label"),v=z.samples;if(x.length-1===u){return m.map(v,function(A){return{id:r++,name:A,param:y,value:A}})}return m.map(v,function(A){return{id:r++,name:A,param:y,value:A,children:t(x,u+1)}})};this.set("tree_data",{name:"Root",id:r++,children:(s.length!==0?t(s,0):null)})},get_tree_params:function(){return m(this.get("tool").get("inputs").where({in_ptree:true})).sortBy(function(r){return r.get("ptree_index")})},get_num_leaves:function(){return this.get_tree_params().reduce(function(r,s){return r*s.get_samples().length},1)},get_node_settings:function(v){var t=this.get("tool").get_inputs_dict();var w=v.parent;if(w){while(w.depth!==0){t[w.param.get("name")]=w.value;w=w.parent}}var r=this,s=function(y,x){if(y.param){x[y.param.get("name")]=y.value}if(!y.children){return new n({inputs:r.get("tool").get("inputs"),values:x})}else{return m.flatten(m.map(y.children,function(z){return s(z,m.clone(x))}))}},u=s(v,t);if(!m.isArray(u)){u=[u]}return u},get_connected_nodes:function(t){var u=function(v){if(!v.children){return v}else{return m.flatten([v,m.map(v.children,function(w){return u(w)})])}};var s=[],r=t.parent;while(r){s.push(r);r=r.parent}return m.flatten([s,u(t)])},get_leaf:function(s){var t=this.get("tree_data"),r=function(u){return m.find(u,function(v){return s[v.param.get("name")]===v.value})};while(t.children){t=r(t.children)}return t},toJSON:function(){return this.get_tree_params().map(function(r){return{name:r.get("name"),min:r.get("min"),max:r.get("max"),num_samples:r.get("num_samples")}})}});var c=Backbone.RelationalModel.extend({defaults:{track:null,mode:"Pack",settings:null,regions:null},relations:[{type:Backbone.HasMany,key:"regions",relatedModel:o.GenomeRegion}],initialize:function(r){if(r.track){var s=m.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},r.track);this.set("track",h.object_from_template(s,{},null))}},same_settings:function(r){var s=this.get("settings"),t=r.get("settings");for(var u in s){if(!t[u]||s[u]!==t[u]){return false}}return true},toJSON:function(){return{track:this.get("track").to_dict(),settings:this.get("settings"),regions:this.get("regions")}}});var a=Backbone.Collection.extend({model:c});var i=o.Visualization.extend({defaults:m.extend({},o.Visualization.prototype.defaults,{dataset:null,tool:null,parameter_tree:null,regions:null,tracks:null,default_mode:"Pack"}),relations:[{type:Backbone.HasOne,key:"dataset",relatedModel:d.Dataset},{type:Backbone.HasOne,key:"tool",relatedModel:g.Tool},{type:Backbone.HasMany,key:"regions",relatedModel:o.GenomeRegion},{type:Backbone.HasMany,key:"tracks",relatedModel:c}],initialize:function(r){var s=this.get("tool").copy(true);this.set("tool_with_samplable_inputs",s);this.set("parameter_tree",new p({tool:s,config:r.tree_config}))},add_track:function(r){this.get("tracks").add(r)},toJSON:function(){return{id:this.get("id"),title:"Parameter exploration for dataset '"+this.get("dataset").get("name")+"'",type:"sweepster",dataset_id:this.get("dataset").id,tool_id:this.get("tool").id,regions:this.get("regions").toJSON(),tree_config:this.get("parameter_tree").toJSON(),tracks:this.get("tracks").toJSON()}}});var l=Backbone.View.extend({tagName:"tr",TILE_LEN:250,initialize:function(r){this.canvas_manager=r.canvas_manager;this.render();this.model.on("change:track change:mode",this.draw_tiles,this)},render:function(){var w=this.model.get("settings"),s=w.get("values"),u=$("<td/>").addClass("settings").appendTo(this.$el),t=$("<div/>").addClass("track-info").hide().appendTo(u);t.append($("<div/>").css("font-weight","bold").text("Track Settings"));w.get("inputs").each(function(y){t.append(y.get("label")+": "+s[y.get("name")]+"<br/>")});var r=this,x=$("<button/>").appendTo(t).text("Run on complete dataset").click(function(){t.toggle();r.trigger("run_on_dataset",w)});var v=create_icon_buttons_menu([{title:"Settings",icon_class:"gear track-settings",on_click:function(){t.toggle()}},{title:"Remove",icon_class:"cross-circle",on_click:function(){r.$el.remove();$(".bs-tooltip").remove()}}]);u.prepend(v.$el);this.model.get("regions").each(function(){r.$el.append($("<td/>").addClass("tile").html($("<img/>").attr("src",galaxy_paths.get("image_path")+"/loading_large_white_bg.gif")))});if(this.model.get("track")){this.draw_tiles()}},draw_tiles:function(){var s=this,r=this.model.get("track"),u=this.model.get("regions"),t=this.$el.find("td.tile");if(!r){return}$.when(r.data_manager.data_is_ready()).then(function(v){u.each(function(y,x){var w=y.length()/s.TILE_LEN,A=1/w,z=s.model.get("mode");$.when(r.data_manager.get_data(y,z,w,{})).then(function(C){var B=s.canvas_manager.new_canvas();B.width=s.TILE_LEN;B.height=r.get_canvas_height(C,z,A,B.width);r.draw_tile(C,B.getContext("2d"),z,w,y,A);$(t[x]).empty().append(B)})})})}});var b=Backbone.View.extend({number_input_template:'<div class="form-row-input sweep"><input class="min" type="text" size="6" value="<%= min %>"> - <input class="max" type="text" size="6" value="<%= max %>"> samples: <input class="num_samples" type="text" size="1" value="<%= num_samples %>"></div>',select_input_template:'<div class="form-row-input sweep"><%= options %></div>',initialize:function(r){this.$el=r.tool_row;this.render()},render:function(){var s=this.model,w=s.get("type"),y=this.$el.find(".form-row-input"),u=null;y.find(":input").change(function(){s.set("value",$(this).val())});if(w==="number"){u=$(m.template(this.number_input_template,this.model.toJSON()))}else{if(w==="select"){var t=m.map(this.$el.find("select option"),function(z){return $(z).val()}),v=t.join(", ");u=$(m.template(this.select_input_template,{options:v}))}}u.insertAfter(y);var r=this,x=create_icon_buttons_menu([{title:"Add parameter to tree",icon_class:"plus-button",on_click:function(){s.set("in_ptree",true);y.hide();u.show();$(this).hide();r.$el.find(".icon-button.toggle").show()}},{title:"Remove parameter from tree",icon_class:"toggle",on_click:function(){s.set("in_ptree",false);u.hide();y.show();$(this).hide();r.$el.find(".icon-button.plus-button").show()}}],{});this.$el.prepend(x.$el);if(s.get("in_ptree")){y.hide();r.$el.find(".icon-button.plus-button").hide()}else{r.$el.find(".icon-button.toggle").hide();u.hide()}m.each(["min","max","num_samples"],function(z){u.find("."+z).change(function(){s.set(z,parseFloat($(this).val()))})})}});var k=Backbone.View.extend({className:"tree-design",initialize:function(r){this.render()},render:function(){var t=new g.ToolFormView({model:this.model.get("tool")});t.render();this.$el.append(t.$el);var s=this,r=s.model.get("tool").get("inputs");this.$el.find(".form-row").not(".form-actions").each(function(u){var v=new b({model:r.at(u),tool_row:$(this)})})}});var j=Backbone.View.extend({className:"tool-parameter-tree",initialize:function(r){this.model.on("change:tree_data",this.render,this)},render:function(){this.$el.children().remove();var z=this.model.get_tree_params();if(!z.length){return}this.width=100*(2+z.length);this.height=15*this.model.get_num_leaves();var y=this;var x=q.layout.cluster().size([this.height,this.width-160]);var t=q.svg.diagonal().projection(function(A){return[A.y,A.x]});var r=x.nodes(this.model.get("tree_data"));var u=m.uniq(m.pluck(r,"y"));m.each(z,function(C,B){var A=u[B+1],D=$("#center").position().left;y.$el.append($("<div>").addClass("label").text(C.get("label")).css("left",A+D))});var s=q.select(this.$el[0]).append("svg").attr("width",this.width).attr("height",this.height+30).append("g").attr("transform","translate(40, 20)");var w=s.selectAll("path.link").data(x.links(r)).enter().append("path").attr("class","link").attr("d",t);var v=s.selectAll("g.node").data(r).enter().append("g").attr("class","node").attr("transform",function(A){return"translate("+A.y+","+A.x+")"}).on("mouseover",function(B){var A=m.pluck(y.model.get_connected_nodes(B),"id");v.filter(function(C){return m.find(A,function(D){return D===C.id})!==undefined}).style("fill","#f00")}).on("mouseout",function(){v.style("fill","#000")});v.append("circle").attr("r",9);v.append("text").attr("dx",function(A){return A.children?-12:12}).attr("dy",3).attr("text-anchor",function(A){return A.children?"end":"start"}).text(function(A){return A.name})}});var e=Backbone.View.extend({className:"Sweepster",helpText:"<div><h4>Getting Started</h4><ol><li>Create a parameter tree by using the icons next to the tool's parameter names to add or remove parameters.<li>Adjust the tree by using parameter inputs to select min, max, and number of samples<li>Run the tool with different settings by clicking on tree nodes</ol></div>",initialize:function(s){this.canvas_manager=new o.CanvasManager(this.$el.parents("body"));this.tool_param_tree_view=new j({model:this.model.get("parameter_tree")});this.track_collection_container=$("<table/>").addClass("tracks");this.model.get("parameter_tree").on("change:tree_data",this.handle_node_clicks,this);var r=this;this.model.get("tracks").each(function(t){t.get("track").view=r});this.block_color=f.get_random_color();this.reverse_strand_color=f.get_random_color([this.block_color,"#ffffff"])},render:function(){var x=new k({model:this.model.get("parameter_tree")});$("#left").append(x.$el);var A=this,u=A.model.get("regions"),y=$("<tr/>").appendTo(this.track_collection_container);u.each(function(B){y.append($("<th>").text(B.toString()))});y.children().first().attr("colspan",2);var v=$("<div>").addClass("tiles");$("#right").append(v.append(this.track_collection_container));A.model.get("tracks").each(function(B){A.add_track(B)});var z=$(this.helpText).addClass("help"),w=create_icon_buttons_menu([{title:"Close",icon_class:"cross-circle",on_click:function(){$(".bs-tooltip").remove();z.remove()}}]);z.prepend(w.$el.css("float","right"));$("#center").append(z);this.tool_param_tree_view.render();$("#center").append(this.tool_param_tree_view.$el);this.handle_node_clicks();var t=create_icon_buttons_menu([{icon_class:"chevron-expand",title:"Set display mode"},{icon_class:"cross-circle",title:"Close",on_click:function(){window.location="${h.url_for( controller='visualization', action='list' )}"}}],{tooltip_config:{placement:"bottom"}});var s=["Squish","Pack"],r={};m.each(s,function(B){r[B]=function(){A.model.set("default_mode",B);A.model.get("tracks").each(function(C){C.set("mode",B)})}});make_popupmenu(t.$el.find(".chevron-expand"),r);t.$el.attr("style","float: right");$("#right .unified-panel-header-inner").append(t.$el)},run_tool_on_dataset:function(s){var r=this.model.get("tool"),u=r.get("name"),t=this.model.get("dataset");r.set_input_values(s.get("values"));$.when(r.rerun(t)).then(function(v){});show_modal("Running "+u+" on complete dataset",u+" is running on dataset '"+t.get("name")+"'. Outputs are in the dataset's history.",{Ok:function(){hide_modal()}})},add_track:function(u){var s=this,t=this.model.get("parameter_tree");s.model.add_track(u);var r=new l({model:u,canvas_manager:s.canvas_manager});r.on("run_on_dataset",s.run_tool_on_dataset,s);s.track_collection_container.append(r.$el);r.$el.hover(function(){var w=t.get_leaf(u.get("settings").get("values"));var v=m.pluck(t.get_connected_nodes(w),"id");q.select(s.tool_param_tree_view.$el[0]).selectAll("g.node").filter(function(x){return m.find(v,function(y){return y===x.id})!==undefined}).style("fill","#f00")},function(){q.select(s.tool_param_tree_view.$el[0]).selectAll("g.node").style("fill","#000")});return u},handle_node_clicks:function(){var r=this,s=this.model.get("parameter_tree"),u=this.model.get("regions"),t=q.select(this.tool_param_tree_view.$el[0]).selectAll("g.node");t.on("click",function(A,x){var w=r.model.get("tool"),z=r.model.get("dataset"),y=s.get_node_settings(A),v=$.Deferred();if(y.length>=10){show_modal("Whoa there cowboy!","You clicked on a node to try "+r.model.get("tool").get("name")+" with "+y.length+" different combinations of settings. You can only run 10 jobs at a time.",{Ok:function(){hide_modal();v.resolve(false)}})}else{v.resolve(true)}$.when(v).then(function(B){if(!B){return}var C=m.map(y,function(D){var E=new c({settings:D,regions:u,mode:r.model.get("default_mode")});r.add_track(E);return E});m.each(C,function(E,D){setTimeout(function(){w.set_input_values(E.get("settings").get("values"));$.when(w.rerun(z,u)).then(function(G){var H=m.extend({data_url:galaxy_paths.get("raw_data_url"),converted_datasets_state_url:galaxy_paths.get("dataset_state_url")},G.first().get("track_config")),F=h.object_from_template(H,r,null);F.data_manager.set("data_type","raw_data");F.prefs.block_color=r.block_color;F.prefs.reverse_strand_color=r.reverse_strand_color;E.set("track",F)})},D*10000)})})})}});return{SweepsterVisualization:i,SweepsterVisualizationView:e}});
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/viz/trackster/tracks.js
--- a/static/scripts/packed/viz/trackster/tracks.js
+++ b/static/scripts/packed/viz/trackster/tracks.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters","viz/trackster_ui"],function(ad,y,l,v,M,ab,i,q){var r=ad.extend;var R=l.get_random_color;var ae=function(af,ah,ag){$.ajax({url:af,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(ai){show_modal("Select datasets for new tracks",ai,{Cancel:function(){hide_modal()},Add:function(){var aj=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var ak={data_type:"track_config",hda_ldda:"hda"},al=$(this).val();if($(this).attr("name")!=="id"){ak.hda_ldda="ldda"}aj[aj.length]=$.ajax({url:ah+"/"+al,data:ak,dataType:"json"})});$.when.apply($,aj).then(function(){var ak=(arguments[0] instanceof Array?$.map(arguments,function(al){return al[0]}):[arguments[0]]);ag(ak)});hide_modal()}})}})};var X=function(af){return("isResolved" in af)};var n={};var k=function(af,ag){n[af.attr("id")]=ag};var m=function(af,ah,aj,ai){aj=".group";var ag={};n[af.attr("id")]=ai;af.bind("drag",{handle:"."+ah,relative:true},function(ar,at){var aq=$(this),aw=$(this).parent(),an=aw.children(),ap=n[$(this).attr("id")],am,al,au,ak,ao;al=$(this).parents(aj);if(al.length!==0){au=al.position().top;ak=au+al.outerHeight();if(at.offsetY<au){$(this).insertBefore(al);var av=n[al.attr("id")];av.remove_drawable(ap);av.container.add_drawable_before(ap,av);return}else{if(at.offsetY>ak){$(this).insertAfter(al);var av=n[al.attr("id")];av.remove_drawable(ap);av.container.add_drawable(ap);return}}}al=null;for(ao=0;ao<an.length;ao++){am=$(an.get(ao));au=am.position().top;ak=au+am.outerHeight();if(am.is(aj)&&this!==am.get(0)&&at.offsetY>=au&&at.offsetY<=ak){if(at.offsetY-au<ak-at.offsetY){am.find(".content-div").prepend(this)}else{am.find(".content-div").append(this)}if(ap.container){ap.container.remove_drawable(ap)}n[am.attr("id")].add_drawable(ap);return}}for(ao=0;ao<an.length;ao++){am=$(an.get(ao));if(at.offsetY<am.position().top&&!(am.hasClass("reference-track")||am.hasClass("intro"))){break}}if(ao===an.length){if(this!==an.get(ao-1)){aw.append(this);n[aw.attr("id")].move_drawable(ap,ao)}}else{if(this!==an.get(ao)){$(this).insertBefore(an.get(ao));n[aw.attr("id")].move_drawable(ap,(at.deltaY>0?ao-1:ao))}}}).bind("dragstart",function(){ag["border-top"]=af.css("border-top");ag["border-bottom"]=af.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(ag)})};exports.moveable=m;var ac=16,H=9,E=20,B=100,J=12000,U=400,L=5000,x=100,o="There was an error in indexing this dataset. ",K="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",F="No data for this chrom/contig.",w="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",z="Tool cannot be rerun: ",a="Loading data...",W="Ready for display",S=10,I=20;function Y(ag,af){if(!af){af=0}var ah=Math.pow(10,af);return Math.round(ag*ah)/ah}var s=function(ag,af,ai){if(!s.id_counter){s.id_counter=0}this.id=s.id_counter++;this.name=ai.name;this.view=ag;this.container=af;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ai.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ai.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(aj){aj.stopPropagation()});var ah=this;this.container_div.hover(function(){ah.icons_div.show()},function(){ah.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};s.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(af){if(af.content_visible){af.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");af.hide_contents();af.content_visible=false}else{af.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");af.content_visible=true;af.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(ag){var ai=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(){ag.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ah=function(aj){if((aj.keyCode||aj.which)===27){ai()}else{if((aj.keyCode||aj.which)===13){af()}}};$(window).bind("keypress.check_enter_esc",ah);show_modal("Configure",ag.config.build_form(),{Cancel:ai,OK:af})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(af){$(".bs-tooltip").remove();af.remove()}}];r(s.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(){},to_dict:function(){},set_name:function(af){this.old_name=this.name;this.name=af;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var af=this.view;this.container_div.hide(0,function(){$(this).remove();af.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(ag,al,ak,aj,af,ai){var ah=this;this.action_icons[ag]=$("<a/>").attr("href","javascript:void(0);").attr("title",al).addClass("icon-button").addClass(ak).tooltip().click(function(){aj(ah)}).appendTo(this.icons_div);if(ai){this.action_icons[ag].hide()}},build_action_icons:function(af){var ah;for(var ag=0;ag<af.length;ag++){ah=af[ag];this.add_action_icon(ah.name,ah.title,ah.css_class,ah.on_click_fn,ah.prepend,ah.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var A=function(ag,af,ah){s.call(this,ag,af,ah);this.obj_type=ah.obj_type;this.drawables=[]};r(A.prototype,s.prototype,{unpack_drawables:function(ah){this.drawables=[];var ag;for(var af=0;af<ah.length;af++){ag=p(ah[af],this.view,this);this.add_drawable(ag)}},init:function(){for(var af=0;af<this.drawables.length;af++){this.drawables[af].init()}},_draw:function(){for(var af=0;af<this.drawables.length;af++){this.drawables[af]._draw()}},to_dict:function(){var ag=[];for(var af=0;af<this.drawables.length;af++){ag.push(this.drawables[af].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:ag}},add_drawable:function(af){this.drawables.push(af);af.container=this;this.changed()},add_drawable_before:function(ah,af){this.changed();var ag=this.drawables.indexOf(af);if(ag!==-1){this.drawables.splice(ag,0,ah);return true}return false},replace_drawable:function(ah,af,ag){var ai=this.drawables.indexOf(ah);if(ai!==-1){this.drawables[ai]=af;if(ag){ah.container_div.replaceWith(af.container_div)}this.changed()}return ai},remove_drawable:function(ag){var af=this.drawables.indexOf(ag);if(af!==-1){this.drawables.splice(af,1);ag.container=null;this.changed();return true}return false},move_drawable:function(ag,ah){var af=this.drawables.indexOf(ag);if(af!==-1){this.drawables.splice(af,1);this.drawables.splice(ah,0,ag);this.changed();return true}return false},get_drawables:function(){return this.drawables}});var Q=function(ag,af,ai){r(ai,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});A.call(this,ag,af,ai);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ai){this.unpack_drawables(ai.drawables)}if("filters" in ai){var ah=this.filters_manager;this.filters_manager=new i.FiltersManager(this,ai.filters);ah.parent_div.replaceWith(this.filters_manager.parent_div);if(ai.filters.visible){this.setup_multitrack_filtering()}}};r(Q.prototype,s.prototype,A.prototype,{action_icons_def:[s.prototype.action_icons_def[0],s.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(af){$(".bs-tooltip").remove();af.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(af){if(af.filters_manager.visible()){af.filters_manager.clear_filters();af._restore_filter_managers()}else{af.setup_multitrack_filtering();af.request_draw(true)}af.filters_manager.toggle()}},s.prototype.action_icons_def[2]],build_container_div:function(){var af=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(af)}return af},build_header_div:function(){var af=$("<div/>").addClass("track-header");af.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(af);return af},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ah=this.drawables.length;if(ah===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ah===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var ao,an,al,ar=true,aj=this.drawables[0].get_type(),af=0;for(ao=0;ao<ah;ao++){al=this.drawables[ao];if(al.get_type()!==aj){can_composite=false;break}if(al instanceof c){af++}}if(ar||af===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(af>1&&af===this.drawables.length){var at={},ag;al=this.drawables[0];for(an=0;an<al.filters_manager.filters.length;an++){ag=al.filters_manager.filters[an];at[ag.name]=[ag]}for(ao=1;ao<this.drawables.length;ao++){al=this.drawables[ao];for(an=0;an<al.filters_manager.filters.length;an++){ag=al.filters_manager.filters[an];if(ag.name in at){at[ag.name].push(ag)}}}this.filters_manager.remove_all();var ai,ak,am,ap;for(var aq in at){ai=at[aq];if(ai.length===af){ak=new i.NumberFilter({name:ai[0].name,index:ai[0].index});this.filters_manager.add_filter(ak)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var af=0;af<this.drawables.length;af++){this.drawables[af].filters_manager=this.saved_filters_managers[af]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var af=0;af<this.drawables.length;af++){drawable=this.drawables[af];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var aj=[];for(var ag=0;ag<this.drawables.length;ag++){aj.push(this.drawables[ag].name)}var ah="Composite Track of "+this.drawables.length+" tracks ("+aj.join(", ")+")";var ai=new f(this.view,this.view,{name:ah,drawables:this.drawables});var af=this.container.replace_drawable(this,ai,true);ai.request_draw()},add_drawable:function(af){A.prototype.add_drawable.call(this,af);this.update_icons()},remove_drawable:function(af){A.prototype.remove_drawable.call(this,af);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var af=r(A.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return af},request_draw:function(af,ah){for(var ag=0;ag<this.drawables.length;ag++){this.drawables[ag].request_draw(af,ah)}}});var aa=function(af){r(af,{obj_type:"View"});A.call(this,"View",af.container,af);this.chrom=null;this.vis_id=af.vis_id;this.dbkey=af.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.init();this.canvas_manager=new y.CanvasManager(this.container.get(0).ownerDocument);this.reset()};ad.extend(aa.prototype,Backbone.Events);r(aa.prototype,A.prototype,{init:function(){this.requested_redraw=false;var ah=this.container,af=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ah);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ah);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ah);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,af);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ai=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){ae(add_datasets_url,add_track_async_url,function(aj){ad.each(aj,function(ak){af.add_drawable(p(ak,af,af))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-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/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").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_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var ag=function(aj){if(aj.type==="focusout"||(aj.keyCode||aj.which)===13||(aj.keyCode||aj.which)===27){if((aj.keyCode||aj.which)!==27){af.go_to($(this).val())}$(this).hide();$(this).val("");af.location_span.show();af.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",ag).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){af.location_span.hide();af.chrom_select.hide();af.nav_input.val(af.chrom+":"+af.low+"-"+af.high);af.nav_input.css("display","inline-block");af.nav_input.select();af.nav_input.focus();af.nav_input.autocomplete({source:function(al,aj){var am=[],ak=$.map(af.get_drawables(),function(an){return an.data_manager.search_features(al.term).success(function(ao){am=am.concat(ao)})});$.when.apply($,ak).done(function(){aj($.map(am,function(an){return{label:an[0],value:an[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){af.zoom_out();af.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){af.zoom_in();af.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){af.change_chrom(af.chrom_select.val())});this.browser_content_div.click(function(aj){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(aj){af.zoom_in(aj.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(aj,ak){this.current_x=ak.offsetX}).bind("drag",function(aj,al){var am=al.offsetX-this.current_x;this.current_x=al.offsetX;var ak=Math.round(am/af.viewport_container.width()*(af.max_high-af.max_low));af.move_delta(-ak)});this.overview_close.click(function(){af.reset_overview()});this.viewport_container.bind("draginit",function(aj,ak){if(aj.clientX>af.viewport_container.width()-16){return false}}).bind("dragstart",function(aj,ak){ak.original_low=af.low;ak.current_height=aj.clientY;ak.current_x=ak.offsetX}).bind("drag",function(al,an){var aj=$(this);var ao=an.offsetX-an.current_x;var ak=aj.scrollTop()-(al.clientY-an.current_height);aj.scrollTop(ak);an.current_height=al.clientY;an.current_x=an.offsetX;var am=Math.round(ao/af.viewport_container.width()*(af.high-af.low));af.move_delta(am)}).bind("mousewheel",function(al,an,ak,aj){if(ak){ak*=50;var am=Math.round(-ak/af.viewport_container.width()*(af.high-af.low));af.move_delta(am)}});this.top_labeltrack.bind("dragstart",function(aj,ak){return $("<div />").css({height:af.browser_content_div.height()+af.top_labeltrack.height()+af.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(an,ao){$(ao.proxy).css({left:Math.min(an.pageX,ao.startX)-af.container.offset().left,width:Math.abs(an.pageX-ao.startX)});var ak=Math.min(an.pageX,ao.startX)-af.container.offset().left,aj=Math.max(an.pageX,ao.startX)-af.container.offset().left,am=(af.high-af.low),al=af.viewport_container.width();af.update_location(Math.round(ak/al*am)+af.low,Math.round(aj/al*am)+af.low)}).bind("dragend",function(ao,ap){var ak=Math.min(ao.pageX,ap.startX),aj=Math.max(ao.pageX,ap.startX),am=(af.high-af.low),al=af.viewport_container.width(),an=af.low;af.low=Math.round(ak/al*am)+an;af.high=Math.round(aj/al*am)+an;$(ap.proxy).remove();af.request_redraw()});this.add_label_track(new Z(this,{content_div:this.top_labeltrack}));this.add_label_track(new Z(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){af.resize_window()},500)});$(document).bind("redraw",function(){af.redraw()});this.reset();$(window).trigger("resize")},changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(ag,ai,af,aj){if(this.timer){clearTimeout(this.timer)}if(aj){var ah=this;this.timer=setTimeout(function(){ah.trigger("navigate",ag+":"+ai+"-"+af)},500)}else{view.trigger("navigate",ag+":"+ai+"-"+af)}},update_location:function(af,ah){this.location_span.text(commatize(af)+" - "+commatize(ah));this.nav_input.val(this.chrom+":"+commatize(af)+"-"+commatize(ah));var ag=view.chrom_select.val();if(ag!==""){this.trigger_navigate(ag,view.low,view.high,true)}},load_chroms:function(ah){ah.num=x;var af=this,ag=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ah,dataType:"json",success:function(aj){if(aj.chrom_info.length===0){return}if(aj.reference){af.add_label_track(new C(af))}af.chrom_data=aj.chrom_info;var am='<option value="">Select Chrom/Contig</option>';for(var al=0,ai=af.chrom_data.length;al<ai;al++){var ak=af.chrom_data[al].chrom;am+='<option value="'+ak+'">'+ak+"</option>"}if(aj.prev_chroms){am+='<option value="previous">Previous '+x+"</option>"}if(aj.next_chroms){am+='<option value="next">Next '+x+"</option>"}af.chrom_select.html(am);af.chrom_start_index=aj.start_index;ag.resolve(aj)},error:function(){alert("Could not load chroms for this dbkey:",af.dbkey)}});return ag},change_chrom:function(ak,ag,am){var ah=this;if(!ah.chrom_data){ah.load_chroms_deferred.then(function(){ah.change_chrom(ak,ag,am)});return}if(!ak||ak==="None"){return}if(ak==="previous"){ah.load_chroms({low:this.chrom_start_index-x});return}if(ak==="next"){ah.load_chroms({low:this.chrom_start_index+x});return}var al=$.grep(ah.chrom_data,function(an,ao){return an.chrom===ak})[0];if(al===undefined){ah.load_chroms({chrom:ak},function(){ah.change_chrom(ak,ag,am)});return}else{if(ak!==ah.chrom){ah.chrom=ak;ah.chrom_select.val(ah.chrom);ah.max_high=al.len-1;ah.reset();ah.request_redraw(true);for(var aj=0,af=ah.drawables.length;aj<af;aj++){var ai=ah.drawables[aj];if(ai.init){ai.init()}}if(ah.reference_track){ah.reference_track.init()}}if(ag!==undefined&&am!==undefined){ah.low=Math.max(ag,0);ah.high=Math.min(am,ah.max_high)}else{ah.low=0;ah.high=ah.max_high}ah.reset_overview();ah.request_redraw()}},go_to:function(aj){aj=aj.replace(/ |,/g,"");var an=this,af,ai,ag=aj.split(":"),al=ag[0],am=ag[1];if(am!==undefined){try{var ak=am.split("-");af=parseInt(ak[0],10);ai=parseInt(ak[1],10)}catch(ah){return false}}an.change_chrom(al,af,ai)},move_fraction:function(ah){var af=this;var ag=af.high-af.low;this.move_delta(ah*ag)},move_delta:function(ai){var af=this;var ah=af.high-af.low;if(af.low-ai<af.max_low){af.low=af.max_low;af.high=af.max_low+ah}else{if(af.high-ai>af.max_high){af.high=af.max_high;af.low=af.max_high-ah}else{af.high-=ai;af.low-=ai}}af.request_redraw();var ag=af.chrom_select.val();this.trigger_navigate(ag,af.low,af.high,true)},add_drawable:function(af){A.prototype.add_drawable.call(this,af);af.init();this.changed();this.update_intro_div()},add_label_track:function(af){af.view=this;af.init();this.label_tracks.push(af)},remove_drawable:function(ah,ag){A.prototype.remove_drawable.call(this,ah);if(ag){var af=this;ah.container_div.hide(0,function(){$(this).remove();af.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(an,af,am,ao){var al=this,ak=(ao?[ao]:al.drawables),ah;var ag;for(var aj=0;aj<ak.length;aj++){ag=ak[aj];ah=-1;for(var ai=0;ai<al.tracks_to_be_redrawn.length;ai++){if(al.tracks_to_be_redrawn[ai][0]===ag){ah=ai;break}}if(ah<0){al.tracks_to_be_redrawn.push([ag,af,am])}else{al.tracks_to_be_redrawn[aj][1]=af;al.tracks_to_be_redrawn[aj][2]=am}}if(!this.requested_redraw){requestAnimationFrame(function(){al._redraw(an)});this.requested_redraw=true}},_redraw:function(ap){this.requested_redraw=false;var am=this.low,ai=this.high;if(am<this.max_low){am=this.max_low}if(ai>this.max_high){ai=this.max_high}var ao=this.high-this.low;if(this.high!==0&&ao<this.min_separation){ai=am+this.min_separation}this.low=Math.floor(am);this.high=Math.ceil(ai);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var af=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var al=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var aq=13;this.overview_box.css({left:af,width:Math.max(aq,al)}).show();if(al<aq){this.overview_box.css("left",af-(aq-al)/2)}if(this.overview_highlight){this.overview_highlight.css({left:af,width:al})}if(!ap){var ah,ag,an;for(var aj=0,ak=this.tracks_to_be_redrawn.length;aj<ak;aj++){ah=this.tracks_to_be_redrawn[aj][0];ag=this.tracks_to_be_redrawn[aj][1];an=this.tracks_to_be_redrawn[aj][2];if(ah){ah._draw(ag,an)}}this.tracks_to_be_redrawn=[];for(aj=0,ak=this.label_tracks.length;aj<ak;aj++){this.label_tracks[aj]._draw()}}},zoom_in:function(ag,ah){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ai=this.high-this.low,aj=ai/2+this.low,af=(ai/this.zoom_factor)/2;if(ag){aj=ag/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(aj-af);this.high=Math.round(aj+af);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var ag=this.high-this.low,ah=ag/2+this.low,af=(ag*this.zoom_factor)/2;this.low=Math.round(ah-af);this.high=Math.round(ah+af);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ah){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ah.dataset_id){return}this.overview_viewport.find(".track").remove()}var ag=ah.copy({content_div:this.overview_viewport}),af=this;ag.header_div.hide();ag.is_overview=true;af.overview_drawable=ag;this.overview_drawable.postdraw_actions=function(){af.overview_highlight.show().height(af.overview_drawable.content_div.height());af.overview_viewport.height(af.overview_drawable.content_div.height()+af.overview_box.outerHeight());af.overview_close.show();af.resize_window()};af.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").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();view.resize_window();view.overview_drawable=null}});var t=function(ah,am,ai){this.track=ah;this.name=am.name;this.params=[];var au=am.params;for(var aj=0;aj<au.length;aj++){var ao=au[aj],ag=ao.name,at=ao.label,ak=unescape(ao.html),av=ao.value,aq=ao.type;if(aq==="number"){this.params.push(new e(ag,at,ak,(ag in ai?ai[ag]:av),ao.min,ao.max))}else{if(aq==="select"){this.params.push(new O(ag,at,ak,(ag in ai?ai[ag]:av)))}else{console.log("WARNING: unrecognized tool parameter type:",ag,aq)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(ax){ax.stopPropagation()}).click(function(ax){ax.stopPropagation()}).bind("dblclick",function(ax){ax.stopPropagation()});var ar=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ap=this.params;var an=this;$.each(this.params,function(ay,aB){var aA=$("<div>").addClass("param-row").appendTo(an.parent_div);var ax=$("<div>").addClass("param-label").text(aB.label).appendTo(aA);var az=$("<div/>").addClass("param-input").html(aB.html).appendTo(aA);az.find(":input").val(aB.value);$("<div style='clear: both;'/>").appendTo(aA)});this.parent_div.find("input").click(function(){$(this).select()});var aw=$("<div>").addClass("param-row").appendTo(this.parent_div);var al=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(aw);var af=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(aw);af.click(function(){an.run_on_region()});al.click(function(){an.run_on_dataset()});if("visible" in ai&&ai.visible){this.parent_div.show()}};r(t.prototype,{update_params:function(){for(var af=0;af<this.params.length;af++){this.params[af].update_value()}},state_dict:function(){var ag={};for(var af=0;af<this.params.length;af++){ag[this.params[af].name]=this.params[af].value}ag.visible=this.parent_div.is(":visible");return ag},get_param_values_dict:function(){var af={};this.parent_div.find(":input").each(function(){var ag=$(this).attr("name"),ah=$(this).val();af[ag]=ah});return af},get_param_values:function(){var af=[];this.parent_div.find(":input").each(function(){var ag=$(this).attr("name"),ah=$(this).val();if(ag){af[af.length]=ah}});return af},run_on_dataset:function(){var af=this;af.run({target_dataset_id:this.track.original_dataset_id,tool_id:af.name},null,function(ag){show_modal(af.name+" is Running",af.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var ag={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[{chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}]},ak=this.track,ah=ag.tool_id+ak.tool_region_and_parameters_str(ag.chrom,ag.low,ag.high),af;if(ak.container===view){var aj=new Q(view,view,{name:this.name});var ai=ak.container.replace_drawable(ak,aj,false);aj.container_div.insertBefore(ak.view.content_div.children()[ai]);aj.add_drawable(ak);ak.container_div.appendTo(aj.content_div);af=aj}else{af=ak.container}var al=new ak.constructor(view,af,{name:ah,hda_ldda:"hda"});al.init_for_tool_data();al.change_mode(ak.mode);al.set_filters_manager(ak.filters_manager.copy(al));al.update_icons();af.add_drawable(al);al.tiles_div.text("Starting job.");this.update_params();this.run(ag,al,function(am){al.set_dataset(new ab.Dataset(am));al.tiles_div.text("Running job.");al.init()})},run:function(af,ah,ai){af.inputs=this.get_param_values_dict();var ag=new l.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(af),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(aj){return aj!=="pending"}});$.when(ag.go()).then(function(aj){if(aj==="no converter"){ah.container_div.addClass("error");ah.content_div.text(K)}else{if(aj.error){ah.container_div.addClass("error");ah.content_div.text(z+aj.message)}else{ai(aj)}}})}});var O=function(ag,af,ah,ai){this.name=ag;this.label=af;this.html=$(ah);this.value=ai};r(O.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ah,ag,aj,ak,ai,af){O.call(this,ah,ag,aj,ak);this.min=ai;this.max=af};r(e.prototype,O.prototype,{update_value:function(){O.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var D=function(af,ag){M.Scaler.call(this,ag);this.filter=af};D.prototype.gen_val=function(af){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(af[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var G=function(af){this.track=af.track;this.params=af.params;this.values={};this.restore_values((af.saved_values?af.saved_values:{}));this.onchange=af.onchange};r(G.prototype,{restore_values:function(af){var ag=this;$.each(this.params,function(ah,ai){if(af[ai.key]!==undefined){ag.values[ai.key]=af[ai.key]}else{ag.values[ai.key]=ai.default_value}})},build_form:function(){var ai=this;var af=$("<div />");var ah;function ag(an,aj){for(var ar=0;ar<an.length;ar++){ah=an[ar];if(ah.hidden){continue}var al="param_"+ar;var aw=ai.values[ah.key];var ay=$("<div class='form-row' />").appendTo(aj);ay.append($("<label />").attr("for",al).text(ah.label+":"));if(ah.type==="bool"){ay.append($('<input type="checkbox" />').attr("id",al).attr("name",al).attr("checked",aw))}else{if(ah.type==="text"){ay.append($('<input type="text"/>').attr("id",al).val(aw).click(function(){$(this).select()}))}else{if(ah.type==="select"){var au=$("<select />").attr("id",al);for(var ap=0;ap<ah.options.length;ap++){$("<option/>").text(ah.options[ap].label).attr("value",ah.options[ap].value).appendTo(au)}au.val(aw);ay.append(au)}else{if(ah.type==="color"){var ax=$("<div/>").appendTo(ay),at=$("<input />").attr("id",al).attr("name",al).val(aw).css("float","left").appendTo(ax).click(function(aA){$(".bs-tooltip").removeClass("in");var az=$(this).siblings(".bs-tooltip").addClass("in");az.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(az).height()/2)+($(this).height()/2)}).show();az.click(function(aB){aB.stopPropagation()});$(document).bind("click.color-picker",function(){az.hide();$(document).unbind("click.color-picker")});aA.stopPropagation()}),aq=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(ax).attr("title","Set new random color").tooltip(),av=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(ax).hide(),am=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(av),ak=$("<div class='tooltip-arrow'></div>").appendTo(av),ao=$.farbtastic(am,{width:100,height:100,callback:at,color:aw});ax.append($("<div/>").css("clear","both"));(function(az){aq.click(function(){az.setColor(R())})})(ao)}else{ay.append($("<input />").attr("id",al).attr("name",al).val(aw))}}}}if(ah.help){ay.append($("<div class='help'/>").text(ah.help))}}}ag(this.params,af);return af},update_from_form:function(af){var ah=this;var ag=false;$.each(this.params,function(ai,ak){if(!ak.hidden){var al="param_"+ai;var aj=af.find("#"+al).val();if(ak.type==="float"){aj=parseFloat(aj)}else{if(ak.type==="int"){aj=parseInt(aj)}else{if(ak.type==="bool"){aj=af.find("#"+al).is(":checked")}}}if(aj!==ah.values[ak.key]){ah.values[ak.key]=aj;ag=true}}});if(ag){this.onchange();this.track.changed()}}});var b=function(af,aj,ah,ag,ai){this.track=af;this.region=aj;this.low=aj.get("start");this.high=aj.get("end");this.resolution=ah;this.html_elt=$("<div class='track-tile'/>").append(ag).height($(ag).attr("height"));this.data=ai;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(af,ak,ah,ag,ai,aj){b.call(this,af,ak,ah,ag,ai);this.max_val=aj};r(j.prototype,b.prototype);var P=function(ai,aq,aj,ah,al,at,am,au,ag,ap){b.call(this,ai,aq,aj,ah,al);this.mode=am;this.all_slotted=ag;this.feature_mapper=ap;this.has_icons=false;if(au){this.has_icons=true;var an=this;ah=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:E-1,width:ah.width}).prependTo(this.html_elt);var ao=new y.GenomeRegion({chrom:ai.view.chrom,start:this.low,end:this.high}),ar=al.length,ak=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+ar+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),af=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+ar+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);ak.click(function(){an.stale=true;ai.data_manager.get_more_data(ao,ai.mode,an.resolution,{},ai.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();ai.request_draw(true)}).dblclick(function(av){av.stopPropagation()});af.click(function(){an.stale=true;ai.data_manager.get_more_data(ao,ai.mode,an.resolution,{},ai.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();ai.request_draw(true)}).dblclick(function(av){av.stopPropagation()})}};r(P.prototype,b.prototype);P.prototype.predisplay_actions=function(){var ag=this,af={};if(ag.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(ar){if(!this.hovered){return}var am=$(this).offset(),aq=ar.pageX-am.left,ap=ar.pageY-am.top,aw=ag.feature_mapper.get_feature_data(aq,ap),an=(aw?aw[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!an||$(this).attr("id")!==an.toString()){$(this).remove()}});if(aw){var ai=af[an];if(!ai){var an=aw[0],at={name:aw[3],start:aw[1],end:aw[2],strand:aw[4]},al=ag.track.filters_manager.filters,ak;for(var ao=0;ao<al.length;ao++){ak=al[ao];at[ak.name]=aw[ak.index]}var ai=$("<div/>").attr("id",an).addClass("feature-popup"),ax=$("<table/>"),av,au,ay;for(av in at){au=at[av];ay=$("<tr/>").appendTo(ax);$("<th/>").appendTo(ay).text(av);$("<td/>").attr("align","left").appendTo(ay).text(typeof(au)==="number"?Y(au,2):au)}ai.append($("<div class='feature-popup-inner'>").append(ax));af[an]=ai}ai.appendTo($(this).parents(".track-content").children(".overlay"));var aj=aq+parseInt(ag.html_elt.css("left"))-ai.width()/2,ah=ap+parseInt(ag.html_elt.css("top"))+7;ai.css("left",aj+"px").css("top",ah+"px")}else{if(!ar.isPropagationStopped()){ar.stopPropagation();$(this).siblings().each(function(){$(this).trigger(ar)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(ag,af,ah){r(ah,{drag_handle_class:"draghandle"});s.call(this,ag,af,ah);this.dataset=new ab.Dataset({id:ah.dataset_id,hda_ldda:ah.hda_ldda});this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ah?ah.data_query_wait:L);this.data_manager=("data_manager" in ah?ah.data_manager:new y.GenomeDataManager({dataset:this.dataset,data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ah)||ah.resize){this.add_resize_handle()}}};r(g.prototype,s.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},s.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(af){af.view.set_overview(af)}},s.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(af){if(af.filters_manager.visible()){af.filters_manager.clear_filters()}else{af.filters_manager.init_filters()}af.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(af){af.dynamic_tool_div.toggle();if(af.dynamic_tool_div.is(":visible")){af.set_name(af.name+af.tool_region_and_parameters_str())}else{af.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(af){var ai='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ah=ad.template(ai,{track:af});var ak=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ag=function(){var am=$('select[name="regions"] option:selected').val(),ao,al=new y.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),an=ad.map($(".bookmark"),function(ap){return new y.GenomeRegion({from_str:$(ap).children(".position").text()})});if(am==="cur"){ao=[al]}else{if(am==="bookmarks"){ao=an}else{ao=[al].concat(an)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:af.dataset_id,hda_ldda:af.hda_ldda,regions:JSON.stringify(new Backbone.Collection(ao).toJSON())})},aj=function(al){if((al.keyCode||al.which)===27){ak()}else{if((al.keyCode||al.which)===13){ag()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ah,{No:ak,Yes:ag})}},s.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&s.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var af=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(af)}this.name_div=$("<div/>").addClass("track-name").appendTo(af).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return af},on_resize:function(){},add_resize_handle:function(){var af=this;var ai=false;var ah=false;var ag=$("<div class='track-resize'>");$(af.container_div).hover(function(){if(af.content_visible){ai=true;ag.show()}},function(){ai=false;if(!ah){ag.hide()}});ag.hide().bind("dragstart",function(aj,ak){ah=true;ak.original_height=$(af.content_div).height()}).bind("drag",function(ak,al){var aj=Math.min(Math.max(al.original_height+al.deltaY,af.min_height_px),af.max_height_px);$(af.tiles_div).css("height",aj);af.visible_height_px=(af.max_height_px===aj?0:aj);af.on_resize()}).bind("dragend",function(aj,ak){af.tile_cache.clear();ah=false;if(!ai){ag.hide()}af.config.values.height=af.visible_height_px;af.changed()}).appendTo(af.container_div)},set_display_modes:function(ai,al){this.display_modes=ai;this.mode=(al?al:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var ag=this,aj={};for(var ah=0,af=ag.display_modes.length;ah<af;ah++){var ak=ag.display_modes[ah];aj[ak]=function(am){return function(){ag.change_mode(am);ag.icons_div.show();ag.container_div.mouseleave(function(){ag.icons_div.hide()})}}(ak)}make_popupmenu(this.action_icons.mode_icon,aj)},build_action_icons:function(){s.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof Z){return"LabelTrack"}else{if(this instanceof C){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof V){return"ReadTrack"}else{if(this instanceof T){return"VcfTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(){var ag=this;ag.enabled=false;ag.tile_cache.clear();ag.data_manager.clear();ag.content_div.css("height","auto");ag.tiles_div.children().remove();ag.container_div.removeClass("nodata error pending");if(!ag.dataset_id){return}var af=$.Deferred(),ah={hda_ldda:ag.hda_ldda,data_type:this.dataset_check_type,chrom:ag.view.chrom};$.getJSON(this.dataset.url(),ah,function(ai){if(!ai||ai==="error"||ai.kind==="error"){ag.container_div.addClass("error");ag.tiles_div.text(o);if(ai.message){var aj=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ai.message+"</pre>",{Close:hide_modal})});ag.tiles_div.append(aj)}}else{if(ai==="no converter"){ag.container_div.addClass("error");ag.tiles_div.text(K)}else{if(ai==="no data"||(ai.data!==undefined&&(ai.data===null||ai.data.length===0))){ag.container_div.addClass("nodata");ag.tiles_div.text(F)}else{if(ai==="pending"){ag.container_div.addClass("pending");ag.tiles_div.html(w);setTimeout(function(){ag.init()},ag.data_query_wait)}else{if(ai==="data"||ai.status==="data"){if(ai.valid_chroms){ag.valid_chroms=ai.valid_chroms;ag.update_icons()}ag.tiles_div.text(W);if(ag.view.chrom){ag.tiles_div.text("");ag.tiles_div.css("height",ag.visible_height_px+"px");ag.enabled=true;$.when(ag.predraw_init()).done(function(){af.resolve();ag.container_div.removeClass("nodata error pending");ag.request_draw()})}else{af.resolve()}}}}}}});this.update_icons();return af},predraw_init:function(){},get_drawables:function(){return this}});var N=function(ah,ag,ai){g.call(this,ah,ag,ai);var af=this;m(af.container_div,af.drag_handle_class,".group",af);this.filters_manager=new i.FiltersManager(this,("filters" in ai?ai.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in ai&&ai.tool?new t(this,ai.tool,ai.tool_state):null);this.tile_cache=new y.Cache(S);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ai.mode){this.change_mode(ai.mode)}};r(N.prototype,s.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(af){$(".bs-tooltip").remove();af.slotters[af.view.resolution_px_b].max_rows*=2;af.request_draw(true)},hide:true}]),copy:function(af){var ag=this.to_dict();r(ag,{data_manager:this.data_manager});var ah=new this.constructor(this.view,af,ag);ah.change_mode(this.mode);ah.enabled=this.enabled;return ah},set_filters_manager:function(af){this.filters_manager=af;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(ag){var af=this;af.mode=ag;af.config.values.mode=ag;af.tile_cache.clear();af.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+af.mode+")");return af},update_icons:function(){var af=this;if(af.filters_available){af.action_icons.filters_icon.show()}else{af.action_icons.filters_icon.hide()}if(af.tool){af.action_icons.tools_icon.show();af.action_icons.param_space_viz_icon.show()}else{af.action_icons.tools_icon.hide();af.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(ag,ah,af){return ag+"_"+ah+"_"+af},request_draw:function(ag,af){this.view.request_redraw(false,ag,af,this)},before_draw:function(){},_draw:function(ag,aq){if(!this.can_draw()){return}var ao=this.view.low,ak=this.view.high,am=ak-ao,ah=this.view.container.width(),at=this.view.resolution_px_b,aj=this.view.resolution_b_px;if(this.is_overview){ao=this.view.max_low;ak=this.view.max_high;aj=(view.max_high-view.max_low)/ah;at=1/aj}this.before_draw();this.tiles_div.children().addClass("remove");var af=Math.floor(ao/(aj*U)),an=true,ar=[],al=function(au){return(au&&"track" in au)};while((af*U*aj)<ak){var ap=this.draw_helper(ag,ah,af,aj,this.tiles_div,at);if(al(ap)){ar.push(ap)}else{an=false}af+=1}if(!aq){this.tiles_div.children(".remove").removeClass("remove").remove()}var ai=this;if(an){this.tiles_div.children(".remove").remove();ai.postdraw_actions(ar,ah,at,aq)}},postdraw_actions:function(ah,ai,ak,af){var aj=false;for(var ag=0;ag<ah.length;ag++){if(ah[ag].has_icons){aj=true;break}}if(aj){for(var ag=0;ag<ah.length;ag++){tile=ah[ag];if(!tile.has_icons){tile.html_elt.css("padding-top",E)}}}},draw_helper:function(af,ar,ax,av,ak,al,at){var aq=this,aA=this._gen_tile_cache_key(ar,al,ax),ai=this._get_tile_bounds(ax,av);if(!at){at={}}var az=(af?undefined:aq.tile_cache.get_elt(aA));if(az){aq.show_tile(az,ak,al);return az}var ao=true;var aw=aq.data_manager.get_data(ai,aq.mode,av,aq.data_url_extra_params);if(X(aw)){ao=false}var am;if(view.reference_track&&al>view.canvas_manager.char_width_px){am=view.reference_track.data_manager.get_data(ai,aq.mode,av,view.reference_track.data_url_extra_params);if(X(am)){ao=false}}if(ao){r(aw,at.more_tile_data);var an=aq.mode;if(an==="Auto"){an=aq.get_mode(aw);aq.update_auto_mode(an)}var ah=aq.view.canvas_manager.new_canvas(),ay=ai.get("start"),ag=ai.get("end"),ar=Math.ceil((ag-ay)*al)+aq.left_offset,ap=aq.get_canvas_height(aw,an,al,ar);ah.width=ar;ah.height=ap;var au=ah.getContext("2d");au.translate(this.left_offset,0);var az=aq.draw_tile(aw,au,an,av,ai,al,am);if(az!==undefined){aq.tile_cache.set_elt(aA,az);aq.show_tile(az,ak,al)}return az}var aj=$.Deferred();$.when(aw,am).then(function(){view.request_redraw(false,false,false,aq);aj.resolve()});return aj},get_canvas_height:function(af,ah,ai,ag){return this.visible_height_px},draw_tile:function(af,ag,ak,ai,aj,al,ah){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ah,aj,ak){var ag=this,af=ah.html_elt;ah.predisplay_actions();var ai=(ah.low-(this.is_overview?this.view.max_low:this.view.low))*ak;if(this.left_offset){ai-=this.left_offset}af.css({position:"absolute",top:0,left:ai});if(af.hasClass("remove")){af.removeClass("remove")}else{aj.append(af)}ag.after_show_tile(ah)},after_show_tile:function(af){this.max_height_px=Math.max(this.max_height_px,af.html_elt.height());af.html_elt.parent().children().css("height",this.max_height_px+"px");var ag=this.max_height_px;if(this.visible_height_px!==0){ag=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",ag+"px")},_get_tile_bounds:function(af,ag){var ai=Math.floor(af*U*ag),aj=Math.ceil(U*ag),ah=(ai+aj<=this.view.max_high?ai+aj:this.view.max_high);return new y.GenomeRegion({chrom:this.view.chrom,start:ai,end:ah})},tool_region_and_parameters_str:function(ah,af,ai){var ag=this,aj=(ah!==undefined&&af!==undefined&&ai!==undefined?ah+":"+af+"-"+ai:"all");return" - region=["+aj+"], parameters=["+ag.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(af,ag){return true},can_subset:function(af){return false},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ah,ai,ak,af){var ag=this;ag.normal_postdraw_actions(ah,ai,ak,af);ag.dataset_check_type="converted_datasets_state";ag.data_query_wait=L;var aj=new l.ServerStateDeferred({url:ag.dataset_state_url,url_params:{dataset_id:ag.dataset_id,hda_ldda:ag.hda_ldda},interval:ag.data_query_wait,success_fn:function(al){return al!=="pending"}});$.when(aj.go()).then(function(){ag.data_manager.set("data_type","data")});ag.postdraw_actions=ag.normal_postdraw_actions}}});var Z=function(ag,af){var ah={resize:false};g.call(this,ag,af,ah);this.container_div.addClass("label-track")};r(Z.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var ah=this.view,ai=ah.high-ah.low,al=Math.floor(Math.pow(10,Math.floor(Math.log(ai)/Math.log(10)))),af=Math.floor(ah.low/al)*al,aj=this.view.container.width(),ag=$("<div style='position: relative; height: 1.3em;'></div>");while(af<ah.high){var ak=(af-ah.low)/ai*aj;ag.append($("<div class='label'>"+commatize(af)+"</div>").css({position:"absolute",left:ak-1}));af+=al}this.content_div.children(":first").remove();this.content_div.append(ag)}});var f=function(ag,af,aj){N.call(this,ag,af,aj);this.drawables=[];this.left_offset=0;if("drawables" in aj){var ai;for(var ah=0;ah<aj.drawables.length;ah++){ai=aj.drawables[ah];this.drawables[ah]=p(ai,ag,null);if(ai.left_offset>this.left_offset){this.left_offset=ai.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};r(f.prototype,N.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(af){$(".bs-tooltip").remove();af.show_group()}}].concat(N.prototype.action_icons_def),to_dict:A.prototype.to_dict,add_drawable:A.prototype.add_drawable,unpack_drawables:A.prototype.unpack_drawables,change_mode:function(af){N.prototype.change_mode.call(this,af);for(var ag=0;ag<this.drawables.length;ag++){this.drawables[ag].change_mode(af)}},init:function(){var ah=[];for(var ag=0;ag<this.drawables.length;ag++){ah.push(this.drawables[ag].init())}var af=this;$.when.apply($,ah).then(function(){af.enabled=true;af.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:s.prototype.can_draw,draw_helper:function(ag,aw,aC,az,an,ap,ax){var av=this,aG=this._gen_tile_cache_key(aw,ap,aC),ak=this._get_tile_bounds(aC,az);if(!ax){ax={}}var aF=(ag?undefined:av.tile_cache.get_elt(aG));if(aF){av.show_tile(aF,an,ap);return aF}var ao=[],av,at=true,aA,aq;for(var aB=0;aB<this.drawables.length;aB++){av=this.drawables[aB];aA=av.data_manager.get_data(ak,av.mode,az,av.data_url_extra_params);if(X(aA)){at=false}ao.push(aA);aq=null;if(view.reference_track&&ap>view.canvas_manager.char_width_px){aq=view.reference_track.data_manager.get_data(ak,av.mode,az,view.reference_track.data_url_extra_params);if(X(aq)){at=false}}ao.push(aq)}if(at){r(aA,ax.more_tile_data);this.tile_predraw_init();var aj=av.view.canvas_manager.new_canvas(),al=av._get_tile_bounds(aC,az),aD=ak.get("start"),ah=ak.get("end"),aE=0,aw=Math.ceil((ah-aD)*ap)+this.left_offset,au=0,ai=[],aB;var af=0;for(aB=0;aB<this.drawables.length;aB++,aE+=2){av=this.drawables[aB];aA=ao[aE];var ar=av.mode;if(ar==="Auto"){ar=av.get_mode(aA);av.update_auto_mode(ar)}ai.push(ar);af=av.get_canvas_height(aA,ar,ap,aw);if(af>au){au=af}}aj.width=aw;aj.height=(ax.height?ax.height:au);aE=0;var ay=aj.getContext("2d");ay.translate(this.left_offset,0);ay.globalAlpha=0.5;ay.globalCompositeOperation="source-over";for(aB=0;aB<this.drawables.length;aB++,aE+=2){av=this.drawables[aB];aA=ao[aE];aq=ao[aE+1];aF=av.draw_tile(aA,ay,ai[aB],az,ak,ap,aq)}this.tile_cache.set_elt(aG,aF);this.show_tile(aF,an,ap);return aF}var am=$.Deferred(),av=this;$.when.apply($,ao).then(function(){view.request_redraw(false,false,false,av);am.resolve()});return am},show_group:function(){var ai=new Q(this.view,this.container,{name:this.name}),af;for(var ah=0;ah<this.drawables.length;ah++){af=this.drawables[ah];af.update_icons();ai.add_drawable(af);af.container=ai;ai.content_div.append(af.container_div)}var ag=this.container.replace_drawable(this,ai,true);ai.request_draw()},tile_predraw_init:function(){var ai=Number.MAX_VALUE,af=-ai,ag;for(var ah=0;ah<this.drawables.length;ah++){ag=this.drawables[ah];if(ag instanceof h){if(ag.prefs.min_value<ai){ai=ag.prefs.min_value}if(ag.prefs.max_value>af){af=ag.prefs.max_value}}}for(var ah=0;ah<this.drawables.length;ah++){ag=this.drawables[ah];ag.prefs.min_value=ai;ag.prefs.max_value=af}},postdraw_actions:function(ah,ak,am,ag){N.prototype.postdraw_actions.call(this,ah,ak,am,ag);var aj=-1;for(var ai=0;ai<ah.length;ai++){var af=ah[ai].html_elt.find("canvas").height();if(af>aj){aj=af}}for(var ai=0;ai<ah.length;ai++){var al=ah[ai];if(al.html_elt.find("canvas").height()!==aj){this.draw_helper(true,ak,al.index,al.resolution,al.html_elt.parent(),am,{height:aj});al.html_elt.remove()}}}});var C=function(af){N.call(this,af,{content_div:af.top_labeltrack},{resize:false});af.reference_track=this;this.left_offset=200;this.visible_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_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new y.ReferenceTrackDataManager({data_url:this.data_url});this.hide_contents()};r(C.prototype,s.prototype,N.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:s.prototype.can_draw,draw_helper:function(aj,ah,af,ag,ak,al,ai){if(al>this.view.canvas_manager.char_width_px){return N.prototype.draw_helper.call(this,aj,ah,af,ag,ak,al,ai)}else{this.hide_contents();return null}},draw_tile:function(an,ao,aj,ai,al,ap){var ah=this;if(ap>this.view.canvas_manager.char_width_px){if(an.data===null){this.hide_contents();return}var ag=ao.canvas;ao.font=ao.canvas.manager.default_font;ao.textAlign="center";an=an.data;for(var ak=0,am=an.length;ak<am;ak++){var af=Math.floor(ak*ap);ao.fillText(an[ak],af,10)}this.show_contents();return new b(ah,al,ai,ag,an)}this.hide_contents()}});var h=function(ah,ag,ai){var af=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";N.call(this,ah,ag,ai);this.hda_ldda=ai.hda_ldda;this.dataset_id=ai.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:R()},{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:32,hidden:true}],saved_values:ai.prefs,onchange:function(){af.set_name(af.prefs.name);af.vertical_range=af.prefs.max_value-af.prefs.min_value;af.set_min_value(af.prefs.min_value);af.set_max_value(af.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};r(h.prototype,s.prototype,N.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(af){this.prefs.min_value=af;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(af){this.prefs.max_value=af;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var af=this;af.vertical_range=undefined;return $.getJSON(af.dataset.url(),{data_type:"data",stats:true,chrom:af.view.chrom,low:0,high:af.view.max_high,hda_ldda:af.hda_ldda},function(ag){af.container_div.addClass("line-track");var aj=ag.data;if(isNaN(parseFloat(af.prefs.min_value))||isNaN(parseFloat(af.prefs.max_value))){var ah=aj.min,al=aj.max;ah=Math.floor(Math.min(0,Math.max(ah,aj.mean-2*aj.sd)));al=Math.ceil(Math.max(0,Math.min(al,aj.mean+2*aj.sd)));af.prefs.min_value=ah;af.prefs.max_value=al;$("#track_"+af.dataset_id+"_minval").val(af.prefs.min_value);$("#track_"+af.dataset_id+"_maxval").val(af.prefs.max_value)}af.vertical_range=af.prefs.max_value-af.prefs.min_value;af.total_frequency=aj.total_frequency;af.container_div.find(".yaxislabel").remove();var ak=$("<div/>").text(Y(af.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(am){$(".bs-tooltip").remove();var am=parseFloat(am);if(!isNaN(am)){af.set_min_value(am)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+af.dataset_id+"_minval").prependTo(af.container_div),ai=$("<div/>").text(Y(af.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(am){$(".bs-tooltip").remove();var am=parseFloat(am);if(!isNaN(am)){af.set_max_value(am)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+af.dataset_id+"_maxval").prependTo(af.container_div)})},draw_tile:function(ao,am,ah,ag,aj,an){var af=am.canvas,ai=aj.get("start"),al=aj.get("end"),ak=new M.LinePainter(ao.data,ai,al,this.prefs,ah);ak.draw(am,af.width,af.height,an);return new b(this,aj,ag,af,ao.data)},can_subset:function(af){return false}});var u=function(ah,ag,ai){var af=this;this.display_modes=["Heatmap"];this.mode="Heatmap";N.call(this,ah,ag,ai);this.hda_ldda=ai.hda_ldda;this.dataset_id=ai.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"4169E1"},{key:"negative_color",label:"Negative Color",type:"color",default_value:"FF8C00"},{key:"min_value",label:"Min Value",type:"float",default_value:0},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ai.prefs,onchange:function(){af.set_name(af.prefs.name);af.vertical_range=af.prefs.max_value-af.prefs.min_value;af.set_min_value(af.prefs.min_value);af.set_max_value(af.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};r(u.prototype,s.prototype,N.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(af){this.prefs.min_value=af;this.tile_cache.clear();this.request_draw()},set_max_value:function(af){this.prefs.max_value=af;this.tile_cache.clear();this.request_draw()},draw_tile:function(ap,an,ak,ai,ag,ao){var ah=an.canvas,af=this._get_tile_bounds(ag,ai),aj=af[0],am=af[1],al=new M.DiagonalHeatmapPainter(ap.data,aj,am,this.prefs,ak);al.draw(an,ah.width,ah.height,ao);return new b(this,ag,ai,ah,ap.data)}});var c=function(ai,ah,ak){var ag=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];N.call(this,ai,ah,ak);var aj=R(),af=R([aj,"#ffffff"]);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:aj},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:af},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:ak.prefs,onchange:function(){ag.set_name(ag.prefs.name);ag.tile_cache.clear();ag.set_painter_from_config();ag.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=ak.hda_ldda;this.dataset_id=ak.dataset_id;this.original_dataset_id=ak.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};r(c.prototype,s.prototype,N.prototype,{set_dataset:function(af){this.dataset_id=af.get("id");this.hda_ldda=af.get("hda_ldda");this.dataset=af;this.data_manager.set("dataset",af)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=M.ArcLinkedFeaturePainter}else{this.painter=M.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},postdraw_actions:function(av,ap,ak,aj){N.prototype.postdraw_actions.call(this,av,aj);var ao=this,ar;if(ao.mode==="Coverage"){var ag=-1;for(ar=0;ar<av.length;ar++){var aq=av[ar].max_val;if(aq>ag){ag=aq}}for(ar=0;ar<av.length;ar++){var ax=av[ar];if(ax.max_val!==ag){ax.html_elt.remove();ao.draw_helper(true,ap,ax.index,ax.resolution,ax.html_elt.parent(),ak,{more_tile_data:{max:ag}})}}}if(ao.filters_manager){var al=ao.filters_manager.filters;for(var au=0;au<al.length;au++){al[au].update_ui_elt()}var aw=false,af,am;for(ar=0;ar<av.length;ar++){if(av[ar].data.length){af=av[ar].data[0];for(var au=0;au<al.length;au++){am=al[au];if(am.applies_to(af)&&am.min!==am.max){aw=true;break}}}}if(ao.filters_available!==aw){ao.filters_available=aw;if(!ao.filters_available){ao.filters_manager.hide()}ao.update_icons()}}this.container_div.find(".yaxislabel").remove();var ai=av[0];if(ai instanceof j){var an=(this.prefs.histogram_max?this.prefs.histogram_max:ai.max_val),ah=$("<div/>").text(an).make_text_editable({num_cols:12,on_finish:function(ay){$(".bs-tooltip").remove();var ay=parseFloat(ay);ao.prefs.histogram_max=(!isNaN(ay)?ay:null);ao.tile_cache.clear();ao.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(ah)}if(ai instanceof P){var at=true;for(ar=0;ar<av.length;ar++){if(!av[ar].all_slotted){at=false;break}}if(!at){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(af){var af;if(this.mode==="Auto"){if(af==="no_detail"){af="feature spans"}else{if(af==="summary_tree"){af="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+af+")")}},incremental_slots:function(aj,af,ai){var ag=this.view.canvas_manager.dummy_context,ah=this.slotters[aj];if(!ah||(ah.mode!==ai)){ah=new (v.FeatureSlotter)(aj,ai,B,function(ak){return ag.measureText(ak)});this.slotters[aj]=ah}return ah.slot_features(af)},get_mode:function(af){if(af.dataset_type==="summary_tree"){mode="summary_tree"}else{if(af.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>J){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(af,aj,ak,ag){if(aj==="summary_tree"||aj==="Coverage"){return this.summary_draw_height}else{var ai=this.incremental_slots(ak,af.data,aj);var ah=new (this.painter)(null,null,null,this.prefs,aj);return Math.max(ac,ah.get_required_height(ai,ag))}},draw_tile:function(ap,au,ar,av,ai,am,ah){var at=this,ag=au.canvas,aB=ai.get("start"),af=ai.get("end"),aj=this.left_offset;if(ar==="summary_tree"||ar==="Coverage"){var aD=new M.SummaryTreePainter(ap,aB,af,this.prefs);aD.draw(au,ag.width,ag.height,am);return new j(at,ai,av,ag,ap.data,ap.max)}var al=[],aq=this.slotters[am].slots;all_slotted=true;if(ap.data){var an=this.filters_manager.filters;for(var aw=0,ay=ap.data.length;aw<ay;aw++){var ak=ap.data[aw];var ax=false;var ao;for(var aA=0,aF=an.length;aA<aF;aA++){ao=an[aA];ao.update_attrs(ak);if(!ao.keep(ak)){ax=true;break}}if(!ax){al.push(ak);if(!(ak[0] in aq)){all_slotted=false}}}}var aE=(this.filters_manager.alpha_filter?new D(this.filters_manager.alpha_filter):null);var aC=(this.filters_manager.height_filter?new D(this.filters_manager.height_filter):null);var aD=new (this.painter)(al,aB,af,this.prefs,ar,aE,aC,ah);var az=null;au.fillStyle=this.prefs.block_color;au.font=au.canvas.manager.default_font;au.textAlign="right";if(ap.data){az=aD.draw(au,ag.width,ag.height,am,aq);az.translation=-aj}return new P(at,ai,av,ag,ap.data,am,ar,ap.message,all_slotted,az)},data_and_mode_compatible:function(af,ag){if(ag==="Auto"){return true}else{if(ag==="Coverage"){return af.dataset_type==="summary_tree"}else{if(af.extra_info==="no_detail"||af.dataset_type==="summary_tree"){return false}else{return true}}}},can_subset:function(af){if(af.dataset_type==="summary_tree"||af.message||af.extra_info==="no_detail"){return false}return true}});var T=function(ag,af,ah){c.call(this,ag,af,ah);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:R()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ah.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=M.ReadPainter};r(T.prototype,s.prototype,N.prototype,c.prototype);var V=function(ah,ag,aj){c.call(this,ah,ag,aj);var ai=R(),af=R([ai,"#ffffff"]);this.config=new G({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ai},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:af},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:aj.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=M.ReadPainter;this.update_icons()};r(V.prototype,s.prototype,N.prototype,c.prototype);var d={LineTrack:h,FeatureTrack:c,VcfTrack:T,ReadTrack:V,CompositeTrack:f,DrawableGroup:Q};var p=function(ah,ag,af){if("copy" in ah){return ah.copy(af)}else{var ai=ah.obj_type;if(!ai){ai=ah.track_type}return new d[ai](ag,af,ah)}};return{View:aa,DrawableGroup:Q,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:u,ReadTrack:V,VcfTrack:T,CompositeTrack:f,object_from_template:p,add_datasets:ae}});
\ No newline at end of file
+define(["libs/underscore","viz/visualization","viz/trackster/util","viz/trackster/slotting","viz/trackster/painters","mvc/data","viz/trackster/filters"],function(ac,x,l,u,L,aa,i){var q=ac.extend;var Q=l.get_random_color;var ad=function(ae,ag,af){$.ajax({url:ae,data:{"f-dbkey":view.dbkey},error:function(){alert("Grid failed")},success:function(ah){show_modal("Select datasets for new tracks",ah,{Cancel:function(){hide_modal()},Add:function(){var ai=[];$("input[name=id]:checked,input[name=ldda_ids]:checked").each(function(){var aj={data_type:"track_config",hda_ldda:"hda"},ak=$(this).val();if($(this).attr("name")!=="id"){aj.hda_ldda="ldda"}ai[ai.length]=$.ajax({url:ag+"/"+ak,data:aj,dataType:"json"})});$.when.apply($,ai).then(function(){var aj=(arguments[0] instanceof Array?$.map(arguments,function(ak){return ak[0]}):[arguments[0]]);af(aj)});hide_modal()}})}})};var W=function(ae){return("isResolved" in ae)};var n={};var k=function(ae,af){n[ae.attr("id")]=af};var m=function(ae,ag,ai,ah){ai=".group";var af={};n[ae.attr("id")]=ah;ae.bind("drag",{handle:"."+ag,relative:true},function(aq,ar){var ap=$(this),av=$(this).parent(),am=av.children(),ao=n[$(this).attr("id")],al,ak,at,aj,an;ak=$(this).parents(ai);if(ak.length!==0){at=ak.position().top;aj=at+ak.outerHeight();if(ar.offsetY<at){$(this).insertBefore(ak);var au=n[ak.attr("id")];au.remove_drawable(ao);au.container.add_drawable_before(ao,au);return}else{if(ar.offsetY>aj){$(this).insertAfter(ak);var au=n[ak.attr("id")];au.remove_drawable(ao);au.container.add_drawable(ao);return}}}ak=null;for(an=0;an<am.length;an++){al=$(am.get(an));at=al.position().top;aj=at+al.outerHeight();if(al.is(ai)&&this!==al.get(0)&&ar.offsetY>=at&&ar.offsetY<=aj){if(ar.offsetY-at<aj-ar.offsetY){al.find(".content-div").prepend(this)}else{al.find(".content-div").append(this)}if(ao.container){ao.container.remove_drawable(ao)}n[al.attr("id")].add_drawable(ao);return}}for(an=0;an<am.length;an++){al=$(am.get(an));if(ar.offsetY<al.position().top&&!(al.hasClass("reference-track")||al.hasClass("intro"))){break}}if(an===am.length){if(this!==am.get(an-1)){av.append(this);n[av.attr("id")].move_drawable(ao,an)}}else{if(this!==am.get(an)){$(this).insertBefore(am.get(an));n[av.attr("id")].move_drawable(ao,(ar.deltaY>0?an-1:an))}}}).bind("dragstart",function(){af["border-top"]=ae.css("border-top");af["border-bottom"]=ae.css("border-bottom");$(this).css({"border-top":"1px solid blue","border-bottom":"1px solid blue"})}).bind("dragend",function(){$(this).css(af)})};exports.moveable=m;var ab=16,G=9,D=20,A=100,I=12000,T=400,K=5000,w=100,o="There was an error in indexing this dataset. ",J="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",E="No data for this chrom/contig.",v="Preparing data. This can take a while for a large dataset. If the visualization is saved and closed, preparation will continue in the background.",y="Tool cannot be rerun: ",a="Loading data...",V="Ready for display",R=10,H=20;function X(af,ae){if(!ae){ae=0}var ag=Math.pow(10,ae);return Math.round(af*ag)/ag}var r=function(af,ae,ah){if(!r.id_counter){r.id_counter=0}this.id=r.id_counter++;this.name=ah.name;this.view=af;this.container=ae;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name}],saved_values:ah.prefs,onchange:function(){this.track.set_name(this.track.config.values.name)}});this.prefs=this.config.values;this.drag_handle_class=ah.drag_handle_class;this.is_overview=false;this.action_icons={};this.content_visible=true;this.container_div=this.build_container_div();this.header_div=this.build_header_div();if(this.header_div){this.container_div.append(this.header_div);this.icons_div=$("<div/>").css("float","left").hide().appendTo(this.header_div);this.build_action_icons(this.action_icons_def);this.header_div.append($("<div style='clear: both'/>"));this.header_div.dblclick(function(ai){ai.stopPropagation()});var ag=this;this.container_div.hover(function(){ag.icons_div.show()},function(){ag.icons_div.hide()});$("<div style='clear: both'/>").appendTo(this.container_div)}};r.prototype.action_icons_def=[{name:"toggle_icon",title:"Hide/show content",css_class:"toggle",on_click_fn:function(ae){if(ae.content_visible){ae.action_icons.toggle_icon.addClass("toggle-expand").removeClass("toggle");ae.hide_contents();ae.content_visible=false}else{ae.action_icons.toggle_icon.addClass("toggle").removeClass("toggle-expand");ae.content_visible=true;ae.show_contents()}}},{name:"settings_icon",title:"Edit settings",css_class:"settings-icon",on_click_fn:function(af){var ah=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},ae=function(){af.config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},ag=function(ai){if((ai.keyCode||ai.which)===27){ah()}else{if((ai.keyCode||ai.which)===13){ae()}}};$(window).bind("keypress.check_enter_esc",ag);show_modal("Configure",af.config.build_form(),{Cancel:ah,OK:ae})}},{name:"remove_icon",title:"Remove",css_class:"remove-icon",on_click_fn:function(ae){$(".bs-tooltip").remove();ae.remove()}}];q(r.prototype,{init:function(){},changed:function(){this.view.changed()},can_draw:function(){if(this.enabled&&this.content_visible){return true}return false},request_draw:function(){},_draw:function(){},to_dict:function(){},set_name:function(ae){this.old_name=this.name;this.name=ae;this.name_div.text(this.name)},revert_name:function(){if(this.old_name){this.name=this.old_name;this.name_div.text(this.name)}},remove:function(){this.changed();this.container.remove_drawable(this);var ae=this.view;this.container_div.hide(0,function(){$(this).remove();ae.update_intro_div()})},build_container_div:function(){},build_header_div:function(){},add_action_icon:function(af,ak,aj,ai,ae,ah){var ag=this;this.action_icons[af]=$("<a/>").attr("href","javascript:void(0);").attr("title",ak).addClass("icon-button").addClass(aj).tooltip().click(function(){ai(ag)}).appendTo(this.icons_div);if(ah){this.action_icons[af].hide()}},build_action_icons:function(ae){var ag;for(var af=0;af<ae.length;af++){ag=ae[af];this.add_action_icon(ag.name,ag.title,ag.css_class,ag.on_click_fn,ag.prepend,ag.hide)}},update_icons:function(){},hide_contents:function(){},show_contents:function(){},get_drawables:function(){}});var z=function(af,ae,ag){r.call(this,af,ae,ag);this.obj_type=ag.obj_type;this.drawables=[]};q(z.prototype,r.prototype,{unpack_drawables:function(ag){this.drawables=[];var af;for(var ae=0;ae<ag.length;ae++){af=p(ag[ae],this.view,this);this.add_drawable(af)}},init:function(){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].init()}},_draw:function(){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae]._draw()}},to_dict:function(){var af=[];for(var ae=0;ae<this.drawables.length;ae++){af.push(this.drawables[ae].to_dict())}return{name:this.name,prefs:this.prefs,obj_type:this.obj_type,drawables:af}},add_drawable:function(ae){this.drawables.push(ae);ae.container=this;this.changed()},add_drawable_before:function(ag,ae){this.changed();var af=this.drawables.indexOf(ae);if(af!==-1){this.drawables.splice(af,0,ag);return true}return false},replace_drawable:function(ag,ae,af){var ah=this.drawables.indexOf(ag);if(ah!==-1){this.drawables[ah]=ae;if(af){ag.container_div.replaceWith(ae.container_div)}this.changed()}return ah},remove_drawable:function(af){var ae=this.drawables.indexOf(af);if(ae!==-1){this.drawables.splice(ae,1);af.container=null;this.changed();return true}return false},move_drawable:function(af,ag){var ae=this.drawables.indexOf(af);if(ae!==-1){this.drawables.splice(ae,1);this.drawables.splice(ag,0,af);this.changed();return true}return false},get_drawables:function(){return this.drawables}});var P=function(af,ae,ah){q(ah,{obj_type:"DrawableGroup",drag_handle_class:"group-handle"});z.call(this,af,ae,ah);this.content_div=$("<div/>").addClass("content-div").attr("id","group_"+this.id+"_content_div").appendTo(this.container_div);k(this.container_div,this);k(this.content_div,this);m(this.container_div,this.drag_handle_class,".group",this);this.filters_manager=new i.FiltersManager(this);this.header_div.after(this.filters_manager.parent_div);this.saved_filters_managers=[];if("drawables" in ah){this.unpack_drawables(ah.drawables)}if("filters" in ah){var ag=this.filters_manager;this.filters_manager=new i.FiltersManager(this,ah.filters);ag.parent_div.replaceWith(this.filters_manager.parent_div);if(ah.filters.visible){this.setup_multitrack_filtering()}}};q(P.prototype,r.prototype,z.prototype,{action_icons_def:[r.prototype.action_icons_def[0],r.prototype.action_icons_def[1],{name:"composite_icon",title:"Show composite track",css_class:"layers-stack",on_click_fn:function(ae){$(".bs-tooltip").remove();ae.show_composite_track()}},{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ae){if(ae.filters_manager.visible()){ae.filters_manager.clear_filters();ae._restore_filter_managers()}else{ae.setup_multitrack_filtering();ae.request_draw(true)}ae.filters_manager.toggle()}},r.prototype.action_icons_def[2]],build_container_div:function(){var ae=$("<div/>").addClass("group").attr("id","group_"+this.id);if(this.container){this.container.content_div.append(ae)}return ae},build_header_div:function(){var ae=$("<div/>").addClass("track-header");ae.append($("<div/>").addClass(this.drag_handle_class));this.name_div=$("<div/>").addClass("track-name").text(this.name).appendTo(ae);return ae},hide_contents:function(){this.tiles_div.hide()},show_contents:function(){this.tiles_div.show();this.request_draw()},update_icons:function(){var ag=this.drawables.length;if(ag===0){this.action_icons.composite_icon.hide();this.action_icons.filters_icon.hide()}else{if(ag===1){if(this.drawables[0] instanceof f){this.action_icons.composite_icon.show()}this.action_icons.filters_icon.hide()}else{var an,am,ak,aq=true,ai=this.drawables[0].get_type(),ae=0;for(an=0;an<ag;an++){ak=this.drawables[an];if(ak.get_type()!==ai){can_composite=false;break}if(ak instanceof c){ae++}}if(aq||ae===1){this.action_icons.composite_icon.show()}else{this.action_icons.composite_icon.hide();$(".bs-tooltip").remove()}if(ae>1&&ae===this.drawables.length){var ar={},af;ak=this.drawables[0];for(am=0;am<ak.filters_manager.filters.length;am++){af=ak.filters_manager.filters[am];ar[af.name]=[af]}for(an=1;an<this.drawables.length;an++){ak=this.drawables[an];for(am=0;am<ak.filters_manager.filters.length;am++){af=ak.filters_manager.filters[am];if(af.name in ar){ar[af.name].push(af)}}}this.filters_manager.remove_all();var ah,aj,al,ao;for(var ap in ar){ah=ar[ap];if(ah.length===ae){aj=new i.NumberFilter({name:ah[0].name,index:ah[0].index});this.filters_manager.add_filter(aj)}}if(this.filters_manager.filters.length>0){this.action_icons.filters_icon.show()}else{this.action_icons.filters_icon.hide()}}else{this.action_icons.filters_icon.hide()}}}},_restore_filter_managers:function(){for(var ae=0;ae<this.drawables.length;ae++){this.drawables[ae].filters_manager=this.saved_filters_managers[ae]}this.saved_filters_managers=[]},setup_multitrack_filtering:function(){if(this.filters_manager.filters.length>0){this.saved_filters_managers=[];for(var ae=0;ae<this.drawables.length;ae++){drawable=this.drawables[ae];this.saved_filters_managers.push(drawable.filters_manager);drawable.filters_manager=this.filters_manager}}this.filters_manager.init_filters()},show_composite_track:function(){var ai=[];for(var af=0;af<this.drawables.length;af++){ai.push(this.drawables[af].name)}var ag="Composite Track of "+this.drawables.length+" tracks ("+ai.join(", ")+")";var ah=new f(this.view,this.view,{name:ag,drawables:this.drawables});var ae=this.container.replace_drawable(this,ah,true);ah.request_draw()},add_drawable:function(ae){z.prototype.add_drawable.call(this,ae);this.update_icons()},remove_drawable:function(ae){z.prototype.remove_drawable.call(this,ae);this.update_icons()},to_dict:function(){if(this.filters_manager.visible()){this._restore_filter_managers()}var ae=q(z.prototype.to_dict.call(this),{filters:this.filters_manager.to_dict()});if(this.filters_manager.visible()){this.setup_multitrack_filtering()}return ae},request_draw:function(ae,ag){for(var af=0;af<this.drawables.length;af++){this.drawables[af].request_draw(ae,ag)}}});var Z=function(ae){q(ae,{obj_type:"View"});z.call(this,"View",ae.container,ae);this.chrom=null;this.vis_id=ae.vis_id;this.dbkey=ae.dbkey;this.label_tracks=[];this.tracks_to_be_redrawn=[];this.max_low=0;this.max_high=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.load_chroms_deferred=null;this.init();this.canvas_manager=new x.CanvasManager(this.container.get(0).ownerDocument);this.reset()};ac.extend(Z.prototype,Backbone.Events);q(Z.prototype,z.prototype,{init:function(){this.requested_redraw=false;var ag=this.container,ae=this;this.top_container=$("<div/>").addClass("top-container").appendTo(ag);this.browser_content_div=$("<div/>").addClass("content").css("position","relative").appendTo(ag);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(ag);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").attr("id","viewport-container").appendTo(this.browser_content_div);this.content_div=this.viewport_container;k(this.viewport_container,ae);this.intro_div=$("<div/>").addClass("intro").appendTo(this.viewport_container).hide();var ah=$("<div/>").text("Add Datasets to Visualization").addClass("action-button").appendTo(this.intro_div).click(function(){ad(add_datasets_url,add_track_async_url,function(ai){ac.each(ai,function(aj){ae.add_drawable(p(aj,ae,ae))})})});this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("trackster-nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("trackster-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/>").attr("href","javascript:void(0);").attr("title","Close overview").addClass("icon-button overview-close tooltip").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_select=$("<select/>").attr({name:"chrom"}).css("width","15em").append("<option value=''>Loading</option>").appendTo(this.nav_controls);var af=function(ai){if(ai.type==="focusout"||(ai.keyCode||ai.which)===13||(ai.keyCode||ai.which)===27){if((ai.keyCode||ai.which)!==27){ae.go_to($(this).val())}$(this).hide();$(this).val("");ae.location_span.show();ae.chrom_select.show()}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keyup focusout",af).appendTo(this.nav_controls);this.location_span=$("<span/>").addClass("location").attr("original-title","Click to change location").tooltip({placement:"bottom"}).appendTo(this.nav_controls);this.location_span.click(function(){ae.location_span.hide();ae.chrom_select.hide();ae.nav_input.val(ae.chrom+":"+ae.low+"-"+ae.high);ae.nav_input.css("display","inline-block");ae.nav_input.select();ae.nav_input.focus();ae.nav_input.autocomplete({source:function(ak,ai){var al=[],aj=$.map(ae.get_drawables(),function(am){return am.data_manager.search_features(ak.term).success(function(an){al=al.concat(an)})});$.when.apply($,aj).done(function(){ai($.map(al,function(am){return{label:am[0],value:am[1]}}))})}})});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.nav_controls)}this.zo_link=$("<a/>").attr("id","zoom-out").attr("title","Zoom out").tooltip({placement:"bottom"}).click(function(){ae.zoom_out();ae.request_redraw()}).appendTo(this.nav_controls);this.zi_link=$("<a/>").attr("id","zoom-in").attr("title","Zoom in").tooltip({placement:"bottom"}).click(function(){ae.zoom_in();ae.request_redraw()}).appendTo(this.nav_controls);this.load_chroms_deferred=this.load_chroms({low:0});this.chrom_select.bind("change",function(){ae.change_chrom(ae.chrom_select.val())});this.browser_content_div.click(function(ai){$(this).find("input").trigger("blur")});this.browser_content_div.bind("dblclick",function(ai){ae.zoom_in(ai.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(ai,aj){this.current_x=aj.offsetX}).bind("drag",function(ai,ak){var al=ak.offsetX-this.current_x;this.current_x=ak.offsetX;var aj=Math.round(al/ae.viewport_container.width()*(ae.max_high-ae.max_low));ae.move_delta(-aj)});this.overview_close.click(function(){ae.reset_overview()});this.viewport_container.bind("draginit",function(ai,aj){if(ai.clientX>ae.viewport_container.width()-16){return false}}).bind("dragstart",function(ai,aj){aj.original_low=ae.low;aj.current_height=ai.clientY;aj.current_x=aj.offsetX}).bind("drag",function(ak,am){var ai=$(this);var an=am.offsetX-am.current_x;var aj=ai.scrollTop()-(ak.clientY-am.current_height);ai.scrollTop(aj);am.current_height=ak.clientY;am.current_x=am.offsetX;var al=Math.round(an/ae.viewport_container.width()*(ae.high-ae.low));ae.move_delta(al)}).bind("mousewheel",function(ak,am,aj,ai){if(aj){aj*=50;var al=Math.round(-aj/ae.viewport_container.width()*(ae.high-ae.low));ae.move_delta(al)}});this.top_labeltrack.bind("dragstart",function(ai,aj){return $("<div />").css({height:ae.browser_content_div.height()+ae.top_labeltrack.height()+ae.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(am,an){$(an.proxy).css({left:Math.min(am.pageX,an.startX)-ae.container.offset().left,width:Math.abs(am.pageX-an.startX)});var aj=Math.min(am.pageX,an.startX)-ae.container.offset().left,ai=Math.max(am.pageX,an.startX)-ae.container.offset().left,al=(ae.high-ae.low),ak=ae.viewport_container.width();ae.update_location(Math.round(aj/ak*al)+ae.low,Math.round(ai/ak*al)+ae.low)}).bind("dragend",function(an,ao){var aj=Math.min(an.pageX,ao.startX),ai=Math.max(an.pageX,ao.startX),al=(ae.high-ae.low),ak=ae.viewport_container.width(),am=ae.low;ae.low=Math.round(aj/ak*al)+am;ae.high=Math.round(ai/ak*al)+am;$(ao.proxy).remove();ae.request_redraw()});this.add_label_track(new Y(this,{content_div:this.top_labeltrack}));this.add_label_track(new Y(this,{content_div:this.nav_labeltrack}));$(window).bind("resize",function(){if(this.resize_timer){clearTimeout(this.resize_timer)}this.resize_timer=setTimeout(function(){ae.resize_window()},500)});$(document).bind("redraw",function(){ae.redraw()});this.reset();$(window).trigger("resize")},changed:function(){this.has_changes=true},update_intro_div:function(){if(this.drawables.length===0){this.intro_div.show()}else{this.intro_div.hide()}},trigger_navigate:function(af,ah,ae,ai){if(this.timer){clearTimeout(this.timer)}if(ai){var ag=this;this.timer=setTimeout(function(){ag.trigger("navigate",af+":"+ah+"-"+ae)},500)}else{view.trigger("navigate",af+":"+ah+"-"+ae)}},update_location:function(ae,ag){this.location_span.text(commatize(ae)+" - "+commatize(ag));this.nav_input.val(this.chrom+":"+commatize(ae)+"-"+commatize(ag));var af=view.chrom_select.val();if(af!==""){this.trigger_navigate(af,view.low,view.high,true)}},load_chroms:function(ag){ag.num=w;var ae=this,af=$.Deferred();$.ajax({url:chrom_url+"/"+this.dbkey,data:ag,dataType:"json",success:function(ai){if(ai.chrom_info.length===0){return}if(ai.reference){ae.add_label_track(new B(ae))}ae.chrom_data=ai.chrom_info;var al='<option value="">Select Chrom/Contig</option>';for(var ak=0,ah=ae.chrom_data.length;ak<ah;ak++){var aj=ae.chrom_data[ak].chrom;al+='<option value="'+aj+'">'+aj+"</option>"}if(ai.prev_chroms){al+='<option value="previous">Previous '+w+"</option>"}if(ai.next_chroms){al+='<option value="next">Next '+w+"</option>"}ae.chrom_select.html(al);ae.chrom_start_index=ai.start_index;af.resolve(ai)},error:function(){alert("Could not load chroms for this dbkey:",ae.dbkey)}});return af},change_chrom:function(aj,af,al){var ag=this;if(!ag.chrom_data){ag.load_chroms_deferred.then(function(){ag.change_chrom(aj,af,al)});return}if(!aj||aj==="None"){return}if(aj==="previous"){ag.load_chroms({low:this.chrom_start_index-w});return}if(aj==="next"){ag.load_chroms({low:this.chrom_start_index+w});return}var ak=$.grep(ag.chrom_data,function(am,an){return am.chrom===aj})[0];if(ak===undefined){ag.load_chroms({chrom:aj},function(){ag.change_chrom(aj,af,al)});return}else{if(aj!==ag.chrom){ag.chrom=aj;ag.chrom_select.val(ag.chrom);ag.max_high=ak.len-1;ag.reset();ag.request_redraw(true);for(var ai=0,ae=ag.drawables.length;ai<ae;ai++){var ah=ag.drawables[ai];if(ah.init){ah.init()}}if(ag.reference_track){ag.reference_track.init()}}if(af!==undefined&&al!==undefined){ag.low=Math.max(af,0);ag.high=Math.min(al,ag.max_high)}else{ag.low=0;ag.high=ag.max_high}ag.reset_overview();ag.request_redraw()}},go_to:function(ai){ai=ai.replace(/ |,/g,"");var am=this,ae,ah,af=ai.split(":"),ak=af[0],al=af[1];if(al!==undefined){try{var aj=al.split("-");ae=parseInt(aj[0],10);ah=parseInt(aj[1],10)}catch(ag){return false}}am.change_chrom(ak,ae,ah)},move_fraction:function(ag){var ae=this;var af=ae.high-ae.low;this.move_delta(ag*af)},move_delta:function(ah){var ae=this;var ag=ae.high-ae.low;if(ae.low-ah<ae.max_low){ae.low=ae.max_low;ae.high=ae.max_low+ag}else{if(ae.high-ah>ae.max_high){ae.high=ae.max_high;ae.low=ae.max_high-ag}else{ae.high-=ah;ae.low-=ah}}ae.request_redraw();var af=ae.chrom_select.val();this.trigger_navigate(af,ae.low,ae.high,true)},add_drawable:function(ae){z.prototype.add_drawable.call(this,ae);ae.init();this.changed();this.update_intro_div()},add_label_track:function(ae){ae.view=this;ae.init();this.label_tracks.push(ae)},remove_drawable:function(ag,af){z.prototype.remove_drawable.call(this,ag);if(af){var ae=this;ag.container_div.hide(0,function(){$(this).remove();ae.update_intro_div()})}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},request_redraw:function(am,ae,al,an){var ak=this,aj=(an?[an]:ak.drawables),ag;var af;for(var ai=0;ai<aj.length;ai++){af=aj[ai];ag=-1;for(var ah=0;ah<ak.tracks_to_be_redrawn.length;ah++){if(ak.tracks_to_be_redrawn[ah][0]===af){ag=ah;break}}if(ag<0){ak.tracks_to_be_redrawn.push([af,ae,al])}else{ak.tracks_to_be_redrawn[ai][1]=ae;ak.tracks_to_be_redrawn[ai][2]=al}}if(!this.requested_redraw){requestAnimationFrame(function(){ak._redraw(am)});this.requested_redraw=true}},_redraw:function(ao){this.requested_redraw=false;var al=this.low,ah=this.high;if(al<this.max_low){al=this.max_low}if(ah>this.max_high){ah=this.max_high}var an=this.high-this.low;if(this.high!==0&&an<this.min_separation){ah=al+this.min_separation}this.low=Math.floor(al);this.high=Math.ceil(ah);this.update_location(this.low,this.high);this.resolution_b_px=(this.high-this.low)/this.viewport_container.width();this.resolution_px_b=this.viewport_container.width()/(this.high-this.low);var ae=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ak=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var ap=13;this.overview_box.css({left:ae,width:Math.max(ap,ak)}).show();if(ak<ap){this.overview_box.css("left",ae-(ap-ak)/2)}if(this.overview_highlight){this.overview_highlight.css({left:ae,width:ak})}if(!ao){var ag,af,am;for(var ai=0,aj=this.tracks_to_be_redrawn.length;ai<aj;ai++){ag=this.tracks_to_be_redrawn[ai][0];af=this.tracks_to_be_redrawn[ai][1];am=this.tracks_to_be_redrawn[ai][2];if(ag){ag._draw(af,am)}}this.tracks_to_be_redrawn=[];for(ai=0,aj=this.label_tracks.length;ai<aj;ai++){this.label_tracks[ai]._draw()}}},zoom_in:function(af,ag){if(this.max_high===0||this.high-this.low<=this.min_separation){return}var ah=this.high-this.low,ai=ah/2+this.low,ae=(ah/this.zoom_factor)/2;if(af){ai=af/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(ai-ae);this.high=Math.round(ai+ae);this.changed();this.request_redraw()},zoom_out:function(){if(this.max_high===0){return}var af=this.high-this.low,ag=af/2+this.low,ae=(af*this.zoom_factor)/2;this.low=Math.round(ag-ae);this.high=Math.round(ag+ae);this.changed();this.request_redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.request_redraw()},set_overview:function(ag){if(this.overview_drawable){if(this.overview_drawable.dataset_id===ag.dataset_id){return}this.overview_viewport.find(".track").remove()}var af=ag.copy({content_div:this.overview_viewport}),ae=this;af.header_div.hide();af.is_overview=true;ae.overview_drawable=af;this.overview_drawable.postdraw_actions=function(){ae.overview_highlight.show().height(ae.overview_drawable.content_div.height());ae.overview_viewport.height(ae.overview_drawable.content_div.height()+ae.overview_box.outerHeight());ae.overview_close.show();ae.resize_window()};ae.overview_drawable.request_draw();this.changed()},reset_overview:function(){$(".bs-tooltip").remove();this.overview_viewport.find(".track-tile").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();view.resize_window();view.overview_drawable=null}});var s=function(ag,al,ah){this.track=ag;this.name=al.name;this.params=[];var at=al.params;for(var ai=0;ai<at.length;ai++){var an=at[ai],af=an.name,ar=an.label,aj=unescape(an.html),au=an.value,ap=an.type;if(ap==="number"){this.params.push(new e(af,ar,aj,(af in ah?ah[af]:au),an.min,an.max))}else{if(ap==="select"){this.params.push(new N(af,ar,aj,(af in ah?ah[af]:au)))}else{console.log("WARNING: unrecognized tool parameter type:",af,ap)}}}this.parent_div=$("<div/>").addClass("dynamic-tool").hide();this.parent_div.bind("drag",function(aw){aw.stopPropagation()}).click(function(aw){aw.stopPropagation()}).bind("dblclick",function(aw){aw.stopPropagation()});var aq=$("<div class='tool-name'>").appendTo(this.parent_div).text(this.name);var ao=this.params;var am=this;$.each(this.params,function(ax,aA){var az=$("<div>").addClass("param-row").appendTo(am.parent_div);var aw=$("<div>").addClass("param-label").text(aA.label).appendTo(az);var ay=$("<div/>").addClass("param-input").html(aA.html).appendTo(az);ay.find(":input").val(aA.value);$("<div style='clear: both;'/>").appendTo(az)});this.parent_div.find("input").click(function(){$(this).select()});var av=$("<div>").addClass("param-row").appendTo(this.parent_div);var ak=$("<input type='submit'>").attr("value","Run on complete dataset").appendTo(av);var ae=$("<input type='submit'>").attr("value","Run on visible region").css("margin-left","3em").appendTo(av);ae.click(function(){am.run_on_region()});ak.click(function(){am.run_on_dataset()});if("visible" in ah&&ah.visible){this.parent_div.show()}};q(s.prototype,{update_params:function(){for(var ae=0;ae<this.params.length;ae++){this.params[ae].update_value()}},state_dict:function(){var af={};for(var ae=0;ae<this.params.length;ae++){af[this.params[ae].name]=this.params[ae].value}af.visible=this.parent_div.is(":visible");return af},get_param_values_dict:function(){var ae={};this.parent_div.find(":input").each(function(){var af=$(this).attr("name"),ag=$(this).val();ae[af]=ag});return ae},get_param_values:function(){var ae=[];this.parent_div.find(":input").each(function(){var af=$(this).attr("name"),ag=$(this).val();if(af){ae[ae.length]=ag}});return ae},run_on_dataset:function(){var ae=this;ae.run({target_dataset_id:this.track.original_dataset_id,tool_id:ae.name},null,function(af){show_modal(ae.name+" is Running",ae.name+" is running on the complete dataset. Tool outputs are in dataset's history.",{Close:hide_modal})})},run_on_region:function(){var af={target_dataset_id:this.track.original_dataset_id,action:"rerun",tool_id:this.name,regions:[{chrom:this.track.view.chrom,start:this.track.view.low,end:this.track.view.high}]},aj=this.track,ag=af.tool_id+aj.tool_region_and_parameters_str(af.chrom,af.low,af.high),ae;if(aj.container===view){var ai=new P(view,view,{name:this.name});var ah=aj.container.replace_drawable(aj,ai,false);ai.container_div.insertBefore(aj.view.content_div.children()[ah]);ai.add_drawable(aj);aj.container_div.appendTo(ai.content_div);ae=ai}else{ae=aj.container}var ak=new aj.constructor(view,ae,{name:ag,hda_ldda:"hda"});ak.init_for_tool_data();ak.change_mode(aj.mode);ak.set_filters_manager(aj.filters_manager.copy(ak));ak.update_icons();ae.add_drawable(ak);ak.tiles_div.text("Starting job.");this.update_params();this.run(af,ak,function(al){ak.set_dataset(new aa.Dataset(al));ak.tiles_div.text("Running job.");ak.init()})},run:function(ae,ag,ah){ae.inputs=this.get_param_values_dict();var af=new l.ServerStateDeferred({ajax_settings:{url:galaxy_paths.get("tool_url"),data:JSON.stringify(ae),dataType:"json",contentType:"application/json",type:"POST"},interval:2000,success_fn:function(ai){return ai!=="pending"}});$.when(af.go()).then(function(ai){if(ai==="no converter"){ag.container_div.addClass("error");ag.content_div.text(J)}else{if(ai.error){ag.container_div.addClass("error");ag.content_div.text(y+ai.message)}else{ah(ai)}}})}});var N=function(af,ae,ag,ah){this.name=af;this.label=ae;this.html=$(ag);this.value=ah};q(N.prototype,{update_value:function(){this.value=$(this.html).val()}});var e=function(ag,af,ai,aj,ah,ae){N.call(this,ag,af,ai,aj);this.min=ah;this.max=ae};q(e.prototype,N.prototype,{update_value:function(){N.prototype.update_value.call(this);this.value=parseFloat(this.value)}});var C=function(ae,af){L.Scaler.call(this,af);this.filter=ae};C.prototype.gen_val=function(ae){if(this.filter.high===Number.MAX_VALUE||this.filter.low===-Number.MAX_VALUE||this.filter.low===this.filter.high){return this.default_val}return((parseFloat(ae[this.filter.index])-this.filter.low)/(this.filter.high-this.filter.low))};var F=function(ae){this.track=ae.track;this.params=ae.params;this.values={};this.restore_values((ae.saved_values?ae.saved_values:{}));this.onchange=ae.onchange};q(F.prototype,{restore_values:function(ae){var af=this;$.each(this.params,function(ag,ah){if(ae[ah.key]!==undefined){af.values[ah.key]=ae[ah.key]}else{af.values[ah.key]=ah.default_value}})},build_form:function(){var ah=this;var ae=$("<div />");var ag;function af(am,ai){for(var aq=0;aq<am.length;aq++){ag=am[aq];if(ag.hidden){continue}var ak="param_"+aq;var av=ah.values[ag.key];var ax=$("<div class='form-row' />").appendTo(ai);ax.append($("<label />").attr("for",ak).text(ag.label+":"));if(ag.type==="bool"){ax.append($('<input type="checkbox" />').attr("id",ak).attr("name",ak).attr("checked",av))}else{if(ag.type==="text"){ax.append($('<input type="text"/>').attr("id",ak).val(av).click(function(){$(this).select()}))}else{if(ag.type==="select"){var at=$("<select />").attr("id",ak);for(var ao=0;ao<ag.options.length;ao++){$("<option/>").text(ag.options[ao].label).attr("value",ag.options[ao].value).appendTo(at)}at.val(av);ax.append(at)}else{if(ag.type==="color"){var aw=$("<div/>").appendTo(ax),ar=$("<input />").attr("id",ak).attr("name",ak).val(av).css("float","left").appendTo(aw).click(function(az){$(".bs-tooltip").removeClass("in");var ay=$(this).siblings(".bs-tooltip").addClass("in");ay.css({left:$(this).position().left+$(this).width()+5,top:$(this).position().top-($(ay).height()/2)+($(this).height()/2)}).show();ay.click(function(aA){aA.stopPropagation()});$(document).bind("click.color-picker",function(){ay.hide();$(document).unbind("click.color-picker")});az.stopPropagation()}),ap=$("<a href='javascript:void(0)'/>").addClass("icon-button arrow-circle").appendTo(aw).attr("title","Set new random color").tooltip(),au=$("<div class='bs-tooltip right' style='position: absolute;' />").appendTo(aw).hide(),al=$("<div class='tooltip-inner' style='text-align: inherit'></div>").appendTo(au),aj=$("<div class='tooltip-arrow'></div>").appendTo(au),an=$.farbtastic(al,{width:100,height:100,callback:ar,color:av});aw.append($("<div/>").css("clear","both"));(function(ay){ap.click(function(){ay.setColor(Q())})})(an)}else{ax.append($("<input />").attr("id",ak).attr("name",ak).val(av))}}}}if(ag.help){ax.append($("<div class='help'/>").text(ag.help))}}}af(this.params,ae);return ae},update_from_form:function(ae){var ag=this;var af=false;$.each(this.params,function(ah,aj){if(!aj.hidden){var ak="param_"+ah;var ai=ae.find("#"+ak).val();if(aj.type==="float"){ai=parseFloat(ai)}else{if(aj.type==="int"){ai=parseInt(ai)}else{if(aj.type==="bool"){ai=ae.find("#"+ak).is(":checked")}}}if(ai!==ag.values[aj.key]){ag.values[aj.key]=ai;af=true}}});if(af){this.onchange();this.track.changed()}}});var b=function(ae,ai,ag,af,ah){this.track=ae;this.region=ai;this.low=ai.get("start");this.high=ai.get("end");this.resolution=ag;this.html_elt=$("<div class='track-tile'/>").append(af).height($(af).attr("height"));this.data=ah;this.stale=false};b.prototype.predisplay_actions=function(){};var j=function(ae,aj,ag,af,ah,ai){b.call(this,ae,aj,ag,af,ah);this.max_val=ai};q(j.prototype,b.prototype);var O=function(ah,ap,ai,ag,ak,ar,al,at,af,ao){b.call(this,ah,ap,ai,ag,ak);this.mode=al;this.all_slotted=af;this.feature_mapper=ao;this.has_icons=false;if(at){this.has_icons=true;var am=this;ag=this.html_elt.children()[0],message_div=$("<div/>").addClass("tile-message").css({height:D-1,width:ag.width}).prependTo(this.html_elt);var an=new x.GenomeRegion({chrom:ah.view.chrom,start:this.low,end:this.high}),aq=ak.length,aj=$("<a href='javascript:void(0);'/>").addClass("icon more-down").attr("title","For speed, only the first "+aq+" features in this region were obtained from server. Click to get more data including depth").tooltip().appendTo(message_div),ae=$("<a href='javascript:void(0);'/>").addClass("icon more-across").attr("title","For speed, only the first "+aq+" features in this region were obtained from server. Click to get more data excluding depth").tooltip().appendTo(message_div);aj.click(function(){am.stale=true;ah.data_manager.get_more_data(an,ah.mode,am.resolution,{},ah.data_manager.DEEP_DATA_REQ);$(".bs-tooltip").hide();ah.request_draw(true)}).dblclick(function(au){au.stopPropagation()});ae.click(function(){am.stale=true;ah.data_manager.get_more_data(an,ah.mode,am.resolution,{},ah.data_manager.BROAD_DATA_REQ);$(".bs-tooltip").hide();ah.request_draw(true)}).dblclick(function(au){au.stopPropagation()})}};q(O.prototype,b.prototype);O.prototype.predisplay_actions=function(){var af=this,ae={};if(af.mode!=="Pack"){return}$(this.html_elt).hover(function(){this.hovered=true;$(this).mousemove()},function(){this.hovered=false;$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()}).mousemove(function(aq){if(!this.hovered){return}var al=$(this).offset(),ap=aq.pageX-al.left,ao=aq.pageY-al.top,av=af.feature_mapper.get_feature_data(ap,ao),am=(av?av[0]:null);$(this).parents(".track-content").children(".overlay").children(".feature-popup").each(function(){if(!am||$(this).attr("id")!==am.toString()){$(this).remove()}});if(av){var ah=ae[am];if(!ah){var am=av[0],ar={name:av[3],start:av[1],end:av[2],strand:av[4]},ak=af.track.filters_manager.filters,aj;for(var an=0;an<ak.length;an++){aj=ak[an];ar[aj.name]=av[aj.index]}var ah=$("<div/>").attr("id",am).addClass("feature-popup"),aw=$("<table/>"),au,at,ax;for(au in ar){at=ar[au];ax=$("<tr/>").appendTo(aw);$("<th/>").appendTo(ax).text(au);$("<td/>").attr("align","left").appendTo(ax).text(typeof(at)==="number"?X(at,2):at)}ah.append($("<div class='feature-popup-inner'>").append(aw));ae[am]=ah}ah.appendTo($(this).parents(".track-content").children(".overlay"));var ai=ap+parseInt(af.html_elt.css("left"))-ah.width()/2,ag=ao+parseInt(af.html_elt.css("top"))+7;ah.css("left",ai+"px").css("top",ag+"px")}else{if(!aq.isPropagationStopped()){aq.stopPropagation();$(this).siblings().each(function(){$(this).trigger(aq)})}}}).mouseleave(function(){$(this).parents(".track-content").children(".overlay").children(".feature-popup").remove()})};var g=function(af,ae,ag){q(ag,{drag_handle_class:"draghandle"});r.call(this,af,ae,ag);this.dataset=new aa.Dataset({id:ag.dataset_id,hda_ldda:ag.hda_ldda});this.dataset_check_type="converted_datasets_state";this.data_url_extra_params={};this.data_query_wait=("data_query_wait" in ag?ag.data_query_wait:K);this.data_manager=("data_manager" in ag?ag.data_manager:new x.GenomeDataManager({dataset:this.dataset,data_mode_compatible:this.data_and_mode_compatible,can_subset:this.can_subset}));this.min_height_px=16;this.max_height_px=800;this.visible_height_px=0;this.content_div=$("<div class='track-content'>").appendTo(this.container_div);if(this.container){this.container.content_div.append(this.container_div);if(!("resize" in ag)||ag.resize){this.add_resize_handle()}}};q(g.prototype,r.prototype,{action_icons_def:[{name:"mode_icon",title:"Set display mode",css_class:"chevron-expand",on_click_fn:function(){}},r.prototype.action_icons_def[0],{name:"overview_icon",title:"Set as overview",css_class:"overview-icon",on_click_fn:function(ae){ae.view.set_overview(ae)}},r.prototype.action_icons_def[1],{name:"filters_icon",title:"Filters",css_class:"filters-icon",on_click_fn:function(ae){if(ae.filters_manager.visible()){ae.filters_manager.clear_filters()}else{ae.filters_manager.init_filters()}ae.filters_manager.toggle()}},{name:"tools_icon",title:"Tool",css_class:"hammer",on_click_fn:function(ae){ae.dynamic_tool_div.toggle();if(ae.dynamic_tool_div.is(":visible")){ae.set_name(ae.name+ae.tool_region_and_parameters_str())}else{ae.revert_name()}$(".bs-tooltip").remove()}},{name:"param_space_viz_icon",title:"Tool parameter space visualization",css_class:"arrow-split",on_click_fn:function(ae){var ah='<strong>Tool</strong>: <%= track.tool.name %><br/><strong>Dataset</strong>: <%= track.name %><br/><strong>Region(s)</strong>: <select name="regions"><option value="cur">current viewing area</option><option value="bookmarks">bookmarks</option><option value="both">current viewing area and bookmarks</option></select>',ag=ac.template(ah,{track:ae});var aj=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},af=function(){var al=$('select[name="regions"] option:selected').val(),an,ak=new x.GenomeRegion({chrom:view.chrom,start:view.low,end:view.high}),am=ac.map($(".bookmark"),function(ao){return new x.GenomeRegion({from_str:$(ao).children(".position").text()})});if(al==="cur"){an=[ak]}else{if(al==="bookmarks"){an=am}else{an=[ak].concat(am)}}hide_modal();window.location.href=galaxy_paths.get("sweepster_url")+"?"+$.param({dataset_id:ae.dataset_id,hda_ldda:ae.hda_ldda,regions:JSON.stringify(new Backbone.Collection(an).toJSON())})},ai=function(ak){if((ak.keyCode||ak.which)===27){aj()}else{if((ak.keyCode||ak.which)===13){af()}}};show_modal("Visualize tool parameter space and output from different parameter settings?",ag,{No:aj,Yes:af})}},r.prototype.action_icons_def[2]],can_draw:function(){if(this.dataset_id&&r.prototype.can_draw.call(this)){return true}return false},build_container_div:function(){return $("<div/>").addClass("track").attr("id","track_"+this.id).css("position","relative")},build_header_div:function(){var ae=$("<div class='track-header'/>");if(this.view.editor){this.drag_div=$("<div/>").addClass(this.drag_handle_class).appendTo(ae)}this.name_div=$("<div/>").addClass("track-name").appendTo(ae).text(this.name).attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase());return ae},on_resize:function(){},add_resize_handle:function(){var ae=this;var ah=false;var ag=false;var af=$("<div class='track-resize'>");$(ae.container_div).hover(function(){if(ae.content_visible){ah=true;af.show()}},function(){ah=false;if(!ag){af.hide()}});af.hide().bind("dragstart",function(ai,aj){ag=true;aj.original_height=$(ae.content_div).height()}).bind("drag",function(aj,ak){var ai=Math.min(Math.max(ak.original_height+ak.deltaY,ae.min_height_px),ae.max_height_px);$(ae.tiles_div).css("height",ai);ae.visible_height_px=(ae.max_height_px===ai?0:ai);ae.on_resize()}).bind("dragend",function(ai,aj){ae.tile_cache.clear();ag=false;if(!ah){af.hide()}ae.config.values.height=ae.visible_height_px;ae.changed()}).appendTo(ae.container_div)},set_display_modes:function(ah,ak){this.display_modes=ah;this.mode=(ak?ak:(this.config&&this.config.values.mode?this.config.values.mode:this.display_modes[0]));this.action_icons.mode_icon.attr("title","Set display mode (now: "+this.mode+")");var af=this,ai={};for(var ag=0,ae=af.display_modes.length;ag<ae;ag++){var aj=af.display_modes[ag];ai[aj]=function(al){return function(){af.change_mode(al);af.icons_div.show();af.container_div.mouseleave(function(){af.icons_div.hide()})}}(aj)}make_popupmenu(this.action_icons.mode_icon,ai)},build_action_icons:function(){r.prototype.build_action_icons.call(this,this.action_icons_def);if(this.display_modes!==undefined){this.set_display_modes(this.display_modes)}},hide_contents:function(){this.tiles_div.hide();this.container_div.find(".yaxislabel, .track-resize").hide()},show_contents:function(){this.tiles_div.show();this.container_div.find(".yaxislabel, .track-resize").show();this.request_draw()},get_type:function(){if(this instanceof Y){return"LabelTrack"}else{if(this instanceof B){return"ReferenceTrack"}else{if(this instanceof h){return"LineTrack"}else{if(this instanceof U){return"ReadTrack"}else{if(this instanceof S){return"VcfTrack"}else{if(this instanceof f){return"CompositeTrack"}else{if(this instanceof c){return"FeatureTrack"}}}}}}}return""},init:function(){var af=this;af.enabled=false;af.tile_cache.clear();af.data_manager.clear();af.content_div.css("height","auto");af.tiles_div.children().remove();af.container_div.removeClass("nodata error pending");if(!af.dataset_id){return}var ae=$.Deferred(),ag={hda_ldda:af.hda_ldda,data_type:this.dataset_check_type,chrom:af.view.chrom};$.getJSON(this.dataset.url(),ag,function(ah){if(!ah||ah==="error"||ah.kind==="error"){af.container_div.addClass("error");af.tiles_div.text(o);if(ah.message){var ai=$(" <a href='javascript:void(0);'></a>").text("View error").click(function(){show_modal("Trackster Error","<pre>"+ah.message+"</pre>",{Close:hide_modal})});af.tiles_div.append(ai)}}else{if(ah==="no converter"){af.container_div.addClass("error");af.tiles_div.text(J)}else{if(ah==="no data"||(ah.data!==undefined&&(ah.data===null||ah.data.length===0))){af.container_div.addClass("nodata");af.tiles_div.text(E)}else{if(ah==="pending"){af.container_div.addClass("pending");af.tiles_div.html(v);setTimeout(function(){af.init()},af.data_query_wait)}else{if(ah==="data"||ah.status==="data"){if(ah.valid_chroms){af.valid_chroms=ah.valid_chroms;af.update_icons()}af.tiles_div.text(V);if(af.view.chrom){af.tiles_div.text("");af.tiles_div.css("height",af.visible_height_px+"px");af.enabled=true;$.when(af.predraw_init()).done(function(){ae.resolve();af.container_div.removeClass("nodata error pending");af.request_draw()})}else{ae.resolve()}}}}}}});this.update_icons();return ae},predraw_init:function(){},get_drawables:function(){return this}});var M=function(ag,af,ah){g.call(this,ag,af,ah);var ae=this;m(ae.container_div,ae.drag_handle_class,".group",ae);this.filters_manager=new i.FiltersManager(this,("filters" in ah?ah.filters:null));this.data_manager.set("filters_manager",this.filters_manager);this.filters_available=false;this.tool=("tool" in ah&&ah.tool?new s(this,ah.tool,ah.tool_state):null);this.tile_cache=new x.Cache(R);if(this.header_div){this.set_filters_manager(this.filters_manager);if(this.tool){this.dynamic_tool_div=this.tool.parent_div;this.header_div.after(this.dynamic_tool_div)}}this.tiles_div=$("<div/>").addClass("tiles").appendTo(this.content_div);this.overlay_div=$("<div/>").addClass("overlay").appendTo(this.content_div);if(ah.mode){this.change_mode(ah.mode)}};q(M.prototype,r.prototype,g.prototype,{action_icons_def:g.prototype.action_icons_def.concat([{name:"show_more_rows_icon",title:"To minimize track height, not all feature rows are displayed. Click to display more rows.",css_class:"exclamation",on_click_fn:function(ae){$(".bs-tooltip").remove();ae.slotters[ae.view.resolution_px_b].max_rows*=2;ae.request_draw(true)},hide:true}]),copy:function(ae){var af=this.to_dict();q(af,{data_manager:this.data_manager});var ag=new this.constructor(this.view,ae,af);ag.change_mode(this.mode);ag.enabled=this.enabled;return ag},set_filters_manager:function(ae){this.filters_manager=ae;this.header_div.after(this.filters_manager.parent_div)},to_dict:function(){return{track_type:this.get_type(),name:this.name,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,prefs:this.prefs,mode:this.mode,filters:this.filters_manager.to_dict(),tool_state:(this.tool?this.tool.state_dict():{})}},change_mode:function(af){var ae=this;ae.mode=af;ae.config.values.mode=af;ae.tile_cache.clear();ae.request_draw();this.action_icons.mode_icon.attr("title","Set display mode (now: "+ae.mode+")");return ae},update_icons:function(){var ae=this;if(ae.filters_available){ae.action_icons.filters_icon.show()}else{ae.action_icons.filters_icon.hide()}if(ae.tool){ae.action_icons.tools_icon.show();ae.action_icons.param_space_viz_icon.show()}else{ae.action_icons.tools_icon.hide();ae.action_icons.param_space_viz_icon.hide()}},_gen_tile_cache_key:function(af,ag,ae){return af+"_"+ag+"_"+ae},request_draw:function(af,ae){this.view.request_redraw(false,af,ae,this)},before_draw:function(){},_draw:function(af,ap){if(!this.can_draw()){return}var an=this.view.low,aj=this.view.high,al=aj-an,ag=this.view.container.width(),ar=this.view.resolution_px_b,ai=this.view.resolution_b_px;if(this.is_overview){an=this.view.max_low;aj=this.view.max_high;ai=(view.max_high-view.max_low)/ag;ar=1/ai}this.before_draw();this.tiles_div.children().addClass("remove");var ae=Math.floor(an/(ai*T)),am=true,aq=[],ak=function(at){return(at&&"track" in at)};while((ae*T*ai)<aj){var ao=this.draw_helper(af,ag,ae,ai,this.tiles_div,ar);if(ak(ao)){aq.push(ao)}else{am=false}ae+=1}if(!ap){this.tiles_div.children(".remove").removeClass("remove").remove()}var ah=this;if(am){this.tiles_div.children(".remove").remove();ah.postdraw_actions(aq,ag,ar,ap)}},postdraw_actions:function(ag,ah,aj,ae){var ai=false;for(var af=0;af<ag.length;af++){if(ag[af].has_icons){ai=true;break}}if(ai){for(var af=0;af<ag.length;af++){tile=ag[af];if(!tile.has_icons){tile.html_elt.css("padding-top",D)}}}},draw_helper:function(ae,aq,aw,au,aj,ak,ar){var ap=this,az=this._gen_tile_cache_key(aq,ak,aw),ah=this._get_tile_bounds(aw,au);if(!ar){ar={}}var ay=(ae?undefined:ap.tile_cache.get_elt(az));if(ay){ap.show_tile(ay,aj,ak);return ay}var an=true;var av=ap.data_manager.get_data(ah,ap.mode,au,ap.data_url_extra_params);if(W(av)){an=false}var al;if(view.reference_track&&ak>view.canvas_manager.char_width_px){al=view.reference_track.data_manager.get_data(ah,ap.mode,au,view.reference_track.data_url_extra_params);if(W(al)){an=false}}if(an){q(av,ar.more_tile_data);var am=ap.mode;if(am==="Auto"){am=ap.get_mode(av);ap.update_auto_mode(am)}var ag=ap.view.canvas_manager.new_canvas(),ax=ah.get("start"),af=ah.get("end"),aq=Math.ceil((af-ax)*ak)+ap.left_offset,ao=ap.get_canvas_height(av,am,ak,aq);ag.width=aq;ag.height=ao;var at=ag.getContext("2d");at.translate(this.left_offset,0);var ay=ap.draw_tile(av,at,am,au,ah,ak,al);if(ay!==undefined){ap.tile_cache.set_elt(az,ay);ap.show_tile(ay,aj,ak)}return ay}var ai=$.Deferred();$.when(av,al).then(function(){view.request_redraw(false,false,false,ap);ai.resolve()});return ai},get_canvas_height:function(ae,ag,ah,af){return this.visible_height_px},draw_tile:function(ae,af,aj,ah,ai,ak,ag){console.log("Warning: TiledTrack.draw_tile() not implemented.")},show_tile:function(ag,ai,aj){var af=this,ae=ag.html_elt;ag.predisplay_actions();var ah=(ag.low-(this.is_overview?this.view.max_low:this.view.low))*aj;if(this.left_offset){ah-=this.left_offset}ae.css({position:"absolute",top:0,left:ah});if(ae.hasClass("remove")){ae.removeClass("remove")}else{ai.append(ae)}af.after_show_tile(ag)},after_show_tile:function(ae){this.max_height_px=Math.max(this.max_height_px,ae.html_elt.height());ae.html_elt.parent().children().css("height",this.max_height_px+"px");var af=this.max_height_px;if(this.visible_height_px!==0){af=Math.min(this.max_height_px,this.visible_height_px)}this.tiles_div.css("height",af+"px")},_get_tile_bounds:function(ae,af){var ah=Math.floor(ae*T*af),ai=Math.ceil(T*af),ag=(ah+ai<=this.view.max_high?ah+ai:this.view.max_high);return new x.GenomeRegion({chrom:this.view.chrom,start:ah,end:ag})},tool_region_and_parameters_str:function(ag,ae,ah){var af=this,ai=(ag!==undefined&&ae!==undefined&&ah!==undefined?ag+":"+ae+"-"+ah:"all");return" - region=["+ai+"], parameters=["+af.tool.get_param_values().join(", ")+"]"},data_and_mode_compatible:function(ae,af){return true},can_subset:function(ae){return false},init_for_tool_data:function(){this.data_manager.set("data_type","raw_data");this.data_query_wait=1000;this.dataset_check_type="state";this.normal_postdraw_actions=this.postdraw_actions;this.postdraw_actions=function(ag,ah,aj,ae){var af=this;af.normal_postdraw_actions(ag,ah,aj,ae);af.dataset_check_type="converted_datasets_state";af.data_query_wait=K;var ai=new l.ServerStateDeferred({url:af.dataset_state_url,url_params:{dataset_id:af.dataset_id,hda_ldda:af.hda_ldda},interval:af.data_query_wait,success_fn:function(ak){return ak!=="pending"}});$.when(ai.go()).then(function(){af.data_manager.set("data_type","data")});af.postdraw_actions=af.normal_postdraw_actions}}});var Y=function(af,ae){var ag={resize:false};g.call(this,af,ae,ag);this.container_div.addClass("label-track")};q(Y.prototype,g.prototype,{build_header_div:function(){},init:function(){this.enabled=true},_draw:function(){var ag=this.view,ah=ag.high-ag.low,ak=Math.floor(Math.pow(10,Math.floor(Math.log(ah)/Math.log(10)))),ae=Math.floor(ag.low/ak)*ak,ai=this.view.container.width(),af=$("<div style='position: relative; height: 1.3em;'></div>");while(ae<ag.high){var aj=(ae-ag.low)/ah*ai;af.append($("<div class='label'>"+commatize(ae)+"</div>").css({position:"absolute",left:aj-1}));ae+=ak}this.content_div.children(":first").remove();this.content_div.append(af)}});var f=function(af,ae,ai){M.call(this,af,ae,ai);this.drawables=[];this.left_offset=0;if("drawables" in ai){var ah;for(var ag=0;ag<ai.drawables.length;ag++){ah=ai.drawables[ag];this.drawables[ag]=p(ah,af,null);if(ah.left_offset>this.left_offset){this.left_offset=ah.left_offset}}this.enabled=true}if(this.drawables.length!==0){this.set_display_modes(this.drawables[0].display_modes,this.drawables[0].mode)}this.update_icons();this.obj_type="CompositeTrack"};q(f.prototype,M.prototype,{action_icons_def:[{name:"composite_icon",title:"Show individual tracks",css_class:"layers-stack",on_click_fn:function(ae){$(".bs-tooltip").remove();ae.show_group()}}].concat(M.prototype.action_icons_def),to_dict:z.prototype.to_dict,add_drawable:z.prototype.add_drawable,unpack_drawables:z.prototype.unpack_drawables,change_mode:function(ae){M.prototype.change_mode.call(this,ae);for(var af=0;af<this.drawables.length;af++){this.drawables[af].change_mode(ae)}},init:function(){var ag=[];for(var af=0;af<this.drawables.length;af++){ag.push(this.drawables[af].init())}var ae=this;$.when.apply($,ag).then(function(){ae.enabled=true;ae.request_draw()})},update_icons:function(){this.action_icons.filters_icon.hide();this.action_icons.tools_icon.hide();this.action_icons.param_space_viz_icon.hide()},can_draw:r.prototype.can_draw,draw_helper:function(af,av,aB,ay,am,ao,aw){var au=this,aF=this._gen_tile_cache_key(av,ao,aB),aj=this._get_tile_bounds(aB,ay);if(!aw){aw={}}var aE=(af?undefined:au.tile_cache.get_elt(aF));if(aE){au.show_tile(aE,am,ao);return aE}var an=[],au,ar=true,az,ap;for(var aA=0;aA<this.drawables.length;aA++){au=this.drawables[aA];az=au.data_manager.get_data(aj,au.mode,ay,au.data_url_extra_params);if(W(az)){ar=false}an.push(az);ap=null;if(view.reference_track&&ao>view.canvas_manager.char_width_px){ap=view.reference_track.data_manager.get_data(aj,au.mode,ay,view.reference_track.data_url_extra_params);if(W(ap)){ar=false}}an.push(ap)}if(ar){q(az,aw.more_tile_data);this.tile_predraw_init();var ai=au.view.canvas_manager.new_canvas(),ak=au._get_tile_bounds(aB,ay),aC=aj.get("start"),ag=aj.get("end"),aD=0,av=Math.ceil((ag-aC)*ao)+this.left_offset,at=0,ah=[],aA;var ae=0;for(aA=0;aA<this.drawables.length;aA++,aD+=2){au=this.drawables[aA];az=an[aD];var aq=au.mode;if(aq==="Auto"){aq=au.get_mode(az);au.update_auto_mode(aq)}ah.push(aq);ae=au.get_canvas_height(az,aq,ao,av);if(ae>at){at=ae}}ai.width=av;ai.height=(aw.height?aw.height:at);aD=0;var ax=ai.getContext("2d");ax.translate(this.left_offset,0);ax.globalAlpha=0.5;ax.globalCompositeOperation="source-over";for(aA=0;aA<this.drawables.length;aA++,aD+=2){au=this.drawables[aA];az=an[aD];ap=an[aD+1];aE=au.draw_tile(az,ax,ah[aA],ay,aj,ao,ap)}this.tile_cache.set_elt(aF,aE);this.show_tile(aE,am,ao);return aE}var al=$.Deferred(),au=this;$.when.apply($,an).then(function(){view.request_redraw(false,false,false,au);al.resolve()});return al},show_group:function(){var ah=new P(this.view,this.container,{name:this.name}),ae;for(var ag=0;ag<this.drawables.length;ag++){ae=this.drawables[ag];ae.update_icons();ah.add_drawable(ae);ae.container=ah;ah.content_div.append(ae.container_div)}var af=this.container.replace_drawable(this,ah,true);ah.request_draw()},tile_predraw_init:function(){var ah=Number.MAX_VALUE,ae=-ah,af;for(var ag=0;ag<this.drawables.length;ag++){af=this.drawables[ag];if(af instanceof h){if(af.prefs.min_value<ah){ah=af.prefs.min_value}if(af.prefs.max_value>ae){ae=af.prefs.max_value}}}for(var ag=0;ag<this.drawables.length;ag++){af=this.drawables[ag];af.prefs.min_value=ah;af.prefs.max_value=ae}},postdraw_actions:function(ag,aj,al,af){M.prototype.postdraw_actions.call(this,ag,aj,al,af);var ai=-1;for(var ah=0;ah<ag.length;ah++){var ae=ag[ah].html_elt.find("canvas").height();if(ae>ai){ai=ae}}for(var ah=0;ah<ag.length;ah++){var ak=ag[ah];if(ak.html_elt.find("canvas").height()!==ai){this.draw_helper(true,aj,ak.index,ak.resolution,ak.html_elt.parent(),al,{height:ai});ak.html_elt.remove()}}}});var B=function(ae){M.call(this,ae,{content_div:ae.top_labeltrack},{resize:false});ae.reference_track=this;this.left_offset=200;this.visible_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_url=reference_url+"/"+this.view.dbkey;this.data_url_extra_params={reference:true};this.data_manager=new x.ReferenceTrackDataManager({data_url:this.data_url});this.hide_contents()};q(B.prototype,r.prototype,M.prototype,{build_header_div:function(){},init:function(){this.data_manager.clear();this.enabled=true},can_draw:r.prototype.can_draw,draw_helper:function(ai,ag,ae,af,aj,ak,ah){if(ak>this.view.canvas_manager.char_width_px){return M.prototype.draw_helper.call(this,ai,ag,ae,af,aj,ak,ah)}else{this.hide_contents();return null}},draw_tile:function(am,an,ai,ah,ak,ao){var ag=this;if(ao>this.view.canvas_manager.char_width_px){if(am.data===null){this.hide_contents();return}var af=an.canvas;an.font=an.canvas.manager.default_font;an.textAlign="center";am=am.data;for(var aj=0,al=am.length;aj<al;aj++){var ae=Math.floor(aj*ao);an.fillText(am[aj],ae,10)}this.show_contents();return new b(ag,ak,ah,af,am)}this.hide_contents()}});var h=function(ag,af,ah){var ae=this;this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";M.call(this,ag,af,ah);this.hda_ldda=ah.hda_ldda;this.dataset_id=ah.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"color",label:"Color",type:"color",default_value:Q()},{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:32,hidden:true}],saved_values:ah.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.vertical_range=ae.prefs.max_value-ae.prefs.min_value;ae.set_min_value(ae.prefs.min_value);ae.set_max_value(ae.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(h.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ae){this.prefs.min_value=ae;$("#linetrack_"+this.dataset_id+"_minval").text(this.prefs.min_value);this.tile_cache.clear();this.request_draw()},set_max_value:function(ae){this.prefs.max_value=ae;$("#linetrack_"+this.dataset_id+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.request_draw()},predraw_init:function(){var ae=this;ae.vertical_range=undefined;return $.getJSON(ae.dataset.url(),{data_type:"data",stats:true,chrom:ae.view.chrom,low:0,high:ae.view.max_high,hda_ldda:ae.hda_ldda},function(af){ae.container_div.addClass("line-track");var ai=af.data;if(isNaN(parseFloat(ae.prefs.min_value))||isNaN(parseFloat(ae.prefs.max_value))){var ag=ai.min,ak=ai.max;ag=Math.floor(Math.min(0,Math.max(ag,ai.mean-2*ai.sd)));ak=Math.ceil(Math.max(0,Math.min(ak,ai.mean+2*ai.sd)));ae.prefs.min_value=ag;ae.prefs.max_value=ak;$("#track_"+ae.dataset_id+"_minval").val(ae.prefs.min_value);$("#track_"+ae.dataset_id+"_maxval").val(ae.prefs.max_value)}ae.vertical_range=ae.prefs.max_value-ae.prefs.min_value;ae.total_frequency=ai.total_frequency;ae.container_div.find(".yaxislabel").remove();var aj=$("<div/>").text(X(ae.prefs.min_value,3)).make_text_editable({num_cols:6,on_finish:function(al){$(".bs-tooltip").remove();var al=parseFloat(al);if(!isNaN(al)){ae.set_min_value(al)}},help_text:"Set min value"}).addClass("yaxislabel bottom").attr("id","linetrack_"+ae.dataset_id+"_minval").prependTo(ae.container_div),ah=$("<div/>").text(X(ae.prefs.max_value,3)).make_text_editable({num_cols:6,on_finish:function(al){$(".bs-tooltip").remove();var al=parseFloat(al);if(!isNaN(al)){ae.set_max_value(al)}},help_text:"Set max value"}).addClass("yaxislabel top").attr("id","linetrack_"+ae.dataset_id+"_maxval").prependTo(ae.container_div)})},draw_tile:function(an,al,ag,af,ai,am){var ae=al.canvas,ah=ai.get("start"),ak=ai.get("end"),aj=new L.LinePainter(an.data,ah,ak,this.prefs,ag);aj.draw(al,ae.width,ae.height,am);return new b(this,ai,af,ae,an.data)},can_subset:function(ae){return false}});var t=function(ag,af,ah){var ae=this;this.display_modes=["Heatmap"];this.mode="Heatmap";M.call(this,ag,af,ah);this.hda_ldda=ah.hda_ldda;this.dataset_id=ah.dataset_id;this.original_dataset_id=this.dataset_id;this.left_offset=0;this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"pos_color",label:"Positive Color",type:"color",default_value:"4169E1"},{key:"negative_color",label:"Negative Color",type:"color",default_value:"FF8C00"},{key:"min_value",label:"Min Value",type:"float",default_value:0},{key:"max_value",label:"Max Value",type:"float",default_value:1},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:500,hidden:true}],saved_values:ah.prefs,onchange:function(){ae.set_name(ae.prefs.name);ae.vertical_range=ae.prefs.max_value-ae.prefs.min_value;ae.set_min_value(ae.prefs.min_value);ae.set_max_value(ae.prefs.max_value)}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.vertical_range=this.config.values.max_value-this.config.values.min_value};q(t.prototype,r.prototype,M.prototype,{on_resize:function(){this.request_draw(true)},set_min_value:function(ae){this.prefs.min_value=ae;this.tile_cache.clear();this.request_draw()},set_max_value:function(ae){this.prefs.max_value=ae;this.tile_cache.clear();this.request_draw()},draw_tile:function(ao,am,aj,ah,af,an){var ag=am.canvas,ae=this._get_tile_bounds(af,ah),ai=ae[0],al=ae[1],ak=new L.DiagonalHeatmapPainter(ao.data,ai,al,this.prefs,aj);ak.draw(am,ag.width,ag.height,an);return new b(this,af,ah,ag,ao.data)}});var c=function(ah,ag,aj){var af=this;this.display_modes=["Auto","Coverage","Dense","Squish","Pack"];M.call(this,ah,ag,aj);var ai=Q(),ae=Q([ai,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:ai},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ae},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true,help:"Show the number of items in each bin when drawing summary histogram"},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"clear value to set automatically"},{key:"connector_style",label:"Connector style",type:"select",default_value:"fishbones",options:[{label:"Line with arrows",value:"fishbone"},{label:"Arcs",value:"arcs"}]},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.visible_height_px,hidden:true}],saved_values:aj.prefs,onchange:function(){af.set_name(af.prefs.name);af.tile_cache.clear();af.set_painter_from_config();af.request_draw()}});this.prefs=this.config.values;this.visible_height_px=this.config.values.height;this.container_div.addClass("feature-track");this.hda_ldda=aj.hda_ldda;this.dataset_id=aj.dataset_id;this.original_dataset_id=aj.dataset_id;this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.slotters={};this.start_end_dct={};this.left_offset=200;this.set_painter_from_config()};q(c.prototype,r.prototype,M.prototype,{set_dataset:function(ae){this.dataset_id=ae.get("id");this.hda_ldda=ae.get("hda_ldda");this.dataset=ae;this.data_manager.set("dataset",ae)},set_painter_from_config:function(){if(this.config.values.connector_style==="arcs"){this.painter=L.ArcLinkedFeaturePainter}else{this.painter=L.LinkedFeaturePainter}},before_draw:function(){this.max_height_px=0},postdraw_actions:function(au,ao,aj,ai){M.prototype.postdraw_actions.call(this,au,ai);var an=this,aq;if(an.mode==="Coverage"){var af=-1;for(aq=0;aq<au.length;aq++){var ap=au[aq].max_val;if(ap>af){af=ap}}for(aq=0;aq<au.length;aq++){var aw=au[aq];if(aw.max_val!==af){aw.html_elt.remove();an.draw_helper(true,ao,aw.index,aw.resolution,aw.html_elt.parent(),aj,{more_tile_data:{max:af}})}}}if(an.filters_manager){var ak=an.filters_manager.filters;for(var at=0;at<ak.length;at++){ak[at].update_ui_elt()}var av=false,ae,al;for(aq=0;aq<au.length;aq++){if(au[aq].data.length){ae=au[aq].data[0];for(var at=0;at<ak.length;at++){al=ak[at];if(al.applies_to(ae)&&al.min!==al.max){av=true;break}}}}if(an.filters_available!==av){an.filters_available=av;if(!an.filters_available){an.filters_manager.hide()}an.update_icons()}}this.container_div.find(".yaxislabel").remove();var ah=au[0];if(ah instanceof j){var am=(this.prefs.histogram_max?this.prefs.histogram_max:ah.max_val),ag=$("<div/>").text(am).make_text_editable({num_cols:12,on_finish:function(ax){$(".bs-tooltip").remove();var ax=parseFloat(ax);an.prefs.histogram_max=(!isNaN(ax)?ax:null);an.tile_cache.clear();an.request_draw()},help_text:"Set max value; leave blank to use default"}).addClass("yaxislabel top").css("color",this.prefs.label_color);this.container_div.prepend(ag)}if(ah instanceof O){var ar=true;for(aq=0;aq<au.length;aq++){if(!au[aq].all_slotted){ar=false;break}}if(!ar){this.action_icons.show_more_rows_icon.show()}else{this.action_icons.show_more_rows_icon.hide()}}else{this.action_icons.show_more_rows_icon.hide()}},update_auto_mode:function(ae){var ae;if(this.mode==="Auto"){if(ae==="no_detail"){ae="feature spans"}else{if(ae==="summary_tree"){ae="coverage histogram"}}this.action_icons.mode_icon.attr("title","Set display mode (now: Auto/"+ae+")")}},incremental_slots:function(ai,ae,ah){var af=this.view.canvas_manager.dummy_context,ag=this.slotters[ai];if(!ag||(ag.mode!==ah)){ag=new (u.FeatureSlotter)(ai,ah,A,function(aj){return af.measureText(aj)});this.slotters[ai]=ag}return ag.slot_features(ae)},get_mode:function(ae){if(ae.dataset_type==="summary_tree"){mode="summary_tree"}else{if(ae.extra_info==="no_detail"||this.is_overview){mode="no_detail"}else{if(this.view.high-this.view.low>I){mode="Squish"}else{mode="Pack"}}}return mode},get_canvas_height:function(ae,ai,aj,af){if(ai==="summary_tree"||ai==="Coverage"){return this.summary_draw_height}else{var ah=this.incremental_slots(aj,ae.data,ai);var ag=new (this.painter)(null,null,null,this.prefs,ai);return Math.max(ab,ag.get_required_height(ah,af))}},draw_tile:function(ao,at,aq,au,ah,al,ag){var ar=this,af=at.canvas,aA=ah.get("start"),ae=ah.get("end"),ai=this.left_offset;if(aq==="summary_tree"||aq==="Coverage"){var aC=new L.SummaryTreePainter(ao,aA,ae,this.prefs);aC.draw(at,af.width,af.height,al);return new j(ar,ah,au,af,ao.data,ao.max)}var ak=[],ap=this.slotters[al].slots;all_slotted=true;if(ao.data){var am=this.filters_manager.filters;for(var av=0,ax=ao.data.length;av<ax;av++){var aj=ao.data[av];var aw=false;var an;for(var az=0,aE=am.length;az<aE;az++){an=am[az];an.update_attrs(aj);if(!an.keep(aj)){aw=true;break}}if(!aw){ak.push(aj);if(!(aj[0] in ap)){all_slotted=false}}}}var aD=(this.filters_manager.alpha_filter?new C(this.filters_manager.alpha_filter):null);var aB=(this.filters_manager.height_filter?new C(this.filters_manager.height_filter):null);var aC=new (this.painter)(ak,aA,ae,this.prefs,aq,aD,aB,ag);var ay=null;at.fillStyle=this.prefs.block_color;at.font=at.canvas.manager.default_font;at.textAlign="right";if(ao.data){ay=aC.draw(at,af.width,af.height,al,ap);ay.translation=-ai}return new O(ar,ah,au,af,ao.data,al,aq,ao.message,all_slotted,ay)},data_and_mode_compatible:function(ae,af){if(af==="Auto"){return true}else{if(af==="Coverage"){return ae.dataset_type==="summary_tree"}else{if(ae.extra_info==="no_detail"||ae.dataset_type==="summary_tree"){return false}else{return true}}}},can_subset:function(ae){if(ae.dataset_type==="summary_tree"||ae.message||ae.extra_info==="no_detail"){return false}return true}});var S=function(af,ae,ag){c.call(this,af,ae,ag);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block color",type:"color",default_value:Q()},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ag.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter};q(S.prototype,r.prototype,M.prototype,c.prototype);var U=function(ag,af,ai){c.call(this,ag,af,ai);var ah=Q(),ae=Q([ah,"#ffffff"]);this.config=new F({track:this,params:[{key:"name",label:"Name",type:"text",default_value:this.name},{key:"block_color",label:"Block and sense strand color",type:"color",default_value:ah},{key:"reverse_strand_color",label:"Antisense strand color",type:"color",default_value:ae},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_insertions",label:"Show insertions",type:"bool",default_value:false},{key:"show_differences",label:"Show differences only",type:"bool",default_value:true},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"histogram_max",label:"Histogram maximum",type:"float",default_value:null,help:"Clear value to set automatically"},{key:"mode",type:"string",default_value:this.mode,hidden:true}],saved_values:ai.prefs,onchange:function(){this.track.set_name(this.track.prefs.name);this.track.tile_cache.clear();this.track.request_draw()}});this.prefs=this.config.values;this.painter=L.ReadPainter;this.update_icons()};q(U.prototype,r.prototype,M.prototype,c.prototype);var d={LineTrack:h,FeatureTrack:c,VcfTrack:S,ReadTrack:U,CompositeTrack:f,DrawableGroup:P};var p=function(ag,af,ae){if("copy" in ag){return ag.copy(ae)}else{var ah=ag.obj_type;if(!ah){ah=ag.track_type}return new d[ah](af,ae,ag)}};return{View:Z,DrawableGroup:P,LineTrack:h,FeatureTrack:c,DiagonalHeatmapTrack:t,ReadTrack:U,VcfTrack:S,CompositeTrack:f,object_from_template:p,add_datasets:ad}});
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/packed/viz/visualization.js
--- a/static/scripts/packed/viz/visualization.js
+++ b/static/scripts/packed/viz/visualization.js
@@ -1,1 +1,1 @@
-define(["libs/underscore","mvc/data","viz/trackster/util"],function(q,h,j){var i=function(s){return("isResolved" in s)};var e=function(s){this.default_font=s!==undefined?s:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};q.extend(e.prototype,{load_pattern:function(s,w){var t=this.patterns,u=this.dummy_context,v=new Image();v.src=galaxy_paths.attributes.image_path+w;v.onload=function(){t[s]=u.createPattern(v,"repeat")}},get_pattern:function(s){return this.patterns[s]},new_canvas:function(){var s=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(s)}s.manager=this;return s}});var o=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(s){this.clear()},get_elt:function(t){var u=this.attributes.obj_cache,v=this.attributes.key_ary,s=v.indexOf(t);if(s!==-1){if(u[t].stale){v.splice(s,1);delete u[t]}else{this.move_key_to_end(t,s)}}return u[t]},set_elt:function(t,v){var w=this.attributes.obj_cache,x=this.attributes.key_ary,u=this.attributes.num_elements;if(!w[t]){if(x.length>=u){var s=x.shift();delete w[s]}x.push(t)}w[t]=v;return v},move_key_to_end:function(t,s){this.attributes.key_ary.splice(s,1);this.attributes.key_ary.push(t)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var c=o.extend({defaults:q.extend({},o.prototype.defaults,{dataset:null,filters_manager:null,data_type:"data",data_mode_compatible:function(s,t){return true},can_subset:function(s){return false}}),data_is_ready:function(){var u=this.get("dataset"),t=$.Deferred(),s=new j.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:u.get("hda_ldda"),data_type:"state"},dataType:"json"},interval:5000,success_fn:function(v){return v!=="pending"}});$.when(s.go()).then(function(v){t.resolve(v==="ok"||v==="data")});return t},search_features:function(s){var t=this.get("dataset"),u={query:s,hda_ldda:t.get("hda_ldda"),data_type:"features"};return $.getJSON(t.url(),u)},load_data:function(A,z,t,y){var w=this.get("dataset"),v={data_type:this.get("data_type"),chrom:A.get("chrom"),low:A.get("start"),high:A.get("end"),mode:z,resolution:t,hda_ldda:w.get("hda_ldda")};$.extend(v,y);var C=this.get("filters_manager");if(C){var D=[];var s=C.filters;for(var x=0;x<s.length;x++){D.push(s[x].name)}v.filter_cols=JSON.stringify(D)}var u=this,B=$.getJSON(w.url(),v,function(E){u.set_data(A,E)});this.set_data(A,B);return B},get_data:function(y,x,u,w){var z=this.get_elt(y);if(z&&(i(z)||this.get("data_mode_compatible")(z,x))){return z}var A=this.get("key_ary"),t=this.get("obj_cache"),B,s;for(var v=0;v<A.length;v++){B=A[v];s=new f({from_str:B});if(s.contains(y)){z=t[B];if(i(z)||(this.get("data_mode_compatible")(z,x)&&this.get("can_subset")(z))){this.move_key_to_end(B,v);return z}}}return this.load_data(y,x,u,w)},set_data:function(t,s){this.set_elt(t,s)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(A,z,v,y,w){var C=this._mark_stale(A);if(!(C&&this.get("data_mode_compatible")(C,z))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var u=A.get("start");if(w===this.DEEP_DATA_REQ){$.extend(y,{start_val:C.data.length+1})}else{if(w===this.BROAD_DATA_REQ){u=(C.max_high?C.max_high:C.data[C.data.length-1][2])+1}}var B=A.copy().set("start",u);var t=this,x=this.load_data(B,z,v,y),s=$.Deferred();this.set_data(A,s);$.when(x).then(function(D){if(D.data){D.data=C.data.concat(D.data);if(D.max_low){D.max_low=C.max_low}if(D.message){D.message=D.message.replace(/[0-9]+/,D.data.length)}}t.set_data(A,D);s.resolve(D)});return s},get_more_detailed_data:function(v,x,t,w,u){var s=this._mark_stale(v);if(!s){console.log("ERROR getting more detailed data: no current data");return}if(!u){u={}}var x;if(s.dataset_type==="bigwig"){u.num_samples=s.data.length*w}else{if(s.dataset_type==="summary_tree"){u.level=s.level+1}}return this.load_data(v,x,t,u)},_mark_stale:function(t){var s=this.get_elt(t);if(!s){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),t.toString())}s.stale=true;return s},get_elt:function(s){return o.prototype.get_elt.call(this,s.toString())},set_elt:function(t,s){return o.prototype.set_elt.call(this,t.toString(),s)}});var m=c.extend({initialize:function(s){var t=new Backbone.Model();t.urlRoot=s.data_url;this.set("dataset",t)},load_data:function(u,v,s,t){console.log(u,v,s);if(s>1){return{data:null}}return c.prototype.load_data.call(this,u,v,s,t)}});var b=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(s){this.id=s.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(s){var t=q.find(this.get_chroms_info(),function(u){return u.chrom==s});return new f({chrom:t.chrom,end:t.len})}});var f=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(t){if(t.from_str){var v=t.from_str.split(":"),u=v[0],s=v[1].split("-");this.set({chrom:u,start:parseInt(s[0],10),end:parseInt(s[1],10)})}},copy:function(){return new f({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(z){var t=this.get("chrom"),y=z.get("chrom"),x=this.get("start"),v=z.get("start"),w=this.get("end"),u=z.get("end"),s;if(t&&y&&t!==y){return this.get("DIF_CHROMS")}if(x<v){if(w<v){s=this.get("BEFORE")}else{if(w<=u){s=this.get("OVERLAP_START")}else{s=this.get("CONTAINS")}}}else{if(x>u){s=this.get("AFTER")}else{if(w<=u){s=this.get("CONTAINED_BY")}else{s=this.get("OVERLAP_END")}}}return s},contains:function(s){return this.compute_overlap(s)===this.get("CONTAINS")},overlaps:function(s){return q.intersection([this.compute_overlap(s)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var l=Backbone.Collection.extend({model:f});var d=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:f}]});var p=Backbone.Collection.extend({model:d});var r=h.Dataset.extend({initialize:function(s){this.set("id",s.dataset_id);var t=new c({dataset:this});this.set("data_manager",t);var u=this.get("preloaded_data");if(u){t.set("num_elements",u.data.length);q.each(u.data,function(v){t.set_data(v.region,v)})}},get_genome_wide_data:function(s){var t=this.get("data_manager");return q.map(s.get("chroms_info").chrom_info,function(u){return t.get_elt(new f({chrom:u.chrom,start:0,end:u.len}))})}});var n=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:r}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:q.extend({},n.prototype.defaults,{bookmarks:null,viewport:null})});var a=Backbone.Model.extend({});var g=Backbone.Router.extend({initialize:function(t){this.view=t.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var s=this;s.view.on("navigate",function(u){s.navigate(u)})},change_location:function(s){this.view.go_to(s)}});return{BrowserBookmark:d,BrowserBookmarkCollection:p,Cache:o,CanvasManager:e,Genome:b,GenomeDataManager:c,GenomeRegion:f,GenomeRegionCollection:l,GenomeVisualization:k,ReferenceTrackDataManager:m,TrackBrowserRouter:g,TrackConfig:a,Visualization:n}});
\ No newline at end of file
+define(["libs/underscore","mvc/data","viz/trackster/util"],function(q,h,j){var i=function(s){return("isResolved" in s)};var e=function(s){this.default_font=s!==undefined?s:"9px Monaco, Lucida Console, monospace";this.dummy_canvas=this.new_canvas();this.dummy_context=this.dummy_canvas.getContext("2d");this.dummy_context.font=this.default_font;this.char_width_px=this.dummy_context.measureText("A").width;this.patterns={};this.load_pattern("right_strand","/visualization/strand_right.png");this.load_pattern("left_strand","/visualization/strand_left.png");this.load_pattern("right_strand_inv","/visualization/strand_right_inv.png");this.load_pattern("left_strand_inv","/visualization/strand_left_inv.png")};q.extend(e.prototype,{load_pattern:function(s,w){var t=this.patterns,u=this.dummy_context,v=new Image();v.src=galaxy_paths.attributes.image_path+w;v.onload=function(){t[s]=u.createPattern(v,"repeat")}},get_pattern:function(s){return this.patterns[s]},new_canvas:function(){var s=$("<canvas/>")[0];if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(s)}s.manager=this;return s}});var o=Backbone.Model.extend({defaults:{num_elements:20,obj_cache:null,key_ary:null},initialize:function(s){this.clear()},get_elt:function(t){var u=this.attributes.obj_cache,v=this.attributes.key_ary,s=v.indexOf(t);if(s!==-1){if(u[t].stale){v.splice(s,1);delete u[t]}else{this.move_key_to_end(t,s)}}return u[t]},set_elt:function(t,v){var w=this.attributes.obj_cache,x=this.attributes.key_ary,u=this.attributes.num_elements;if(!w[t]){if(x.length>=u){var s=x.shift();delete w[s]}x.push(t)}w[t]=v;return v},move_key_to_end:function(t,s){this.attributes.key_ary.splice(s,1);this.attributes.key_ary.push(t)},clear:function(){this.attributes.obj_cache={};this.attributes.key_ary=[]},size:function(){return this.attributes.key_ary.length}});var c=o.extend({defaults:q.extend({},o.prototype.defaults,{dataset:null,filters_manager:null,data_type:"data",data_mode_compatible:function(s,t){return true},can_subset:function(s){return false}}),data_is_ready:function(){var u=this.get("dataset"),t=$.Deferred(),s=new j.ServerStateDeferred({ajax_settings:{url:this.get("dataset").url(),data:{hda_ldda:u.get("hda_ldda"),data_type:"state"},dataType:"json"},interval:5000,success_fn:function(v){return v!=="pending"}});$.when(s.go()).then(function(v){t.resolve(v==="ok"||v==="data")});return t},search_features:function(s){var t=this.get("dataset"),u={query:s,hda_ldda:t.get("hda_ldda"),data_type:"features"};return $.getJSON(t.url(),u)},load_data:function(A,z,t,y){var w=this.get("dataset"),v={data_type:this.get("data_type"),chrom:A.get("chrom"),low:A.get("start"),high:A.get("end"),mode:z,resolution:t,hda_ldda:w.get("hda_ldda")};$.extend(v,y);var C=this.get("filters_manager");if(C){var D=[];var s=C.filters;for(var x=0;x<s.length;x++){D.push(s[x].name)}v.filter_cols=JSON.stringify(D)}var u=this,B=$.getJSON(w.url(),v,function(E){u.set_data(A,E)});this.set_data(A,B);return B},get_data:function(y,x,u,w){var z=this.get_elt(y);if(z&&(i(z)||this.get("data_mode_compatible")(z,x))){return z}var A=this.get("key_ary"),t=this.get("obj_cache"),B,s;for(var v=0;v<A.length;v++){B=A[v];s=new f({from_str:B});if(s.contains(y)){z=t[B];if(i(z)||(this.get("data_mode_compatible")(z,x)&&this.get("can_subset")(z))){this.move_key_to_end(B,v);return z}}}return this.load_data(y,x,u,w)},set_data:function(t,s){this.set_elt(t,s)},DEEP_DATA_REQ:"deep",BROAD_DATA_REQ:"breadth",get_more_data:function(A,z,v,y,w){var C=this._mark_stale(A);if(!(C&&this.get("data_mode_compatible")(C,z))){console.log("ERROR: problem with getting more data: current data is not compatible");return}var u=A.get("start");if(w===this.DEEP_DATA_REQ){$.extend(y,{start_val:C.data.length+1})}else{if(w===this.BROAD_DATA_REQ){u=(C.max_high?C.max_high:C.data[C.data.length-1][2])+1}}var B=A.copy().set("start",u);var t=this,x=this.load_data(B,z,v,y),s=$.Deferred();this.set_data(A,s);$.when(x).then(function(D){if(D.data){D.data=C.data.concat(D.data);if(D.max_low){D.max_low=C.max_low}if(D.message){D.message=D.message.replace(/[0-9]+/,D.data.length)}}t.set_data(A,D);s.resolve(D)});return s},get_more_detailed_data:function(v,x,t,w,u){var s=this._mark_stale(v);if(!s){console.log("ERROR getting more detailed data: no current data");return}if(!u){u={}}var x;if(s.dataset_type==="bigwig"){u.num_samples=s.data.length*w}else{if(s.dataset_type==="summary_tree"){u.level=Math.min(s.level-1,2)}}return this.load_data(v,x,t,u)},_mark_stale:function(t){var s=this.get_elt(t);if(!s){console.log("ERROR: no data to mark as stale: ",this.get("dataset"),t.toString())}s.stale=true;return s},get_elt:function(s){return o.prototype.get_elt.call(this,s.toString())},set_elt:function(t,s){return o.prototype.set_elt.call(this,t.toString(),s)}});var m=c.extend({initialize:function(s){var t=new Backbone.Model();t.urlRoot=s.data_url;this.set("dataset",t)},load_data:function(u,v,s,t){console.log(u,v,s);if(s>1){return{data:null}}return c.prototype.load_data.call(this,u,v,s,t)}});var b=Backbone.Model.extend({defaults:{name:null,key:null,chroms_info:null},initialize:function(s){this.id=s.dbkey},get_chroms_info:function(){return this.attributes.chroms_info.chrom_info},get_chrom_region:function(s){var t=q.find(this.get_chroms_info(),function(u){return u.chrom==s});return new f({chrom:t.chrom,end:t.len})}});var f=Backbone.RelationalModel.extend({defaults:{chrom:null,start:0,end:0,DIF_CHROMS:1000,BEFORE:1001,CONTAINS:1002,OVERLAP_START:1003,OVERLAP_END:1004,CONTAINED_BY:1005,AFTER:1006},initialize:function(t){if(t.from_str){var v=t.from_str.split(":"),u=v[0],s=v[1].split("-");this.set({chrom:u,start:parseInt(s[0],10),end:parseInt(s[1],10)})}},copy:function(){return new f({chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")})},length:function(){return this.get("end")-this.get("start")},toString:function(){return this.get("chrom")+":"+this.get("start")+"-"+this.get("end")},toJSON:function(){return{chrom:this.get("chrom"),start:this.get("start"),end:this.get("end")}},compute_overlap:function(z){var t=this.get("chrom"),y=z.get("chrom"),x=this.get("start"),v=z.get("start"),w=this.get("end"),u=z.get("end"),s;if(t&&y&&t!==y){return this.get("DIF_CHROMS")}if(x<v){if(w<v){s=this.get("BEFORE")}else{if(w<=u){s=this.get("OVERLAP_START")}else{s=this.get("CONTAINS")}}}else{if(x>u){s=this.get("AFTER")}else{if(w<=u){s=this.get("CONTAINED_BY")}else{s=this.get("OVERLAP_END")}}}return s},contains:function(s){return this.compute_overlap(s)===this.get("CONTAINS")},overlaps:function(s){return q.intersection([this.compute_overlap(s)],[this.get("DIF_CHROMS"),this.get("BEFORE"),this.get("AFTER")]).length===0}});var l=Backbone.Collection.extend({model:f});var d=Backbone.RelationalModel.extend({defaults:{region:null,note:""},relations:[{type:Backbone.HasOne,key:"region",relatedModel:f}]});var p=Backbone.Collection.extend({model:d});var r=h.Dataset.extend({initialize:function(s){this.set("id",s.dataset_id);var t=new c({dataset:this});this.set("data_manager",t);var u=this.get("preloaded_data");if(u){t.set("num_elements",u.data.length);q.each(u.data,function(v){t.set_data(v.region,v)})}},get_genome_wide_data:function(s){var t=this.get("data_manager");return q.map(s.get("chroms_info").chrom_info,function(u){return t.get_elt(new f({chrom:u.chrom,start:0,end:u.len}))})}});var n=Backbone.RelationalModel.extend({defaults:{id:"",title:"",type:"",dbkey:"",tracks:null},relations:[{type:Backbone.HasMany,key:"tracks",relatedModel:r}],url:function(){return galaxy_paths.get("visualization_url")},save:function(){return $.ajax({url:this.url(),type:"POST",dataType:"json",data:{vis_json:JSON.stringify(this)}})}});var k=n.extend({defaults:q.extend({},n.prototype.defaults,{bookmarks:null,viewport:null})});var a=Backbone.Model.extend({});var g=Backbone.Router.extend({initialize:function(t){this.view=t.view;this.route(/([\w]+)$/,"change_location");this.route(/([\w]+\:[\d,]+-[\d,]+)$/,"change_location");var s=this;s.view.on("navigate",function(u){s.navigate(u)})},change_location:function(s){this.view.go_to(s)}});return{BrowserBookmark:d,BrowserBookmarkCollection:p,Cache:o,CanvasManager:e,Genome:b,GenomeDataManager:c,GenomeRegion:f,GenomeRegionCollection:l,GenomeVisualization:k,ReferenceTrackDataManager:m,TrackBrowserRouter:g,TrackConfig:a,Visualization:n}});
\ No newline at end of file
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 static/scripts/viz/scatterplot.js
--- a/static/scripts/viz/scatterplot.js
+++ b/static/scripts/viz/scatterplot.js
@@ -61,8 +61,9 @@
*/
function TwoVarScatterplot( config ){
var plot = this,
- GUESS_AT_SVG_CHAR_WIDTH = 10,
- GUESS_AT_SVG_CHAR_HEIGHT = 12,
+ TICK_LINE_AND_PADDING = 10,
+ GUESS_AT_SVG_CHAR_WIDTH = 7,
+ GUESS_AT_SVG_CHAR_HEIGHT = 10,
PADDING = 8,
X_LABEL_TOO_LONG_AT = 5;
@@ -135,16 +136,23 @@
this.log( 'built svg:', d3.selectAll( 'svg' ) );
- this.adjustChartDimensions = function(){
+ this.adjustChartDimensions = function( top, right, bottom, left ){
+ top = top || 0;
+ right = right || 0;
+ bottom = bottom || 0;
+ left = left || 0;
this.svg
- .attr( "width", this.config.width + ( this.config.marginRight + this.config.marginLeft ) )
- .attr( "height", this.config.height + ( this.config.marginTop + this.config.marginBottom ) )
+ .attr( "width", this.config.width + ( this.config.marginRight + right ) +
+ ( this.config.marginLeft + left ) )
+ .attr( "height", this.config.height + ( this.config.marginTop + top ) +
+ ( this.config.marginBottom + bottom ) )
// initial is hidden - show it
.style( 'display', 'block' );
// move content group away from margins
+ //TODO: allow top, right axis
this.content = this.svg.select( "g.content" )
- .attr( "transform", this.translateStr( this.config.marginLeft, this.config.marginTop ) );
+ .attr( "transform", this.translateStr( this.config.marginLeft + left, this.config.marginTop + top ) );
};
// ........................................................ data and scales
@@ -208,29 +216,38 @@
.orient( 'left' );
this.yAxis// = content.select( 'g#y-axis' )
.call( this.yAxisFn );
- //this.log( 'yAxis:', this.yAxis );
+ this.log( 'yAxis:', this.yAxis );
- //TODO: this isn't reliable with -/+ ranges - better to go thru each tick
- this.yLongestLabel = d3.max( _.map( [ this.yMin, this.yMax ],
- function( number ){ return ( String( number ) ).length; } ) );
- this.log( 'yLongestLabel:', this.yLongestLabel );
+ // get the tick labels for the y axis
+ var yTickLabels = this.yAxis.selectAll( 'text' ).filter( function( e, i ){ return i !== 0; } );
+ //this.log( 'yTickLabels:', yTickLabels );
- //TODO: ugh ... so clumsy
- //TODO: this isn't reliable with -/+ ranges - better to go thru each tick
- var neededY = this.yLongestLabel * GUESS_AT_SVG_CHAR_WIDTH + ( PADDING );
+ // get the longest label length (or 0 if no labels)
+ this.yLongestLabel = d3.max(
+ //NOTE: d3 returns an nested array - use the plain array inside ([0])
+ yTickLabels[0].map( function( e, i ){
+ return ( d3.select( e ).text() ).length;
+ })
+ ) || 0;
+ //this.log( 'yLongestLabel:', this.yLongestLabel );
+ //TODO: lose the guessing if possible
+ var neededY = TICK_LINE_AND_PADDING + ( this.yLongestLabel * GUESS_AT_SVG_CHAR_WIDTH )
+ + PADDING + GUESS_AT_SVG_CHAR_HEIGHT;
+ //this.log( 'neededY:', neededY );
// increase width for yLongerStr, increase margin for y
//TODO??: (or transform each number: 2k)
- if( this.config.yAxisLabelBumpX > -( neededY ) ){
- this.config.yAxisLabelBumpX = -( neededY );
+ this.config.yAxisLabelBumpX = -( neededY - GUESS_AT_SVG_CHAR_HEIGHT );
+ if( this.config.marginLeft < neededY ){
+ var adjusting = ( neededY ) - this.config.marginLeft;
+ adjusting = ( adjusting < 0 )?( 0 ):( adjusting );
+ this.log( 'adjusting:', adjusting );
+
+ // update dimensions, translations
+ this.adjustChartDimensions( 0, 0, 0, adjusting );
}
- if( this.config.marginLeft < neededY ){
- this.config.marginLeft = neededY + GUESS_AT_SVG_CHAR_HEIGHT;
- // update dimensions, translations
- this.adjustChartDimensions();
- }
- this.log( 'this.config.yAxisLableBumpx, this.config.marginLeft:',
- this.config.yAxisLabelBumpX, this.config.marginLeft );
+ //this.log( 'this.config.yAxisLableBumpx, this.config.marginLeft:',
+ // this.config.yAxisLabelBumpX, this.config.marginLeft );
this.yAxisLabel// = yAxis.select( 'text#y-axis-label' )
.attr( 'x', this.config.yAxisLabelBumpX )
@@ -367,7 +384,7 @@
*
*/
var ScatterplotView = BaseView.extend( LoggableMixin ).extend({
- logger : console,
+ //logger : console,
tagName : 'form',
className : 'scatterplot-settings-form',
@@ -444,12 +461,10 @@
message = message || '';
this.$el.find( 'div#loading-indicator' ).children( '.loading-message' ).text( message );
this.$el.find( 'div#loading-indicator' ).show( 'fast' );
- console.debug( 'showing:', this.$el.find( 'div#loading-indicator' ), message );
},
hideLoadingIndicator : function(){
this.$el.find( 'div#loading-indicator' ).hide( 'fast' );
- console.debug( 'hiding:', this.$el.find( 'div#loading-indicator' ) );
},
renderScatterplot : function(){
diff -r 80251cd7f94d64295ef6e64412f895d268ab988d -r 369a941393909434e0efb5c84dd831e5ab096095 templates/visualization/scatterplot.mako
--- a/templates/visualization/scatterplot.mako
+++ b/templates/visualization/scatterplot.mako
@@ -60,9 +60,15 @@
stroke: black;
shape-rendering: crispEdges;
}
+
svg .axis text {
+ font-family: monospace;
+ font-size: 12px;
+}
+
+svg #x-axis-label, svg #y-axis-label {
font-family: sans-serif;
- font-size: 12px;
+ font-size: 10px;
}
svg .glyph {
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: carlfeberhard: scatterplot: loading indicators; api/datasets: minor cleanup;
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/80251cd7f94d/
changeset: 80251cd7f94d
user: carlfeberhard
date: 2012-10-02 19:24:26
summary: scatterplot: loading indicators; api/datasets: minor cleanup;
affected #: 4 files
diff -r 00681c35d987cde2200ff94c7f5510c594c904fd -r 80251cd7f94d64295ef6e64412f895d268ab988d lib/galaxy/visualization/data_providers/basic.py
--- a/lib/galaxy/visualization/data_providers/basic.py
+++ b/lib/galaxy/visualization/data_providers/basic.py
@@ -102,6 +102,7 @@
"column index (%d) must be less" % ( column )
+ " than the number of columns: %d" % ( self.original_dataset.metadata.columns ) )
+
#print columns, start_val, max_vals, skip_comments, kwargs
# alter meta by column_selectors (if any)
diff -r 00681c35d987cde2200ff94c7f5510c594c904fd -r 80251cd7f94d64295ef6e64412f895d268ab988d lib/galaxy/webapps/galaxy/api/datasets.py
--- a/lib/galaxy/webapps/galaxy/api/datasets.py
+++ b/lib/galaxy/webapps/galaxy/api/datasets.py
@@ -187,7 +187,6 @@
# Return data.
data = None
data_provider = trans.app.data_provider_registry.get_data_provider( trans, raw=True, original_dataset=dataset )
- print 'data_provider:', data_provider
if isinstance( data_provider, ColumnDataProvider ):
data = data_provider.get_data( **kwargs )
diff -r 00681c35d987cde2200ff94c7f5510c594c904fd -r 80251cd7f94d64295ef6e64412f895d268ab988d static/scripts/viz/scatterplot.js
--- a/static/scripts/viz/scatterplot.js
+++ b/static/scripts/viz/scatterplot.js
@@ -181,12 +181,11 @@
this.xAxis// = content.select( 'g#x-axis' )
.attr( 'transform', this.translateStr( 0, this.config.height ) )
.call( this.xAxisFn );
- this.log( 'xAxis:', this.xAxis );
+ //this.log( 'xAxis:', this.xAxis );
- //TODO: this isn't reliable with -/+ ranges - better to go thru each tick
this.xLongestLabel = d3.max( _.map( [ this.xMin, this.xMax ],
function( number ){ return ( String( number ) ).length; } ) );
- this.log( 'xLongestLabel:', this.xLongestLabel );
+ //this.log( 'xLongestLabel:', this.xLongestLabel );
if( this.xLongestLabel >= X_LABEL_TOO_LONG_AT ){
//TODO: adjust ticks when tick labels are long - move odds down and extend tick line
@@ -199,7 +198,7 @@
.attr( 'y', this.config.xAxisLabelBumpY )
.attr( 'text-anchor', 'middle' )
.text( this.config.xLabel );
- this.log( 'xAxisLabel:', this.xAxisLabel );
+ //this.log( 'xAxisLabel:', this.xAxisLabel );
};
this.setUpYAxis = function(){
@@ -209,8 +208,9 @@
.orient( 'left' );
this.yAxis// = content.select( 'g#y-axis' )
.call( this.yAxisFn );
- this.log( 'yAxis:', this.yAxis );
+ //this.log( 'yAxis:', this.yAxis );
+ //TODO: this isn't reliable with -/+ ranges - better to go thru each tick
this.yLongestLabel = d3.max( _.map( [ this.yMin, this.yMax ],
function( number ){ return ( String( number ) ).length; } ) );
this.log( 'yLongestLabel:', this.yLongestLabel );
@@ -219,7 +219,7 @@
//TODO: this isn't reliable with -/+ ranges - better to go thru each tick
var neededY = this.yLongestLabel * GUESS_AT_SVG_CHAR_WIDTH + ( PADDING );
- // increase width for xLongerStr, increase margin for y
+ // increase width for yLongerStr, increase margin for y
//TODO??: (or transform each number: 2k)
if( this.config.yAxisLabelBumpX > -( neededY ) ){
this.config.yAxisLabelBumpX = -( neededY );
@@ -238,7 +238,7 @@
.attr( 'text-anchor', 'middle' )
.attr( 'transform', this.rotateStr( -90, this.config.yAxisLabelBumpX, this.config.height / 2 ) )
.text( this.config.yLabel );
- this.log( 'yAxisLabel:', this.yAxisLabel );
+ //this.log( 'yAxisLabel:', this.yAxisLabel );
};
// ........................................................ grid lines
@@ -261,7 +261,7 @@
// remove unneeded (less ticks)
this.vGridLines.exit().remove();
- this.log( 'vGridLines:', this.vGridLines );
+ //this.log( 'vGridLines:', this.vGridLines );
// HORIZONTAL
this.hGridLines = this.content.selectAll( 'line.h-grid-line' )
@@ -277,7 +277,7 @@
.attr( 'y2', this.yScale );
this.hGridLines.exit().remove();
- this.log( 'hGridLines:', this.hGridLines );
+ //this.log( 'hGridLines:', this.hGridLines );
};
// ........................................................ data points
@@ -332,7 +332,7 @@
.style( "fill-opacity", 0 )
.remove();
- this.log( this.datapoints, 'glyphs rendered' );
+ //this.log( this.datapoints, 'glyphs rendered' );
};
this.render = function( xCol, yCol ){
@@ -343,11 +343,11 @@
//TODO: ^^ isn't necessarily true with current ColumnDataProvider
xCol = this.preprocessData( xCol );
yCol = this.preprocessData( yCol );
- this.log( 'xCol len', xCol.length, 'yCol len', yCol.length );
+ //this.log( 'xCol len', xCol.length, 'yCol len', yCol.length );
//TODO: compute min, max on server.
this.setUpDomains( xCol, yCol );
- this.log( 'xMin, xMax, yMin, yMax:', this.xMin, this.xMax, this.yMin, this.yMax );
+ //this.log( 'xMin, xMax, yMin, yMax:', this.xMin, this.xMax, this.yMin, this.yMax );
this.setUpScales();
this.adjustChartDimensions();
@@ -367,9 +367,11 @@
*
*/
var ScatterplotView = BaseView.extend( LoggableMixin ).extend({
- //logger : console,
+ logger : console,
tagName : 'form',
- className : 'scatterplot-settings-form',
+ className : 'scatterplot-settings-form',
+
+ loadingIndicatorImagePath : ( galaxy_paths.get( 'image_path' ) + '/loading_large_white_bg.gif' ),
events : {
'click #render-button' : 'renderScatterplot'
@@ -397,6 +399,7 @@
var view = this,
html = '',
columnHtml = '';
+
// build column select controls for each x, y (based on name if available)
// ugh...hafta preprocess
this.dataset.metadata_column_types = this.dataset.metadata_column_types.split( ', ' );
@@ -408,10 +411,16 @@
if( view.dataset.metadata_column_names ){
name = view.dataset.metadata_column_names[ index ];
}
- columnHtml += '<option value="' + index + '">' + name + '</column>';
+ columnHtml += '<option value="' + index + '">' + name + '</option>';
}
});
+ // loading indicator - initially hidden
+ html += '<div id="loading-indicator" style="display: none;">';
+ html += '<img class="loading-img" src=' + this.loadingIndicatorImagePath + ' />';
+ html += '<span class="loading-message"></span>';
+ html += '</div>';
+
// column selector containers
html += '<div id="x-column-input">';
html += '<label for="">Data column for X: </label><select name="x-column">' + columnHtml + '</select>';
@@ -430,6 +439,18 @@
this.$el.find( '#render-button' );
return this;
},
+
+ showLoadingIndicator : function( message ){
+ message = message || '';
+ this.$el.find( 'div#loading-indicator' ).children( '.loading-message' ).text( message );
+ this.$el.find( 'div#loading-indicator' ).show( 'fast' );
+ console.debug( 'showing:', this.$el.find( 'div#loading-indicator' ), message );
+ },
+
+ hideLoadingIndicator : function(){
+ this.$el.find( 'div#loading-indicator' ).hide( 'fast' );
+ console.debug( 'hiding:', this.$el.find( 'div#loading-indicator' ) );
+ },
renderScatterplot : function(){
// parse the column values for both
@@ -462,19 +483,23 @@
});
this.log( 'url:', url );
+ this.showLoadingIndicator( 'Fetching data...' );
jQuery.ajax({
url : url,
dataType : 'json',
success : function( response ){
//TODO: server sends back an endpoint, cache for next pagination request
+ view.showLoadingIndicator( 'Rendering...' );
view.endpoint = response.endpoint;
view.plot.render(
// pull apart first two regardless of number of columns
_.map( response.data, function( columns ){ return columns[0]; } ),
_.map( response.data, function( columns ){ return columns[1]; } )
);
+ view.hideLoadingIndicator();
},
error : function( xhr, status, error ){
+ view.hideLoadingIndicator();
alert( 'ERROR:' + status + '\n' + error );
}
});
diff -r 00681c35d987cde2200ff94c7f5510c594c904fd -r 80251cd7f94d64295ef6e64412f895d268ab988d templates/visualization/scatterplot.mako
--- a/templates/visualization/scatterplot.mako
+++ b/templates/visualization/scatterplot.mako
@@ -37,12 +37,14 @@
max-width: 256px;
}
-#chart-settings-form [value=Draw] {
- float: right;
+#chart-holder {
+ overflow: auto;
}
-#chart-holder {
- overflow: auto;
+#chart-settings-form #loading-indicator .loading-message {
+ margin-left: 16px;
+ font-style: italic;
+ color: grey;
}
svg .grid-line {
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: Fix for viewing a tool shed repository README in a changeset revision older than the tip.
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/00681c35d987/
changeset: 00681c35d987
user: greg
date: 2012-10-02 17:36:20
summary: Fix for viewing a tool shed repository README in a changeset revision older than the tip.
affected #: 3 files
diff -r fb35591b0273945610917c178255674bba0f9a21 -r 00681c35d987cde2200ff94c7f5510c594c904fd lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -1043,15 +1043,6 @@
if name == config_file:
return os.path.abspath( os.path.join( root, name ) )
return None
-def get_config_from_repository( app, config_file, repository, changeset_revision, dir, install_dir=None ):
- """Return config_filename if it exists in some changeset of the repository using only the repository and changeset_revision."""
- if install_dir is None:
- install_dir = repository.repo_path( app )
- repo_files_dir = os.path.join( install_dir, repository.name )
- repo = hg.repository( get_configured_ui(), repo_files_dir )
- ctx = get_changectx_for_changeset( repo, changeset_revision )
- config = get_config( config_file, repo, ctx, dir )
- return config
def get_configured_ui():
# Configure any desired ui settings.
_ui = ui.ui()
@@ -1140,6 +1131,13 @@
if deleted:
return 'DELETED'
return None
+def get_file_from_changeset_revision( app, repository, repo_files_dir, changeset_revision, file_name, dir ):
+ """Return file_name from the received changeset_revision of the repository manifest."""
+ stripped_file_name = strip_path( file_name )
+ repo = hg.repository( get_configured_ui(), repo_files_dir )
+ ctx = get_changectx_for_changeset( repo, changeset_revision )
+ named_tmp_file = get_named_tmpfile_from_ctx( ctx, file_name, dir )
+ return named_tmp_file
def get_list_of_copied_sample_files( repo, ctx, dir ):
"""
Find all sample files (files in the repository with the special .sample extension) in the reversed repository manifest up to ctx. Copy
diff -r fb35591b0273945610917c178255674bba0f9a21 -r 00681c35d987cde2200ff94c7f5510c594c904fd lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -624,10 +624,7 @@
status = 'error'
else:
tool, message, sample_files = handle_sample_files_and_load_tool_from_tmp_config( trans, repo, changeset_revision, tool_config_filename, work_dir )
- try:
- shutil.rmtree( work_dir )
- except:
- pass
+ remove_dir( work_dir )
trans.app.config.tool_data_path = original_tool_data_path
# Reset the tool_data_tables by loading the empty tool_data_table_conf.xml file.
reset_tool_data_tables( trans.app )
@@ -685,6 +682,12 @@
return True
# The received metadata_dict includes no metadata for workflows, so a new repository_metadata table record is not needed.
return False
+def remove_dir( dir ):
+ if os.path.exists( dir ):
+ try:
+ shutil.rmtree( dir )
+ except:
+ pass
def reset_all_metadata_on_repository( trans, id, **kwd ):
def reset_all_tool_versions( trans, id, repo ):
changeset_revisions = []
@@ -799,11 +802,7 @@
changeset_revisions.append( metadata_changeset_revision )
ancestor_changeset_revision = None
ancestor_metadata_dict = None
- if os.path.exists( work_dir ):
- try:
- shutil.rmtree( work_dir )
- except:
- pass
+ remove_dir( work_dir )
# Delete all repository_metadata records for this repository that do not have a changeset_revision value in changeset_revisions.
clean_repository_metadata( trans, id, changeset_revisions )
# Set tool version information for all downloadable changeset revisions. Get the list of changeset revisions from the changelog.
diff -r fb35591b0273945610917c178255674bba0f9a21 -r 00681c35d987cde2200ff94c7f5510c594c904fd lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -9,8 +9,8 @@
from galaxy.web.framework.helpers import time_ago, iff, grids
from galaxy.util.json import from_json_string, to_json_string
from galaxy.model.orm import *
-from galaxy.util.shed_util import create_repo_info_dict, get_changectx_for_changeset, get_configured_ui, get_repository_file_contents
-from galaxy.util.shed_util import get_repository_metadata_by_changeset_revision, handle_sample_files_and_load_tool_from_disk
+from galaxy.util.shed_util import create_repo_info_dict, get_changectx_for_changeset, get_configured_ui, get_file_from_changeset_revision
+from galaxy.util.shed_util import get_repository_file_contents, get_repository_metadata_by_changeset_revision, handle_sample_files_and_load_tool_from_disk
from galaxy.util.shed_util import handle_sample_files_and_load_tool_from_tmp_config, INITIAL_CHANGELOG_HASH, load_tool_from_config, NOT_TOOL_CONFIGS
from galaxy.util.shed_util import open_repository_files_folder, reversed_lower_upper_bounded_changelog, reversed_upper_bounded_changelog, strip_path
from galaxy.util.shed_util import to_html_escaped, translate_string, update_repository, url_join
@@ -2184,9 +2184,32 @@
repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_revision )
metadata = repository_metadata.metadata
if metadata and 'readme' in metadata:
- f = open( metadata[ 'readme' ], 'r' )
- raw_text = f.read()
- f.close()
+ readme_file = str( metadata[ 'readme' ] )
+ repo_files_dir = repository.repo_path
+ try:
+ f = open( readme_file, 'r' )
+ raw_text = f.read()
+ f.close()
+ except IOError:
+ work_dir = tempfile.mkdtemp()
+ try:
+ manifest_readme_file = get_file_from_changeset_revision( trans.app,
+ repository,
+ repo_files_dir,
+ changeset_revision,
+ readme_file,
+ work_dir )
+ f = open( manifest_readme_file, 'r' )
+ raw_text = f.read()
+ f.close()
+ remove_dir( work_dir )
+ except Exception, e:
+ raw_text = "Error locating and reading this repository's README file '%s': %s" % ( readme_file, str( e ) )
+ log.debug( raw_text )
+ remove_dir( work_dir )
+ except Exception, e:
+ raw_text = "Error locating and reading this repository's README file '%s': %s" % ( readme_file, str( e ) )
+ log.debug( raw_text )
readme_text = translate_string( raw_text, to_html=True )
else:
readme_text = ''
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
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/fb35591b0273/
changeset: fb35591b0273
user: jgoecks
date: 2012-10-02 17:17:22
summary: Circster: show more data when zoomed in.
affected #: 2 files
diff -r 0445cd851094b8bad61d2a96f399538f74e5db03 -r fb35591b0273945610917c178255674bba0f9a21 static/scripts/viz/circster.js
--- a/static/scripts/viz/circster.js
+++ b/static/scripts/viz/circster.js
@@ -30,8 +30,7 @@
/**
* A label track.
*/
-// FIXME: merge with tracks.js LabelTrack
-var LabelTrack = Backbone.Model.extend({
+var CircsterLabelTrack = Backbone.Model.extend({
defaults: {
prefs: {
color: '#ccc'
@@ -51,6 +50,7 @@
this.dataset_arc_height = options.dataset_arc_height;
this.track_gap = 5;
this.label_arc_height = 20;
+ this.scale = 1;
},
render: function() {
@@ -63,7 +63,23 @@
init_radius_start = Math.min(width, height) / 2 -
this.model.get('tracks').length * (this.dataset_arc_height + this.track_gap) -
(this.label_arc_height + this.track_gap),
- tracks = this.model.get('tracks');
+ tracks = this.model.get('tracks'),
+
+ // Create a renderer for each track in the visualiation.
+ track_renderers = tracks.map(function(track, index) {
+ var radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
+ track_renderer_class = (track.get('track_type') === 'LineTrack' ?
+ CircsterBigWigTrackRenderer :
+ CircsterSummaryTreeTrackRenderer );
+
+ return new track_renderer_class({
+ track: track,
+ track_index: index,
+ radius_bounds: [radius_start, radius_start + dataset_arc_height],
+ genome: self.genome,
+ total_gap: self.total_gap
+ });
+ });
// Set up SVG element.
var svg = d3.select(self.$el[0])
@@ -74,78 +90,41 @@
// Set up zooming, dragging.
.append('svg:g')
.call(d3.behavior.zoom().on('zoom', function() {
- // Do zoom.
+ // Do zoom, drag.
+ var scale = d3.event.scale;
svg.attr("transform",
"translate(" + d3.event.translate + ")" +
- " scale(" + d3.event.scale + ")");
+ " scale(" + scale + ")");
- // Update visible elements with more data.
- var utils = new SVGUtils(),
- tracks_and_chroms_to_update = {};
-
- tracks.each(function(t) {
- tracks_and_chroms_to_update[t.id] = [];
- });
-
- d3.selectAll('path.chrom-data').filter(function(d, i) {
- return utils.is_visible(this, svg);
- }).each(function(d, i) {
- var elt_data = $.data(this, 'chrom_data');
- tracks_and_chroms_to_update[elt_data.track.id].push(elt_data.chrom);
- });
-
- /*
- _.each(_.pairs(tracks_and_chroms_to_update), function(track_and_chroms) {
- var track = tracks.get(track_and_chroms[0])
- chroms = track_and_chroms[1];
-
- _.each(chroms, function(chr_name) {
- var chr_region = self.genome.get_chrom_region(chr_name),
- data_deferred = track.get('data_manager').get_more_detailed_data(chr_region, 'Coverage', 0, d3.event.scale);
-
- $.when(data_deferred).then(function(data) {
- console.log("got more detailed data", data);
- })
- })
-
-
- });
-
- // TODO: update tracks and chroms.
- console.log(tracks_and_chroms_to_update);
- */
+ // Propagate scale changes to renderers.
+ if (self.scale !== scale) {
+ // Use timeout to wait for zooming/dragging to stop before rendering more detail.
+ if (self.zoom_drag_timeout) {
+ clearTimeout(self.zoom_drag_timeout);
+ }
+ self.zoom_drag_timeout = setTimeout(function() {
+ // Render more detail in tracks' visible elements.
+ _.each(track_renderers, function(renderer) {
+ renderer.update_scale(scale);
+ });
+ }, 400);
+ }
}))
.attr("transform", "translate(" + width / 2 + "," + height / 2 + ")")
.append('svg:g');
// -- Render each dataset in the visualization. --
- tracks.each(function(track, index) {
- var radius_start = init_radius_start + index * (dataset_arc_height + self.track_gap),
- track_renderer_class = (track.get('track_type') === 'LineTrack' ?
- CircsterBigWigTrackRenderer :
- CircsterSummaryTreeTrackRenderer );
-
- var track_renderer = new track_renderer_class({
- track: track,
- track_index: index,
- radius_start: radius_start,
- radius_end: radius_start + dataset_arc_height,
- genome: self.genome,
- total_gap: self.total_gap
- });
-
- track_renderer.render(svg);
-
+ _.each(track_renderers, function(renderer) {
+ renderer.render(svg);
});
// -- Render chromosome labels. --
var radius_start = init_radius_start + tracks.length * (dataset_arc_height + self.track_gap) + self.track_gap;
var chrom_labels_track = new CircsterLabelTrackRenderer({
- track: new LabelTrack(),
+ track: new CircsterLabelTrack(),
track_index: tracks.length,
- radius_start: radius_start,
- radius_end: radius_start,
+ radius_bounds: [radius_start, radius_start],
genome: self.genome,
total_gap: self.total_gap
});
@@ -154,27 +133,38 @@
}
});
-var CircsterTrackRenderer = Base.extend( {
+/**
+ * Renders a track in a Circster visualization.
+ */
+var CircsterTrackRenderer = Base.extend({
+
+ /* ----------------------- Public Methods ------------------------- */
initialize: function(options) {
this.options = options;
this.options.bg_stroke = 'ccc';
this.options.bg_fill = 'ccc';
+ this.options.chroms_layout = this._chroms_layout();
+ this.options.data_bounds = this.get_data_bounds(this.options.track.get_genome_wide_data(this.options.genome));
+ this.options.scale = 1;
+ this.options.parent_elt = null;
},
- render: function(svg) {
+ /**
+ * Render track's data by adding SVG elements to parent.
+ */
+ render: function(parent) {
// Create track group element.
- var track_group_elt = svg.append("g").attr("id", "parent-" + this.options.track_index);
+ this.options.parent_elt = parent.append("g").attr("id", "parent-" + this.options.track_index);
+ var track_parent_elt = this.options.parent_elt;
// Render background arcs.
- var genome_arcs = this._chroms_layout(),
- radius_start = this.options.radius_start,
- radius_end = this.options.radius_end,
+ var genome_arcs = this.options.chroms_layout,
arc_gen = d3.svg.arc()
- .innerRadius(radius_start)
- .outerRadius(radius_end),
+ .innerRadius(this.options.radius_bounds[0])
+ .outerRadius(this.options.radius_bounds[1]),
- chroms_elts = track_group_elt.selectAll('g')
+ chroms_elts = track_parent_elt.selectAll('g')
.data(genome_arcs).enter().append('svg:g');
// Draw arcs.
@@ -185,16 +175,112 @@
.append("title").text(function(d) { return d.data.chrom; });
// Render track data.
- this.render_data(track_group_elt);
+ this._render_data(track_parent_elt);
// Apply prefs.
var prefs = this.options.track.get('prefs'),
block_color = prefs.block_color;
if (!block_color) { block_color = prefs.color; }
- track_group_elt.selectAll('path.chrom-data').style('stroke', block_color).style('fill', block_color);
+ track_parent_elt.selectAll('path.chrom-data').style('stroke', block_color).style('fill', block_color);
},
/**
+ * Update renderer scale. This fetches more data if scale is increased.
+ */
+ update_scale: function(new_scale) {
+ // -- Update scale and return if new scale is less than old scale. --
+
+ var old_scale = this.options.scale;
+ this.options.scale = new_scale;
+ if (new_scale <= old_scale) {
+ return;
+ }
+
+ // -- Scale increased, so render visible data with more detail. --
+
+ var self = this,
+ utils = new SVGUtils();
+
+ // Select all chrom data and filter to operate on those that are visible.
+ this.options.parent_elt.selectAll('path.chrom-data').filter(function(d, i) {
+ return utils.is_visible(this);
+ }).each(function(d, i) {
+ // Now operating on a single path element representing chromosome data.
+ var path_elt = d3.select(this),
+ chrom = path_elt.attr('chrom'),
+ chrom_region = self.options.genome.get_chrom_region(chrom),
+
+ // Get more detailde data for chrom.
+ data_deferred = self.options.track.get('data_manager').get_more_detailed_data(chrom_region, 'Coverage', 0, new_scale);
+
+ // When more data is available, use new data to redraw path.
+ $.when(data_deferred).then(function(data) {
+ // Remove current data path.
+ path_elt.remove();
+
+ // Update data bounds with new data.
+ self._update_data_bounds();
+
+ // Find chromosome arc to draw data on.
+ var chrom_arc = _.find(self.options.chroms_layout, function(layout) {
+ return layout.data.chrom === chrom;
+ });
+
+ // Add new data path and apply preferences.
+ var prefs = self.options.track.get('prefs'),
+ block_color = prefs.block_color;
+ if (!block_color) { block_color = prefs.color; }
+ self._render_chrom_data(self.options.parent_elt, chrom_arc, data).style('stroke', block_color).style('fill', block_color);
+ });
+ });
+
+ return self;
+ },
+
+ /* ----------------------- Internal Methods ------------------------- */
+
+ /**
+ * Update data bounds.
+ */
+ _update_data_bounds: function() {
+ this.options.data_bounds = this.get_data_bounds(this.options.track.get_genome_wide_data(this.options.genome));
+
+ // TODO: transition all paths to use the new data bounds.
+ },
+
+ /**
+ * Render data as elements attached to svg.
+ */
+ _render_data: function(svg) {
+ var self = this,
+ chrom_arcs = this.options.chroms_layout,
+ track = this.options.track,
+ genome_wide_data = track.get_genome_wide_data(this.options.genome),
+
+ // Merge chroms layout with data.
+ layout_and_data = _.zip(chrom_arcs, genome_wide_data),
+
+ // Render each chromosome's data.
+ chroms_data_layout = _.map(layout_and_data, function(chrom_info) {
+ var chrom_arc = chrom_info[0],
+ data = chrom_info[1];
+ return self._render_chrom_data(svg, chrom_arc, data);
+ });
+
+ return svg;
+ },
+
+ /**
+ * Render a chromosome data and attach elements to svg.
+ */
+ _render_chrom_data: function(svg, chrom_arc, data) {},
+
+ /**
+ * Returns data for creating a path for the given data using chrom_arc and data bounds.
+ */
+ _compute_path_data: function(chrom_arc, data) {},
+
+ /**
* Returns arc layouts for genome's chromosomes/contigs. Arcs are arranged in a circle
* separated by gaps.
*/
@@ -211,42 +297,6 @@
return arc;
});
return chrom_arcs;
- },
-
- /**
- * Render chromosome data and attach elements to svg.
- */
- render_chrom_data: function(svg, chrom_arc, data, inner_radius, outer_radius, max) {
- },
-
- /**
- * Render data as elements attached to svg.
- */
- render_data: function(svg) {
- var self = this,
- chrom_arcs = this._chroms_layout(),
- track = this.options.track,
- r_start = this.options.radius_start,
- r_end = this.options.radius_end,
-
- genome_wide_data = track.get_genome_wide_data(this.options.genome),
-
- // Merge chroms layout with data.
- layout_and_data = _.zip(chrom_arcs, genome_wide_data),
-
- // Get min, max in data.
- bounds = this.get_bounds(genome_wide_data),
-
- // Do dataset layout for each chromosome's data using pie layout.
- chroms_data_layout = _.map(layout_and_data, function(chrom_info) {
- var chrom_arc = chrom_info[0],
- data = chrom_info[1];
- return self.render_chrom_data(svg, chrom_arc, data,
- r_start, r_end,
- bounds.min, bounds.max);
- });
-
- return chroms_data_layout;
}
});
@@ -259,18 +309,19 @@
this.options = options;
this.options.bg_stroke = 'fff';
this.options.bg_fill = 'fff';
+ this.options.chroms_layout = this._chroms_layout();
},
/**
* Render labels.
*/
- render_data: function(svg) {
+ _render_data: function(svg) {
// Add chromosome label where it will fit; an alternative labeling mechanism
// would be nice for small chromosomes.
var chrom_arcs = svg.selectAll('g');
chrom_arcs.selectAll('path')
- .attr('id', function(d) { return 'label-' + d.data.chrom; })
+ .attr('id', function(d) { return 'label-' + d.data.chrom; });
chrom_arcs.append("svg:text")
.filter(function(d) {
@@ -295,46 +346,56 @@
* Renders quantitative data with the form [x, value] and assumes data is equally spaced across
* chromosome. Attachs a dict with track and chrom name information to DOM element.
*/
- render_quantitative_data: function(svg, chrom_arc, data, inner_radius, outer_radius, min, max) {
+ _render_chrom_data: function(svg, chrom_arc, chrom_data) {
+ // If no chrom data, return null.
+ if (!chrom_data || typeof chrom_data === "string" || chrom_data.data.length === 0) {
+ return null;
+ }
+
+ var path_data = this._compute_path_data(chrom_arc, chrom_data.data);
+
+ // Render data.
+ var parent = svg.datum(chrom_data.data),
+ path = parent.append('path')
+ .attr('class', 'chrom-data')
+ .attr('chrom', chrom_arc.data.chrom)
+ .attr('d', path_data);
+
+ return path;
+ },
+
+ /**
+ * Returns data for creating a path for the given data using chrom_arc, radius bounds, and data bounds.
+ */
+ _compute_path_data: function(chrom_arc, data) {
// Radius scaler.
var radius = d3.scale.linear()
- .domain([min, max])
- .range([inner_radius, outer_radius]);
+ .domain(this.options.data_bounds)
+ .range(this.options.radius_bounds);
// Scaler for placing data points across arc.
var angle = d3.scale.linear()
.domain([0, data.length])
.range([chrom_arc.startAngle, chrom_arc.endAngle]);
+ // Use line generator to create area.
var line = d3.svg.line.radial()
.interpolate("linear")
.radius(function(d) { return radius(d[1]); })
.angle(function(d, i) { return angle(i); });
- var area = d3.svg.area.radial()
+ return d3.svg.area.radial()
.interpolate(line.interpolate())
.innerRadius(radius(0))
.outerRadius(line.radius())
.angle(line.angle());
-
- // Render data.
- var parent = svg.datum(data),
- path = parent.append("path")
- .attr("class", "chrom-data")
- .attr("d", area);
-
- // Attach dict with track and chrom info for path.
- $.data(path[0][0], "chrom_data", {
- track: this.options.track,
- chrom: chrom_arc.data.chrom
- });
},
/**
- * Returns an object with min, max attributes denoting the minimum and maximum
+ * Returns an array with two values denoting the minimum and maximum
* values for the track.
*/
- get_bounds: function() {}
+ get_data_bounds: function(data) {}
});
@@ -342,29 +403,14 @@
* Layout for summary tree data in a circster visualization.
*/
var CircsterSummaryTreeTrackRenderer = CircsterQuantitativeTrackRenderer.extend({
-
- /**
- * Renders a chromosome's data.
- */
- render_chrom_data: function(svg, chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
- // If no chrom data, return null.
- if (!chrom_data || typeof chrom_data === "string") {
- return null;
- }
- return this.render_quantitative_data(svg, chrom_arc, chrom_data.data, inner_radius, outer_radius, min, max);
- },
-
- get_bounds: function(data) {
+ get_data_bounds: function(data) {
// Get max across data.
var max_data = _.map(data, function(d) {
if (!d || typeof d === 'string') { return 0; }
return d.max;
});
- return {
- min: 0,
- max: (max_data && typeof max_data !== 'string' ? _.max(max_data) : 0)
- };
+ return [ 0, (max_data && typeof max_data !== 'string' ? _.max(max_data) : 0) ];
}
});
@@ -372,18 +418,8 @@
* Layout for BigWig data in a circster visualization.
*/
var CircsterBigWigTrackRenderer = CircsterQuantitativeTrackRenderer.extend({
-
- /**
- * Renders a chromosome's data.
- */
- render_chrom_data: function(svg, chrom_arc, chrom_data, inner_radius, outer_radius, min, max) {
- var data = chrom_data.data;
- if (data.length === 0) { return; }
- return this.render_quantitative_data(svg, chrom_arc, data, inner_radius, outer_radius, min, max);
- },
-
- get_bounds: function(data) {
+ get_data_bounds: function(data) {
// Set max across dataset by extracting all values, flattening them into a
// single array, and getting the min and max.
var values = _.flatten( _.map(data, function(d) {
@@ -398,13 +434,11 @@
}
}) );
- return {
- min: _.min(values),
- max: _.max(values)
- };
+ return [ _.min(values), _.max(values) ];
}
});
+// Module exports.
return {
CircsterView: CircsterView
};
diff -r 0445cd851094b8bad61d2a96f399538f74e5db03 -r fb35591b0273945610917c178255674bba0f9a21 static/scripts/viz/visualization.js
--- a/static/scripts/viz/visualization.js
+++ b/static/scripts/viz/visualization.js
@@ -356,7 +356,7 @@
extra_params.num_samples = cur_data.data.length * detail_multiplier;
}
else if (cur_data.dataset_type === 'summary_tree') {
- extra_params.level = cur_data.level + 1;
+ extra_params.level = Math.min(cur_data.level - 1, 2);
}
return this.load_data(region, mode, resolution, extra_params);
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: inithello: Import missing utility methods from the admin controller.
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/0445cd851094/
changeset: 0445cd851094
user: inithello
date: 2012-10-02 16:30:38
summary: Import missing utility methods from the admin controller.
affected #: 1 file
diff -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c -r 0445cd851094b8bad61d2a96f399538f74e5db03 lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -11,6 +11,7 @@
from galaxy.util.shed_util import handle_sample_files_and_load_tool_from_tmp_config, handle_sample_tool_data_table_conf_file, INITIAL_CHANGELOG_HASH
from galaxy.util.shed_util import load_tool_from_config, reset_tool_data_tables, reversed_upper_bounded_changelog, strip_path
from galaxy.web.base.controller import *
+from galaxy.web.base.controllers.admin import *
from galaxy.webapps.community import model
from galaxy.model.orm import *
from galaxy.model.item_attrs import UsesItemRatings
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: Fixes for tool shed features broken due to the elimination of the ability to use the webapp param.
by Bitbucket 02 Oct '12
by Bitbucket 02 Oct '12
02 Oct '12
1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/changeset/c3a9547df6f1/
changeset: c3a9547df6f1
user: greg
date: 2012-10-02 15:47:06
summary: Fixes for tool shed features broken due to the elimination of the ability to use the webapp param.
affected #: 33 files
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/tool_shed/install_manager.py
--- a/lib/galaxy/tool_shed/install_manager.py
+++ b/lib/galaxy/tool_shed/install_manager.py
@@ -138,8 +138,7 @@
relative_install_dir=relative_install_dir,
repository_files_dir=None,
resetting_all_metadata_on_repository=False,
- updating_installed_repository=False,
- webapp='galaxy' )
+ updating_installed_repository=False )
tool_shed_repository.metadata = metadata_dict
self.app.sa_session.add( tool_shed_repository )
self.app.sa_session.flush()
@@ -260,7 +259,7 @@
tool_shed_repository,
self.app.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS )
# Get the tool_versions from the tool shed for each tool in the installed change set.
- url = '%s/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ url = '%s/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s' % \
( tool_shed_url, tool_shed_repository.name, self.repository_owner, installed_changeset_revision )
response = urllib2.urlopen( url )
text = response.read()
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/tool_shed/migrate/common.py
--- a/lib/galaxy/tool_shed/migrate/common.py
+++ b/lib/galaxy/tool_shed/migrate/common.py
@@ -30,7 +30,7 @@
tool_dependencies_dict = {}
repository_name = elem.get( 'name' )
changeset_revision = elem.get( 'changeset_revision' )
- url = '%s/repository/get_tool_dependencies?name=%s&owner=%s&changeset_revision=%s&webapp=install_manager' % \
+ url = '%s/repository/get_tool_dependencies?name=%s&owner=%s&changeset_revision=%s&from_install_manager=True' % \
( tool_shed_url, repository_name, REPOSITORY_OWNER, changeset_revision )
try:
response = urllib2.urlopen( url )
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/tool_shed/update_manager.py
--- a/lib/galaxy/tool_shed/update_manager.py
+++ b/lib/galaxy/tool_shed/update_manager.py
@@ -34,7 +34,7 @@
log.info( 'Transfer job restarter shutting down...' )
def check_for_update( self, repository ):
tool_shed_url = get_url_from_repository_tool_shed( self.app, repository )
- url = '%s/repository/check_for_updates?name=%s&owner=%s&changeset_revision=%s&webapp=update_manager' % \
+ url = '%s/repository/check_for_updates?name=%s&owner=%s&changeset_revision=%s&from_update_manager=True' % \
( tool_shed_url, repository.name, repository.owner, repository.changeset_revision )
try:
response = urllib2.urlopen( url )
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/util/shed_util.py
--- a/lib/galaxy/util/shed_util.py
+++ b/lib/galaxy/util/shed_util.py
@@ -297,7 +297,7 @@
# tag for any tool in the repository.
break
return can_generate_dependency_metadata
-def check_tool_input_params( app, repo_dir, tool_config_name, tool, sample_files, webapp='galaxy' ):
+def check_tool_input_params( app, repo_dir, tool_config_name, tool, sample_files ):
"""
Check all of the tool's input parameters, looking for any that are dynamically generated using external data files to make
sure the files exist.
@@ -602,7 +602,7 @@
tool_dependencies_dict[ 'set_environment' ] = [ requirements_dict ]
return tool_dependencies_dict
def generate_metadata_for_changeset_revision( app, repository, repository_clone_url, relative_install_dir=None, repository_files_dir=None,
- resetting_all_metadata_on_repository=False, updating_installed_repository=False, webapp='galaxy' ):
+ resetting_all_metadata_on_repository=False, updating_installed_repository=False ):
"""
Generate metadata for a repository using it's files on disk. To generate metadata for changeset revisions older than the repository tip,
the repository will have been cloned to a temporary location and updated to a specified changeset revision to access that changeset revision's
@@ -695,7 +695,7 @@
if not valid:
invalid_file_tups.append( ( name, error_message ) )
else:
- invalid_files_and_errors_tups = check_tool_input_params( app, files_dir, name, tool, sample_file_metadata_paths, webapp=webapp )
+ invalid_files_and_errors_tups = check_tool_input_params( app, files_dir, name, tool, sample_file_metadata_paths )
can_set_metadata = True
for tup in invalid_files_and_errors_tups:
if name in tup:
@@ -1115,7 +1115,7 @@
return manifest_ctx, ctx_file
return None, None
def get_ctx_rev( tool_shed_url, name, owner, changeset_revision ):
- url = url_join( tool_shed_url, 'repository/get_ctx_rev?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % ( name, owner, changeset_revision ) )
+ url = url_join( tool_shed_url, 'repository/get_ctx_rev?name=%s&owner=%s&changeset_revision=%s' % ( name, owner, changeset_revision ) )
response = urllib2.urlopen( url )
ctx_rev = response.read()
response.close()
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/community/controllers/admin.py
--- a/lib/galaxy/webapps/community/controllers/admin.py
+++ b/lib/galaxy/webapps/community/controllers/admin.py
@@ -69,7 +69,7 @@
columns = [
UserLoginColumn( "Email",
key="email",
- link=( lambda item: dict( operation="information", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="information", id=item.id ) ),
attach_popup=True,
filterable="advanced" ),
UserNameColumn( "User Name",
@@ -93,18 +93,18 @@
filterable="standard" ) )
global_actions = [
grids.GridAction( "Create new user",
- dict( controller='admin', action='users', operation='create', webapp="community" ) )
+ dict( controller='admin', action='users', operation='create' ) )
]
operations = [
grids.GridOperation( "Manage Roles and Groups",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( webapp="community", action="manage_roles_and_groups_for_user" ) ),
+ url_args=dict( action="manage_roles_and_groups_for_user" ) ),
grids.GridOperation( "Reset Password",
condition=( lambda item: not item.deleted ),
allow_multiple=True,
allow_popup=False,
- url_args=dict( webapp="community", action="reset_user_password" ) )
+ url_args=dict( action="reset_user_password" ) )
]
standard_filters = [
grids.GridColumnFilter( "Active", args=dict( deleted=False ) ),
@@ -119,8 +119,7 @@
return trans.user
class RoleListGrid( grids.Grid ):
- # TODO: move this to an admin_common controller since it is virtually the same
- # in the galaxy webapp.
+ # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp.
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, role ):
return role.name
@@ -156,7 +155,7 @@
columns = [
NameColumn( "Name",
key="name",
- link=( lambda item: dict( operation="Manage users and groups", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="Manage users and groups", id=item.id ) ),
attach_popup=True,
filterable="advanced" ),
DescriptionColumn( "Description",
@@ -183,24 +182,24 @@
filterable="standard" ) )
global_actions = [
grids.GridAction( "Add new role",
- dict( controller='admin', action='roles', operation='create', webapp="community" ) )
+ dict( controller='admin', action='roles', operation='create' ) )
]
operations = [ grids.GridOperation( "Rename",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( webapp="community", action="rename_role" ) ),
+ url_args=dict( action="rename_role" ) ),
grids.GridOperation( "Delete",
condition=( lambda item: not item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="mark_role_deleted" ) ),
+ url_args=dict( action="mark_role_deleted" ) ),
grids.GridOperation( "Undelete",
condition=( lambda item: item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="undelete_role" ) ),
+ url_args=dict( action="undelete_role" ) ),
grids.GridOperation( "Purge",
condition=( lambda item: item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="purge_role" ) ) ]
+ url_args=dict( action="purge_role" ) ) ]
standard_filters = [
grids.GridColumnFilter( "Active", args=dict( deleted=False ) ),
grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
@@ -213,8 +212,7 @@
return query.filter( model.Role.type != model.Role.types.PRIVATE )
class GroupListGrid( grids.Grid ):
- # TODO: move this to an admin_common controller since it is virtually the same
- # in the galaxy webapp.
+ # TODO: move this to an admin_common controller since it is virtually the same in the galaxy webapp.
class NameColumn( grids.TextColumn ):
def get_value( self, trans, grid, group ):
return group.name
@@ -242,7 +240,7 @@
columns = [
NameColumn( "Name",
#key="name",
- link=( lambda item: dict( operation="Manage users and roles", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="Manage users and roles", id=item.id ) ),
attach_popup=True
#filterable="advanced"
),
@@ -262,24 +260,24 @@
filterable="standard" ) )
global_actions = [
grids.GridAction( "Add new group",
- dict( controller='admin', action='groups', operation='create', webapp="community" ) )
+ dict( controller='admin', action='groups', operation='create' ) )
]
operations = [ grids.GridOperation( "Rename",
condition=( lambda item: not item.deleted ),
allow_multiple=False,
- url_args=dict( webapp="community", action="rename_group" ) ),
+ url_args=dict( action="rename_group" ) ),
grids.GridOperation( "Delete",
condition=( lambda item: not item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="mark_group_deleted" ) ),
+ url_args=dict( action="mark_group_deleted" ) ),
grids.GridOperation( "Undelete",
condition=( lambda item: item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="undelete_group" ) ),
+ url_args=dict( action="undelete_group" ) ),
grids.GridOperation( "Purge",
condition=( lambda item: item.deleted ),
allow_multiple=True,
- url_args=dict( webapp="community", action="purge_group" ) ) ]
+ url_args=dict( action="purge_group" ) ) ]
standard_filters = [
grids.GridColumnFilter( "Active", args=dict( deleted=False ) ),
grids.GridColumnFilter( "Deleted", args=dict( deleted=True ) ),
@@ -294,12 +292,12 @@
# Override the NameColumn to include an Edit link
columns[ 0 ] = CategoryListGrid.NameColumn( "Name",
key="Category.name",
- link=( lambda item: dict( operation="Edit", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="Edit", id=item.id ) ),
model_class=model.Category,
attach_popup=False )
global_actions = [
grids.GridAction( "Add new category",
- dict( controller='admin', action='manage_categories', operation='create', webapp="community" ) )
+ dict( controller='admin', action='manage_categories', operation='create' ) )
]
class AdminRepositoryListGrid( RepositoryListGrid ):
@@ -377,9 +375,7 @@
NameColumn( "Name",
key="name",
model_class=model.Repository,
- link=( lambda item: dict( operation="view_or_manage_repository_revision",
- id=item.id,
- webapp="community" ) ),
+ link=( lambda item: dict( operation="view_or_manage_repository_revision", id=item.id ) ),
attach_popup=True ),
RevisionColumn( "Revision",
attach_popup=False ),
@@ -716,7 +712,6 @@
"repository" ) )
trans.response.send_redirect( web.url_for( controller='admin',
action='browse_repository_metadata',
- webapp='community',
message=util.sanitize_text( message ),
status=status ) )
else:
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/community/controllers/common.py
--- a/lib/galaxy/webapps/community/controllers/common.py
+++ b/lib/galaxy/webapps/community/controllers/common.py
@@ -612,8 +612,7 @@
repo_files_dir,
tool_config_filename,
tool,
- sample_files,
- webapp='community' )
+ sample_files )
if invalid_files_and_errors_tups:
message2 = generate_message_for_invalid_tools( invalid_files_and_errors_tups,
repository,
@@ -753,8 +752,7 @@
relative_install_dir=repo_dir,
repository_files_dir=work_dir,
resetting_all_metadata_on_repository=True,
- updating_installed_repository=False,
- webapp='community' )
+ updating_installed_repository=False )
if current_metadata_dict:
if not metadata_changeset_revision and not metadata_dict:
# We're at the first change set in the change log.
@@ -829,8 +827,7 @@
relative_install_dir=repo_dir,
repository_files_dir=None,
resetting_all_metadata_on_repository=False,
- updating_installed_repository=False,
- webapp='community' )
+ updating_installed_repository=False )
if metadata_dict:
downloadable = is_downloadable( metadata_dict )
repository_metadata = None
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/community/controllers/repository.py
--- a/lib/galaxy/webapps/community/controllers/repository.py
+++ b/lib/galaxy/webapps/community/controllers/repository.py
@@ -49,7 +49,7 @@
columns = [
NameColumn( "Name",
key="Category.name",
- link=( lambda item: dict( operation="repositories_by_category", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="repositories_by_category", id=item.id ) ),
attach_popup=False ),
DescriptionColumn( "Description",
key="Category.description",
@@ -87,7 +87,7 @@
columns = [
CategoryListGrid.NameColumn( "Name",
key="Category.name",
- link=( lambda item: dict( operation="valid_repositories_by_category", id=item.id, webapp="galaxy" ) ),
+ link=( lambda item: dict( operation="valid_repositories_by_category", id=item.id ) ),
attach_popup=False ),
CategoryListGrid.DescriptionColumn( "Description",
key="Category.description",
@@ -136,7 +136,7 @@
rval = '<ul>'
if repository.categories:
for rca in repository.categories:
- rval += '<li><a href="browse_repositories?operation=repositories_by_category&id=%s&webapp=community">%s</a></li>' \
+ rval += '<li><a href="browse_repositories?operation=repositories_by_category&id=%s">%s</a></li>' \
% ( trans.security.encode_id( rca.category.id ), rca.category.name )
else:
rval += '<li>not set</li>'
@@ -173,8 +173,7 @@
NameColumn( "Name",
key="name",
link=( lambda item: dict( operation="view_or_manage_repository",
- id=item.id,
- webapp="community" ) ),
+ id=item.id ) ),
attach_popup=True ),
DescriptionColumn( "Synopsis",
key="description",
@@ -187,7 +186,7 @@
attach_popup=False ),
UserColumn( "Owner",
model_class=model.User,
- link=( lambda item: dict( operation="repositories_by_user", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="repositories_by_user", id=item.id ) ),
attach_popup=False,
key="User.username" ),
grids.CommunityRatingColumn( "Average Rating", key="rating" ),
@@ -231,15 +230,14 @@
RepositoryListGrid.NameColumn( "Name",
key="name",
link=( lambda item: dict( operation="view_or_manage_repository",
- id=item.id,
- webapp="community" ) ),
+ id=item.id ) ),
attach_popup=False ),
RepositoryListGrid.DescriptionColumn( "Synopsis",
key="description",
attach_popup=False ),
RepositoryListGrid.UserColumn( "Owner",
model_class=model.User,
- link=( lambda item: dict( operation="repositories_by_user", id=item.id, webapp="community" ) ),
+ link=( lambda item: dict( operation="repositories_by_user", id=item.id ) ),
attach_popup=False,
key="User.username" ),
RepositoryListGrid.EmailAlertsColumn( "Alert", attach_popup=False ),
@@ -254,7 +252,7 @@
condition=( lambda item: not item.deleted ),
async_compatible=False ) ]
global_actions = [
- grids.GridAction( "User preferences", dict( controller='user', action='index', cntrller='repository', webapp='community' ) )
+ grids.GridAction( "User preferences", dict( controller='user', action='index', cntrller='repository' ) )
]
class WritableRepositoryListGrid( RepositoryListGrid ):
@@ -285,7 +283,7 @@
rval = '<ul>'
if repository.categories:
for rca in repository.categories:
- rval += '<li><a href="browse_repositories?operation=valid_repositories_by_category&id=%s&webapp=galaxy">%s</a></li>' \
+ rval += '<li><a href="browse_repositories?operation=valid_repositories_by_category&id=%s">%s</a></li>' \
% ( trans.security.encode_id( rca.category.id ), rca.category.name )
else:
rval += '<li>not set</li>'
@@ -372,9 +370,7 @@
default_sort_key = "Repository.name"
columns = [
NameColumn( "Repository name",
- link=( lambda item: dict( operation="view_or_manage_repository",
- id=item.id,
- webapp="community" ) ),
+ link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ),
attach_popup=True ),
DescriptionColumn( "Synopsis",
attach_popup=False ),
@@ -414,9 +410,7 @@
columns = [ col for col in MatchedRepositoryListGrid.columns ]
# Override the NameColumn
columns[ 0 ] = MatchedRepositoryListGrid.NameColumn( "Name",
- link=( lambda item: dict( operation="view_or_manage_repository",
- id=item.id,
- webapp="galaxy" ) ),
+ link=( lambda item: dict( operation="view_or_manage_repository", id=item.id ) ),
attach_popup=False )
class RepositoryController( BaseUIController, ItemRatings ):
@@ -481,7 +475,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
cntrller = params.get( 'cntrller', 'repository' )
is_admin = trans.user_is_admin()
invalid_tools_dict = odict()
@@ -514,15 +507,12 @@
return trans.fill_template( '/webapps/community/repository/browse_invalid_tools.mako',
cntrller=cntrller,
invalid_tools_dict=invalid_tools_dict,
- webapp=webapp,
message=message,
status=status )
@web.expose
def browse_repositories( self, trans, **kwd ):
# We add params to the keyword dict in this method in order to rename the param with an "f-" prefix, simulating filtering by clicking a search
# link. We have to take this approach because the "-" character is illegal in HTTP requests.
- if 'webapp' not in kwd:
- kwd[ 'webapp' ] = get_webapp( trans, **kwd )
if 'operation' in kwd:
operation = kwd['operation'].lower()
if operation == "view_or_manage_repository":
@@ -606,7 +596,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
commit_message = util.restore_text( params.get( 'commit_message', 'Deleted selected files' ) )
repository = get_repository( trans, id )
repo = hg.repository( get_configured_ui(), repository.repo_path )
@@ -619,7 +608,6 @@
metadata=metadata,
commit_message=commit_message,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status=status )
@web.expose
@@ -631,7 +619,7 @@
if 'f-free-text-search' in kwd:
if kwd[ 'f-free-text-search' ] == 'All':
# The user performed a search, then clicked the "x" to eliminate the search criteria.
- new_kwd = dict( webapp='galaxy' )
+ new_kwd = {}
return self.valid_category_list_grid( trans, **new_kwd )
# Since we are searching valid repositories and not categories, redirect to browse_valid_repositories().
if 'id' in kwd and 'f-free-text-search' in kwd and kwd[ 'id' ] == kwd[ 'f-free-text-search' ]:
@@ -656,7 +644,6 @@
return self.valid_category_list_grid( trans, **kwd )
@web.expose
def browse_valid_repositories( self, trans, **kwd ):
- webapp = get_webapp( trans, **kwd )
galaxy_url = kwd.get( 'galaxy_url', None )
if 'f-free-text-search' in kwd:
if 'f-Category.name' in kwd:
@@ -676,7 +663,6 @@
latest_installable_changeset_revision = repository_metadata.changeset_revision
return trans.response.send_redirect( web.url_for( controller='repository',
action='preview_tools_in_changeset',
- webapp=webapp,
repository_id=repository_id,
changeset_revision=latest_installable_changeset_revision ) )
elif operation == "valid_repositories_by_category":
@@ -700,12 +686,10 @@
if repository.tip != v:
return trans.response.send_redirect( web.url_for( controller='repository',
action='preview_tools_in_changeset',
- webapp=webapp,
repository_id=trans.security.encode_id( repository.id ),
changeset_revision=v ) )
url_args = dict( action='browse_valid_repositories',
operation='preview_tools_in_changeset',
- webapp=webapp,
repository_id=repository_id )
self.valid_repository_list_grid.operations = [ grids.GridOperation( "Preview and install",
url_args=url_args,
@@ -745,10 +729,7 @@
shutil.move( tmp_fname, os.path.abspath( hgweb_config ) )
@web.expose
def check_for_updates( self, trans, **kwd ):
- """
- Handle a request from a local Galaxy instance. If the request originated with the Galaxy instances' UpdateManager, the value of 'webapp'
- will be 'update_manager'.
- """
+ """Handle a request from a local Galaxy instance."""
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -757,14 +738,13 @@
name = params.get( 'name', None )
owner = params.get( 'owner', None )
changeset_revision = params.get( 'changeset_revision', None )
- webapp = get_webapp( trans, **kwd )
repository = get_repository_by_name_and_owner( trans, name, owner )
repo_dir = repository.repo_path
repo = hg.repository( get_configured_ui(), repo_dir )
# Default to the current changeset revision.
update_to_ctx = get_changectx_for_changeset( repo, changeset_revision )
latest_changeset_revision = changeset_revision
- from_update_manager = webapp == 'update_manager'
+ from_update_manager = kwd.get( 'from_update_manager', False )
if from_update_manager:
update = 'true'
no_update = 'false'
@@ -923,7 +903,6 @@
message = "Repository '%s' has been created." % repository.name
trans.response.send_redirect( web.url_for( controller='repository',
action='view_repository',
- webapp='community',
message=message,
id=trans.security.encode_id( repository.id ) ) )
return trans.fill_template( '/webapps/community/repository/create_repository.mako',
@@ -939,7 +918,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
repository, tool, message = load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config )
tool_state = self.__new_state( trans )
is_malicious = changeset_is_malicious( trans, repository_id, repository.tip )
@@ -952,12 +930,11 @@
tool=tool,
tool_state=tool_state,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status=status )
except Exception, e:
message = "Error displaying tool, probably due to a problem in the tool config. The exception is: %s." % str( e )
- if webapp == 'galaxy':
+ if trans.webapp.name == 'galaxy':
return trans.response.send_redirect( web.url_for( controller='repository',
action='preview_tools_in_changeset',
repository_id=repository_id,
@@ -996,7 +973,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
galaxy_url = kwd.get( 'galaxy_url', None )
if galaxy_url:
trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
@@ -1012,7 +988,7 @@
repository = get_repository( trans, repository_id )
kwd[ 'id' ] = repository_id
kwd[ 'changeset_revision' ] = repository_metadata.changeset_revision
- if webapp == 'community' and ( is_admin or repository.user == trans.user ):
+ if trans.webapp.name == 'community' and ( is_admin or repository.user == trans.user ):
a = 'manage_repository'
else:
a = 'view_repository'
@@ -1048,16 +1024,16 @@
if ok:
kwd[ 'match_tuples' ] = match_tuples
# Render the list view
- if webapp == 'galaxy':
+ if trans.webapp.name == 'galaxy':
# Our initial request originated from a Galaxy instance.
global_actions = [ grids.GridAction( "Browse valid repositories",
- dict( controller='repository', action='browse_valid_categories', webapp=webapp ) ),
+ dict( controller='repository', action='browse_valid_categories' ) ),
grids.GridAction( "Search for valid tools",
- dict( controller='repository', action='find_tools', webapp=webapp ) ),
+ dict( controller='repository', action='find_tools' ) ),
grids.GridAction( "Search for workflows",
- dict( controller='repository', action='find_workflows', webapp=webapp ) ) ]
+ dict( controller='repository', action='find_workflows' ) ) ]
self.install_matched_repository_list_grid.global_actions = global_actions
- install_url_args = dict( controller='repository', action='find_tools', webapp=webapp )
+ install_url_args = dict( controller='repository', action='find_tools' )
operations = [ grids.GridOperation( "Install", url_args=install_url_args, allow_multiple=True, async_compatible=False ) ]
self.install_matched_repository_list_grid.operations = operations
return self.install_matched_repository_list_grid( trans, **kwd )
@@ -1071,7 +1047,6 @@
status = "error"
exact_matches_check_box = CheckboxField( 'exact_matches', checked=exact_matches_checked )
return trans.fill_template( '/webapps/community/repository/find_tools.mako',
- webapp=webapp,
tool_id=self.__stringify( tool_ids ),
tool_name=self.__stringify( tool_names ),
tool_version=self.__stringify( tool_versions ),
@@ -1083,7 +1058,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
galaxy_url = kwd.get( 'galaxy_url', None )
if galaxy_url:
trans.set_cookie( galaxy_url, name='toolshedgalaxyurl' )
@@ -1099,7 +1073,7 @@
repository = get_repository( trans, repository_id )
kwd[ 'id' ] = repository_id
kwd[ 'changeset_revision' ] = repository_metadata.changeset_revision
- if webapp == 'community' and ( is_admin or repository.user == trans.user ):
+ if trans.webapp.name == 'community' and ( is_admin or repository.user == trans.user ):
a = 'manage_repository'
else:
a = 'view_repository'
@@ -1136,17 +1110,16 @@
ok, match_tuples = self.__search_repository_metadata( trans, exact_matches_checked, workflow_names=[], all_workflows=True )
if ok:
kwd[ 'match_tuples' ] = match_tuples
- # Render the list view
- if webapp == 'galaxy':
+ if trans.webapp.name == 'galaxy':
# Our initial request originated from a Galaxy instance.
global_actions = [ grids.GridAction( "Browse valid repositories",
- dict( controller='repository', action='browse_valid_repositories', webapp=webapp ) ),
+ dict( controller='repository', action='browse_valid_repositories' ) ),
grids.GridAction( "Search for valid tools",
- dict( controller='repository', action='find_tools', webapp=webapp ) ),
+ dict( controller='repository', action='find_tools' ) ),
grids.GridAction( "Search for workflows",
- dict( controller='repository', action='find_workflows', webapp=webapp ) ) ]
+ dict( controller='repository', action='find_workflows' ) ) ]
self.install_matched_repository_list_grid.global_actions = global_actions
- install_url_args = dict( controller='repository', action='find_workflows', webapp=webapp )
+ install_url_args = dict( controller='repository', action='find_workflows' )
operations = [ grids.GridOperation( "Install", url_args=install_url_args, allow_multiple=True, async_compatible=False ) ]
self.install_matched_repository_list_grid.operations = operations
return self.install_matched_repository_list_grid( trans, **kwd )
@@ -1163,7 +1136,6 @@
workflow_names = []
exact_matches_check_box = CheckboxField( 'exact_matches', checked=exact_matches_checked )
return trans.fill_template( '/webapps/community/repository/find_workflows.mako',
- webapp=webapp,
workflow_name=self.__stringify( workflow_names ),
exact_matches_check_box=exact_matches_check_box,
message=message,
@@ -1234,8 +1206,7 @@
return ''
@web.expose
def get_tool_dependencies( self, trans, **kwd ):
- # Handle a request from a local Galaxy instance. If the request originated with the Galaxy instances' InstallManager, the value of 'webapp'
- # will be 'install_manager'.
+ """Handle a request from a local Galaxy instance."""
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -1244,14 +1215,14 @@
name = params.get( 'name', None )
owner = params.get( 'owner', None )
changeset_revision = params.get( 'changeset_revision', None )
- webapp = get_webapp( trans, **kwd )
repository = get_repository_by_name_and_owner( trans, name, owner )
for downloadable_revision in repository.downloadable_revisions:
if downloadable_revision.changeset_revision == changeset_revision:
break
metadata = downloadable_revision.metadata
tool_dependencies = metadata.get( 'tool_dependencies', '' )
- if webapp == 'install_manager':
+ from_install_manager = kwd.get( 'from_install_manager', False )
+ if from_install_manager:
if tool_dependencies:
return tool_shed_encode( tool_dependencies )
return ''
@@ -1450,7 +1421,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'error' )
- webapp = get_webapp( trans, **kwd )
repository_clone_url = generate_clone_url( trans, repository_id )
repository, tool, error_message = load_tool_from_changeset_revision( trans, repository_id, changeset_revision, tool_config )
tool_state = self.__new_state( trans )
@@ -1461,8 +1431,7 @@
repository.repo_path,
tool_config,
tool,
- [],
- webapp=webapp )
+ [] )
if invalid_file_tups:
message = generate_message_for_invalid_tools( invalid_file_tups, repository, {}, as_html=True, displaying_invalid_tool=True )
elif error_message:
@@ -1474,12 +1443,11 @@
tool=tool,
tool_state=tool_state,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status='error' )
except Exception, e:
message = "Exception thrown attempting to display tool: %s." % str( e )
- if webapp == 'galaxy':
+ if trans.webapp.name == 'galaxy':
return trans.response.send_redirect( web.url_for( controller='repository',
action='preview_tools_in_changeset',
repository_id=repository_id,
@@ -1535,7 +1503,6 @@
if user.email in repository.email_alerts:
email_alert_repositories.append( repository )
return trans.fill_template( "/webapps/community/user/manage_email_alerts.mako",
- webapp='community',
new_repo_alert_check_box=new_repo_alert_check_box,
email_alert_repositories=email_alert_repositories,
message=message,
@@ -1573,7 +1540,6 @@
return trans.response.send_redirect( web.url_for( controller='repository',
action='view_repository',
id=id,
- webapp='community',
message=message,
status='error' ) )
if description != repository.description:
@@ -1713,8 +1679,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- if 'webapp' not in kwd:
- kwd[ 'webapp' ] = 'community'
if 'operation' in kwd:
operation = kwd['operation'].lower()
if operation == "receive email alerts":
@@ -1753,7 +1717,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
repository = get_repository( trans, repository_id )
changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
repository_metadata = get_repository_metadata_by_changeset_revision( trans, repository_id, changeset_revision )
@@ -1776,7 +1739,6 @@
revision_label=revision_label,
changeset_revision_select_field=changeset_revision_select_field,
metadata=metadata,
- webapp=webapp,
message=message,
status=status )
@web.expose
@@ -2218,7 +2180,6 @@
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
cntrller = params.get( 'cntrller', 'repository' )
- webapp = params.get( 'webapp', 'community' )
repository = get_repository( trans, id )
repository_metadata = get_repository_metadata_by_changeset_revision( trans, trans.security.encode_id( repository.id ), changeset_revision )
metadata = repository_metadata.metadata
@@ -2236,7 +2197,6 @@
changeset_revision=changeset_revision,
readme_text=readme_text,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status=status )
@web.expose
@@ -2245,7 +2205,6 @@
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
repository = get_repository( trans, id )
- webapp = get_webapp( trans, **kwd )
repo = hg.repository( get_configured_ui(), repository.repo_path )
avg_rating, num_ratings = self.get_ave_item_rating_data( trans.sa_session, repository, webapp_model=trans.model )
changeset_revision = util.restore_text( params.get( 'changeset_revision', repository.tip ) )
@@ -2307,7 +2266,6 @@
changeset_revision_select_field=changeset_revision_select_field,
revision_label=revision_label,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status=status )
@web.expose
@@ -2315,7 +2273,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
repository = get_repository( trans, repository_id )
repo_files_dir = repository.repo_path
repo = hg.repository( get_configured_ui(), repo_files_dir )
@@ -2376,7 +2333,6 @@
revision_label=revision_label,
changeset_revision_select_field=changeset_revision_select_field,
is_malicious=is_malicious,
- webapp=webapp,
message=message,
status=status )
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/community/controllers/upload.py
--- a/lib/galaxy/webapps/community/controllers/upload.py
+++ b/lib/galaxy/webapps/community/controllers/upload.py
@@ -19,7 +19,7 @@
class UploadController( BaseUIController ):
@web.expose
- @web.require_login( 'upload', use_panels=True, webapp='community' )
+ @web.require_login( 'upload', use_panels=True )
def upload( self, trans, **kwd ):
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
@@ -161,7 +161,6 @@
action='browse_repository',
id=repository_id,
commit_message='Deleted selected files',
- webapp='community',
message=message,
status=status ) )
else:
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/community/controllers/workflow.py
--- a/lib/galaxy/webapps/community/controllers/workflow.py
+++ b/lib/galaxy/webapps/community/controllers/workflow.py
@@ -141,7 +141,6 @@
workflow_name = kwd.get( 'workflow_name', '' )
if workflow_name:
workflow_name = tool_shed_decode( workflow_name )
- webapp = kwd.get( 'webapp', 'community' )
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
repository_metadata = get_repository_metadata_by_id( trans, repository_metadata_id )
@@ -152,11 +151,10 @@
repository_metadata_id=repository_metadata_id,
workflow_name=workflow_name,
metadata=repository_metadata,
- webapp=webapp,
message=message,
status=status )
@web.expose
- def generate_workflow_image( self, trans, repository_metadata_id, workflow_name, webapp='community' ):
+ def generate_workflow_image( self, trans, repository_metadata_id, workflow_name ):
repository_metadata = get_repository_metadata_by_id( trans, repository_metadata_id )
repository_id = trans.security.encode_id( repository_metadata.repository_id )
changeset_revision = repository_metadata.changeset_revision
@@ -388,7 +386,6 @@
workflow_name = kwd.get( 'workflow_name', '' )
if workflow_name:
workflow_name = tool_shed_decode( workflow_name )
- webapp = kwd.get( 'webapp', 'community' )
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
repository_metadata = get_repository_metadata_by_id( trans, repository_metadata_id )
@@ -404,8 +401,8 @@
to_file.write( to_json_string( workflow_data ) )
return open( tmp_fname )
galaxy_url = trans.get_cookie( name='toolshedgalaxyurl' )
- url = '%sworkflow/import_workflow?tool_shed_url=%s&repository_metadata_id=%s&workflow_name=%s&webapp=%s' % \
- ( galaxy_url, url_for( '/', qualified=True ), repository_metadata_id, tool_shed_encode( workflow_name ), webapp )
+ url = '%sworkflow/import_workflow?tool_shed_url=%s&repository_metadata_id=%s&workflow_name=%s' % \
+ ( galaxy_url, url_for( '/', qualified=True ), repository_metadata_id, tool_shed_encode( workflow_name ) )
return trans.response.send_redirect( url )
return trans.response.send_redirect( web.url_for( controller='workflow',
action='view_workflow',
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
--- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
+++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py
@@ -65,7 +65,7 @@
key="name",
link=( lambda item: iff( item.status in [ model.ToolShedRepository.installation_status.CLONING ],
None,
- dict( operation="manage_repository", id=item.id, webapp="galaxy" ) ) ),
+ dict( operation="manage_repository", id=item.id ) ) ),
attach_popup=True ),
DescriptionColumn( "Description" ),
OwnerColumn( "Owner" ),
@@ -410,7 +410,7 @@
def browse_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = url_for( '/', qualified=True )
- url = url_join( tool_shed_url, 'repository/browse_valid_categories?galaxy_url=%s&webapp=galaxy' % ( galaxy_url ) )
+ url = url_join( tool_shed_url, 'repository/browse_valid_categories?galaxy_url=%s' % ( galaxy_url ) )
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
@@ -419,7 +419,6 @@
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
return trans.fill_template( '/webapps/galaxy/admin/tool_sheds.mako',
- webapp='galaxy',
message=message,
status='error' )
@web.expose
@@ -429,7 +428,7 @@
repository = get_repository( trans, kwd[ 'id' ] )
tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
url = url_join( tool_shed_url,
- 'repository/check_for_updates?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ 'repository/check_for_updates?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s' % \
( url_for( '/', qualified=True ), repository.name, repository.owner, repository.changeset_revision ) )
return trans.response.send_redirect( url )
@web.expose
@@ -507,14 +506,14 @@
def find_tools_in_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = url_for( '/', qualified=True )
- url = url_join( tool_shed_url, 'repository/find_tools?galaxy_url=%s&webapp=galaxy' % galaxy_url )
+ url = url_join( tool_shed_url, 'repository/find_tools?galaxy_url=%s' % galaxy_url )
return trans.response.send_redirect( url )
@web.expose
@web.require_admin
def find_workflows_in_tool_shed( self, trans, **kwd ):
tool_shed_url = kwd[ 'tool_shed_url' ]
galaxy_url = url_for( '/', qualified=True )
- url = url_join( tool_shed_url, 'repository/find_workflows?galaxy_url=%s&webapp=galaxy' % galaxy_url )
+ url = url_join( tool_shed_url, 'repository/find_workflows?galaxy_url=%s' % galaxy_url )
return trans.response.send_redirect( url )
def generate_tool_path( self, repository_clone_url, changeset_revision ):
"""
@@ -676,7 +675,7 @@
trans.model.ToolShedRepository.installation_status.SETTING_TOOL_VERSIONS )
tool_shed_url = get_url_from_repository_tool_shed( trans.app, tool_shed_repository )
url = url_join( tool_shed_url,
- '/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ '/repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s' % \
( tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.changeset_revision ) )
response = urllib2.urlopen( url )
text = response.read()
@@ -731,8 +730,7 @@
relative_install_dir=relative_install_dir,
repository_files_dir=None,
resetting_all_metadata_on_repository=False,
- updating_installed_repository=False,
- webapp='galaxy' )
+ updating_installed_repository=False )
tool_shed_repository.metadata = metadata_dict
trans.sa_session.add( tool_shed_repository )
trans.sa_session.flush()
@@ -806,7 +804,7 @@
# Send a request to the tool shed to install the repository.
tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
url = url_join( tool_shed_url,
- 'repository/install_repositories_by_revision?name=%s&owner=%s&changeset_revisions=%s&galaxy_url=%s&webapp=galaxy' % \
+ 'repository/install_repositories_by_revision?name=%s&owner=%s&changeset_revisions=%s&galaxy_url=%s' % \
( repository.name,
repository.owner,
repository.installed_changeset_revision,
@@ -1030,7 +1028,7 @@
changeset_revisions = kwd.get( 'changeset_revisions', None )
# Get the information necessary to install each repository.
url = url_join( tool_shed_url,
- 'repository/get_repository_information?repository_ids=%s&changeset_revisions=%s&webapp=galaxy' % \
+ 'repository/get_repository_information?repository_ids=%s&changeset_revisions=%s' % \
( repository_ids, changeset_revisions ) )
response = urllib2.urlopen( url )
raw_text = response.read()
@@ -1175,7 +1173,7 @@
repo_info_tuple = repo_info_dict[ name ]
description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, tool_dependencies = repo_info_tuple
url = url_join( tool_shed_url,
- 'repository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ 'repository/get_readme?name=%s&owner=%s&changeset_revision=%s' % \
( name, repository_owner, changeset_revision ) )
response = urllib2.urlopen( url )
raw_text = response.read()
@@ -1350,7 +1348,7 @@
# Get all previous change set revisions from the tool shed for the repository back to, but excluding, the previous valid changeset
# revision to see if it was previously installed using one of them.
url = url_join( tool_shed_url,
- 'repository/previous_changeset_revisions?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ 'repository/previous_changeset_revisions?galaxy_url=%s&name=%s&owner=%s&changeset_revision=%s' % \
( url_for( '/', qualified=True ), repository_name, repository_owner, changeset_revision ) )
response = urllib2.urlopen( url )
text = response.read()
@@ -1413,7 +1411,7 @@
install_tool_dependencies_check_box = CheckboxField( 'install_tool_dependencies', checked=True )
if metadata and 'readme' in metadata:
url = url_join( tool_shed_url,
- 'repository/get_readme?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ 'repository/get_readme?name=%s&owner=%s&changeset_revision=%s' % \
( repository.name, repository.owner, repository.installed_changeset_revision ) )
response = urllib2.urlopen( url )
raw_text = response.read()
@@ -1448,8 +1446,7 @@
relative_install_dir=relative_install_dir,
repository_files_dir=None,
resetting_all_metadata_on_repository=False,
- updating_installed_repository=False,
- webapp='galaxy' )
+ updating_installed_repository=False )
repository.metadata = metadata_dict
trans.sa_session.add( repository )
trans.sa_session.flush()
@@ -1506,7 +1503,7 @@
repository = get_repository( trans, kwd[ 'id' ] )
tool_shed_url = get_url_from_repository_tool_shed( trans.app, repository )
url = url_join( tool_shed_url,
- 'repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s&webapp=galaxy' % \
+ 'repository/get_tool_versions?name=%s&owner=%s&changeset_revision=%s' % \
( repository.name, repository.owner, repository.changeset_revision ) )
response = urllib2.urlopen( url )
text = response.read()
@@ -1625,8 +1622,7 @@
relative_install_dir=relative_install_dir,
repository_files_dir=None,
resetting_all_metadata_on_repository=False,
- updating_installed_repository=True,
- webapp='galaxy' )
+ updating_installed_repository=True )
repository.metadata = metadata_dict
# Update the repository changeset_revision in the database.
repository.changeset_revision = latest_changeset_revision
@@ -1676,7 +1672,6 @@
changeset_revision=repository.changeset_revision,
readme_text=readme_text,
is_malicious=is_malicious,
- webapp='galaxy',
message=message,
status=status )
@web.expose
@@ -1685,7 +1680,6 @@
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
- webapp = get_webapp( trans, **kwd )
repository = get_repository( trans, repository_id )
repository_metadata = repository.metadata
tool_metadata = {}
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c lib/galaxy/webapps/galaxy/controllers/workflow.py
--- a/lib/galaxy/webapps/galaxy/controllers/workflow.py
+++ b/lib/galaxy/webapps/galaxy/controllers/workflow.py
@@ -1026,7 +1026,6 @@
"""
url = kwd.get( 'url', '' )
workflow_text = kwd.get( 'workflow_text', '' )
- webapp = get_webapp( trans, **kwd )
message = kwd.get( 'message', '' )
status = kwd.get( 'status', 'done' )
import_button = kwd.get( 'import_button', False )
@@ -1056,8 +1055,8 @@
import_button = True
if tool_shed_url and not import_button:
# Use urllib (send another request to the tool shed) to retrieve the workflow.
- workflow_url = '%s/workflow/import_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&open_for_url=true' % \
- ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ), webapp )
+ workflow_url = '%s/workflow/import_workflow?repository_metadata_id=%s&workflow_name=%s&open_for_url=true' % \
+ ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ) )
response = urllib2.urlopen( workflow_url )
workflow_text = response.read()
response.close()
@@ -1137,7 +1136,7 @@
for shed_name, shed_url in trans.app.tool_shed_registry.tool_sheds.items():
if shed_url.endswith( '/' ):
shed_url = shed_url.rstrip( '/' )
- url = '%s/repository/find_tools?galaxy_url=%s&webapp=%s' % ( shed_url, url_for( '/', qualified=True ), webapp )
+ url = '%s/repository/find_tools?galaxy_url=%s' % ( shed_url, url_for( '/', qualified=True ) )
if missing_tool_tups:
url += '&tool_id='
for missing_tool_tup in missing_tool_tups:
@@ -1155,7 +1154,6 @@
action = 'index'
return trans.response.send_redirect( web.url_for( controller='admin',
action=action,
- webapp='galaxy',
message=message,
status=status ) )
else:
@@ -1164,8 +1162,8 @@
if tool_shed_url:
# We've received the textual representation of a workflow from a Galaxy tool shed.
message = "Workflow <b>%s</b> imported successfully." % workflow.name
- url = '%s/workflow/view_workflow?repository_metadata_id=%s&workflow_name=%s&webapp=%s&message=%s' % \
- ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ), webapp, message )
+ url = '%s/workflow/view_workflow?repository_metadata_id=%s&workflow_name=%s&message=%s' % \
+ ( tool_shed_url, repository_metadata_id, tool_shed_encode( workflow_name ), message )
return trans.response.send_redirect( url )
elif installed_repository_file:
# The workflow was read from a file included with an installed tool shed repository.
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/admin/index.mako
--- a/templates/webapps/community/admin/index.mako
+++ b/templates/webapps/community/admin/index.mako
@@ -48,19 +48,19 @@
<div class="toolSectionBody"><div class="toolSectionBg"><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories' )}">Browse by category</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repositories', webapp='community' )}">Browse all repositories</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repositories' )}">Browse all repositories</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='reset_metadata_on_selected_repositories', webapp='community' )}">Reset selected metadata</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='reset_metadata_on_selected_repositories' )}">Reset selected metadata</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repository_metadata', webapp='community' )}">Browse metadata</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='browse_repository_metadata' )}">Browse metadata</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', cntrller='admin', webapp='community' )}">Browse invalid tools</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', cntrller='admin' )}">Browse invalid tools</a></div></div></div>
@@ -70,7 +70,7 @@
<div class="toolSectionBody"><div class="toolSectionBg"><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='manage_categories', webapp='community' )}">Manage categories</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='manage_categories' )}">Manage categories</a></div></div></div>
@@ -81,13 +81,13 @@
<div class="toolSectionBody"><div class="toolSectionBg"><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='users', webapp='community' )}">Manage users</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='users' )}">Manage users</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='groups', webapp='community' )}">Manage groups</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='groups' )}">Manage groups</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='roles', webapp='community' )}">Manage roles</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='roles' )}">Manage roles</a></div></div></div>
@@ -95,7 +95,7 @@
Statistics
</div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='admin', action='regenerate_statistics', webapp='community' )}">View shed statistics</a>
+ <a target="galaxy_main" href="${h.url_for( controller='admin', action='regenerate_statistics' )}">View shed statistics</a></div></div></div>
@@ -104,7 +104,7 @@
<%def name="center_panel()"><%
- center_url = h.url_for( action='center', webapp='community' )
+ center_url = h.url_for( action='center' )
%><iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/admin/statistics.mako
--- a/templates/webapps/community/admin/statistics.mako
+++ b/templates/webapps/community/admin/statistics.mako
@@ -7,7 +7,7 @@
<div class="toolForm"><div class="toolFormTitle">Tool shed statistics generated on ${trans.app.shed_counter.generation_time}</div>
- <form name="regenerate_statistics" id="regenerate_statistics" action="${h.url_for( controller='admin', action='regenerate_statistics', webapp='community' )}" method="post" >
+ <form name="regenerate_statistics" id="regenerate_statistics" action="${h.url_for( controller='admin', action='regenerate_statistics' )}" method="post" ><div class="form-row"><table class="grid"><tr>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/base_panels.mako
--- a/templates/webapps/community/base_panels.mako
+++ b/templates/webapps/community/base_panels.mako
@@ -64,10 +64,10 @@
</%def>
## Repositories tab.
- ${tab( "repositories", "Repositories", h.url_for( controller='/repository', action='index', webapp='community' ) )}
+ ${tab( "repositories", "Repositories", h.url_for( controller='/repository', action='index' ) )}
## Admin tab.
- ${tab( "admin", "Admin", h.url_for( controller='/admin', action='index', webapp='community' ), extra_class="admin-only", visible=( trans.user and app.config.is_admin_user( trans.user ) ) )}
+ ${tab( "admin", "Admin", h.url_for( controller='/admin', action='index' ), extra_class="admin-only", visible=( trans.user and app.config.is_admin_user( trans.user ) ) )}
## Help tab.
<%
@@ -85,9 +85,9 @@
## User tabs.
<%
# Menu for user who is not logged in.
- menu_options = [ [ _("Login"), h.url_for( controller='/user', action='login', webapp='community' ), "galaxy_main" ] ]
+ menu_options = [ [ _("Login"), h.url_for( controller='/user', action='login' ), "galaxy_main" ] ]
if app.config.allow_user_creation:
- menu_options.append( [ _("Register"), h.url_for( controller='/user', action='create', cntrller='user', webapp='community' ), "galaxy_main" ] )
+ menu_options.append( [ _("Register"), h.url_for( controller='/user', action='create', cntrller='user' ), "galaxy_main" ] )
extra_class = "loggedout-only"
visible = ( trans.user == None )
tab( "user", _("User"), None, visible=visible, menu_options=menu_options )
@@ -101,12 +101,12 @@
if app.config.remote_user_logout_href:
menu_options.append( [ _('Logout'), app.config.remote_user_logout_href, "_top" ] )
else:
- menu_options.append( [ _('Preferences'), h.url_for( controller='/user', action='index', cntrller='user', webapp='community' ), "galaxy_main" ] )
- logout_url = h.url_for( controller='/user', action='logout', webapp='community' )
+ menu_options.append( [ _('Preferences'), h.url_for( controller='/user', action='index', cntrller='user' ), "galaxy_main" ] )
+ logout_url = h.url_for( controller='/user', action='logout' )
menu_options.append( [ 'Logout', logout_url, "_top" ] )
menu_options.append( None )
if app.config.use_remote_user:
- menu_options.append( [ _('Public Name'), h.url_for( controller='/user', action='edit_username', cntrller='user', webapp='community' ), "galaxy_main" ] )
+ menu_options.append( [ _('Public Name'), h.url_for( controller='/user', action='edit_username', cntrller='user' ), "galaxy_main" ] )
extra_class = "loggedin-only"
visible = ( trans.user != None )
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/common/view_readme.mako
--- a/templates/webapps/community/common/view_readme.mako
+++ b/templates/webapps/community/common/view_readme.mako
@@ -3,7 +3,7 @@
<%namespace file="/webapps/community/common/common.mako" import="render_readme" /><%
- if webapp == 'community':
+ if trans.webapp.name == 'community':
is_admin = trans.user_is_admin()
is_new = repository.is_new
can_contact_owner = trans.user and trans.user != repository.user
@@ -22,43 +22,43 @@
<br/><br/><ul class="manage-table-actions">
- %if webapp == 'community':
+ %if trans.webapp.name == 'community':
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
- <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">Rate repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp=webapp )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz', webapp=webapp )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2', webapp=webapp )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip', webapp=webapp )}">Download as a zip file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a>
%endif
</div>
%else:
%if cntrller=='repository':
- <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', operation='preview_tools_in_changeset', id=trans.security.encode_id( repository.id ), webapp=webapp )}">Preview tools for install</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_repositories', operation='preview_tools_in_changeset', id=trans.security.encode_id( repository.id ) )}">Preview tools for install</a></li><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/index.mako
--- a/templates/webapps/community/index.mako
+++ b/templates/webapps/community/index.mako
@@ -50,10 +50,10 @@
</div><div class="toolSectionBody"><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='find_tools', webapp='community' )}">Search for valid tools</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='find_workflows', webapp='community' )}">Search for workflows</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div></div>
%endif
@@ -62,7 +62,7 @@
All Repositories
</div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories', webapp='community' )}">Browse by category</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_categories' )}">Browse by category</a></div>
%if trans.user:
<div class="toolSectionPad"></div>
@@ -70,20 +70,20 @@
My Repositories and Tools
</div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='repositories_i_own', webapp='community' )}">Repositories I own</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='repositories_i_own' )}">Repositories I own</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='writable_repositories', webapp='community' )}">My writable repositories</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_repositories', operation='writable_repositories' )}">My writable repositories</a></div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', cntrller='repository', webapp='community' )}">My invalid tools</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='browse_invalid_tools', cntrller='repository' )}">My invalid tools</a></div><div class="toolSectionPad"></div><div class="toolSectionTitle">
Available Actions
</div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='repository', action='create_repository', webapp='community' )}">Create new repository</a>
+ <a target="galaxy_main" href="${h.url_for( controller='repository', action='create_repository' )}">Create new repository</a></div>
%else:
<div class="toolSectionPad"></div>
@@ -91,7 +91,7 @@
Available Actions
</div><div class="toolTitle">
- <a target="galaxy_main" href="${h.url_for( controller='/user', action='login', webapp='community' )}">Login to create a repository</a>
+ <a target="galaxy_main" href="${h.url_for( controller='/user', action='login' )}">Login to create a repository</a></div>
%endif
</div>
@@ -102,9 +102,9 @@
<%def name="center_panel()"><%
if trans.app.config.require_login and not trans.user:
- center_url = h.url_for( controller='user', action='login', message=message, status=status, webapp='community' )
+ center_url = h.url_for( controller='user', action='login', message=message, status=status )
else:
- center_url = h.url_for( controller='repository', action='browse_categories', message=message, status=status, webapp='community' )
+ center_url = h.url_for( controller='repository', action='browse_categories', message=message, status=status )
%><iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/browse_invalid_tools.mako
--- a/templates/webapps/community/repository/browse_invalid_tools.mako
+++ b/templates/webapps/community/repository/browse_invalid_tools.mako
@@ -20,7 +20,7 @@
<% repository_id, repository_name, repository_owner, changeset_revision = repository_tup %><tr><td>
- <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( repository_id ), tool_config=invalid_tool_config, changeset_revision=changeset_revision, webapp=webapp )}">
+ <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( repository_id ), tool_config=invalid_tool_config, changeset_revision=changeset_revision )}">
${invalid_tool_config}
</a></td>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/browse_repository.mako
--- a/templates/webapps/community/repository/browse_repository.mako
+++ b/templates/webapps/community/repository/browse_repository.mako
@@ -65,23 +65,23 @@
<br/><br/><ul class="manage-table-actions">
%if is_new:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/common.mako
--- a/templates/webapps/community/repository/common.mako
+++ b/templates/webapps/community/repository/common.mako
@@ -83,7 +83,7 @@
hg clone <a href="${clone_str}">${clone_str}</a></%def>
-<%def name="render_repository_items( repository_metadata_id, metadata, can_set_metadata=False, webapp='community' )">
+<%def name="render_repository_items( repository_metadata_id, metadata, can_set_metadata=False )"><% from galaxy.tool_shed.encoding_util import tool_shed_encode %>
%if metadata or can_set_metadata:
<p/>
@@ -184,10 +184,10 @@
<tr><td><div style="float:left;" class="menubutton split popup" id="tool-${index}-popup">
- <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision, webapp=webapp )}">${tool_dict[ 'name' ]}</a>
+ <a class="view-info" href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_dict[ 'tool_config' ], changeset_revision=changeset_revision )}">${tool_dict[ 'name' ]}</a></div><div popupmenu="tool-${index}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ], webapp=webapp )}">View tool metadata</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_tool_metadata', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision, tool_id=tool_dict[ 'id' ] )}">View tool metadata</a></div></td><td>${tool_dict[ 'description' ]}</td>
@@ -232,7 +232,7 @@
%for invalid_tool_config in invalid_tool_configs:
<tr><td>
- <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=invalid_tool_config, changeset_revision=changeset_revision, webapp=webapp )}">
+ <a class="view-info" href="${h.url_for( controller='repository', action='load_invalid_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=invalid_tool_config, changeset_revision=changeset_revision )}">
${invalid_tool_config}
</a></td>
@@ -274,7 +274,7 @@
%><tr><td>
- <a href="${h.url_for( controller='workflow', action='view_workflow', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ), webapp=webapp )}">${workflow_name}</a>
+ <a href="${h.url_for( controller='workflow', action='view_workflow', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ) )}">${workflow_name}</a></td><td>
%if steps:
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/contact_owner.mako
--- a/templates/webapps/community/repository/contact_owner.mako
+++ b/templates/webapps/community/repository/contact_owner.mako
@@ -31,26 +31,26 @@
<br/><br/><ul class="manage-table-actions">
%if is_new and can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ) )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ) )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/find_tools.mako
--- a/templates/webapps/community/repository/find_tools.mako
+++ b/templates/webapps/community/repository/find_tools.mako
@@ -10,11 +10,11 @@
%><%inherit file="${inherit(context)}"/>
-%if webapp == 'galaxy':
+%if trans.webapp.name == 'galaxy':
<br/><br/><ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a></li>
- <li><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></li></ul>
%endif
@@ -32,7 +32,7 @@
strings if these types of search strings are entered in more than one field.
</div><div style="clear: both"></div>
- <form name="find_tools" id="find_tools" action="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}" method="post" >
+ <form name="find_tools" id="find_tools" action="${h.url_for( controller='repository', action='find_tools' )}" method="post" ><div class="form-row"><label>Tool id:</label><input name="tool_id" type="textfield" value="${tool_id}" size="40"/>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/find_workflows.mako
--- a/templates/webapps/community/repository/find_workflows.mako
+++ b/templates/webapps/community/repository/find_workflows.mako
@@ -10,11 +10,11 @@
%><%inherit file="${inherit(context)}"/>
-%if webapp == 'galaxy':
+%if trans.webapp.name == 'galaxy':
<br/><br/><ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a></li>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a></li>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a></ul>
%endif
@@ -30,7 +30,7 @@
Comma-separated strings may be entered to expand search criteria.
</div><div style="clear: both"></div>
- <form name="find_workflows" id="find_workflows" action="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}" method="post" >
+ <form name="find_workflows" id="find_workflows" action="${h.url_for( controller='repository', action='find_workflows' )}" method="post" ><div style="clear: both"></div><div class="form-row"><label>Workflow name:</label>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/manage_repository.mako
--- a/templates/webapps/community/repository/manage_repository.mako
+++ b/templates/webapps/community/repository/manage_repository.mako
@@ -42,30 +42,30 @@
<br/><br/><ul class="manage-table-actions">
%if is_new and can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_reset_all_metadata:
- <a class="action-button" href="${h.url_for( controller='repository', action='reset_all_metadata', id=trans.security.encode_id( repository.id ), webapp='community' )}">Reset all repository metadata</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='reset_all_metadata', id=trans.security.encode_id( repository.id ) )}">Reset all repository metadata</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
@@ -276,7 +276,7 @@
<div class="toolFormBody">
%if display_reviews:
<div class="form-row">
- <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=False, webapp='community' )}"><label>Hide Reviews</label></a>
+ <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=False )}"><label>Hide Reviews</label></a></div><table class="grid"><thead>
@@ -303,7 +303,7 @@
</table>
%else:
<div class="form-row">
- <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=True, webapp='community' )}"><label>Display Reviews</label></a>
+ <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=True )}"><label>Display Reviews</label></a></div>
%endif
</div>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/preview_tools_in_changeset.mako
--- a/templates/webapps/community/repository/preview_tools_in_changeset.mako
+++ b/templates/webapps/community/repository/preview_tools_in_changeset.mako
@@ -36,15 +36,15 @@
<br/><br/><ul class="manage-table-actions">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div></ul>
@@ -79,4 +79,4 @@
</div></div><p/>
-${render_repository_items( repository_metadata_id, metadata, webapp=webapp )}
+${render_repository_items( repository_metadata_id, metadata )}
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/rate_repository.mako
--- a/templates/webapps/community/repository/rate_repository.mako
+++ b/templates/webapps/community/repository/rate_repository.mako
@@ -72,29 +72,29 @@
<br/><br/><ul class="manage-table-actions">
%if is_new:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/tool_form.mako
--- a/templates/webapps/community/repository/tool_form.mako
+++ b/templates/webapps/community/repository/tool_form.mako
@@ -121,46 +121,46 @@
<br/><br/><ul class="manage-table-actions">
- %if webapp == 'galaxy':
+ %if trans.webapp.name == 'galaxy':
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
- <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revision=changeset_revision )}">Browse repository</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Browse repository</a></li></div><li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="tool_shed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div>
%else:
%if is_new:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp=webapp )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/upload.mako
--- a/templates/webapps/community/repository/upload.mako
+++ b/templates/webapps/community/repository/upload.mako
@@ -50,13 +50,13 @@
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">Browse or delete repository files</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">Browse or delete repository files</a>
%endif
</div></ul>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/view_changelog.mako
--- a/templates/webapps/community/repository/view_changelog.mako
+++ b/templates/webapps/community/repository/view_changelog.mako
@@ -45,24 +45,24 @@
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/view_changeset.mako
--- a/templates/webapps/community/repository/view_changeset.mako
+++ b/templates/webapps/community/repository/view_changeset.mako
@@ -46,27 +46,27 @@
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, file_type='gz' )}">Download as a .tar.gz file</a>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/view_repository.mako
--- a/templates/webapps/community/repository/view_repository.mako
+++ b/templates/webapps/community/repository/view_repository.mako
@@ -11,8 +11,8 @@
can_rate = not is_new and trans.user and repository.user != trans.user
can_upload = can_push
can_download = not is_new and ( not is_malicious or can_push )
- can_browse_contents = webapp == 'community' and not is_new
- can_view_change_log = webapp == 'community' and not is_new
+ can_browse_contents = trans.webapp.name == 'community' and not is_new
+ can_view_change_log = trans.webapp.name == 'community' and not is_new
if can_push:
browse_label = 'Browse or delete repository tip files'
else:
@@ -37,44 +37,44 @@
<br/><br/><ul class="manage-table-actions">
- %if webapp == 'community':
+ %if trans.webapp.name == 'community':
%if is_new and can_upload:
- <li><a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a></li>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
- <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">Rate repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp=webapp )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz', webapp=webapp )}">Download as a .tar.gz file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2', webapp=webapp )}">Download as a .tar.bz2 file</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip', webapp=webapp )}">Download as a zip file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='bz2' )}">Download as a .tar.bz2 file</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='zip' )}">Download as a zip file</a>
%endif
</div>
%endif
%else:
- <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li><li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div>
%endif
</ul>
@@ -87,7 +87,7 @@
<div class="toolForm"><div class="toolFormTitle">Repository revision</div><div class="toolFormBody">
- <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), webapp=webapp )}" method="post" >
+ <form name="change_revision" id="change_revision" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"><%
if changeset_revision == repository.tip:
@@ -117,7 +117,7 @@
<div class="form-row"><label>Name:</label>
%if can_browse_contents:
- <a href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${repository.name}</a>
+ <a href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${repository.name}</a>
%else:
${repository.name}
%endif
@@ -132,7 +132,7 @@
<div class="form-row"><label>Revision:</label>
%if can_view_change_log:
- <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${revision_label}</a>
+ <a href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">${revision_label}</a>
%else:
${revision_label}
%endif
@@ -157,7 +157,7 @@
%endif
</div></div>
-${render_repository_items( repository_metadata_id, metadata, webapp=webapp )}
+${render_repository_items( repository_metadata_id, metadata )}
%if repository.categories:
<p/><div class="toolForm">
@@ -172,12 +172,12 @@
</div></div>
%endif
-%if webapp == 'community' and trans.user and trans.app.config.smtp_server:
+%if trans.webapp.name == 'community' and trans.user and trans.app.config.smtp_server:
<p/><div class="toolForm"><div class="toolFormTitle">Notification on update</div><div class="toolFormBody">
- <form name="receive_email_alerts" id="receive_email_alerts" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), webapp=webapp )}" method="post" >
+ <form name="receive_email_alerts" id="receive_email_alerts" action="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ) )}" method="post" ><div class="form-row"><label>Receive email alerts:</label>
${alerts_check_box.get_html()}
@@ -214,7 +214,7 @@
<div class="toolFormBody">
%if display_reviews:
<div class="form-row">
- <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=False, webapp=webapp )}"><label>Hide Reviews</label></a>
+ <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=False )}"><label>Hide Reviews</label></a></div><table class="grid"><thead>
@@ -241,7 +241,7 @@
</table>
%else:
<div class="form-row">
- <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=True, webapp=webapp )}"><label>Display Reviews</label></a>
+ <a href="${h.url_for( controller='repository', action='view_repository', id=trans.security.encode_id( repository.id ), display_reviews=True )}"><label>Display Reviews</label></a></div>
%endif
</div>
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/view_tool_metadata.mako
--- a/templates/webapps/community/repository/view_tool_metadata.mako
+++ b/templates/webapps/community/repository/view_tool_metadata.mako
@@ -12,10 +12,10 @@
can_push = trans.app.security_agent.can_push( trans.user, repository )
can_upload = can_push
can_download = not is_new and ( not is_malicious or can_push )
- can_browse_contents = webapp == 'community' and not is_new
+ can_browse_contents = trans.webapp.name == 'community' and not is_new
can_rate = repository.user != trans.user
can_manage = is_admin or repository.user == trans.user
- can_view_change_log = webapp == 'community' and not is_new
+ can_view_change_log = trans.webapp.name == 'community' and not is_new
if can_push:
browse_label = 'Browse or delete repository tip files'
else:
@@ -34,43 +34,43 @@
<br/><br/><ul class="manage-table-actions">
- %if webapp == 'galaxy':
+ %if trans.webapp.name == 'galaxy':
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
- <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revision=changeset_revision )}">Browse repository</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='preview_tools_in_changeset', repository_id=trans.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Browse repository</a></li></div><li><a class="action-button" id="tool_shed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="tool_shed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div>
%else:
%if is_new:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View repository</a>
%endif
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp=webapp )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp=webapp )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp=webapp )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp=webapp )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
@@ -126,7 +126,7 @@
</div><div class="form-row"><label>Name:</label>
- <a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_metadata_dict[ 'tool_config' ], changeset_revision=changeset_revision, webapp=webapp )}">${tool_metadata_dict[ 'name' ]}</a>
+ <a href="${h.url_for( controller='repository', action='display_tool', repository_id=trans.security.encode_id( repository.id ), tool_config=tool_metadata_dict[ 'tool_config' ], changeset_revision=changeset_revision )}">${tool_metadata_dict[ 'name' ]}</a><div style="clear: both"></div></div>
%if 'description' in tool_metadata_dict:
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/repository/view_workflow.mako
--- a/templates/webapps/community/repository/view_workflow.mako
+++ b/templates/webapps/community/repository/view_workflow.mako
@@ -7,7 +7,7 @@
from galaxy.web.framework.helpers import time_ago
from galaxy.tool_shed.encoding_util import tool_shed_encode
- in_tool_shed = webapp == 'community'
+ in_tool_shed = trans.webapp.name == 'community'
is_admin = trans.user_is_admin()
is_new = repository.is_new
can_manage = is_admin or trans.user == repository.user
@@ -34,8 +34,8 @@
%><%inherit file="${inherit(context)}"/>
-<%def name="render_workflow( repository_metadata_id, workflow_name, webapp )">
- <% center_url = h.url_for( controller='workflow', action='generate_workflow_image', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ), webapp=webapp ) %>
+<%def name="render_workflow( repository_metadata_id, workflow_name )">
+ <% center_url = h.url_for( controller='workflow', action='generate_workflow_image', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ) ) %><iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${center_url}"></iframe></%def>
@@ -43,32 +43,32 @@
<ul class="manage-table-actions">
%if in_tool_shed:
%if is_new and can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
%if can_upload:
- <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ), webapp='community' )}">Upload files to repository</a>
+ <a class="action-button" href="${h.url_for( controller='upload', action='upload', repository_id=trans.security.encode_id( repository.id ) )}">Upload files to repository</a>
%endif
%if can_manage:
<a class="action-button" href="${h.url_for( controller='repository', action='manage_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">Manage repository</a>
%else:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip, webapp='community' )}">View repository</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_repository', id=trans.app.security.encode_id( repository.id ), changeset_revision=repository.tip )}">View repository</a>
%endif
%if has_readme:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, webapp='community' )}">View README</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_readme', id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision )}">View README</a>
%endif
%if can_view_change_log:
- <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">View change log</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='view_changelog', id=trans.app.security.encode_id( repository.id ) )}">View change log</a>
%endif
%if can_rate:
<a class="action-button" href="${h.url_for( controller='repository', action='rate_repository', id=trans.app.security.encode_id( repository.id ) )}">Rate repository</a>
%endif
%if can_browse_contents:
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ), webapp='community' )}">${browse_label}</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_repository', id=trans.app.security.encode_id( repository.id ) )}">${browse_label}</a>
%endif
%if can_contact_owner:
- <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ), webapp='community' )}">Contact repository owner</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='contact_owner', id=trans.security.encode_id( repository.id ) )}">Contact repository owner</a>
%endif
%if can_download:
<a class="action-button" href="${h.url_for( controller='repository', action='download', repository_id=trans.app.security.encode_id( repository.id ), changeset_revision=changeset_revision, file_type='gz' )}">Download as a .tar.gz file</a>
@@ -80,14 +80,14 @@
%else:
<li><a class="action-button" id="repository-${repository.id}-popup" class="menubutton">Repository Actions</a></li><div popupmenu="repository-${repository.id}-popup">
- <li><a class="action-button" href="${h.url_for( controller='workflow', action='import_workflow', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ), webapp=webapp )}">Import workflow to local Galaxy</a></li>
- <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), webapp=webapp, changeset_revisions=changeset_revision )}">Install repository to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='workflow', action='import_workflow', repository_metadata_id=repository_metadata_id, workflow_name=tool_shed_encode( workflow_name ) )}">Import workflow to local Galaxy</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='repository', action='install_repositories_by_revision', repository_ids=trans.security.encode_id( repository.id ), changeset_revisions=changeset_revision )}">Install repository to local Galaxy</a></li></div><li><a class="action-button" id="toolshed-${repository.id}-popup" class="menubutton">Tool Shed Actions</a></li><div popupmenu="toolshed-${repository.id}-popup">
- <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories', webapp=webapp )}">Browse valid repositories</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_tools', webapp=webapp )}">Search for valid tools</a>
- <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows', webapp=webapp )}">Search for workflows</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='browse_valid_categories' )}">Browse valid repositories</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_tools' )}">Search for valid tools</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='find_workflows' )}">Search for workflows</a></div>
%endif
</ul>
@@ -105,4 +105,4 @@
</div><br clear="left"/>
-${render_workflow( repository_metadata_id, workflow_name, webapp )}
+${render_workflow( repository_metadata_id, workflow_name )}
diff -r 4bdb9214efd6ec510f2cc6e00224a467d36ba721 -r c3a9547df6f1ea1f7db1f5ae8ba30b6ae113c97c templates/webapps/community/user/manage_email_alerts.mako
--- a/templates/webapps/community/user/manage_email_alerts.mako
+++ b/templates/webapps/community/user/manage_email_alerts.mako
@@ -4,10 +4,10 @@
<br/><br/><ul class="manage-table-actions"><li>
- <a class="action-button" href="${h.url_for( controller='repository', action='multi_select_email_alerts', cntrller='repository', webapp=webapp )}">Manage repository alerts</a>
+ <a class="action-button" href="${h.url_for( controller='repository', action='multi_select_email_alerts', cntrller='repository' )}">Manage repository alerts</a></li><li>
- <a class="action-button" href="${h.url_for( controller='user', action='index', cntrller='repository', webapp=webapp )}">User preferences</a>
+ <a class="action-button" href="${h.url_for( controller='user', action='index', cntrller='repository' )}">User preferences</a></li></ul>
@@ -17,7 +17,7 @@
<div class="toolForm"><div class="toolFormTitle">Email alerts for new repositories</div>
- <form name="new_repo_alert" id="new_repo_alert" action="${h.url_for( controller='repository', action='manage_email_alerts', webapp=webapp )}" method="post" >
+ <form name="new_repo_alert" id="new_repo_alert" action="${h.url_for( controller='repository', action='manage_email_alerts' )}" method="post" ><div class="form-row"><label>New repository alert:</label>
${new_repo_alert_check_box.get_html()}
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