galaxy-commits
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 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
- 15302 discussions

galaxy-dist commit 1f4d6b25a84e: Fix for Integer/FloatToolParameter.get_html_field() when 'value' is provided as an integer/float.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1287167414 14400
# Node ID 1f4d6b25a84e785c3feee1733a19ac10877a985b
# Parent 74fa7c7c0db8ed06aeda6948d286432b61e7feb0
Fix for Integer/FloatToolParameter.get_html_field() when 'value' is provided as an integer/float.
Fixes an issue seen when saving workflows: If an integer or float tool parameter is changed to a value of 0 or 0.0 and saved, the form field would be redisplayed using the default tool value; and not the value that is now saved in the database.
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -197,6 +197,10 @@ class IntegerToolParameter( TextToolPara
raise ValueError( "An integer is required" )
elif self.value is None:
raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be an integer" )
+ def get_html_field( self, trans=None, value=None, other_values={} ):
+ if isinstance( value, int ):
+ value = str( value )
+ return super( IntegerToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values )
def from_html( self, value, trans=None, other_values={} ):
try:
return int( value )
@@ -235,6 +239,10 @@ class FloatToolParameter( TextToolParame
raise ValueError( "A real number is required" )
elif self.value is None:
raise ValueError( "The settings for this field require a 'value' setting and optionally a default value which must be a real number" )
+ def get_html_field( self, trans=None, value=None, other_values={} ):
+ if isinstance( value, float ):
+ value = str( value )
+ return super( FloatToolParameter, self ).get_html_field( trans=trans, value=value, other_values=other_values )
def from_html( self, value, trans=None, other_values={} ):
try:
return float( value )
1
0

galaxy-dist commit fb2a31820ccf: A bit of code cleanup / optimization in sample tracking.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1287069813 14400
# Node ID fb2a31820ccff6f02bb24a0632f214bfef0a8b0a
# Parent c8173a50bc9bdb0c8e07807c1b73be746557647f
A bit of code cleanup / optimization in sample tracking.
--- a/templates/requests/common/manage_request.mako
+++ b/templates/requests/common/manage_request.mako
@@ -163,7 +163,7 @@
</div></div>
-%if request.has_samples_without_library_destinations:
+%if request.samples_without_library_destinations:
${render_msg( "Select a target data library and folder for all the samples before starting the sequence run", "warning" )}
%endif
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1647,12 +1647,12 @@ class Request( object ):
def is_complete( self ):
return self.state == self.states.COMPLETE
@property
- def has_samples_without_library_destinations( self ):
+ def samples_without_library_destinations( self ):
# Return all samples that are not associated with a library
samples = []
- for s in self.samples:
- if not s.library:
- samples.append( s.name )
+ for sample in self.samples:
+ if not sample.library:
+ samples.append( sample )
return samples
def send_email_notification( self, trans, common_state, final_state=False ):
# Check if an email notification is configured to be sent when the samples
@@ -1774,25 +1774,25 @@ class Sample( object ):
return None
@property
def untransferred_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status == self.transfer_status.NOT_STARTED:
- count = count + 1
- return count
+ untransferred_datasets = []
+ for dataset in self.datasets:
+ if dataset.status == self.transfer_status.NOT_STARTED:
+ untransferred_datasets.append( dataset )
+ return untransferred_datasets
@property
def inprogress_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status not in [self.transfer_status.NOT_STARTED, self.transfer_status.COMPLETE]:
- count = count + 1
- return count
+ inprogress_datasets = []
+ for dataset in self.datasets:
+ if dataset.status not in [ self.transfer_status.NOT_STARTED, self.transfer_status.COMPLETE ]:
+ inprogress_datasets.append( dataset )
+ return inprogress_datasets
@property
def transferred_dataset_files( self ):
- count = 0
- for df in self.datasets:
- if df.status == self.transfer_status.COMPLETE:
- count = count + 1
- return count
+ transferred_datasets = []
+ for dataset in self.datasets:
+ if dataset.status == self.transfer_status.COMPLETE:
+ transferred_datasets.append( dataset )
+ return transferred_datasets
def dataset_size( self, filepath ):
def print_ticks(d):
pass
--- a/templates/requests/common/sample_datasets.mako
+++ b/templates/requests/common/sample_datasets.mako
@@ -1,5 +1,5 @@
<%def name="render_sample_datasets( sample )">
- ${sample.transferred_dataset_files} / ${len( sample.datasets )}
+ ${len( sample.transferred_dataset_files )}/${len( sample.datasets )}
</%def>
${render_sample_datasets( sample )}
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -244,6 +244,11 @@ class RequestsAdmin( BaseController, Use
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
+ sample_id = params.get( 'sample_id', None )
+ try:
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
+ except:
+ return invalid_id_redirect( trans, 'requests_admin', sample_id )
if 'operation' in kwd:
operation = kwd[ 'operation' ].lower()
sample_dataset_id = params.get( 'id', None )
@@ -262,48 +267,44 @@ class RequestsAdmin( BaseController, Use
elif operation == "delete":
not_deleted = []
for sample_dataset in selected_sample_datasets:
- sample_id = sample_dataset.sample.id
- if sample_dataset.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
+ # Make sure the dataset has been transferred before deleting it.
+ if sample_dataset in sample.untransferred_dataset_files:
trans.sa_session.delete( sample_dataset )
trans.sa_session.flush()
else:
not_deleted.append( sample_dataset.name )
- message = '%i datasets have been deleted. ' % ( len( id_list ) - len( not_deleted ) )
+ message = '%i datasets have been deleted.' % ( len( id_list ) - len( not_deleted ) )
if not_deleted:
status = 'warning'
- message = message + '%s could not be deleted because their transfer status is not "Not Started". ' % str( not_deleted )
+ message = message + ' %s could not be deleted because their transfer status is not "Not Started". ' % str( not_deleted )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=trans.security.encode_id( sample_id ),
+ sample_id=sample_id,
status=status,
message=message ) )
elif operation == "rename":
- # if none of the selected sample datasets are in the NOT_STARTED state,
- # then display error message
- flag = True
- for sd in selected_sample_datasets:
- if sd.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
- flag = False
+ # If one of the selected sample datasets is in the NOT_STARTED state,
+ # then display an error message. A NOT_STARTED state implies the dataset
+ # has not yet been transferred.
+ no_datasets_transferred = True
+ for selected_sample_dataset in selected_sample_datasets:
+ if selected_sample_dataset in sample.untransferred_dataset_files:
+ no_datasets_transferred = False
break
- if flag:
+ if no_datasets_transferred:
status = 'error'
- message = 'A dataset can be renamed only if it is in the <b>Not Started</b> state.'
+ message = 'A dataset can be renamed only if it is in the "Not Started" state.'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=trans.security.encode_id( selected_sample_datasets[0].sample.id ),
+ sample_id=sample_id,
status=status,
message=message ) )
return trans.fill_template( '/admin/requests/rename_datasets.mako',
- sample=selected_sample_datasets[0].sample,
+ sample=sample,
id_list=id_list )
elif operation == "start transfer":
- self.__start_datatx( trans, selected_sample_datasets[0].sample, selected_sample_datasets )
+ self.__start_datatx( trans, sample, selected_sample_datasets )
# Render the grid view
- sample_id = params.get( 'sample_id', None )
- try:
- sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id ( sample_id ) )
- except:
- return invalid_id_redirect( trans, 'requests_admin', sample_id )
request_id = trans.security.encode_id( sample.request.id )
library_id = trans.security.encode_id( sample.library.id )
self.datatx_grid.title = 'Datasets of sample "%s"' % sample.name
@@ -392,25 +393,26 @@ class RequestsAdmin( BaseController, Use
folder_path = self.__check_path( folder_path )
if params.get( 'folder_up', False ):
if folder_path[-1] == os.sep:
- folder_path = os.path.dirname(folder_path[:-1])
+ folder_path = os.path.dirname( folder_path[:-1] )
folder_path = self.__check_path( folder_path )
elif params.get( 'select_show_datasets_button', False ) or params.get( 'select_more_button', False ):
# get the sample these datasets are associated with
try:
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( selected_sample_id ) )
- if sample.name in sample.request.has_samples_without_library_destinations:
- raise Exception()
except:
- # if no sample (with associated library & folder) has been selected
+ return invalid_id_redirect( trans, 'requests_admin', selected_sample_id )
+ if sample in sample.request.samples_without_library_destinations:
+ # Display an error if a sample has been selected that
+ # has not yet been associated with a destination library.
status = 'error'
- message = 'Select a sample with associated data library and folder before selecting the dataset(s).'
+ message = 'Select a sample with associated data library and folder before selecting the datasets.'
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='get_data',
- request_id=trans.security.encode_id( request.id ),
+ request_id=request_id,
folder_path=folder_path,
status=status,
message=message ) )
- # save the sample datasets
+ # Save the sample datasets
sample_dataset_file_names = self.__save_sample_datasets( trans, sample, selected_files, folder_path )
if sample_dataset_file_names:
message = 'Datasets (%s) have been selected for sample (%s)' % \
@@ -419,7 +421,7 @@ class RequestsAdmin( BaseController, Use
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
request_id=request_id,
- sample_id=trans.security.encode_id( sample.id ),
+ sample_id=selected_sample_id,
message=message,
status=status ) )
else: # 'select_more_button' was clicked
--- a/templates/requests/common/find_samples.mako
+++ b/templates/requests/common/find_samples.mako
@@ -71,7 +71,7 @@
%else:
State: ${sample.state.name}<br/>
%endif
- Datasets: <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.transferred_dataset_files}/${len( sample.datasets )}</a><br/>
+ Datasets: <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${len( sample.transferred_dataset_files )}/${len( sample.datasets )}</a><br/>
%if is_admin:
<i>User: ${sample.request.user.email}</i>
%endif
1
0

galaxy-dist commit e029c860e717: Added tests and more help to mutation visualization tool
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287517130 14400
# Node ID e029c860e71710d69f725e5c136b7e55fa529a42
# Parent 7c80b7c2aa6aef5fba1b3a08e6426f5c84a125b4
Added tests and more help to mutation visualization tool
--- a/tools/mutation/visualize.xml
+++ b/tools/mutation/visualize.xml
@@ -37,16 +37,42 @@
<outputs><data format="svg" name="out_file1" /></outputs>
+ <tests>
+ <test>
+ <param name="input1" value="mutation_data1.txt" ftype="tabular" />
+ <param name="position_col" value="2" />
+ <param name="ref_col" value="4" />
+ <param name="zoom_value" value="interactive" />
+ <param name="name" value="s1" />
+ <param name="a_col" value="5" />
+ <param name="totals_col" value="9" />
+ <output name="output" file="mutation_data1_interactive.svg" ftype="svg" />
+ </test>
+ <test>
+ <param name="input1" value="mutation_data1.txt" ftype="tabular" />
+ <param name="position_col" value="2" />
+ <param name="ref_col" value="4" />
+ <param name="zoom_value" value="3" />
+ <param name="name" value="s1" />
+ <param name="a_col" value="5" />
+ <param name="totals_col" value="9" />
+ <output name="output" file="mutation_data1_zoom3x.svg" ftype="svg" />
+ </test>
+ </tests><help>
**Example**
-
+This tool allows you to visualize mutations described in a tabular input file. It generates an SVG image which can be viewed in any web browser.
+
Given the input file::
gm blood gm cheek
chrM 72 73 G 26394 4 49 0 26447 26398 1 23389 3 45 0 23437 23392 1
chrM 149 150 T 11 50422 2 96 50531 50435 1 4 45417 1 65 45487 45422 1
+
+You will need to specify the position and reference columns in the input file. Then click on the 'Add new Sample' to add samples in the input file that you would like to visualize. For each sample you select, specify the column for base 'A' and the totals column.
+This tool assumes the columns specifying bases A, C, G, T are placed consecutively and in that order in an input file.
Visualization:
@@ -54,7 +80,7 @@ Visualization:
:width: 150
Interactivity::
- If interactive zoom/pan option is checked then the resultant image can be zoomed in or out: scroll mouse wheel; pan: drag using left mouse button.
+ If interactive zoom option is selected, then the resultant image can be zoomed in or out using the scroll mouse wheel and can be panned by dragging the image using left mouse button.
</help></tool>
--- a/tool_conf.xml.main
+++ b/tool_conf.xml.main
@@ -134,6 +134,7 @@
<tool file="visualization/GMAJ.xml" /><tool file="visualization/build_ucsc_custom_track.xml" /><tool file="maf/vcf_to_maf_customtrack.xml" />
+ <tool file="mutation/visualize.xml" /></section><section name="Regional Variation" id="regVar"><tool file="regVariation/windowSplitter.xml" />
--- a/tools/mutation/visualize.py
+++ b/tools/mutation/visualize.py
@@ -367,7 +367,6 @@ if __name__ == '__main__':
parser.add_option('-z', '--zoom', dest='zoom', action='store', default='1')
parser.add_option('-p', '--position_col', dest='position_col', action='store', default='c0')
parser.add_option('-r', '--ref_col', dest='ref_col', action='store', default='c1')
- #parser.add_option('-n', '--interactive', dest='interactive', action='store_false', default='True')
(opts, args) = parser.parse_args()
mainsvg(opts, args)
sys.exit(1)
1
0

galaxy-dist commit 03b74e3675f0: sample tracking functional tests are fixed
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287161361 14400
# Node ID 03b74e3675f0344005ad491f74d2fb0aa56cb010
# Parent d4b85e30e56d605edc2236ccba5cde41bda1510a
sample tracking functional tests are fixed
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1540,7 +1540,7 @@ class TwillTestCase( unittest.TestCase )
def add_bar_codes( self, request_id, request_name, bar_codes, samples, strings_displayed_after_submit=[] ):
# We have to simulate the form submission here since twill barfs on the page
# gvk - 9/22/10 - TODO: make sure the mako template produces valid html
- url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&edit_samples_button=Edit+samples" % ( self.url, request_id )
+ url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s&managing_samples=True" % ( self.url, request_id )
for index, field_value in enumerate( bar_codes ):
sample_field_name = "sample_%i_name" % index
sample_field_value = samples[ index ].name.replace( ' ', '+' )
@@ -1551,20 +1551,23 @@ class TwillTestCase( unittest.TestCase )
self.visit_url( url )
for check_str in strings_displayed_after_submit:
self.check_page_for_string( check_str )
- def change_sample_state( self, request_id, request_name, sample_name, sample_id, new_sample_state_id, new_state_name, comment='',
+ def change_sample_state( self, request_id, request_name, sample_names, sample_ids, new_sample_state_id, new_state_name, comment='',
strings_displayed=[], strings_displayed_after_submit=[] ):
# We have to simulate the form submission here since twill barfs on the page
# gvk - 9/22/10 - TODO: make sure the mako template produces valid html
url = "%s/requests_common/manage_request?cntrller=requests_admin&id=%s" % ( self.url, request_id )
- # select_sample_%i=true must be included twice to simulate a CheckboxField checked setting.
- url += "&comment=%s&select_sample_%i=true&select_sample_%i=true&sample_state_id=%i" % ( comment, sample_id, sample_id, new_sample_state_id )
+ url += "&comment=%s&sample_state_id=%s" % ( comment, self.security.encode_id( new_sample_state_id ) )
+ # select_sample_%i=true must be included twice for each sample to simulate a CheckboxField checked setting.
+ for sample_id in sample_ids:
+ url += "&select_sample_%i=true&select_sample_%i=true" % ( sample_id, sample_id )
url += "&sample_operation=Change%20state&refresh=true"
url += "&change_state_button=Save"
self.visit_url( url )
self.check_page_for_string( 'Sequencing Request "%s"' % request_name )
- self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%i" % ( self.url, sample_id ) )
- self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
- self.check_page_for_string( new_state_name )
+ for sample_id, sample_name in zip( sample_ids, sample_names ):
+ self.visit_url( "%s/requests_common/sample_events?cntrller=requests_admin&sample_id=%s" % ( self.url, self.security.encode_id( sample_id ) ) )
+ self.check_page_for_string( 'Events for Sample "%s"' % sample_name )
+ self.check_page_for_string( new_state_name )
def add_user_address( self, user_id, address_dict ):
self.home()
self.visit_url( "%s/user/new_address?admin_view=False&user_id=%i" % ( self.url, user_id ) )
--- a/test/functional/test_forms_and_requests.py
+++ b/test/functional/test_forms_and_requests.py
@@ -209,7 +209,7 @@ class TestFormsAndRequests( TwillTestCas
name=name,
desc=desc,
field_value_tuples=field_value_tuples,
- strings_displayed=[ 'Create a new request',
+ strings_displayed=[ 'Create a new sequencing request',
test_field_name1,
test_field_name2,
test_field_name3 ],
@@ -272,8 +272,6 @@ class TestFormsAndRequests( TwillTestCas
def test_040_request_lifecycle( self ):
"""Testing request life-cycle as it goes through all the states"""
# logged in as regular_user1
- """
- TODO: debug this test case...
self.logout()
self.login( email=admin_user.email )
self.check_request_grid( cntrller='requests_admin',
@@ -292,19 +290,18 @@ class TestFormsAndRequests( TwillTestCas
samples=request_one.samples,
strings_displayed_after_submit=strings_displayed_after_submit )
# Change the states of all the samples of this request to ultimately be COMPLETE
- for sample in request_one.samples:
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_name=sample.name,
- sample_id=self.security.encode_id( sample.id ),
- new_sample_state_id=request_type1.states[1].id,
- new_state_name=request_type1.states[1].name )
- self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
- request_name=request_one.name,
- sample_name=sample.name,
- sample_id=self.security.encode_id( sample.id ),
- new_sample_state_id=request_type1.states[2].id,
- new_state_name=request_type1.states[2].name )
+ self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
+ request_name=request_one.name,
+ sample_names=[ sample.name for sample in request_one.samples ],
+ sample_ids=[ sample.id for sample in request_one.samples ],
+ new_sample_state_id=request_type1.states[1].id,
+ new_state_name=request_type1.states[1].name )
+ self.change_sample_state( request_id=self.security.encode_id( request_one.id ),
+ request_name=request_one.name,
+ sample_names=[ sample.name for sample in request_one.samples ],
+ sample_ids=[ sample.id for sample in request_one.samples ],
+ new_sample_state_id=request_type1.states[2].id,
+ new_state_name=request_type1.states[2].name )
refresh( request_one )
self.logout()
self.login( email=regular_user1.email )
@@ -314,7 +311,7 @@ class TestFormsAndRequests( TwillTestCas
strings_displayed=[ request_one.name ] )
assert request_one.state is not request_one.states.COMPLETE, "The state of the request '%s' should be set to '%s'" \
% ( request_one.name, request_one.states.COMPLETE )
- """
+
def test_045_admin_create_request_on_behalf_of_regular_user( self ):
"""Testing creating and submitting a request as an admin on behalf of a regular user"""
# Logged in as regular_user1
@@ -332,7 +329,7 @@ class TestFormsAndRequests( TwillTestCas
name=name,
desc=desc,
field_value_tuples=field_value_tuples,
- strings_displayed=[ 'Create a new request',
+ strings_displayed=[ 'Create a new sequencing request',
test_field_name1,
test_field_name2,
test_field_name3 ],
1
0

galaxy-dist commit 7c80b7c2aa6a: Add descriptive labels to output dataset names for MACS peakcalling tool.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1287508435 14400
# Node ID 7c80b7c2aa6aef5fba1b3a08e6426f5c84a125b4
# Parent 9c80bcb0bfa49d553428aca22043a8a68f773c65
Add descriptive labels to output dataset names for MACS peakcalling tool.
--- a/tools/peak_calling/macs_wrapper.xml
+++ b/tools/peak_calling/macs_wrapper.xml
@@ -74,22 +74,22 @@
<param name="futurefdr" label="Perform the new peak detection method (futurefdr)" type="boolean" truevalue="--futurefdr" falsevalue="" checked="False" help="The default method only consider the peak location, 1k, 5k, and 10k regions in the control data; whereas the new future method also consider the 5k, 10k regions in treatment data to calculate local bias."/></inputs><outputs>
- <data name="output_bed_file" format="bed"/>
- <data name="output_xls_to_interval_peaks_file" format="interval">
+ <data name="output_bed_file" format="bed" label="${tool.name} on ${on_string} (peaks: bed)"/>
+ <data name="output_xls_to_interval_peaks_file" format="interval" label="${tool.name} on ${on_string} (peaks: interval)"><filter>xls_to_interval is True</filter></data>
- <data name="output_xls_to_interval_negative_peaks_file" format="interval">
+ <data name="output_xls_to_interval_negative_peaks_file" format="interval" label="${tool.name} on ${on_string} (negative peaks: interval)"><filter>xls_to_interval is True</filter><filter>input_type['input_control_file1'] is not None</filter></data>
- <data name="output_treatment_wig_file" format="wig">
+ <data name="output_treatment_wig_file" format="wig" label="${tool.name} on ${on_string} (treatment: wig)"><filter>wig_type['wig_type_selector']=='wig'</filter></data>
- <data name="output_control_wig_file" format="wig">
+ <data name="output_control_wig_file" format="wig" label="${tool.name} on ${on_string} (control: wig)"><filter>wig_type['wig_type_selector'] == 'wig'</filter><filter>input_type['input_control_file1'] is not None</filter></data>
- <data name="output_extra_files" format="html"/>
+ <data name="output_extra_files" format="html" label="${tool.name} on ${on_string} (html report)"/></outputs><configfiles><configfile name="options_file"><%
1
0
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1287167075 14400
# Node ID 74fa7c7c0db8ed06aeda6948d286432b61e7feb0
# Parent 03b74e3675f0344005ad491f74d2fb0aa56cb010
trackster:
- New histogram mode for LineTrack that's used by default.
- Refactored LineTrack drawing code
- Can change draw color of LineTrack
- summary_tree now shows maximum y-axis value
- When editing track config, "Enter" and "Esc" keys submit and cancel the changes, respectively
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -456,7 +456,7 @@ var Track = function (name, view, parent
};
$.extend( Track.prototype, {
init_global: function () {
- this.container_div = $("<div />").addClass('track')
+ this.container_div = $("<div />").addClass('track').css("position", "relative");
if (!this.hidden) {
this.header_div = $("<div class='track-header' />").appendTo(this.container_div);
if (this.view.editor) { this.drag_div = $("<div class='draghandle' />").appendTo(this.header_div); }
@@ -561,9 +561,17 @@ var TiledTrack = function() {
}
};
track_dropdown["Edit configuration"] = function() {
- var cancel_fn = function() { hide_modal(); };
- var ok_fn = function() { track.update_options(track.track_id); hide_modal(); };
+ var cancel_fn = function() { hide_modal(); $(window).unbind("keypress.check_enter_esc"); },
+ ok_fn = function() { track.update_options(track.track_id); hide_modal(); $(window).unbind("keypress.check_enter_esc"); },
+ check_enter_esc = function(e) {
+ if ((e.keyCode || e.which) === 27) { // Escape key
+ cancel_fn();
+ } else if ((e.keyCode || e.which) === 13) { // Enter key
+ ok_fn();
+ }
+ };
+ $(window).bind("keypress.check_enter_esc", check_enter_esc);
show_modal("Configure Track", track.gen_options(track.track_id), {
"Cancel": cancel_fn,
"OK": ok_fn
@@ -771,8 +779,8 @@ var ReferenceTrack = function (view) {
var LineTrack = function ( name, view, dataset_id, prefs ) {
this.track_type = "LineTrack";
- this.display_modes = ["Line", "Filled", "Intensity"];
- this.mode = "Line";
+ this.display_modes = ["Histogram", "Line", "Filled", "Intensity"];
+ this.mode = "Histogram";
Track.call( this, name, view, view.viewport_container );
TiledTrack.call( this );
@@ -780,7 +788,7 @@ var LineTrack = function ( name, view, d
this.dataset_id = dataset_id;
this.data_cache = new Cache(CACHED_DATA);
this.tile_cache = new Cache(CACHED_TILES_LINE);
- this.prefs = { 'min_value': undefined, 'max_value': undefined, 'mode': 'Line' };
+ this.prefs = { 'color': 'black', 'min_value': undefined, 'max_value': undefined, 'mode': this.mode };
if (prefs.min_value !== undefined) { this.prefs.min_value = prefs.min_value; }
if (prefs.max_value !== undefined) { this.prefs.max_value = prefs.max_value; }
};
@@ -806,10 +814,7 @@ var LineTrack = function ( name, view, d
track.total_frequency = data.total_frequency;
// Draw y-axis labels if necessary
- $('#linetrack_' + track_id + '_minval').remove();
- $('#linetrack_' + track_id + '_maxval').remove();
-
- track.container_div.css("position", "relative");
+ track.container_div.find(".yaxislabel").remove();
var min_label = $("<div />").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_minval').text(round_1000(track.prefs.min_value));
var max_label = $("<div />").addClass('yaxislabel').attr("id", 'linetrack_' + track_id + '_maxval').text(round_1000(track.prefs.max_value));
@@ -886,7 +891,7 @@ var LineTrack = function ( name, view, d
mode = this.mode;
ctx.beginPath();
-
+ ctx.fillStyle = this.prefs.color;
// for intensity, calculate delta x in pixels to for width of box
if (data.length > 1) {
var delta_x_px = Math.ceil((data[1][0] - data[0][0]) * w_scale);
@@ -896,51 +901,42 @@ var LineTrack = function ( name, view, d
var x_scaled, y;
- for ( var i = 0; i < data.length; i++ ) {
- x_scaled = (data[i][0] - tile_low) * w_scale;
+ for (var i = 0, len = data.length; i < len; i++) {
+ x_scaled = Math.round((data[i][0] - tile_low) * w_scale);
y = data[i][1];
+ if (y === null) {
+ if (in_path && mode === "Filled") {
+ ctx.lineTo(x_scaled, height_px);
+ }
+ in_path = false;
+ continue;
+ }
+ if (y < min_value) {
+ y = min_value;
+ } else if (y > max_value) {
+ y = max_value;
+ }
- if ( mode == "Intensity" ) {
- // DRAW INTENSITY
- if (y === null) {
- continue;
- }
- if (y <= min_value) {
- y = min_value;
- } else if (y >= max_value) {
- y = max_value;
- }
+ if (mode === "Histogram") {
+ y = Math.round( height_px - (y - min_value) / vertical_range * height_px );
+ ctx.fillRect(x_scaled, y, delta_x_px, height_px - y);
+ } else if (mode === "Intensity" ) {
y = 255 - Math.floor( (y - min_value) / vertical_range * 255 );
ctx.fillStyle = "rgb(" +y+ "," +y+ "," +y+ ")";
- ctx.fillRect(x_scaled, 0, delta_x_px, this.height_px);
- }
- else {
- // Missing data causes us to stop drawing
- if (y === null) {
- if (in_path && mode === "Filled") {
- ctx.lineTo(x_scaled, height_px);
- }
- in_path = false;
- continue;
+ ctx.fillRect(x_scaled, 0, delta_x_px, height_px);
+ } else {
+ // console.log(y, this.min_value, this.vertical_range, (y - this.min_value) / this.vertical_range * this.height_px);
+ y = Math.round( height_px - (y - min_value) / vertical_range * height_px );
+ // console.log(canvas.get(0).height, canvas.get(0).width);
+ if (in_path) {
+ ctx.lineTo(x_scaled, y);
} else {
- // console.log(y, this.min_value, this.vertical_range, (y - this.min_value) / this.vertical_range * this.height_px);
- if (y <= min_value) {
- y = min_value;
- } else if (y >= max_value) {
- y = max_value;
- }
- y = Math.round( height_px - (y - min_value) / vertical_range * height_px );
- // console.log(canvas.get(0).height, canvas.get(0).width);
- if (in_path) {
+ in_path = true;
+ if (mode === "Filled") {
+ ctx.moveTo(x_scaled, height_px);
ctx.lineTo(x_scaled, y);
} else {
- in_path = true;
- if (mode === "Filled") {
- ctx.moveTo(x_scaled, height_px);
- ctx.lineTo(x_scaled, y);
- } else {
- ctx.moveTo(x_scaled, y);
- }
+ ctx.moveTo(x_scaled, y);
}
}
}
@@ -958,7 +954,10 @@ var LineTrack = function ( name, view, d
}, gen_options: function(track_id) {
var container = $("<div />").addClass("form-row");
- var minval = 'track_' + track_id + '_minval',
+ var color = 'track_' + track_id + '_color',
+ color_label = $('<label />').attr("for", color).text("Color:"),
+ color_input = $('<input />').attr("id", color).attr("name", color).val(this.prefs.color),
+ minval = 'track_' + track_id + '_minval',
min_label = $('<label></label>').attr("for", minval).text("Min value:"),
min_val = (this.prefs.min_value === undefined ? "" : this.prefs.min_value),
min_input = $('<input></input>').attr("id", minval).val(min_val),
@@ -967,13 +966,16 @@ var LineTrack = function ( name, view, d
max_val = (this.prefs.max_value === undefined ? "" : this.prefs.max_value),
max_input = $('<input></input>').attr("id", maxval).val(max_val);
- return container.append(min_label).append(min_input).append(max_label).append(max_input);
+ return container.append(min_label).append(min_input).append(max_label)
+ .append(max_input).append(color_label).append(color_input);
}, update_options: function(track_id) {
var min_value = $('#track_' + track_id + '_minval').val(),
max_value = $('#track_' + track_id + '_maxval').val();
- if ( min_value !== this.prefs.min_value || max_value !== this.prefs.max_value ) {
+ color = $('#track_' + track_id + '_color').val();
+ if ( min_value !== this.prefs.min_value || max_value !== this.prefs.max_value || color !== this.prefs.color ) {
this.prefs.min_value = parseFloat(min_value);
this.prefs.max_value = parseFloat(max_value);
+ this.prefs.color = color;
this.vertical_range = this.prefs.max_value - this.prefs.min_value;
// Update the y-axis
$('#linetrack_' + track_id + '_minval').text(this.prefs.min_value);
@@ -1199,12 +1201,18 @@ var FeatureTrack = function ( name, view
ctx.fillStyle = block_color;
ctx.font = this.default_font;
ctx.textAlign = "right";
+ this.container_div.find(".yaxislabel").remove();
- if (result.dataset_type == "summary_tree") {
+ if (result.dataset_type == "summary_tree") {
var points = result.data,
max = result.max,
avg = result.avg,
delta_x_px = Math.ceil(result.delta * w_scale);
+
+ var max_label = $("<div />").addClass('yaxislabel').text(max);
+
+ max_label.css({ position: "absolute", top: "22px", left: "10px" });
+ max_label.prependTo(this.container_div);
for ( var i = 0, len = points.length; i < len; i++ ) {
var x = Math.floor( (points[i][0] - tile_low) * w_scale );
--- a/static/june_2007_style/blue/trackster.css
+++ b/static/june_2007_style/blue/trackster.css
@@ -16,7 +16,7 @@
.overview-box{cursor:pointer;opacity:0.5;bottom:0px;z-index:100;position:absolute;margin-top:0px;height:14px;background:#484848 url(../images/visualization/draggable_horizontal.png) center center no-repeat;border-style:solid;border-color:#484848;border-width:0px 1px;-moz-border-radius:3px;border-radius:3px;}
.overview-box:hover{background-color:#838383;border-color:#838383;}
.viewport-canvas{width:100%;height:100px;}
-.yaxislabel{color:#777;}
+.yaxislabel{color:#777;z-index:100;}
.line-track .track-content{border-top:1px solid #ddd;border-bottom:1px solid #ddd;}
.track{background:white;margin-bottom:1px;}
.track-header{text-align:left;padding:4px 0px;color:#666;}
--- a/static/june_2007_style/trackster.css.tmpl
+++ b/static/june_2007_style/trackster.css.tmpl
@@ -116,6 +116,7 @@
.yaxislabel {
color: #777;
+ z-index: 100;
}
/* Line track needs borders to show range */
.line-track .track-content {
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function()
{RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.
min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview
-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<inp
ut/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info
;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(d){this.origin
al_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,h=(a.high-a.
low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(c.chrom===""){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.reset();c.redraw(true);for(var g i
n c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this
.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_locatio
n(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Track=function(b,a,c){this.name=b;this.parent_
element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name)}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(D
ATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class=
'right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configuration"]=function(){var k=function(){hide_modal()};var j=function(){d.update_options(d.track_id);hide_modal()};show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:k,OK:j})};b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};make_popupmenu(d.name_div,b)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution
;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove();this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var l=tile_element.get(0).getContext("2d");var j=c.initial_canvas.get(0).getContext("2d");var k=l.getImageData(0,0,l.canvas.width,l.canvas.height);j.putImageData(k,0,0);c.set_overview()}c.tile_cache.set(e,tile_element);
c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a
+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).get
Context("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Line","Filled","Intensity"];this.mode="Line";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){thi
s.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();a.container_div.css("position","relative");var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.cs
s({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false
,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(k){var a=$("<div />").addClass("form-row");var e="track_"+k+"_minval",h=$("<label></label>").attr("for",e).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),j=$("<input
></input>").attr("id",e).val(b),g="track_"+k+"_maxval",d=$("<label></label>").attr("for",g).text("Max value:"),f=(this.prefs.max_value===undefined?"":this.prefs.max_value),c=$("<input></input>").attr("id",g).val(f);return a.append(h).append(j).append(d).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show
_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"black",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data
_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}v
ar v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(ac,n,q,ap){var L=n*DENSITY*ac,ah=(n+1)*DENSITY*ac,K=ah-L;var aj=(!this.initial_canvas?"initial":L+"_"+ah);var G=this.data_cache.get(aj);var e;if(G===undefined||(this.mode!=="Auto"&&
G.dataset_type==="summary_tree")){this.data_queue[[L,ah]]=true;this.get_data(L,ah);return}var a=Math.ceil(K*ap),Q=$("<canvas class='tile'></canvas>"),ae=this.prefs.label_color,h=this.prefs.block_color,p=this.mode,v=25,aa=(p==="Squish")||(p==="Dense")&&(p!=="Pack")||(p==="Auto"&&(G.extra_info==="no_detail")),U=this.left_offset,ao,B,aq;if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(p==="Dense"){B=v;aq=10}else{aq=(aa?this.vertical_nodetail_px:this.vertical_detail_px);var w=(ap<0.0001?1/view.zoom_res:ap);B=this.incremental_slots(w,G.data,aa,p)*aq+v;ao=this.inc_slots[w]}}Q.css({position:"absolute",top:0,left:(L-this.view.low)*ap-U});Q.get(0).width=a+U;Q.get(0).height=B;q.parent().css("height",Math.max(this.height_px,B)+"px");var H=Q.get(0).getContext("2d");H.fillStyle=h;H.font=this.default_font;H.textAlign="right";if(G.dataset_type=="summary_tree"){var W=G.data,J=G.max,o=G.avg,b=Math.ceil(G.delta*ap);for(var al=0,F=W.length;al<F;al++){var Y=Math.floor((W[a
l][0]-L)*ap);var X=W[al][1];if(!X){continue}var ai=X/J*this.summary_draw_height;H.fillStyle="black";H.fillRect(Y+U,this.summary_draw_height-ai,b,ai);if(this.prefs.show_counts&&H.measureText(X).width<b){H.fillStyle="#bbb";H.textAlign="center";H.fillText(X,Y+U+(b/2),this.summary_draw_height-5)}}e="Summary";q.append(Q);return Q}if(G.message){Q.css({border:"solid red","border-width":"2px 2px 2px 0px"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+U,aq)}var an=G.data;var ak=0;for(var al=0,F=an.length;al<F;al++){var R=an[al],P=R[0],am=R[1],Z=R[2],M=R[3];if(am<=ah&&Z>=L){var ab=Math.floor(Math.max(0,(am-L)*ap)),I=Math.ceil(Math.min(a,Math.max(0,(Z-L)*ap))),V=(p==="Dense"?1:(1+ao[P]))*aq;if(G.dataset_type==="bai"){var t=R[4];H.fillStyle=h;if(R[5] instanceof Array){var C=Math.floor(Math.max(0,(R[5][0]-L)*ap)),O=Math.ceil(Math.min(a,Math.max(0,(R[5][1]-L)*ap))),A=Math.floor(Math.max(0,(R[6][0]-L)*ap)),u=Math.ceil(Math.min(a,Math.max(0,(R[6][1]-L)*ap)));if(R[5][1]>=L&&
R[5][0]<=ah){this.rect_or_text(H,ap,L,ah,R[5][0],R[5][2],C+U,O-C,V)}if(R[6][1]>=L&&R[6][0]<=ah){this.rect_or_text(H,ap,L,ah,R[6][0],R[6][2],A+U,u-A,V)}if(A>O){H.fillStyle="#999";H.fillRect(O+U,V+5,A-O,1)}}else{H.fillStyle=h;this.rect_or_text(H,ap,L,ah,am,M,ab+U,I-ab,V)}if(p!=="Dense"&&!aa&&am>L){H.fillStyle=this.prefs.label_color;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(P,I+2+U,V+8)}else{H.textAlign="right";H.fillText(P,ab-2+U,V+8)}H.fillStyle=h}}else{if(G.dataset_type==="interval_index"){if(aa){H.fillStyle=h;H.fillRect(ab+U,V+5,I-ab,1)}else{var E=R[4],T=R[5],ad=R[6],g=R[7];var D,af,N=null,ar=null;if(T&&ad){N=Math.floor(Math.max(0,(T-L)*ap));ar=Math.ceil(Math.min(a,Math.max(0,(ad-L)*ap)))}if(p!=="Dense"&&M!==undefined&&am>L){H.fillStyle=ae;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ab-2+U,V+8)}H.fillStyle=h}if(g){if(E){if(E=="+"){H.fillStyle=RIGHT_STRAND}else{if(E=="-"){H
.fillStyle=LEFT_STRAND}}H.fillRect(ab+U,V,I-ab,10);H.fillStyle=h}for(var aj=0,f=g.length;aj<f;aj++){var s=g[aj],d=Math.floor(Math.max(0,(s[0]-L)*ap)),S=Math.ceil(Math.min(a,Math.max((s[1]-L)*ap)));if(d>S){continue}D=5;af=3;H.fillRect(d+U,V+af,S-d,D);if(N!==undefined&&!(d>ar||S<N)){D=9;af=1;var ag=Math.max(d,N),z=Math.min(S,ar);H.fillRect(ag+U,V+af,z-ag,D)}}}else{D=9;af=1;H.fillRect(ab+U,V+af,I-ab,D);if(R.strand){if(R.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(R.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}H.fillRect(ab+U,V,I-ab,10);H.fillStyle=h}}}}else{if(G.dataset_type==="vcf"){if(aa){H.fillStyle=h;H.fillRect(ab+U,V+5,I-ab,1)}else{var r=R[4],m=R[5],c=R[6];D=9;af=1;H.fillRect(ab+U,V,I-ab,D);if(p!=="Dense"&&M!==undefined&&am>L){H.fillStyle=ae;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ab-2+U,V+8)}H.fillStyle=h}var l=r+" / "+m;if(am>L&&H.measureText(l).width<(I-ab)){H.fillStyle="white";H.textAlig
n="center";H.fillText(l,U+ab+(I-ab)/2,V+8);H.fillStyle=h}}}}}ak++}}q.append(Q);return Q},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.b
lock_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function()
{RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.
min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview
-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<inp
ut/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info
;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(d){this.origin
al_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,h=(a.high-a.
low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(c.chrom===""){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.reset();c.redraw(true);for(var g i
n c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this
.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_locatio
n(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Track=function(b,a,c){this.name=b;this.parent_
element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name)}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("e
rror");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined
){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configuration"]=function(){var l=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},j=function(){d.update_options(d.track_id);hide_modal();$(window).unbind("keypress.check_enter_esc")},k=function(m){if((m.keyCode||m.which)===27){l()}else{if((m.keyCode||m.which)===13){j()}}};$(window).bind("keypress.check_enter_esc",k);show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:l,OK
:j})};b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};make_popupmenu(d.name_div,b)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove();this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){if(!c.initial_canvas){c.initial_ca
nvas=$(tile_element).clone();var l=tile_element.get(0).getContext("2d");var j=c.initial_canvas.get(0).getContext("2d");var k=l.getImageData(0,0,l.canvas.width,l.canvas.height);j.putImageData(k,0,0);c.set_overview()}c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10
)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:
this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).getContext("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_
px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={color:"black",min_value:undefined,max_value:undefined,mode:this.mode};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;a.container_div.find(".yaxislabel").remove();var e=$("<div />").addCl
ass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,s,c,e){if(this.vertical_range===undefined){return}var t=s*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),w=p+"_"+s;if(this.data_cache.get(w)===undefined){this.get_data(p,s);return}v
ar j=this.data_cache.get(w);if(j===null){return}b.css({position:"absolute",top:0,left:(t-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,u=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();o.fillStyle=this.prefs.color;if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var v,h;for(var q=0,r=data.length;q<r;q++){v=Math.round((data[q][0]-t)*e);h=data[q][1];if(h===null){if(k&&m==="Filled"){o.lineTo(v,d)}k=false;continue}if(h<l){h=l}else{if(h>g){h=g}}if(m==="Histogram"){h=Math.round(d-(h-l)/n*d);o.fillRect(v,h,f,d-h)}else{if(m==="Intensity"){h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(v,0,f,d)}else{h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(v,h)}else{k=true;if(m==="Filled"){o.moveTo(v,d);o.lineTo(v,h)}else{o.moveTo(v,h)}}}}}if(m==="Filled"){if(k){o.lineTo(v,d)}o.fill()}else
{o.stroke()}c.append(b);return b},gen_options:function(n){var a=$("<div />").addClass("form-row");var e="track_"+n+"_color",b=$("<label />").attr("for",e).text("Color:"),c=$("<input />").attr("id",e).attr("name",e).val(this.prefs.color),h="track_"+n+"_minval",m=$("<label></label>").attr("for",h).text("Min value:"),d=(this.prefs.min_value===undefined?"":this.prefs.min_value),l=$("<input></input>").attr("id",h).val(d),k="track_"+n+"_maxval",g=$("<label></label>").attr("for",k).text("Max value:"),j=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",k).val(j);return a.append(m).append(l).append(g).append(f).append(b).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();color=$("#track_"+c+"_color").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value||color!==this.prefs.color){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.prefs.color=color;this.vert
ical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"black",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_colo
r!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_
slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefine
d&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(ad,n,r,aq){var M=n*DENSITY*ad,ai=(n+1)*DENSITY*ad,L=ai-M;var ak=(!this.initial_canvas?"initial":M+"_"+ai);var H=this.data_cache.get(ak);var e;if(H===undefined||(this.mode!=="Auto"&&H.dataset_type==="summary_tree")){this.data_queue[[M,ai]]=true;this.get_data(M,ai);return}var a=Math.ceil(L*aq),R=$("<canvas class='tile'></canvas>"),af=this.prefs.label_color,h=this.prefs.block_color,q=this.mode,w=25,ab=(q==="Squish")||(q==="Dense")&&(q!=="Pack")||(q==="Auto"&&(H.extra_info==="no_detail")),V=this.left_offset,ap,C,ar;if(H.dataset_type==="summary_tree"){C=this.summary_draw_height}else{if(q==="Dense"){C=w;ar=10}else{ar=(ab?this.vertical_nodetail_px:this.vertical_detail_px);var
z=(aq<0.0001?1/view.zoom_res:aq);C=this.incremental_slots(z,H.data,ab,q)*ar+w;ap=this.inc_slots[z]}}R.css({position:"absolute",top:0,left:(M-this.view.low)*aq-V});R.get(0).width=a+V;R.get(0).height=C;r.parent().css("height",Math.max(this.height_px,C)+"px");var I=R.get(0).getContext("2d");I.fillStyle=h;I.font=this.default_font;I.textAlign="right";this.container_div.find(".yaxislabel").remove();if(H.dataset_type=="summary_tree"){var X=H.data,K=H.max,p=H.avg,b=Math.ceil(H.delta*aq);var o=$("<div />").addClass("yaxislabel").text(K);o.css({position:"absolute",top:"22px",left:"10px"});o.prependTo(this.container_div);for(var am=0,G=X.length;am<G;am++){var Z=Math.floor((X[am][0]-M)*aq);var Y=X[am][1];if(!Y){continue}var aj=Y/K*this.summary_draw_height;I.fillStyle="black";I.fillRect(Z+V,this.summary_draw_height-aj,b,aj);if(this.prefs.show_counts&&I.measureText(Y).width<b){I.fillStyle="#bbb";I.textAlign="center";I.fillText(Y,Z+V+(b/2),this.summary_draw_height-5)}}e="Summary";r.append
(R);return R}if(H.message){R.css({border:"solid red","border-width":"2px 2px 2px 0px"});I.fillStyle="red";I.textAlign="left";I.fillText(H.message,100+V,ar)}var ao=H.data;var al=0;for(var am=0,G=ao.length;am<G;am++){var S=ao[am],Q=S[0],an=S[1],aa=S[2],N=S[3];if(an<=ai&&aa>=M){var ac=Math.floor(Math.max(0,(an-M)*aq)),J=Math.ceil(Math.min(a,Math.max(0,(aa-M)*aq))),W=(q==="Dense"?1:(1+ap[Q]))*ar;if(H.dataset_type==="bai"){var u=S[4];I.fillStyle=h;if(S[5] instanceof Array){var D=Math.floor(Math.max(0,(S[5][0]-M)*aq)),P=Math.ceil(Math.min(a,Math.max(0,(S[5][1]-M)*aq))),B=Math.floor(Math.max(0,(S[6][0]-M)*aq)),v=Math.ceil(Math.min(a,Math.max(0,(S[6][1]-M)*aq)));if(S[5][1]>=M&&S[5][0]<=ai){this.rect_or_text(I,aq,M,ai,S[5][0],S[5][2],D+V,P-D,W)}if(S[6][1]>=M&&S[6][0]<=ai){this.rect_or_text(I,aq,M,ai,S[6][0],S[6][2],B+V,v-B,W)}if(B>P){I.fillStyle="#999";I.fillRect(P+V,W+5,B-P,1)}}else{I.fillStyle=h;this.rect_or_text(I,aq,M,ai,an,N,ac+V,J-ac,W)}if(q!=="Dense"&&!ab&&an>M){I.fillStyle=th
is.prefs.label_color;if(n===0&&ac-I.measureText(N).width<0){I.textAlign="left";I.fillText(Q,J+2+V,W+8)}else{I.textAlign="right";I.fillText(Q,ac-2+V,W+8)}I.fillStyle=h}}else{if(H.dataset_type==="interval_index"){if(ab){I.fillStyle=h;I.fillRect(ac+V,W+5,J-ac,1)}else{var F=S[4],U=S[5],ae=S[6],g=S[7];var E,ag,O=null,at=null;if(U&&ae){O=Math.floor(Math.max(0,(U-M)*aq));at=Math.ceil(Math.min(a,Math.max(0,(ae-M)*aq)))}if(q!=="Dense"&&N!==undefined&&an>M){I.fillStyle=af;if(n===0&&ac-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+V,W+8)}else{I.textAlign="right";I.fillText(N,ac-2+V,W+8)}I.fillStyle=h}if(g){if(F){if(F=="+"){I.fillStyle=RIGHT_STRAND}else{if(F=="-"){I.fillStyle=LEFT_STRAND}}I.fillRect(ac+V,W,J-ac,10);I.fillStyle=h}for(var ak=0,f=g.length;ak<f;ak++){var t=g[ak],d=Math.floor(Math.max(0,(t[0]-M)*aq)),T=Math.ceil(Math.min(a,Math.max((t[1]-M)*aq)));if(d>T){continue}E=5;ag=3;I.fillRect(d+V,W+ag,T-d,E);if(O!==undefined&&!(d>at||T<O)){E=9;ag=1;var ah=Math.max(d,O)
,A=Math.min(T,at);I.fillRect(ah+V,W+ag,A-ah,E)}}}else{E=9;ag=1;I.fillRect(ac+V,W+ag,J-ac,E);if(S.strand){if(S.strand=="+"){I.fillStyle=RIGHT_STRAND_INV}else{if(S.strand=="-"){I.fillStyle=LEFT_STRAND_INV}}I.fillRect(ac+V,W,J-ac,10);I.fillStyle=h}}}}else{if(H.dataset_type==="vcf"){if(ab){I.fillStyle=h;I.fillRect(ac+V,W+5,J-ac,1)}else{var s=S[4],m=S[5],c=S[6];E=9;ag=1;I.fillRect(ac+V,W,J-ac,E);if(q!=="Dense"&&N!==undefined&&an>M){I.fillStyle=af;if(n===0&&ac-I.measureText(N).width<0){I.textAlign="left";I.fillText(N,J+2+V,W+8)}else{I.textAlign="right";I.fillText(N,ac-2+V,W+8)}I.fillStyle=h}var l=s+" / "+m;if(an>M&&I.measureText(l).width<(J-ac)){I.fillStyle="white";I.textAlign="center";I.fillText(l,V+ac+(J-ac)/2,W+8);I.fillStyle=h}}}}}al++}}r.append(R);return R},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k
="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vert
ical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0

galaxy-dist commit 9c80bcb0bfa4: Fix for viewing a form definition.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287424478 14400
# Node ID 9c80bcb0bfa49d553428aca22043a8a68f773c65
# Parent 98739e24554c777400732e8a2d8f6c18b2b8768a
Fix for viewing a form definition.
--- a/lib/galaxy/web/controllers/forms.py
+++ b/lib/galaxy/web/controllers/forms.py
@@ -104,7 +104,7 @@ class Forms( BaseController ):
message='Invalid form',
status='error' ) )
return trans.fill_template( '/admin/forms/show_form_read_only.mako',
- form=fdc.latest_form )
+ form_definition=fdc.latest_form )
def __form_types_widget(self, trans, selected='none'):
form_type_selectbox = SelectField( 'form_type_selectbox' )
if selected == 'none':
1
0

galaxy-dist commit 98739e24554c: Fix for setting columns in workflow builder for ColumnListParameter. e.g. allows splitting lists of columns by newlines and commas and strips leading 'c's.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1287173342 14400
# Node ID 98739e24554c777400732e8a2d8f6c18b2b8768a
# Parent 1f4d6b25a84e785c3feee1733a19ac10877a985b
Fix for setting columns in workflow builder for ColumnListParameter. e.g. allows splitting lists of columns by newlines and commas and strips leading 'c's.
--- a/lib/galaxy/tools/parameters/basic.py
+++ b/lib/galaxy/tools/parameters/basic.py
@@ -562,7 +562,8 @@ class SelectToolParameter( ToolParameter
if value == '':
value = None
else:
- value = value.split( "\n" )
+ if not isinstance( value, list ):
+ value = value.split( "\n" )
return UnvalidatedValue( value )
legal_values = self.get_legal_values( trans, context )
if isinstance( value, list ):
@@ -773,16 +774,30 @@ class ColumnListParameter( SelectToolPar
Label convention prepends column number with a 'c', but tool uses the integer. This
removes the 'c' when entered into a workflow.
"""
- if type( value ) == list:
- # We have a multi-select list
- new_value = []
- for item in value:
- if item.startswith( "c" ):
- item = item[1:]
- new_value.append( item )
- value = new_value
- elif value and value.startswith( "c" ):
- value = value[1:]
+ def _strip_c( column ):
+ column = column.strip().lower()
+ if column.startswith( 'c' ):
+ column = column[1:]
+ return column
+ if self.multiple:
+ #split on newline and ,
+ if value:
+ column_list = []
+ if not isinstance( value, list ):
+ value = value.split( '\n' )
+ for column in value:
+ for column2 in column.split( ',' ):
+ column2 = column2.strip()
+ if column2:
+ column_list.append( column2 )
+ value = map( _strip_c, column_list )
+ else:
+ value = []
+ else:
+ if value:
+ value = _strip_c( value )
+ else:
+ value = None
return super( ColumnListParameter, self ).from_html( value, trans, context )
def get_column_list( self, trans, other_values ):
"""
1
0

galaxy-dist commit 4d5b00b6fe74: Show Image type datasets inline in browser
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1287007951 14400
# Node ID 4d5b00b6fe741a35320a572302d1fb8bb7eb6971
# Parent 5f4ad373807158f8b2ac0bcaafab9f57b972e562
Show Image type datasets inline in browser
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -350,7 +350,7 @@ class DatasetInterface( BaseController,
trans.response.set_content_type(mime)
trans.log_event( "Display dataset id: %s" % str( dataset_id ) )
- if to_ext or isinstance(data.datatype, datatypes.binary.Binary) or isinstance(data.datatype, datatypes.images.Image): # Saving the file, or binary/image file
+ if to_ext or isinstance(data.datatype, datatypes.binary.Binary): # Saving the file, or binary file
if data.extension in composite_extensions:
return self.archive_composite_dataset( trans, data, **kwd )
else:
@@ -366,13 +366,13 @@ class DatasetInterface( BaseController,
raise paste.httpexceptions.HTTPNotFound( "File Not Found (%s)." % data.file_name )
max_peek_size = 1000000 # 1 MB
- if preview and os.stat( data.file_name ).st_size > max_peek_size:
+ if not preview or isinstance(data.datatype, datatypes.images.Image) or os.stat( data.file_name ).st_size < max_peek_size:
+ return open( data.file_name )
+ else:
trans.response.set_content_type( "text/html" )
return trans.stream_template_mako( "/dataset/large_file.mako",
truncated_data = open( data.file_name ).read(max_peek_size),
data = data )
- else:
- return open( data.file_name )
@web.expose
@web.require_login( "see all available datasets" )
1
0

galaxy-dist commit c0feb970e48d: sample tracking bug fixes
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287000426 14400
# Node ID c0feb970e48de8b713a9a516cad61950ed0641b5
# Parent 77e13329ab8b9e69089400259eb70cda9525ec80
sample tracking bug fixes
--- a/templates/admin/requests/rename_datasets.mako
+++ b/templates/admin/requests/rename_datasets.mako
@@ -3,15 +3,14 @@
<% from galaxy.web.controllers.requests_admin import build_rename_datasets_for_sample_select_field %>
-<br/><br/>
-<font color="red"><b><i>A dataset can be renamed only if its status is "Not Started"</i></b></font>
+<h3>Rename datasets for Sample "${sample.name}"</h3><ul class="manage-table-actions"><li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Browse datasets</a></li><li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='manage_request', cntrller=cntrller, id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='manage_request', cntrller='requests_admin', id=trans.security.encode_id( sample.request.id ) )}">Browse this request</a></li></ul>
@@ -19,40 +18,39 @@
${render_msg( message, status )}
%endif
+${render_msg( 'A dataset can be renamed only if it is in <b>Not Started</b> state.', 'warning' )}
<div class="toolForm">
- <div class="toolFormTitle">Rename datasets for Sample "${sample.name}"</div>
- <div class="toolFormBody">
- <form name="rename_datasets" id="rename_datasets" action="${h.url_for( controller='requests_admin', action='rename_datasets', id_list=id_list, sample_id=trans.security.encode_id( sample.id ) )}" method="post" >
- <table class="grid">
- <thead>
- <tr>
- <th>Prepend directory name</th>
- <th>Name</th>
- <th>Path on sequencer</th>
- </tr>
- <thead>
- <tbody>
- %for sample_dataset in sample_datasets:
- %if sample_dataset.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
- <tr>
- <td>
- <% rename_datasets_for_sample_select_field = build_rename_datasets_for_sample_select_field( trans, sample_dataset ) %>
- ${rename_datasets_for_sample_select_field}
- </td>
- <td>
- <input type="text" name="new_name_${trans.security.encode_id( sample_dataset.id} )" value="${sample_dataset.name}" size="100"/>
- </td>
- <td>${sample_dataset.file_path}</td>
- </tr>
- %endif
- %endfor
- </tbody>
- </table>
- <br/>
- <div class="form-row">
- <input type="submit" name="rename_datasets_button" value="Save"/>
- <input type="submit" name="cancel_rename_datasets_button" value="Close"/>
- </div>
- </form>
- </div>
+ <form name="rename_datasets" id="rename_datasets" action="${h.url_for( controller='requests_admin', action='rename_datasets', id_list=id_list, sample_id=trans.security.encode_id( sample.id ) )}" method="post" >
+ <table class="grid">
+ <thead>
+ <tr>
+ <th>Prepend directory name</th>
+ <th>Name</th>
+ <th>Path on sequencer</th>
+ </tr>
+ <thead>
+ <tbody>
+ %for id in id_list:
+ <% sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( id ) ) %>
+ %if sample_dataset.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
+ <tr>
+ <td>
+ <% rename_datasets_for_sample_select_field = build_rename_datasets_for_sample_select_field( trans, sample_dataset ) %>
+ ${rename_datasets_for_sample_select_field.get_html()}
+ </td>
+ <td>
+ <input type="text" name="new_name_${trans.security.encode_id( sample_dataset.id ) }" value="${sample_dataset.name}" size="100"/>
+ </td>
+ <td>${sample_dataset.file_path}</td>
+ </tr>
+ %endif
+ %endfor
+ </tbody>
+ </table>
+ <br/>
+ <div class="form-row">
+ <input type="submit" name="rename_datasets_button" value="Save"/>
+ <input type="submit" name="cancel_rename_datasets_button" value="Close"/>
+ </div>
+ </form></div>
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -105,8 +105,7 @@ class RequestsGrid( grids.Grid ):
class RequestsCommon( BaseController, UsesFormDefinitionWidgets ):
@web.json
- def sample_state_updates( self, trans, ids=None, states=None, cntrller=None ):
- # TODO fix this mthod - cntrller is required in the signature.
+ def sample_state_updates( self, trans, cntrller, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
@@ -424,13 +423,19 @@ class RequestsCommon( BaseController, Us
except:
invalid_id_redirect( trans, cntrller, folder_id )
for sample_id in selected_samples:
- sample = trans.sa_session.query( trans.model.Sample ).get( sample_id )
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
sample.library = library
sample.folder = folder
trans.sa_session.add( sample )
trans.sa_session.flush()
trans.sa_session.refresh( request )
message = 'Changes made to the selected samples have been saved. '
+ return trans.response.send_redirect( web.url_for( controller='requests_common',
+ action='manage_request',
+ cntrller=cntrller,
+ id=request_id,
+ status=status,
+ message=message ) )
elif params.get( 'cancel_change_lib_button', False ):
return trans.response.send_redirect( web.url_for( controller='requests_common',
action='manage_request',
@@ -859,7 +864,7 @@ class RequestsCommon( BaseController, Us
# The user has selected a sample to copy.
library_id = current_samples[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
folder_id = current_samples[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
- name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( index+1 )
+ name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( len( current_samples ) + 1 )
library_id = 'none'
folder_id = 'none'
field_values = [ val for val in current_samples[ copy_sample_index ][ 'field_values' ] ]
@@ -867,7 +872,7 @@ class RequestsCommon( BaseController, Us
# The user has not selected a sample to copy (may just be adding a sample).
library_id = None
folder_id = None
- name = 'Sample_%i' % ( sample_index+1 )
+ name = 'Sample_%i' % ( len( current_samples ) + 1 )
field_values = [ '' for field in request.type.sample_form.fields ]
# Build the library_select_field and folder_select_field for the new sample being added.
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans,
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -9,11 +9,13 @@ import logging, os, pexpect, ConfigParse
log = logging.getLogger( __name__ )
-class UserColumn( grids.TextColumn ):
- def get_value( self, trans, grid, request ):
- return request.user.email
+
class AdminRequestsGrid( RequestsGrid ):
+ class UserColumn( grids.TextColumn ):
+ def get_value( self, trans, grid, request ):
+ return request.user.email
+ # Grid definition
columns = [ col for col in RequestsGrid.columns ]
columns.append( UserColumn( "User",
model_class=model.User,
@@ -180,7 +182,7 @@ class RequestsAdmin( BaseController, Use
@web.json
def get_file_details( self, trans, id, folder_path ):
def print_ticks( d ):
- # TODO: why is this method here? Add comments!
+ # pexpect timeout method
pass
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
@@ -243,16 +245,20 @@ class RequestsAdmin( BaseController, Use
if not sample_dataset_id:
return invalid_id_redirect( trans, 'requests_admin', sample_dataset_id )
id_list = util.listify( sample_dataset_id )
+ selected_sample_datasets = []
+ for sample_dataset_id in id_list:
+ try:
+ selected_sample_datasets.append( trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) ) )
+ except:
+ return invalid_id_redirect( trans, 'requests_admin', sample_dataset_id )
if operation == "view":
- sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
return trans.fill_template( '/admin/requests/dataset.mako',
- sample_dataset=sample_dataset )
+ sample_dataset=selected_sample_datasets[0] )
elif operation == "delete":
not_deleted = []
- for sample_dataset_id in id_list:
- sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
- sample_id = sample_dataset.sample_id
- if sample_dataset.status == sample_dataset.sample.transfer_status.NOT_STARTED:
+ for sample_dataset in selected_sample_datasets:
+ sample_id = sample_dataset.sample.id
+ if sample_dataset.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
trans.sa_session.delete( sample_dataset )
trans.sa_session.flush()
else:
@@ -267,13 +273,26 @@ class RequestsAdmin( BaseController, Use
status=status,
message=message ) )
elif operation == "rename":
- sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
+ # if none of the selected sample datasets are in the NOT_STARTED state,
+ # then display error message
+ flag = True
+ for sd in selected_sample_datasets:
+ if sd.status == trans.app.model.Sample.transfer_status.NOT_STARTED:
+ flag = False
+ break
+ if flag:
+ status = 'error'
+ message = 'A dataset can be renamed only if it is in the <b>Not Started</b> state.'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='manage_datasets',
+ sample_id=trans.security.encode_id( selected_sample_datasets[0].sample.id ),
+ status=status,
+ message=message ) )
return trans.fill_template( '/admin/requests/rename_datasets.mako',
- sample=sample_dataset.sample,
+ sample=selected_sample_datasets[0].sample,
id_list=id_list )
elif operation == "start transfer":
- sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( sample_dataset_id ) )
- self.__start_datatx( trans, sample_dataset.sample, id_list )
+ self.__start_datatx( trans, selected_sample_datasets[0].sample, selected_sample_datasets )
# Render the grid view
sample_id = params.get( 'sample_id', None )
try:
@@ -340,7 +359,7 @@ class RequestsAdmin( BaseController, Use
message = 'Changes saved successfully.'
return trans.fill_template( '/admin/requests/rename_datasets.mako',
sample=sample,
- sample_datasets=sample_datasets,
+ id_list=id_list,
message=message,
status=status )
return trans.response.send_redirect( web.url_for( controller='requests_admin',
@@ -353,38 +372,48 @@ class RequestsAdmin( BaseController, Use
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
request_id = kwd.get( 'request_id', None )
+ files = []
try:
request = trans.sa_session.query( trans.model.Request ).get( trans.security.decode_id( request_id ) )
except:
return invalid_id_redirect( trans, 'requests_admin', request_id )
- files_list = util.listify( params.get( 'files_list', [] ) )
+ selected_files = util.listify( params.get( 'files_list', [] ) )
folder_path = util.restore_text( params.get( 'folder_path', request.type.datatx_info[ 'data_dir' ] ) )
- selected_value = kwd.get( 'sample_id', 'none' )
- sample_id_select_field = self.__build_sample_id_select_field( request, selected_value )
+ selected_sample_id = kwd.get( 'sample_id', 'none' )
+ sample_id_select_field = self.__build_sample_id_select_field( trans, request, selected_sample_id )
# The __get_files() method redirects here with a status of 'error' and a message if there
# was a problem retrieving the files.
if folder_path and status != 'error':
folder_path = self.__check_path( folder_path )
- sample_id = params.get( 'sample_id', None )
- try:
- sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( sample_id ) )
- except:
- return invalid_id_redirect( trans, 'requests_admin', sample_id )
- # Get the filenames from the remote host
- files = self.__get_files( trans, request, folder_path )
- if params.get( 'open_folder', False ):
- if len( files_list ) == 1:
- folder_path = os.path.join( folder_path, files_list[0] )
- folder_path = self.__check_path( folder_path )
+ if params.get( 'folder_up', False ):
+ if folder_path[-1] == os.sep:
+ folder_path = os.path.dirname(folder_path[:-1])
+ folder_path = self.__check_path( folder_path )
elif params.get( 'select_show_datasets_button', False ) or params.get( 'select_more_button', False ):
- sample_dataset_file_names = self.__save_sample_datasets( trans, sample, files_list, folder_path )
+ # get the sample these datasets are associated with
+ try:
+ sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( selected_sample_id ) )
+ sample.library.id and sample.folder.id
+ except:
+ # if no sample (with associated library & folder) has been selected
+ status = 'error'
+ message = 'Select a sample with associated data library and folder before selecting the dataset(s).'
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='get_data',
+ request_id=trans.security.encode_id( request.id ),
+ folder_path=folder_path,
+ status=status,
+ message=message ) )
+ # save the sample datasets
+ sample_dataset_file_names = self.__save_sample_datasets( trans, sample, selected_files, folder_path )
if sample_dataset_file_names:
message = 'Datasets (%s) have been selected for sample (%s)' % \
( str( sample_dataset_file_names )[1:-1].replace( "'", "" ), sample.name )
if params.get( 'select_show_datasets_button', False ):
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
- sample_id=sample_id,
+ request_id=request_id,
+ sample_id=trans.security.encode_id( sample.id ),
message=message,
status=status ) )
else: # 'select_more_button' was clicked
@@ -392,11 +421,13 @@ class RequestsAdmin( BaseController, Use
action='get_data',
request_id=request_id,
folder_path=folder_path,
- sample_id=sample_id,
+ sample_id=sample.id,
open_folder=True,
message=message,
status=status ) )
- return trans.fill_template( '/admin/requests/dataset_transfer.mako',
+ # Get the filenames from the remote host
+ files = self.__get_files( trans, request, folder_path )
+ return trans.fill_template( '/admin/requests/get_data.mako',
cntrller='requests_admin',
request=request,
sample_id_select_field=sample_id_select_field,
@@ -434,20 +465,20 @@ class RequestsAdmin( BaseController, Use
if ok:
return output.splitlines()
return trans.response.send_redirect( web.url_for( controller='requests_admin',
- action='get_data',
- request_id=trans.security.encode_id( request.id ),
- folder_path=folder_path,
- status=status,
- message=message ) )
+ action='get_data',
+ request_id=trans.security.encode_id( request.id ),
+ folder_path=folder_path,
+ status=status,
+ message=message ) )
def __check_path( self, a_path ):
# Return a valid folder_path
if a_path and not a_path.endswith( os.sep ):
a_path += os.sep
return a_path
- def __save_sample_datasets( self, trans, sample, files_list, folder_path ):
+ def __save_sample_datasets( self, trans, sample, selected_files, folder_path ):
sample_dataset_file_names = []
- if files_list:
- for f in files_list:
+ if selected_files:
+ for f in selected_files:
filepath = os.path.join( folder_path, f )
if f[-1] == os.sep:
# FIXME: The selected item is a folder so transfer all the folder contents
@@ -522,7 +553,7 @@ class RequestsAdmin( BaseController, Use
trans.sa_session.add( lfp )
trans.sa_session.flush()
return datatx_user
- def __send_message( self, trans, datatx_info, sample, id_list ):
+ def __send_message( self, trans, datatx_info, sample, selected_sample_datasets ):
"""Ceates an xml message and sends it to the rabbitmq server"""
# Create the xml message based on the following template
xml = \
@@ -542,8 +573,7 @@ class RequestsAdmin( BaseController, Use
<file>%(FILE)s</file></dataset>'''
datasets = ''
- for id in id_list:
- sample_dataset = trans.sa_session.query( trans.model.SampleDataset ).get( trans.security.decode_id( id ) )
+ for sample_dataset in selected_sample_datasets:
if sample_dataset.status == sample.transfer_status.NOT_STARTED:
datasets = datasets + dataset_xml % dict( ID=str( sample_dataset.id ),
NAME=sample_dataset.name,
@@ -574,7 +604,7 @@ class RequestsAdmin( BaseController, Use
routing_key=trans.app.config.amqp['routing_key'] )
chan.close()
conn.close()
- def __start_datatx( self, trans, sample, id_list ):
+ def __start_datatx( self, trans, sample, selected_sample_datasets ):
datatx_user = self.__setup_datatx_user( trans, sample.library, sample.folder )
# Validate sequencer information
datatx_info = sample.request.type.datatx_info
@@ -582,8 +612,8 @@ class RequestsAdmin( BaseController, Use
message = "Error in sequencer login information."
status = "error"
else:
- self.__send_message( trans, datatx_info, sample, id_list )
- message = "%i datasets have been queued for transfer from the sequencer. Click the Refresh button above to see the latest transfer status." % len( id_list )
+ self.__send_message( trans, datatx_info, sample, selected_sample_datasets )
+ message = "%i datasets have been queued for transfer from the sequencer. Click the Refresh button above to see the latest transfer status." % len( selected_sample_datasets )
status = "done"
return trans.response.send_redirect( web.url_for( controller='requests_admin',
action='manage_datasets',
@@ -599,6 +629,14 @@ class RequestsAdmin( BaseController, Use
obj_id = kwd.get( 'id', None )
if operation == "view_form_definition":
return self.view_form_definition( trans, **kwd )
+ elif operation == "view":
+ return self.view_request_type( trans, **kwd )
+ elif operation == "delete":
+ return self.delete_request_type( trans, **kwd )
+ elif operation == "undelete":
+ return self.undelete_request_type( trans, **kwd )
+ elif operation == "permissions":
+ return self.request_type_permissions( trans, **kwd )
# Render the grid view
return self.requesttype_grid( trans, **kwd )
@web.expose
@@ -655,26 +693,26 @@ class RequestsAdmin( BaseController, Use
message=message,
status=status )
def __create_request_type_form( self, trans, **kwd ):
- request_form_definitionss = self.get_all_forms( trans,
+ request_form_definitions = self.get_all_forms( trans,
filter=dict( deleted=False ),
form_type=trans.model.FormDefinition.types.REQUEST )
sample_form_definitions = self.get_all_forms( trans,
filter=dict( deleted=False ),
form_type=trans.model.FormDefinition.types.SAMPLE )
- if not request_form_definitionss or not sample_form_definitions:
+ if not request_form_definitions or not sample_form_definitions:
return [],[]
params = util.Params( kwd )
request_form_id = params.get( 'request_form_id', 'none' )
sample_form_id = params.get( 'sample_form_id', 'none' )
request_form_id_select_field = build_select_field( trans,
- objs=request_form_definitionss,
- label_attr='id',
+ objs=request_form_definitions,
+ label_attr='name',
select_field_name='request_form_id',
selected_value=request_form_id,
refresh_on_change=False )
sample_form_id_select_field = build_select_field( trans,
objs=sample_form_definitions,
- label_attr='id',
+ label_attr='name',
select_field_name='sample_form_id',
selected_value=sample_form_id,
refresh_on_change=False )
@@ -826,7 +864,7 @@ class RequestsAdmin( BaseController, Use
status=status,
message=message )
# ===== Methods for building SelectFields used on various admin_requests forms
- def __build_sample_id_select_field( self, request, selected_value ):
+ def __build_sample_id_select_field( self, trans, request, selected_value ):
return build_select_field( trans, request.samples, 'name', 'sample_id', selected_value=selected_value, refresh_on_change=False )
def __build_rename_dataset_select_field( self, trans, request_type=None ):
if request_type:
--- a/templates/admin/requests/get_data.mako
+++ b/templates/admin/requests/get_data.mako
@@ -68,13 +68,6 @@
}
</script>
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-</style>
-
<br/><br/><ul class="manage-table-actions">
@@ -92,7 +85,7 @@
<div class="toolForm"><div class="toolFormTitle">Select files for transfer</div>
- <form name="get_data" id="get_data" action="${h.url_for( controller='requests_admin', action='get_data', cntrller=cntrller, request_id=trans.security.encode_id( request.id )}" method="post" >
+ <form name="get_data" id="get_data" action="${h.url_for( controller='requests_admin', action='get_data', cntrller=cntrller, request_id=trans.security.encode_id( request.id ))}" method="post" ><div class="form-row"><label>Sample:</label>
${sample_id_select_field.get_html()}
--- a/templates/requests/common/manage_request.mako
+++ b/templates/requests/common/manage_request.mako
@@ -62,7 +62,7 @@
// Build request data
var ids = []
var states = []
- $.each( sample_states, function ( id, state ) {
+ $.each( sample_states, function ( id, state, cntrller ) {
ids.push( id );
states.push( state );
});
@@ -73,7 +73,7 @@
dataType: "json",
data: { ids: ids.join( "," ), states: states.join( "," ) },
success : function ( data ) {
- $.each( data, function(id, val, cntrller ) {
+ $.each( data, function( cntrller, id, val ) {
// Replace HTML
var cell1 = $("#sampleState-" + id);
cell1.html( val.html_state );
@@ -146,8 +146,6 @@
</div><br/><br/>
-<font color="red"><b><i>A dataset can be renamed only if its status is "Not Started"</i></b></font>
-
<ul class="manage-table-actions"><li><a class="action-button" id="seqreq-${request.id}-popup" class="menubutton">Sequencing Request Actions</a></li><div popupmenu="seqreq-${request.id}-popup">
1
0

galaxy-dist commit 5f4ad3738071: trackster: Fix ReferenceTrack not drawing, summary_tree display is now histogram and more fine grained. Small overview fix, UI tweaks
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1287007196 14400
# Node ID 5f4ad373807158f8b2ac0bcaafab9f57b972e562
# Parent 76f09e5ccb85569b56e66676e4c761f4348336fc
trackster: Fix ReferenceTrack not drawing, summary_tree display is now histogram and more fine grained. Small overview fix, UI tweaks
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -292,7 +292,7 @@ var View = function( container, chrom, t
view.low = Math.max(low, 0);
view.high = Math.min(high, view.max_high);
}
- view.overview_viewport.find("canvas").remove();
+ view.reset_overview();
view.redraw();
},
@@ -438,6 +438,13 @@ var View = function( container, chrom, t
this.low = Math.round(cur_center - new_half);
this.high = Math.round(cur_center + new_half);
this.redraw();
+ },
+ reset_overview: function() {
+ this.overview_viewport.find("canvas").remove();
+ this.overview_viewport.height(this.default_overview_height);
+ this.overview_box.height(this.default_overview_height);
+ this.overview_close.hide();
+ this.overview_highlight.hide();
}
});
@@ -648,8 +655,6 @@ var TiledTrack = function() {
}, 50);
}, set_overview: function() {
var view = this.view;
- view.overview_viewport.height(view.default_overview_height);
- view.overview_box.height(view.default_overview_height);
if (this.initial_canvas && this.is_overview) {
view.overview_close.show();
@@ -695,6 +700,7 @@ var ReferenceTrack = function (view) {
Track.call( this, null, view, view.top_labeltrack );
TiledTrack.call( this );
+ this.left_offset = 200;
this.height_px = 12;
this.container_div.addClass( "reference-track" );
this.dummy_canvas = $("<canvas></canvas>").get(0).getContext("2d");
@@ -752,8 +758,9 @@ var ReferenceTrack = function (view) {
});
for (var c = 0, str_len = seq.length; c < str_len; c++) {
- var c_start = Math.round(c * w_scale);
- ctx.fillText(seq[c], c_start + this.left_offset, 10);
+ var c_start = Math.round(c * w_scale),
+ gap = Math.round(w_scale / 2);
+ ctx.fillText(seq[c], c_start + this.left_offset + gap, 10);
}
parent_element.append(canvas);
return canvas;
@@ -991,7 +998,7 @@ var FeatureTrack = function ( name, view
this.showing_details = false;
this.vertical_detail_px = 10;
this.vertical_nodetail_px = 2;
- this.summary_draw_height = 20;
+ this.summary_draw_height = 30;
this.default_font = "9px Monaco, Lucida Console, monospace";
this.inc_slots = {};
this.data_queue = {};
@@ -1194,32 +1201,25 @@ var FeatureTrack = function ( name, view
ctx.textAlign = "right";
if (result.dataset_type == "summary_tree") {
- var color,
- min_color = 55,
- color_span = 255 - min_color,
- color_cutoff = color_span*2/3, // Where text switches from black to white
- points = result.data,
+ var points = result.data,
max = result.max,
avg = result.avg,
delta_x_px = Math.ceil(result.delta * w_scale);
-
+
for ( var i = 0, len = points.length; i < len; i++ ) {
var x = Math.floor( (points[i][0] - tile_low) * w_scale );
var y = points[i][1];
-
+
if (!y) { continue; }
- color = Math.floor( color_span - (y / max) * color_span );
- ctx.fillStyle = "rgb(" +color+ "," +color+ "," +color+ ")";
- ctx.fillRect(x + left_offset, 0, delta_x_px, this.summary_draw_height);
-
+ var y_px = y / max * this.summary_draw_height;
+
+ ctx.fillStyle = "black";
+ ctx.fillRect(x + left_offset, this.summary_draw_height - y_px, delta_x_px, y_px);
+
if (this.prefs.show_counts && ctx.measureText(y).width < delta_x_px) {
- if (color > color_cutoff) {
- ctx.fillStyle = "black";
- } else {
- ctx.fillStyle = "#ddd";
- }
+ ctx.fillStyle = "#bbb";
ctx.textAlign = "center";
- ctx.fillText(y, x + left_offset + (delta_x_px/2), 12);
+ ctx.fillText(y, x + left_offset + (delta_x_px/2), this.summary_draw_height - 5);
}
}
cur_mode = "Summary";
@@ -1252,18 +1252,19 @@ var FeatureTrack = function ( name, view
y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
if (result.dataset_type === "bai") {
+ var cigar = feature[4];
ctx.fillStyle = block_color;
- if (feature[4] instanceof Array) {
- var b1_start = Math.floor( Math.max(0, (feature[4][0] - tile_low) * w_scale) ),
- b1_end = Math.ceil( Math.min(width, Math.max(0, (feature[4][1] - tile_low) * w_scale)) ),
- b2_start = Math.floor( Math.max(0, (feature[5][0] - tile_low) * w_scale) ),
- b2_end = Math.ceil( Math.min(width, Math.max(0, (feature[5][1] - tile_low) * w_scale)) );
+ if (feature[5] instanceof Array) {
+ var b1_start = Math.floor( Math.max(0, (feature[5][0] - tile_low) * w_scale) ),
+ b1_end = Math.ceil( Math.min(width, Math.max(0, (feature[5][1] - tile_low) * w_scale)) ),
+ b2_start = Math.floor( Math.max(0, (feature[6][0] - tile_low) * w_scale) ),
+ b2_end = Math.ceil( Math.min(width, Math.max(0, (feature[6][1] - tile_low) * w_scale)) );
- if (feature[4][1] >= tile_low && feature[4][0] <= tile_high) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[4][0], feature[4][2], b1_start + left_offset, b1_end - b1_start, y_center);
+ if (feature[5][1] >= tile_low && feature[5][0] <= tile_high) {
+ this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], b1_start + left_offset, b1_end - b1_start, y_center);
}
- if (feature[5][1] >= tile_low && feature[5][0] <= tile_high) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], b2_start + left_offset, b2_end - b2_start, y_center);
+ if (feature[6][1] >= tile_low && feature[6][0] <= tile_high) {
+ this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[6][0], feature[6][2], b2_start + left_offset, b2_end - b2_start, y_center);
}
if (b2_start > b1_end) {
ctx.fillStyle = "#999";
--- a/lib/galaxy/visualization/tracks/data_providers.py
+++ b/lib/galaxy/visualization/tracks/data_providers.py
@@ -97,7 +97,7 @@ class SummaryTreeDataProvider( TracksDat
resolution = max(1, ceil(float(kwargs['resolution'])))
- level = ceil( log( resolution, st.block_size ) )
+ level = ceil( log( resolution, st.block_size ) ) - 1
level = int(max( level, 0 ))
if level <= 0:
return None
@@ -167,6 +167,7 @@ class BamDataProvider( TracksDataProvide
Fetch intervals in the region
"""
start, end = int(start), int(end)
+ no_detail = "no_detail" in kwargs
# Attempt to open the BAM file with index
bamfile = csamtools.Samfile( filename=self.original_dataset.file_name, mode='rb', index_filename=self.converted_dataset.file_name )
message = None
@@ -189,16 +190,20 @@ class BamDataProvider( TracksDataProvide
message = "Only the first %s pairs are being displayed." % MAX_VALS
break
qname = read.qname
+ if no_detail:
+ seq = len(read.seq)
+ else:
+ seq = read.seq
if read.is_proper_pair:
if qname in paired_pending: # one in dict is always first
pair = paired_pending[qname]
- results.append( [ qname, pair['start'], read.pos + read.rlen, read.seq, [pair['start'], pair['end'], pair['seq']], [read.pos, read.pos + read.rlen, read.seq] ] )
+ results.append( [ qname, pair['start'], read.pos + read.rlen, seq, read.cigar, [pair['start'], pair['end'], pair['seq']], [read.pos, read.pos + read.rlen, seq] ] )
# results.append( [read.qname, pair['start'], read.pos + read.rlen, qname, [pair['start'], pair['end']], [read.pos, read.pos + read.rlen] ] )
del paired_pending[qname]
else:
- paired_pending[qname] = { 'start': read.pos, 'end': read.pos + read.rlen, 'seq': read.seq, 'mate_start': read.mpos, 'rlen': read.rlen }
+ paired_pending[qname] = { 'start': read.pos, 'end': read.pos + read.rlen, 'seq': seq, 'mate_start': read.mpos, 'rlen': read.rlen, 'cigar': read.cigar }
else:
- results.append( [qname, read.pos, read.pos + read.rlen, read.seq] )
+ results.append( [qname, read.pos, read.pos + read.rlen, seq, read.cigar] )
# take care of reads whose mates are out of range
for qname, read in paired_pending.iteritems():
if read['mate_start'] < read['start']:
@@ -212,7 +217,7 @@ class BamDataProvider( TracksDataProvide
r1 = [read['start'], read['end'], read['seq']]
r2 = [read['mate_start'], read['mate_start'] + read['rlen']]
- results.append( [ qname, start, end, read['seq'], r1, r2 ] )
+ results.append( [ qname, start, end, read['seq'], read['cigar'], r1, r2 ] )
bamfile.close()
return { 'data': results, 'message': message }
--- a/static/june_2007_style/blue/trackster.css
+++ b/static/june_2007_style/blue/trackster.css
@@ -6,7 +6,7 @@
.nav-controls a{padding:0 0.4em;}
.nav-input{font-size:12px;width:30em;z-index:1000;}
.location{display:inline-block;width:15em;margin:0px 10px;}
-.draghandle{float:left;background:transparent url(../images/visualization/draggable_horizontal.png) center center no-repeat;width:10px;height:12px;margin-right:5px;}
+.draghandle{cursor:move;float:left;background:transparent url(../images/visualization/draggable_horizontal.png) center center no-repeat;width:10px;height:12px;}
.intro{z-index:1000;margin-left:auto;margin-right:auto;color:#555;text-align:center;font-size:16px;}
.overview{width:100%;margin:0px;color:white;}
.overview-viewport{position:relative;height:14px;background:white;border-bottom:solid gray 1px;margin:0;}
@@ -18,11 +18,12 @@
.viewport-canvas{width:100%;height:100px;}
.yaxislabel{color:#777;}
.line-track .track-content{border-top:1px solid #ddd;border-bottom:1px solid #ddd;}
-.track{background:white;}
+.track{background:white;margin-bottom:1px;}
.track-header{text-align:left;padding:4px 0px;color:#666;}
+.track-header .menubutton{margin-left:3px;}
.track-content{overflow:hidden;text-align:center;}
-.track.error{margin-bottom:2px;background-color:#ECB4AF;}
-.track.nodata{margin-bottom:2px;background-color:#ddd;}
+.track.error{background-color:#ECB4AF;}
+.track.nodata{background-color:#ddd;}
.loading{min-height:100px;}
.label-track{}
.label-track .label{border-left:solid #999 1px;padding:1px;display:inline-block;}
--- a/static/june_2007_style/trackster.css.tmpl
+++ b/static/june_2007_style/trackster.css.tmpl
@@ -35,11 +35,11 @@
margin: 0px 10px;
}
.draghandle {
+ cursor: move;
float: left;
background: transparent url(../images/visualization/draggable_horizontal.png) center center no-repeat;
width: 10px;
height: 12px;
- margin-right: 5px;
}
.intro {
z-index: 1000;
@@ -127,6 +127,7 @@
/* border-top: solid #DDDDDD 1px; */
/* border-bottom: solid #DDDDDD 1px; */
background: white;
+ margin-bottom: 1px;
}
.track-header {
@@ -135,17 +136,19 @@
color: #666;
}
+.track-header .menubutton {
+ margin-left: 3px;
+}
+
.track-content {
overflow: hidden;
text-align: center;
}
.track.error {
- margin-bottom: 2px;
background-color: #ECB4AF;
}
.track.nodata {
- margin-bottom: 2px;
background-color: #ddd;
}
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function()
{RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.
min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview
-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<inp
ut/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info
;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(d){this.origin
al_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,h=(a.high-a.
low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(c.chrom===""){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.reset();c.redraw(true);for(var g i
n c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.overview_viewport.find("canvas").remove();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()}
);delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,widt
h:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()}});var Track=function(b,a,c){this.name=b;this.parent_element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.
container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name)}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Erro
r","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class='right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_m
odes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configuration"]=function(){var k=function(){hide_modal()};var j=function(){d.update_options(d.track_id);hide_modal()};show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:k,OK:j})};b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};make_popupmenu(d.name_div,b)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove();this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)
<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var l=tile_element.get(0).getContext("2d");var j=c.initial_canvas.get(0).getContext("2d");var k=l.getImageData(0,0,l.canvas.width,l.canvas.height);j.putImageData(k,0,0);c.set_overview()}c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)},set_overview:function(){var a=this.view;a.overview_viewport.height(a.default_overview_height);a.overview_box.h
eight(a.default_overview_height);if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.trac
k_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),n=e.get(0).getContext("2d"),j=f+"_"+b;if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m
===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o-this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o);n.fillText(m[h],a+this.left_offset,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Line","Filled","Intensity"];this.mode="Line";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefi
ned;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();a.container_div.css("position","relative");var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.cont
ainer_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();if(data.length>1){var f=M
ath.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(k){var a=$("<div />").addClass("form-row");var e="track_"+k+"_minval",h=$("<label></label>").attr("for",e).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),j=$("<input></input>").attr("id",e).val(b),g="track_"+k+"_maxval",d=$("<label></label>").attr("for",g).text("Max value:"),f=(this.prefs.max_value===undefined?"":this.prefs
.max_value),c=$("<input></input>").attr("id",g).val(f);return a.append(h).append(j).append(d).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=20;this.default_font="9px Monaco,
Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"black",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_ca
che.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y
[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(ae,o,r,ar){var L=o*DENSITY*ae,ak=(o+1)*DENSITY*ae,K=ak-L;var al=(!this.initial_canvas?"initial":L+"_"+ak);var G=this.data_cache.get(al);var e;if(G===undefined||(this.mode!=="Auto"&&G.dataset_type==="summary_tree")){this.data_queue[[L,ak]]=true;this.get_data(L,ak);return}var a=Math.ceil(K*ar),S=$("<canvas class='tile'></canvas>"),ag=this.pr
efs.label_color,h=this.prefs.block_color,q=this.mode,v=25,ac=(q==="Squish")||(q==="Dense")&&(q!=="Pack")||(q==="Auto"&&(G.extra_info==="no_detail")),W=this.left_offset,aq,B,at;if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(q==="Dense"){B=v;at=10}else{at=(ac?this.vertical_nodetail_px:this.vertical_detail_px);var w=(ar<0.0001?1/view.zoom_res:ar);B=this.incremental_slots(w,G.data,ac,q)*at+v;aq=this.inc_slots[w]}}S.css({position:"absolute",top:0,left:(L-this.view.low)*ar-W});S.get(0).width=a+W;S.get(0).height=B;r.parent().css("height",Math.max(this.height_px,B)+"px");var H=S.get(0).getContext("2d");H.fillStyle=h;H.font=this.default_font;H.textAlign="right";if(G.dataset_type=="summary_tree"){var R,O=55,aj=255-O,n=aj*2/3,Y=G.data,J=G.max,p=G.avg,b=Math.ceil(G.delta*ar);for(var an=0,F=Y.length;an<F;an++){var aa=Math.floor((Y[an][0]-L)*ar);var Z=Y[an][1];if(!Z){continue}R=Math.floor(aj-(Z/J)*aj);H.fillStyle="rgb("+R+","+R+","+R+")";H.fillRect(aa+W,0,b,this.su
mmary_draw_height);if(this.prefs.show_counts&&H.measureText(Z).width<b){if(R>n){H.fillStyle="black"}else{H.fillStyle="#ddd"}H.textAlign="center";H.fillText(Z,aa+W+(b/2),12)}}e="Summary";r.append(S);return S}if(G.message){S.css({border:"solid red","border-width":"2px 2px 2px 0px"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+W,at)}var ap=G.data;var am=0;for(var an=0,F=ap.length;an<F;an++){var T=ap[an],Q=T[0],ao=T[1],ab=T[2],M=T[3];if(ao<=ak&&ab>=L){var ad=Math.floor(Math.max(0,(ao-L)*ar)),I=Math.ceil(Math.min(a,Math.max(0,(ab-L)*ar))),X=(q==="Dense"?1:(1+aq[Q]))*at;if(G.dataset_type==="bai"){H.fillStyle=h;if(T[4] instanceof Array){var C=Math.floor(Math.max(0,(T[4][0]-L)*ar)),P=Math.ceil(Math.min(a,Math.max(0,(T[4][1]-L)*ar))),A=Math.floor(Math.max(0,(T[5][0]-L)*ar)),u=Math.ceil(Math.min(a,Math.max(0,(T[5][1]-L)*ar)));if(T[4][1]>=L&&T[4][0]<=ak){this.rect_or_text(H,ar,L,ak,T[4][0],T[4][2],C+W,P-C,X)}if(T[5][1]>=L&&T[5][0]<=ak){this.rect_or_text(H,ar,L,ak,T[5]
[0],T[5][2],A+W,u-A,X)}if(A>P){H.fillStyle="#999";H.fillRect(P+W,X+5,A-P,1)}}else{H.fillStyle=h;this.rect_or_text(H,ar,L,ak,ao,M,ad+W,I-ad,X)}if(q!=="Dense"&&!ac&&ao>L){H.fillStyle=this.prefs.label_color;if(o===0&&ad-H.measureText(M).width<0){H.textAlign="left";H.fillText(Q,I+2+W,X+8)}else{H.textAlign="right";H.fillText(Q,ad-2+W,X+8)}H.fillStyle=h}}else{if(G.dataset_type==="interval_index"){if(ac){H.fillStyle=h;H.fillRect(ad+W,X+5,I-ad,1)}else{var E=T[4],V=T[5],af=T[6],g=T[7];var D,ah,N=null,au=null;if(V&&af){N=Math.floor(Math.max(0,(V-L)*ar));au=Math.ceil(Math.min(a,Math.max(0,(af-L)*ar)))}if(q!=="Dense"&&M!==undefined&&ao>L){H.fillStyle=ag;if(o===0&&ad-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+W,X+8)}else{H.textAlign="right";H.fillText(M,ad-2+W,X+8)}H.fillStyle=h}if(g){if(E){if(E=="+"){H.fillStyle=RIGHT_STRAND}else{if(E=="-"){H.fillStyle=LEFT_STRAND}}H.fillRect(ad+W,X,I-ad,10);H.fillStyle=h}for(var al=0,f=g.length;al<f;al++){var t=g[al],d=Math.floor(Mat
h.max(0,(t[0]-L)*ar)),U=Math.ceil(Math.min(a,Math.max((t[1]-L)*ar)));if(d>U){continue}D=5;ah=3;H.fillRect(d+W,X+ah,U-d,D);if(N!==undefined&&!(d>au||U<N)){D=9;ah=1;var ai=Math.max(d,N),z=Math.min(U,au);H.fillRect(ai+W,X+ah,z-ai,D)}}}else{D=9;ah=1;H.fillRect(ad+W,X+ah,I-ad,D);if(T.strand){if(T.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(T.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}H.fillRect(ad+W,X,I-ad,10);H.fillStyle=h}}}}else{if(G.dataset_type==="vcf"){if(ac){H.fillStyle=h;H.fillRect(ad+W,X+5,I-ad,1)}else{var s=T[4],m=T[5],c=T[6];D=9;ah=1;H.fillRect(ad+W,X,I-ad,D);if(q!=="Dense"&&M!==undefined&&ao>L){H.fillStyle=ag;if(o===0&&ad-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+W,X+8)}else{H.textAlign="right";H.fillText(M,ad-2+W,X+8)}H.fillStyle=h}var l=s+" / "+m;if(ao>L&&H.measureText(l).width<(I-ad)){H.fillStyle="white";H.textAlign="center";H.fillText(l,W+ad+(I-ad)/2,X+8);H.fillStyle=h}}}}}am++}}r.append(S);return S},gen_options:function(j){var a=$("<div /
>").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs
.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function()
{RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.
min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.prototype,{init:function(){var c=this.container,a=this;this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview
-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div />").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(d){if(d.type==="focusout"||(d.keyCode||d.which)===13||(d.keyCode||d.which)===27){if((d.keyCode||d.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<inp
ut/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="'+image_path+'/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}),dataType:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info
;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.intro_div.show();a.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-f)});this.overview_close.bind("click",function(){for(var d in a.tracks){a.tracks[d].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("dragstart",function(d){this.origin
al_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX;this.enable_pan=(d.clientX<a.viewport_container.width()-16)?true:false}).bind("drag",function(g){if(!this.enable_pan||this.in_reordering){return}var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);d.scrollTop(f);this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height()+30,top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x)-a.container.offset().left,d=Math.max(j.clientX,this.drag_origin_x)-a.container.offset().left,h=(a.high-a.
low),g=a.viewport_container.width();a.update_location(Math.round(f/g*h)+a.low,Math.round(d/g*h)+a.low);this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},change_chrom:function(d,a,f){var c=this;var e=$.grep(c.chrom_data,function(h,j){return h.chrom===d})[0];if(e===undefined){return}if(d!==c.chrom){c.chrom=d;if(c.chrom===""){c.intro_div.show()}else{c.intro_div.hide()}c.chrom_select.val(c.chrom);c.max_high=e.len;c.reset();c.redraw(true);for(var g i
n c.tracks){var b=c.tracks[g];if(b.init){b.init()}}}if(a!==undefined&&f!==undefined){c.low=Math.max(a,0);c.high=Math.min(f,c.max_high)}c.reset_overview();c.redraw()},go_to:function(f){var k=this,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-"),a=parseInt(g[0].replace(/,/g,"")),d=parseInt(g[1].replace(/,/g,""))}catch(c){return false}}k.change_chrom(h,a,d)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this
.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=this.low/(this.max_high-this.max_low)*this.overview_viewport.width();var e=(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width();var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_locatio
n(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Track=function(b,a,c){this.name=b;this.parent_
element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.container_div=$("<div />").addClass("track");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name)}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(D
ATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){var d=this,c=d.view;if(d.hidden){return}if(d.display_modes!==undefined){if(d.mode_div===undefined){d.mode_div=$("<div class=
'right-float menubutton popup' />").appendTo(d.header_div);var h=d.display_modes[0];d.mode=h;d.mode_div.text(h);var a=function(j){d.mode_div.text(j);d.mode=j;d.tile_cache.clear();d.draw()};var f={};for(var e in d.display_modes){var g=d.display_modes[e];f[g]=function(j){return function(){a(j)}}(g)}make_popupmenu(d.mode_div,f)}else{d.mode_div.hide()}}var b={};b["Set as overview"]=function(){c.overview_viewport.find("canvas").remove();d.is_overview=true;d.set_overview();for(var j in c.tracks){if(c.tracks[j]!==d){c.tracks[j].is_overview=false}}};b["Edit configuration"]=function(){var k=function(){hide_modal()};var j=function(){d.update_options(d.track_id);hide_modal()};show_modal("Configure Track",d.gen_options(d.track_id),{Cancel:k,OK:j})};b.Remove=function(){c.remove_track(d);if(c.num_tracks===0){$("#no-tracks").show()}};make_popupmenu(d.name_div,b)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution
;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove();this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){if(!c.initial_canvas){c.initial_canvas=$(tile_element).clone();var l=tile_element.get(0).getContext("2d");var j=c.initial_canvas.get(0).getContext("2d");var k=l.getImageData(0,0,l.canvas.width,l.canvas.height);j.putImageData(k,0,0);c.set_overview()}c.tile_cache.set(e,tile_element);
c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a
+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),o=e.get(0).get
Context("2d"),k=f+"_"+b;if(p>PX_PER_CHAR){if(this.data_cache.get(k)===undefined){this.get_data(f,b);return}var n=this.data_cache.get(k);if(n===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*p+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*p-this.left_offset});for(var h=0,m=n.length;h<m;h++){var a=Math.round(h*p),j=Math.round(p/2);o.fillText(n[h],a+this.left_offset+j,10)}l.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";this.display_modes=["Line","Filled","Intensity"];this.mode="Line";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=80;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){thi
s.prefs.max_value=c.max_value}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();a.container_div.css("position","relative");var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.cs
s({position:"absolute",top:"22px",left:"10px"});d.prependTo(a.container_div);e.css({position:"absolute",top:a.height_px+11+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false
,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(k){var a=$("<div />").addClass("form-row");var e="track_"+k+"_minval",h=$("<label></label>").attr("for",e).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),j=$("<input
></input>").attr("id",e).val(b),g="track_"+k+"_maxval",d=$("<label></label>").attr("for",g).text("Max value:"),f=(this.prefs.max_value===undefined?"":this.prefs.max_value),c=$("<input></input>").attr("id",g).val(f);return a.append(h).append(j).append(d).append(c)},update_options:function(c){var a=$("#track_"+c+"_minval").val(),b=$("#track_"+c+"_maxval").val();if(a!==this.prefs.min_value||b!==this.prefs.max_value){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(b);this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+c+"_minval").text(this.prefs.min_value);$("#linetrack_"+c+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show
_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=2;this.summary_draw_height=30;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.left_offset=200;this.prefs={block_color:"black",label_color:"black",show_counts:true};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b="initial";this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution,mode:a.mode},function(c){a.mode_div.show();a.data_cache.set(b,c);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data
_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}v
ar v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(ac,n,q,ap){var L=n*DENSITY*ac,ah=(n+1)*DENSITY*ac,K=ah-L;var aj=(!this.initial_canvas?"initial":L+"_"+ah);var G=this.data_cache.get(aj);var e;if(G===undefined||(this.mode!=="Auto"&&
G.dataset_type==="summary_tree")){this.data_queue[[L,ah]]=true;this.get_data(L,ah);return}var a=Math.ceil(K*ap),Q=$("<canvas class='tile'></canvas>"),ae=this.prefs.label_color,h=this.prefs.block_color,p=this.mode,v=25,aa=(p==="Squish")||(p==="Dense")&&(p!=="Pack")||(p==="Auto"&&(G.extra_info==="no_detail")),U=this.left_offset,ao,B,aq;if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(p==="Dense"){B=v;aq=10}else{aq=(aa?this.vertical_nodetail_px:this.vertical_detail_px);var w=(ap<0.0001?1/view.zoom_res:ap);B=this.incremental_slots(w,G.data,aa,p)*aq+v;ao=this.inc_slots[w]}}Q.css({position:"absolute",top:0,left:(L-this.view.low)*ap-U});Q.get(0).width=a+U;Q.get(0).height=B;q.parent().css("height",Math.max(this.height_px,B)+"px");var H=Q.get(0).getContext("2d");H.fillStyle=h;H.font=this.default_font;H.textAlign="right";if(G.dataset_type=="summary_tree"){var W=G.data,J=G.max,o=G.avg,b=Math.ceil(G.delta*ap);for(var al=0,F=W.length;al<F;al++){var Y=Math.floor((W[a
l][0]-L)*ap);var X=W[al][1];if(!X){continue}var ai=X/J*this.summary_draw_height;H.fillStyle="black";H.fillRect(Y+U,this.summary_draw_height-ai,b,ai);if(this.prefs.show_counts&&H.measureText(X).width<b){H.fillStyle="#bbb";H.textAlign="center";H.fillText(X,Y+U+(b/2),this.summary_draw_height-5)}}e="Summary";q.append(Q);return Q}if(G.message){Q.css({border:"solid red","border-width":"2px 2px 2px 0px"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+U,aq)}var an=G.data;var ak=0;for(var al=0,F=an.length;al<F;al++){var R=an[al],P=R[0],am=R[1],Z=R[2],M=R[3];if(am<=ah&&Z>=L){var ab=Math.floor(Math.max(0,(am-L)*ap)),I=Math.ceil(Math.min(a,Math.max(0,(Z-L)*ap))),V=(p==="Dense"?1:(1+ao[P]))*aq;if(G.dataset_type==="bai"){var t=R[4];H.fillStyle=h;if(R[5] instanceof Array){var C=Math.floor(Math.max(0,(R[5][0]-L)*ap)),O=Math.ceil(Math.min(a,Math.max(0,(R[5][1]-L)*ap))),A=Math.floor(Math.max(0,(R[6][0]-L)*ap)),u=Math.ceil(Math.min(a,Math.max(0,(R[6][1]-L)*ap)));if(R[5][1]>=L&&
R[5][0]<=ah){this.rect_or_text(H,ap,L,ah,R[5][0],R[5][2],C+U,O-C,V)}if(R[6][1]>=L&&R[6][0]<=ah){this.rect_or_text(H,ap,L,ah,R[6][0],R[6][2],A+U,u-A,V)}if(A>O){H.fillStyle="#999";H.fillRect(O+U,V+5,A-O,1)}}else{H.fillStyle=h;this.rect_or_text(H,ap,L,ah,am,M,ab+U,I-ab,V)}if(p!=="Dense"&&!aa&&am>L){H.fillStyle=this.prefs.label_color;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(P,I+2+U,V+8)}else{H.textAlign="right";H.fillText(P,ab-2+U,V+8)}H.fillStyle=h}}else{if(G.dataset_type==="interval_index"){if(aa){H.fillStyle=h;H.fillRect(ab+U,V+5,I-ab,1)}else{var E=R[4],T=R[5],ad=R[6],g=R[7];var D,af,N=null,ar=null;if(T&&ad){N=Math.floor(Math.max(0,(T-L)*ap));ar=Math.ceil(Math.min(a,Math.max(0,(ad-L)*ap)))}if(p!=="Dense"&&M!==undefined&&am>L){H.fillStyle=ae;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ab-2+U,V+8)}H.fillStyle=h}if(g){if(E){if(E=="+"){H.fillStyle=RIGHT_STRAND}else{if(E=="-"){H
.fillStyle=LEFT_STRAND}}H.fillRect(ab+U,V,I-ab,10);H.fillStyle=h}for(var aj=0,f=g.length;aj<f;aj++){var s=g[aj],d=Math.floor(Math.max(0,(s[0]-L)*ap)),S=Math.ceil(Math.min(a,Math.max((s[1]-L)*ap)));if(d>S){continue}D=5;af=3;H.fillRect(d+U,V+af,S-d,D);if(N!==undefined&&!(d>ar||S<N)){D=9;af=1;var ag=Math.max(d,N),z=Math.min(S,ar);H.fillRect(ag+U,V+af,z-ag,D)}}}else{D=9;af=1;H.fillRect(ab+U,V+af,I-ab,D);if(R.strand){if(R.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(R.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}H.fillRect(ab+U,V,I-ab,10);H.fillStyle=h}}}}else{if(G.dataset_type==="vcf"){if(aa){H.fillStyle=h;H.fillRect(ab+U,V+5,I-ab,1)}else{var r=R[4],m=R[5],c=R[6];D=9;af=1;H.fillRect(ab+U,V,I-ab,D);if(p!=="Dense"&&M!==undefined&&am>L){H.fillStyle=ae;if(n===0&&ab-H.measureText(M).width<0){H.textAlign="left";H.fillText(M,I+2+U,V+8)}else{H.textAlign="right";H.fillText(M,ab-2+U,V+8)}H.fillStyle=h}var l=r+" / "+m;if(am>L&&H.measureText(l).width<(I-ab)){H.fillStyle="white";H.textAlig
n="center";H.fillText(l,U+ab+(I-ab)/2,V+8);H.fillStyle=h}}}}}ak++}}q.append(Q);return Q},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.b
lock_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0

20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287030296 14400
# Node ID c8173a50bc9bdb0c8e07807c1b73be746557647f
# Parent 4d5b00b6fe741a35320a572302d1fb8bb7eb6971
sample_tracking fixes
--- a/templates/requests/common/sample_datasets.mako
+++ b/templates/requests/common/sample_datasets.mako
@@ -1,5 +1,5 @@
-<%def name="render_sample_datasets( cntrller, sample )">
- <a href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.transferred_dataset_files} / ${len( sample.datasets )}</a>
+<%def name="render_sample_datasets( sample )">
+ ${sample.transferred_dataset_files} / ${len( sample.datasets )}
</%def>
-${render_sample_datasets( cntrller, sample )}
+${render_sample_datasets( sample )}
--- a/test/functional/test_forms_and_requests.py
+++ b/test/functional/test_forms_and_requests.py
@@ -160,8 +160,8 @@ class TestFormsAndRequests( TwillTestCas
name = 'Test Requestype'
self.create_request_type( name,
"test sequencer configuration",
- str( request_form.id ),
- str( sample_form.id ),
+ self.security.encode_id( request_form.id ),
+ self.security.encode_id( sample_form.id ),
sample_states,
strings_displayed=[ 'Create a new sequencer configuration' ],
strings_displayed_after_submit=[ "Sequencer configuration (%s) has been created" % name ] )
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -88,7 +88,7 @@ class RequestsGrid( grids.Grid ):
StateColumn( "State",
key='state',
filterable="advanced",
- link=( lambda item: iff( item.deleted, None, dict( operation="events", id=item.id ) ) )
+ link=( lambda item: iff( item.deleted, None, dict( operation="request_events", id=item.id ) ) )
)
]
columns.append( grids.MulticolFilterColumn( "Search",
@@ -105,7 +105,7 @@ class RequestsGrid( grids.Grid ):
class RequestsCommon( BaseController, UsesFormDefinitionWidgets ):
@web.json
- def sample_state_updates( self, trans, cntrller, ids=None, states=None ):
+ def sample_state_updates( self, trans, ids=None, states=None ):
# Avoid caching
trans.response.headers['Pragma'] = 'no-cache'
trans.response.headers['Expires'] = '0'
@@ -120,12 +120,10 @@ class RequestsCommon( BaseController, Us
rval[ id ] = { "state": sample.state.name,
"datasets": len( sample.datasets ),
"html_state": unicode( trans.fill_template( "requests/common/sample_state.mako",
- sample=sample,
- cntrller=cntrller ),
+ sample=sample),
'utf-8' ),
"html_datasets": unicode( trans.fill_template( "requests/common/sample_datasets.mako",
- sample=sample,
- cntrller=cntrller ),
+ sample=sample ),
'utf-8' ) }
return rval
@web.expose
@@ -865,8 +863,6 @@ class RequestsCommon( BaseController, Us
library_id = current_samples[ copy_sample_index][ 'library_select_field' ].get_selected( return_value=True )
folder_id = current_samples[ copy_sample_index ][ 'folder_select_field' ].get_selected( return_value=True )
name = current_samples[ copy_sample_index ][ 'name' ] + '_%i' % ( len( current_samples ) + 1 )
- library_id = 'none'
- folder_id = 'none'
field_values = [ val for val in current_samples[ copy_sample_index ][ 'field_values' ] ]
else:
# The user has not selected a sample to copy (may just be adding a sample).
--- a/lib/galaxy/web/controllers/requests.py
+++ b/lib/galaxy/web/controllers/requests.py
@@ -52,6 +52,12 @@ class Requests( BaseController ):
action='undelete_request',
cntrller='requests',
**kwd ) )
+ if operation == "request_events":
+ return trans.response.send_redirect( web.url_for( controller='requests_common',
+ action='request_events',
+ cntrller='requests',
+ **kwd ) )
+
# If there are requests that have been rejected, show a message as a reminder to the user
rejected = 0
for request in trans.sa_session.query( trans.app.model.Request ) \
--- a/templates/admin/requests/view_request_type.mako
+++ b/templates/admin/requests/view_request_type.mako
@@ -11,7 +11,7 @@
<div class="toolForm"><div class="toolFormTitle">Sequencer configuration information</div>
- <form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=request_type.id)}" method="post" >
+ <form name="view_request_type" action="${h.url_for( controller='requests_admin', action='create_request_type', rt_id=trans.security.encode_id( request_type.id ))}" method="post" ><div class="form-row"><label>Name</label>
${request_type.name}
--- a/templates/requests/common/manage_request.mako
+++ b/templates/requests/common/manage_request.mako
@@ -62,7 +62,7 @@
// Build request data
var ids = []
var states = []
- $.each( sample_states, function ( id, state, cntrller ) {
+ $.each( sample_states, function ( id, state ) {
ids.push( id );
states.push( state );
});
@@ -73,7 +73,7 @@
dataType: "json",
data: { ids: ids.join( "," ), states: states.join( "," ) },
success : function ( data ) {
- $.each( data, function( cntrller, id, val ) {
+ $.each( data, function( id, val ) {
// Replace HTML
var cell1 = $("#sampleState-" + id);
cell1.html( val.html_state );
@@ -140,7 +140,6 @@
<a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit</a>
%endif
<a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">History</a>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a>
%if is_admin:
%if request.is_submitted:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
@@ -178,6 +177,13 @@
<h4><img src="/static/images/fugue/toggle-expand.png" alt="Show" onclick="showContent(this);" style="cursor:pointer;"/> Request Information</h4><div style="display:none;">
+ <div class="form-row">
+ <ul class="manage-table-actions">
+ <li>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit request informaton</a>
+ </li>
+ </ul>
+ </div><table class="grid" border="0"><tbody><tr>
@@ -452,7 +458,7 @@
%if sample.request.is_unsubmitted:
<td>Unsubmitted</td>
%else:
- <td id="sampleState-${sample.id}">${render_sample_state( cntrller, sample )}</td>
+ <td><a id="sampleState-${sample.id}" href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${render_sample_state( sample )}</a></td>
%endif
%if info['library']:
%if cntrller == 'requests':
@@ -469,9 +475,9 @@
<td></td>
%endif
%if request.is_submitted or request.is_complete:
- <td id="sampleDatasets-${sample.id}">
- ${render_sample_datasets( cntrller, sample )}
- </td>
+ <td><a id="sampleDatasets-${sample.id}" href="${h.url_for( controller='requests_common', action='view_dataset_transfer', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">
+ ${render_sample_datasets( sample )}
+ </a></td>
%endif
%else:
${show_basic_info_form( sample_index, sample, info )}
--- a/templates/requests/common/sample_state.mako
+++ b/templates/requests/common/sample_state.mako
@@ -1,5 +1,5 @@
-<%def name="render_sample_state( cntrller, sample )">
- <a href="${h.url_for( controller='requests_common', action='sample_events', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">${sample.state.name}</a>
+<%def name="render_sample_state( sample )">
+ ${sample.state.name}
</%def>
-${render_sample_state( cntrller, sample )}
+${render_sample_state( sample )}
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -163,6 +163,11 @@ class RequestsAdmin( BaseController, Use
action='manage_request',
cntrller='requests_admin',
**kwd ) )
+ if operation == "request_events":
+ return trans.response.send_redirect( web.url_for( controller='requests_common',
+ action='request_events',
+ cntrller='requests_admin',
+ **kwd ) )
if operation == "reject":
return self.reject_request( trans, **kwd )
if operation == "view_type":
@@ -423,7 +428,6 @@ class RequestsAdmin( BaseController, Use
request_id=request_id,
folder_path=folder_path,
sample_id=sample.id,
- open_folder=True,
message=message,
status=status ) )
# Get the filenames from the remote host
@@ -590,21 +594,31 @@ class RequestsAdmin( BaseController, Use
FOLDER_ID=str(sample.folder.id),
DATASETS=datasets )
# Send the message
- conn = amqp.Connection( host=trans.app.config.amqp['host'] + ":" + trans.app.config.amqp['port'],
- userid=trans.app.config.amqp['userid'],
- password=trans.app.config.amqp['password'],
- virtual_host=trans.app.config.amqp['virtual_host'],
- insist=False )
- chan = conn.channel()
- msg = amqp.Message( data.replace( '\n', '' ).replace( '\r', '' ),
- content_type='text/plain',
- application_headers={'msg_type': 'data_transfer'} )
- msg.properties["delivery_mode"] = 2
- chan.basic_publish( msg,
- exchange=trans.app.config.amqp['exchange'],
- routing_key=trans.app.config.amqp['routing_key'] )
- chan.close()
- conn.close()
+ try:
+ conn = amqp.Connection( host=trans.app.config.amqp['host'] + ":" + trans.app.config.amqp['port'],
+ userid=trans.app.config.amqp['userid'],
+ password=trans.app.config.amqp['password'],
+ virtual_host=trans.app.config.amqp['virtual_host'],
+ insist=False )
+ chan = conn.channel()
+ msg = amqp.Message( data.replace( '\n', '' ).replace( '\r', '' ),
+ content_type='text/plain',
+ application_headers={'msg_type': 'data_transfer'} )
+ msg.properties["delivery_mode"] = 2
+ chan.basic_publish( msg,
+ exchange=trans.app.config.amqp['exchange'],
+ routing_key=trans.app.config.amqp['routing_key'] )
+ chan.close()
+ conn.close()
+ except Exception, e:
+ message = "Error in sending the data transfer message to the Galaxy AMQP message queue:<br/>%s" % str(e)
+ status = "error"
+ return trans.response.send_redirect( web.url_for( controller='requests_admin',
+ action='manage_datasets',
+ sample_id=trans.security.encode_id( sample.id ),
+ status=status,
+ message=message) )
+
def __start_datatx( self, trans, sample, selected_sample_datasets ):
datatx_user = self.__setup_datatx_user( trans, sample.library, sample.folder )
# Validate sequencer information
1
0

galaxy-dist commit 76f09e5ccb85: sample tracking UI fixes
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User rc
# Date 1287002139 14400
# Node ID 76f09e5ccb85569b56e66676e4c761f4348336fc
# Parent c0feb970e48de8b713a9a516cad61950ed0641b5
sample tracking UI fixes
--- a/templates/requests/common/manage_request.mako
+++ b/templates/requests/common/manage_request.mako
@@ -132,38 +132,38 @@
<div class="grid-header"><h2>Sequencing Request "${request.name}"</h2>
+
+ <ul class="manage-table-actions">
+ <li><a class="action-button" id="seqreq-${request.id}-popup" class="menubutton">Sequencing Request Actions</a></li>
+ <div popupmenu="seqreq-${request.id}-popup">
+ %if request.is_unsubmitted and request.samples:
+ <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit</a>
+ %endif
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">History</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a>
+ %if is_admin:
+ %if request.is_submitted:
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
+ %endif
+ %endif
+ </div>
+ <li><a class="action-button" href="${h.url_for( controller=cntrller, action='browse_requests' )}">Browse requests</a></li>
+ </ul>
+
<div class="toolParamHelp" style="clear: both;">
- <b>Sequencer</b>: ${request.type.name}
- %if is_admin:
- | <b>User</b>: ${request.user.email}
- %endif
- %if request.is_submitted:
- | <b>State</b>: <i>${request.state}</i>
- %else:
- | <b>State</b>: ${request.state}
- %endif
+ <b>Sequencer</b>: ${request.type.name}
+ %if is_admin:
+ | <b>User</b>: ${request.user.email}
+ %endif
+ %if request.is_submitted:
+ | <b>State</b>: <i>${request.state}</i>
+ %else:
+ | <b>State</b>: ${request.state}
+ %endif
</div></div>
-<br/><br/>
-<ul class="manage-table-actions">
- <li><a class="action-button" id="seqreq-${request.id}-popup" class="menubutton">Sequencing Request Actions</a></li>
- <div popupmenu="seqreq-${request.id}-popup">
- %if request.is_unsubmitted and request.samples:
- <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit</a>
- %endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">History</a>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit</a>
- %if is_admin:
- %if request.is_submitted:
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject</a>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
- %endif
- %endif
- </div>
- <li><a class="action-button" href="${h.url_for( controller=cntrller, action='browse_requests' )}">Browse requests</a></li>
-</ul>
-
%if request.has_samples_without_library_destinations:
${render_msg( "Select a target data library and folder for all the samples before starting the sequence run", "warning" )}
%endif
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -393,7 +393,8 @@ class RequestsAdmin( BaseController, Use
# get the sample these datasets are associated with
try:
sample = trans.sa_session.query( trans.model.Sample ).get( trans.security.decode_id( selected_sample_id ) )
- sample.library.id and sample.folder.id
+ if sample.name in sample.request.has_samples_without_library_destinations:
+ raise Exception()
except:
# if no sample (with associated library & folder) has been selected
status = 'error'
1
0

galaxy-dist commit 9f172e4713ed: Support query anchored and HTML output
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286796719 -3600
# Node ID 9f172e4713edbf4d6a22f10ad01867710cce6b00
# Parent d8da4f7bb0f5e1d43b371e4e52fb688ad816e5bf
Support query anchored and HTML output
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -15,7 +15,7 @@ blastn
$adv_opts.filter_query
$adv_opts.strand
-out $output1
--outfmt $out_format
+$out_format
-num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
@@ -60,11 +60,16 @@ blastn
</param><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
- <option value="6">Tabular</option>
- <option value="5">BLAST XML</option>
- <option value="0">Pairwise text</option>
+ <option value="-outfmt 6" selected="True">Tabular</option>
+ <option value="-outfmt 5">BLAST XML</option>
+ <option value="-outfmt 0">Pairwise text</option>
+ <option value="-outfmt 0 -html">Pairwise HTML</option>
+ <option value="-outfmt 2">Query-anchored text</option>
+ <option value="-outfmt 2 -html">Query-anchored HTML</option>
+ <option value="-outfmt 4">Flat query-anchored text</option>
+ <option value="-outfmt 4 -html">Flat query-anchored HTML</option><!--
- <option value="11">BLAST archive format (ASN.1)</option>
+ <option value="-outfmt 11">BLAST archive format (ASN.1)</option>
--></param><conditional name="adv_opts">
@@ -102,10 +107,13 @@ blastn
<outputs><data name="output1" format="tabular" label="${blast_type.value_label} on ${db_opts.db_opts_selector}"><change_format>
- <when input="out_format" value="0" format="txt"/>
- </change_format>
- <change_format>
- <when input="out_format" value="5" format="blastxml"/>
+ <when input="out_format" value="-outfmt 0" format="txt"/>
+ <when input="out_format" value="-outfmt 0 -html" format="html"/>
+ <when input="out_format" value="-outfmt 2" format="txt"/>
+ <when input="out_format" value="-outfmt 2 -html" format="html"/>
+ <when input="out_format" value="-outfmt 4" format="txt"/>
+ <when input="out_format" value="-outfmt 4 -html" format="html"/>
+ <when input="out_format" value="-outfmt 5" format="blastxml"/></change_format></data></outputs>
@@ -147,7 +155,7 @@ Algorithms include blastn, megablast, an
**Output format**
-The default output of this tool is tabular, containing 12 columns:
+Because Galaxy focuses on processing tabular data, the default output of this tool is tabular. This contains 12 columns:
1. Id of your sequence
2. GI of the database hit
@@ -162,6 +170,14 @@ 10. End position in database hit
11. E-value
12. Bit score
+The second option is BLAST XML output, which is designed to be parsed by another program, and is understood by other Galaxy tools.
+
+You can also choose several plain text or HTML output formats which are designed to be read by a person (not by another program).
+The HTML versions use basic webpage formatting and can include links to the hits on the NCBI website.
+The pairwise output (the default on the NCBI BLAST website) shows each match as a pairwise alignment with the query.
+The two query anchored outputs show a multiple sequence alignment between the query and all the matches,
+and differ in how insertions are shown (marked as insertions or with gap characters added to the other sequences).
+
-------
**References**
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -15,7 +15,7 @@ blastp
$adv_opts.filter_query
$adv_opts.matrix
-out $output1
--outfmt $out_format
+$out_format
-num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
@@ -55,11 +55,16 @@ blastp
</param><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
- <option value="6">Tabular</option>
- <option value="5">BLAST XML</option>
- <option value="0">Pairwise text</option>
+ <option value="-outfmt 6" selected="True">Tabular</option>
+ <option value="-outfmt 5">BLAST XML</option>
+ <option value="-outfmt 0">Pairwise text</option>
+ <option value="-outfmt 0 -html">Pairwise HTML</option>
+ <option value="-outfmt 2">Query-anchored text</option>
+ <option value="-outfmt 2 -html">Query-anchored HTML</option>
+ <option value="-outfmt 4">Flat query-anchored text</option>
+ <option value="-outfmt 4 -html">Flat query-anchored HTML</option><!--
- <option value="11">BLAST archive format (ASN.1)</option>
+ <option value="-outfmt 11">BLAST archive format (ASN.1)</option>
--></param><conditional name="adv_opts">
@@ -110,10 +115,13 @@ blastp
<outputs><data name="output1" format="tabular" label="${blast_type.value_label} on ${db_opts.db_opts_selector}"><change_format>
- <when input="out_format" value="0" format="txt"/>
- </change_format>
- <change_format>
- <when input="out_format" value="5" format="blastxml"/>
+ <when input="out_format" value="-outfmt 0" format="txt"/>
+ <when input="out_format" value="-outfmt 0 -html" format="html"/>
+ <when input="out_format" value="-outfmt 2" format="txt"/>
+ <when input="out_format" value="-outfmt 2 -html" format="html"/>
+ <when input="out_format" value="-outfmt 4" format="txt"/>
+ <when input="out_format" value="-outfmt 4 -html" format="html"/>
+ <when input="out_format" value="-outfmt 5" format="blastxml"/></change_format></data></outputs>
@@ -140,7 +148,7 @@ using the NCBI BLAST+ blastp command lin
**Output format**
-The default output of this tool is tabular, containing 12 columns:
+Because Galaxy focuses on processing tabular data, the default output of this tool is tabular. This contains 12 columns:
1. Id of your sequence
2. GI of the database hit
@@ -155,6 +163,14 @@ 10. End position in database hit
11. E-value
12. Bit score
+The second option is BLAST XML output, which is designed to be parsed by another program, and is understood by other Galaxy tools.
+
+You can also choose several plain text or HTML output formats which are designed to be read by a person (not by another program).
+The HTML versions use basic webpage formatting and can include links to the hits on the NCBI website.
+The pairwise output (the default on the NCBI BLAST website) shows each match as a pairwise alignment with the query.
+The two query anchored outputs show a multiple sequence alignment between the query and all the matches,
+and differ in how insertions are shown (marked as insertions or with gap characters added to the other sequences).
+
-------
**References**
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -15,7 +15,7 @@ tblastx
$adv_opts.strand
$adv_opts.matrix
-out $output1
--outfmt $out_format
+$out_format
-num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
@@ -49,11 +49,16 @@ tblastx
</conditional><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
- <option value="6">Tabular</option>
- <option value="5">BLAST XML</option>
- <option value="0">Pairwise text</option>
+ <option value="-outfmt 6" selected="True">Tabular</option>
+ <option value="-outfmt 5">BLAST XML</option>
+ <option value="-outfmt 0">Pairwise text</option>
+ <option value="-outfmt 0 -html">Pairwise HTML</option>
+ <option value="-outfmt 2">Query-anchored text</option>
+ <option value="-outfmt 2 -html">Query-anchored HTML</option>
+ <option value="-outfmt 4">Flat query-anchored text</option>
+ <option value="-outfmt 4 -html">Flat query-anchored HTML</option><!--
- <option value="11">BLAST archive format (ASN.1)</option>
+ <option value="-outfmt 11">BLAST archive format (ASN.1)</option>
--></param><conditional name="adv_opts">
@@ -100,10 +105,13 @@ tblastx
<outputs><data name="output1" format="tabular" label="tblastx on ${db_opts.db_opts_selector}"><change_format>
- <when input="out_format" value="0" format="txt"/>
- </change_format>
- <change_format>
- <when input="out_format" value="5" format="blastxml"/>
+ <when input="out_format" value="-outfmt 0" format="txt"/>
+ <when input="out_format" value="-outfmt 0 -html" format="html"/>
+ <when input="out_format" value="-outfmt 2" format="txt"/>
+ <when input="out_format" value="-outfmt 2 -html" format="html"/>
+ <when input="out_format" value="-outfmt 4" format="txt"/>
+ <when input="out_format" value="-outfmt 4 -html" format="html"/>
+ <when input="out_format" value="-outfmt 5" format="blastxml"/></change_format></data></outputs>
@@ -122,7 +130,7 @@ tblastx
--><param name="evalue_cutoff" value="10.0" /><param name="filter_query" value="yes" />
- <param name="out_format" value="6" />
+ <param name="out_format" value="-outfmt 6" /><output name="output1" file="megablast_wrapper_test1.out"/></test></tests>
@@ -143,7 +151,7 @@ using the NCBI BLAST+ tblastx command li
**Output format**
-The default output of this tool is tabular, containing 12 columns:
+Because Galaxy focuses on processing tabular data, the default output of this tool is tabular. This contains 12 columns:
1. Id of your sequence
2. GI of the database hit
@@ -158,6 +166,14 @@ 10. End position in database hit
11. E-value
12. Bit score
+The second option is BLAST XML output, which is designed to be parsed by another program, and is understood by other Galaxy tools.
+
+You can also choose several plain text or HTML output formats which are designed to be read by a person (not by another program).
+The HTML versions use basic webpage formatting and can include links to the hits on the NCBI website.
+The pairwise output (the default on the NCBI BLAST website) shows each match as a pairwise alignment with the query.
+The two query anchored outputs show a multiple sequence alignment between the query and all the matches,
+and differ in how insertions are shown (marked as insertions or with gap characters added to the other sequences).
+
-------
**References**
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -15,7 +15,7 @@ blastx
$adv_opts.strand
$adv_opts.matrix
-out $output1
--outfmt $out_format
+$out_format
-num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
@@ -50,11 +50,16 @@ blastx
</conditional><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
- <option value="6">Tabular</option>
- <option value="5">BLAST XML</option>
- <option value="0">Pairwise text</option>
+ <option value="-outfmt 6" selected="True">Tabular</option>
+ <option value="-outfmt 5">BLAST XML</option>
+ <option value="-outfmt 0">Pairwise text</option>
+ <option value="-outfmt 0 -html">Pairwise HTML</option>
+ <option value="-outfmt 2">Query-anchored text</option>
+ <option value="-outfmt 2 -html">Query-anchored HTML</option>
+ <option value="-outfmt 4">Flat query-anchored text</option>
+ <option value="-outfmt 4 -html">Flat query-anchored HTML</option><!--
- <option value="11">BLAST archive format (ASN.1)</option>
+ <option value="-outfmt 11">BLAST archive format (ASN.1)</option>
--></param><conditional name="adv_opts">
@@ -103,10 +108,13 @@ blastx
<outputs><data name="output1" format="tabular" label="blastx on ${db_opts.db_opts_selector}"><change_format>
- <when input="out_format" value="0" format="txt"/>
- </change_format>
- <change_format>
- <when input="out_format" value="5" format="blastxml"/>
+ <when input="out_format" value="-outfmt 0" format="txt"/>
+ <when input="out_format" value="-outfmt 0 -html" format="html"/>
+ <when input="out_format" value="-outfmt 2" format="txt"/>
+ <when input="out_format" value="-outfmt 2 -html" format="html"/>
+ <when input="out_format" value="-outfmt 4" format="txt"/>
+ <when input="out_format" value="-outfmt 4 -html" format="html"/>
+ <when input="out_format" value="-outfmt 5" format="blastxml"/></change_format></data></outputs>
@@ -133,7 +141,7 @@ using the NCBI BLAST+ blastx command lin
**Output format**
-The default output of this tool is tabular, containing 12 columns:
+Because Galaxy focuses on processing tabular data, the default output of this tool is tabular. This contains 12 columns:
1. Id of your sequence
2. GI of the database hit
@@ -148,6 +156,14 @@ 10. End position in database hit
11. E-value
12. Bit score
+The second option is BLAST XML output, which is designed to be parsed by another program, and is understood by other Galaxy tools.
+
+You can also choose several plain text or HTML output formats which are designed to be read by a person (not by another program).
+The HTML versions use basic webpage formatting and can include links to the hits on the NCBI website.
+The pairwise output (the default on the NCBI BLAST website) shows each match as a pairwise alignment with the query.
+The two query anchored outputs show a multiple sequence alignment between the query and all the matches,
+and differ in how insertions are shown (marked as insertions or with gap characters added to the other sequences).
+
-------
**References**
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -14,7 +14,7 @@ tblastn
$adv_opts.filter_query
$adv_opts.matrix
-out $output1
--outfmt $out_format
+$out_format
-num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
@@ -50,11 +50,16 @@ tblastn
</conditional><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
- <option value="6">Tabular</option>
- <option value="5">BLAST XML</option>
- <option value="0">Pairwise text</option>
+ <option value="-outfmt 6" selected="True">Tabular</option>
+ <option value="-outfmt 5">BLAST XML</option>
+ <option value="-outfmt 0">Pairwise text</option>
+ <option value="-outfmt 0 -html">Pairwise HTML</option>
+ <option value="-outfmt 2">Query-anchored text</option>
+ <option value="-outfmt 2 -html">Query-anchored HTML</option>
+ <option value="-outfmt 4">Flat query-anchored text</option>
+ <option value="-outfmt 4 -html">Flat query-anchored HTML</option><!--
- <option value="11">BLAST archive format (ASN.1)</option>
+ <option value="-outfmt 11">BLAST archive format (ASN.1)</option>
--></param><conditional name="adv_opts">
@@ -105,10 +110,13 @@ tblastn
<outputs><data name="output1" format="tabular" label="tblastn on ${db_opts.db_opts_selector}"><change_format>
- <when input="out_format" value="0" format="txt"/>
- </change_format>
- <change_format>
- <when input="out_format" value="5" format="blastxml"/>
+ <when input="out_format" value="-outfmt 0" format="txt"/>
+ <when input="out_format" value="-outfmt 0 -html" format="html"/>
+ <when input="out_format" value="-outfmt 2" format="txt"/>
+ <when input="out_format" value="-outfmt 2 -html" format="html"/>
+ <when input="out_format" value="-outfmt 4" format="txt"/>
+ <when input="out_format" value="-outfmt 4 -html" format="html"/>
+ <when input="out_format" value="-outfmt 5" format="blastxml"/></change_format></data></outputs>
@@ -135,7 +143,7 @@ using the NCBI BLAST+ tblastn command li
**Output format**
-The default output of this tool is tabular, containing 12 columns:
+Because Galaxy focuses on processing tabular data, the default output of this tool is tabular. This contains 12 columns:
1. Id of your sequence
2. GI of the database hit
@@ -150,6 +158,14 @@ 10. End position in database hit
11. E-value
12. Bit score
+The second option is BLAST XML output, which is designed to be parsed by another program, and is understood by other Galaxy tools.
+
+You can also choose several plain text or HTML output formats which are designed to be read by a person (not by another program).
+The HTML versions use basic webpage formatting and can include links to the hits on the NCBI website.
+The pairwise output (the default on the NCBI BLAST website) shows each match as a pairwise alignment with the query.
+The two query anchored outputs show a multiple sequence alignment between the query and all the matches,
+and differ in how insertions are shown (marked as insertions or with gap characters added to the other sequences).
+
-------
**References**
1
0

galaxy-dist commit 77e13329ab8b: No longer try to display Image type (including PDF) datasets within browser. Clicking on eye icon for binary and image types will now invoke save action.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1286945049 14400
# Node ID 77e13329ab8b9e69089400259eb70cda9525ec80
# Parent 9f172e4713edbf4d6a22f10ad01867710cce6b00
No longer try to display Image type (including PDF) datasets within browser. Clicking on eye icon for binary and image types will now invoke save action.
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -324,56 +324,56 @@ class DatasetInterface( BaseController,
if not data:
raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) )
current_user_roles = trans.get_current_user_roles()
- if trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
- if data.state == trans.model.Dataset.states.UPLOAD:
- return trans.show_error_message( "Please wait until this dataset finishes uploading before attempting to view it." )
+ if not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
+ return trans.show_error_message( "You are not allowed to access this dataset" )
+
+ if data.state == trans.model.Dataset.states.UPLOAD:
+ return trans.show_error_message( "Please wait until this dataset finishes uploading before attempting to view it." )
+
+ if filename and filename != "index":
+ # For files in extra_files_path
+ file_path = os.path.join( data.extra_files_path, filename )
+ if os.path.exists( file_path ):
+ mime, encoding = mimetypes.guess_type( file_path )
+ if not mime:
+ try:
+ mime = trans.app.datatypes_registry.get_mimetype_by_extension( ".".split( file_path )[-1] )
+ except:
+ mime = "text/plain"
- if filename and filename != "index":
- # For files in extra_files_path
- file_path = os.path.join( data.extra_files_path, filename )
- if os.path.exists( file_path ):
- mime, encoding = mimetypes.guess_type( file_path )
- if not mime:
- try:
- mime = trans.app.datatypes_registry.get_mimetype_by_extension( ".".split( file_path )[-1] )
- except:
- mime = "text/plain"
-
- trans.response.set_content_type( mime )
- return open( file_path )
- else:
- return "Could not find '%s' on the extra files path %s." % (filename,file_path)
-
- mime = trans.app.datatypes_registry.get_mimetype_by_extension( data.extension.lower() )
- trans.response.set_content_type(mime)
- trans.log_event( "Display dataset id: %s" % str( dataset_id ) )
-
- if to_ext: # Saving the file
- if data.ext in composite_extensions:
- return self.archive_composite_dataset( trans, data, **kwd )
- else:
- trans.response.headers['Content-Length'] = int( os.stat( data.file_name ).st_size )
- if to_ext[0] != ".":
- to_ext = "." + to_ext
- valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- fname = data.name
- fname = ''.join(c in valid_chars and c or '_' for c in fname)[0:150]
- trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s]%s" % (data.hid, fname, to_ext)
- return open( data.file_name )
- if os.path.exists( data.file_name ):
- max_peek_size = 1000000 # 1 MB
- if preview and (not isinstance(data.datatype, datatypes.binary.Binary)) and os.stat( data.file_name ).st_size > max_peek_size:
- trans.response.set_content_type( "text/html" )
- return trans.stream_template_mako( "/dataset/large_file.mako",
- truncated_data = open( data.file_name ).read(max_peek_size),
- data = data )
- else:
- return open( data.file_name )
+ trans.response.set_content_type( mime )
+ return open( file_path )
else:
- raise paste.httpexceptions.HTTPNotFound( "File Not Found (%s)." % data.file_name )
+ return "Could not find '%s' on the extra files path %s." % (filename,file_path)
+
+ mime = trans.app.datatypes_registry.get_mimetype_by_extension( data.extension.lower() )
+ trans.response.set_content_type(mime)
+ trans.log_event( "Display dataset id: %s" % str( dataset_id ) )
+
+ if to_ext or isinstance(data.datatype, datatypes.binary.Binary) or isinstance(data.datatype, datatypes.images.Image): # Saving the file, or binary/image file
+ if data.extension in composite_extensions:
+ return self.archive_composite_dataset( trans, data, **kwd )
+ else:
+ trans.response.headers['Content-Length'] = int( os.stat( data.file_name ).st_size )
+ if not to_ext:
+ to_ext = data.extension
+ valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ fname = data.name
+ fname = ''.join(c in valid_chars and c or '_' for c in fname)[0:150]
+ trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s].%s" % (data.hid, fname, to_ext)
+ return open( data.file_name )
+ if not os.path.exists( data.file_name ):
+ raise paste.httpexceptions.HTTPNotFound( "File Not Found (%s)." % data.file_name )
+
+ max_peek_size = 1000000 # 1 MB
+ if preview and os.stat( data.file_name ).st_size > max_peek_size:
+ trans.response.set_content_type( "text/html" )
+ return trans.stream_template_mako( "/dataset/large_file.mako",
+ truncated_data = open( data.file_name ).read(max_peek_size),
+ data = data )
else:
- return trans.show_error_message( "You are not allowed to access this dataset" )
-
+ return open( data.file_name )
+
@web.expose
@web.require_login( "see all available datasets" )
def list( self, trans, **kwargs ):
1
0

galaxy-dist commit d8da4f7bb0f5: Add -ungapped for blastn and blastx (having trouble with blastp and tblastn, not in tblastx)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286554738 -3600
# Node ID d8da4f7bb0f5e1d43b371e4e52fb688ad816e5bf
# Parent 8979b429d7691f4121afb368a05e6b9d0ea40706
Add -ungapped for blastn and blastx (having trouble with blastp and tblastn, not in tblastx)
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -25,6 +25,7 @@ blastn
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+$adv_opts.ungapped
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -76,6 +77,7 @@ blastn
<param name="strand" type="hidden" value="" /><param name="max_hits" type="hidden" value="" /><param name="word_size" type="hidden" value="" />
+ <param name="ungapped" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'level window linker' -->
@@ -93,6 +95,7 @@ blastn
<param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 4."><validator type="in_range" min="0" /></param>
+ <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" /></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -25,6 +25,8 @@ blastp
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+##Ungapped disabled for now - see comments below
+##$adv_opts.ungapped
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -70,6 +72,10 @@ blastp
<param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" /><param name="word_size" type="hidden" value="" />
+ <!--
+ Ungapped disabled for now, see comments below
+ <param name="ungapped" type="hidden" value="" />
+ --></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -92,6 +98,12 @@ blastp
<param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param>
+ <!--
+ Can't use '-ungapped' on its own, error back is:
+ Composition-adjusted searched are not supported with an ungapped search, please add -comp_based_stats F or do a gapped search
+ Tried using '-ungapped -comp_based_stats F' and blastp crashed with 'Attempt to access NULL pointer.'
+ <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
+ --></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -25,6 +25,7 @@ blastx
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+$adv_opts.ungapped
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -67,6 +68,7 @@ blastx
<param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" /><param name="word_size" type="hidden" value="" />
+ <param name="ungapped" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -94,6 +96,7 @@ blastx
<param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param>
+ <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped" falsevalue="" checked="false" /></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -24,6 +24,8 @@ tblastn
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+##Ungapped disabled for now - see comments below
+##$adv_opts.ungapped
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -65,6 +67,10 @@ tblastn
<param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" /><param name="word_size" type="hidden" value="" />
+ <!--
+ Ungapped disabled for now, see comments below
+ <param name="ungapped" type="hidden" value="" />
+ --></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -87,6 +93,12 @@ tblastn
<param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param>
+ <!--
+ Can't use '-ungapped' on its own, error back is:
+ Composition-adjusted searched are not supported with an ungapped search, please add -comp_based_stats F or do a gapped search
+ Tried using '-ungapped -comp_based_stats F' and tblastn crashed with 'Attempt to access NULL pointer.'
+ <param name="ungapped" type="boolean" label="Perform ungapped alignment only?" truevalue="-ungapped -comp_based_stats F" falsevalue="" checked="false" />
+ --></when></conditional></inputs>
1
0

galaxy-dist commit 9bf65ebafa8f: Reduce whitespace in <command> tag (there are OS limits on command line length)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286366018 -3600
# Node ID 9bf65ebafa8fc89115a5b42ebb9865ed99c1cf84
# Parent 6273161e76c33f807145d9b12eafa0a6e414bbf1
Reduce whitespace in <command> tag (there are OS limits on command line length)
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -1,20 +1,21 @@
<tool id="ncbi_blastn_wrapper" name="NCBI BLAST+ blastn" version="0.0.1"><description>Search nucleotide database with nucleotide query sequence(s)</description><command>
- blastn
- -query "$query"
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+blastn -query "$query"
#if $db_opts.db_opts_selector == "db":
- -db "$db_opts.database"
+ -db "$db_opts.database"
#else:
- -subject "$db_opts.subject"
+ -subject "$db_opts.subject"
#end if
- -task $blast_type
- -evalue $evalue_cutoff
- $adv_opts.filter_query
- $adv_opts.strand
- -out $output1
- -outfmt $out_format
- -num_threads 8
+-task $blast_type
+-evalue $evalue_cutoff
+$adv_opts.filter_query
+$adv_opts.strand
+-out $output1
+-outfmt $out_format
+-num_threads 8
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -1,20 +1,22 @@
<tool id="ncbi_blastp_wrapper" name="NCBI BLAST+ blastp" version="0.0.1"><description>Search protein database with protein query sequence(s)</description><command>
- blastp
- -query "$query"
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+blastp
+-query "$query"
#if $db_opts.db_opts_selector == "db":
- -db "$db_opts.database"
+ -db "$db_opts.database"
#else:
- -subject "$db_opts.subject"
+ -subject "$db_opts.subject"
#end if
- -task $blast_type
- -evalue $evalue_cutoff
- $adv_opts.filter_query
- $adv_opts.matrix
- -out $output1
- -outfmt $out_format
- -num_threads 8
+-task $blast_type
+-evalue $evalue_cutoff
+$adv_opts.filter_query
+$adv_opts.matrix
+-out $output1
+-outfmt $out_format
+-num_threads 8
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -1,20 +1,22 @@
<tool id="ncbi_tblastx_wrapper" name="NCBI BLAST+ tblastx" version="0.0.1"><description>Search translated nucleotide database with translated nucleotide query sequence(s)</description><command>
- tblastx
- -query "$query"
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+tblastx
+-query "$query"
#if $db_opts.db_opts_selector == "db":
- -db "$db_opts.database"
+ -db "$db_opts.database"
#else:
- -subject "$db_opts.subject"
+ -subject "$db_opts.subject"
#end if
- -evalue $evalue_cutoff
- $adv_opts.filter_query
- $adv_opts.strand
- $adv_opts.matrix
- -out $output1
- -outfmt $out_format
- -num_threads 8
+-evalue $evalue_cutoff
+$adv_opts.filter_query
+$adv_opts.strand
+$adv_opts.matrix
+-out $output1
+-outfmt $out_format
+-num_threads 8
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -1,20 +1,22 @@
<tool id="ncbi_blastx_wrapper" name="NCBI BLAST+ blastx" version="0.0.1"><description>Search protein database with translated nucleotide query sequence(s)</description><command>
- blastx
- -query "$query"
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+blastx
+-query "$query"
#if $db_opts.db_opts_selector == "db":
- -db "$db_opts.database"
+ -db "$db_opts.database"
#else:
- -subject "$db_opts.subject"
+ -subject "$db_opts.subject"
#end if
- -evalue $evalue_cutoff
- $adv_opts.filter_query
- $adv_opts.strand
- $adv_opts.matrix
- -out $output1
- -outfmt $out_format
- -num_threads 8
+-evalue $evalue_cutoff
+$adv_opts.filter_query
+$adv_opts.strand
+$adv_opts.matrix
+-out $output1
+-outfmt $out_format
+-num_threads 8
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -1,19 +1,21 @@
<tool id="ncbi_tblastn_wrapper" name="NCBI BLAST+ tblastn" version="0.0.1"><description>Search translated nucleotide database with protein query sequence(s)</description><command>
- tblastn
- -query "$query"
+## The command is a Cheetah template which allows some Python based syntax.
+## Lines starting hash hash are comments. Galaxy will turn newlines into spaces
+tblastn
+-query "$query"
#if $db_opts.db_opts_selector == "db":
- -db "$db_opts.database"
+ -db "$db_opts.database"
#else:
- -subject "$db_opts.subject"
+ -subject "$db_opts.subject"
#end if
- -evalue $evalue_cutoff
- $adv_opts.filter_query
- $adv_opts.matrix
- -out $output1
- -outfmt $out_format
- -num_threads 8
+-evalue $evalue_cutoff
+$adv_opts.filter_query
+$adv_opts.matrix
+-out $output1
+-outfmt $out_format
+-num_threads 8
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
1
0

galaxy-dist commit b2906cd2d484: Add -word_size as an advanced argument (ideally would be an optional integer with validation)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286538540 -3600
# Node ID b2906cd2d484a25f80134f432b7c36ed18747bb5
# Parent b0286178f81dfcfbfd03e64b2b4fdb347ee75607
Add -word_size as an advanced argument (ideally would be an optional integer with validation)
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -22,6 +22,9 @@ blastn
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-max_target_seqs $adv_opts.max_hits
#end if
+#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+-word_size $adv_opts.word_size
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -72,6 +75,7 @@ blastn
<param name="filter_query" type="hidden" value="" /><param name="strand" type="hidden" value="" /><param name="max_hits" type="hidden" value="" />
+ <param name="word_size" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'level window linker' -->
@@ -82,7 +86,11 @@ blastn
<option value="-strand minus">Minus (reverse complement)</option></param><!-- Why doesn't optional override a validator? I want to accept an empty string OR a non-negative integer -->
- <param name="max_hits" type="integer" value="0" lable="Maximum hits to show" help="Use zero for default limits">
+ <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits">
+ <validator type="in_range" min="0" />
+ </param>
+ <!-- I'd like word_size to be optional, with minimum 4 for blastn -->
+ <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 4."><validator type="in_range" min="0" /></param></when>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -22,6 +22,9 @@ blastp
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-max_target_seqs $adv_opts.max_hits
#end if
+#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+-word_size $adv_opts.word_size
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -66,6 +69,7 @@ blastp
<param name="filter_query" type="hidden" value="" /><param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" />
+ <param name="word_size" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -81,7 +85,11 @@ blastp
<option value="-matrix PAM30">PAM30</option></param><!-- Why doesn't optional override a validator? I want to accept an empty string OR a non-negative integer -->
- <param name="max_hits" type="integer" value="0" lable="Maximum hits to show" help="Use zero for default limits">
+ <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits">
+ <validator type="in_range" min="0" />
+ </param>
+ <!-- I'd like word_size to be optional, with minimum 2 for blastp -->
+ <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param></when>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -22,6 +22,9 @@ tblastx
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-max_target_seqs $adv_opts.max_hits
#end if
+#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+-word_size $adv_opts.word_size
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -63,6 +66,7 @@ tblastx
<param name="strand" type="hidden" value="" /><param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" />
+ <param name="word_size" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -86,6 +90,10 @@ tblastx
<param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits"><validator type="in_range" min="0" /></param>
+ <!-- I'd like word_size to be optional, with minimum 2 for tblastx -->
+ <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2.">
+ <validator type="in_range" min="0" />
+ </param></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -22,6 +22,9 @@ blastx
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-max_target_seqs $adv_opts.max_hits
#end if
+#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+-word_size $adv_opts.word_size
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -63,6 +66,7 @@ blastx
<param name="strand" type="hidden" value="" /><param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" />
+ <param name="word_size" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -83,7 +87,11 @@ blastx
<option value="-matrix PAM30">PAM30</option></param><!-- Why doesn't optional override a validator? I want to accept an empty string OR a non-negative integer -->
- <param name="max_hits" type="integer" value="0" lable="Maximum hits to show" help="Use zero for default limits">
+ <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits">
+ <validator type="in_range" min="0" />
+ </param>
+ <!-- I'd like word_size to be optional, with minimum 2 for blastx -->
+ <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param></when>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -21,6 +21,9 @@ tblastn
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
-max_target_seqs $adv_opts.max_hits
#end if
+#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
+-word_size $adv_opts.word_size
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -61,6 +64,7 @@ tblastn
<param name="filter_query" type="hidden" value="" /><param name="matrix" type="hidden" value="" /><param name="max_hits" type="hidden" value="" />
+ <param name="word_size" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -76,7 +80,11 @@ tblastn
<option value="-matrix PAM30">PAM30</option></param><!-- Why doesn't optional override a validator? I want to accept an empty string OR a non-negative integer -->
- <param name="max_hits" type="integer" value="0" lable="Maximum hits to show" help="Use zero for default limits">
+ <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits">
+ <validator type="in_range" min="0" />
+ </param>
+ <!-- I'd like word_size to be optional, with minimum 2 for blastp -->
+ <param name="word_size" type="integer" value="0" label="Word size for wordfinder algorithm" help="Use zero for default, otherwise minimum 2."><validator type="in_range" min="0" /></param></when>
1
0

galaxy-dist commit dd7a3707f323: Add -matrix option to BLASTP, BLASTX, TBLASTN and TBLASTX (doesn't apply to BLASTN)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286293730 -3600
# Node ID dd7a3707f323bbf38689a24bfcb0b337c3494569
# Parent 1c8a5958c7481e53e862dbdf44d5367b6f3fc271
Add -matrix option to BLASTP, BLASTX, TBLASTN and TBLASTX (doesn't apply to BLASTN)
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -11,6 +11,7 @@
-task $blast_type
-evalue $evalue_cutoff
$adv_opts.filter_query
+ $adv_opts.matrix
-out $output1
-outfmt $out_format
-num_threads 8
@@ -56,10 +57,21 @@
</param><when value="basic"><param name="filter_query" type="hidden" value="" />
+ <param name="matrix" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
+ <param name="matrix" type="select" label="Scoring matrix">
+ <option value="-matrix BLOSUM62">BLOSUM62 (default)</option>
+ <option value="-matrix BLOSUM90">BLOSUM90</option>
+ <option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM50">BLOSUM50</option>
+ <option value="-matrix BLOSUM45">BLOSUM45</option>
+ <option value="-matrix PAM250">PAM250</option>
+ <option value="-matrix PAM70">PAM70</option>
+ <option value="-matrix PAM30">PAM30</option>
+ </param></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -11,6 +11,7 @@
-evalue $evalue_cutoff
$adv_opts.filter_query
$adv_opts.strand
+ $adv_opts.matrix
-out $output1
-outfmt $out_format
-num_threads 8
@@ -53,6 +54,7 @@
<when value="basic"><param name="filter_query" type="hidden" value="" /><param name="strand" type="hidden" value="" />
+ <param name="matrix" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -62,6 +64,16 @@
<option value="-strand plus">Plus (forward)</option><option value="-strand minus">Minus (reverse complement)</option></param>
+ <param name="matrix" type="select" label="Scoring matrix">
+ <option value="-matrix BLOSUM62">BLOSUM62 (default)</option>
+ <option value="-matrix BLOSUM90">BLOSUM90</option>
+ <option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM50">BLOSUM50</option>
+ <option value="-matrix BLOSUM45">BLOSUM45</option>
+ <option value="-matrix PAM250">PAM250</option>
+ <option value="-matrix PAM70">PAM70</option>
+ <option value="-matrix PAM30">PAM30</option>
+ </param></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -11,6 +11,7 @@
-evalue $evalue_cutoff
$adv_opts.filter_query
$adv_opts.strand
+ $adv_opts.matrix
-out $output1
-outfmt $out_format
-num_threads 8
@@ -53,6 +54,7 @@
<when value="basic"><param name="filter_query" type="hidden" value="" /><param name="strand" type="hidden" value="" />
+ <param name="matrix" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' -->
@@ -62,6 +64,16 @@
<option value="-strand plus">Plus (forward)</option><option value="-strand minus">Minus (reverse complement)</option></param>
+ <param name="matrix" type="select" label="Scoring matrix">
+ <option value="-matrix BLOSUM62">BLOSUM62 (default)</option>
+ <option value="-matrix BLOSUM90">BLOSUM90</option>
+ <option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM50">BLOSUM50</option>
+ <option value="-matrix BLOSUM45">BLOSUM45</option>
+ <option value="-matrix PAM250">PAM250</option>
+ <option value="-matrix PAM70">PAM70</option>
+ <option value="-matrix PAM30">PAM30</option>
+ </param></when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -10,6 +10,7 @@
#end if
-evalue $evalue_cutoff
$adv_opts.filter_query
+ $adv_opts.matrix
-out $output1
-outfmt $out_format
-num_threads 8
@@ -51,10 +52,21 @@
</param><when value="basic"><param name="filter_query" type="hidden" value="" />
+ <param name="matrix" type="hidden" value="" /></when><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
+ <param name="matrix" type="select" label="Scoring matrix">
+ <option value="-matrix BLOSUM62">BLOSUM62 (default)</option>
+ <option value="-matrix BLOSUM90">BLOSUM90</option>
+ <option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM50">BLOSUM50</option>
+ <option value="-matrix BLOSUM45">BLOSUM45</option>
+ <option value="-matrix PAM250">PAM250</option>
+ <option value="-matrix PAM70">PAM70</option>
+ <option value="-matrix PAM30">PAM30</option>
+ </param></when></conditional></inputs>
1
0

galaxy-dist commit 1c8a5958c748: Use dropdown (default) rather than radio for BLAST databases as could be lots of them
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1285945041 -3600
# Node ID 1c8a5958c7481e53e862dbdf44d5367b6f3fc271
# Parent 477eb3cceae79d93be845a8540572033f208ae73
Use dropdown (default) rather than radio for BLAST databases as could be lots of them
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -24,7 +24,7 @@
<option value="file">FASTA file</option></param><when value="db">
- <param name="database" type="select" display="radio" label="Nucleotide BLAST database">
+ <param name="database" type="select" label="Nucleotide BLAST database"><options from_file="blastdb.loc"><column name="name" index="0"/><column name="value" index="1"/>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -23,7 +23,7 @@
<option value="file">FASTA file</option></param><when value="db">
- <param name="database" type="select" display="radio" label="Protein BLAST database">
+ <param name="database" type="select" label="Protein BLAST database"><options from_file="blastdb_p.loc"><column name="name" index="0"/><column name="value" index="1"/>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -23,7 +23,7 @@
<option value="file">FASTA file</option></param><when value="db">
- <param name="database" type="select" display="radio" label="Nucleotide BLAST database">
+ <param name="database" type="select" label="Nucleotide BLAST database"><options from_file="blastdb.loc"><column name="name" index="0"/><column name="value" index="1"/>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -23,7 +23,7 @@
<option value="file">FASTA file</option></param><when value="db">
- <param name="database" type="select" display="radio" label="Protein BLAST database">
+ <param name="database" type="select" label="Protein BLAST database"><options from_file="blastdb_p.loc"><column name="name" index="0"/><column name="value" index="1"/>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -22,7 +22,7 @@
<option value="file">FASTA file</option></param><when value="db">
- <param name="database" type="select" display="radio" label="Nucleotide BLAST database">
+ <param name="database" type="select" label="Nucleotide BLAST database"><options from_file="blastdb.loc"><column name="name" index="0"/><column name="value" index="1"/>
1
0

galaxy-dist commit 6273161e76c3: Make BLOSUM62 the default with sensible sorting (tip from Ross Lazarus on mailing list)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286293953 -3600
# Node ID 6273161e76c33f807145d9b12eafa0a6e414bbf1
# Parent dd7a3707f323bbf38689a24bfcb0b337c3494569
Make BLOSUM62 the default with sensible sorting (tip from Ross Lazarus on mailing list)
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -63,9 +63,9 @@
<!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" /><param name="matrix" type="select" label="Scoring matrix">
- <option value="-matrix BLOSUM62">BLOSUM62 (default)</option><option value="-matrix BLOSUM90">BLOSUM90</option><option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM62" selected="true">BLOSUM62 (default)</option><option value="-matrix BLOSUM50">BLOSUM50</option><option value="-matrix BLOSUM45">BLOSUM45</option><option value="-matrix PAM250">PAM250</option>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -65,9 +65,9 @@
<option value="-strand minus">Minus (reverse complement)</option></param><param name="matrix" type="select" label="Scoring matrix">
- <option value="-matrix BLOSUM62">BLOSUM62 (default)</option><option value="-matrix BLOSUM90">BLOSUM90</option><option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM62" selected="true">BLOSUM62 (default)</option><option value="-matrix BLOSUM50">BLOSUM50</option><option value="-matrix BLOSUM45">BLOSUM45</option><option value="-matrix PAM250">PAM250</option>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -65,15 +65,16 @@
<option value="-strand minus">Minus (reverse complement)</option></param><param name="matrix" type="select" label="Scoring matrix">
- <option value="-matrix BLOSUM62">BLOSUM62 (default)</option><option value="-matrix BLOSUM90">BLOSUM90</option><option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM62" selected="true">BLOSUM62 (default)</option><option value="-matrix BLOSUM50">BLOSUM50</option><option value="-matrix BLOSUM45">BLOSUM45</option><option value="-matrix PAM250">PAM250</option><option value="-matrix PAM70">PAM70</option><option value="-matrix PAM30">PAM30</option></param>
+
</when></conditional></inputs>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -58,9 +58,9 @@
<!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" /><param name="matrix" type="select" label="Scoring matrix">
- <option value="-matrix BLOSUM62">BLOSUM62 (default)</option><option value="-matrix BLOSUM90">BLOSUM90</option><option value="-matrix BLOSUM80">BLOSUM80</option>
+ <option value="-matrix BLOSUM62" selected="true">BLOSUM62 (default)</option><option value="-matrix BLOSUM50">BLOSUM50</option><option value="-matrix BLOSUM45">BLOSUM45</option><option value="-matrix PAM250">PAM250</option>
1
0

20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286383905 -3600
# Node ID b0286178f81dfcfbfd03e64b2b4fdb347ee75607
# Parent f5f74df868f1dfb369ec723ef2cb9f0926eaa760
Fixed silly typo
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -83,7 +83,7 @@ tblastx
<option value="-matrix PAM30">PAM30</option></param><!-- Why doesn't optional override a validator? I want to accept an empty string OR a non-negative integer -->
- <param name="max_hits" type="integer" value="0" lable="Maximum hits to show (in plain text output)" help="Use zero for default limits">
+ <param name="max_hits" type="integer" value="0" label="Maximum hits to show" help="Use zero for default limits"><validator type="in_range" min="0" /></param></when>
1
0

galaxy-dist commit 477eb3cceae7: Updated a caption for consistency, removed an old comment
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1285944657 -3600
# Node ID 477eb3cceae79d93be845a8540572033f208ae73
# Parent 36086d5bd8fa174ce88443eeeefec52b8fada5bd
Updated a caption for consistency, removed an old comment
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -33,7 +33,7 @@
</when><when value="file"><param name="database" type="hidden" value="" />
- <param name="subject" type="data" format="fasta" label="Protein subject sequence(s)"/>
+ <param name="subject" type="data" format="fasta" label="Protein FASTA file to use as database"/></when></conditional><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -59,7 +59,6 @@
</conditional></inputs><outputs>
- <!-- TODO, can I get the caption rather than the value? e.g. 'NT' rather than a long path? --><data name="output1" format="tabular" label="tblastn on ${db_opts.db_opts_selector}"><change_format><when input="out_format" value="0" format="txt"/>
1
0

galaxy-dist commit f5f74df868f1: Comment out blastn vecscreen as not supported
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286381298 -3600
# Node ID f5f74df868f1dfb369ec723ef2cb9f0926eaa760
# Parent c4c2b6eea3e11ee8a024b32f58419f7b1d36f114
Comment out blastn vecscreen as not supported
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -49,7 +49,10 @@ blastn
<option value="blastn">blastn</option><option value="blastn-short">blastn-short</option><option value="dc-megablast">dc-megablast</option>
+ <!-- Using BLAST 2.2.24+ this gives an error:
+ BLAST engine error: Program type 'vecscreen' not supported
<option value="vecscreen">vecscreen</option>
+ --></param><param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" /><param name="out_format" type="select" label="Output format">
1
0

galaxy-dist commit 8979b429d769: Adding a Python script for converting BLAST XML to 12 column tabular
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286551276 -3600
# Node ID 8979b429d7691f4121afb368a05e6b9d0ea40706
# Parent b2906cd2d484a25f80134f432b7c36ed18747bb5
Adding a Python script for converting BLAST XML to 12 column tabular
--- /dev/null
+++ b/tools/ncbi_blast_plus/blastxml_to_tabular.xml
@@ -0,0 +1,41 @@
+<tool id="blastxml_to_tabular" name="BLAST XML to tabular" version="0.0.1">
+ <description>Convert BLAST XML output to tabular</description>
+ <command interpreter="python">
+ blastxml_to_tabular.py $blastxml_file $tabular_file
+ </command>
+ <inputs>
+ <param name="blastxml_file" type="data" format="blastxml" label="BLAST results as XML"/>
+ </inputs>
+ <outputs>
+ <data name="tabular_file" format="tabular" label="BLAST results as tabular" />
+ </outputs>
+ <requirements>
+ </requirements>
+ <tests>
+ </tests>
+ <help>
+
+**What it does**
+
+NCBI BLAST+ (and the older NCBI 'legacy' BLAST) can output in a range of formats including
+tabular and a more detailed XML format. A complex workflow may need both the XML and the
+tabular output.
+
+This tool takes the BLAST XML output and converts it into the 12 column tabular equivalent:
+
+1. Id of your sequence
+2. GI of the database hit
+3. % identity
+4. Alignment length
+5. # mismatches
+6. # gaps
+7. Start position in your sequence
+8. End position in your sequence
+9. Start position in database hit
+10. End position in database hit
+11. E-value
+12. Bit score
+
+
+ </help>
+</tool>
--- /dev/null
+++ b/tools/ncbi_blast_plus/blastxml_to_tabular.py
@@ -0,0 +1,123 @@
+#!/usr/bin/env python
+"""Convert a BLAST XML file to 12 column tabular output
+
+Takes two command line options, input BLAST XML filename and output tabular
+BLAST filename.
+
+The 12 colums output are 'qseqid sseqid pident length mismatch gapopen qstart
+qend sstart send evalue bitscore' which mean:
+
+ * qseqid - Query Seq-id
+ * sseqid - Subject Seq-id
+ * pident - Percentage of identical matches
+ * length - Alignment length
+ * mismatch - Number of mismatches
+ * gapopen - Number of gap openings
+ * qstart - Start of alignment in query
+ * qend - End of alignment in query
+ * sstart - Start of alignment in subject
+ * send - End of alignment in subject
+ * evalue - Expect value
+ * bitscore - Bit score
+
+Most of these fields are given explicitly in the XML file, others some like
+the percentage identity and the number of gap openings must be calculated.
+
+This script attempts to produce idential output to what BLAST+ would have done.
+However, check this with "diff -b ..." since BLAST+ sometimes includes an extra
+space character (probably a bug).
+"""
+import sys
+
+#Parse Command Line
+in_file, out_file = sys.argv[1:]
+
+assert sys.version_info[:2] >= ( 2, 4 )
+if sys.version_info[:2] >= ( 2, 5 ):
+ import xml.etree.cElementTree as cElementTree
+else:
+ import cElementTree
+
+def stop_err( msg ):
+ sys.stderr.write("%s\n" % msg)
+ sys.exit(1)
+
+tags = ["Hsp_identity",
+ "Hsp_align-len",
+ "Hsp_gaps",
+ "Hsp_query-from",
+ "Hsp_query-to",
+ "Hsp_hit-from",
+ "Hsp_hit-to",
+ "Hsp_evalue",
+ "Hsp_bit-score"]
+
+# get an iterable
+try:
+ context = cElementTree.iterparse(in_file, events=("start", "end"))
+except:
+ stop_err("Invalid data format.")
+# turn it into an iterator
+context = iter(context)
+# get the root element
+try:
+ event, root = context.next()
+except:
+ stop_err( "Invalid data format." )
+
+outfile = open(out_file, 'w')
+for event, elem in context:
+ # for every <Iteration> tag
+ if event == "end" and elem.tag == "Iteration":
+ qseqid = elem.findtext("Iteration_query-def").split(None,1)[0]
+ # for every <Hit> within <Iteration>
+ for hit in elem.findall("Iteration_hits/Hit/"):
+ sseqid = hit.findtext("Hit_id").split(None,1)[0]
+ # for every <Hsp> within <Hit>
+ for hsp in hit.findall("Hit_hsps/Hsp"):
+ identity = hsp.findtext("Hsp_identity")
+ length = hsp.findtext("Hsp_align-len")
+ pident = "%0.2f" % (100*float(identity)/float(length))
+
+ q_seq = hsp.findtext("Hsp_qseq")
+ h_seq = hsp.findtext("Hsp_hseq")
+ assert len(q_seq) == len(h_seq) == int(length)
+ gapopen = str(len(q_seq.replace('-', ' ').split())-1 + \
+ len(h_seq.replace('-', ' ').split())-1)
+ mismatch = str(len(q_seq) - sum(1 for q,h in zip(q_seq, h_seq) \
+ if q == h or q == "-" or h == "-"))
+ assert int(identity) == sum(1 for q,h in zip(q_seq, h_seq) if q == h)
+
+ evalue = hsp.findtext("Hsp_evalue")
+ if evalue == "0":
+ evalue = "0.0"
+ else:
+ evalue = "%0.0e" % float(evalue)
+
+ bitscore = float(hsp.findtext("Hsp_bit-score"))
+ if bitscore < 100:
+ #Seems to show one decimal place for lower scores
+ bitscore = "%0.1f" % bitscore
+ else:
+ #Note BLAST does not round to nearest int, it truncates
+ bitscore = "%i" % bitscore
+
+ values = [qseqid,
+ sseqid,
+ pident,
+ length, #hsp.findtext("Hsp_align-len")
+ mismatch,
+ gapopen,
+ hsp.findtext("Hsp_query-from"), #qstart,
+ hsp.findtext("Hsp_query-to"), #qend,
+ hsp.findtext("Hsp_hit-from"), #sstart,
+ hsp.findtext("Hsp_hit-to"), #send,
+ evalue, #hsp.findtext("Hsp_evalue") in scientific notation
+ bitscore, #hsp.findtext("Hsp_bit-score") rounded
+ ]
+ #print "\t".join(values)
+ outfile.write("\t".join(values) + "\n")
+ # prevents ElementTree from growing large datastructure
+ root.clear()
+ elem.clear()
+outfile.close()
1
0