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

commit/galaxy-central: jgoecks: Update functional test outputs for v1.2.0 of Tophat.
by Bitbucket 24 Feb '11
by Bitbucket 24 Feb '11
24 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/5fca3e76c2f4/
changeset: r5117:5fca3e76c2f4
user: jgoecks
date: 2011-02-24 15:17:50
summary: Update functional test outputs for v1.2.0 of Tophat.
affected #: 4 files (0 bytes)
--- a/test-data/tophat_out1j.bed Wed Feb 23 14:53:54 2011 -0500
+++ b/test-data/tophat_out1j.bed Thu Feb 24 09:17:50 2011 -0500
@@ -1,3 +1,3 @@
track name=junctions description="TopHat junctions"
-test_chromosome 180 400 JUNC00000001 24 + 180 400 255,0,0 2 70,50 0,170
+test_chromosome 180 400 JUNC00000001 26 + 180 400 255,0,0 2 70,50 0,170
test_chromosome 349 550 JUNC00000002 22 + 349 550 255,0,0 2 51,50 0,151
--- a/test-data/tophat_out2j.bed Wed Feb 23 14:53:54 2011 -0500
+++ b/test-data/tophat_out2j.bed Thu Feb 24 09:17:50 2011 -0500
@@ -1,3 +1,3 @@
track name=junctions description="TopHat junctions"
-test_chromosome 180 402 JUNC00000001 46 + 180 402 255,0,0 2 70,52 0,170
+test_chromosome 180 402 JUNC00000001 49 + 180 402 255,0,0 2 70,52 0,170
test_chromosome 349 550 JUNC00000002 38 + 349 550 255,0,0 2 51,50 0,151
--- a/test-data/tophat_out3j.bed Wed Feb 23 14:53:54 2011 -0500
+++ b/test-data/tophat_out3j.bed Thu Feb 24 09:17:50 2011 -0500
@@ -1,3 +1,3 @@
track name=junctions description="TopHat junctions"
-test_chromosome 180 400 JUNC00000001 24 + 180 400 255,0,0 2 70,50 0,170
+test_chromosome 180 400 JUNC00000001 26 + 180 400 255,0,0 2 70,50 0,170
test_chromosome 349 550 JUNC00000002 22 + 349 550 255,0,0 2 51,50 0,151
--- a/test-data/tophat_out4j.bed Wed Feb 23 14:53:54 2011 -0500
+++ b/test-data/tophat_out4j.bed Thu Feb 24 09:17:50 2011 -0500
@@ -1,3 +1,3 @@
track name=junctions description="TopHat junctions"
-test_chromosome 180 402 JUNC00000001 46 + 180 402 255,0,0 2 70,52 0,170
+test_chromosome 180 402 JUNC00000001 49 + 180 402 255,0,0 2 70,52 0,170
test_chromosome 349 550 JUNC00000002 38 + 349 550 255,0,0 2 51,50 0,151
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: natefoo: When comparing bam files in the test framework, convert them to sam for comparison.
by Bitbucket 23 Feb '11
by Bitbucket 23 Feb '11
23 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/93783833e6b1/
changeset: r5116:93783833e6b1
user: natefoo
date: 2011-02-23 20:53:54
summary: When comparing bam files in the test framework, convert them to sam for comparison.
affected #: 2 files (949 bytes)
--- a/test/base/twilltestcase.py Wed Feb 23 14:01:58 2011 -0500
+++ b/test/base/twilltestcase.py Wed Feb 23 14:53:54 2011 -0500
@@ -1,7 +1,7 @@
import pkg_resources
pkg_resources.require( "twill==0.9" )
-import StringIO, os, sys, random, filecmp, time, unittest, urllib, logging, difflib, tarfile, zipfile, tempfile, re, shutil
+import StringIO, os, sys, random, filecmp, time, unittest, urllib, logging, difflib, tarfile, zipfile, tempfile, re, shutil, subprocess
from itertools import *
import twill
@@ -633,6 +633,9 @@
try:
if attributes is None:
attributes = {}
+ if attributes.get( 'ftype', None ) == 'bam':
+ local_fh, temp_name = self._bam_to_sam( local_name, temp_name )
+ local_name = local_fh.name
compare = attributes.get( 'compare', 'diff' )
extra_files = attributes.get( 'extra_files', None )
if compare == 'diff':
@@ -658,6 +661,17 @@
finally:
os.remove( temp_name )
+ def _bam_to_sam( self, local_name, temp_name ):
+ temp_local = tempfile.NamedTemporaryFile( suffix='.sam', prefix='local_bam_converted_to_sam_' )
+ fd, temp_temp = tempfile.mkstemp( suffix='.sam', prefix='history_bam_converted_to_sam_' )
+ os.close( fd )
+ p = subprocess.Popen( args="samtools view %s -o %s" % ( local_name, temp_local.name ), shell=True )
+ assert not p.wait(), 'Converting local (test-data) bam to sam failed'
+ p = subprocess.Popen( args="samtools view %s -o %s" % ( temp_name, temp_temp ), shell=True )
+ assert not p.wait(), 'Converting history bam to sam failed'
+ os.remove( temp_name )
+ return temp_local, temp_temp
+
def verify_extra_files_content( self, extra_files, hda_id ):
files_list = []
for extra_type, extra_value, extra_name, extra_attributes in extra_files:
--- a/test/functional/test_get_data.py Wed Feb 23 14:01:58 2011 -0500
+++ b/test/functional/test_get_data.py Wed Feb 23 14:53:54 2011 -0500
@@ -389,7 +389,7 @@
self.upload_file( '1.bam' )
hda = get_latest_hda()
assert hda is not None, "Problem retrieving hda from database"
- self.verify_dataset_correctness( '1.bam', hid=str( hda.hid ) )
+ self.verify_dataset_correctness( '1.bam', hid=str( hda.hid ), attributes={ 'ftype' : 'bam' } )
self.check_history_for_string( '<span class="bam">bam</span>' )
# Make sure the Bam index was created
assert hda.metadata.bam_index is not None, "Bam index was not correctly created for 1.bam"
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

23 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/7b2bc40bad02/
changeset: r5115:7b2bc40bad02
user: dannon
date: 2011-02-23 20:01:58
summary: Initial commit of Mosaik and Freebayes.
affected #: 5 files (302 bytes)
--- a/tool_conf.xml.sample Wed Feb 23 13:54:06 2011 -0500
+++ b/tool_conf.xml.sample Wed Feb 23 14:01:58 2011 -0500
@@ -291,6 +291,7 @@
<tool file="metag_tools/megablast_xml_parser.xml" /><tool file="sr_mapping/PerM.xml" /><tool file="sr_mapping/srma_wrapper.xml" />
+ <tool file="sr_mapping/mosaik.xml"/></section><section name="NGS: Indel Analysis" id="indel_analysis"><tool file="indels/sam_indel_filter.xml" />
@@ -369,6 +370,7 @@
<tool file="human_genome_variation/beam.xml" /><tool file="human_genome_variation/lps.xml" /><tool file="human_genome_variation/hilbertvis.xml" />
+ <tool file="human_genome_variation/freebayes.xml" /></section><section name="VCF Tools" id="vcf_tools"><tool file="vcf_tools/intersect.xml" />
--- a/tool_data_table_conf.xml.sample Wed Feb 23 13:54:06 2011 -0500
+++ b/tool_data_table_conf.xml.sample Wed Feb 23 14:01:58 2011 -0500
@@ -80,4 +80,9 @@
<columns>value, name, path</columns><file path="tool-data/ccat_configurations.loc" /></table>
+ <!-- Location of Mosaik files -->
+ <table name="mosaik_indexes" comment_char="#">
+ <columns>value, dbkey, name, path</columns>
+ <file path="tool-data/mosaik_index.loc" />
+ </table></tables>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: natefoo: Update bwa_wrapper to use the test data repository. bwa_color_wrapper will need to be done once the test data repository is updated to contain the data it uses.
by Bitbucket 23 Feb '11
by Bitbucket 23 Feb '11
23 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a6141e135830/
changeset: r5114:a6141e135830
user: natefoo
date: 2011-02-23 19:54:06
summary: Update bwa_wrapper to use the test data repository. bwa_color_wrapper will need to be done once the test data repository is updated to contain the data it uses.
affected #: 1 file (258 bytes)
--- a/tools/sr_mapping/bwa_wrapper.xml Wed Feb 23 11:56:16 2011 -0500
+++ b/tools/sr_mapping/bwa_wrapper.xml Wed Feb 23 13:54:06 2011 -0500
@@ -139,8 +139,7 @@
python -c "import sys; lines=file(sys.argv[1],'rb').readlines(); lines.sort(); file(sys.argv[2],'wb').write(''.join(lines))" bwa_wrapper_out1.u.sam bwa_wrapper_out1.sam
--><param name="refGenomeSource" value="indexed" />
- <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="indices" value="/galaxy/data/phiX/bwa_index/phiX.fa" />
+ <param name="indices" value="phiX" /><param name="sPaired" value="single" /><param name="input1" value="bwa_wrapper_in1.fastqsanger" ftype="fastqsanger" /><param name="source_select" value="pre_set" />
@@ -195,8 +194,7 @@
python -c "import sys; lines=file(sys.argv[1],'rb').readlines(); lines.sort(); file(sys.argv[2],'wb').write(''.join(lines))" bwa_wrapper_out3.u.sam bwa_wrapper_out3.sam
--><param name="refGenomeSource" value="indexed" />
- <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="indices" value="/galaxy/data/phiX/bwa_index/phiX.fa" />
+ <param name="indices" value="phiX" /><param name="sPaired" value="paired" /><param name="input1" value="bwa_wrapper_in2.fastqsanger" ftype="fastqsanger" /><param name="input2" value="bwa_wrapper_in3.fastqsanger" ftype="fastqsanger" />
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: rc: Bug fix: checkbox values were not getting saved for samples in the sample grid. Issue #476
by Bitbucket 23 Feb '11
by Bitbucket 23 Feb '11
23 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b54ef1e11b77/
changeset: r5113:b54ef1e11b77
user: rc
date: 2011-02-23 17:56:16
summary: Bug fix: checkbox values were not getting saved for samples in the sample grid. Issue #476
affected #: 2 files (890 bytes)
--- a/lib/galaxy/web/controllers/requests_common.py Wed Feb 23 10:40:30 2011 -0500
+++ b/lib/galaxy/web/controllers/requests_common.py Wed Feb 23 11:56:16 2011 -0500
@@ -1432,7 +1432,11 @@
field_values = {}
for field_index, field in enumerate( request.type.sample_form.fields ):
field_name = field['name']
- field_value = util.restore_text( params.get( 'sample_%i_field_%i' % ( index, field_index ), sample.values.content[ field_name ] ) )
+ input_value = params.get( 'sample_%i_field_%i' % ( index, field_index ), sample.values.content[ field_name ] )
+ if field['type'] == CheckboxField.__name__:
+ field_value = CheckboxField.is_checked( input_value )
+ else:
+ field_value = util.restore_text( input_value )
field_values[ field_name ] = field_value
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans=trans,
user=request.user,
@@ -1504,8 +1508,13 @@
workflow_dict['mappings'][int(k[len(kwd_tag):])] = {'ds_tag':v}
field_values = {}
for field_index, field in enumerate( request.type.sample_form.fields ):
- field_name = field['name']
- field_values[ field_name ] = util.restore_text( params.get( 'sample_%i_field_%i' % ( index, field_index ), '' ) )
+ field_name = field['name']
+ input_value = params.get( 'sample_%i_field_%i' % ( index, field_index ), '' )
+ if field['type'] == CheckboxField.__name__:
+ field_value = CheckboxField.is_checked( input_value )
+ else:
+ field_value = util.restore_text( input_value )
+ field_values[ field_name ] = field_value
library_select_field, folder_select_field = self.__build_library_and_folder_select_fields( trans=trans,
user=request.user,
sample_index=index,
--- a/templates/requests/common/common.mako Wed Feb 23 10:40:30 2011 -0500
+++ b/templates/requests/common/common.mako Wed Feb 23 11:56:16 2011 -0500
@@ -591,7 +591,11 @@
%endfor
</select>
%elif field_type == 'CheckboxField':
- <input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes"/>
+ %if field_value is True:
+ <input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes" checked="checked"/><input type="hidden" name="sample_${index}_field_${field_index}" value="Yes"/>
+ %else:
+ <input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes"/><input type="hidden" name="sample_${index}_field_${field_index}" value="Yes"/>
+ %endif
%endif
<div class="toolParamHelp" style="clear: both;"><i>${'('+field['required']+')' }</i>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: jgoecks: Enhance GFF reader to handle headers and comments.
by Bitbucket 23 Feb '11
by Bitbucket 23 Feb '11
23 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/4426265b87be/
changeset: r5112:4426265b87be
user: jgoecks
date: 2011-02-23 16:40:30
summary: Enhance GFF reader to handle headers and comments.
affected #: 1 file (308 bytes)
--- a/lib/galaxy/datatypes/util/gff_util.py Tue Feb 22 18:49:57 2011 -0500
+++ b/lib/galaxy/datatypes/util/gff_util.py Wed Feb 23 10:40:30 2011 -0500
@@ -3,6 +3,7 @@
"""
import pkg_resources; pkg_resources.require( "bx-python" )
from bx.intervals.io import *
+from bx.tabular.io import Header, Comment
class GFFInterval( GenomicInterval ):
"""
@@ -148,6 +149,12 @@
self.seed_interval = GenomicIntervalReader.next( self )
except ParseError, e:
handle_parse_error( e )
+
+ # If header or comment, clear seed interval and return it.
+ if isinstance( self.seed_interval, ( Header, Comment ) ):
+ return_val = self.seed_interval
+ self.seed_interval = None
+ return return_val
# Initialize feature name from seed.
feature_group = self.seed_interval.attributes.get( 'group', None ) # For GFF
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: kanwei: Refactor javascript in tool_form.mako; fix indentation for repeat groups
by Bitbucket 22 Feb '11
by Bitbucket 22 Feb '11
22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/9171601965fc/
changeset: r5111:9171601965fc
user: kanwei
date: 2011-02-23 00:49:57
summary: Refactor javascript in tool_form.mako; fix indentation for repeat groups
affected #: 1 file (235 bytes)
--- a/templates/tool_form.mako Tue Feb 22 18:41:15 2011 -0500
+++ b/templates/tool_form.mako Tue Feb 22 18:49:57 2011 -0500
@@ -29,6 +29,42 @@
}
});
});
+
+ // For drilldown parameters: add expand/collapse buttons and collapse initially-collapsed elements
+ $( 'li ul.toolParameterExpandableCollapsable' ).each( function() {
+ var el = $(this),
+ parent_li = el.parent('li'),
+ sub_ul = el.remove();
+
+ parent_li.find( 'span' ).wrapInner( '<a/>' ).find( 'a' ).click( function() {
+ sub_ul.toggle();
+ (this).html( sub_ul.is(":hidden") ? '[+]' : '[-]' );
+ });
+ parent_li.append( sub_ul );
+ });
+
+ $( 'ul ul.toolParameterExpandableCollapsable' ).each( function(i) {
+ var el = $(this);
+ if (el.attr("default_state") === "collapsed") {
+ el.hide();
+ }
+ });
+
+ function checkUncheckAll( name, check ) {
+ $("input[name=" + name + "][type='checkbox']").attr('checked', !!check);
+ }
+
+ // Inserts the Select All / Unselect All buttons for checkboxes
+ $("div.checkUncheckAllPlaceholder").each( function() {
+ var check_name = $(this).attr("checkbox_name");
+ select_link = $("<a class='action-button'></a>").text("Select All").click(function() {
+ checkUncheckAll(check_name, true);
+ });
+ unselect_link = $("<a class='action-button'></a>").text("Unselect All").click(function() {
+ checkUncheckAll(check_name, false);
+ });
+ $(this).append(select_link).append(" ").append(unselect_link);
+ });
});
%if not add_frame.debug:
@@ -36,13 +72,6 @@
location.replace( '${h.url_for( controller='root', action='index', tool_id=tool.id )}' );
}
%endif
-function checkUncheckAll( name, check ) {
- if (!check) {
- $("input[name=" + name + "][type='checkbox']").attr('checked', false);
- } else {
- $("input[name=" + name + "][type='checkbox']").attr('checked', true );
- }
-}
</script></head>
@@ -59,16 +88,16 @@
<% repeat_state = tool_state[input.name] %>
%for i in range( len( repeat_state ) ):
<div class="repeat-group-item">
- <%
- if input.name in errors:
- rep_errors = errors[input.name][i]
- else:
- rep_errors = dict()
- index = repeat_state[i]['__index__']
- %>
- <div class="form-title-row"><b>${input.title} ${i + 1}</b></div>
- ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
- <div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div>
+ <%
+ if input.name in errors:
+ rep_errors = errors[input.name][i]
+ else:
+ rep_errors = dict()
+ index = repeat_state[i]['__index__']
+ %>
+ <div class="form-title-row"><b>${input.title} ${i + 1}</b></div>
+ ${do_inputs( input.inputs, repeat_state[i], rep_errors, prefix + input.name + "_" + str(index) + "|", other_values )}
+ <div class="form-row"><input type="submit" name="${prefix}${input.name}_${index}_remove" value="Remove ${input.title} ${i+1}"></div></div>
%if rep_errors.has_key( '__index__' ):
<div><img style="vertical-align: middle;" src="${h.url_for('/static/style/error_small.png')}"> <span style="vertical-align: middle;">${rep_errors['__index__']}</span></div>
@@ -231,37 +260,4 @@
</div>
%endif
</body>
-
-<script type="text/javascript">
-##For Drilldown Parameters adds expand/collapse buttons and collapses collapsed elements
- $( function() {
- $( 'li > ul' ).each( function( i ) {
- if ( $( this )[0].className == 'toolParameterExpandableCollapsable' )
- {
- var parent_li = $( this ).parent( 'li' );
- var sub_ul = $( this ).remove();
- parent_li.find( 'span' ).wrapInner( '<a/>' ).find( 'a' ).click( function() {
- sub_ul.toggle();
- $( this )[0].innerHTML = ( sub_ul[0].style.display=='none' ) ? '[+]' : '[-]';
- });
- parent_li.append( sub_ul );
- }
- });
- $( 'ul ul' ).each( function(i) {
- if ( $( this )[0].className == 'toolParameterExpandableCollapsable' && this.attributes.getNamedItem( 'default_state' ).value == 'collapsed' )
- {
- $( this ).hide();
- }
- });
- });
-
-##inserts the Select All / Unselect All buttons for checkboxes
-$( function() {
- $("div.checkUncheckAllPlaceholder").each( function( i ) {
- $( this )[0].innerHTML = '<a class="action-button" onclick="checkUncheckAll( \'' + this.attributes.getNamedItem( 'checkbox_name' ).value + '\', true );"><span>Select All</span></a><a class="action-button" onclick="checkUncheckAll( \'' + this.attributes.getNamedItem( 'checkbox_name' ).value + '\', false );"><span>Unselect All</span></a>';
- });
-});
-
-</script>
-
</html>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: jgoecks: Set output dataset type for 'Extract GFF features' tool to be input dataset type.
by Bitbucket 22 Feb '11
by Bitbucket 22 Feb '11
22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/6506489984e1/
changeset: r5110:6506489984e1
user: jgoecks
date: 2011-02-23 00:41:15
summary: Set output dataset type for 'Extract GFF features' tool to be input dataset type.
affected #: 1 file (26 bytes)
--- a/tools/filters/gff/extract_GFF_Features.xml Tue Feb 22 18:10:52 2011 -0500
+++ b/tools/filters/gff/extract_GFF_Features.xml Tue Feb 22 18:41:15 2011 -0500
@@ -59,7 +59,7 @@
</conditional></inputs><outputs>
- <data format="gff" name="out_file1" />
+ <data format="input" name="out_file1" metadata_source="input1"/></outputs><tests><test>
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: kanwei: Remove overflow from help text in tool forms, for IE
by Bitbucket 22 Feb '11
by Bitbucket 22 Feb '11
22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/a2f92ea84931/
changeset: r5109:a2f92ea84931
user: kanwei
date: 2011-02-23 00:10:52
summary: Remove overflow from help text in tool forms, for IE
affected #: 3 files (3 bytes)
--- a/static/june_2007_style/base.css.tmpl Tue Feb 22 17:24:10 2011 -0500
+++ b/static/june_2007_style/base.css.tmpl Tue Feb 22 18:10:52 2011 -0500
@@ -107,12 +107,12 @@
border-color: ${layout_border};
}
-div.toolHelp {
+div.toolHelp {
+ margin-top: 10px;
}
-div.toolHelpBody {
+div.toolHelpBody {
width: 100%;
- overflow: auto;
}
div.metadataForm {
--- a/static/june_2007_style/blue/base.css Tue Feb 22 17:24:10 2011 -0500
+++ b/static/june_2007_style/blue/base.css Tue Feb 22 18:10:52 2011 -0500
@@ -21,8 +21,8 @@
div.toolFormBody div.toolFormTitle{background:transparent;border:none;font-weight:bold;border-bottom:solid #d8b365 1px;margin-bottom:5px;}
div.toolFormDisabled div.toolFormTitle{background:#eee;border-color:#999;}
div.toolFormDisabled{border-color:#999;}
-div.toolHelp{}
-div.toolHelpBody{width:100%;overflow:auto;}
+div.toolHelp{margin-top:10px;}
+div.toolHelpBody{width:100%;}
div.metadataForm{border:solid #aaaaaa 1px;}
div.metadataFormTitle{font-weight:bold;padding:5px;padding-left:10px;padding-right:10px;background:#cccccc;background-repeat:repeat-x;background-position:top;border-bottom:solid #aaaaaa 1px;}
div.metadataFormBody{background:#FFFFFF;background-image:url(form_body_bg.png);background-repeat:repeat-x;background-position:top;padding:5px 0;}
--- a/static/june_2007_style/blue/trackster.css Tue Feb 22 17:24:10 2011 -0500
+++ b/static/june_2007_style/blue/trackster.css Tue Feb 22 18:10:52 2011 -0500
@@ -25,7 +25,7 @@
.track-content{overflow:hidden;text-align:center;border-bottom:1px solid #bbb;background:#eee url('/static/images/tracks/diag_bg.gif');min-height:16px;}
.label-track .track-content{background:white;}
.track-tile{background:white;}
-.track-tile canvas{position:relative;z-index:100;border:solid white;border-width: 2px 0px 0px 0px;}
+.track-tile canvas{position:relative;z-index:100;border:solid white;border-width:2px 0px 0px 0px;}
.track.error .track-content{background-color:#ECB4AF;background-image:none;padding:2px 0;}
.track.nodata .track-content{background-color:#eee;background-image:none;padding:2px 0;}
.loading{min-height:100px;}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: kanwei: Fix IE error when clicking on links in tool pane. Small refactoring as well
by Bitbucket 22 Feb '11
by Bitbucket 22 Feb '11
22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/5edac6f53bc2/
changeset: r5108:5edac6f53bc2
user: kanwei
date: 2011-02-22 23:24:10
summary: Fix IE error when clicking on links in tool pane. Small refactoring as well
affected #: 1 file (185 bytes)
--- a/templates/root/tool_menu.mako Tue Feb 22 17:14:16 2011 -0500
+++ b/templates/root/tool_menu.mako Tue Feb 22 17:24:10 2011 -0500
@@ -70,28 +70,26 @@
$( "div.toolSectionTitle > span" ).wrap( "<a href='#'></a>" )
var last_expanded = null;
$( "div.toolSectionTitle" ).each( function() {
- var body = $(this).next( "div.toolSectionBody" );
- $(this).click( function() {
- if ( body.is( ":hidden" ) ) {
+ var body = $(this).next( "div.toolSectionBody" );
+ $(this).click( function() {
+ if ( body.is( ":hidden" ) ) {
if ( last_expanded ) {
last_expanded.slideUp( "fast" );
}
last_expanded = body;
body.slideDown( "fast" );
- }
- else {
- body.slideUp( "fast" );
- last_expanded = null;
- }
- return false;
- });
+ } else {
+ body.slideUp( "fast" );
+ last_expanded = null;
+ }
+ return false;
+ });
});
// Log clicks on tools.
- $("div.toolTitle > a").click( function()
- {
+ $("div.toolTitle > a").click( function() {
var tool_title = $(this).attr('id').split("-")[1];
- var section_title = $(this).parents("div.toolSectionWrapper").find("div.toolSectionTitle").text().trim();
+ var section_title = $.trim( $(this).parents("div.toolSectionWrapper").find("div.toolSectionTitle").text() );
var search_active = $(this).parents("div.toolTitle").hasClass("search_match");
// Log action.
@@ -106,18 +104,17 @@
});
// Init searching.
- $("#tool-search-query").click( function (){
+ $("#tool-search-query").click( function () {
$(this).focus();
$(this).select();
- })
- .keyup( function () {
+ }).keyup( function () {
// Remove italics.
$(this).css("font-style", "normal");
// Don't update if same value as last time
if ( this.value.length < 3 ) {
reset_tool_search(false);
- } else if ( this.value != this.lastValue ) {
+ } else if ( this.value !== this.lastValue ) {
// Add class to denote that searching is active.
$(this).addClass("search_active");
// input.addClass(config.loadingClass);
@@ -138,7 +135,7 @@
$(".toolSectionWrapper").hide();
// This hides all tools but not workflows link (which is in a .toolTitle div).
$(".toolSectionWrapper").find(".toolTitle").hide();
- if ( data.length != 0 ) {
+ if ( data.length !== 0 ) {
// Map tool ids to element ids and join them.
var s = $.map( data, function( n, i ) { return ".link-" + n.toLowerCase().replace(/[^a-z0-9_]/g,'_'); } ).join( ", " );
@@ -146,14 +143,13 @@
$(s).each( function() {
// Add class to denote match.
$(this).parent().addClass("search_match");
- if ($(this).parents("#recently_used_wrapper").length == 0)
+ if ($(this).parents("#recently_used_wrapper").length === 0) {
// Default behavior.
$(this).parent().show().parent().parent().show().parent().show();
- else if ($(this).parents(".user_pref_visible").length != 0)
+ } else if ($(this).parents(".user_pref_visible").length !== 0) {
// RU menu is visible, so filter it as normal.
$(this).parent().show().parent().parent().show().parent().show();
- else
- {
+ } else {
// RU menu is not visible, so set up classes and visibility so that if menu shown matching is
// aleady in place.
$(this).parent().show();
@@ -162,22 +158,21 @@
// Hide labels that have no visible children.
$(".toolPanelLabel").each( function() {
- var this_label = $(this);
- var next = this_label.next();
- var no_visible_tools = true;
- // Look through tools following label and, if none are visible, hide label.
- while (next.length != 0 && next.hasClass("toolTitle"))
- {
- if (next.is(":visible"))
- {
- no_visible_tools = false;
- break;
- }
- else
- next = next.next();
+ var this_label = $(this);
+ var next = this_label.next();
+ var no_visible_tools = true;
+ // Look through tools following label and, if none are visible, hide label.
+ while (next.length !== 0 && next.hasClass("toolTitle")) {
+ if (next.is(":visible")) {
+ no_visible_tools = false;
+ break;
+ } else {
+ next = next.next();
+ }
}
- if (no_visible_tools)
+ if (no_visible_tools) {
this_label.hide();
+ }
});
} else {
$("#search-no-results").show();
@@ -191,8 +186,7 @@
});
// Update recently used tools menu. Function inserts a new item and removes the last item.
- function update_recently_used()
- {
+ function update_recently_used() {
$.ajax({
url: "${h.url_for( controller='/user', action='get_most_recently_used_tool_async' )}",
dataType: 'json',
@@ -208,15 +202,13 @@
recently_used_elts.each( function(index) {
var anchor = $(this).find("a");
var tool_id = anchor.attr("id").split("-")[1];
- if (tool_id == new_tool_info.id)
- {
+ if (tool_id === new_tool_info.id) {
found_in_list = true;
// If tool is first, do nothing.
- if (index == 0)
+ if (index === 0) {
return;
- else
- {
+ } else {
// Tool not first; reorder.
$(this).remove();
first_elt.before($(this));
@@ -225,8 +217,7 @@
});
// If tool not in list, create new element, remove last element, and put new element first in list.
- if (!found_in_list)
- {
+ if (!found_in_list) {
new_tool_elt = $("<div class='toolTitle'> \
<a id='link-" + new_tool_info.id + "' href='" + new_tool_info.link + "' target='" +
new_tool_info.target + "' minsizehint='" + new_tool_info.minsizehint + "'>" +
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/174ad45c7323/
changeset: r5107:174ad45c7323
user: kanwei
date: 2011-02-22 23:14:16
summary: Copy datasets feature:
- Fix functional tests
- Populate previously selected target history if attempt fails
affected #: 4 files (671 bytes)
--- a/lib/galaxy/web/controllers/dataset.py Tue Feb 22 16:56:11 2011 -0500
+++ b/lib/galaxy/web/controllers/dataset.py Tue Feb 22 17:14:16 2011 -0500
@@ -753,7 +753,7 @@
return trans.fill_template( "show_params.mako", history=trans.get_history(), hda=hda, tool=tool, params_objects=params_objects )
@web.expose
- def copy_datasets( self, trans, source_history=None, source_dataset_ids="", target_history_ids="", new_history_name="", do_copy=False, **kwd ):
+ def copy_datasets( self, trans, source_history=None, source_dataset_ids="", target_history_id=None, target_history_ids="", new_history_name="", do_copy=False, **kwd ):
params = util.Params( kwd )
user = trans.get_user()
if source_history is not None:
@@ -763,14 +763,16 @@
refresh_frames = []
if source_dataset_ids:
if not isinstance( source_dataset_ids, list ):
- source_dataset_ids = source_dataset_ids.split( "," )
- source_dataset_ids = map( trans.security.decode_id, source_dataset_ids )
+ source_dataset_ids = source_dataset_ids.split(",")
+ source_dataset_ids = set(map( trans.security.decode_id, source_dataset_ids ))
else:
source_dataset_ids = []
- if target_history_ids:
+ if target_history_id:
+ target_history_ids = [ trans.security.decode_id(target_history_id) ]
+ elif target_history_ids:
if not isinstance( target_history_ids, list ):
- target_history_ids = target_history_ids.split( "," )
- target_history_ids = [ trans.security.decode_id(h) for h in target_history_ids if h ]
+ target_history_ids = target_history_ids.split(",")
+ target_history_ids = set([ trans.security.decode_id(h) for h in target_history_ids if h ])
else:
target_history_ids = []
done_msg = error_msg = ""
@@ -818,6 +820,7 @@
source_history = history,
current_history = trans.get_history(),
source_dataset_ids = source_dataset_ids,
+ target_history_id = target_history_id,
target_history_ids = target_history_ids,
source_datasets = source_datasets,
target_histories = target_histories,
--- a/templates/dataset/copy_view.mako Tue Feb 22 16:56:11 2011 -0500
+++ b/templates/dataset/copy_view.mako Tue Feb 22 17:14:16 2011 -0500
@@ -79,16 +79,19 @@
<div class="toolFormTitle">Destination History:</div><div class="toolFormBody"><div class="form-row" id="single-destination">
- <select id="single-dest-select" name="target_history_ids">
+ <select id="single-dest-select" name="target_history_id"><option value=""></option>
%for i, hist in enumerate(target_histories):
<%
encoded_id = trans.security.encode_id(hist.id)
source_history_text = ""
+ selected = ""
if hist == source_history:
source_history_text = " (source history)"
+ if encoded_id == target_history_id:
+ selected = " selected='selected'"
%>
- <option value="${encoded_id}">${i + 1}: ${h.truncate(hist.name, 30)}${source_history_text}</option>
+ <option value="${encoded_id}"${selected}>${i + 1}: ${h.truncate(hist.name, 30)}${source_history_text}</option>
%endfor
</select><br /><br /><a style="margin-left: 10px;" href="javascript:void(0);" id="select-multiple">Choose multiple histories</a>
--- a/test/base/twilltestcase.py Tue Feb 22 16:56:11 2011 -0500
+++ b/test/base/twilltestcase.py Tue Feb 22 17:14:16 2011 -0500
@@ -543,12 +543,15 @@
tc.submit( 'change' )
self.check_page_for_string( 'Changed the type of dataset' )
self.home()
- def copy_history_item( self, source_dataset_ids='', target_history_ids=[], all_target_history_ids=[],
+ def copy_history_item( self, source_dataset_id=None, target_history_id=None, all_target_history_ids=[],
deleted_history_ids=[] ):
- """Copy 1 or more history_dataset_associations to 1 or more histories"""
+ """
+ Copy 1 history_dataset_association to 1 history (Limited by twill since it doesn't support multiple
+ field names, such as checkboxes
+ """
self.home()
- self.visit_url( "%s/dataset/copy_datasets?source_dataset_ids=%s" % ( self.url, source_dataset_ids ) )
- self.check_page_for_string( 'Source History Items' )
+ self.visit_url( "%s/dataset/copy_datasets?source_dataset_ids=%s" % ( self.url, source_dataset_id ) )
+ self.check_page_for_string( 'Source History:' )
# Make sure all of users active histories are displayed
for id in all_target_history_ids:
self.check_page_for_string( id )
@@ -559,12 +562,10 @@
raise AssertionError, "deleted history id %d displayed in list of target histories" % id
except:
pass
- # Check each history to which we want to copy the item
- for id in target_history_ids:
- tc.fv( '1', 'target_history_ids', id )
+
+ tc.fv( '1', 'target_history_id', target_history_id )
tc.submit( 'do_copy' )
- no_source_ids = len( source_dataset_ids.split( ',' ) )
- check_str = '%d datasets copied to %d histories.' % ( no_source_ids, len( target_history_ids ) )
+ check_str = '1 dataset copied to 1 history'
self.check_page_for_string( check_str )
self.home()
def get_hids_in_history( self ):
--- a/test/functional/test_history_functions.py Tue Feb 22 16:56:11 2011 -0500
+++ b/test/functional/test_history_functions.py Tue Feb 22 17:14:16 2011 -0500
@@ -726,16 +726,16 @@
.first()
assert hda1 is not None, "Problem retrieving hda1 from database"
# We'll just test copying 1 hda
- source_dataset_ids=str( hda1.id )
+ source_dataset_ids=self.security.encode_id( hda1.id )
# The valid list of target histories is only the user's active histories
- all_target_history_ids = [ str( hda.id ) for hda in admin_user.active_histories ]
+ all_target_history_ids = [ self.security.encode_id( hda.id ) for hda in admin_user.active_histories ]
# Since history1 and history2 have been deleted, they should not be displayed in the list of target histories
# on the copy_view.mako form
- deleted_history_ids = [ str( history1.id ), str( history2.id ) ]
+ deleted_history_ids = [ self.security.encode_id( history1.id ), self.security.encode_id( history2.id ) ]
# Test copying to the current history
- target_history_ids=[ str( history6.id ) ]
- self.copy_history_item( source_dataset_ids=source_dataset_ids,
- target_history_ids=target_history_ids,
+ target_history_id = self.security.encode_id( history6.id )
+ self.copy_history_item( source_dataset_id=source_dataset_ids,
+ target_history_id=target_history_id,
all_target_history_ids=all_target_history_ids,
deleted_history_ids=deleted_history_ids )
sa_session.refresh( history6 )
@@ -751,12 +751,12 @@
assert history7 is not None, "Problem retrieving history7 from database"
# Switch back to our history from which we want to copy
self.switch_history( id=self.security.encode_id( history6.id ), name=history6.name )
- target_history_ids=[ str( history7.id ) ]
- all_target_history_ids = [ str( hda.id ) for hda in admin_user.active_histories ]
+ target_history_id = self.security.encode_id( history7.id )
+ all_target_history_ids = [ self.security.encode_id( hda.id ) for hda in admin_user.active_histories ]
# Test copying to the a history that is not the current history
- target_history_ids=[ str( history7.id ) ]
- self.copy_history_item( source_dataset_ids=source_dataset_ids,
- target_history_ids=target_history_ids,
+ target_history_ids=[ self.security.encode_id( history7.id ) ]
+ self.copy_history_item( source_dataset_id=source_dataset_ids,
+ target_history_id=target_history_id,
all_target_history_ids=all_target_history_ids,
deleted_history_ids=deleted_history_ids )
# Switch to the history to which we copied
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/7e31d5c0a42d/
changeset: r5106:7e31d5c0a42d
user: dan
date: 2011-02-22 22:56:11
summary: Allow toolbox tests to upload a file found located in subdirectories. Fix a bug occurring on the determination of uploaded dataset name during the handling of the removal of .gzip or .zip extension from the uploaded filenames within the toolbox test framework.
affected #: 1 file (127 bytes)
--- a/test/functional/test_toolbox.py Tue Feb 22 15:31:57 2011 -0500
+++ b/test/functional/test_toolbox.py Tue Feb 22 16:56:11 2011 -0500
@@ -1,4 +1,5 @@
import sys, new
+import os.path
from galaxy.tools.parameters import grouping
from galaxy.tools.parameters import basic
from base.twilltestcase import TwillTestCase
@@ -58,8 +59,9 @@
if value:
for end in [ '.zip', '.gz' ]:
if value.endswith( end ):
- value = value.rstrip( end )
+ value = value[ :-len( end ) ]
break
+ value = os.path.basename( value ) #if uploading a file in a path other than root of test-data
all_inputs[ name ] = value
# See if we have a grouping.Repeat element
repeat_name = None
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/bcac5cc3ae9f/
changeset: r5105:bcac5cc3ae9f
user: rc
date: 2011-02-22 21:31:57
summary: Adding VCF annotate and intersect tools
affected #: 19 files (144 bytes)
Diff too large to display.
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: guru: Fixed functional tests for the following tools: histogram, estimate indel rates, compute q-values, kernel pca.
by Bitbucket 22 Feb '11
by Bitbucket 22 Feb '11
22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/09682e35aa75/
changeset: r5104:09682e35aa75
user: guru
date: 2011-02-22 18:37:06
summary: Fixed functional tests for the following tools: histogram, estimate indel rates, compute q-values, kernel pca.
affected #: 10 files (509 bytes)
--- a/test-data/indelrates_3way.tabular Tue Feb 22 11:00:03 2011 -0500
+++ b/test-data/indelrates_3way.tabular Tue Feb 22 12:37:06 2011 -0500
@@ -1,15 +1,15 @@
#Block hg18_InsRate panTro2_InsRate canFam2_InsRate hg18_DelRate panTro2_DelRate canFam2_DelRate
-1 0.00e+00 0.00e+00 6.90e-03 0.00e+00 0.00e+00 6.90e-03
-2 0.00e+00 0.00e+00 1.20e-02 0.00e+00 0.00e+00 6.36e-03
+1 0.00e+00 6.90e-03 6.90e-03 0.00e+00 0.00e+00 1.38e-02
+2 0.00e+00 0.00e+00 1.27e-02 7.25e-04 0.00e+00 6.36e-03
3 0.00e+00 0.00e+00 6.21e-03 0.00e+00 0.00e+00 6.21e-03
4 0.00e+00 0.00e+00 2.07e-02 0.00e+00 0.00e+00 5.18e-03
-5 0.00e+00 0.00e+00 1.69e-02 0.00e+00 0.00e+00 8.47e-03
+5 0.00e+00 0.00e+00 2.54e-02 0.00e+00 0.00e+00 1.69e-02
6 0.00e+00 0.00e+00 9.61e-04 0.00e+00 0.00e+00 0.00e+00
7 0.00e+00 0.00e+00 1.97e-02 0.00e+00 0.00e+00 5.62e-03
8 0.00e+00 1.71e-03 1.17e-02 0.00e+00 1.71e-03 6.67e-03
-9 0.00e+00 0.00e+00 1.05e-02 0.00e+00 0.00e+00 1.57e-02
+9 0.00e+00 0.00e+00 1.05e-02 2.72e-03 0.00e+00 1.83e-02
10 0.00e+00 3.26e-03 1.51e-02 0.00e+00 0.00e+00 1.89e-02
-12 1.25e-03 0.00e+00 8.70e-03 0.00e+00 0.00e+00 1.12e-02
-13 0.00e+00 0.00e+00 6.76e-03 0.00e+00 0.00e+00 4.05e-02
-14 0.00e+00 0.00e+00 3.70e-03 0.00e+00 6.13e-04 5.55e-03
+12 1.25e-03 0.00e+00 8.70e-03 0.00e+00 0.00e+00 1.24e-02
+13 0.00e+00 0.00e+00 6.76e-03 0.00e+00 0.00e+00 4.73e-02
+14 0.00e+00 0.00e+00 4.93e-03 1.23e-03 1.23e-03 5.55e-03
15 0.00e+00 0.00e+00 2.29e-02 0.00e+00 0.00e+00 1.38e-02
--- a/test-data/kpca_out3.tabular Tue Feb 22 11:00:03 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,304 +0,0 @@
-#Component 1
-#Eigenvalue 0.3836
-#Principal component vectors 1
-1 -0.1858
-2 -0.1814
-3 -0.1859
-4 -0.1806
-5 -0.1858
-6 -0.1735
-7 -0.1847
-8 -0.1833
-9 -0.1796
-10 -0.1813
-11 -0.1833
-12 -0.1805
-13 -0.182
-14 -0.1853
-15 -0.1845
-16 -0.1704
-17 -0.1833
-18 -0.1849
-19 -0.1757
-20 -0.1817
-21 -0.1772
-22 -0.181
-23 -0.1888
-24 -0.1717
-25 -0.1689
-26 -0.1762
-27 -0.1779
-28 -0.1836
-29 -0.1856
-30 -0.179
-31 -0.1777
-32 -0.1809
-33 -0.1793
-34 -0.1787
-35 -0.1813
-36 -0.187
-37 -0.1875
-38 -0.1813
-39 -0.1832
-40 -0.1833
-41 -0.1867
-42 -0.1641
-43 -0.1859
-44 -0.1743
-45 -0.1659
-46 -0.1805
-47 -0.18
-48 -0.1841
-49 -0.1833
-50 -0.185
-51 0.09424
-52 0.0852
-53 0.1077
-54 0.04757
-55 0.09435
-56 0.08257
-57 0.098
-58 -0.02337
-59 0.08823
-60 0.04166
-61 -0.002438
-62 0.06651
-63 0.03717
-64 0.09682
-65 0.009931
-66 0.07686
-67 0.08726
-68 0.04361
-69 0.08623
-70 0.03213
-71 0.1081
-72 0.04584
-73 0.1083
-74 0.09118
-75 0.0684
-76 0.07783
-77 0.1022
-78 0.1163
-79 0.08795
-80 -0.007513
-81 0.02424
-82 0.012
-83 0.03462
-84 0.1183
-85 0.08726
-86 0.08491
-87 0.09801
-88 0.07569
-89 0.05223
-90 0.04736
-91 0.07326
-92 0.09055
-93 0.04351
-94 -0.02219
-95 0.06216
-96 0.05659
-97 0.06096
-98 0.0684
-99 -0.04782
-100 0.05391
-101 0.1161
-102 0.1221
-103 0.1258
-104 0.1285
-105 0.1265
-106 0.1025
-107 0.09298
-108 0.116
-109 0.1247
-110 0.1087
-111 0.121
-112 0.1262
-113 0.1286
-114 0.1185
-115 0.1218
-116 0.1245
-117 0.128
-118 0.08626
-119 0.08214
-120 0.1082
-121 0.1253
-122 0.1168
-123 0.09795
-124 0.1146
-125 0.1259
-126 0.1232
-127 0.1106
-128 0.1141
-129 0.1287
-130 0.1256
-131 0.1219
-132 0.1007
-133 0.1281
-134 0.1165
-135 0.1219
-136 0.1191
-137 0.1221
-138 0.1274
-139 0.1099
-140 0.1275
-141 0.1254
-142 0.1218
-143 0.1221
-144 0.1227
-145 0.1211
-146 0.1244
-147 0.1179
-148 0.125
-149 0.1229
-150 0.1209
-#Rotated values 1
-1 -10.69
-2 -10.44
-3 -10.7
-4 -10.39
-5 -10.69
-6 -9.981
-7 -10.63
-8 -10.55
-9 -10.34
-10 -10.43
-11 -10.55
-12 -10.39
-13 -10.48
-14 -10.67
-15 -10.62
-16 -9.808
-17 -10.55
-18 -10.64
-19 -10.11
-20 -10.45
-21 -10.2
-22 -10.41
-23 -10.86
-24 -9.88
-25 -9.717
-26 -10.14
-27 -10.24
-28 -10.57
-29 -10.68
-30 -10.3
-31 -10.23
-32 -10.41
-33 -10.32
-34 -10.28
-35 -10.43
-36 -10.76
-37 -10.79
-38 -10.43
-39 -10.54
-40 -10.55
-41 -10.74
-42 -9.445
-43 -10.7
-44 -10.03
-45 -9.547
-46 -10.38
-47 -10.36
-48 -10.6
-49 -10.55
-50 -10.65
-51 5.423
-52 4.903
-53 6.197
-54 2.737
-55 5.43
-56 4.752
-57 5.639
-58 -1.345
-59 5.077
-60 2.397
-61 -0.1403
-62 3.827
-63 2.139
-64 5.572
-65 0.5715
-66 4.423
-67 5.021
-68 2.509
-69 4.962
-70 1.849
-71 6.218
-72 2.638
-73 6.23
-74 5.247
-75 3.936
-76 4.479
-77 5.884
-78 6.695
-79 5.061
-80 -0.4323
-81 1.395
-82 0.6907
-83 1.992
-84 6.805
-85 5.021
-86 4.886
-87 5.64
-88 4.355
-89 3.006
-90 2.725
-91 4.216
-92 5.211
-93 2.504
-94 -1.277
-95 3.577
-96 3.256
-97 3.508
-98 3.936
-99 -2.752
-100 3.102
-101 6.68
-102 7.026
-103 7.239
-104 7.395
-105 7.281
-106 5.899
-107 5.351
-108 6.677
-109 7.175
-110 6.254
-111 6.962
-112 7.265
-113 7.403
-114 6.821
-115 7.008
-116 7.163
-117 7.363
-118 4.964
-119 4.726
-120 6.229
-121 7.212
-122 6.719
-123 5.636
-124 6.595
-125 7.245
-126 7.087
-127 6.364
-128 6.566
-129 7.406
-130 7.23
-131 7.014
-132 5.796
-133 7.369
-134 6.703
-135 7.014
-136 6.852
-137 7.025
-138 7.331
-139 6.323
-140 7.335
-141 7.214
-142 7.008
-143 7.026
-144 7.059
-145 6.971
-146 7.158
-147 6.784
-148 7.191
-149 7.071
-150 6.959
--- a/test-data/q_values.tabular Tue Feb 22 11:00:03 2011 -0500
+++ b/test-data/q_values.tabular Tue Feb 22 12:37:06 2011 -0500
@@ -1,4 +1,4 @@
-pi0: 0.243863648325618
+pi0: 0.243863648325601
FDR level: 0.05
--- a/test/base/twilltestcase.py Tue Feb 22 11:00:03 2011 -0500
+++ b/test/base/twilltestcase.py Tue Feb 22 12:37:06 2011 -0500
@@ -76,7 +76,7 @@
# PDF files contain creation dates, modification dates, ids and descriptions that change with each
# new file, so we need to handle these differences. As long as the rest of the PDF file does
# not differ we're ok.
- valid_diff_strs = [ 'description', 'createdate', 'creationdate', 'moddate', 'id', 'producer', 'creator' ]
+ valid_diff_strs = [ 'description', 'createdate', 'creationdate', 'moddate', 'id', 'producer', 'creator', 'extgstate', 'ais' ]
valid_diff = False
for line in diff_slice:
# Make sure to lower case strings before checking.
--- a/tools/multivariate_stats/kpca.py Tue Feb 22 11:00:03 2011 -0500
+++ b/tools/multivariate_stats/kpca.py Tue Feb 22 12:37:06 2011 -0500
@@ -97,7 +97,7 @@
elif kernel=="anovadot":
pars = r.list(degree=float(options.degree),sigma=float(options.sigma))
else:
- pars = rlist()
+ pars = r.list()
try:
kpc = r.kpca(x=r.na_exclude(dat), kernel=kernel, kpar=pars, features=ncomps)
--- a/tools/multivariate_stats/kpca.xml Tue Feb 22 11:00:03 2011 -0500
+++ b/tools/multivariate_stats/kpca.xml Tue Feb 22 12:37:06 2011 -0500
@@ -110,17 +110,6 @@
<output name="out_file1" file="kpca_out1.tabular"/><output name="out_file2" file="kpca_out2.pdf"/></test>
- <test>
- <param name="input1" value="iris.tabular"/>
- <param name="var_cols" value="2,3,4"/>
- <param name="kernel" value="besseldot"/>
- <param name="features" value="1"/>
- <param name="sigma" value="1"/>
- <param name="order" value="1"/>
- <param name="degree" value="1"/>
- <output name="out_file1" file="kpca_out3.tabular"/>
- <output name="out_file2" file="kpca_out4.pdf"/>
- </test></tests><help>
--- a/tools/plotting/histogram.py Tue Feb 22 11:00:03 2011 -0500
+++ b/tools/plotting/histogram.py Tue Feb 22 12:37:06 2011 -0500
@@ -73,7 +73,7 @@
if skipped_lines < i:
try:
- a = array( matrix )
+ a = r.array( matrix )
r.pdf( out_fname, 8, 8 )
histogram = r.hist( a, probability=not frequency, main=title, xlab=xlab, breaks=breaks )
if density:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

22 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/e323df1a604d/
changeset: r5103:e323df1a604d
user: jgoecks
date: 2011-02-22 17:00:03
summary: Trackster: (a) refactoring back down to a single draw_tile method for FeatureTracks but each track now has a draw_element() method for drawing individual elements; (b) when mode is Auto, enable squish mode when possible to bridge from summary tree to pack.
affected #: 2 files (14.7 KB)
--- a/static/scripts/packed/trackster.js Tue Feb 22 10:38:35 2011 -0500
+++ b/static/scripts/packed/trackster.js Tue Feb 22 11:00:03 2011 -0500
@@ -1,1 +1,1 @@
-CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};CanvasRenderingContext2D.prototype.drawDownwardEquilateralTriangle=function(b,a,e){var d=b-e/2,c=b+e/2,f=a-Math.sqrt(e*3/2);this.beginPath();this.moveTo(d,f);this.lineTo(c,f);this.lineTo(b,a);this.lineTo(d,f);this.strokeStyle=this.fillStyle;this.fill();this.stroke();this.closePath()};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var NO_OVERLAP=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005;function compute_overlap(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=NO_OVERLAP}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=NO_OVERLAP}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a}function is_overlap(b,a){return(compute_overlap(b,a)!=NO_OVERLAP)}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,PACK_SPACING=5,DEFAULT_FONT="9px Monaco, Lucida Console, monospace",DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}var CONTEXT=DUMMY_CANVAS.getContext("2d");CONTEXT.font=DEFAULT_FONT;var CHAR_WIDTH_PX=CONTEXT.measureText("A").width,CHAR_HEIGHT_PX=9;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len-1;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var k=$("<div class='form-row' />").appendTo(a);k.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){k.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var i=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(i);var j=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(i).appendTo(k).bind("click",function(l){i.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){i.hide();$(document).unbind("click.color-picker")});l.stopPropagation()})}else{k.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(converted_datasets_state_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b.status==="data"){if(b.valid_chroms){a.valid_chroms=b.valid_chroms;a.name_div.data("menu_options")["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+a.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,j=g-m,c=this.view.container.width(),f=this.view.resolution;var p=$("<div style='position: relative;'></div>"),r=c/j;this.content_div.append(p);this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=0;while((a*DENSITY*f)<g){var n=c+"_"+r+"_"+a;var e=this.tile_cache.get(n);var k=a*DENSITY*this.view.resolution;var q=k+DENSITY*this.view.resolution;if(!b&&e){this.show_tile(e,p,k,r)}else{this.delayed_draw(b,n,k,q,a,f,p,r)}a+=1}var d=this;var o=setInterval(function(){if(l===0){var u=d.content_div.children();var t=false;for(var v=u.length-1,s=0;v>=s;v--){var x=$(u[v]);if(t){x.remove()}else{if(x.children().length!==0){t=true}}}for(var w=0;w<d.filters.length;w++){d.filters[w].update_ui_elt()}clearInterval(o)}},50);for(var h=0;h<this.child_tracks.length;h++){this.child_tracks[h].draw(b)}},delayed_draw:function(b,g,f,i,c,e,h,j){var d=this;var a=setTimeout(function(){if(f<=d.view.high&&i>=d.view.low){var k;if(!b){k=d.tile_cache.get(g)}if(!k){k=d.draw_tile(e,c,h,j);if(k){var l=$("<div class='track-tile'>").prepend(k);if(k.hasClass(FILTERABLE_CLASS)){l.addClass(FILTERABLE_CLASS)}k=l}}if(k){d.tile_cache.set(g,k);d.show_tile(k,h,f,j)}}},50)},show_tile:function(a,f,d,g){var b=this;var c=this.view.high-this.view.low,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.view.container.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>CHAR_WIDTH_PX){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font=DEFAULT_FONT;this.inc_slots={};this.data_queue={};this.start_end_dct={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,j,d,q){var r=this.inc_slots[a];if(!r||(r.mode!==q)){r={};r.w_scale=a;r.mode=q;this.inc_slots[a]=r;this.start_end_dct[a]={}}var m=r.w_scale,x=[],y=[],k=0,o=this.view.max_low;for(var v=0,w=j.length;v<w;v++){var h=j[v],l=h[0];if(r[l]!==undefined){k=Math.max(k,r[l]);y.push(r[l])}else{x.push(v)}}var e=this.start_end_dct[a];var n=function(D,E){for(var C=0;C<=MAX_FEATURE_DEPTH;C++){var A=false,F=e[C];if(F!==undefined){for(var z=0,B=F.length;z<B;z++){var i=F[z];if(E>i[0]&&D<i[1]){A=true;break}}}if(!A){return C}}return -1};for(var v=0,w=x.length;v<w;v++){var h=j[x[v]],l=h[0],t=h[1],b=h[2],p=h[3],c=Math.floor((t-o)*m),g=Math.ceil((b-o)*m),u=CONTEXT.measureText(p).width,f;if(p!==undefined&&!d){u+=(LABEL_SPACING+PACK_SPACING);if(c-u>=0){c-=u;f="left"}else{g+=u;f="right"}}var s=n(c,g);if(s>=0){if(e[s]===undefined){e[s]=[]}e[s].push([c,g]);r[l]=s;k=Math.max(k,s)}else{}}return k},rect_or_text:function(v,n,z,d,u,l,h,g){v.textAlign="center";var b=[z,d],q=0,w=0,t=Math.round(n/2);var E=[];for(var o=0,y=l.length;o<y;o++){var m=l[o],e="MIDNSHP=X"[m[0]],p=m[1];if(e==="H"||e==="S"){q-=p}var j=u+q,D=Math.floor(Math.max(0,(j-z)*n)),k=Math.floor(Math.max(0,(j+p-z)*n));switch(e){case"H":break;case"S":case"M":case"=":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var s=h.slice(w,w+p);if((this.mode==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){v.fillStyle=this.prefs.block_color;v.fillRect(D+this.left_offset,g+1,k-D,9);v.fillStyle=CONNECTOR_COLOR;for(var B=0,a=s.length;B<a;B++){if(j+B>=z&&j+B<=d){var C=Math.floor(Math.max(0,(j+B-z)*n));v.fillText(s[B],C+this.left_offset+t,g+9)}}}else{v.fillStyle=this.prefs.block_color;v.fillRect(D+this.left_offset,g+(this.mode!="Dense"?4:5),k-D,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}w+=p;q+=p;break;case"N":v.fillStyle=CONNECTOR_COLOR;v.fillRect(D+this.left_offset,g+5,k-D,1);q+=p;break;case"D":v.fillStyle="red";v.fillRect(D+this.left_offset,g+4,k-D,3);q+=p;break;case"P":break;case"I":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var s=h.slice(w,w+p);var f=this.left_offset+D-(k-D)/2;if((this.mode==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){v.fillStyle="yellow";v.fillRect(f,g-9,k-D,9);E[E.length]=[f+(k-D)/2,g+4,5];v.fillStyle=CONNECTOR_COLOR;switch(r){case (OVERLAP_START):s=s.slice(z-j);break;case (OVERLAP_END):s=s.slice(0,j-d);break;case (CONTAINED_BY):break;case (CONTAINS):s=s.slice(z-j,j-d);break}for(var B=0,a=s.length;B<a;B++){var C=Math.floor(Math.max(0,(j+B-z)*n));v.fillText(s[B],C+this.left_offset+t-(k-D)/2,g)}}else{v.fillStyle="yellow";v.fillRect(f,g+(this.mode!="Dense"?2:5),k-D,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}w+=p;break;case"X":w+=p;break}}var A;for(var x=0;x<E.length;x++){A=E[x];v.fillStyle="yellow";v.drawDownwardEquilateralTriangle(A[0],A[1],A[2])}},draw_tile:function(ae,m,q,au){var K=m*DENSITY*ae,aj=(m+1)*DENSITY*ae,J=aj-K;var G=this.data_cache.get_data(K,aj,this.mode);if(G===undefined||G==="pending"||(this.mode!=="Auto"&&G.dataset_type==="summary_tree")){this.data_queue[[K,aj]]=true;this.get_data(K,aj);return}var a=Math.ceil(J*au),ag=this.prefs.label_color,g=this.prefs.block_color,p=this.mode,u=25,aa,V=this.left_offset,at,B,av;var o=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(o)}o=$(o);if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(p==="Dense"){B=u;av=DENSE_TRACK_HEIGHT}else{if(p==="Squish"){av=SQUISH_TRACK_HEIGHT;aa=true}else{if(p==="Pack"){av=PACK_TRACK_HEIGHT;aa=false}else{if(G.extra_info==="no_detail"){av=(G.track_type==="bai"?SQUISH_TRACK_HEIGHT:NO_DETAIL_TRACK_HEIGHT);aa=true}else{av=PACK_TRACK_HEIGHT;aa=false}}}B=this.incremental_slots(au,G.data,aa,p)*av+u;at=this.inc_slots[au]}}o.get(0).width=a+V;o.get(0).height=B;if(G.dataset_type=="summary_tree"){o.get(0).height+=LABEL_SPACING+CHAR_HEIGHT_PX}q.parent().css("height",Math.max(this.height_px,B)+"px");var H=o.get(0).getContext("2d");H.fillStyle=g;H.font=this.default_font;H.textAlign="right";this.container_div.find(".yaxislabel").remove();if(G.dataset_type=="summary_tree"){var v=B+LABEL_SPACING+CHAR_HEIGHT_PX;points=G.data,max=G.max,delta_x_px=Math.ceil(G.delta*au);var n=$("<div />").addClass("yaxislabel");n.text(max);n.css({position:"absolute",top:"22px",left:"10px"});n.prependTo(this.container_div);for(var an=0,F=points.length;an<F;an++){var Z=Math.floor((points[an][0]-K)*au);var Y=points[an][1];if(!Y){continue}var ak=Y/max*B;H.fillStyle="black";H.fillRect(Z+V,v-ak,delta_x_px,ak);var X=4;if(this.prefs.show_counts&&(H.measureText(Y).width+X)<delta_x_px){H.fillStyle="#666";H.textAlign="center";H.fillText(Y,Z+V+(delta_x_px/2),10)}}return o}if(G.message){o.css({"border-color":"red"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+V,av);if(!G.data){return o}}for(var aq=0;aq<this.filters.length;aq++){if(G.data.length&&this.filters[aq].applies_to(G.data[0])){o.addClass(FILTERABLE_CLASS);break}}var ar=G.data;var am=0;for(var an=0,F=ar.length;an<F;an++){var R=ar[an],O=R[0],ap=R[1],ac=R[2],L=R[3];if(this.mode!="Dense"&&at[O]===undefined){continue}var ab=false;var T;for(var aq=0;aq<this.filters.length;aq++){T=this.filters[aq];T.update_attrs(R);if(!T.keep(R)){ab=true;break}}if(ab){continue}if(ap<=aj&&ac>=K){if(G.dataset_type=="interval_index"){ac-=1}var ad=Math.floor(Math.max(0,(ap-K)*au)),I=Math.ceil(Math.min(a,Math.max(0,(ac-K)*au))),W=(p==="Dense"?1:(1+at[O]))*av;var E,ah,M=null,aw=null;if(G.dataset_type==="bai"){H.fillStyle=g;if(R[5] instanceof Array){var C=Math.floor(Math.max(0,(R[4][0]-K)*au)),N=Math.ceil(Math.min(a,Math.max(0,(R[4][1]-K)*au))),A=Math.floor(Math.max(0,(R[5][0]-K)*au)),t=Math.ceil(Math.min(a,Math.max(0,(R[5][1]-K)*au)));if(R[4][1]>=K&&R[4][0]<=aj&&R[4][2]){this.rect_or_text(H,au,K,aj,R[4][0],R[4][2],R[4][3],W)}if(R[5][1]>=K&&R[5][0]<=aj&&R[5][2]){this.rect_or_text(H,au,K,aj,R[5][0],R[5][2],R[5][3],W)}if(A>N){H.fillStyle=CONNECTOR_COLOR;H.dashedLine(N+V,W+5,V+A,W+5)}}else{H.fillStyle=g;this.rect_or_text(H,au,K,aj,ap,R[4],R[5],W)}if(p!=="Dense"&&!aa&&ap>K){H.fillStyle=this.prefs.label_color;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}else{if(G.dataset_type==="interval_index"){if(p=="Auto"){if(R.length<=4){p="Squish"}else{p="Pack"}}if(p=="Dense"){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{if(R.length<=4){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{var D=R[5],U=R[6],af=R[7],e=R[8];if(U&&af){M=Math.floor(Math.max(0,(U-K)*au));aw=Math.ceil(Math.min(a,Math.max(0,(af-K)*au)))}var ao,P;if(p=="Squish"){ao=1;P=SQUISH_FEATURE_HEIGHT}else{ao=5;P=PACK_FEATURE_HEIGHT}if(!e){if(R.strand){if(R.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(R.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}}else{H.fillStyle=CONNECTOR_COLOR}H.fillRect(ad+V,W+(P-ao)/2+1,I-ad,P)}else{var z,Q;if(p=="Squish"){H.fillStyle=CONNECTOR_COLOR;z=W+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}else{if(D){var z=W;var Q=P;if(D=="+"){H.fillStyle=RIGHT_STRAND}else{if(D=="-"){H.fillStyle=LEFT_STRAND}}}else{H.fillStyle=CONNECTOR_COLOR;z+=(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}}H.fillRect(ad+V,z,I-ad,Q);for(var al=0,d=e.length;al<d;al++){var s=e[al],c=Math.floor(Math.max(0,(s[0]-K)*au)),S=Math.ceil(Math.min(a,Math.max((s[1]-K)*au)));if(c>S){continue}H.fillStyle=g;H.fillRect(c+V,W+(P-ao)/2+1,S-c,ao);if(M!==undefined&&!(c>aw||S<M)){var ai=Math.max(c,M),w=Math.min(S,aw-1);H.fillRect(ai+V,W+1,w-ai,P)}}}if(p=="Pack"&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}}}else{if(G.dataset_type==="vcf"){if(aa){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,1)}else{var r=R[4],l=R[5],b=R[6];E=9;ah=1;H.fillRect(ad+V,W,I-ad,E);if(p!=="Dense"&&L!==undefined&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+2+V,W+8)}else{H.textAlign="right";H.fillText(L,ad-2+V,W+8)}H.fillStyle=g}var h=r+" / "+l;if(ap>K&&H.measureText(h).width<(I-ad)){H.fillStyle="white";H.textAlign="center";H.fillText(h,V+ad+(I-ad)/2,W+8);H.fillStyle=g}}}}}am++}}return o}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
+CanvasRenderingContext2D.prototype.dashedLine=function(c,j,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-j;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var l=e/g;var k=d/g;for(var a=0;a<g;a++,c+=l,j+=k){if(a%2!=0){continue}this.fillRect(c,j,f,1)}};CanvasRenderingContext2D.prototype.drawDownwardEquilateralTriangle=function(b,a,e){var d=b-e/2,c=b+e/2,f=a-Math.sqrt(e*3/2);this.beginPath();this.moveTo(d,f);this.lineTo(c,f);this.lineTo(b,a);this.lineTo(d,f);this.strokeStyle=this.fillStyle;this.fill();this.stroke();this.closePath()};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var NO_OVERLAP=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005;function compute_overlap(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=NO_OVERLAP}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=NO_OVERLAP}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a}function is_overlap(b,a){return(compute_overlap(b,a)!=NO_OVERLAP)}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,PACK_SPACING=5,MIN_SQUISH_VIEW_WIDTH=12000,DEFAULT_FONT="9px Monaco, Lucida Console, monospace",DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}var CONTEXT=DUMMY_CANVAS.getContext("2d");CONTEXT.font=DEFAULT_FONT;var CHAR_WIDTH_PX=CONTEXT.measureText("A").width,CHAR_HEIGHT_PX=9;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var j=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(j/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,k){var f=$(this);var l=k.offsetX-k.current_x;var g=f.scrollTop()-(h.clientY-k.current_height);f.scrollTop(g);k.current_height=h.clientY;k.current_x=k.offsetX;var j=Math.round(l/a.viewport_container.width()*(a.high-a.low));a.move_delta(j)}).bind("mousewheel",function(h,k,g,f){if(g){var j=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(j)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(k,l){$(l.proxy).css({left:Math.min(k.pageX,l.startX),width:Math.abs(k.pageX-l.startX)});var g=Math.min(k.pageX,l.startX)-a.container.offset().left,f=Math.max(k.pageX,l.startX)-a.container.offset().left,j=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*j)+a.low,Math.round(f/h*j)+a.low)}).bind("dragend",function(l,m){var g=Math.min(l.pageX,m.startX),f=Math.max(l.pageX,m.startX),j=(a.high-a.low),h=a.viewport_container.width(),k=a.low;a.low=Math.round(g/h*j)+k;a.high=Math.round(f/h*j)+k;$(m.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len-1;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var k=this,a,d,b=f.split(":"),h=b[0],j=b[1];if(j!==undefined){try{var g=j.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}k.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var l=$("<div class='form-row' />").appendTo(a);l.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){l.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var j=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(j);var k=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(j).appendTo(l).bind("click",function(m){j.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){j.hide();$(document).unbind("click.color-picker")});m.stopPropagation()})}else{l.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(converted_datasets_state_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b.status==="data"){if(b.valid_chroms){a.valid_chroms=b.valid_chroms;a.name_div.data("menu_options")["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+a.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(u){u.stopPropagation()}).bind("dblclick",function(u){u.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(x,A){var w=$("<tr>").appendTo(t);var z=$("<th class='filter-info'>").appendTo(w);var v=$("<span class='name'>").appendTo(z);v.text(A.name+" ");var u=$("<span class='values'>").appendTo(z);var y=$("<td>").appendTo(w);A.control_element=$("<div id='"+A.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(y);A.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(C,D){var B=D.values;u.text("["+B[0]+"-"+B[1]+"]");A.low=B[0];A.high=B[1];o.draw(true)},change:function(B,C){A.control_element.slider("option","slide").call(A.control_element,B,C)}});A.slider=A.control_element;A.slider_label=u});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(u){u.stopPropagation()}).bind("click",function(u){u.stopPropagation()}).bind("dblclick",function(u){u.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(B,w){var z=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var y=$("<div>").addClass("slider-label").appendTo(z);var D=$("<span class='param-name'>").text(w.label+" ").appendTo(y);var x=$("<span/>").text(w.value);var A=$("<span class='param-value'>").appendTo(y).append("[").append(x).append("]");var C=$("<div/>").addClass("slider").appendTo(z);var u=$("<div id='"+w.name+"-param-control'>").appendTo(C);var v=(w.max<=1?0.01:(w.max<=1000?1:5));u.slider({min:w.min,max:w.max,step:v,value:w.value,slide:function(E,G){var F=G.value;w.value=F;if(0<F&&F<1){F=parseFloat(F).toFixed(2)}x.text(F)},change:function(E,F){w.value=F.value}});A.click(function(){var G=x,F=G.text(),E=(w.max<=1?4:w.max.length);G.text("");$("<input type='text'/>").attr("size",E).attr("maxlength",E).attr("value",F).appendTo(G).focus().select().click(function(H){H.stopPropagation()}).blur(function(){$(this).remove();G.text(F)}).keyup(function(J){if(J.keyCode===27){$(this).trigger("blur")}else{if(J.keyCode===13){var H=$(this),I=parseFloat(H.val());if(isNaN(I)||I>w.max||I<w.min){alert("Parameter value must be in the range ["+w.min+"-"+w.max+"]");return $(this)}G.text(I);u.slider("value",I);w.value=I}}})});$("<div style='clear: both;'/>").appendTo(z)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=(o.track_config&&o.track_config.values.mode?o.track_config.values.mode:o.display_modes[0]);o.mode=m;o.mode_div.text(m);var a=function(u){o.mode_div.text(u);o.mode=u;o.track_config.values.mode=u;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(u){return function(){a(u)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var w=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},v=function(x){if((x.keyCode||x.which)===27){w()}else{if((x.keyCode||x.which)===13){u()}}};$(window).bind("keypress.check_enter_esc",v);show_modal("Configure Track",o.track_config.build_form(),{Cancel:w,OK:u})};if(o.filters.length>0){h["Show filters"]=function(){var u;if(!o.filtering_div.is(":visible")){u="Hide filters";o.filters_visible=true}else{u="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var u;if(!o.dynamic_tool_div.is(":visible")){u="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{u="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,j=g-m,c=this.view.container.width(),f=this.view.resolution;var p=$("<div style='position: relative;'></div>"),r=c/j;this.content_div.append(p);this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=0;while((a*DENSITY*f)<g){var n=c+"_"+r+"_"+a;var e=this.tile_cache.get(n);var k=a*DENSITY*this.view.resolution;var q=k+DENSITY*this.view.resolution;if(!b&&e){this.show_tile(e,p,k,r)}else{this.delayed_draw(b,n,k,q,a,f,p,r)}a+=1}var d=this;var o=setInterval(function(){if(l===0){var u=d.content_div.children();var t=false;for(var v=u.length-1,s=0;v>=s;v--){var x=$(u[v]);if(t){x.remove()}else{if(x.children().length!==0){t=true}}}for(var w=0;w<d.filters.length;w++){d.filters[w].update_ui_elt()}clearInterval(o)}},50);for(var h=0;h<this.child_tracks.length;h++){this.child_tracks[h].draw(b)}},delayed_draw:function(b,g,f,j,c,e,h,k){var d=this;var a=setTimeout(function(){if(f<=d.view.high&&j>=d.view.low){var l;if(!b){l=d.tile_cache.get(g)}if(!l){l=d.draw_tile(e,c,h,k);if(l){var m=$("<div class='track-tile'>").prepend(l);if(l.hasClass(FILTERABLE_CLASS)){m.addClass(FILTERABLE_CLASS)}l=m}}if(l){d.tile_cache.set(g,l);d.show_tile(l,h,f,k)}}},50)},show_tile:function(a,f,d,g){var b=this;var c=this.view.high-this.view.low,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.view.container.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,l,p){var g=b*DENSITY*f,d=DENSITY*f,k=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var o=e.get(0).getContext("2d");if(p>CHAR_WIDTH_PX){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;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(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var k=false;var j=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){k=true;h.show()},function(){k=false;if(!j){h.hide()}});h.hide().bind("dragstart",function(l,m){j=true;m.original_height=$(g.content_div).height()}).bind("drag",function(m,n){var l=Math.min(Math.max(n.original_height+n.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",l);g.height_px=l;g.draw(true)}).bind("dragend",function(l,m){g.tile_cache.clear();j=false;if(!k){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,j,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true},{key:"mode",type:"string",default_value:this.mode,hidden:true},],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=j;this.original_dataset_id=j;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font=DEFAULT_FONT;this.inc_slots={};this.data_queue={};this.start_end_dct={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,p){var q=this.inc_slots[a];if(!q||(q.mode!==p)){q={};q.w_scale=a;q.mode=p;this.inc_slots[a]=q;this.start_end_dct[a]={}}var l=q.w_scale,w=[],x=[],j=0,n=this.view.max_low;for(var u=0,v=h.length;u<v;u++){var g=h[u],k=g[0];if(q[k]!==undefined){j=Math.max(j,q[k]);x.push(q[k])}else{w.push(u)}}var d=this.start_end_dct[a];var m=function(D,E){for(var C=0;C<=MAX_FEATURE_DEPTH;C++){var A=false,F=d[C];if(F!==undefined){for(var z=0,B=F.length;z<B;z++){var y=F[z];if(E>y[0]&&D<y[1]){A=true;break}}}if(!A){return C}}return -1};for(var u=0,v=w.length;u<v;u++){var g=h[w[u]],k=g[0],s=g[1],b=g[2],o=g[3],c=Math.floor((s-n)*l),f=Math.ceil((b-n)*l),t=CONTEXT.measureText(o).width,e;if(o!==undefined&&p==="Pack"){t+=(LABEL_SPACING+PACK_SPACING);if(c-t>=0){c-=t;e="left"}else{f+=t;e="right"}}var r=m(c,f);if(r>=0){if(d[r]===undefined){d[r]=[]}d[r].push([c,f]);q[k]=r;j=Math.max(j,r)}else{}}return j},draw_summary_tree:function(b,o,n,l,r,j,f,e){var c=j+LABEL_SPACING+CHAR_HEIGHT_PX;delta_x_px=Math.ceil(n*r);var h=$("<div />").addClass("yaxislabel");h.text(l);h.css({position:"absolute",top:"22px",left:"10px"});h.prependTo(this.container_div);var q=b.get(0).getContext("2d");for(var d=0,g=o.length;d<g;d++){var m=Math.floor((o[d][0]-f)*r);var k=o[d][1];if(!k){continue}var p=k/l*j;q.fillStyle="black";q.fillRect(m+e,c-p,delta_x_px,p);var a=4;if(this.prefs.show_counts&&(q.measureText(k).width+a)<delta_x_px){q.fillStyle="#666";q.textAlign="center";q.fillText(k,m+e+(delta_x_px/2),10)}}},draw_element:function(p,f,g,x,j,r,I,M,N,a,A){var u=x[0],K=x[1],C=x[2],s=x[3],D=Math.floor(Math.max(0,(K-r)*M)),q=Math.ceil(Math.min(a,Math.max(0,(C-r)*M))),B=(g==="Dense"?1:(1+j))*N,o,G,t=null,O=null,d=this.prefs.block_color,F=this.prefs.label_color;if(g==="Dense"){p.fillStyle=d;p.fillRect(D+A,B+5,q-D,DENSE_FEATURE_HEIGHT)}else{if(g==="no_detail"){p.fillStyle=d;p.fillRect(D+A,B+5,q-D,DENSE_FEATURE_HEIGHT)}else{var n=x[5],z=x[6],E=x[7],e=x[8];if(z&&E){t=Math.floor(Math.max(0,(z-r)*M));O=Math.ceil(Math.min(a,Math.max(0,(E-r)*M)))}var L,v;if(g=="Squish"){L=1;v=SQUISH_FEATURE_HEIGHT}else{L=5;v=PACK_FEATURE_HEIGHT}if(!e){if(x.strand){if(x.strand=="+"){p.fillStyle=RIGHT_STRAND_INV}else{if(x.strand=="-"){p.fillStyle=LEFT_STRAND_INV}}}else{p.fillStyle=CONNECTOR_COLOR}p.fillRect(D+A,B+(v-L)/2+1,q-D,v)}else{var m,w;if(g=="Squish"){p.fillStyle=CONNECTOR_COLOR;m=B+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;w=1}else{if(n){var m=B;var w=v;if(n=="+"){p.fillStyle=RIGHT_STRAND}else{if(n=="-"){p.fillStyle=LEFT_STRAND}}}else{p.fillStyle=CONNECTOR_COLOR;m+=(SQUISH_FEATURE_HEIGHT/2)+1;w=1}}p.fillRect(D+A,m,q-D,w);for(var J=0,c=e.length;J<c;J++){var h=e[J],b=Math.floor(Math.max(0,(h[0]-r)*M)),y=Math.ceil(Math.min(a,Math.max((h[1]-r)*M)));if(b>y){continue}p.fillStyle=d;p.fillRect(b+A,B+(v-L)/2+1,y-b,L);if(t!==undefined&&!(b>O||y<t)){var H=Math.max(b,t),l=Math.min(y,O-1);p.fillRect(H+A,B+1,l-H,v)}}}if(g==="Pack"&&K>r){p.fillStyle=F;if(f===0&&D-p.measureText(s).width<0){p.textAlign="left";p.fillText(s,q+A+LABEL_SPACING,B+8)}else{p.textAlign="right";p.fillText(s,D+A-LABEL_SPACING,B+8)}p.fillStyle=d}}}},draw_tile:function(u,z,j,l){var B=z*DENSITY*u,a=(z+1)*DENSITY*u,p=a-B;var n=this.data_cache.get_data(B,a,this.mode);if(n===undefined||n==="pending"||(this.mode!=="Auto"&&n.dataset_type==="summary_tree")){this.data_queue[[B,a]]=true;this.get_data(B,a);return}var s=Math.ceil(p*l),q=this.mode,D=25,e=this.left_offset,o,g,v;var c=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(c)}c=$(c);if(q==="Auto"){if(n.dataset_type==="summary_tree"){q=n.dataset_type}else{if(n.extra_info==="no_detail"){q="no_detail"}else{var C=n.data;if((C.length&&C.length<4)||(this.view.high-this.view.low>MIN_SQUISH_VIEW_WIDTH)){q="Squish"}else{q="Pack"}}}}if(q==="summary_tree"){g=this.summary_draw_height}if(q==="Dense"){g=D;v=DENSE_TRACK_HEIGHT}else{if(q==="no_detail"){v=NO_DETAIL_TRACK_HEIGHT}else{if(q==="Squish"){v=SQUISH_TRACK_HEIGHT}else{v=PACK_TRACK_HEIGHT}}}if(q==="no_detail"||q==="Squish"||q==="Pack"){g=this.incremental_slots(l,n.data,q)*v+D;o=this.inc_slots[l]}c.get(0).width=s+e;c.get(0).height=g;if(n.dataset_type=="summary_tree"){c.get(0).height+=LABEL_SPACING+CHAR_HEIGHT_PX}j.parent().css("height",Math.max(this.height_px,g)+"px");var t=c.get(0).getContext("2d");t.fillStyle=this.prefs.block_color;t.font=this.default_font;t.textAlign="right";this.container_div.find(".yaxislabel").remove();if(q==="summary_tree"){this.draw_summary_tree(c,n.data,n.delta,n.max,l,g,B,e);return c}if(n.message){c.css({"border-color":"red"});t.fillStyle="red";t.textAlign="left";t.fillText(n.message,100+e,v);if(!n.data){return c}}for(var A=0;A<this.filters.length;A++){if(n.data.length&&this.filters[A].applies_to(n.data[0])){c.addClass(FILTERABLE_CLASS);break}}var C=n.data;for(var w=0,y=C.length;w<y;w++){var h=C[w],k=h[0],r=h[1],b=h[2],d=(o&&o[k]!==undefined?o[k]:null);var x=false;var m;for(var A=0;A<this.filters.length;A++){m=this.filters[A];m.update_attrs(h);if(!m.keep(h)){x=true;break}}if(x){continue}if(is_overlap([r,b],[B,a])&&d!==null){this.draw_element(t,z,q,h,d,B,a,l,v,s,e)}}return c}});var VcfTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="VcfTrack"};$.extend(VcfTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{draw_element:function(u,p,j,e,x,c,m,v,s){var j=data[i],l=j[0],t=j[1],d=j[2]-1,o=j[3],g=Math.floor(Math.max(0,(t-x)*m)),k=Math.ceil(Math.min(s,Math.max(0,(d-x)*m))),f=(p==="Dense"?1:(1+e))*v,a,y,b=null,n=null;if(no_label){u.fillStyle=block_color;u.fillRect(g+left_offset,f+5,k-g,1)}else{var w=j[4],r=j[5],h=j[6];a=9;y=1;u.fillRect(g+left_offset,f,k-g,a);if(p!=="Dense"&&o!==undefined&&t>x){u.fillStyle=label_color;if(tile_index===0&&g-u.measureText(o).width<0){u.textAlign="left";u.fillText(o,k+2+left_offset,f+8)}else{u.textAlign="right";u.fillText(o,g-2+left_offset,f+8)}u.fillStyle=block_color}var q=w+" / "+r;if(t>x&&u.measureText(q).width<(k-g)){u.fillStyle="white";u.textAlign="center";u.fillText(q,left_offset+g+(k-g)/2,f+8);u.fillStyle=block_color}}}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{draw_read:function(w,s,n,A,d,v,l,h,g){w.textAlign="center";var b=[A,d],q=0,x=0,u=Math.round(n/2);var F=[];for(var o=0,z=l.length;o<z;o++){var m=l[o],e="MIDNSHP=X"[m[0]],p=m[1];if(e==="H"||e==="S"){q-=p}var j=v+q,E=Math.floor(Math.max(0,(j-A)*n)),k=Math.floor(Math.max(0,(j+p-A)*n));switch(e){case"H":break;case"S":case"M":case"=":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var t=h.slice(x,x+p);if((s==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){w.fillStyle=this.prefs.block_color;w.fillRect(E+this.left_offset,g+1,k-E,9);w.fillStyle=CONNECTOR_COLOR;for(var C=0,a=t.length;C<a;C++){if(j+C>=A&&j+C<=d){var D=Math.floor(Math.max(0,(j+C-A)*n));w.fillText(t[C],D+this.left_offset+u,g+9)}}}else{w.fillStyle=this.prefs.block_color;w.fillRect(E+this.left_offset,g+(this.mode!="Dense"?4:5),k-E,(s!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}x+=p;q+=p;break;case"N":w.fillStyle=CONNECTOR_COLOR;w.fillRect(E+this.left_offset,g+5,k-E,1);q+=p;break;case"D":w.fillStyle="red";w.fillRect(E+this.left_offset,g+4,k-E,3);q+=p;break;case"P":break;case"I":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var t=h.slice(x,x+p);var f=this.left_offset+E-(k-E)/2;if((s==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){w.fillStyle="yellow";w.fillRect(f,g-9,k-E,9);F[F.length]=[f+(k-E)/2,g+4,5];w.fillStyle=CONNECTOR_COLOR;switch(r){case (OVERLAP_START):t=t.slice(A-j);break;case (OVERLAP_END):t=t.slice(0,j-d);break;case (CONTAINED_BY):break;case (CONTAINS):t=t.slice(A-j,j-d);break}for(var C=0,a=t.length;C<a;C++){var D=Math.floor(Math.max(0,(j+C-A)*n));w.fillText(t[C],D+this.left_offset+u-(k-E)/2,g)}}else{w.fillStyle="yellow";w.fillRect(f,g+(this.mode!="Dense"?2:5),k-E,(s!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}x+=p;break;case"X":x+=p;break}}var B;for(var y=0;y<F.length;y++){B=F[y];w.fillStyle="yellow";w.drawDownwardEquilateralTriangle(B[0],B[1],B[2])}},draw_element:function(u,w,q,h,d,y,b,m,v,s,e){var l=h[0],t=h[1],c=h[2],n=h[3],g=Math.floor(Math.max(0,(t-y)*m)),j=Math.ceil(Math.min(s,Math.max(0,(c-y)*m))),f=(q==="Dense"?1:(1+d))*v,x=this.prefs.block_color,k=this.prefs.label_color;u.fillStyle=x;if(h[5] instanceof Array){var r=Math.floor(Math.max(0,(h[4][0]-y)*m)),p=Math.ceil(Math.min(s,Math.max(0,(h[4][1]-y)*m))),o=Math.floor(Math.max(0,(h[5][0]-y)*m)),a=Math.ceil(Math.min(s,Math.max(0,(h[5][1]-y)*m)));if(h[4][1]>=y&&h[4][0]<=b&&h[4][2]){this.draw_read(u,q,m,y,b,h[4][0],h[4][2],h[4][3],f)}if(h[5][1]>=y&&h[5][0]<=b&&h[5][2]){this.draw_read(u,q,m,y,b,h[5][0],h[5][2],h[5][3],f)}if(o>p){u.fillStyle=CONNECTOR_COLOR;u.dashedLine(p+e,f+5,e+o,f+5)}}else{u.fillStyle=x;this.draw_read(u,q,m,y,b,t,h[4],h[5],f)}if(q==="Pack"&&t>y){u.fillStyle=this.prefs.label_color;if(w===0&&g-u.measureText(n).width<0){u.textAlign="left";u.fillText(n,j+e+LABEL_SPACING,f+8)}else{u.textAlign="right";u.fillText(n,g+e-LABEL_SPACING,f+8)}u.fillStyle=x}}});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
--- a/static/scripts/trackster.js Tue Feb 22 10:38:35 2011 -0500
+++ b/static/scripts/trackster.js Tue Feb 22 11:00:03 2011 -0500
@@ -134,6 +134,8 @@
PACK_FEATURE_HEIGHT = 9,
LABEL_SPACING = 2,
PACK_SPACING = 5,
+ // Minimum width for window for squish to be used.
+ MIN_SQUISH_VIEW_WIDTH = 12000,
// Other constants.
DEFAULT_FONT = "9px Monaco, Lucida Console, monospace",
@@ -2120,7 +2122,7 @@
// with keys 'slot' and 'text'.
// Returns the number of slots used to pack features.
//
- incremental_slots: function(level, features, no_label, mode) {
+ incremental_slots: function(level, features, mode) {
//
// Get/create incremental slots for level. If display mode changed,
// need to create new slots.
@@ -2200,7 +2202,7 @@
// Update start, end drawing locations to include feature name.
// Try to put the name on the left, if not, put on right.
- if (feature_name !== undefined && !no_label) {
+ if (feature_name !== undefined && mode === "Pack") {
// Add gap for label spacing and extra pack space padding
text_len += (LABEL_SPACING + PACK_SPACING);
if (f_start - text_len >= 0) {
@@ -2248,7 +2250,7 @@
else {
// TODO: remove this warning when skipped features are handled.
// Show warning for skipped feature.
- // console.log("WARNING: not displaying feature"); // , feature_uid, f_start, f_end);
+ //console.log("WARNING: not displaying feature", feature_uid, f_start, f_end);
}
}
@@ -2267,6 +2269,180 @@
return highest_slot;
},
/**
+ * Draw summary tree on canvas.
+ */
+ draw_summary_tree: function(canvas, points, delta, max, w_scale, required_height, tile_low, left_offset) {
+ var
+ // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
+ // start. However, height of each rectangle is relative to required_height; hence, the
+ // max rectangle is required_height.
+ base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
+ delta_x_px = Math.ceil(delta * w_scale);
+
+ var max_label = $("<div />").addClass('yaxislabel');
+ max_label.text(max);
+
+ max_label.css({ position: "absolute", top: "22px", left: "10px" });
+ max_label.prependTo(this.container_div);
+
+ var ctx = canvas.get(0).getContext("2d");
+ 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; }
+ var y_px = y / max * required_height;
+
+ ctx.fillStyle = "black";
+ ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
+
+ // Draw number count if it can fit the number with some padding, otherwise things clump up
+ var text_padding_req_x = 4;
+ if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
+ ctx.fillStyle = "#666";
+ ctx.textAlign = "center";
+ ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
+ }
+ }
+ },
+ /**
+ * Draw feature.
+ */
+ draw_element: function(ctx, tile_index, mode, feature, slot, tile_low, tile_high, w_scale, y_scale, width, left_offset) {
+ var
+ feature_uid = feature[0],
+ feature_start = feature[1],
+ feature_end = feature[2],
+ feature_name = feature[3],
+ f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
+ y_center = (mode === "Dense" ? 1 : (1 + slot)) * y_scale,
+ thickness, y_start, thick_start = null, thick_end = null,
+ block_color = this.prefs.block_color,
+ label_color = this.prefs.label_color;
+
+ // Dense mode displays the same for all data.
+ if (mode === "Dense") {
+ ctx.fillStyle = block_color;
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
+ }
+ else if (mode === "no_detail") {
+ // No details for feature, so only one way to display.
+ ctx.fillStyle = block_color;
+ // TODO: what should width be here?
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
+ }
+ else { // Mode is either Squish or Pack:
+ // Feature has details.
+ var feature_strand = feature[5],
+ feature_ts = feature[6],
+ feature_te = feature[7],
+ feature_blocks = feature[8];
+
+ if (feature_ts && feature_te) {
+ thick_start = Math.floor( Math.max(0, (feature_ts - tile_low) * w_scale) );
+ thick_end = Math.ceil( Math.min(width, Math.max(0, (feature_te - tile_low) * w_scale)) );
+ }
+
+ // Set vars that depend on mode.
+ var thin_height, thick_height;
+ if (mode == "Squish") {
+ thin_height = 1;
+ thick_height = SQUISH_FEATURE_HEIGHT;
+ }
+ else { // mode == "Pack"
+ thin_height = 5;
+ thick_height = PACK_FEATURE_HEIGHT;
+ }
+
+ // Draw feature/feature blocks + connectors.
+ if (!feature_blocks) {
+ // If there are no blocks, treat the feature as one big exon.
+ if ( feature.strand ) {
+ if (feature.strand == "+") {
+ ctx.fillStyle = RIGHT_STRAND_INV;
+ } else if (feature.strand == "-") {
+ ctx.fillStyle = LEFT_STRAND_INV;
+ }
+ }
+ else { // No strand.
+ ctx.fillStyle = CONNECTOR_COLOR;
+ }
+ ctx.fillRect(f_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
+ f_end - f_start, thick_height);
+ }
+ else {
+ // There are feature blocks and mode is either Squish or Pack.
+ //
+ // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as
+ // needed. This ensures that whole feature, regardless of whether it starts with
+ // a block, is visible.
+ //
+
+ // Draw whole feature as connector/intron.
+ var cur_y_center, cur_height;
+ if (mode == "Squish") {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ cur_y_center = y_center + Math.floor(SQUISH_FEATURE_HEIGHT/2) + 1;
+ cur_height = 1;
+ }
+ else { // mode == "Pack"
+ if (feature_strand) {
+ var cur_y_center = y_center;
+ var cur_height = thick_height;
+ if (feature_strand == "+") {
+ ctx.fillStyle = RIGHT_STRAND;
+ } else if (feature_strand == "-") {
+ ctx.fillStyle = LEFT_STRAND;
+ }
+ }
+ else {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ cur_y_center += (SQUISH_FEATURE_HEIGHT/2) + 1;
+ cur_height = 1;
+ }
+ }
+ ctx.fillRect(f_start + left_offset, cur_y_center, f_end - f_start, cur_height);
+
+ for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) {
+ var block = feature_blocks[k],
+ block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
+ block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) );
+
+ // Skip drawing if block not on tile.
+ if (block_start > block_end) { continue; }
+
+ // Draw thin block.
+ ctx.fillStyle = block_color;
+ ctx.fillRect(block_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
+ block_end - block_start, thin_height);
+
+ // If block intersects with thick region, draw block as thick.
+ if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) {
+ var block_thick_start = Math.max(block_start, thick_start),
+ // -1 b/c intervals are half-open.
+ block_thick_end = Math.min(block_end, thick_end-1);
+ ctx.fillRect(block_thick_start + left_offset, y_center + 1,
+ block_thick_end - block_thick_start, thick_height);
+ }
+ }
+ }
+
+ // Draw label for Pack mode.
+ if (mode === "Pack" && feature_start > tile_low) {
+ ctx.fillStyle = label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
+ } else {
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
+ }
+ ctx.fillStyle = block_color;
+ }
+ }
+ },
+ /**
* Draw FeatureTrack tile.
*/
draw_tile: function(resolution, tile_index, parent_element, w_scale) {
@@ -2297,11 +2473,8 @@
// Create/set/compute some useful vars.
//
var width = Math.ceil( tile_span * w_scale ),
- label_color = this.prefs.label_color,
- block_color = this.prefs.block_color,
mode = this.mode,
min_height = 25,
- no_label,
left_offset = this.left_offset,
slots, required_height, y_scale;
@@ -2309,33 +2482,68 @@
if (window.G_vmlCanvasManager) { G_vmlCanvasManager.initElement(canvas); } // EXCANVAS HACK
canvas = $(canvas);
- if (result.dataset_type === "summary_tree") {
+ //
+ // Set mode if Auto.
+ //
+ if (mode === "Auto") {
+ if (result.dataset_type === "summary_tree") {
+ mode = result.dataset_type;
+ } else if (result.extra_info === "no_detail") {
+ mode = "no_detail";
+ }
+ else {
+ // Choose b/t Squish and Pack.
+ // Proxy measures for using Squish:
+ // (a) error message re: limiting number of features shown;
+ // (b) X number of features shown;
+ // (c) size of view shown.
+ // TODO: cannot use (a) and (b) because it requires coordinating mode across tiles;
+ // fix this so that tiles are redrawn as necessary to use the same mode.
+ //if ( (result.message && result.message.match(/^Only the first [\d]+/)) ||
+ // (result.data && result.data.length > 2000) ||
+ var data = result.data;
+ if ( (data.length && data.length < 4) ||
+ (this.view.high - this.view.low > MIN_SQUISH_VIEW_WIDTH) ) {
+ mode = "Squish";
+ }
+ else {
+ mode = "Pack";
+ }
+ }
+ }
+
+ //
+ // Set required height, y_scale.
+ //
+ if (mode === "summary_tree") {
required_height = this.summary_draw_height;
- } else if (mode === "Dense") {
+ }
+ if (mode === "Dense") {
required_height = min_height;
- y_scale = DENSE_TRACK_HEIGHT;
- } else {
- // Set y_scale based on mode and result data.
- if (mode === "Squish") {
- y_scale = SQUISH_TRACK_HEIGHT;
- no_label = true;
- } else if (mode === "Pack") {
- y_scale = PACK_TRACK_HEIGHT;
- // TODO: is there data where there is no label even in pack mode?
- no_label = false;
- } else if (result.extra_info === "no_detail") { // mode == "Auto"
- y_scale = NO_DETAIL_TRACK_HEIGHT;
- no_label = true;
- } else {
- y_scale = PACK_TRACK_HEIGHT;
- no_label = false;
- }
-
+ y_scale = DENSE_TRACK_HEIGHT;
+ }
+ else if (mode === "no_detail") {
+ y_scale = NO_DETAIL_TRACK_HEIGHT;
+ }
+ else if (mode === "Squish") {
+ y_scale = SQUISH_TRACK_HEIGHT;
+ }
+ else { // mode === "Pack"
+ y_scale = PACK_TRACK_HEIGHT;
+ }
+
+ //
+ // Pack reads.
+ //
+ if (mode === "no_detail" || mode === "Squish" || mode === "Pack") {
// Calculate new slots incrementally for this new chunk of data and update height if necessary.
- required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
+ required_height = this.incremental_slots(w_scale, result.data, mode) * y_scale + min_height;
slots = this.inc_slots[w_scale];
}
-
+
+ //
+ // Set up for drawing.
+ //
canvas.get(0).width = width + left_offset;
canvas.get(0).height = required_height;
if (result.dataset_type == "summary_tree") {
@@ -2345,7 +2553,7 @@
parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px");
// console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
var ctx = canvas.get(0).getContext("2d");
- ctx.fillStyle = block_color;
+ ctx.fillStyle = this.prefs.block_color;
ctx.font = this.default_font;
ctx.textAlign = "right";
this.container_div.find(".yaxislabel").remove();
@@ -2353,40 +2561,9 @@
//
// Draw summary tree. If tree is drawn, canvas is returned.
//
- if (result.dataset_type == "summary_tree") {
- var
- // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
- // start. However, height of each rectangle is relative to required_height; hence, the
- // max rectangle is required_height.
- base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
- points = result.data,
- max = result.max,
- delta_x_px = Math.ceil(result.delta * w_scale);
-
- var max_label = $("<div />").addClass('yaxislabel');
- max_label.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 );
- var y = points[i][1];
-
- if (!y) { continue; }
- var y_px = y / max * required_height;
-
- ctx.fillStyle = "black";
- ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
-
- // Draw number count if it can fit the number with some padding, otherwise things clump up
- var text_padding_req_x = 4;
- if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
- ctx.fillStyle = "#666";
- ctx.textAlign = "center";
- ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
- }
- }
+ if (mode === "summary_tree") {
+ this.draw_summary_tree(canvas, result.data, result.delta, result.max, w_scale, required_height,
+ tile_low, left_offset);
return canvas;
}
@@ -2419,32 +2596,17 @@
}
//
- // Draw data points.
+ // Draw elements.
//
var data = result.data;
-
- // Set mode in Auto; never use Dense, so decide b/t Squish and Pack.
- if (mode == "Auto" && data.length > 0) {
- if (feature.length <= 4) {
- mode = "Squish";
- }
- else {
- mode = "Pack";
- }
- }
-
for (var i = 0, len = data.length; i < len; i++) {
var feature = data[i],
feature_uid = feature[0],
feature_start = feature[1],
- // -1 b/c intervals are half-open.
- feature_end = feature[2] - 1,
- feature_name = feature[3];
-
- // TODO: why is this necessary? Without explicitly short-circuiting it, it prevents dense mode from rendering.
- if (this.mode != "Dense" && slots[feature_uid] === undefined) {
- continue;
- }
+ feature_end = feature[2],
+ // Slot valid only if features are slotted and this feature is slotted;
+ // feature may not be due to lack of space.
+ slot = (slots && slots[feature_uid] !== undefined ? slots[feature_uid] : null);
// Apply filters to feature.
var hide_feature = false;
@@ -2459,143 +2621,15 @@
}
if (hide_feature) {
continue;
- }
-
- if (feature_start <= tile_high && feature_end >= tile_low) {
- // All features need a start, end, and vertical center.
- var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
- f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
- y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
- var thickness, y_start, thick_start = null, thick_end = null;
-
- //
- // There are really four modes for interval indices:
- // dense, no_detail, squish, pack.
- //
-
- // Dense mode displays the same for all data.
- if (mode == "Dense") {
- ctx.fillStyle = block_color;
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
- }
- // Mode is either Squish or Pack:
- else if (feature.length <= 4) {
- // No details for feature, so only one way to display.
- ctx.fillStyle = block_color;
- // TODO: what should width be here?
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
- } else {
- // Feature has details.
- var feature_strand = feature[5],
- feature_ts = feature[6],
- feature_te = feature[7],
- feature_blocks = feature[8];
-
- if (feature_ts && feature_te) {
- thick_start = Math.floor( Math.max(0, (feature_ts - tile_low) * w_scale) );
- thick_end = Math.ceil( Math.min(width, Math.max(0, (feature_te - tile_low) * w_scale)) );
- }
-
- // Set vars that depend on mode.
- var thin_height, thick_height;
- if (mode == "Squish") {
- thin_height = 1;
- thick_height = SQUISH_FEATURE_HEIGHT;
- }
- else { // mode == "Pack"
- thin_height = 5;
- thick_height = PACK_FEATURE_HEIGHT;
- }
-
- // Draw feature/feature blocks + connectors.
- if (!feature_blocks) {
- // If there are no blocks, treat the feature as one big exon.
- if ( feature.strand ) {
- if (feature.strand == "+") {
- ctx.fillStyle = RIGHT_STRAND_INV;
- } else if (feature.strand == "-") {
- ctx.fillStyle = LEFT_STRAND_INV;
- }
- }
- else { // No strand.
- ctx.fillStyle = CONNECTOR_COLOR;
- }
- ctx.fillRect(f_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
- f_end - f_start, thick_height);
- }
- else {
- // There are feature blocks and mode is either Squish or Pack.
- //
- // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as
- // needed. This ensures that whole feature, regardless of whether it starts with
- // a block, is visible.
- //
-
- // Draw whole feature as connector/intron.
- var cur_y_center, cur_height;
- if (mode == "Squish") {
- ctx.fillStyle = CONNECTOR_COLOR;
- cur_y_center = y_center + Math.floor(SQUISH_FEATURE_HEIGHT/2) + 1;
- cur_height = 1;
- }
- else { // mode == "Pack"
- if (feature_strand) {
- var cur_y_center = y_center;
- var cur_height = thick_height;
- if (feature_strand == "+") {
- ctx.fillStyle = RIGHT_STRAND;
- } else if (feature_strand == "-") {
- ctx.fillStyle = LEFT_STRAND;
- }
- }
- else {
- ctx.fillStyle = CONNECTOR_COLOR;
- cur_y_center += (SQUISH_FEATURE_HEIGHT/2) + 1;
- cur_height = 1;
- }
- }
- ctx.fillRect(f_start + left_offset, cur_y_center, f_end - f_start, cur_height);
-
- for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) {
- var block = feature_blocks[k],
- block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
- block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) );
-
- // Skip drawing if block not on tile.
- if (block_start > block_end) { continue; }
-
- // Draw thin block.
- ctx.fillStyle = block_color;
- ctx.fillRect(block_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
- block_end - block_start, thin_height);
-
- // If block intersects with thick region, draw block as thick.
- if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) {
- var block_thick_start = Math.max(block_start, thick_start),
- // -1 b/c intervals are half-open.
- block_thick_end = Math.min(block_end, thick_end-1);
- ctx.fillRect(block_thick_start + left_offset, y_center + 1,
- block_thick_end - block_thick_start, thick_height);
- }
- }
- }
-
- // Draw label for Pack mode.
- if (mode == "Pack" && feature_start > tile_low) {
- ctx.fillStyle = label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
- }
+ }
+
+ // Draw feature.
+ if (is_overlap([feature_start, feature_end], [tile_low, tile_high]) && slot !== null) {
+ this.draw_element(ctx, tile_index, mode, feature, slot, tile_low, tile_high, w_scale, y_scale,
+ width, left_offset);
}
}
- return canvas;
+ return canvas;
}
});
@@ -2606,236 +2640,57 @@
$.extend(VcfTrack.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
/**
- * Draw VcfTrack tile.
+ * Draw a VCF entry.
*/
- draw_tile: function(resolution, tile_index, parent_element, w_scale) {
- var tile_low = tile_index * DENSITY * resolution,
- tile_high = ( tile_index + 1 ) * DENSITY * resolution,
- tile_span = tile_high - tile_low;
- //console.log("drawing " + tile_low + " to " + tile_high);
-
- /*for (var k in this.data_cache.obj_cache) {
- var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
- if (k_low <= tile_low && k_high >= tile_high) {
- data = this.data_cache.get(k);
- break;
+ draw_element: function(ctx, mode, feature, slot, tile_low, tile_high, w_scale, y_scale, width) {
+ var feature = data[i],
+ feature_uid = feature[0],
+ feature_start = feature[1],
+ // -1 b/c intervals are half-open.
+ feature_end = feature[2] - 1,
+ feature_name = feature[3],
+ // All features need a start, end, and vertical center.
+ f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
+ y_center = (mode === "Dense" ? 1 : (1 + slot)) * y_scale,
+ thickness, y_start, thick_start = null, thick_end = null;
+
+ if (no_label) {
+ ctx.fillStyle = block_color;
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, 1);
+ }
+ else { // Show blocks, labels, etc.
+ // Unpack.
+ var ref_base = feature[4], alt_base = feature[5], qual = feature[6];
+
+ // Draw block for entry.
+ thickness = 9;
+ y_start = 1;
+ ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, thickness);
+
+ // Add label for entry.
+ if (mode !== "Dense" && feature_name !== undefined && feature_start > tile_low) {
+ // Draw label
+ ctx.fillStyle = label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + 2 + left_offset, y_center + 8);
+ } else {
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start - 2 + left_offset, y_center + 8);
+ }
+ ctx.fillStyle = block_color;
}
- }*/
- //
- // Get tile data; if data not available, issue get_data request and return.
- //
- var result = this.data_cache.get_data(tile_low, tile_high, this.mode);
- if (result === undefined || result === "pending" ||
- (this.mode !== "Auto" && result.dataset_type === "summary_tree")) {
- this.data_queue[ [tile_low, tile_high] ] = true;
- this.get_data(tile_low, tile_high);
- return;
- }
- //
- // Create/set/compute some useful vars.
- //
- var width = Math.ceil( tile_span * w_scale ),
- label_color = this.prefs.label_color,
- block_color = this.prefs.block_color,
- mode = this.mode,
- min_height = 25,
- no_label,
- left_offset = this.left_offset,
- slots, required_height, y_scale;
-
- var canvas = document.createElement("canvas");
- if (window.G_vmlCanvasManager) { G_vmlCanvasManager.initElement(canvas); } // EXCANVAS HACK
- canvas = $(canvas);
-
- if (result.dataset_type === "summary_tree") {
- required_height = this.summary_draw_height;
- } else if (mode === "Dense") {
- required_height = min_height;
- y_scale = DENSE_TRACK_HEIGHT;
- } else {
- // Set y_scale based on mode and result data.
- if (mode === "Squish") {
- y_scale = SQUISH_TRACK_HEIGHT;
- no_label = true;
- } else if (mode === "Pack") {
- y_scale = PACK_TRACK_HEIGHT;
- // TODO: is there data where there is no label even in pack mode?
- no_label = false;
- } else if (result.extra_info === "no_detail") { // mode == "Auto"
- y_scale = NO_DETAIL_TRACK_HEIGHT;
- no_label = true;
- } else {
- y_scale = PACK_TRACK_HEIGHT;
- no_label = false;
- }
-
- // Calculate new slots incrementally for this new chunk of data and update height if necessary.
- required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
- slots = this.inc_slots[w_scale];
- }
-
- canvas.get(0).width = width + left_offset;
- canvas.get(0).height = required_height;
- if (result.dataset_type == "summary_tree") {
- // Increase canvas height in order to display max label.
- canvas.get(0).height += LABEL_SPACING + CHAR_HEIGHT_PX;
- }
- parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px");
- // console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
- var ctx = canvas.get(0).getContext("2d");
- ctx.fillStyle = block_color;
- ctx.font = this.default_font;
- ctx.textAlign = "right";
- this.container_div.find(".yaxislabel").remove();
-
- //
- // Draw summary tree. If tree is drawn, canvas is returned.
- //
- if (result.dataset_type == "summary_tree") {
- var
- // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
- // start. However, height of each rectangle is relative to required_height; hence, the
- // max rectangle is required_height.
- base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
- points = result.data,
- max = result.max,
- delta_x_px = Math.ceil(result.delta * w_scale);
-
- var max_label = $("<div />").addClass('yaxislabel');
- max_label.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 );
- var y = points[i][1];
-
- if (!y) { continue; }
- var y_px = y / max * required_height;
-
- ctx.fillStyle = "black";
- ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
-
- // Draw number count if it can fit the number with some padding, otherwise things clump up
- var text_padding_req_x = 4;
- if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
- ctx.fillStyle = "#666";
- ctx.textAlign = "center";
- ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
- }
- }
- return canvas;
- }
-
- //
- // If there is a message, show it; also, return if there's no data to draw.
- // FIXME: Why is this drawn on a canvas instead of a div?
- if (result.message) {
- canvas.css({
- "border-color": "red"
- });
-
- ctx.fillStyle = "red";
- ctx.textAlign = "left";
- ctx.fillText(result.message, 100 + left_offset, y_scale);
-
- // If there's no data, return.
- if (!result.data) {
- return canvas;
+ // Show additional data on block.
+ var vcf_label = ref_base + " / " + alt_base;
+ if (feature_start > tile_low && ctx.measureText(vcf_label).width < (f_end - f_start)) {
+ ctx.fillStyle = "white";
+ ctx.textAlign = "center";
+ ctx.fillText(vcf_label, left_offset + f_start + (f_end-f_start)/2, y_center + 8);
+ ctx.fillStyle = block_color;
}
}
-
- //
- // If tile is filterable, add class to canvas.
- //
- for (var f = 0; f < this.filters.length; f++) {
- if (result.data.length && this.filters[f].applies_to(result.data[0])) {
- canvas.addClass(FILTERABLE_CLASS);
- break;
- }
- }
-
- //
- // Draw data points.
- //
- var data = result.data;
- for (var i = 0, len = data.length; i < len; i++) {
- var feature = data[i],
- feature_uid = feature[0],
- feature_start = feature[1],
- // -1 b/c intervals are half-open.
- feature_end = feature[2] - 1,
- feature_name = feature[3];
-
- // TODO: why is this necessary? Without explicitly short-circuiting it, it prevents dense mode from rendering.
- if (this.mode != "Dense" && slots[feature_uid] === undefined) {
- continue;
- }
-
- // Apply filters to feature.
- var hide_feature = false;
- var filter;
- for (var f = 0; f < this.filters.length; f++) {
- filter = this.filters[f];
- filter.update_attrs( feature );
- if ( !filter.keep( feature ) ) {
- hide_feature = true;
- break;
- }
- }
- if (hide_feature) {
- continue;
- }
-
- if (feature_start <= tile_high && feature_end >= tile_low) {
- // All features need a start, end, and vertical center.
- var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
- f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
- y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
- var thickness, y_start, thick_start = null, thick_end = null;
-
-
- if (no_label) {
- ctx.fillStyle = block_color;
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, 1);
- }
- else { // Show blocks, labels, etc.
- // Unpack.
- var ref_base = feature[4], alt_base = feature[5], qual = feature[6];
-
- // Draw block for entry.
- thickness = 9;
- y_start = 1;
- ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, thickness);
-
- // Add label for entry.
- if (mode !== "Dense" && feature_name !== undefined && feature_start > tile_low) {
- // Draw label
- ctx.fillStyle = label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + 2 + left_offset, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start - 2 + left_offset, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
-
- // Show additional data on block.
- var vcf_label = ref_base + " / " + alt_base;
- if (feature_start > tile_low && ctx.measureText(vcf_label).width < (f_end - f_start)) {
- ctx.fillStyle = "white";
- ctx.textAlign = "center";
- ctx.fillText(vcf_label, left_offset + f_start + (f_end-f_start)/2, y_center + 8);
- ctx.fillStyle = block_color;
- }
- }
- }
- }
- return canvas;
}
});
@@ -2847,7 +2702,7 @@
/**
* Draw a single read.
*/
- draw_read: function(ctx, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center) {
+ draw_read: function(ctx, mode, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center) {
ctx.textAlign = "center";
var
tile_region = [tile_low, tile_high],
@@ -2885,7 +2740,7 @@
if (seq_tile_overlap != NO_OVERLAP) {
// Draw.
var seq = orig_seq.slice(seq_offset, seq_offset + cig_len);
- if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
+ if ( (mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
ctx.fillStyle = this.prefs.block_color;
ctx.fillRect(s_start + this.left_offset, y_center + 1, s_end - s_start, 9);
ctx.fillStyle = CONNECTOR_COLOR;
@@ -2903,7 +2758,7 @@
ctx.fillRect(s_start + this.left_offset,
y_center + (this.mode != "Dense" ? 4 : 5),
s_end - s_start,
- (this.mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT) );
+ (mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT) );
}
}
seq_offset += cig_len;
@@ -2938,7 +2793,7 @@
var seq = orig_seq.slice(seq_offset, seq_offset + cig_len);
// X center is offset + start - <half_sequence_length>
var x_center = this.left_offset + s_start - (s_end - s_start)/2;
- if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
+ if ( (mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
// Draw sequence container.
ctx.fillStyle = "yellow";
ctx.fillRect(x_center, y_center - 9, s_end - s_start, 9);
@@ -2970,7 +2825,7 @@
ctx.fillStyle = "yellow";
// TODO: This is a pretty hack-ish way to fill rectangle based on mode.
ctx.fillRect(x_center, y_center + (this.mode != "Dense" ? 2 : 5),
- s_end - s_start, (this.mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT));
+ s_end - s_start, (mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT));
}
}
seq_offset += cig_len;
@@ -2992,213 +2847,61 @@
}
},
/**
- * Draw ReadTrack tile.
+ * Draw a complete read.
*/
- draw_tile: function(resolution, tile_index, parent_element, w_scale) {
- var tile_low = tile_index * DENSITY * resolution,
- tile_high = ( tile_index + 1 ) * DENSITY * resolution,
- tile_span = tile_high - tile_low;
- //console.log("ReadTrack: drawing " + tile_low + " to " + tile_high);
+ draw_element: function(ctx, tile_index, mode, feature, slot, tile_low, tile_high, w_scale, y_scale, width, left_offset) {
+ // All features need a start, end, and vertical center.
+ var
+ feature_uid = feature[0],
+ feature_start = feature[1],
+ feature_end = feature[2],
+ feature_name = feature[3],
+ f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
+ y_center = (mode === "Dense" ? 1 : (1 + slot)) * y_scale,
+ block_color = this.prefs.block_color,
+ label_color = this.prefs.label_color;
+
+ // Draw read.
+ ctx.fillStyle = block_color;
+ if (feature[5] instanceof Array) {
+ // Read is paired.
+ 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)) );
- /*for (var k in this.data_cache.obj_cache) {
- var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
- if (k_low <= tile_low && k_high >= tile_high) {
- data = this.data_cache.get(k);
- break;
+ // Draw left/forward read.
+ if (feature[4][1] >= tile_low && feature[4][0] <= tile_high && feature[4][2]) {
+ this.draw_read(ctx, mode, w_scale, tile_low, tile_high, feature[4][0], feature[4][2], feature[4][3], y_center);
}
- }*/
-
- //
- // Get tile data; if data not available, issue get_data request and return.
- //
- var result = this.data_cache.get_data(tile_low, tile_high, this.mode);
- if (result === undefined || result === "pending" ||
- (this.mode !== "Auto" && result.dataset_type === "summary_tree")) {
- this.data_queue[ [tile_low, tile_high] ] = true;
- this.get_data(tile_low, tile_high);
- return;
+ // Draw right/reverse read.
+ if (feature[5][1] >= tile_low && feature[5][0] <= tile_high && feature[5][2]) {
+ this.draw_read(ctx, mode, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], feature[5][3], y_center);
+ }
+ // Draw connector.
+ if (b2_start > b1_end) {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ //ctx.fillRect(b1_end + left_offset, y_center + 5, b2_start - b1_end, 1);
+ ctx.dashedLine(b1_end + left_offset, y_center + 5, left_offset + b2_start, y_center + 5);
+ }
+ } else {
+ // Read is single.
+ ctx.fillStyle = block_color;
+ this.draw_read(ctx, mode, w_scale, tile_low, tile_high, feature_start, feature[4], feature[5], y_center);
}
- //
- // Create/set/compute some useful vars.
- //
- var width = Math.ceil( tile_span * w_scale ),
- label_color = this.prefs.label_color,
- block_color = this.prefs.block_color,
- mode = this.mode,
- min_height = 25,
- no_label,
- left_offset = this.left_offset,
- slots, required_height, y_scale;
-
- var canvas = document.createElement("canvas");
- if (window.G_vmlCanvasManager) { G_vmlCanvasManager.initElement(canvas); } // EXCANVAS HACK
- canvas = $(canvas);
-
- if (result.dataset_type === "summary_tree") {
- required_height = this.summary_draw_height;
- } else if (mode === "Dense") {
- required_height = min_height;
- y_scale = DENSE_TRACK_HEIGHT;
- } else {
- // Set y_scale based on mode and result data.
- if (mode === "Squish") {
- y_scale = SQUISH_TRACK_HEIGHT;
- no_label = true;
- } else if (mode === "Pack") {
- y_scale = PACK_TRACK_HEIGHT;
- // TODO: is there data where there is no label even in pack mode?
- no_label = false;
- } else if (result.extra_info === "no_detail") { // mode == "Auto"
- y_scale = SQUISH_TRACK_HEIGHT;
- no_label = true;
+ if (mode === "Pack" && feature_start > tile_low) {
+ // Draw label.
+ ctx.fillStyle = this.prefs.label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
} else {
- y_scale = PACK_TRACK_HEIGHT;
- no_label = false;
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
}
-
- // Calculate new slots incrementally for this new chunk of data and update height if necessary.
- required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
- slots = this.inc_slots[w_scale];
+ ctx.fillStyle = block_color;
}
-
- canvas.get(0).width = width + left_offset;
- canvas.get(0).height = required_height;
- if (result.dataset_type == "summary_tree") {
- // Increase canvas height in order to display max label.
- canvas.get(0).height += LABEL_SPACING + CHAR_HEIGHT_PX;
- }
- parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px");
- // console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
- var ctx = canvas.get(0).getContext("2d");
- ctx.fillStyle = block_color;
- ctx.font = this.default_font;
- ctx.textAlign = "right";
- this.container_div.find(".yaxislabel").remove();
-
- //
- // Draw summary tree. If tree is drawn, canvas is returned.
- //
- if (result.dataset_type == "summary_tree") {
- var
- // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
- // start. However, height of each rectangle is relative to required_height; hence, the
- // max rectangle is required_height.
- base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
- points = result.data,
- max = result.max,
- delta_x_px = Math.ceil(result.delta * w_scale);
-
- var max_label = $("<div />").addClass('yaxislabel');
- max_label.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 );
- var y = points[i][1];
-
- if (!y) { continue; }
- var y_px = y / max * required_height;
-
- ctx.fillStyle = "black";
- ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
-
- // Draw number count if it can fit the number with some padding, otherwise things clump up
- var text_padding_req_x = 4;
- if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
- ctx.fillStyle = "#666";
- ctx.textAlign = "center";
- ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
- }
- }
- return canvas;
- }
-
- //
- // If there is a message, show it; also, return if there's no data to draw.
- // FIXME: Why is this drawn on a canvas instead of a div?
- if (result.message) {
- canvas.css({
- "border-color": "red"
- });
-
- ctx.fillStyle = "red";
- ctx.textAlign = "left";
- ctx.fillText(result.message, 100 + left_offset, y_scale);
-
- // If there's no data, return.
- if (!result.data) {
- return canvas;
- }
- }
-
- //
- // Draw reads.
- //
- var data = result.data;
- for (var i = 0, len = data.length; i < len; i++) {
- var feature = data[i],
- feature_uid = feature[0],
- feature_start = feature[1],
- feature_end = feature[2],
- feature_name = feature[3];
-
- // TODO: why is this necessary? Without explicitly short-circuiting it, it prevents dense mode from rendering.
- if (this.mode != "Dense" && slots[feature_uid] === undefined) {
- continue;
- }
-
- if (feature_start <= tile_high && feature_end >= tile_low) {
- // All features need a start, end, and vertical center.
- var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
- f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
- y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
- var thickness, y_start, thick_start = null, thick_end = null;
-
- // Draw read.
- ctx.fillStyle = block_color;
- if (feature[5] instanceof Array) {
- // Read is paired.
- 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)) );
-
- // Draw left/forward read.
- if (feature[4][1] >= tile_low && feature[4][0] <= tile_high && feature[4][2]) {
- this.draw_read(ctx, w_scale, tile_low, tile_high, feature[4][0], feature[4][2], feature[4][3], y_center);
- }
- // Draw right/reverse read.
- if (feature[5][1] >= tile_low && feature[5][0] <= tile_high && feature[5][2]) {
- this.draw_read(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], feature[5][3], y_center);
- }
- // Draw connector.
- if (b2_start > b1_end) {
- ctx.fillStyle = CONNECTOR_COLOR;
- //ctx.fillRect(b1_end + left_offset, y_center + 5, b2_start - b1_end, 1);
- ctx.dashedLine(b1_end + left_offset, y_center + 5, left_offset + b2_start, y_center + 5);
- }
- } else {
- // Read is single.
- ctx.fillStyle = block_color;
- this.draw_read(ctx, w_scale, tile_low, tile_high, feature_start, feature[4], feature[5], y_center);
- }
- if (mode !== "Dense" && !no_label && feature_start > tile_low) {
- // Draw label.
- ctx.fillStyle = this.prefs.label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
- }
- }
- return canvas;
}
});
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/9ec73a5b31a4/
changeset: r5102:9ec73a5b31a4
user: greg
date: 2011-02-22 16:38:35
summary: (no commit message)
affected #: 2 files (173 bytes)
--- a/lib/galaxy/web/controllers/library_common.py Mon Feb 21 16:25:35 2011 -0500
+++ b/lib/galaxy/web/controllers/library_common.py Tue Feb 22 10:38:35 2011 -0500
@@ -1585,6 +1585,7 @@
message += '(%s)' % ldda.name
message += '. '
if valid_ldda_ids:
+ encoded_ldda_ids = [ trans.security.encode_id( ldda_id ) for ldda_id in valid_ldda_ids ]
folder_id = trans.security.encode_id( valid_lddas[0].library_dataset.folder.id )
trans.response.send_redirect( web.url_for( controller='library_common',
action='ldda_permissions',
@@ -1592,7 +1593,7 @@
use_panels=use_panels,
library_id=library_id,
folder_id=folder_id,
- id=",".join( valid_ldda_ids ),
+ id=",".join( encoded_ldda_ids ),
show_deleted=show_deleted,
message=util.sanitize_text( message ),
status=status ) )
--- a/templates/library/common/browse_library.mako Mon Feb 21 16:25:35 2011 -0500
+++ b/templates/library/common/browse_library.mako Tue Feb 22 10:38:35 2011 -0500
@@ -361,9 +361,7 @@
<div style="float: left; margin-left: 2px;" class="menubutton split popup" id="folder_img-${folder.id}-popup"><a class="folder-${encoded_id}-click" href="javascript:void(0);">
%if folder.deleted:
- <span class="libraryItem-error">
- ${folder.name}
- </span>
+ <span class="libraryItem-error">${folder.name}</span>
%else:
${folder.name}
%endif
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: natefoo: Update bowtie_wrapper and bowtie_color_wrapper to use test data from the external test data repository
by Bitbucket 21 Feb '11
by Bitbucket 21 Feb '11
21 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/b26e5c6ff96d/
changeset: r5101:b26e5c6ff96d
user: natefoo
date: 2011-02-21 22:25:35
summary: Update bowtie_wrapper and bowtie_color_wrapper to use test data from the external test data repository
affected #: 2 files (428 bytes)
--- a/tools/sr_mapping/bowtie_color_wrapper.xml Mon Feb 21 15:54:22 2011 -0500
+++ b/tools/sr_mapping/bowtie_color_wrapper.xml Mon Feb 21 16:25:35 2011 -0500
@@ -396,8 +396,7 @@
chrM_color needs to be the base location/name of the index files.
--><param name="genomeSource" value="indexed" />
- <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="index" value="/galaxy/data/equCab2_chrM/bowtie_index/cs/chrM" />
+ <param name="index" value="equCab2chrM" /><param name="sPaired" value="single" /><param name="sInput1" ftype="fastqcssanger" value="bowtie_in1.fastqcssanger" /><param name="sSettingsType" value="preSet" />
@@ -466,8 +465,7 @@
chrM_base is the index files' location/base name.
--><param name="genomeSource" value="indexed" />
- <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="index" value="/galaxy/data/equCab2_chrM/bowtie_index/cs/chrM" />
+ <param name="index" value="equCab2chrM" /><param name="sPaired" value="single" /><param name="sInput1" ftype="fastqcssanger" value="bowtie_in1.fastqcssanger" /><param name="sSettingsType" value="full" />
--- a/tools/sr_mapping/bowtie_wrapper.xml Mon Feb 21 15:54:22 2011 -0500
+++ b/tools/sr_mapping/bowtie_wrapper.xml Mon Feb 21 16:25:35 2011 -0500
@@ -379,8 +379,7 @@
chrM_base needs to be the base location/name of the index files.
--><param name="genomeSource" value="indexed" />
- <!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="index" value="/galaxy/data/equCab2_chrM/bowtie_index/chrM" />
+ <param name="index" value="equCab2chrM" /><param name="sPaired" value="single" /><param name="sInput1" ftype="fastqsanger" value="bowtie_in2.fastqsanger" /><param name="sSettingsType" value="preSet" />
@@ -448,7 +447,7 @@
--><param name="genomeSource" value="indexed" /><!-- this is the backwards-compatible "unique value" for this index, not an actual path -->
- <param name="index" value="/galaxy/data/equCab2_chrM/bowtie_index/chrM" />
+ <param name="index" value="equCab2chrM" /><param name="sPaired" value="single" /><param name="sInput1" ftype="fastqsanger" value="bowtie_in2.fastqsanger" /><param name="sSettingsType" value="full" />
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/89df419a7e21/
changeset: r5100:89df419a7e21
user: jgoecks
date: 2011-02-21 21:54:22
summary: Trackster refactoring: (a) move ReadTrack-specific code out of FeatureTrack and into ReadTrack; (b) move VCFTrack-specific code of out FeatureTrack and into VcfTTrack. This makes it easier to modify drawing for each track type but creates some repeated code in draw_tile() for different classes that needs to be cleaned up.
affected #: 2 files (13.8 KB)
--- a/lib/galaxy/visualization/tracks/data_providers.py Mon Feb 21 15:10:22 2011 -0500
+++ b/lib/galaxy/visualization/tracks/data_providers.py Mon Feb 21 15:54:22 2011 -0500
@@ -285,7 +285,7 @@
paired_pending = {}
for read in data:
if len(results) > MAX_VALS:
- message = "Only the first %s pairs are being displayed." % MAX_VALS
+ message = "Only the first %s reads are being displayed." % MAX_VALS
break
qname = read.qname
seq = read.seq
--- a/static/scripts/trackster.js Mon Feb 21 15:10:22 2011 -0500
+++ b/static/scripts/trackster.js Mon Feb 21 15:54:22 2011 -0500
@@ -2266,8 +2266,588 @@
*/
return highest_slot;
},
- // Right now this function is used only for rendering BAM reads.
- rect_or_text: function(ctx, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center) {
+ /**
+ * Draw FeatureTrack tile.
+ */
+ draw_tile: function(resolution, tile_index, parent_element, w_scale) {
+ var tile_low = tile_index * DENSITY * resolution,
+ tile_high = ( tile_index + 1 ) * DENSITY * resolution,
+ tile_span = tile_high - tile_low;
+ //console.log("drawing " + tile_low + " to " + tile_high);
+
+ /*for (var k in this.data_cache.obj_cache) {
+ var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
+ if (k_low <= tile_low && k_high >= tile_high) {
+ data = this.data_cache.get(k);
+ break;
+ }
+ }*/
+
+ //
+ // Get tile data; if data not available, issue get_data request and return.
+ //
+ var result = this.data_cache.get_data(tile_low, tile_high, this.mode);
+ if (result === undefined || result === "pending" ||
+ (this.mode !== "Auto" && result.dataset_type === "summary_tree")) {
+ this.data_queue[ [tile_low, tile_high] ] = true;
+ this.get_data(tile_low, tile_high);
+ return;
+ }
+ //
+ // Create/set/compute some useful vars.
+ //
+ var width = Math.ceil( tile_span * w_scale ),
+ label_color = this.prefs.label_color,
+ block_color = this.prefs.block_color,
+ mode = this.mode,
+ min_height = 25,
+ no_label,
+ left_offset = this.left_offset,
+ slots, required_height, y_scale;
+
+ var canvas = document.createElement("canvas");
+ if (window.G_vmlCanvasManager) { G_vmlCanvasManager.initElement(canvas); } // EXCANVAS HACK
+ canvas = $(canvas);
+
+ if (result.dataset_type === "summary_tree") {
+ required_height = this.summary_draw_height;
+ } else if (mode === "Dense") {
+ required_height = min_height;
+ y_scale = DENSE_TRACK_HEIGHT;
+ } else {
+ // Set y_scale based on mode and result data.
+ if (mode === "Squish") {
+ y_scale = SQUISH_TRACK_HEIGHT;
+ no_label = true;
+ } else if (mode === "Pack") {
+ y_scale = PACK_TRACK_HEIGHT;
+ // TODO: is there data where there is no label even in pack mode?
+ no_label = false;
+ } else if (result.extra_info === "no_detail") { // mode == "Auto"
+ y_scale = NO_DETAIL_TRACK_HEIGHT;
+ no_label = true;
+ } else {
+ y_scale = PACK_TRACK_HEIGHT;
+ no_label = false;
+ }
+
+ // Calculate new slots incrementally for this new chunk of data and update height if necessary.
+ required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
+ slots = this.inc_slots[w_scale];
+ }
+
+ canvas.get(0).width = width + left_offset;
+ canvas.get(0).height = required_height;
+ if (result.dataset_type == "summary_tree") {
+ // Increase canvas height in order to display max label.
+ canvas.get(0).height += LABEL_SPACING + CHAR_HEIGHT_PX;
+ }
+ parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px");
+ // console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
+ var ctx = canvas.get(0).getContext("2d");
+ ctx.fillStyle = block_color;
+ ctx.font = this.default_font;
+ ctx.textAlign = "right";
+ this.container_div.find(".yaxislabel").remove();
+
+ //
+ // Draw summary tree. If tree is drawn, canvas is returned.
+ //
+ if (result.dataset_type == "summary_tree") {
+ var
+ // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
+ // start. However, height of each rectangle is relative to required_height; hence, the
+ // max rectangle is required_height.
+ base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
+ points = result.data,
+ max = result.max,
+ delta_x_px = Math.ceil(result.delta * w_scale);
+
+ var max_label = $("<div />").addClass('yaxislabel');
+ max_label.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 );
+ var y = points[i][1];
+
+ if (!y) { continue; }
+ var y_px = y / max * required_height;
+
+ ctx.fillStyle = "black";
+ ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
+
+ // Draw number count if it can fit the number with some padding, otherwise things clump up
+ var text_padding_req_x = 4;
+ if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
+ ctx.fillStyle = "#666";
+ ctx.textAlign = "center";
+ ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
+ }
+ }
+ return canvas;
+ }
+
+ //
+ // If there is a message, show it; also, return if there's no data to draw.
+ // FIXME: Why is this drawn on a canvas instead of a div?
+ if (result.message) {
+ canvas.css({
+ "border-color": "red"
+ });
+
+ ctx.fillStyle = "red";
+ ctx.textAlign = "left";
+ ctx.fillText(result.message, 100 + left_offset, y_scale);
+
+ // If there's no data, return.
+ if (!result.data) {
+ return canvas;
+ }
+ }
+
+ //
+ // If tile is filterable, add class to canvas.
+ //
+ for (var f = 0; f < this.filters.length; f++) {
+ if (result.data.length && this.filters[f].applies_to(result.data[0])) {
+ canvas.addClass(FILTERABLE_CLASS);
+ break;
+ }
+ }
+
+ //
+ // Draw data points.
+ //
+ var data = result.data;
+
+ // Set mode in Auto; never use Dense, so decide b/t Squish and Pack.
+ if (mode == "Auto" && data.length > 0) {
+ if (feature.length <= 4) {
+ mode = "Squish";
+ }
+ else {
+ mode = "Pack";
+ }
+ }
+
+ for (var i = 0, len = data.length; i < len; i++) {
+ var feature = data[i],
+ feature_uid = feature[0],
+ feature_start = feature[1],
+ // -1 b/c intervals are half-open.
+ feature_end = feature[2] - 1,
+ feature_name = feature[3];
+
+ // TODO: why is this necessary? Without explicitly short-circuiting it, it prevents dense mode from rendering.
+ if (this.mode != "Dense" && slots[feature_uid] === undefined) {
+ continue;
+ }
+
+ // Apply filters to feature.
+ var hide_feature = false;
+ var filter;
+ for (var f = 0; f < this.filters.length; f++) {
+ filter = this.filters[f];
+ filter.update_attrs( feature );
+ if ( !filter.keep( feature ) ) {
+ hide_feature = true;
+ break;
+ }
+ }
+ if (hide_feature) {
+ continue;
+ }
+
+ if (feature_start <= tile_high && feature_end >= tile_low) {
+ // All features need a start, end, and vertical center.
+ var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
+ y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
+ var thickness, y_start, thick_start = null, thick_end = null;
+
+ //
+ // There are really four modes for interval indices:
+ // dense, no_detail, squish, pack.
+ //
+
+ // Dense mode displays the same for all data.
+ if (mode == "Dense") {
+ ctx.fillStyle = block_color;
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
+ }
+ // Mode is either Squish or Pack:
+ else if (feature.length <= 4) {
+ // No details for feature, so only one way to display.
+ ctx.fillStyle = block_color;
+ // TODO: what should width be here?
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
+ } else {
+ // Feature has details.
+ var feature_strand = feature[5],
+ feature_ts = feature[6],
+ feature_te = feature[7],
+ feature_blocks = feature[8];
+
+ if (feature_ts && feature_te) {
+ thick_start = Math.floor( Math.max(0, (feature_ts - tile_low) * w_scale) );
+ thick_end = Math.ceil( Math.min(width, Math.max(0, (feature_te - tile_low) * w_scale)) );
+ }
+
+ // Set vars that depend on mode.
+ var thin_height, thick_height;
+ if (mode == "Squish") {
+ thin_height = 1;
+ thick_height = SQUISH_FEATURE_HEIGHT;
+ }
+ else { // mode == "Pack"
+ thin_height = 5;
+ thick_height = PACK_FEATURE_HEIGHT;
+ }
+
+ // Draw feature/feature blocks + connectors.
+ if (!feature_blocks) {
+ // If there are no blocks, treat the feature as one big exon.
+ if ( feature.strand ) {
+ if (feature.strand == "+") {
+ ctx.fillStyle = RIGHT_STRAND_INV;
+ } else if (feature.strand == "-") {
+ ctx.fillStyle = LEFT_STRAND_INV;
+ }
+ }
+ else { // No strand.
+ ctx.fillStyle = CONNECTOR_COLOR;
+ }
+ ctx.fillRect(f_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
+ f_end - f_start, thick_height);
+ }
+ else {
+ // There are feature blocks and mode is either Squish or Pack.
+ //
+ // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as
+ // needed. This ensures that whole feature, regardless of whether it starts with
+ // a block, is visible.
+ //
+
+ // Draw whole feature as connector/intron.
+ var cur_y_center, cur_height;
+ if (mode == "Squish") {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ cur_y_center = y_center + Math.floor(SQUISH_FEATURE_HEIGHT/2) + 1;
+ cur_height = 1;
+ }
+ else { // mode == "Pack"
+ if (feature_strand) {
+ var cur_y_center = y_center;
+ var cur_height = thick_height;
+ if (feature_strand == "+") {
+ ctx.fillStyle = RIGHT_STRAND;
+ } else if (feature_strand == "-") {
+ ctx.fillStyle = LEFT_STRAND;
+ }
+ }
+ else {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ cur_y_center += (SQUISH_FEATURE_HEIGHT/2) + 1;
+ cur_height = 1;
+ }
+ }
+ ctx.fillRect(f_start + left_offset, cur_y_center, f_end - f_start, cur_height);
+
+ for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) {
+ var block = feature_blocks[k],
+ block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
+ block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) );
+
+ // Skip drawing if block not on tile.
+ if (block_start > block_end) { continue; }
+
+ // Draw thin block.
+ ctx.fillStyle = block_color;
+ ctx.fillRect(block_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
+ block_end - block_start, thin_height);
+
+ // If block intersects with thick region, draw block as thick.
+ if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) {
+ var block_thick_start = Math.max(block_start, thick_start),
+ // -1 b/c intervals are half-open.
+ block_thick_end = Math.min(block_end, thick_end-1);
+ ctx.fillRect(block_thick_start + left_offset, y_center + 1,
+ block_thick_end - block_thick_start, thick_height);
+ }
+ }
+ }
+
+ // Draw label for Pack mode.
+ if (mode == "Pack" && feature_start > tile_low) {
+ ctx.fillStyle = label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
+ } else {
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
+ }
+ ctx.fillStyle = block_color;
+ }
+ }
+ }
+ }
+ return canvas;
+ }
+});
+
+var VcfTrack = function(name, view, hda_ldda, dataset_id, prefs, filters) {
+ FeatureTrack.call(this, name, view, hda_ldda, dataset_id, prefs, filters);
+ this.track_type = "VcfTrack";
+};
+
+$.extend(VcfTrack.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
+ /**
+ * Draw VcfTrack tile.
+ */
+ draw_tile: function(resolution, tile_index, parent_element, w_scale) {
+ var tile_low = tile_index * DENSITY * resolution,
+ tile_high = ( tile_index + 1 ) * DENSITY * resolution,
+ tile_span = tile_high - tile_low;
+ //console.log("drawing " + tile_low + " to " + tile_high);
+
+ /*for (var k in this.data_cache.obj_cache) {
+ var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
+ if (k_low <= tile_low && k_high >= tile_high) {
+ data = this.data_cache.get(k);
+ break;
+ }
+ }*/
+
+ //
+ // Get tile data; if data not available, issue get_data request and return.
+ //
+ var result = this.data_cache.get_data(tile_low, tile_high, this.mode);
+ if (result === undefined || result === "pending" ||
+ (this.mode !== "Auto" && result.dataset_type === "summary_tree")) {
+ this.data_queue[ [tile_low, tile_high] ] = true;
+ this.get_data(tile_low, tile_high);
+ return;
+ }
+ //
+ // Create/set/compute some useful vars.
+ //
+ var width = Math.ceil( tile_span * w_scale ),
+ label_color = this.prefs.label_color,
+ block_color = this.prefs.block_color,
+ mode = this.mode,
+ min_height = 25,
+ no_label,
+ left_offset = this.left_offset,
+ slots, required_height, y_scale;
+
+ var canvas = document.createElement("canvas");
+ if (window.G_vmlCanvasManager) { G_vmlCanvasManager.initElement(canvas); } // EXCANVAS HACK
+ canvas = $(canvas);
+
+ if (result.dataset_type === "summary_tree") {
+ required_height = this.summary_draw_height;
+ } else if (mode === "Dense") {
+ required_height = min_height;
+ y_scale = DENSE_TRACK_HEIGHT;
+ } else {
+ // Set y_scale based on mode and result data.
+ if (mode === "Squish") {
+ y_scale = SQUISH_TRACK_HEIGHT;
+ no_label = true;
+ } else if (mode === "Pack") {
+ y_scale = PACK_TRACK_HEIGHT;
+ // TODO: is there data where there is no label even in pack mode?
+ no_label = false;
+ } else if (result.extra_info === "no_detail") { // mode == "Auto"
+ y_scale = NO_DETAIL_TRACK_HEIGHT;
+ no_label = true;
+ } else {
+ y_scale = PACK_TRACK_HEIGHT;
+ no_label = false;
+ }
+
+ // Calculate new slots incrementally for this new chunk of data and update height if necessary.
+ required_height = this.incremental_slots(w_scale, result.data, no_label, mode) * y_scale + min_height;
+ slots = this.inc_slots[w_scale];
+ }
+
+ canvas.get(0).width = width + left_offset;
+ canvas.get(0).height = required_height;
+ if (result.dataset_type == "summary_tree") {
+ // Increase canvas height in order to display max label.
+ canvas.get(0).height += LABEL_SPACING + CHAR_HEIGHT_PX;
+ }
+ parent_element.parent().css("height", Math.max(this.height_px, required_height) + "px");
+ // console.log(( tile_low - this.view.low ) * w_scale, tile_index, w_scale);
+ var ctx = canvas.get(0).getContext("2d");
+ ctx.fillStyle = block_color;
+ ctx.font = this.default_font;
+ ctx.textAlign = "right";
+ this.container_div.find(".yaxislabel").remove();
+
+ //
+ // Draw summary tree. If tree is drawn, canvas is returned.
+ //
+ if (result.dataset_type == "summary_tree") {
+ var
+ // Set base Y so that max label and data do not overlap. Base Y is where rectangle bases
+ // start. However, height of each rectangle is relative to required_height; hence, the
+ // max rectangle is required_height.
+ base_y = required_height + LABEL_SPACING + CHAR_HEIGHT_PX;
+ points = result.data,
+ max = result.max,
+ delta_x_px = Math.ceil(result.delta * w_scale);
+
+ var max_label = $("<div />").addClass('yaxislabel');
+ max_label.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 );
+ var y = points[i][1];
+
+ if (!y) { continue; }
+ var y_px = y / max * required_height;
+
+ ctx.fillStyle = "black";
+ ctx.fillRect(x + left_offset, base_y - y_px, delta_x_px, y_px);
+
+ // Draw number count if it can fit the number with some padding, otherwise things clump up
+ var text_padding_req_x = 4;
+ if (this.prefs.show_counts && (ctx.measureText(y).width + text_padding_req_x) < delta_x_px) {
+ ctx.fillStyle = "#666";
+ ctx.textAlign = "center";
+ ctx.fillText(y, x + left_offset + (delta_x_px/2), 10);
+ }
+ }
+ return canvas;
+ }
+
+ //
+ // If there is a message, show it; also, return if there's no data to draw.
+ // FIXME: Why is this drawn on a canvas instead of a div?
+ if (result.message) {
+ canvas.css({
+ "border-color": "red"
+ });
+
+ ctx.fillStyle = "red";
+ ctx.textAlign = "left";
+ ctx.fillText(result.message, 100 + left_offset, y_scale);
+
+ // If there's no data, return.
+ if (!result.data) {
+ return canvas;
+ }
+ }
+
+ //
+ // If tile is filterable, add class to canvas.
+ //
+ for (var f = 0; f < this.filters.length; f++) {
+ if (result.data.length && this.filters[f].applies_to(result.data[0])) {
+ canvas.addClass(FILTERABLE_CLASS);
+ break;
+ }
+ }
+
+ //
+ // Draw data points.
+ //
+ var data = result.data;
+ for (var i = 0, len = data.length; i < len; i++) {
+ var feature = data[i],
+ feature_uid = feature[0],
+ feature_start = feature[1],
+ // -1 b/c intervals are half-open.
+ feature_end = feature[2] - 1,
+ feature_name = feature[3];
+
+ // TODO: why is this necessary? Without explicitly short-circuiting it, it prevents dense mode from rendering.
+ if (this.mode != "Dense" && slots[feature_uid] === undefined) {
+ continue;
+ }
+
+ // Apply filters to feature.
+ var hide_feature = false;
+ var filter;
+ for (var f = 0; f < this.filters.length; f++) {
+ filter = this.filters[f];
+ filter.update_attrs( feature );
+ if ( !filter.keep( feature ) ) {
+ hide_feature = true;
+ break;
+ }
+ }
+ if (hide_feature) {
+ continue;
+ }
+
+ if (feature_start <= tile_high && feature_end >= tile_low) {
+ // All features need a start, end, and vertical center.
+ var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
+ f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
+ y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
+ var thickness, y_start, thick_start = null, thick_end = null;
+
+
+ if (no_label) {
+ ctx.fillStyle = block_color;
+ ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, 1);
+ }
+ else { // Show blocks, labels, etc.
+ // Unpack.
+ var ref_base = feature[4], alt_base = feature[5], qual = feature[6];
+
+ // Draw block for entry.
+ thickness = 9;
+ y_start = 1;
+ ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, thickness);
+
+ // Add label for entry.
+ if (mode !== "Dense" && feature_name !== undefined && feature_start > tile_low) {
+ // Draw label
+ ctx.fillStyle = label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + 2 + left_offset, y_center + 8);
+ } else {
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start - 2 + left_offset, y_center + 8);
+ }
+ ctx.fillStyle = block_color;
+ }
+
+ // Show additional data on block.
+ var vcf_label = ref_base + " / " + alt_base;
+ if (feature_start > tile_low && ctx.measureText(vcf_label).width < (f_end - f_start)) {
+ ctx.fillStyle = "white";
+ ctx.textAlign = "center";
+ ctx.fillText(vcf_label, left_offset + f_start + (f_end-f_start)/2, y_center + 8);
+ ctx.fillStyle = block_color;
+ }
+ }
+ }
+ }
+ return canvas;
+ }
+});
+
+var ReadTrack = function (name, view, hda_ldda, dataset_id, prefs, filters) {
+ FeatureTrack.call(this, name, view, hda_ldda, dataset_id, prefs, filters);
+ this.track_type = "ReadTrack";
+};
+$.extend(ReadTrack.prototype, TiledTrack.prototype, FeatureTrack.prototype, {
+ /**
+ * Draw a single read.
+ */
+ draw_read: function(ctx, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center) {
ctx.textAlign = "center";
var
tile_region = [tile_low, tile_high],
@@ -2411,11 +2991,14 @@
ctx.drawDownwardEquilateralTriangle(item[0], item[1], item[2]);
}
},
+ /**
+ * Draw ReadTrack tile.
+ */
draw_tile: function(resolution, tile_index, parent_element, w_scale) {
var tile_low = tile_index * DENSITY * resolution,
tile_high = ( tile_index + 1 ) * DENSITY * resolution,
tile_span = tile_high - tile_low;
- //console.log("drawing " + tile_low + " to " + tile_high);
+ //console.log("ReadTrack: drawing " + tile_low + " to " + tile_high);
/*for (var k in this.data_cache.obj_cache) {
var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
@@ -2466,7 +3049,7 @@
// TODO: is there data where there is no label even in pack mode?
no_label = false;
} else if (result.extra_info === "no_detail") { // mode == "Auto"
- y_scale = (result.track_type === "bai" ? SQUISH_TRACK_HEIGHT : NO_DETAIL_TRACK_HEIGHT);
+ y_scale = SQUISH_TRACK_HEIGHT;
no_label = true;
} else {
y_scale = PACK_TRACK_HEIGHT;
@@ -2532,9 +3115,8 @@
return canvas;
}
-
//
- // Show message. If there is a message, return canvas.
+ // If there is a message, show it; also, return if there's no data to draw.
// FIXME: Why is this drawn on a canvas instead of a div?
if (result.message) {
canvas.css({
@@ -2551,21 +3133,10 @@
}
}
- //
- // If tile is filterable, add class to canvas.
//
- for (var f = 0; f < this.filters.length; f++) {
- if (result.data.length && this.filters[f].applies_to(result.data[0])) {
- canvas.addClass(FILTERABLE_CLASS);
- break;
- }
- }
-
- //
- // Draw data points.
+ // Draw reads.
//
var data = result.data;
- var j = 0;
for (var i = 0, len = data.length; i < len; i++) {
var feature = data[i],
feature_uid = feature[0],
@@ -2577,268 +3148,60 @@
if (this.mode != "Dense" && slots[feature_uid] === undefined) {
continue;
}
-
- // Apply filters to feature.
- var hide_feature = false;
- var filter;
- for (var f = 0; f < this.filters.length; f++) {
- filter = this.filters[f];
- filter.update_attrs( feature );
- if ( !filter.keep( feature ) ) {
- hide_feature = true;
- break;
- }
- }
- if (hide_feature) {
- continue;
- }
-
+
if (feature_start <= tile_high && feature_end >= tile_low) {
- // -1 b/c intervals are half-open.
- if (result.dataset_type == "interval_index") {
- feature_end -= 1;
- }
-
// All features need a start, end, and vertical center.
var f_start = Math.floor( Math.max(0, (feature_start - tile_low) * w_scale) ),
f_end = Math.ceil( Math.min(width, Math.max(0, (feature_end - tile_low) * w_scale)) ),
y_center = (mode === "Dense" ? 1 : (1 + slots[feature_uid])) * y_scale;
var thickness, y_start, thick_start = null, thick_end = null;
- // BAM/read drawing.
- if (result.dataset_type === "bai") {
+ // Draw read.
+ ctx.fillStyle = block_color;
+ if (feature[5] instanceof Array) {
+ // Read is paired.
+ 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)) );
+
+ // Draw left/forward read.
+ if (feature[4][1] >= tile_low && feature[4][0] <= tile_high && feature[4][2]) {
+ this.draw_read(ctx, w_scale, tile_low, tile_high, feature[4][0], feature[4][2], feature[4][3], y_center);
+ }
+ // Draw right/reverse read.
+ if (feature[5][1] >= tile_low && feature[5][0] <= tile_high && feature[5][2]) {
+ this.draw_read(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], feature[5][3], y_center);
+ }
+ // Draw connector.
+ if (b2_start > b1_end) {
+ ctx.fillStyle = CONNECTOR_COLOR;
+ //ctx.fillRect(b1_end + left_offset, y_center + 5, b2_start - b1_end, 1);
+ ctx.dashedLine(b1_end + left_offset, y_center + 5, left_offset + b2_start, y_center + 5);
+ }
+ } else {
+ // Read is single.
ctx.fillStyle = block_color;
- if (feature[5] instanceof Array) {
- // Read is paired.
- 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)) );
-
- // Draw left/forward read.
- if (feature[4][1] >= tile_low && feature[4][0] <= tile_high && feature[4][2]) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[4][0], feature[4][2], feature[4][3], y_center);
- }
- // Draw right/reverse read.
- if (feature[5][1] >= tile_low && feature[5][0] <= tile_high && feature[5][2]) {
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature[5][0], feature[5][2], feature[5][3], y_center);
- }
- // Draw connector.
- if (b2_start > b1_end) {
- ctx.fillStyle = CONNECTOR_COLOR;
- //ctx.fillRect(b1_end + left_offset, y_center + 5, b2_start - b1_end, 1);
- ctx.dashedLine(b1_end + left_offset, y_center + 5, left_offset + b2_start, y_center + 5);
- }
+ this.draw_read(ctx, w_scale, tile_low, tile_high, feature_start, feature[4], feature[5], y_center);
+ }
+ if (mode !== "Dense" && !no_label && feature_start > tile_low) {
+ // Draw label.
+ ctx.fillStyle = this.prefs.label_color;
+ if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
+ ctx.textAlign = "left";
+ ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
} else {
- // Read is single.
- ctx.fillStyle = block_color;
- this.rect_or_text(ctx, w_scale, tile_low, tile_high, feature_start, feature[4], feature[5], y_center);
+ ctx.textAlign = "right";
+ ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
}
- if (mode !== "Dense" && !no_label && feature_start > tile_low) {
- // Draw label.
- ctx.fillStyle = this.prefs.label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
+ ctx.fillStyle = block_color;
}
- // Interval index drawing.
- else if (result.dataset_type === "interval_index") {
- //
- // There are really four modes for interval indices:
- // dense, no_detail, squish, pack.
- //
-
- // TODO: move this code out of loop.
- // Set mode in Auto
- if (mode == "Auto") {
- // Never use dense when in auto mode.
- // TODO: decide when to use squish and when to use pack.
- if (feature.length <= 4) {
- mode = "Squish";
- }
- else {
- mode = "Pack";
- }
- }
-
- // Dense mode displays the same for all data.
- if (mode == "Dense") {
- ctx.fillStyle = block_color;
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
- }
- // Mode is either Squish or Pack:
- else if (feature.length <= 4) {
- // No details for feature, so only one way to display.
- ctx.fillStyle = block_color;
- // TODO: what should width be here?
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, DENSE_FEATURE_HEIGHT);
- } else {
- // Feature has details.
- var feature_strand = feature[5],
- feature_ts = feature[6],
- feature_te = feature[7],
- feature_blocks = feature[8];
-
- if (feature_ts && feature_te) {
- thick_start = Math.floor( Math.max(0, (feature_ts - tile_low) * w_scale) );
- thick_end = Math.ceil( Math.min(width, Math.max(0, (feature_te - tile_low) * w_scale)) );
- }
-
- // Set vars that depend on mode.
- var thin_height, thick_height;
- if (mode == "Squish") {
- thin_height = 1;
- thick_height = SQUISH_FEATURE_HEIGHT;
- }
- else { // mode == "Pack"
- thin_height = 5;
- thick_height = PACK_FEATURE_HEIGHT;
- }
-
- // Draw feature/feature blocks + connectors.
- if (!feature_blocks) {
- // If there are no blocks, treat the feature as one big exon.
- if ( feature.strand ) {
- if (feature.strand == "+") {
- ctx.fillStyle = RIGHT_STRAND_INV;
- } else if (feature.strand == "-") {
- ctx.fillStyle = LEFT_STRAND_INV;
- }
- }
- else { // No strand.
- ctx.fillStyle = CONNECTOR_COLOR;
- }
- ctx.fillRect(f_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
- f_end - f_start, thick_height);
- }
- else {
- // There are feature blocks and mode is either Squish or Pack.
- //
- // Approach: (a) draw whole feature as connector/intron and (b) draw blocks as
- // needed. This ensures that whole feature, regardless of whether it starts with
- // a block, is visible.
- //
-
- // Draw whole feature as connector/intron.
- var cur_y_center, cur_height;
- if (mode == "Squish") {
- ctx.fillStyle = CONNECTOR_COLOR;
- cur_y_center = y_center + Math.floor(SQUISH_FEATURE_HEIGHT/2) + 1;
- cur_height = 1;
- }
- else { // mode == "Pack"
- if (feature_strand) {
- var cur_y_center = y_center;
- var cur_height = thick_height;
- if (feature_strand == "+") {
- ctx.fillStyle = RIGHT_STRAND;
- } else if (feature_strand == "-") {
- ctx.fillStyle = LEFT_STRAND;
- }
- }
- else {
- ctx.fillStyle = CONNECTOR_COLOR;
- cur_y_center += (SQUISH_FEATURE_HEIGHT/2) + 1;
- cur_height = 1;
- }
- }
- ctx.fillRect(f_start + left_offset, cur_y_center, f_end - f_start, cur_height);
-
- for (var k = 0, k_len = feature_blocks.length; k < k_len; k++) {
- var block = feature_blocks[k],
- block_start = Math.floor( Math.max(0, (block[0] - tile_low) * w_scale) ),
- block_end = Math.ceil( Math.min(width, Math.max((block[1] - tile_low) * w_scale)) );
-
- // Skip drawing if block not on tile.
- if (block_start > block_end) { continue; }
-
- // Draw thin block.
- ctx.fillStyle = block_color;
- ctx.fillRect(block_start + left_offset, y_center + (thick_height-thin_height)/2 + 1,
- block_end - block_start, thin_height);
-
- // If block intersects with thick region, draw block as thick.
- if (thick_start !== undefined && !(block_start > thick_end || block_end < thick_start) ) {
- var block_thick_start = Math.max(block_start, thick_start),
- // -1 b/c intervals are half-open.
- block_thick_end = Math.min(block_end, thick_end-1);
- ctx.fillRect(block_thick_start + left_offset, y_center + 1,
- block_thick_end - block_thick_start, thick_height);
- }
- }
- }
-
- // Draw label for Pack mode.
- if (mode == "Pack" && feature_start > tile_low) {
- ctx.fillStyle = label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + left_offset + LABEL_SPACING, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start + left_offset - LABEL_SPACING, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
- }
- } else if (result.dataset_type === 'vcf') {
- // VCF track.
- if (no_label) {
- ctx.fillStyle = block_color;
- ctx.fillRect(f_start + left_offset, y_center + 5, f_end - f_start, 1);
- }
- else { // Show blocks, labels, etc.
- // Unpack.
- var ref_base = feature[4], alt_base = feature[5], qual = feature[6];
-
- // Draw block for entry.
- thickness = 9;
- y_start = 1;
- ctx.fillRect(f_start + left_offset, y_center, f_end - f_start, thickness);
-
- // Add label for entry.
- if (mode !== "Dense" && feature_name !== undefined && feature_start > tile_low) {
- // Draw label
- ctx.fillStyle = label_color;
- if (tile_index === 0 && f_start - ctx.measureText(feature_name).width < 0) {
- ctx.textAlign = "left";
- ctx.fillText(feature_name, f_end + 2 + left_offset, y_center + 8);
- } else {
- ctx.textAlign = "right";
- ctx.fillText(feature_name, f_start - 2 + left_offset, y_center + 8);
- }
- ctx.fillStyle = block_color;
- }
-
- // Show additional data on block.
- var vcf_label = ref_base + " / " + alt_base;
- if (feature_start > tile_low && ctx.measureText(vcf_label).width < (f_end - f_start)) {
- ctx.fillStyle = "white";
- ctx.textAlign = "center";
- ctx.fillText(vcf_label, left_offset + f_start + (f_end-f_start)/2, y_center + 8);
- ctx.fillStyle = block_color;
- }
- }
- }
- j++;
}
}
return canvas;
}
});
-var ReadTrack = function (name, view, hda_ldda, dataset_id, prefs, filters) {
- FeatureTrack.call(this, name, view, hda_ldda, dataset_id, prefs, filters);
- this.track_type = "ReadTrack";
-};
-$.extend( ReadTrack.prototype, TiledTrack.prototype, FeatureTrack.prototype, {});
-
/**
* Feature track that displays data generated from tool.
*/
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: greg: Fix the folder popup menu when browsing a deleted folder in a data library, and fis the broken display of deleted library items.
by Bitbucket 21 Feb '11
by Bitbucket 21 Feb '11
21 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/ca53c664778e/
changeset: r5099:ca53c664778e
user: greg
date: 2011-02-21 21:10:22
summary: Fix the folder popup menu when browsing a deleted folder in a data library, and fis the broken display of deleted library items.
affected #: 1 file (153 bytes)
--- a/templates/library/common/browse_library.mako Mon Feb 21 14:00:39 2011 -0500
+++ b/templates/library/common/browse_library.mako Mon Feb 21 15:10:22 2011 -0500
@@ -357,55 +357,55 @@
><td style="padding-left: ${folder_pad}px;"><input type="checkbox" class="folderCheckbox"/>
- %if folder.deleted:
- <span class="libraryItem-error">
- %endif
- <span class="expandLink folder-${encoded_id}-click"><span class="rowIcon"></span>
+ <span class="expandLink folder-${encoded_id}-click"><div style="float: left; margin-left: 2px;" class="menubutton split popup" id="folder_img-${folder.id}-popup">
- <a class="folder-${encoded_id}-click" href="javascript:void(0);">${folder.name}</a>
+ <a class="folder-${encoded_id}-click" href="javascript:void(0);">
+ %if folder.deleted:
+ <span class="libraryItem-error">
+ ${folder.name}
+ </span>
+ %else:
+ ${folder.name}
+ %endif
+ </a></div>
- %if folder.deleted:
- </span>
- %endif
- %if not branch_deleted( folder ):
- %if not library.deleted:
- <div popupmenu="folder_img-${folder.id}-popup">
- %if not branch_deleted( folder ) and can_add:
- <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add datasets</a>
- <a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add sub-folder</a>
- %endif
- %if not branch_deleted( folder ):
- %if self.has_accessible_datasets:
- <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Select datasets for import into selected histories</a>
- %endif
- %if can_modify:
- <a class="action-button" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
- %else:
- <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
- %endif
- %endif
- %if not branch_deleted( folder ) and can_modify and not info_association:
- <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
- %endif
- %if not branch_deleted( folder ) and can_modify and info_association:
- <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
- <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
- %endif
- %if not branch_deleted( folder ) and can_manage:
- %if not trans.app.security_agent.folder_is_public( folder ):
- <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='folder', id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
- %endif
- <a class="action-button" href="${h.url_for( controller='library_common', action='folder_permissions', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
+ %if not library.deleted:
+ <div popupmenu="folder_img-${folder.id}-popup">
+ %if not branch_deleted( folder ) and can_add:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='upload_library_dataset', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add datasets</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='create_folder', cntrller=cntrller, parent_id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Add sub-folder</a>
+ %endif
+ %if not branch_deleted( folder ):
+ %if self.has_accessible_datasets:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='import_datasets_to_histories', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Select datasets for import into selected histories</a>
%endif
%if can_modify:
- %if not library.deleted and not folder.deleted:
- <a class="action-button" confirm="Click OK to delete the folder '${folder.name}.'" href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Delete this folder</a>
- %elif not library.deleted and folder.deleted and not folder.purged:
- <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Undelete this folder</a>
- %endif
+ <a class="action-button" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit information</a>
+ %else:
+ <a class="action-button" class="view-info" href="${h.url_for( controller='library_common', action='folder_info', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">View information</a>
%endif
- </div>
- %endif
+ %endif
+ %if not branch_deleted( folder ) and can_modify and not info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='add_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Use template</a>
+ %endif
+ %if not branch_deleted( folder ) and can_modify and info_association:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='edit_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit template</a>
+ <a class="action-button" href="${h.url_for( controller='library_common', action='delete_template', cntrller=cntrller, item_type='folder', form_type=form_type, library_id=trans.security.encode_id( library.id ), folder_id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Unuse template</a>
+ %endif
+ %if not branch_deleted( folder ) and can_manage:
+ %if not trans.app.security_agent.folder_is_public( folder ):
+ <a class="action-button" href="${h.url_for( controller='library_common', action='make_library_item_public', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_type='folder', id=trans.security.encode_id( folder.id ), use_panels=use_panels, show_deleted=show_deleted )}">Make public</a>
+ %endif
+ <a class="action-button" href="${h.url_for( controller='library_common', action='folder_permissions', cntrller=cntrller, id=trans.security.encode_id( folder.id ), library_id=trans.security.encode_id( library.id ), use_panels=use_panels, show_deleted=show_deleted )}">Edit permissions</a>
+ %endif
+ %if can_modify:
+ %if not library.deleted and not folder.deleted:
+ <a class="action-button" confirm="Click OK to delete the folder '${folder.name}.'" href="${h.url_for( controller='library_common', action='delete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Delete this folder</a>
+ %elif not library.deleted and folder.deleted and not folder.purged:
+ <a class="action-button" href="${h.url_for( controller='library_common', action='undelete_library_item', cntrller=cntrller, library_id=trans.security.encode_id( library.id ), item_id=trans.security.encode_id( folder.id ), item_type='folder', show_deleted=show_deleted )}">Undelete this folder</a>
+ %endif
+ %endif
+ </div>
%endif
<td>
%if folder.description:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: jgoecks: Trackster: save and restore mode for feature and read tracks.
by Bitbucket 21 Feb '11
by Bitbucket 21 Feb '11
21 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/54dc9beb30ea/
changeset: r5098:54dc9beb30ea
user: jgoecks
date: 2011-02-21 20:00:39
summary: Trackster: save and restore mode for feature and read tracks.
affected #: 1 file (553 bytes)
--- a/static/scripts/trackster.js Mon Feb 21 11:49:24 2011 -0500
+++ b/static/scripts/trackster.js Mon Feb 21 14:00:39 2011 -0500
@@ -1318,13 +1318,16 @@
if (track.display_modes !== undefined) {
if (track.mode_div === undefined) {
track.mode_div = $("<div class='right-float menubutton popup' />").appendTo(track.header_div);
- var init_mode = track.display_modes[0];
+ var init_mode = (track.track_config && track.track_config.values['mode'] ?
+ track.track_config.values['mode'] : track.display_modes[0]);
track.mode = init_mode;
track.mode_div.text(init_mode);
var change_mode = function(name) {
track.mode_div.text(name);
+ // TODO: is it necessary to store the mode in two places (.mode and track_config)?
track.mode = name;
+ track.track_config.values['mode'] = name;
track.tile_cache.clear();
track.draw();
};
@@ -2046,9 +2049,33 @@
});
var FeatureTrack = function (name, view, hda_ldda, dataset_id, prefs, filters, tool, parent_track) {
+ //
+ // Preinitialization: do things that need to be done before calling Track and TiledTrack
+ // initialization code.
+ //
var track = this;
this.track_type = "FeatureTrack";
this.display_modes = ["Auto", "Dense", "Squish", "Pack"];
+ // Define and restore track configuration.
+ this.track_config = new TrackConfig( {
+ track: this,
+ params: [
+ { key: 'block_color', label: 'Block color', type: 'color', default_value: '#444' },
+ { key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
+ { key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true },
+ { key: 'mode', type: 'string', default_value: this.mode, hidden: true },
+ ],
+ saved_values: prefs,
+ onchange: function() {
+ track.tile_cache.clear();
+ track.draw();
+ }
+ });
+ this.prefs = this.track_config.values;
+
+ //
+ // Initialization.
+ //
Track.call(this, name, view, view.viewport_container);
TiledTrack.call(this, filters, tool, parent_track);
@@ -2068,23 +2095,6 @@
this.tile_cache = new Cache(CACHED_TILES_FEATURE);
this.data_cache = new DataCache(20);
this.left_offset = 200;
-
- // Define track configuration
- this.track_config = new TrackConfig( {
- track: this,
- params: [
- { key: 'block_color', label: 'Block color', type: 'color', default_value: '#444' },
- { key: 'label_color', label: 'Label color', type: 'color', default_value: 'black' },
- { key: 'show_counts', label: 'Show summary counts', type: 'bool', default_value: true }
- ],
- saved_values: prefs,
- onchange: function() {
- track.tile_cache.clear();
- track.draw();
- }
- });
-
- this.prefs = this.track_config.values;
};
$.extend( FeatureTrack.prototype, TiledTrack.prototype, {
get_data: function( low, high ) {
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

21 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/fda57df0aa20/
changeset: r5097:fda57df0aa20
user: jgoecks
date: 2011-02-21 17:49:24
summary: Trackster: enhancements to read track display: insertions and deletions now shown correctly, and some efficiency improvements made using overlap calculations. Added function to compute the type of overlap between two regions.
affected #: 2 files (8.0 KB)
--- a/static/scripts/packed/trackster.js Mon Feb 21 09:46:54 2011 -0500
+++ b/static/scripts/packed/trackster.js Mon Feb 21 11:49:24 2011 -0500
@@ -1,1 +1,1 @@
-CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,PACK_SPACING=5,DEFAULT_FONT="9px Monaco, Lucida Console, monospace",DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}var CONTEXT=DUMMY_CANVAS.getContext("2d");CONTEXT.font=DEFAULT_FONT;var CHAR_WIDTH_PX=CONTEXT.measureText("A").width,CHAR_HEIGHT_PX=9;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len-1;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var k=$("<div class='form-row' />").appendTo(a);k.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){k.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var i=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(i);var j=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(i).appendTo(k).bind("click",function(l){i.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){i.hide();$(document).unbind("click.color-picker")});l.stopPropagation()})}else{k.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(converted_datasets_state_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b.status==="data"){if(b.valid_chroms){a.valid_chroms=b.valid_chroms;a.name_div.data("menu_options")["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+a.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,j=g-m,c=this.view.container.width(),f=this.view.resolution;var p=$("<div style='position: relative;'></div>"),r=c/j;this.content_div.append(p);this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=0;while((a*DENSITY*f)<g){var n=c+"_"+r+"_"+a;var e=this.tile_cache.get(n);var k=a*DENSITY*this.view.resolution;var q=k+DENSITY*this.view.resolution;if(!b&&e){this.show_tile(e,p,k,r)}else{this.delayed_draw(b,n,k,q,a,f,p,r)}a+=1}var d=this;var o=setInterval(function(){if(l===0){var u=d.content_div.children();var t=false;for(var v=u.length-1,s=0;v>=s;v--){var x=$(u[v]);if(t){x.remove()}else{if(x.children().length!==0){t=true}}}for(var w=0;w<d.filters.length;w++){d.filters[w].update_ui_elt()}clearInterval(o)}},50);for(var h=0;h<this.child_tracks.length;h++){this.child_tracks[h].draw(b)}},delayed_draw:function(b,g,f,i,c,e,h,j){var d=this;var a=setTimeout(function(){if(f<=d.view.high&&i>=d.view.low){var k;if(!b){k=d.tile_cache.get(g)}if(!k){k=d.draw_tile(e,c,h,j);if(k){var l=$("<div class='track-tile'>").prepend(k);if(k.hasClass(FILTERABLE_CLASS)){l.addClass(FILTERABLE_CLASS)}k=l}}if(k){d.tile_cache.set(g,k);d.show_tile(k,h,f,j)}}},50)},show_tile:function(a,f,d,g){var b=this;var c=this.view.high-this.view.low,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.view.container.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>CHAR_WIDTH_PX){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font=DEFAULT_FONT;this.inc_slots={};this.data_queue={};this.start_end_dct={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,j,d,q){var r=this.inc_slots[a];if(!r||(r.mode!==q)){r={};r.w_scale=a;r.mode=q;this.inc_slots[a]=r;this.start_end_dct[a]={}}var m=r.w_scale,x=[],y=[],k=0,o=this.view.max_low;for(var v=0,w=j.length;v<w;v++){var h=j[v],l=h[0];if(r[l]!==undefined){k=Math.max(k,r[l]);y.push(r[l])}else{x.push(v)}}var e=this.start_end_dct[a];var n=function(D,E){for(var C=0;C<=MAX_FEATURE_DEPTH;C++){var A=false,F=e[C];if(F!==undefined){for(var z=0,B=F.length;z<B;z++){var i=F[z];if(E>i[0]&&D<i[1]){A=true;break}}}if(!A){return C}}return -1};for(var v=0,w=x.length;v<w;v++){var h=j[x[v]],l=h[0],t=h[1],b=h[2],p=h[3],c=Math.floor((t-o)*m),g=Math.ceil((b-o)*m),u=CONTEXT.measureText(p).width,f;if(p!==undefined&&!d){u+=(LABEL_SPACING+PACK_SPACING);if(c-u>=0){c-=u;f="left"}else{g+=u;f="right"}}var s=n(c,g);if(s>=0){if(e[s]===undefined){e[s]=[]}e[s].push([c,g]);r[l]=s;k=Math.max(k,s)}else{}}return k},rect_or_text:function(r,l,u,b,q,j,g,f){r.textAlign="center";var d=0,s=0,p=Math.round(l/2);for(var m=0,t=j.length;m<t;m++){var k=j[m],e="MIDNSHP=X"[k[0]],n=k[1];if(e==="H"||e==="S"){d-=n}var h=q+d,x=Math.floor(Math.max(0,(h-u)*l)),i=Math.floor(Math.max(0,(h+n-u)*l));switch(e){case"H":break;case"S":case"M":case"=":var o=g.slice(s,s+n);if((this.mode==="Pack"||this.mode==="Auto")&&g!==undefined&&l>CHAR_WIDTH_PX){r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+1,i-x,9);r.fillStyle=CONNECTOR_COLOR;for(var v=0,a=o.length;v<a;v++){if(h+v>=u&&h+v<=b){var w=Math.floor(Math.max(0,(h+v-u)*l));r.fillText(o[v],w+this.left_offset+p,f+9)}}}else{r.fillStyle=this.prefs.block_color;r.fillRect(x+this.left_offset,f+(this.mode!="Dense"?4:5),i-x,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}s+=n;break;case"N":r.fillStyle=CONNECTOR_COLOR;r.fillRect(x+this.left_offset,f+5,i-x,1);break;case"D":r.fillStyle="red";r.fillRect(x+this.left_offset,f+4,i-x,3);break;case"P":break;case"I":s+=n;break;case"X":s+=n;break}d+=n}},draw_tile:function(ae,m,q,au){var K=m*DENSITY*ae,aj=(m+1)*DENSITY*ae,J=aj-K;var G=this.data_cache.get_data(K,aj,this.mode);if(G===undefined||G==="pending"||(this.mode!=="Auto"&&G.dataset_type==="summary_tree")){this.data_queue[[K,aj]]=true;this.get_data(K,aj);return}var a=Math.ceil(J*au),ag=this.prefs.label_color,g=this.prefs.block_color,p=this.mode,u=25,aa,V=this.left_offset,at,B,av;var o=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(o)}o=$(o);if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(p==="Dense"){B=u;av=DENSE_TRACK_HEIGHT}else{if(p==="Squish"){av=SQUISH_TRACK_HEIGHT;aa=true}else{if(p==="Pack"){av=PACK_TRACK_HEIGHT;aa=false}else{if(G.extra_info==="no_detail"){av=(G.track_type==="bai"?SQUISH_TRACK_HEIGHT:NO_DETAIL_TRACK_HEIGHT);aa=true}else{av=PACK_TRACK_HEIGHT;aa=false}}}B=this.incremental_slots(au,G.data,aa,p)*av+u;at=this.inc_slots[au]}}o.get(0).width=a+V;o.get(0).height=B;if(G.dataset_type=="summary_tree"){o.get(0).height+=LABEL_SPACING+CHAR_HEIGHT_PX}q.parent().css("height",Math.max(this.height_px,B)+"px");var H=o.get(0).getContext("2d");H.fillStyle=g;H.font=this.default_font;H.textAlign="right";this.container_div.find(".yaxislabel").remove();if(G.dataset_type=="summary_tree"){var v=B+LABEL_SPACING+CHAR_HEIGHT_PX;points=G.data,max=G.max,delta_x_px=Math.ceil(G.delta*au);var n=$("<div />").addClass("yaxislabel");n.text(max);n.css({position:"absolute",top:"22px",left:"10px"});n.prependTo(this.container_div);for(var an=0,F=points.length;an<F;an++){var Z=Math.floor((points[an][0]-K)*au);var Y=points[an][1];if(!Y){continue}var ak=Y/max*B;H.fillStyle="black";H.fillRect(Z+V,v-ak,delta_x_px,ak);var X=4;if(this.prefs.show_counts&&(H.measureText(Y).width+X)<delta_x_px){H.fillStyle="#666";H.textAlign="center";H.fillText(Y,Z+V+(delta_x_px/2),10)}}return o}if(G.message){o.css({"border-color":"red"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+V,av);if(!G.data){return o}}for(var aq=0;aq<this.filters.length;aq++){if(G.data.length&&this.filters[aq].applies_to(G.data[0])){o.addClass(FILTERABLE_CLASS);break}}var ar=G.data;var am=0;for(var an=0,F=ar.length;an<F;an++){var R=ar[an],O=R[0],ap=R[1],ac=R[2],L=R[3];if(this.mode!="Dense"&&at[O]===undefined){continue}var ab=false;var T;for(var aq=0;aq<this.filters.length;aq++){T=this.filters[aq];T.update_attrs(R);if(!T.keep(R)){ab=true;break}}if(ab){continue}if(ap<=aj&&ac>=K){if(G.dataset_type=="interval_index"){ac-=1}var ad=Math.floor(Math.max(0,(ap-K)*au)),I=Math.ceil(Math.min(a,Math.max(0,(ac-K)*au))),W=(p==="Dense"?1:(1+at[O]))*av;var E,ah,M=null,aw=null;if(G.dataset_type==="bai"){H.fillStyle=g;if(R[5] instanceof Array){var C=Math.floor(Math.max(0,(R[4][0]-K)*au)),N=Math.ceil(Math.min(a,Math.max(0,(R[4][1]-K)*au))),A=Math.floor(Math.max(0,(R[5][0]-K)*au)),t=Math.ceil(Math.min(a,Math.max(0,(R[5][1]-K)*au)));if(R[4][1]>=K&&R[4][0]<=aj&&R[4][2]){this.rect_or_text(H,au,K,aj,R[4][0],R[4][2],R[4][3],W)}if(R[5][1]>=K&&R[5][0]<=aj&&R[5][2]){this.rect_or_text(H,au,K,aj,R[5][0],R[5][2],R[5][3],W)}if(A>N){H.fillStyle=CONNECTOR_COLOR;H.dashedLine(N+V,W+5,V+A,W+5)}}else{H.fillStyle=g;this.rect_or_text(H,au,K,aj,ap,R[4],R[5],W)}if(p!=="Dense"&&!aa&&ap>K){H.fillStyle=this.prefs.label_color;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}else{if(G.dataset_type==="interval_index"){if(p=="Auto"){if(R.length<=4){p="Squish"}else{p="Pack"}}if(p=="Dense"){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{if(R.length<=4){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{var D=R[5],U=R[6],af=R[7],e=R[8];if(U&&af){M=Math.floor(Math.max(0,(U-K)*au));aw=Math.ceil(Math.min(a,Math.max(0,(af-K)*au)))}var ao,P;if(p=="Squish"){ao=1;P=SQUISH_FEATURE_HEIGHT}else{ao=5;P=PACK_FEATURE_HEIGHT}if(!e){if(R.strand){if(R.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(R.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}}else{H.fillStyle=CONNECTOR_COLOR}H.fillRect(ad+V,W+(P-ao)/2+1,I-ad,P)}else{var z,Q;if(p=="Squish"){H.fillStyle=CONNECTOR_COLOR;z=W+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}else{if(D){var z=W;var Q=P;if(D=="+"){H.fillStyle=RIGHT_STRAND}else{if(D=="-"){H.fillStyle=LEFT_STRAND}}}else{H.fillStyle=CONNECTOR_COLOR;z+=(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}}H.fillRect(ad+V,z,I-ad,Q);for(var al=0,d=e.length;al<d;al++){var s=e[al],c=Math.floor(Math.max(0,(s[0]-K)*au)),S=Math.ceil(Math.min(a,Math.max((s[1]-K)*au)));if(c>S){continue}H.fillStyle=g;H.fillRect(c+V,W+(P-ao)/2+1,S-c,ao);if(M!==undefined&&!(c>aw||S<M)){var ai=Math.max(c,M),w=Math.min(S,aw-1);H.fillRect(ai+V,W+1,w-ai,P)}}}if(p=="Pack"&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}}}else{if(G.dataset_type==="vcf"){if(aa){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,1)}else{var r=R[4],l=R[5],b=R[6];E=9;ah=1;H.fillRect(ad+V,W,I-ad,E);if(p!=="Dense"&&L!==undefined&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+2+V,W+8)}else{H.textAlign="right";H.fillText(L,ad-2+V,W+8)}H.fillStyle=g}var h=r+" / "+l;if(ap>K&&H.measureText(h).width<(I-ad)){H.fillStyle="white";H.textAlign="center";H.fillText(h,V+ad+(I-ad)/2,W+8);H.fillStyle=g}}}}}am++}}return o}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
+CanvasRenderingContext2D.prototype.dashedLine=function(c,i,b,h,f){if(f==undefined){f=4}var e=b-c;var d=h-i;var g=Math.floor(Math.sqrt(e*e+d*d)/f);var k=e/g;var j=d/g;for(var a=0;a<g;a++,c+=k,i+=j){if(a%2!=0){continue}this.fillRect(c,i,f,1)}};CanvasRenderingContext2D.prototype.drawDownwardEquilateralTriangle=function(b,a,e){var d=b-e/2,c=b+e/2,f=a-Math.sqrt(e*3/2);this.beginPath();this.moveTo(d,f);this.lineTo(c,f);this.lineTo(b,a);this.lineTo(d,f);this.strokeStyle=this.fillStyle;this.fill();this.stroke();this.closePath()};function sortable(a,b){a.bind("drag",{handle:b,relative:true},function(h,j){var g=$(this).parent();var f=g.children();for(var c=0;c<f.length;c++){if(j.offsetY<$(f.get(c)).position().top){break}}if(c==f.length){if(this!=f.get(c-1)){g.append(this)}}else{if(this!=f.get(c)){$(this).insertBefore(f.get(c))}}})}var NO_OVERLAP=1001,CONTAINS=1002,OVERLAP_START=1003,OVERLAP_END=1004,CONTAINED_BY=1005;function compute_overlap(e,b){var g=e[0],f=e[1],d=b[0],c=b[1],a;if(g<d){if(f<d){a=NO_OVERLAP}else{if(f<=c){a=OVERLAP_START}else{a=CONTAINS}}}else{if(g>c){a=NO_OVERLAP}else{if(f<=c){a=CONTAINED_BY}else{a=OVERLAP_END}}}return a}function is_overlap(b,a){return(compute_overlap(b,a)!=NO_OVERLAP)}var DENSE_TRACK_HEIGHT=10,NO_DETAIL_TRACK_HEIGHT=3,SQUISH_TRACK_HEIGHT=5,PACK_TRACK_HEIGHT=10,NO_DETAIL_FEATURE_HEIGHT=DENSE_FEATURE_HEIGHT=1,SQUISH_FEATURE_HEIGHT=3,PACK_FEATURE_HEIGHT=9,LABEL_SPACING=2,PACK_SPACING=5,DEFAULT_FONT="9px Monaco, Lucida Console, monospace",DENSITY=200,FEATURE_LEVELS=10,MAX_FEATURE_DEPTH=100,DEFAULT_DATA_QUERY_WAIT=5000,MAX_CHROMS_SELECTABLE=100,CONNECTOR_COLOR="#ccc",DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_CANNOT_RUN_TOOL="Tool cannot be rerun: ",DATA_LOADING="Loading data...",DATA_OK="Ready for display",FILTERABLE_CLASS="filterable",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=5,CACHED_DATA=5,DUMMY_CANVAS=document.createElement("canvas"),RIGHT_STRAND,LEFT_STRAND;if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(DUMMY_CANVAS)}var CONTEXT=DUMMY_CANVAS.getContext("2d");CONTEXT.font=DEFAULT_FONT;var CHAR_WIDTH_PX=CONTEXT.measureText("A").width,CHAR_HEIGHT_PX=9;var right_img=new Image();right_img.src=image_path+"/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src=image_path+"/visualization/strand_left.png";left_img.onload=function(){LEFT_STRAND=CONTEXT.createPattern(left_img,"repeat")};var right_img_inv=new Image();right_img_inv.src=image_path+"/visualization/strand_right_inv.png";right_img_inv.onload=function(){RIGHT_STRAND_INV=CONTEXT.createPattern(right_img_inv,"repeat")};var left_img_inv=new Image();left_img_inv.src=image_path+"/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};function round_1000(a){return Math.round(a*1000)/1000}var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.move_key_to_end(b,a)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},move_key_to_end:function(b,a){this.key_ary.splice(a,1);this.key_ary.push(b)},clear:function(){this.obj_cache={};this.key_ary=[]},size:function(){return this.key_ary.length}});var DataCache=function(a){Cache.call(this,a)};$.extend(DataCache.prototype,Cache.prototype,{get_data:function(g,b,e){var h=this.get(this.gen_key(g,b,e));if(h){return h}var j,f,a,d,e,h;for(var c=0;c<this.key_ary.length;c++){j=this.key_ary[c];f=this.split_key(j);a=f[0];d=f[1];if(g>=a&&b<=d){h=this.obj_cache[j];if(h.dataset_type!=="summary_tree"&&h.extra_info!=="no_detail"){this.move_key_to_end(j,c);return h}}}return undefined},set_data:function(b,c,d,a){return this.set(this.gen_key(b,c,d),a)},gen_key:function(a,c,d){var b=a+"_"+c+"_"+d;return b},split_key:function(a){return a.split("_")}});var View=function(a,d,c,b,e){this.container=a;this.chrom=null;this.vis_id=c;this.dbkey=b;this.title=d;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.num_tracks=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init(e);this.reset()};$.extend(View.prototype,{init:function(d){var c=this.container,a=this;this.top_container=$("<div/>").addClass("top-container").appendTo(c);this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.bottom_container=$("<div/>").addClass("bottom-container").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.top_container);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.intro_div=$("<div/>").addClass("intro").text("Select a chrom from the dropdown below").hide();this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.bottom_container);this.nav_container=$("<div/>").addClass("nav-container").prependTo(this.top_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.bottom_container);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_close=$("<a href='javascript:void(0);'>Close Overview</a>").addClass("overview-close").hide().appendTo(this.overview_viewport);this.overview_highlight=$("<div/>").addClass("overview-highlight").hide().appendTo(this.overview_viewport);this.overview_box_background=$("<div/>").addClass("overview-boxback").appendTo(this.overview_viewport);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.default_overview_height=this.overview_box.height();this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form=$("<form/>").attr("action",function(){}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);var b=function(f){if(f.type==="focusout"||(f.keyCode||f.which)===13||(f.keyCode||f.which)===27){if((f.keyCode||f.which)!==27){a.go_to($(this).val())}$(this).hide();a.location_span.show();a.chrom_select.show();return false}};this.nav_input=$("<input/>").addClass("nav-input").hide().bind("keypress focusout",b).appendTo(this.chrom_form);this.location_span=$("<span/>").addClass("location").appendTo(this.chrom_form);this.location_span.bind("click",function(){a.location_span.hide();a.chrom_select.hide();a.nav_input.css("display","inline-block");a.nav_input.select();a.nav_input.focus()});if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zo_link=$("<a id='zoom-out' />").click(function(){a.zoom_out();a.redraw()}).appendTo(this.chrom_form);this.zi_link=$("<a id='zoom-in' />").click(function(){a.zoom_in();a.redraw()}).appendTo(this.chrom_form);this.load_chroms({low:0},d);this.chrom_select.bind("change",function(){a.change_chrom(a.chrom_select.val())});this.intro_div.show();this.content_div.bind("click",function(f){$(this).find("input").trigger("blur")});this.content_div.bind("dblclick",function(f){a.zoom_in(f.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(f,g){this.current_x=g.offsetX}).bind("drag",function(f,h){var i=h.offsetX-this.current_x;this.current_x=h.offsetX;var g=Math.round(i/a.viewport_container.width()*(a.max_high-a.max_low));a.move_delta(-g)});this.overview_close.bind("click",function(){for(var f=0,e=a.tracks.length;f<e;f++){a.tracks[f].is_overview=false}$(this).siblings().filter("canvas").remove();$(this).parent().css("height",a.overview_box.height());a.overview_highlight.hide();$(this).hide()});this.viewport_container.bind("draginit",function(f,g){if(f.clientX>a.viewport_container.width()-16){return false}}).bind("dragstart",function(f,g){g.original_low=a.low;g.current_height=f.clientY;g.current_x=g.offsetX}).bind("drag",function(h,j){var f=$(this);var k=j.offsetX-j.current_x;var g=f.scrollTop()-(h.clientY-j.current_height);f.scrollTop(g);j.current_height=h.clientY;j.current_x=j.offsetX;var i=Math.round(k/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}).bind("mousewheel",function(h,j,g,f){if(g){var i=Math.round(-g/a.viewport_container.width()*(a.high-a.low));a.move_delta(i)}});this.top_labeltrack.bind("dragstart",function(f,g){return $("<div />").css({height:a.content_div.height()+a.top_labeltrack.height()+a.nav_labeltrack.height()+1,top:"0px",position:"absolute","background-color":"#ccf",opacity:0.5,"z-index":1000}).appendTo($(this))}).bind("drag",function(j,k){$(k.proxy).css({left:Math.min(j.pageX,k.startX),width:Math.abs(j.pageX-k.startX)});var g=Math.min(j.pageX,k.startX)-a.container.offset().left,f=Math.max(j.pageX,k.startX)-a.container.offset().left,i=(a.high-a.low),h=a.viewport_container.width();a.update_location(Math.round(g/h*i)+a.low,Math.round(f/h*i)+a.low)}).bind("dragend",function(k,l){var g=Math.min(k.pageX,l.startX),f=Math.max(k.pageX,l.startX),i=(a.high-a.low),h=a.viewport_container.width(),j=a.low;a.low=Math.round(g/h*i)+j;a.high=Math.round(f/h*i)+j;$(l.proxy).remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack));$(window).bind("resize",function(){a.resize_window()});$(document).bind("redraw",function(){a.redraw()});this.reset();$(window).trigger("resize")},update_location:function(a,b){this.location_span.text(commatize(a)+" - "+commatize(b));this.nav_input.val(this.chrom+":"+commatize(a)+"-"+commatize(b))},load_chroms:function(b,c){b.num=MAX_CHROMS_SELECTABLE;$.extend(b,(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey}));var a=this;$.ajax({url:chrom_url,data:b,dataType:"json",success:function(e){if(e.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=e.chrom_info;var h='<option value="">Select Chrom/Contig</option>';for(var g=0,d=a.chrom_data.length;g<d;g++){var f=a.chrom_data[g].chrom;h+='<option value="'+f+'">'+f+"</option>"}if(e.prev_chroms){h+='<option value="previous">Previous '+MAX_CHROMS_SELECTABLE+"</option>"}if(e.next_chroms){h+='<option value="next">Next '+MAX_CHROMS_SELECTABLE+"</option>"}a.chrom_select.html(h);if(c){c()}a.chrom_start_index=e.start_index},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}})},change_chrom:function(e,b,g){if(!e||e==="None"){return}var d=this;if(e=="previous"){d.load_chroms({low:this.chrom_start_index-MAX_CHROMS_SELECTABLE});return}if(e=="next"){d.load_chroms({low:this.chrom_start_index+MAX_CHROMS_SELECTABLE});return}var f=$.grep(d.chrom_data,function(j,k){return j.chrom===e})[0];if(f===undefined){d.load_chroms({chrom:e},function(){d.change_chrom(e,b,g)});return}else{if(e!==d.chrom){d.chrom=e;if(!d.chrom){d.intro_div.show()}else{d.intro_div.hide()}d.chrom_select.val(d.chrom);d.max_high=f.len-1;d.reset();d.redraw(true);for(var h=0,a=d.tracks.length;h<a;h++){var c=d.tracks[h];if(c.init){c.init()}}}if(b!==undefined&&g!==undefined){d.low=Math.max(b,0);d.high=Math.min(g,d.max_high)}d.reset_overview();d.redraw()}},go_to:function(f){var j=this,a,d,b=f.split(":"),h=b[0],i=b[1];if(i!==undefined){try{var g=i.split("-");a=parseInt(g[0].replace(/,/g,""),10);d=parseInt(g[1].replace(/,/g,""),10)}catch(c){return false}}j.change_chrom(h,a,d)},move_fraction:function(c){var a=this;var b=a.high-a.low;this.move_delta(c*b)},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);sortable(a.container_div,".draghandle");this.track_id_counter+=1;this.num_tracks+=1},add_label_track:function(a){a.view=this;this.label_tracks.push(a)},remove_track:function(a){this.has_changes=true;a.container_div.fadeOut("slow",function(){$(this).remove()});delete this.tracks[this.tracks.indexOf(a)];this.num_tracks-=1},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(h){var g=this.high-this.low,f=this.low,b=this.high;if(f<this.max_low){f=this.max_low}if(b>this.max_high){b=this.max_high}if(this.high!==0&&g<this.min_separation){b=f+this.min_separation}this.low=Math.floor(f);this.high=Math.ceil(b);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));var a=(this.low/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var e=((this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())||0;var j=13;this.overview_box.css({left:a,width:Math.max(j,e)}).show();if(e<j){this.overview_box.css("left",a-(j-e)/2)}if(this.overview_highlight){this.overview_highlight.css({left:a,width:e})}this.update_location(this.low,this.high);if(!h){for(var c=0,d=this.tracks.length;c<d;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(c=0,d=this.label_tracks.length;c<d;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()},resize_window:function(){this.viewport_container.height(this.container.height()-this.top_container.height()-this.bottom_container.height());this.nav_container.width(this.container.width());this.redraw()},reset_overview:function(){this.overview_viewport.find("canvas").remove();this.overview_viewport.height(this.default_overview_height);this.overview_box.height(this.default_overview_height);this.overview_close.hide();this.overview_highlight.hide()}});var Tool=function(a,b){this.name=a;this.params=b};$.extend(Tool.prototype,{get_param_values_dict:function(){var b={};for(var a=0;a<this.params.length;a++){var c=this.params[a];b[c.name]=c.value}return b},get_param_values:function(){var b=[];for(var a=0;a<this.params.length;a++){b[a]=this.params[a].value}return b}});var NumberToolParameter=function(c,b,e,a,d){this.name=c;this.label=b;this.min=e;this.max=a;this.value=d};var get_tool_from_dict=function(f){if(obj_length(f)==0){return undefined}var b=f.name;var l=f.params;var c=Array();for(var e=0;e<l.length;e++){var g=l[e];var a=g.name,k=g.label,h=g.type,d=g.min,j=g.max,m=g.value;c[c.length]=new NumberToolParameter(a,k,d,j,m)}return new Tool(b,c)};var Filter=function(b,a,c){this.name=b;this.index=a;this.value=c};var NumberFilter=function(b,a){this.name=b;this.index=a;this.low=-Number.MAX_VALUE;this.high=Number.MAX_VALUE;this.slider_min=Number.MAX_VALUE;this.slider_max=-Number.MAX_VALUE;this.slider=null;this.slider_label=null};$.extend(NumberFilter.prototype,{applies_to:function(a){if(a.length>this.index){return true}return false},keep:function(a){if(!this.applies_to(a)){return true}return(a[this.index]>=this.low&&a[this.index]<=this.high)},update_attrs:function(b){var a=false;if(!this.applies_to(b)){return a}if(b[this.index]<this.slider_min){this.slider_min=b[this.index];a=true}if(b[this.index]>this.slider_max){this.slider_max=b[this.index];a=false}return a},update_ui_elt:function(){var b=this.slider.slider("option","min"),a=this.slider.slider("option","max");if(this.slider_min<b||this.slider_max>a){this.slider.slider("option","min",this.slider_min);this.slider.slider("option","max",this.slider_max);this.slider.slider("option","values",[this.slider_min,this.slider_max])}}});var get_filters_from_dict=function(a){var g=[];for(var d=0;d<a.length;d++){var f=a[d];var c=f.name,e=f.type,b=f.index;if(e=="int"||e=="float"){g[d]=new NumberFilter(c,b)}else{g[d]=new Filter(c,b,e)}}return g};var TrackConfig=function(a){this.track=a.track;this.params=a.params;this.values={};if(a.saved_values){this.restore_values(a.saved_values)}this.onchange=a.onchange};$.extend(TrackConfig.prototype,{restore_values:function(a){var b=this;$.each(this.params,function(c,d){if(a[d.key]!==undefined){b.values[d.key]=a[d.key]}else{b.values[d.key]=d.default_value}})},build_form:function(){var b=this;var a=$("<div />");$.each(this.params,function(f,d){if(!d.hidden){var c="param_"+f;var k=$("<div class='form-row' />").appendTo(a);k.append($("<label />").attr("for",c).text(d.label+":"));if(d.type=="bool"){k.append($('<input type="checkbox" />').attr("id",c).attr("name",c).attr("checked",b.values[d.key]))}else{if(d.type=="color"){var h=b.values[d.key];var g=$("<input />").attr("id",c).attr("name",c).val(h);var i=$("<div class='tipsy tipsy-north' style='position: absolute;' />").hide();var e=$("<div style='background-color: black; padding: 10px;'></div>").appendTo(i);var j=$("<div/>").appendTo(e).farbtastic({width:100,height:100,callback:g,color:h});$("<div />").append(g).append(i).appendTo(k).bind("click",function(l){i.css({left:$(this).position().left+($(g).width()/2)-60,top:$(this).position().top+$(this.height)}).show();$(document).bind("click.color-picker",function(){i.hide();$(document).unbind("click.color-picker")});l.stopPropagation()})}else{k.append($("<input />").attr("id",c).attr("name",c).val(b.values[d.key]))}}}});return a},update_from_form:function(a){var c=this;var b=false;$.each(this.params,function(d,f){if(!f.hidden){var g="param_"+d;var e=a.find("#"+g).val();if(f.type=="float"){e=parseFloat(e)}else{if(f.type=="int"){e=parseInt(e)}else{if(f.type=="bool"){e=a.find("#"+g).is(":checked")}}}if(e!==c.values[f.key]){c.values[f.key]=e;b=true}}});if(b){this.onchange()}}});var Track=function(b,a,e,c,d){this.name=b;this.view=a;this.parent_element=e;this.data_url=(c?c:default_data_url);this.data_query_wait=(d?d:DEFAULT_DATA_QUERY_WAIT);this.dataset_check_url=converted_datasets_state_url;this.container_div=$("<div />").addClass("track").css("position","relative");if(!this.hidden){this.header_div=$("<div class='track-header' />").appendTo(this.container_div);if(this.view.editor){this.drag_div=$("<div class='draghandle' />").appendTo(this.header_div)}this.name_div=$("<div class='menubutton popup' />").appendTo(this.header_div);this.name_div.text(this.name);this.name_div.attr("id",this.name.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9\-]/g,"").toLowerCase())}this.content_div=$("<div class='track-content'>").appendTo(this.container_div);this.parent_element.append(this.container_div)};$.extend(Track.prototype,{init:function(){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();a.initial_canvas=undefined;a.content_div.css("height","auto");a.container_div.removeClass("nodata error pending");if(!a.dataset_id){return}if(a.view.chrom!=null){$.getJSON(converted_datasets_state_url,{hda_ldda:a.hda_ldda,dataset_id:a.dataset_id,chrom:a.view.chrom},function(b){if(!b||b==="error"||b.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(b.message){var d=a.view.tracks.indexOf(a);var c=$(" <a href='javascript:void(0);'></a>").text("View error").bind("click",function(){show_modal("Trackster Error","<pre>"+b.message+"</pre>",{Close:hide_modal})});a.content_div.append(c)}}else{if(b==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(b==="no data"||(b.data!==undefined&&(b.data===null||b.data.length===0))){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(b==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},a.data_query_wait)}else{if(b.status==="data"){if(b.valid_chroms){a.valid_chroms=b.valid_chroms;a.name_div.data("menu_options")["List chrom/contigs with data"]=function(){show_modal("Chrom/contigs with data","<p>"+a.valid_chroms.join("<br/>")+"</p>",{Close:function(){hide_modal()}})}}a.content_div.text(DATA_OK);if(a.view.chrom){a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;$.when(a.predraw_init()).done(function(){a.draw()})}}}}}}})}},predraw_init:function(){},update_name:function(a){this.old_name=this.name;this.name=a;this.name_div.text(this.name)},revert_name:function(){this.name=this.old_name;this.name_div.text(this.name)}});var TiledTrack=function(g,d,s){var o=this,j=o.view;this.filters=(g!==undefined?get_filters_from_dict(g):[]);this.tool=(d!==undefined?get_tool_from_dict(d):undefined);this.parent_track=s;this.child_tracks=[];if(o.hidden){return}if(this.parent_track){this.header_div.find(".draghandle").removeClass("draghandle").addClass("child-track-icon").addClass("icon-button");this.parent_element.addClass("child-track");this.tool=undefined}this.filtering_div=$("<div/>").addClass("track-filters").hide();this.header_div.after(this.filtering_div);this.filtering_div.bind("drag",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var t=$("<table class='filters'>").appendTo(this.filtering_div);$.each(this.filters,function(w,z){var v=$("<tr>").appendTo(t);var y=$("<th class='filter-info'>").appendTo(v);var u=$("<span class='name'>").appendTo(y);u.text(z.name+" ");var i=$("<span class='values'>").appendTo(y);var x=$("<td>").appendTo(v);z.control_element=$("<div id='"+z.name+"-filter-control' style='width: 200px; position: relative'>").appendTo(x);z.control_element.slider({range:true,min:Number.MAX_VALUE,max:-Number.MIN_VALUE,values:[0,0],slide:function(B,C){var A=C.values;i.text("["+A[0]+"-"+A[1]+"]");z.low=A[0];z.high=A[1];o.draw(true)},change:function(A,B){z.control_element.slider("option","slide").call(z.control_element,A,B)}});z.slider=z.control_element;z.slider_label=i});if(this.tool){this.dynamic_tool_div=$("<div/>").addClass("dynamic-tool").hide();this.header_div.after(this.dynamic_tool_div);this.dynamic_tool_div.bind("drag",function(i){i.stopPropagation()}).bind("click",function(i){i.stopPropagation()}).bind("dblclick",function(i){i.stopPropagation()});var l=$("<div class='tool-name'>").appendTo(this.dynamic_tool_div).text(this.tool.name);var e=this.tool.params;var o=this;$.each(this.tool.params,function(A,v){var y=$("<div>").addClass("param-row").appendTo(o.dynamic_tool_div);var x=$("<div>").addClass("slider-label").appendTo(y);var C=$("<span class='param-name'>").text(v.label+" ").appendTo(x);var w=$("<span/>").text(v.value);var z=$("<span class='param-value'>").appendTo(x).append("[").append(w).append("]");var B=$("<div/>").addClass("slider").appendTo(y);var i=$("<div id='"+v.name+"-param-control'>").appendTo(B);var u=(v.max<=1?0.01:(v.max<=1000?1:5));i.slider({min:v.min,max:v.max,step:u,value:v.value,slide:function(D,F){var E=F.value;v.value=E;if(0<E&&E<1){E=parseFloat(E).toFixed(2)}w.text(E)},change:function(D,E){v.value=E.value}});z.click(function(){var F=w,E=F.text(),D=(v.max<=1?4:v.max.length);F.text("");$("<input type='text'/>").attr("size",D).attr("maxlength",D).attr("value",E).appendTo(F).focus().select().click(function(G){G.stopPropagation()}).blur(function(){$(this).remove();F.text(E)}).keyup(function(I){if(I.keyCode===27){$(this).trigger("blur")}else{if(I.keyCode===13){var G=$(this),H=parseFloat(G.val());if(isNaN(H)||H>v.max||H<v.min){alert("Parameter value must be in the range ["+v.min+"-"+v.max+"]");return $(this)}F.text(H);i.slider("value",H);v.value=H}}})});$("<div style='clear: both;'/>").appendTo(y)});var b=$("<div>").addClass("param-row").appendTo(this.dynamic_tool_div);var n=$("<input type='submit'>").attr("value","Run").appendTo(b);var o=this;n.click(function(){o.run_tool()})}o.child_tracks_container=$("<div/>").addClass("child-tracks-container").hide();o.container_div.append(o.child_tracks_container);if(o.display_modes!==undefined){if(o.mode_div===undefined){o.mode_div=$("<div class='right-float menubutton popup' />").appendTo(o.header_div);var m=o.display_modes[0];o.mode=m;o.mode_div.text(m);var a=function(i){o.mode_div.text(i);o.mode=i;o.tile_cache.clear();o.draw()};var f={};for(var q=0,r=o.display_modes.length;q<r;q++){var k=o.display_modes[q];f[k]=function(i){return function(){a(i)}}(k)}make_popupmenu(o.mode_div,f)}else{o.mode_div.hide()}}var h={};h["Edit configuration"]=function(){var v=function(){hide_modal();$(window).unbind("keypress.check_enter_esc")},i=function(){o.track_config.update_from_form($(".dialog-box"));hide_modal();$(window).unbind("keypress.check_enter_esc")},u=function(w){if((w.keyCode||w.which)===27){v()}else{if((w.keyCode||w.which)===13){i()}}};$(window).bind("keypress.check_enter_esc",u);show_modal("Configure Track",o.track_config.build_form(),{Cancel:v,OK:i})};if(o.filters.length>0){h["Show filters"]=function(){var i;if(!o.filtering_div.is(":visible")){i="Hide filters";o.filters_visible=true}else{i="Show filters";o.filters_visible=false}o.filtering_div.toggle()}}if(o.tool){h["Toggle Tool"]=function(){var i;if(!o.dynamic_tool_div.is(":visible")){i="Hide dynamic tool";o.update_name(o.name+o.tool_region_and_parameters_str())}else{i="Show dynamic tool";o.revert_name()}o.dynamic_tool_div.toggle()}}var c=j;var p=function(){$("#no-tracks").show()};if(this.parent_track){c=this.parent_track;p=function(){}}h.Remove=function(){c.remove_track(o);if(c.num_tracks===0){p()}};o.popup_menu=make_popupmenu(o.name_div,h)};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(b){var m=this.view.low,g=this.view.high,j=g-m,c=this.view.container.width(),f=this.view.resolution;var p=$("<div style='position: relative;'></div>"),r=c/j;this.content_div.append(p);this.max_height=0;var a=Math.floor(m/f/DENSITY);var l=0;while((a*DENSITY*f)<g){var n=c+"_"+r+"_"+a;var e=this.tile_cache.get(n);var k=a*DENSITY*this.view.resolution;var q=k+DENSITY*this.view.resolution;if(!b&&e){this.show_tile(e,p,k,r)}else{this.delayed_draw(b,n,k,q,a,f,p,r)}a+=1}var d=this;var o=setInterval(function(){if(l===0){var u=d.content_div.children();var t=false;for(var v=u.length-1,s=0;v>=s;v--){var x=$(u[v]);if(t){x.remove()}else{if(x.children().length!==0){t=true}}}for(var w=0;w<d.filters.length;w++){d.filters[w].update_ui_elt()}clearInterval(o)}},50);for(var h=0;h<this.child_tracks.length;h++){this.child_tracks[h].draw(b)}},delayed_draw:function(b,g,f,i,c,e,h,j){var d=this;var a=setTimeout(function(){if(f<=d.view.high&&i>=d.view.low){var k;if(!b){k=d.tile_cache.get(g)}if(!k){k=d.draw_tile(e,c,h,j);if(k){var l=$("<div class='track-tile'>").prepend(k);if(k.hasClass(FILTERABLE_CLASS)){l.addClass(FILTERABLE_CLASS)}k=l}}if(k){d.tile_cache.set(g,k);d.show_tile(k,h,f,j)}}},50)},show_tile:function(a,f,d,g){var b=this;var c=this.view.high-this.view.low,e=(d-this.view.low)*g;if(this.left_offset){e-=this.left_offset}a.css({position:"absolute",top:0,left:e,height:""});f.append(a);b.max_height=Math.max(b.max_height,a.height());b.content_div.css("height",b.max_height+"px");f.children().css("height",b.max_height+"px");if(b.hidden){return}if(a.hasClass(FILTERABLE_CLASS)){show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters");if(b.filters_visible){b.filtering_div.show()}}else{show_hide_popupmenu_options(b.popup_menu,"(Show|Hide) filters",false);b.filtering_div.hide()}},set_overview:function(){var a=this.view;if(this.initial_canvas&&this.is_overview){a.overview_close.show();a.overview_viewport.append(this.initial_canvas);a.overview_highlight.show().height(this.initial_canvas.height());a.overview_viewport.height(this.initial_canvas.height()+a.overview_box.height())}$(window).trigger("resize")},run_tool:function(){var b={dataset_id:this.original_dataset_id,chrom:this.view.chrom,low:this.view.low,high:this.view.high,tool_id:this.tool.name};$.extend(b,this.tool.get_param_values_dict());var d=this,c=b.tool_id+d.tool_region_and_parameters_str(b.chrom,b.low,b.high),e;if(d.track_type=="FeatureTrack"){e=new ToolDataFeatureTrack(c,view,undefined,{},{},d)}this.add_track(e);e.content_div.text("Starting job.");view.has_changes=true;var a=function(){$.getJSON(run_tool_url,b,function(f){if(f=="no converter"){e.container_div.addClass("error");e.content_div.text(DATA_NOCONVERTER)}else{if(f.error){e.container_div.addClass("error");e.content_div.text(DATA_CANNOT_RUN_TOOL+f.message)}else{if(f=="pending"){e.container_div.addClass("pending");e.content_div.text("Converting input data so that it can be easily reused.");setTimeout(a,2000)}else{e.dataset_id=f.dataset_id;e.content_div.text("Running job.");e.init()}}}})};a()},tool_region_and_parameters_str:function(c,a,d){var b=this,e=(c!==undefined&&a!==undefined&&d!==undefined?c+":"+a+"-"+d:"all");return" - region=["+e+"], parameters=["+b.tool.get_param_values().join(", ")+"]"},add_track:function(a){a.track_id=this.track_id+"_"+this.child_tracks.length;a.container_div.attr("id","track_"+a.track_id);this.child_tracks_container.append(a.container_div);sortable(a.container_div,".child-track-icon");if(!$(this.child_tracks_container).is(":visible")){this.child_tracks_container.show()}this.child_tracks.push(a)},remove_track:function(a){a.container_div.fadeOut("slow",function(){$(this).remove()})}});var LabelTrack=function(a,b){this.track_type="LabelTrack";this.hidden=true;Track.call(this,null,a,b);this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=Math.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.view.container.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";this.hidden=true;Track.call(this,null,a,a.top_labeltrack);TiledTrack.call(this);this.left_offset=200;this.height_px=12;this.container_div.addClass("reference-track");this.content_div.css("background","none");this.content_div.css("min-height","0px");this.content_div.css("border","none");this.data_queue={};this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,j=f+"_"+b;var e=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(e)}e=$(e);var n=e.get(0).getContext("2d");if(o>CHAR_WIDTH_PX){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){this.content_div.css("height","0px");return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o),i=Math.round(o/2);n.fillText(m[h],a+this.left_offset+i,10)}k.append(e);return e}this.content_div.css("height","0px")}});var LineTrack=function(e,c,f,a,d){var b=this;this.track_type="LineTrack";this.display_modes=["Histogram","Line","Filled","Intensity"];this.mode="Histogram";Track.call(this,e,c,c.viewport_container);TiledTrack.call(this);this.min_height_px=16;this.max_height_px=400;this.height_px=80;this.hda_ldda=f;this.dataset_id=a;this.original_dataset_id=a;this.data_cache=new DataCache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.track_config=new TrackConfig({track:this,params:[{key:"color",label:"Color",type:"color",default_value:"black"},{key:"min_value",label:"Min Value",type:"float",default_value:undefined},{key:"max_value",label:"Max Value",type:"float",default_value:undefined},{key:"mode",type:"string",default_value:this.mode,hidden:true},{key:"height",type:"int",default_value:this.height_px,hidden:true}],saved_values:d,onchange:function(){b.vertical_range=b.prefs.max_value-b.prefs.min_value;$("#linetrack_"+b.track_id+"_minval").text(b.prefs.min_value);$("#linetrack_"+b.track_id+"_maxval").text(b.prefs.max_value);b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values;this.height_px=this.track_config.values.height;this.vertical_range=this.track_config.values.max_value-this.track_config.values.min_value;(function(g){var j=false;var i=false;var h=$("<div class='track-resize'>");$(g.container_div).hover(function(){j=true;h.show()},function(){j=false;if(!i){h.hide()}});h.hide().bind("dragstart",function(k,l){i=true;l.original_height=$(g.content_div).height()}).bind("drag",function(l,m){var k=Math.min(Math.max(m.original_height+m.deltaY,g.min_height_px),g.max_height_px);$(g.content_div).css("height",k);g.height_px=k;g.draw(true)}).bind("dragend",function(k,l){g.tile_cache.clear();i=false;if(!j){h.hide()}g.track_config.values.height=g.height_px}).appendTo(g.container_div)})(this)};$.extend(LineTrack.prototype,TiledTrack.prototype,{predraw_init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;return $.getJSON(a.data_url,{stats:true,chrom:a.view.chrom,low:null,high:null,hda_ldda:a.hda_ldda,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");var e=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=e.min;a.prefs.max_value=e.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=e.total_frequency;a.container_div.find(".yaxislabel").remove();var f=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(round_1000(a.prefs.min_value));var d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(round_1000(a.prefs.max_value));d.css({position:"absolute",top:"24px",left:"10px"});d.prependTo(a.container_div);f.css({position:"absolute",bottom:"2px",left:"10px"});f.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:this.data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,hda_ldda:this.hda_ldda,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){var h=g.data;c.data_cache.set(e,h);delete c.data_queue[e];c.draw()},error:function(h,g,i){console.log(h,g,i)}})}},draw_tile:function(o,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*o,a=DENSITY*o,x=o+"_"+r;var b=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(b)}b=$(b);if(this.data_cache.get(x)===undefined){this.get_data(o,r);return}var v=this.data_cache.get(x);if(!v){return}b.get(0).width=Math.ceil(a*e);b.get(0).height=this.height_px;var n=b.get(0).getContext("2d"),j=false,k=this.prefs.min_value,g=this.prefs.max_value,m=this.vertical_range,t=this.total_frequency,d=this.height_px,l=this.mode;var w=Math.round(d+k/m*d);n.beginPath();n.moveTo(0,w);n.lineTo(a*e,w);n.fillStyle="#aaa";n.stroke();n.beginPath();n.fillStyle=this.prefs.color;var u,h,f;if(v.length>1){f=Math.ceil((v[1][0]-v[0][0])*e)}else{f=10}for(var p=0,q=v.length;p<q;p++){u=Math.round((v[p][0]-s)*e);h=v[p][1];if(h===null){if(j&&l==="Filled"){n.lineTo(u,d)}j=false;continue}if(h<k){h=k}else{if(h>g){h=g}}if(l==="Histogram"){h=Math.round(h/m*d);n.fillRect(u,w,f,-h)}else{if(l==="Intensity"){h=255-Math.floor((h-k)/m*255);n.fillStyle="rgb("+h+","+h+","+h+")";n.fillRect(u,0,f,d)}else{h=Math.round(d-(h-k)/m*d);if(j){n.lineTo(u,h)}else{j=true;if(l==="Filled"){n.moveTo(u,d);n.lineTo(u,h)}else{n.moveTo(u,h)}}}}}if(l==="Filled"){if(j){n.lineTo(u,w);n.lineTo(0,w)}n.fill()}else{n.stroke()}return b}});var FeatureTrack=function(a,f,e,i,h,c,d,g){var b=this;this.track_type="FeatureTrack";this.display_modes=["Auto","Dense","Squish","Pack"];Track.call(this,a,f,f.viewport_container);TiledTrack.call(this,c,d,g);this.height_px=0;this.container_div.addClass("feature-track");this.hda_ldda=e;this.dataset_id=i;this.original_dataset_id=i;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.summary_draw_height=30;this.default_font=DEFAULT_FONT;this.inc_slots={};this.data_queue={};this.start_end_dct={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new DataCache(20);this.left_offset=200;this.track_config=new TrackConfig({track:this,params:[{key:"block_color",label:"Block color",type:"color",default_value:"#444"},{key:"label_color",label:"Label color",type:"color",default_value:"black"},{key:"show_counts",label:"Show summary counts",type:"bool",default_value:true}],saved_values:h,onchange:function(){b.tile_cache.clear();b.draw()}});this.prefs=this.track_config.values};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(b.data_url,{chrom:b.view.chrom,low:a,high:d,hda_ldda:b.hda_ldda,dataset_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set_data(a,d,b.mode,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,j,d,q){var r=this.inc_slots[a];if(!r||(r.mode!==q)){r={};r.w_scale=a;r.mode=q;this.inc_slots[a]=r;this.start_end_dct[a]={}}var m=r.w_scale,x=[],y=[],k=0,o=this.view.max_low;for(var v=0,w=j.length;v<w;v++){var h=j[v],l=h[0];if(r[l]!==undefined){k=Math.max(k,r[l]);y.push(r[l])}else{x.push(v)}}var e=this.start_end_dct[a];var n=function(D,E){for(var C=0;C<=MAX_FEATURE_DEPTH;C++){var A=false,F=e[C];if(F!==undefined){for(var z=0,B=F.length;z<B;z++){var i=F[z];if(E>i[0]&&D<i[1]){A=true;break}}}if(!A){return C}}return -1};for(var v=0,w=x.length;v<w;v++){var h=j[x[v]],l=h[0],t=h[1],b=h[2],p=h[3],c=Math.floor((t-o)*m),g=Math.ceil((b-o)*m),u=CONTEXT.measureText(p).width,f;if(p!==undefined&&!d){u+=(LABEL_SPACING+PACK_SPACING);if(c-u>=0){c-=u;f="left"}else{g+=u;f="right"}}var s=n(c,g);if(s>=0){if(e[s]===undefined){e[s]=[]}e[s].push([c,g]);r[l]=s;k=Math.max(k,s)}else{}}return k},rect_or_text:function(v,n,z,d,u,l,h,g){v.textAlign="center";var b=[z,d],q=0,w=0,t=Math.round(n/2);var E=[];for(var o=0,y=l.length;o<y;o++){var m=l[o],e="MIDNSHP=X"[m[0]],p=m[1];if(e==="H"||e==="S"){q-=p}var j=u+q,D=Math.floor(Math.max(0,(j-z)*n)),k=Math.floor(Math.max(0,(j+p-z)*n));switch(e){case"H":break;case"S":case"M":case"=":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var s=h.slice(w,w+p);if((this.mode==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){v.fillStyle=this.prefs.block_color;v.fillRect(D+this.left_offset,g+1,k-D,9);v.fillStyle=CONNECTOR_COLOR;for(var B=0,a=s.length;B<a;B++){if(j+B>=z&&j+B<=d){var C=Math.floor(Math.max(0,(j+B-z)*n));v.fillText(s[B],C+this.left_offset+t,g+9)}}}else{v.fillStyle=this.prefs.block_color;v.fillRect(D+this.left_offset,g+(this.mode!="Dense"?4:5),k-D,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}w+=p;q+=p;break;case"N":v.fillStyle=CONNECTOR_COLOR;v.fillRect(D+this.left_offset,g+5,k-D,1);q+=p;break;case"D":v.fillStyle="red";v.fillRect(D+this.left_offset,g+4,k-D,3);q+=p;break;case"P":break;case"I":var r=compute_overlap([j,j+p],b);if(r!=NO_OVERLAP){var s=h.slice(w,w+p);var f=this.left_offset+D-(k-D)/2;if((this.mode==="Pack"||this.mode==="Auto")&&h!==undefined&&n>CHAR_WIDTH_PX){v.fillStyle="yellow";v.fillRect(f,g-9,k-D,9);E[E.length]=[f+(k-D)/2,g+4,5];v.fillStyle=CONNECTOR_COLOR;switch(r){case (OVERLAP_START):s=s.slice(z-j);break;case (OVERLAP_END):s=s.slice(0,j-d);break;case (CONTAINED_BY):break;case (CONTAINS):s=s.slice(z-j,j-d);break}for(var B=0,a=s.length;B<a;B++){var C=Math.floor(Math.max(0,(j+B-z)*n));v.fillText(s[B],C+this.left_offset+t-(k-D)/2,g)}}else{v.fillStyle="yellow";v.fillRect(f,g+(this.mode!="Dense"?2:5),k-D,(this.mode!="Dense"?SQUISH_FEATURE_HEIGHT:DENSE_FEATURE_HEIGHT))}}w+=p;break;case"X":w+=p;break}}var A;for(var x=0;x<E.length;x++){A=E[x];v.fillStyle="yellow";v.drawDownwardEquilateralTriangle(A[0],A[1],A[2])}},draw_tile:function(ae,m,q,au){var K=m*DENSITY*ae,aj=(m+1)*DENSITY*ae,J=aj-K;var G=this.data_cache.get_data(K,aj,this.mode);if(G===undefined||G==="pending"||(this.mode!=="Auto"&&G.dataset_type==="summary_tree")){this.data_queue[[K,aj]]=true;this.get_data(K,aj);return}var a=Math.ceil(J*au),ag=this.prefs.label_color,g=this.prefs.block_color,p=this.mode,u=25,aa,V=this.left_offset,at,B,av;var o=document.createElement("canvas");if(window.G_vmlCanvasManager){G_vmlCanvasManager.initElement(o)}o=$(o);if(G.dataset_type==="summary_tree"){B=this.summary_draw_height}else{if(p==="Dense"){B=u;av=DENSE_TRACK_HEIGHT}else{if(p==="Squish"){av=SQUISH_TRACK_HEIGHT;aa=true}else{if(p==="Pack"){av=PACK_TRACK_HEIGHT;aa=false}else{if(G.extra_info==="no_detail"){av=(G.track_type==="bai"?SQUISH_TRACK_HEIGHT:NO_DETAIL_TRACK_HEIGHT);aa=true}else{av=PACK_TRACK_HEIGHT;aa=false}}}B=this.incremental_slots(au,G.data,aa,p)*av+u;at=this.inc_slots[au]}}o.get(0).width=a+V;o.get(0).height=B;if(G.dataset_type=="summary_tree"){o.get(0).height+=LABEL_SPACING+CHAR_HEIGHT_PX}q.parent().css("height",Math.max(this.height_px,B)+"px");var H=o.get(0).getContext("2d");H.fillStyle=g;H.font=this.default_font;H.textAlign="right";this.container_div.find(".yaxislabel").remove();if(G.dataset_type=="summary_tree"){var v=B+LABEL_SPACING+CHAR_HEIGHT_PX;points=G.data,max=G.max,delta_x_px=Math.ceil(G.delta*au);var n=$("<div />").addClass("yaxislabel");n.text(max);n.css({position:"absolute",top:"22px",left:"10px"});n.prependTo(this.container_div);for(var an=0,F=points.length;an<F;an++){var Z=Math.floor((points[an][0]-K)*au);var Y=points[an][1];if(!Y){continue}var ak=Y/max*B;H.fillStyle="black";H.fillRect(Z+V,v-ak,delta_x_px,ak);var X=4;if(this.prefs.show_counts&&(H.measureText(Y).width+X)<delta_x_px){H.fillStyle="#666";H.textAlign="center";H.fillText(Y,Z+V+(delta_x_px/2),10)}}return o}if(G.message){o.css({"border-color":"red"});H.fillStyle="red";H.textAlign="left";H.fillText(G.message,100+V,av);if(!G.data){return o}}for(var aq=0;aq<this.filters.length;aq++){if(G.data.length&&this.filters[aq].applies_to(G.data[0])){o.addClass(FILTERABLE_CLASS);break}}var ar=G.data;var am=0;for(var an=0,F=ar.length;an<F;an++){var R=ar[an],O=R[0],ap=R[1],ac=R[2],L=R[3];if(this.mode!="Dense"&&at[O]===undefined){continue}var ab=false;var T;for(var aq=0;aq<this.filters.length;aq++){T=this.filters[aq];T.update_attrs(R);if(!T.keep(R)){ab=true;break}}if(ab){continue}if(ap<=aj&&ac>=K){if(G.dataset_type=="interval_index"){ac-=1}var ad=Math.floor(Math.max(0,(ap-K)*au)),I=Math.ceil(Math.min(a,Math.max(0,(ac-K)*au))),W=(p==="Dense"?1:(1+at[O]))*av;var E,ah,M=null,aw=null;if(G.dataset_type==="bai"){H.fillStyle=g;if(R[5] instanceof Array){var C=Math.floor(Math.max(0,(R[4][0]-K)*au)),N=Math.ceil(Math.min(a,Math.max(0,(R[4][1]-K)*au))),A=Math.floor(Math.max(0,(R[5][0]-K)*au)),t=Math.ceil(Math.min(a,Math.max(0,(R[5][1]-K)*au)));if(R[4][1]>=K&&R[4][0]<=aj&&R[4][2]){this.rect_or_text(H,au,K,aj,R[4][0],R[4][2],R[4][3],W)}if(R[5][1]>=K&&R[5][0]<=aj&&R[5][2]){this.rect_or_text(H,au,K,aj,R[5][0],R[5][2],R[5][3],W)}if(A>N){H.fillStyle=CONNECTOR_COLOR;H.dashedLine(N+V,W+5,V+A,W+5)}}else{H.fillStyle=g;this.rect_or_text(H,au,K,aj,ap,R[4],R[5],W)}if(p!=="Dense"&&!aa&&ap>K){H.fillStyle=this.prefs.label_color;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}else{if(G.dataset_type==="interval_index"){if(p=="Auto"){if(R.length<=4){p="Squish"}else{p="Pack"}}if(p=="Dense"){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{if(R.length<=4){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,DENSE_FEATURE_HEIGHT)}else{var D=R[5],U=R[6],af=R[7],e=R[8];if(U&&af){M=Math.floor(Math.max(0,(U-K)*au));aw=Math.ceil(Math.min(a,Math.max(0,(af-K)*au)))}var ao,P;if(p=="Squish"){ao=1;P=SQUISH_FEATURE_HEIGHT}else{ao=5;P=PACK_FEATURE_HEIGHT}if(!e){if(R.strand){if(R.strand=="+"){H.fillStyle=RIGHT_STRAND_INV}else{if(R.strand=="-"){H.fillStyle=LEFT_STRAND_INV}}}else{H.fillStyle=CONNECTOR_COLOR}H.fillRect(ad+V,W+(P-ao)/2+1,I-ad,P)}else{var z,Q;if(p=="Squish"){H.fillStyle=CONNECTOR_COLOR;z=W+Math.floor(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}else{if(D){var z=W;var Q=P;if(D=="+"){H.fillStyle=RIGHT_STRAND}else{if(D=="-"){H.fillStyle=LEFT_STRAND}}}else{H.fillStyle=CONNECTOR_COLOR;z+=(SQUISH_FEATURE_HEIGHT/2)+1;Q=1}}H.fillRect(ad+V,z,I-ad,Q);for(var al=0,d=e.length;al<d;al++){var s=e[al],c=Math.floor(Math.max(0,(s[0]-K)*au)),S=Math.ceil(Math.min(a,Math.max((s[1]-K)*au)));if(c>S){continue}H.fillStyle=g;H.fillRect(c+V,W+(P-ao)/2+1,S-c,ao);if(M!==undefined&&!(c>aw||S<M)){var ai=Math.max(c,M),w=Math.min(S,aw-1);H.fillRect(ai+V,W+1,w-ai,P)}}}if(p=="Pack"&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+V+LABEL_SPACING,W+8)}else{H.textAlign="right";H.fillText(L,ad+V-LABEL_SPACING,W+8)}H.fillStyle=g}}}}else{if(G.dataset_type==="vcf"){if(aa){H.fillStyle=g;H.fillRect(ad+V,W+5,I-ad,1)}else{var r=R[4],l=R[5],b=R[6];E=9;ah=1;H.fillRect(ad+V,W,I-ad,E);if(p!=="Dense"&&L!==undefined&&ap>K){H.fillStyle=ag;if(m===0&&ad-H.measureText(L).width<0){H.textAlign="left";H.fillText(L,I+2+V,W+8)}else{H.textAlign="right";H.fillText(L,ad-2+V,W+8)}H.fillStyle=g}var h=r+" / "+l;if(ap>K&&H.measureText(h).width<(I-ad)){H.fillStyle="white";H.textAlign="center";H.fillText(h,V+ad+(I-ad)/2,W+8);H.fillStyle=g}}}}}am++}}return o}});var ReadTrack=function(d,b,f,a,c,e){FeatureTrack.call(this,d,b,f,a,c,e);this.track_type="ReadTrack"};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});var ToolDataFeatureTrack=function(e,c,g,a,d,f,b){FeatureTrack.call(this,e,c,g,a,d,f,{},b);this.track_type="ToolDataFeatureTrack";this.data_url=raw_data_url;this.data_query_wait=1000;this.dataset_check_url=dataset_state_url};$.extend(ToolDataFeatureTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{predraw_init:function(){var b=this;var a=function(){if(b.data_cache.size()==0){setTimeout(a,300)}else{b.data_url=default_data_url;b.data_query_wait=DEFAULT_DATA_QUERY_WAIT;b.dataset_state_url=converted_datasets_state_url;$.getJSON(b.dataset_state_url,{dataset_id:b.dataset_id},function(c){})}};a()}});
\ No newline at end of file
--- a/static/scripts/trackster.js Mon Feb 21 09:46:54 2011 -0500
+++ b/static/scripts/trackster.js Mon Feb 21 11:49:24 2011 -0500
@@ -24,6 +24,29 @@
}
};
+/**
+ * Draw an isosceles triangle that points down.
+ */
+CanvasRenderingContext2D.prototype.drawDownwardEquilateralTriangle = function(down_vertex_x, down_vertex_y, side_len) {
+ // Compute other two points of triangle.
+ var
+ x1 = down_vertex_x - side_len/2,
+ x2 = down_vertex_x + side_len/2,
+ y = down_vertex_y - Math.sqrt( side_len*3/2 );
+
+ // Draw and fill.
+ this.beginPath();
+ this.moveTo(x1, y);
+ this.lineTo(x2, y);
+ this.lineTo(down_vertex_x, down_vertex_y);
+ this.lineTo(x1, y);
+
+ this.strokeStyle = this.fillStyle;
+ this.fill();
+ this.stroke();
+ this.closePath();
+}
+
/**
* Make `element` sortable in parent by dragging `handle` (a selector)
*/
@@ -51,7 +74,49 @@
});
}
+/**
+ * Compute the type of overlap between two regions. They are assumed to be on the same chrom/contig.
+ * The overlap is computed relative to the second region; hence, OVERLAP_START indicates that the first
+ * region overlaps the start (but not the end) of the second region.
+ */
+var NO_OVERLAP = 1001, CONTAINS = 1002, OVERLAP_START = 1003, OVERLAP_END = 1004, CONTAINED_BY = 1005;
+function compute_overlap(first_region, second_region) {
+ var
+ first_start = first_region[0], first_end = first_region[1],
+ second_start = second_region[0], second_end = second_region[1],
+ overlap;
+ if (first_start < second_start) {
+ if (first_end < second_start) {
+ overlap = NO_OVERLAP;
+ }
+ else if (first_end <= second_end) {
+ overlap = OVERLAP_START;
+ }
+ else { // first_end > second_end
+ overlap = CONTAINS;
+ }
+ }
+ else { // first_start >= second_start
+ if (first_start > second_end) {
+ overlap = NO_OVERLAP;
+ }
+ else if (first_end <= second_end) {
+ overlap = CONTAINED_BY;
+ }
+ else {
+ overlap = OVERLAP_END;
+ }
+ }
+
+ return overlap;
+}
+/**
+ * Returns true if there is any overlap between regions.
+ */
+function is_overlap(first_region, second_region) {
+ return (compute_overlap(first_region, second_region) != NO_OVERLAP);
+}
/**
* Init constants & functions used throughout trackster.
@@ -2192,11 +2257,18 @@
return highest_slot;
},
// Right now this function is used only for rendering BAM reads.
- rect_or_text: function( ctx, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center ) {
+ rect_or_text: function(ctx, w_scale, tile_low, tile_high, feature_start, cigar, orig_seq, y_center) {
ctx.textAlign = "center";
- var draw_offset = 0,
+ var
+ tile_region = [tile_low, tile_high],
+ base_offset = 0,
seq_offset = 0,
gap = Math.round(w_scale / 2);
+
+ // Keep list of triangles that need to be drawn on top of initial drawing layer.
+ // TODO: Eventually, we'll probably want to keep an ordered list of items to draw and then draw all
+ // items at once.
+ var draw_last = [];
for (var cig_id = 0, len = cigar.length; cig_id < len; cig_id++) {
var cig = cigar[cig_id],
@@ -2205,69 +2277,135 @@
if (cig_op === "H" || cig_op === "S") {
// Go left if it clips
- draw_offset -= cig_len;
+ base_offset -= cig_len;
}
- var seq_start = feature_start + draw_offset,
+ var seq_start = feature_start + base_offset,
s_start = Math.floor( Math.max(0, (seq_start - tile_low) * w_scale) ),
s_end = Math.floor( Math.max(0, (seq_start + cig_len - tile_low) * w_scale) );
switch (cig_op) {
- case "H": // Hard clipping
+ case "H": // Hard clipping.
// TODO: draw anything?
// Sequence not present, so do not increment seq_offset.
break;
- case "S": // Soft clipping
- case "M": // Match
- case "=":
- var seq = orig_seq.slice(seq_offset, seq_offset + cig_len);
- if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
- ctx.fillStyle = this.prefs.block_color;
- ctx.fillRect(s_start + this.left_offset, y_center + 1, s_end - s_start, 9);
- ctx.fillStyle = CONNECTOR_COLOR;
- for (var c = 0, str_len = seq.length; c < str_len; c++) {
- if (seq_start + c >= tile_low && seq_start + c <= tile_high) {
- var c_start = Math.floor( Math.max(0, (seq_start + c - tile_low) * w_scale) );
- ctx.fillText(seq[c], c_start + this.left_offset + gap, y_center + 9);
+ case "S": // Soft clipping.
+ case "M": // Match.
+ case "=": // Equals.
+ var seq_tile_overlap = compute_overlap([seq_start, seq_start + cig_len], tile_region);
+ if (seq_tile_overlap != NO_OVERLAP) {
+ // Draw.
+ var seq = orig_seq.slice(seq_offset, seq_offset + cig_len);
+ if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
+ ctx.fillStyle = this.prefs.block_color;
+ ctx.fillRect(s_start + this.left_offset, y_center + 1, s_end - s_start, 9);
+ ctx.fillStyle = CONNECTOR_COLOR;
+ // TODO: this can be made much more efficient by computing the complete sequence
+ // to draw and then drawing it.
+ for (var c = 0, str_len = seq.length; c < str_len; c++) {
+ if (seq_start + c >= tile_low && seq_start + c <= tile_high) {
+ var c_start = Math.floor( Math.max(0, (seq_start + c - tile_low) * w_scale) );
+ ctx.fillText(seq[c], c_start + this.left_offset + gap, y_center + 9);
+ }
}
+ } else {
+ ctx.fillStyle = this.prefs.block_color;
+ // TODO: This is a pretty hack-ish way to fill rectangle based on mode.
+ ctx.fillRect(s_start + this.left_offset,
+ y_center + (this.mode != "Dense" ? 4 : 5),
+ s_end - s_start,
+ (this.mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT) );
}
- } else {
- ctx.fillStyle = this.prefs.block_color;
- // TODO: This is a pretty hack-ish way to fill rectangle based on mode.
- ctx.fillRect(s_start + this.left_offset,
- y_center + (this.mode != "Dense" ? 4 : 5),
- s_end - s_start,
- (this.mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT) );
}
seq_offset += cig_len;
+ base_offset += cig_len;
break;
- case "N": // Skipped bases
+ case "N": // Skipped bases.
ctx.fillStyle = CONNECTOR_COLOR;
ctx.fillRect(s_start + this.left_offset, y_center + 5, s_end - s_start, 1);
//ctx.dashedLine(s_start + this.left_offset, y_center + 5, this.left_offset + s_end, y_center + 5);
+ // No change in seq_offset because sequence not used when skipping.
+ base_offset += cig_len;
break;
- case "D": // Deletion
+ case "D": // Deletion.
ctx.fillStyle = "red";
ctx.fillRect(s_start + this.left_offset, y_center + 4, s_end - s_start, 3);
+ // TODO: is this true? No change in seq_offset because sequence not used when skipping.
+ base_offset += cig_len;
break;
case "P": // TODO: No good way to draw insertions/padding right now, so ignore
// Sequences not present, so do not increment seq_offset.
break;
- case "I":
+ case "I": // Insertion.
+ //
+ // Show insertion above, centered on insertion point.
+ //
+
+ // Check to see if sequence should be drawn at all by looking at the overlap between
+ // the sequence region and the tile region.
+ var seq_tile_overlap = compute_overlap([seq_start, seq_start + cig_len], tile_region);
+ if (seq_tile_overlap != NO_OVERLAP) {
+ // Draw sequence.
+ var seq = orig_seq.slice(seq_offset, seq_offset + cig_len);
+ // X center is offset + start - <half_sequence_length>
+ var x_center = this.left_offset + s_start - (s_end - s_start)/2;
+ if ( (this.mode === "Pack" || this.mode === "Auto") && orig_seq !== undefined && w_scale > CHAR_WIDTH_PX) {
+ // Draw sequence container.
+ ctx.fillStyle = "yellow";
+ ctx.fillRect(x_center, y_center - 9, s_end - s_start, 9);
+ draw_last[draw_last.length] = [x_center + (s_end - s_start)/2, y_center + 4, 5];
+ ctx.fillStyle = CONNECTOR_COLOR;
+ // Based on overlap b/t sequence and tile, get sequence to be drawn.
+ switch(seq_tile_overlap) {
+ case(OVERLAP_START):
+ seq = seq.slice(tile_low-seq_start);
+ break;
+ case(OVERLAP_END):
+ seq = seq.slice(0, seq_start-tile_high);
+ break;
+ case(CONTAINED_BY):
+ // All of sequence drawn.
+ break;
+ case(CONTAINS):
+ seq = seq.slice(tile_low-seq_start, seq_start-tile_high);
+ break;
+ }
+ // Draw sequence.
+ for (var c = 0, str_len = seq.length; c < str_len; c++) {
+ var c_start = Math.floor( Math.max(0, (seq_start + c - tile_low) * w_scale) );
+ ctx.fillText(seq[c], c_start + this.left_offset + gap - (s_end - s_start)/2, y_center);
+ }
+ }
+ else {
+ // Draw block.
+ ctx.fillStyle = "yellow";
+ // TODO: This is a pretty hack-ish way to fill rectangle based on mode.
+ ctx.fillRect(x_center, y_center + (this.mode != "Dense" ? 2 : 5),
+ s_end - s_start, (this.mode != "Dense" ? SQUISH_FEATURE_HEIGHT : DENSE_FEATURE_HEIGHT));
+ }
+ }
seq_offset += cig_len;
+ // No change to base offset because insertions are drawn above sequence/read.
break;
case "X":
// TODO: draw something?
seq_offset += cig_len;
break;
}
- draw_offset += cig_len;
+ }
+
+ // Draw last items.
+ var item;
+ for (var i = 0; i < draw_last.length; i++) {
+ item = draw_last[i];
+ ctx.fillStyle = "yellow";
+ ctx.drawDownwardEquilateralTriangle(item[0], item[1], item[2]);
}
},
draw_tile: function(resolution, tile_index, parent_element, w_scale) {
var tile_low = tile_index * DENSITY * resolution,
tile_high = ( tile_index + 1 ) * DENSITY * resolution,
tile_span = tile_high - tile_low;
- // console.log("drawing " + tile_low + " to " + tile_high);
+ //console.log("drawing " + tile_low + " to " + tile_high);
/*for (var k in this.data_cache.obj_cache) {
var k_split = k.split("_"), k_low = k_split[0], k_high = k_split[1];
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

commit/galaxy-central: natefoo: Don't use 'python -ES' when scrambling eggs due to '-S' breaking virtualenv.
by Bitbucket 21 Feb '11
by Bitbucket 21 Feb '11
21 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/2c9ce797953d/
changeset: r5096:2c9ce797953d
user: natefoo
date: 2011-02-21 15:46:54
summary: Don't use 'python -ES' when scrambling eggs due to '-S' breaking virtualenv.
affected #: 1 file (4 bytes)
--- a/lib/galaxy/eggs/scramble.py Fri Feb 18 17:47:07 2011 -0500
+++ b/lib/galaxy/eggs/scramble.py Mon Feb 21 09:46:54 2011 -0500
@@ -193,7 +193,7 @@
def run_scramble_script( self ):
log.warning( "%s(): Beginning build" % sys._getframe().f_code.co_name )
# subprocessed to sterilize the env
- cmd = "%s -ES %s" % ( self.python, "scramble.py" )
+ cmd = "%s %s" % ( self.python, "scramble.py" )
log.debug( '%s(): Executing in %s:' % ( sys._getframe().f_code.co_name, self.buildpath ) )
log.debug( ' %s' % cmd )
p = subprocess.Popen( args = cmd, shell = True, cwd = self.buildpath )
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

18 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/040d6f59f464/
changeset: r5095:040d6f59f464
user: kanwei
date: 2011-02-18 23:47:07
summary: Update distutils egg to 0.7, and use the provided HTML output writer to do rst->html conversion. Remove old code that previously did this. This fixes a bug where an extra "</div>" was appended after every output, resulting in the tool config not showing in workflows, in IE.
affected #: 5 files (115 bytes)
--- a/eggs.ini Fri Feb 18 16:21:11 2011 -0500
+++ b/eggs.ini Fri Feb 18 17:47:07 2011 -0500
@@ -32,7 +32,7 @@
amqplib = 0.6.1
Beaker = 1.4
decorator = 3.1.2
-docutils = 0.4
+docutils = 0.7
drmaa = 0.4b3
elementtree = 1.2.6_20050316
GeneTrack = 2.0.0_beta_1
--- a/lib/galaxy/util/__init__.py Fri Feb 18 16:21:11 2011 -0500
+++ b/lib/galaxy/util/__init__.py Fri Feb 18 17:47:07 2011 -0500
@@ -19,7 +19,7 @@
pkg_resources.require( 'docutils' )
import docutils.core
-from galaxy.util.docutils_ext.htmlfrag import Writer as HTMLFragWriter
+import docutils.writers.html4css1
pkg_resources.require( 'elementtree' )
from elementtree import ElementTree, ElementInclude
@@ -252,7 +252,9 @@
def write( self, str ):
if len( str ) > 0 and not str.isspace():
log.warn( str )
- return docutils.core.publish_string( s, writer=HTMLFragWriter(), settings_overrides=dict( warning_stream=FakeStream() ) )
+ return docutils.core.publish_string(s,
+ writer=docutils.writers.html4css1.Writer(),
+ settings_overrides={"embed_stylesheet": False, "template": os.path.join(os.path.dirname(__file__), "docutils_template.txt"), "warning_stream": FakeStream()})
def xml_text(root, name=None):
"""Returns the text inside an element"""
--- a/lib/galaxy/util/docutils_ext/htmlfrag.py Fri Feb 18 16:21:11 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
-# Author: Ollie Rutherfurd
-# Contact: oliver(a)rutherfurd.net
-# Revision: $Revision: 2884 $
-# Date: $Date: 2004-12-08 20:49:05 +0100 (Wed, 08 Dec 2004) $
-# Copyright: This module has been placed in the public domain.
-
-"""
-Simple .ht (HyperText Template) document tree Writer.
-
-.ht tmeplate files are essentially normal HTML, with
-an option set of RFC 2822-like headers at the top of
-the file. There must be at least one blank line between
-the last header and the start of the body HTML.
-
-See http://ht2html.sf.net/ for more information on
-.ht files and ht2html..
-"""
-
-__docformat__ = 'reStructuredText'
-
-import os
-from docutils import nodes
-from docutils import writers
-from docutils import frontend
-from docutils.writers.html4css1 import HTMLTranslator, utils
-
-
-class Writer(writers.Writer):
-
- supported = ('htmlfrag',)
- """Formats this writer supports."""
-
- settings_spec = (
- 'HTML-Specific Options',
- None,
- (('Specify a stylesheet URL, used verbatim. Default is '
- '"default.css". Overrides --stylesheet-path.',
- ['--stylesheet'],
- {'default': 'default.css', 'metavar': '<URL>',
- 'overrides': 'stylesheet_path'}),
- ('Specify a stylesheet file, relative to the current working '
- 'directory. The path is adjusted relative to the output HTML '
- 'file. Overrides --stylesheet.',
- ['--stylesheet-path'],
- {'metavar': '<file>', 'overrides': 'stylesheet'}),
- ('Link to the stylesheet in the output HTML file. This is the '
- 'default.',
- ['--link-stylesheet'],
- {'dest': 'embed_stylesheet', 'action': 'store_false',
- 'validator': frontend.validate_boolean}),
- ('Embed the stylesheet in the output HTML file. The stylesheet '
- 'file must be accessible during processing (--stylesheet-path is '
- 'recommended). Default: link the stylesheet, do not embed it.',
- ['--embed-stylesheet'],
- {'action': 'store_true', 'validator': frontend.validate_boolean}),
- ('Specify the initial header level. Default is 1 for "<h1>". '
- 'Does not affect document title & subtitle (see --no-doc-title).',
- ['--initial-header-level'],
- {'choices': '1 2 3 4 5 6'.split(), 'default': '3',
- 'metavar': '<level>'}),
- ('Specify the maximum width (in characters) for one-column field '
- 'names. Longer field names will span an entire row of the table '
- 'used to render the field list. Default is 14 characters. '
- 'Use 0 for "no limit".',
- ['--field-name-limit'],
- {'default': 14, 'metavar': '<level>',
- 'validator': frontend.validate_nonnegative_int}),
- ('Specify the maximum width (in characters) for options in option '
- 'lists. Longer options will span an entire row of the table used '
- 'to render the option list. Default is 14 characters. '
- 'Use 0 for "no limit".',
- ['--option-limit'],
- {'default': 14, 'metavar': '<level>',
- 'validator': frontend.validate_nonnegative_int}),
- ('Format for footnote references: one of "superscript" or '
- '"brackets". Default is "brackets".',
- ['--footnote-references'],
- {'choices': ['superscript', 'brackets'], 'default': 'brackets',
- 'metavar': '<format>',
- 'overrides': 'trim_footnote_reference_space'}),
- ('Format for block quote attributions: one of "dash" (em-dash '
- 'prefix), "parentheses"/"parens", or "none". Default is "dash".',
- ['--attribution'],
- {'choices': ['dash', 'parentheses', 'parens', 'none'],
- 'default': 'dash', 'metavar': '<format>'}),
- ('Remove extra vertical whitespace between items of bullet lists '
- 'and enumerated lists, when list items are "simple" (i.e., all '
- 'items each contain one paragraph and/or one "simple" sublist '
- 'only). Default: enabled.',
- ['--compact-lists'],
- {'default': 1, 'action': 'store_true',
- 'validator': frontend.validate_boolean}),
- ('Disable compact simple bullet and enumerated lists.',
- ['--no-compact-lists'],
- {'dest': 'compact_lists', 'action': 'store_false'}),
- ('Omit the XML declaration. Use with caution.',
- ['--no-xml-declaration'],
- {'dest': 'xml_declaration', 'default': 1, 'action': 'store_false',
- 'validator': frontend.validate_boolean}),
- ('Scramble email addresses to confuse harvesters. '
- 'For example, "abc(a)example.org" will become '
- '``<a href="mailto:%61%62%63%40...">abc at example dot org</a>``.',
- ['--cloak-email-addresses'],
- {'action': 'store_true', 'validator': frontend.validate_boolean}),))
-
-
- relative_path_settings = ('stylesheet_path',)
-
- output = None
-
- def __init__(self):
- writers.Writer.__init__(self)
- self.translator_class = HTMLFragTranslator
-
- def translate(self):
- visitor = self.translator_class(self.document)
- self.document.walkabout(visitor)
- self.output = visitor.astext()
- self.stylesheet = visitor.stylesheet
- self.body = visitor.body
-
-
-class HTMLFragTranslator(HTMLTranslator):
-
- def __init__(self, document):
- # I don't believe we can embed any style content
- # the header, so always link to the stylesheet.
- document.settings.embed_stylesheet = 0
- HTMLTranslator.__init__(self, document)
-
- def astext(self):
- # kludge! want footer, but not '</body></html>'
- body = self.body_pre_docinfo + self.docinfo + self.body + \
- self.body_suffix[:-1]
- return ''.join(body)
-
-# :indentSize=4:lineSeparator=\n:noTabs=true:tabSize=4:
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

18 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/751b80f0bbf4/
changeset: r5094:751b80f0bbf4
user: natefoo
date: 2011-02-18 22:21:11
summary: Fix for 3 of the 4 failing upload tests.
affected #: 1 file (3 bytes)
--- a/test/functional/test_get_data.py Fri Feb 18 15:06:34 2011 -0500
+++ b/test/functional/test_get_data.py Fri Feb 18 16:21:11 2011 -0500
@@ -228,7 +228,7 @@
hda = get_latest_hda()
assert hda is not None, "Problem retrieving hda from database"
self.verify_dataset_correctness( 'qualscores.qualsolid', hid=str( hda.hid ) )
- self.check_history_for_string( '48 lines, format: <span class="qualsolid">qualsolid</span>, database: \? Info: uploaded file' )
+ self.check_history_for_string( '48 lines format: <span class="qualsolid">qualsolid</span>, database: \? Info: uploaded file' )
self.check_metadata_for_string( 'Change data type value="qualsolid" selected="yes">qualsolid' )
self.delete_history( id=self.security.encode_id( history.id ) )
def test_0090_upload_file( self ):
@@ -240,7 +240,7 @@
hda = get_latest_hda()
assert hda is not None, "Problem retrieving hda from database"
self.verify_dataset_correctness( 'qualscores.qual454', hid=str( hda.hid ) )
- self.check_history_for_string( '49 lines, format: <span class="qual454">qual454</span>, database: \?' )
+ self.check_history_for_string( '49 lines format: <span class="qual454">qual454</span>, database: \?' )
self.check_metadata_for_string( 'Change data type value="qual454" selected="yes">qual454' )
self.delete_history( id=self.security.encode_id( history.id ) )
def test_0095_upload_file( self ):
@@ -357,7 +357,7 @@
hda = get_latest_hda()
assert hda is not None, "Problem retrieving hda from database"
self.verify_dataset_correctness( 'shrimp_cs_test1.csfasta', hid=str( hda.hid ) )
- self.check_history_for_string( '2,500 sequences, format: <span class="csfasta">csfasta</span>, <td>>2_14_26_F3,-1282216.0</td>' )
+ self.check_history_for_string( '2,500 sequences format: <span class="csfasta">csfasta</span>, <td>>2_14_26_F3,-1282216.0</td>' )
self.check_metadata_for_string( 'value="shrimp_cs_test1.csfasta" value="\?" Change data type value="csfasta" selected="yes"' )
self.delete_history( id=self.security.encode_id( history.id ) )
def test_0140_upload_file( self ):
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0

18 Feb '11
1 new changeset in galaxy-central:
http://bitbucket.org/galaxy/galaxy-central/changeset/1dfad17e81a8/
changeset: r5093:1dfad17e81a8
user: kanwei
date: 2011-02-18 21:06:34
summary: Use jStorage (http://www.jstorage.info/) instead of jStore. Tested to be working on IE7 and IE8, where the latter was failing. Fixes links not showing up in history pane to expand histories.
affected #: 15 files (779 bytes)
--- a/static/scripts/class.js Fri Feb 18 14:53:35 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*!
- * Class definition
- *
- * Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
- * Inspired by base2 and Prototype
- */
-
-//"use strict";
-
-(function () {
-
- var initializing = false,
-
- fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
-
- // The base Class implementation (does nothing)
- this.Class = function(){};
-
- // Create a new Class that inherits from this class
- Class.extend = function (prop)
- {
- var _super = this.prototype;
-
- // Instantiate a base class (but only create the instance, don't run the init constructor)
- initializing = true;
-
- var prototype = new this();
-
- initializing = false;
-
- // Copy the properties over onto the new prototype
- for (var name in prop)
- {
-
- // Check if we're overwriting an existing function
- prototype[name] = (typeof prop[name] === "function" && typeof _super[name] === "function" && fnTest.test(prop[name]) ?
-
- (function(name, fn)
- {
- return function()
- {
- var tmp = this._super;
-
- // Add a new ._super() method that is the same method
- // but on the super-class
- this._super = _super[name];
-
- // The method only need to be bound temporarily, so we
- // remove it when we're done executing
- var ret = fn.apply(this, arguments);
- this._super = tmp;
-
- return ret;
- };
- }(name, prop[name])) : prop[name]);
- }
-
- // The dummy class constructor
- function Class()
- {
- // All construction is actually done in the init method
- if (!initializing && this.init)
- {
- this.init.apply(this, arguments);
- }
- }
-
- // Populate our constructed prototype object
- Class.prototype = prototype;
-
- // Enforce the constructor to be what we expect
- Class.constructor = Class;
-
- // And make this class extendable
- Class.extend = arguments.callee;
-
- return Class;
- };
-
-}());
--- a/static/scripts/galaxy.base.js Fri Feb 18 14:53:35 2011 -0500
+++ b/static/scripts/galaxy.base.js Fri Feb 18 15:06:34 2011 -0500
@@ -424,7 +424,7 @@
var action = function() {
// Load saved state and show as necessary
try {
- var stored = $.jStore.store("history_expand_state");
+ var stored = $.jStorage.get("history_expand_state");
if (stored) {
for (var id in stored) {
$("#" + id + " div.historyItemBody" ).show();
@@ -432,7 +432,7 @@
}
} catch(err) {
// Something was wrong with values in storage, so clear storage
- $.jStore.remove("history_expand_state");
+ $.jStorage.deleteKey("history_expand_state");
}
// If Mozilla, hide scrollbars in hidden items since they cause animation bugs
@@ -455,10 +455,10 @@
if (!nochanges) { // Ignore embedded item actions
// Save setting
- prefs = $.jStore.store("history_expand_state");
+ prefs = $.jStorage.get("history_expand_state");
if (prefs) {
delete prefs[id];
- $.jStore.store("history_expand_state", prefs);
+ $.jStorage.set("history_expand_state", prefs);
}
}
} else {
@@ -469,10 +469,10 @@
if (!nochanges) {
// Save setting
- prefs = $.jStore.store("history_expand_state");
- if (prefs === undefined) { prefs = {}; }
+ prefs = $.jStorage.get("history_expand_state");
+ if (!prefs) { prefs = {}; }
prefs[id] = true;
- $.jStore.store("history_expand_state", prefs);
+ $.jStorage.set("history_expand_state", prefs);
}
}
return false;
@@ -481,8 +481,8 @@
// Generate 'collapse all' link
$("#top-links > a.toggle").click( function() {
- var prefs = $.jStore.store("history_expand_state");
- if (prefs === undefined) { prefs = {}; }
+ var prefs = $.jStorage.get("history_expand_state");
+ if (!prefs) { prefs = {}; }
$( "div.historyItemBody:visible" ).each( function() {
if ( $.browser.mozilla ) {
$(this).find( "pre.peek" ).css( "overflow", "hidden" );
@@ -492,19 +492,11 @@
delete prefs[$(this).parent().attr("id")];
}
});
- $.jStore.store("history_expand_state", prefs);
+ $.jStorage.set("history_expand_state", prefs);
}).show();
};
- if (noinit) {
- action();
- } else {
- // Load jStore for local storage
- $.jStore.init("galaxy"); // Auto-select best storage
- $.jStore.ready(function() {
- action();
- });
- }
+ action();
}
function commatize( number ) {
--- a/static/scripts/jquery.jstore.js Fri Feb 18 14:53:35 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1810 +0,0 @@
-/*!
- * jStore 2.0 - Persistent Client Side Storage
- *
- * Copyright (c) 2010 Eric Garside (http://eric.garside.name/)
- * Dual licensed under:
- * MIT: http://www.opensource.org/licenses/mit-license.php
- * GPLv3: http://www.opensource.org/licenses/gpl-3.0.html
- *
- * ---------------------------
- *
- * jStore Flash Storage Component
- *
- * Copyright (c) 2006 Jeff Lerman (jeff(a)blip.tv)
- * Licensed under the Creative Commons Attribution 3.0 United States License:
- * http://creativecommons.org/licenses/by/3.0/us
- */
-
-//"use strict";
-
-/*global Class, window, jQuery, ActiveXObject, google */
-
-/*jslint white: true, browser: true, onevar: true, undef: true, eqeqeq: true, bitwise: true, regexp: false, strict: true, newcap: true, immed: true, maxerr: 50, indent: 4 */
-
-(function ($, window) {
-
- //------------------------------
- //
- // Constants
- //
- //------------------------------
-
- //------------------------------
- // Exceptions
- //------------------------------
-
- /**
- * An exception thrown by the StorageEngine class whenever its data accessor methods
- * are called before the engine is ready to transact data.
- */
- var EX_UNSTABLE = 'JSTORE_ENGINE_UNSTABLE',
-
- /**
- * An exception thrown by jStore whenever an undefined storage engine is referenced for
- * some task by an invalid JRI (jStore Resource Identifier).
- */
- EX_UNKNOWN = 'JSTORE_UNKNOWN_ENGINE_REQUESTED',
-
- /**
- * An exception thrown by jStore whenever a given flavor of storage is double defined.
- */
- EX_COLLISION = 'JSTORE_ENGINE_NAMESPACE_COLLISION',
-
- /**
- * An exception thrown by jStore whenever a jri is double applied to a resource.
- */
- EX_DUPLICATE = 'JSTORE_RESOURCE_NAMESPACE_COLLISION',
-
- /**
- * An exception thrown by jStore whenever a given flavor of storage has no defined engine.
- */
- EX_UNAVAILABLE = 'JSTORE_ENGINE_UNAVAILABLE',
-
- /**
- * An exception thrown by jStore whenever an invalid flavor type is used.
- */
- EX_INVALID = 'JSTORE_INVALID_FLAVOR',
-
- //------------------------------
- // Regular Expressions
- //------------------------------
-
- /**
- * Regular expression to test property values for being JSON.
- */
- RX_JSON = (function ()
- {
- try
- {
- return new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$');
- }
- catch (e)
- {
- return (/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/);
- }
- }()),
-
- //------------------------------
- // Storage Flavors
- //------------------------------
-
- /**
- * The storage flavor identifier for HTML5 local storage.
- */
- FLAVOR_LOCAL = 'jstore-html5-local',
-
- /**
- * The storage flavor identifier for HTML5 database storage.
- */
- FLAVOR_SQL = 'jstore-html5-sql',
-
- /**
- * The storage flavor identifier for Adobe Flash SharedObject storage.
- */
- FLAVOR_FLASH = 'jstore-flash',
-
- /**
- * The storage flavor identifier for Google Gears storage.
- */
- FLAVOR_GEARS = 'jstore-google-gears',
-
- /**
- * The storage flavor identifier for Internet Explorer storage, available to IE7 and IE6.
- */
- FLAVOR_MSIE = 'jstore-msie',
-
- //------------------------------
- //
- // Property Declaration
- //
- //------------------------------
-
- /**
- * The base StorageEngine class which each "storage flavor" will extend to meet the
- * requirements for its specific implementation.
- */
- StorageEngine,
-
- /**
- * The jStore object. Internal to this closure, jStore is referenced by "_". It is
- * exposed to jQuery below, and made publicly accessible through jQuery.jStore
- */
- _ = {},
-
- /**
- * The engines available to jStore for use. These are the class definitions for flavored
- * storage engines.
- *
- * Signature:
- * {
- * <storageFlavor>: <flavoredStorageEngineDefinition>,
- *
- * ...
- * }
- */
- definitions = {},
-
- /**
- * Active engines instantiated by jStore, indexed by their JRI.
- *
- * Signature:
- * {
- * <engineJRI>: <engineInstance>,
- *
- * ...
- * }
- */
- engines = {},
-
- /**
- * If we are going to be using the flash storage engine, we want to postpone the jStore ready event until the jStore
- * isFlashReady flag is also true. This property is set whenever flash is determined to be the storage engine.
- */
- waitForFlash = false,
-
- /**
- * Storage for listeners, indexed by content and event type.
- *
- * Signature:
- * {
- * <context>:
- * {
- * <eventType>: [<listener>, ...],
- *
- * ...
- * },
- *
- * ...
- * }
- */
- events = {},
-
- /**
- * The configuration for this implementation.
- *
- * Signature:
- * {
- * project: <defaultProjectName>,
- *
- * flash: <pathToFlashBootloader>,
- *
- * json: <pathToJSONFile>,
- *
- * errorCallback: <listenerToNotifyOnError>
- * }
- */
- configurations =
- {
- project: undefined,
-
- flash: 'jStore.Flash.html',
-
- json: 'browser.json.js'
- },
-
- /**
- * The active storage engine, being used to satisfy the get/set/remove functions on the jStore and jQuery
- * objects.
- */
- active;
-
- //------------------------------
- //
- // Internal Methods
- //
- //------------------------------
-
- /**
- * Determine if the given flavor is valid.
- *
- * @param flavor The flavor to test.
- *
- * @return True if the flavor is valid, false otherwise.
- */
- function validFlavor(flavor)
- {
- switch (flavor)
- {
-
- case FLAVOR_LOCAL:
- case FLAVOR_SQL:
- case FLAVOR_FLASH:
- case FLAVOR_GEARS:
- case FLAVOR_MSIE:
- return true;
-
- default:
- return false;
-
- }
- }
-
- /**
- * Performs enhanced type comparison on an object. This is more reliable method
- * of type checking a variable than a simple typeof comparison. The reason is that,
- * typeof will reduce to the lowest common type.
- *
- * "typeof []" returns Object, and not Array.
- * "typeof {}" returns Object as well.
- *
- * typecheck( [], 'Array' ) : returns true;
- * typecheck( [], 'Object' ) : returns false;
- *
- * @param type The variable type to check.
- *
- * @param compare A string representing the literal type to check.
- *
- * @return True if the variable "type" matches the compare literal.
- */
- function typecheck(type, compare)
- {
- return !type ? false : type.constructor.toString().match(new RegExp(compare + '\\(\\)', 'i')) !== null;
- }
-
- /**
- * If the provided listener is a valid function, it will be triggered with the provided context
- * and parameters.
- *
- * @param listener The listener being triggered.
- *
- * @param context The context to provide to the listener.
- *
- * @param parameters The parameters to pass to the listener as arguments.
- *
- * @return The response of the notified listener.
- */
- function notify(listener, context, parameters)
- {
- if (typecheck(listener, 'Function'))
- {
- return listener.apply(context || _, typecheck(parameters, 'Array') ? parameters : [parameters]);
- }
- }
-
- /**
- * Load the given script.
- *
- * @param path The path to the file to include.
- *
- * @param listener The listener to notify when the file finishes loading.
- */
- function loadScript(path, listener)
- {
- $.ajax(
- {
- url: path,
- complete: listener || $.noop(),
- type: 'GET',
- dataType: 'script',
- cache: false
- });
- }
-
- /**
- * Checks the type of the value, and returns a value safe to persist in any client-side mechanism.
- *
- * @param value The value which should be prepared for storage.
- *
- * @return A value safe for storage.
- */
- function prepareForStorage(value)
- {
- if (value === undefined)
- {
- return '';
- }
-
- if (typecheck(value, 'Object') ||
- typecheck(value, 'Array') ||
- typecheck(value, 'Function'))
- {
- return JSON.stringify(value);
- }
-
- return value;
- }
-
- /**
- * Checks the type of the value, and returns a value safe for access in any client-side mechanism.
- *
- * @param value The value which should be prepared for use.
- *
- * @return A value safe for use.
- */
- function prepareForRevival(value)
- {
- return RX_JSON.test(value) ? JSON.parse(value) : value;
- }
-
- /**
- * Normalize a key before using it, to ensure it's valid.
- *
- * @param key The key to normalize.
- *
- * @return A normalized key, safe for storage.
- */
- function normalizeKey(key)
- {
- return key.replace(/^\s+|\s+$/g, "");
- }
-
- /**
- * Define a flavored storage engine.
- *
- * @throws EX_COLLISION, EX_INVALID
- *
- * @param flavor The flavor of engine being defined.
- *
- * @param definition An object containing the new properties and methods for the engine extension.
- *
- * @param availability A function to invoke which must return a boolean value indicating the
- * availability of the storage flavor on this browser.
- */
- function define(flavor, definition, availability)
- {
- if (!validFlavor(flavor))
- {
- throw EX_INVALID;
- }
-
- if (availability[flavor] !== undefined)
- {
- throw EX_COLLISION;
- }
-
- /**
- * The logic here has been reworked so unavailable flavors are discarded, so we don't needlessly
- * bloat the runtime size of jStore.
- */
- if (notify(availability) === true)
- {
- _.available[flavor] = true;
-
- definition.flavor = flavor;
-
- definitions[flavor] = StorageEngine.extend(definition);
- }
- else
- {
- _.available[flavor] = false;
-
- // Filter the invalid flavor out of the priority list.
- _.enginePriority = $.map(_.enginePriority, function (engine)
- {
- if (engine === flavor)
- {
- return null;
- }
- else
- {
- return engine;
- }
- });
- }
- }
-
- /**
- * Make the jStore library ready.
- */
- function makeReady()
- {
- if (_.isReady)
- {
- return;
- }
-
- if ((waitForFlash && _.isFlashReady) || !waitForFlash)
- {
- _.isReady = true;
- _.trigger('jstore-ready', [engines[active]]);
- }
- }
-
- /**
- * Create a best-fit engine.
- */
- function createBestFitEngine()
- {
- _.create(_.enginePriority[0], undefined, 'best-fit');
- }
-
- /**
- * Get the flash version currently supported in this browser.
- *
- * @return The flash version.
- */
- function flashVersion()
- {
- // MSIE
- try
- {
- // avoid fp6 minor version lookup issues
- // see: http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet…
- var axo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
-
- try
- {
- axo.AllowScriptAccess = 'always';
- }
- catch (axo_e)
- {
- return '6,0,0';
- }
-
- return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
- }
-
- // Real browsers
- catch (e)
- {
- try
- {
- if (navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
- {
- return (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
- }
- }
- catch (flash_e)
- {}
- }
-
- return '0,0,0';
- }
-
- /**
- * Flash Detection functions copied from the jQuery Flash Plugin
- *
- * Copyright (c) 2006 Luke Lutman (http://jquery.lukelutman.com/plugins/flash)
- *
- * Dual licensed under the MIT and GPL licenses.
- * http://www.opensource.org/licenses/mit-license.php
- * http://www.opensource.org/licenses/gpl-license.php
- *
- * @param version The version to compare to.
- *
- * @return True if the version is greater than or equal to the required version, false otherwise.
- */
- function hasFlashVersion(version)
- {
- var playerVersion = flashVersion().match(/\d+/g),
- requiredVersion = version.match(/\d+/g),
- index = 0,
- player,
- required;
-
- for (; index < 3; index++)
- {
- player = parseInt(playerVersion[index], 10);
- required = parseInt(requiredVersion[index], 10);
-
- // Player version is less than what is required.
- if (player < required)
- {
- return false;
- }
-
- // Player version is greater than what is required.
- else if (player > required)
- {
- return true;
- }
- }
-
- // Player and required version match exactly.
- return true;
- }
-
- //------------------------------
- //
- // Plugin Definition
- //
- //------------------------------
-
- //------------------------------
- // Error Declaration
- //------------------------------
-
- //------------------------------
- // Plugin Creation
- //------------------------------
-
- /**
- * The jStore object. Manages a collection of StorageEngines for particular "storage flavors", or the types
- * of storage solutions available to each browser.
- *
- * 2.0 Version Notes:
- *
- * - The user is now responsible for third-party script includes, with the exception of flash.
- *
- * - jStore has been given sole responsibility for testing engine availability.
- *
- * - For the sake of naming conventions, all property names now start with a lowercase, and are camel-cased.
- *
- * The following properties have been changed since the 1.2.x release:
- *
- * - EngineOrder: For the sake of naming conventions, renamed to enginePriority.
- *
- * The following properties and methods have been removed since the 1.2.x release:
- *
- * - Availability: jStore's engines would add their availability tests to this object, so jStore could test
- * them. With the changes to how availability testing works, this property has been removed.
- * A new property, "available" on jStore contains a set of available engines.
- *
- * - Engines: Formerly contained the definitions of storage engines. This property has been removed, and
- * storage of these definitions has been moved internal to the closure.
- *
- * - Instances: Formerly contained instantiated storage engines. This property has been removed, and storage
- * of instantiated engines has been moved internal to the closure.
- *
- * - CurrentEngine: Formerly contained the active storage engine being used for transacting data through the jStore
- * and/or jQuery objects. This property has been removed, and storage of the current engine has
- * been moved internal to the closure. A new method, "activeEngine" has been added to jQuery to
- * get and set the active engine to use.
- *
- * - defaults: Formerly used to set the implementation options for jStore. This property has been removed and
- * replaced with a new configuration metho on the jStore object.
- *
- * - delegate: The delegate class has been removed in favor of a much simpler bind/trigger accessor system, which
- * is accessible contextually through storage engines, or generically through jStore.
- *
- * + fail: This registration class bound events on the delegate for jstore-fail events. Instead, use:
- * jStore.bind('jstore-failure', listener);
- *
- * + flashReady: This registration class bound events on the delegate for flash-ready events. The jstore-ready method
- * now accounts for waiting for flash readyness, if and only if the flash engine is being used. Simply
- * call to jStore.ready().
- *
- * + load: Replaced with the init() method, which performs the same basic functions as the old load() method. Also,
- * the init function is now domready safe, meaning it wraps itself in a domready listener, so the end user
- * doesn't have to.
- *
- * + FindEngine: Removed entirely. The functionality provided by this method now implicitly occurs with the new define()
- * system implemented for engine flavors.
- *
- * + setCurrentEngine: Replaced by activeEngine(). Set the current active engine by passing in the JRI.
- *
- * + safeStore: Replaced by a method internal to this closure, "prepareForStorage".
- *
- * + safeResurrect: Replaced by a method internal to this closure, "prepareForRevival".
- *
- * + use: Replaced by "create".
- */
- $.extend(_, {
-
- //------------------------------
- // Properties
- //------------------------------
-
- /**
- * The priority order in which engines should be tested for use. The lower their index in the array, the higher
- * their priority for use.
- *
- * Be weary when reconfiguring the priority order of engines! jStore will use the first available engine it finds
- * based on its priority when autoloading.
- *
- * This array is filtered out as engines are defined, with invalid engines being removed.
- *
- * Signature:
- * [FLAVOR_<storageFlavor>, ...]
- */
- enginePriority: [FLAVOR_LOCAL, FLAVOR_SQL, FLAVOR_FLASH, FLAVOR_MSIE],
-
- /**
- * A collection of the availability states of engines, indexed by their flavor.
- *
- * Signature:
- * {
- * <storageFlavor>: true|false,
- *
- * ...
- * }
- */
- available: {},
-
- /**
- * Flag to determine if the jStore library is ready. jStore becomes ready once the dom is ready and all necessary
- * startup procedures required by jStore to function properly are completed.
- */
- isReady: false,
-
- /**
- * With the flash storage engine, we have to jump through a couple of hoops before the flash engine is ready to work.
- * This flag tracks whether or not the flash storage is available.
- */
- isFlashReady: false,
-
- /**
- * The available engine flavors.
- */
- flavors:
- {
- local: FLAVOR_LOCAL,
-
- sql: FLAVOR_SQL,
-
- flash: FLAVOR_FLASH,
-
- gears: FLAVOR_GEARS,
-
- msie: FLAVOR_MSIE
- },
-
- //------------------------------
- // Constructor
- //------------------------------
-
- /**
- * Constructor.
- *
- * @throws EX_INVALID
- *
- * @param project The name of the jStore project. Used to generate a JRI for the engine we create.
- *
- * @param configuration Optionally, an object containing configuration options for this implementation.
- *
- * @param flavor Optionally, the flavor of storage to use. If not provided, jStore will pick the
- * best flavor, based on the current browser.
- *
- * @return jStore
- */
- init: function (project, configuration, flavor)
- {
- // Extend our plugin configurations
- $.extend(configurations, {project: project}, configuration);
-
- $(function ()
- {
- // If JSON parsing isn't defined in this browser, include it.
- if (window.JSON === undefined)
- {
- loadScript(configurations.json);
- }
-
- // If we have an explicit flavor to use, use it.
- if (flavor !== undefined)
- {
- _.create(flavor, project, 'default');
- }
-
- // Otherwise, attempt to create a best-fit engine.
- else
- {
- createBestFitEngine();
- }
- });
-
- return _;
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- /**
- * Create an instance of a flavored engine.
- *
- * @throws EX_INVALID, EX_UNAVAILABLE, EX_DUPLICATE
- *
- * @param flavor The flavor to create the engine with.
- *
- * @param project The project identifier for this instance.
- *
- * @param identifier Some arbitrary identifier for this project instance of the engine.
- *
- * @return The created instance.
- */
- create: function (flavor, project, identifier)
- {
- project = project || configurations.project || location.hostname.replace(/\./g, '-') || 'unknown';
-
- if (!validFlavor(flavor))
- {
- throw EX_INVALID;
- }
-
- if (definitions[flavor] === undefined)
- {
- throw EX_UNAVAILABLE;
- }
-
- var jri = (identifier !== undefined ? identifier + '.' : '') + project + '.' + flavor,
- engine;
-
- if (engines[jri] !== undefined)
- {
- throw EX_DUPLICATE;
- }
-
- // Create our engine instance.
- engine = engines[jri] = new definitions[flavor](project, jri);
-
- // Set up a listener for our jstore-engine-ready event.
- engine.ready(function ()
- {
- _.trigger('jstore-engine-ready', [engine]);
- });
-
- if (flavor === FLAVOR_FLASH && !_.isFlashReady)
- {
- if (active === undefined)
- {
- waitForFlash = true;
- }
-
- // Define a window-accessible function for flash to call via ExternalInterface
- window.jstore_ready = function ()
- {
- _.isFlashReady = true;
- _.trigger('flash-ready');
-
- if (active === undefined)
- {
- makeReady();
- }
-
- // Remove the callback from the window scope, as it is no longer necessary
- window.flash_ready = undefined;
- };
-
- window.jstore_error = function (message)
- {
- _.trigger('jstore-error', ['JSTORE_FLASH_EXCEPTION', null, message]);
- };
-
- $('<iframe style="height:1px;width:1px;position:absolute;left:0;top:0;margin-left:-100px;" id="jStoreFlashFrame" src="' +
- configurations.flash + '"></iframe>').appendTo('body');
- }
- else if (active === undefined)
- {
- active = jri;
- makeReady();
- }
-
- return engine;
- },
-
- /**
- * Fetch an engine by it's JRI.
- *
- * @param jri The JRI of the engine to retrieve.
- *
- * @return The requested engine.
- */
- engine: function (jri)
- {
- return engines[jri];
- },
-
- /**
- * Returns the active storage engine being used. If a value is passed, sets that engine as the active engine.
- *
- * @throws EX_UNKNOWN
- *
- * @param jri Optionally, the JRI of the engine to make active, if it should be changed.
- *
- * @return The active storage engine.
- */
- activeEngine: function (jri)
- {
- if (jri !== undefined)
- {
- if (engines[jri] === undefined)
- {
- throw EX_UNKNOWN;
- }
- else
- {
- active = jri;
- }
- }
-
- return engines[active];
- },
-
- /**
- * Bind an event listener.
- *
- * @param event The event to bind a listener on.
- *
- * @param listener The listener to notify when the event occurs.
- *
- * @param context The context of the binding. A string representing the engine flavor
- * binding the event, or undefined to indicate it's a jStore event.
- *
- * @return jStore
- */
- bind: function (event, listener, context)
- {
- context = context || 'jstore';
-
- if (events[context] === undefined)
- {
- events[context] = {};
- }
-
- if (events[context][event] === undefined)
- {
- events[context][event] = [listener];
- }
- else
- {
- events[context][event].push(listener);
- }
-
- return _;
- },
-
- /**
- * Trigger an event, notifying any bound listeners.
- *
- * @param event The event to trigger.
- *
- * @param parameters Any additional parameters to pass to the listeners being notified.
- *
- * @param context The context of the binding. A string representing the engine flavor
- * binding the event, or undefined to indicate it's a jStore event.
- *
- * @return jStore
- */
- trigger: function (event, parameters, context)
- {
- context = context || 'jstore';
-
- if (events[context] !== undefined)
- {
- if (events[context][event] !== undefined)
- {
- $.each(events[context][event], function ()
- {
- notify(this, _, parameters);
- });
- }
- }
-
- return _;
- },
-
- /**
- * Bind a listener to be notified when jStore causes a non-fatal exception.
- *
- * @param listener The listener to notify when a failure occurs.
- */
- error: function (listener)
- {
- _.bind('jstore-error', listener);
- },
-
- /**
- * Bind a listener to be notified when jStore is ready.
- *
- * @param listener The listener to notify when jStore is ready.
- *
- * @return jStore
- */
- ready: function (listener)
- {
- if (_.isReady)
- {
- notify(listener);
- }
- else
- {
- _.bind('jstore-ready', listener);
- }
-
- return _;
- },
-
- /**
- * Bind a listener to be notified when jStore and the default engine are ready.
- *
- * @param listener The listener to notify when jStore and it's default engine are ready.
- *
- * @return jStore
- */
- engineReady: function (listener)
- {
- if (_.isReady)
- {
- notify(listener);
- }
- else
- {
- _.bind('jstore-engine-ready', listener);
- }
-
- return _;
- },
-
- /**
- * A combined getter/setter for the active engine.
- *
- * @param key The key of the property to get, or set.
- *
- * @param value If a valid value is provided, sets the engine.
- *
- * @return The requested property value.
- */
- store: function (key, value)
- {
- return value === undefined ? _.get(key) : _.set(key, value);
- },
-
- /**
- * Remove a property from the active engine.
- *
- * @param key The key of the property to remove.
- *
- * @return The value of the property before removal.
- */
- remove: function (key)
- {
- return _.activeEngine().remove(key);
- },
-
- /**
- * Get a property from the active engine.
- *
- * @param key The key of the property to get.
- *
- * @return The value of the property.
- */
- get: function (key)
- {
- return _.activeEngine().get(key);
- },
-
- /**
- * Set a property on the active engine.
- *
- * @param key The key of the property to set.
- *
- * @param value The value to set the property to.
- *
- * @return The new value of the property.
- */
- set: function (key, value)
- {
- return _.activeEngine().set(key, value);
- }
-
- });
-
- //------------------------------
- // Core Extension
- //------------------------------
-
- //------------------------------
- //
- // Class Definition
- //
- //------------------------------
-
- /**
- * The StorageEngine class is the unified API through which jStore accesses and manipulates
- * the various storage flavors available.
- *
- * 2.0 Version Notes:
- *
- * - All third-party loading is now the responsibility of the developer.
- *
- * - The delegate class has been removed entirely. Engines have been given "bind" and "trigger" methods
- * to interact directly with the delegate like-replacement that has been added to jStore.
- *
- * - Engine availability has been moved out of the engines themselves, and elevated to a jStore
- * responsibility.
- *
- * The following methods have changed since the 1.2.x release:
- *
- * - get: When "get"ting a non-stored property, the get function will now return "undefined"
- * instead of "null". "null" can now be used as a valid property value.
- *
- * - rem: Renamed to "remove". I always felt dirty about "rem" being vaguely explicit.
- *
- * The following properties have been removed since the 1.2.x release:
- *
- * - autoload: Part of the third-party loading logic.
- *
- * - hasIncluded: Part of the third-party loading logic.
- *
- * - includes: Part of the third-party loading logic.
- *
- * - isAvailable: Part of the availability logic elevated to jStore.
- *
- * @throws EX_UNSTABLE
- */
- StorageEngine = Class.extend({
-
- //------------------------------
- // Properties
- //------------------------------
-
- /**
- * The project which owns this storage engine.
- */
- project: undefined,
-
- /**
- * The JRI (jStore Resource Identifier) acts as a uuid for this specific instance
- * of the storage engine.
- */
- jri: undefined,
-
- /**
- * The flavor of this engine.
- */
- flavor: undefined,
-
- /**
- * The actual database object which data is transacted through.
- */
- database: undefined,
-
- /**
- * A StorageEngine should always respond to fetch requests synchronously. However, some
- * of the storage flavors require callback-based asynchronous access. To get around this,
- * we simlpy require all engines to function off a primary data cache, to allow for
- * synchronous access across all implementations.
- *
- * Signature:
- * {
- * <propertyKey>: <propertyValue>,
- *
- * ...
- * }
- */
- data: undefined,
-
- /**
- * A number of storage engines enforce a size limit as to what they will persist for a given site.
- * This limit is not monitored or computed by jStore currently, and this property will merely give
- * a static indication of the total size alloted to the engine, as defined by the storage flavor.
- */
- limit: undefined,
-
- /**
- * Each storage flavor has a different process to go through before it's "ready" to transact data. This
- * property stores the state of the engine's readyness, and uses it to notify listeners whenever jStore
- * is ready to function.
- */
- isReady: undefined,
-
- //------------------------------
- // Constructor
- //------------------------------
-
- /**
- * Constructor.
- *
- * @param project The project which instantiated this engine.
- *
- * @param jri The uuid assigned to this instance by jStore.
- */
- init: function (project, jri)
- {
- this.project = project;
- this.jri = jri;
- this.data = {};
- this.isReady = false;
- this.updateCache();
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- /**
- * Update the cache.
- */
- updateCache: function ()
- {
- this.isReady = true;
- this.trigger('engine-ready', [this]);
- },
-
- /**
- * Bind a listener to an event dispatched by this engine.
- *
- * @param event The event to bind on.
- *
- * @param listener The listener to notify when the event occurs.
- */
- bind: function (event, listener)
- {
- _.bind(event, listener, this.jri);
- },
-
- /**
- * Trigger an event, notifying all bound listeners.
- *
- * @param event The event to trigger.
- *
- * @param parameters An optional Array of parameters to pass to the listeners.
- */
- trigger: function (event, parameters)
- {
- _.trigger(event, parameters, this.jri);
- },
-
- /**
- * Bind a listener to the StorageEngine's ready event.
- *
- * @param listener The listener to notify whenever this engine is ready to transact data.
- */
- ready: function (listener)
- {
- if (this.isReady)
- {
- notify(listener, this);
- }
- else
- {
- this.bind('engine-ready', listener);
- }
- },
-
- /**
- * Get a property from the StorageEngine.
- *
- * @param key The property key of the data to retrieve.
- *
- * @return The property value, or "undefined" if the property isn't stored.
- */
- get: function (key)
- {
- this.__interruptAccess();
-
- return this.data[key];
- },
-
- /**
- * Sets a property in the StorageEngine.
- *
- * @param key The key of the property.
- *
- * @param value The value of the property.
- *
- * @return The new value of the property.
- */
- set: function (key, value)
- {
- this.__interruptAccess();
-
- key = normalizeKey(key);
-
- try
- {
- this.__set(key, value);
- }
- catch (e)
- {
- _.trigger('jstore-error', ['JSTORE_STORAGE_FAILURE', this.jri, e]);
- }
-
- this.data[key] = value;
-
- return value;
- },
-
- /**
- * Removes a property from the StorageEngine.
- *
- * @param key The property key of the data to remove.
- *
- * @return The value of the property, before it was removed.
- */
- remove: function (key)
- {
- this.__interruptAccess();
-
- key = normalizeKey(key);
-
- try
- {
- this.__remove(key);
- }
- catch (e)
- {
- _.trigger('jstore-error', ['JSTORE_REMOVE_FAILURE', this.jri, e]);
- }
-
- var buffer = this.data[key];
-
- this.data[key] = undefined;
-
- return buffer;
- },
-
- //------------------------------
- // Internal Methods
- //------------------------------
-
- /**
- * Ensures the engine is in a stable state for transacting data.
- *
- * @throws EX_UNSTABLE
- */
- __interruptAccess: function ()
- {
- if (!this.isReady)
- {
- throw EX_UNSTABLE;
- }
- },
-
- /**
- * Sets a property in the StorageEngine. This method should be overloaded to provide actual
- * storage flavor integration.
- *
- * @param key The key of the property.
- *
- * @param value The value of the property.
- *
- * @return The new value of the property.
- */
- __set: function (key, value)
- {
- return;
- },
-
- /**
- * Removes a property from the StorageEngine. This method should be overloaded to provide actual
- * storage flavor integration.
- *
- * @param key The property key of the data to remove.
- *
- * @return The value of the property, before it was removed.
- */
- __remove: function (key)
- {
- return;
- }
-
- });
-
- //------------------------------
- //
- // jQuery Hooks
- //
- //------------------------------
-
- $.extend($.fn, {
-
- //------------------------------
- // Methods
- //------------------------------
-
- /**
- * A combined getter/setter for the active engine.
- *
- * @param key The key of the property to get, or set.
- *
- * @param value If a valid value is provided, sets the engine.
- *
- * @return jQuery
- */
- store: function (key, value)
- {
- if (value === undefined)
- {
- _.get(key);
- }
- else
- {
- _.set(key, value);
- }
-
- return this;
- },
-
- /**
- * Remove a property from the active engine.
- *
- * @param key The key of the property to remove.
- *
- * @return jQuery
- */
- removeStore: function (key)
- {
- _.activeEngine().remove(key);
-
- return this;
- },
-
- /**
- * Get a property from the active engine.
- *
- * @param key The key of the property to get.
- *
- * @return The value of the property.
- */
- getStore: function (key)
- {
- return _.activeEngine().get(key);
- },
-
- /**
- * Set a property on the active engine.
- *
- * @param key The key of the property to set.
- *
- * @param value The value to set the property to.
- *
- * @return jQuery
- */
- setStore: function (key, value)
- {
- _.activeEngine().set(key, value);
-
- return this;
- }
-
- });
-
- //------------------------------
- //
- // Event Bindings
- //
- //------------------------------
-
- //------------------------------
- //
- // Startup Code
- //
- //------------------------------
-
- //------------------------------
- // Expose jStore through jQuery
- //------------------------------
-
- window.jStore = $.jStore = _;
-
- //------------------------------
- //
- // Engine Definitions
- //
- //------------------------------
-
- //------------------------------
- // Local
- //------------------------------
-
- define(FLAVOR_LOCAL,
- {
- //------------------------------
- // Properties
- //------------------------------
-
- limit: parseInt(5e5, 16),
-
- //------------------------------
- // Constructor
- //------------------------------
-
- init: function (project, name)
- {
- this.database = window.globalStorage === undefined ? window.localStorage : window.globalStorage[location.hostname];
-
- this._super(project, name);
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- updateCache: function ()
- {
- var key, value;
-
- for (key in this.database)
- {
- var has_key = false;
- if (this.database.hasOwnProperty) {
- if (this.database.hasOwnProperty(key)) {
- has_key = true;
- }
- } else { // IE 8
- if (this.database.getItem(key) !== null) {
- has_key = true;
- }
- }
-
- if (has_key) {
- value = this.database.getItem(key);
-
- // Gecko's getItem returns {value: 'the value'}, WebKit returns 'the value'
- this.data[key] = prepareForRevival(value && value.value ? value.value : value);
- }
- }
-
- this._super();
- },
-
- //------------------------------
- // Internal methods
- //------------------------------
-
- __set: function (key, value)
- {
- this.database.setItem(key, prepareForStorage(value));
- },
-
- __remove: function (key)
- {
- this.database.removeItem(key);
- }
- },
-
- function ()
- {
- return window.localStorage !== undefined || window.globalStorage !== undefined;
- });
-
- //------------------------------
- // SQL
- //------------------------------
-
- define(FLAVOR_SQL,
- {
- //------------------------------
- // Properties
- //------------------------------
-
- limit: parseInt(32e3, 16),
-
- //------------------------------
- // Constructor
- //------------------------------
-
- init: function (project, name)
- {
- this.database = window.openDatabase('jstore-' + project, '1.0', project, this.limit);
-
- if (!this.database)
- {
- throw 'JSTORE_SQL_NO_DB';
- }
-
- this.database.transaction(function (database)
- {
- database.executeSql('CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)');
- });
-
- this._super(project, name);
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- updateCache: function ()
- {
- var self = this,
- _super = this._super;
-
- this.database.transaction(function (database)
- {
- database.executeSql('SELECT k,v FROM jstore', [], function (database, result)
- {
- var rows = result.rows,
- index = 0,
- row;
-
- for (; index < rows.length; ++index)
- {
- row = rows.item(index);
- self.data[row.k] = prepareForRevival(row.v);
- }
-
- _super.apply(self);
- });
- });
- },
-
- //------------------------------
- // Internal methods
- //------------------------------
-
- __set: function (key, value)
- {
- this.database.transaction(function (database)
- {
- database.executeSql('INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)', [key, prepareForStorage(value)]);
- });
- },
-
- __remove: function (key)
- {
- this.database.transaction(function (database)
- {
- database.executeSql('DELETE FROM jstore WHERE k = ?', [key]);
- });
- }
- },
-
- function ()
- {
- return window.openDatabase !== undefined;
- });
-
- //------------------------------
- // Flash
- //------------------------------
-
- define(FLAVOR_FLASH,
- {
- //------------------------------
- // Properties
- //------------------------------
-
- limit: -1,
-
- //------------------------------
- // Constructor
- //------------------------------
-
- init: function (project, name)
- {
- var self = this;
-
- _.bind('flash-ready', function ()
- {
- self.__flashReadyListener();
- });
-
- this._super(project, name);
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- updateCache: function (enable)
- {
- /**
- * The default call to updateCache passes no variable, so we can short circuit the
- * ready state until we explictly call this after flash ready.
- */
- if (enable === true)
- {
- var key,
- dataset = this.database.jstore_get_all();
-
- for (key in dataset)
- {
- if (dataset.hasOwnProperty(key))
- {
- this.data[key] = prepareForRevival(this.database.jstore_get(key));
- }
- }
-
- this._super();
- }
- },
-
- //------------------------------
- // Internal methods
- //------------------------------
-
- __set: function (key, value)
- {
- if (!this.database.jstore_set(key, prepareForStorage(value)))
- {
- _.trigger('jstore-error', ['JSTORE_STORAGE_FAILURE', this.jri, 'Flash Exception']);
- }
- },
-
- __remove: function (key)
- {
- this.database.jstore_remove(key);
- },
-
- /**
- * Triggered whenever flash is ready.
- */
- __flashReadyListener: function ()
- {
- var iFrame = $('#jStoreFlashFrame')[0],
- frameDocument;
-
- // MSIE
- if (iFrame.Document !== undefined && typecheck(iFrame.Document.jStoreFlash.jstore_get, 'Function'))
- {
- this.database = iFrame.Document.jStoreFlash;
- }
-
- // Real Browsers
- else if (iFrame.contentWindow && iFrame.contentWindow.document)
- {
- frameDocument = $(iFrame.contentWindow.document);
-
- // Webkit
- if (typecheck($('object', frameDocument)[0].jstore_get, 'Function'))
- {
- this.database = $('object', frameDocument)[0];
- }
-
- // Gecko
- else if (typecheck($('embed', frameDocument)[0].jstore_get, 'Function'))
- {
- this.database = $('embed', frameDocument)[0];
- }
- }
-
- if (this.database === undefined)
- {
- throw 'JSTORE_FLASH_REFERENCE_ISSUE';
- }
- else
- {
- this.updateCache(true);
- }
- }
- },
-
- function ()
- {
- return hasFlashVersion('9.0.0');
- });
-
- //------------------------------
- // Gears
- //------------------------------
-
- define(FLAVOR_GEARS,
- {
- //------------------------------
- // Properties
- //------------------------------
-
- limit: -1,
-
- //------------------------------
- // Constructor
- //------------------------------
-
- init: function (project, name)
- {
- this.database = google.gears.factory.create('beta.database');
- this.database.open('jstore-' + project);
- this.database.execute('CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)');
-
- this._super(project, name);
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- updateCache: function ()
- {
- var result = this.database.execute('SELECT k,v FROM jstore');
-
- while (result.isValidRow())
- {
- this.data[result.field(0)] = prepareForRevival(result.field(1));
- result.next();
- }
-
- result.close();
-
- this._super();
- },
-
- //------------------------------
- // Internal methods
- //------------------------------
-
- __set: function (key, value)
- {
- this.database.execute('BEGIN');
- this.database.execute('INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)', [key, prepareForStorage(value)]);
- this.database.execute('COMMIT');
- },
-
- __remove: function (key)
- {
- this.database.execute('BEGIN');
- this.database.execute('DELETE FROM jstore WHERE k = ?', [key]);
- this.database.execute('COMMIT');
- }
- },
-
- function ()
- {
- return window.google !== undefined && window.google.gears !== undefined;
- });
-
- //------------------------------
- // MSIE
- //------------------------------
-
- define(FLAVOR_MSIE,
- {
- //------------------------------
- // Properties
- //------------------------------
-
- limit: parseInt(1e4, 16),
-
- //------------------------------
- // Constructor
- //------------------------------
-
- init: function (project, name)
- {
- this.database = $('<div style="display:none;behavior:url(\'#default#userData\')" id="jstore-' + project + '"></div>')
- .appendTo(document.body).get(0);
-
- this._super(project, name);
- },
-
- //------------------------------
- // Methods
- //------------------------------
-
- updateCache: function ()
- {
- this.database.load(this.project);
-
- var node = document.getElementById('jstore-' + this.project),
- xmlDoc = node.XMLDocument,
- root,
- index = 0;
-
- if (xmlDoc && xmlDoc.documentElement && xmlDoc.documentElement.attributes)
- {
- root = xmlDoc.documentElement;
-
- for (; index < root.attributes.length; ++index)
- {
- this.data[root.attributes.item(index).nodeName] = prepareForRevival(root.attributes.item(index).nodeValue);
- }
- }
-
- this._super();
- },
-
- //------------------------------
- // Internal methods
- //------------------------------
-
- __set: function (key, value)
- {
- this.database.setAttribute(key, prepareForStorage(value));
- this.database.save(this.project);
- },
-
- __remove: function (key)
- {
- this.database.removeAttribute(key);
- this.database.save(this.project);
- }
- },
-
- function ()
- {
- return window.ActiveXObject !== undefined;
- });
-
-}(jQuery, window));
--- a/static/scripts/packed/class.js Fri Feb 18 14:53:35 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-/*
- * Class definition
- *
- * Copyright (c) 2008 John Resig (http://ejohn.org/blog/simple-javascript-inheritance/)
- * Inspired by base2 and Prototype
- */
-(function(){var a=false,b=/xyz/.test(function(){xyz})?/\b_super\b/:/.*/;this.Class=function(){};Class.extend=function(g){var f=this.prototype;a=true;var e=new this();a=false;for(var d in g){e[d]=(typeof g[d]==="function"&&typeof f[d]==="function"&&b.test(g[d])?(function(h,i){return function(){var k=this._super;this._super=f[h];var j=i.apply(this,arguments);this._super=k;return j}}(d,g[d])):g[d])}function c(){if(!a&&this.init){this.init.apply(this,arguments)}}c.prototype=e;c.constructor=c;c.extend=arguments.callee;return c}}());
\ No newline at end of file
--- a/static/scripts/packed/galaxy.base.js Fri Feb 18 14:53:35 2011 -0500
+++ b/static/scripts/packed/galaxy.base.js Fri Feb 18 15:06:34 2011 -0500
@@ -1,1 +1,1 @@
-if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function show_hide_popupmenu_options(d,c,a){a=(a===undefined?true:a);var b=new RegExp(c);$(d).find("li").each(function(){if(b.exec($(this).text())){if(a){$(this).show()}else{$(this).hide()}}})}function make_popupmenu(a,b){a.data("menu_options",b);a.bind("click.show_popup",function(c){$(".popmenu-wrapper").remove();setTimeout(function(){var f=$("<ul id='"+a.attr("id")+"-menu'></ul>");var e=a.data("menu_options");if(obj_length(e)<=0){$("<li>No Options.</li>").appendTo(f)}$.each(e,function(i,h){if(h){$("<li/>").html(i).click(h).appendTo(f)}else{$("<li class='head'/>").html(i).appendTo(f)}});var g=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'>");g.append(f).append("<div class='overlay-border'>").appendTo("body");var d=c.pageX-g.width()/2;d=Math.min(d,$(document).scrollLeft()+$(window).width()-$(g).width()-20);d=Math.max(d,$(document).scrollLeft()+20);g.css({top:c.pageY-5,left:d})},10);setTimeout(function(){var e=function(g){$(g).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();g.unbind("click.close_popup")})};e($(window.document));e($(window.top.document));for(var d=window.top.frames.length;d--;){var f=$(window.top.frames[d].document);e(f)}},50);return false})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var a={};var c=$(this);c.find("a").each(function(){var f=$(this),h=f.get(0);var d=h.getAttribute("confirm"),e=h.getAttribute("href"),g=h.getAttribute("target");if(!e){a[f.text()]=null}else{a[f.text()]=function(){if(!d||confirm(d)){var i;if(g=="_parent"){window.parent.location=e}else{if(g=="_top"){window.top.location=e}else{if(g=="demo"){if(i==undefined||i.closed){i=window.open(e,g);i.creator=self}}else{window.location=e}}}}}}});var b=$("#"+c.attr("popupmenu"));b.find("a").bind("click",function(d){d.stopPropagation();return true});make_popupmenu(b,a);b.addClass("popup");c.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(b===undefined){b=3000}$("select").each(function(){var d=$(this);var g=d.find("option").length;if((g<a)||(g>b)){return}if(d.attr("multiple")===true){return}if(d.hasClass("no-autocomplete")){return}var m=d.attr("value");var c=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",d.attr("name"));c.attr("id",d.attr("id"));c.click(function(){var n=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(n);$(this).select()});var e=[];var i={};d.children("option").each(function(){var o=$(this).text();var n=$(this).attr("value");e.push(o);i[o]=n;i[n]=n;if(n==m){c.attr("value",o)}});if(m===""||m==="?"){c.attr("value","Click to Search or Select")}if(d.attr("name")=="dbkey"){e=e.sort(naturalSort)}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:b,minChars:0,hideForLessThanMinChars:false};c.autocomplete(e,f);d.replaceWith(c);var k=function(){var o=c.attr("value");var n=i[o];if(n!==null&&n!==undefined){c.attr("value",n)}else{if(m!==""){c.attr("value",m)}else{c.attr("value","?")}}};c.parents("form").submit(function(){k()});$(document).bind("convert_to_values",function(){k()});if(d.attr("refresh_on_change")=="true"){var h=d.attr("refresh_on_change_values"),l=d.attr("last_selected_value");if(h!==undefined){h=h.split(",")}var j=function(){var n=i[c.attr("value")];if(l!==n&&n!==null&&n!==undefined){if(h!==undefined&&$.inArray(n,h)===-1&&$.inArray(l,h)===-1){return}c.attr("value",n);$(window).trigger("refresh_on_change");c.parents("form").submit()}};c.bind("result",j);c.keyup(function(n){if(n.keyCode===13){j()}});c.keydown(function(n){if(n.keyCode===13){return false}})}})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStore.store("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStore.remove("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStore.store("history_expand_state");if(k){delete k[j];$.jStore.store("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStore.store("history_expand_state");if(k===undefined){k={}}k[j]=true;$.jStore.store("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStore.store("history_expand_state");if(h===undefined){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStore.store("history_expand_state",h)}).show()};if(a){b()}else{$.jStore.init("galaxy");$.jStore.ready(function(){b()})}}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools");b.css("font-style","italic")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
+if(!Array.indexOf){Array.prototype.indexOf=function(c){for(var b=0,a=this.length;b<a;b++){if(this[b]==c){return b}}return -1}}function obj_length(c){if(c.length!==undefined){return c.length}var b=0;for(var a in c){b++}return b}$.fn.makeAbsolute=function(a){return this.each(function(){var b=$(this);var c=b.position();b.css({position:"absolute",marginLeft:0,marginTop:0,top:c.top,left:c.left,right:$(window).width()-(c.left+b.width())});if(a){b.remove().appendTo("body")}})};function show_hide_popupmenu_options(d,c,a){a=(a===undefined?true:a);var b=new RegExp(c);$(d).find("li").each(function(){if(b.exec($(this).text())){if(a){$(this).show()}else{$(this).hide()}}})}function make_popupmenu(a,b){a.data("menu_options",b);a.bind("click.show_popup",function(c){$(".popmenu-wrapper").remove();setTimeout(function(){var f=$("<ul id='"+a.attr("id")+"-menu'></ul>");var e=a.data("menu_options");if(obj_length(e)<=0){$("<li>No Options.</li>").appendTo(f)}$.each(e,function(i,h){if(h){$("<li/>").html(i).click(h).appendTo(f)}else{$("<li class='head'/>").html(i).appendTo(f)}});var g=$("<div class='popmenu-wrapper' style='position: absolute;left: 0; top: -1000;'>");g.append(f).append("<div class='overlay-border'>").appendTo("body");var d=c.pageX-g.width()/2;d=Math.min(d,$(document).scrollLeft()+$(window).width()-$(g).width()-20);d=Math.max(d,$(document).scrollLeft()+20);g.css({top:c.pageY-5,left:d})},10);setTimeout(function(){var e=function(g){$(g).bind("click.close_popup",function(){$(".popmenu-wrapper").remove();g.unbind("click.close_popup")})};e($(window.document));e($(window.top.document));for(var d=window.top.frames.length;d--;){var f=$(window.top.frames[d].document);e(f)}},50);return false})}function make_popup_menus(){jQuery("div[popupmenu]").each(function(){var a={};var c=$(this);c.find("a").each(function(){var f=$(this),h=f.get(0);var d=h.getAttribute("confirm"),e=h.getAttribute("href"),g=h.getAttribute("target");if(!e){a[f.text()]=null}else{a[f.text()]=function(){if(!d||confirm(d)){var i;if(g=="_parent"){window.parent.location=e}else{if(g=="_top"){window.top.location=e}else{if(g=="demo"){if(i==undefined||i.closed){i=window.open(e,g);i.creator=self}}else{window.location=e}}}}}}});var b=$("#"+c.attr("popupmenu"));b.find("a").bind("click",function(d){d.stopPropagation();return true});make_popupmenu(b,a);b.addClass("popup");c.remove()})}function naturalSort(j,h){var p=/(-?[0-9\.]+)/g,k=j.toString().toLowerCase()||"",g=h.toString().toLowerCase()||"",l=String.fromCharCode(0),n=k.replace(p,l+"$1"+l).split(l),e=g.replace(p,l+"$1"+l).split(l),d=(new Date(k)).getTime(),o=d?(new Date(g)).getTime():null;if(o){if(d<o){return -1}else{if(d>o){return 1}}}var m,f;for(var i=0,c=Math.max(n.length,e.length);i<c;i++){m=parseFloat(n[i])||n[i];f=parseFloat(e[i])||e[i];if(m<f){return -1}else{if(m>f){return 1}}}return 0}function replace_big_select_inputs(a,b){if(!jQuery().autocomplete){return}if(a===undefined){a=20}if(b===undefined){b=3000}$("select").each(function(){var d=$(this);var g=d.find("option").length;if((g<a)||(g>b)){return}if(d.attr("multiple")===true){return}if(d.hasClass("no-autocomplete")){return}var m=d.attr("value");var c=$("<input type='text' class='text-and-autocomplete-select'></input>");c.attr("size",40);c.attr("name",d.attr("name"));c.attr("id",d.attr("id"));c.click(function(){var n=$(this).val();$(this).val("Loading...");$(this).showAllInCache();$(this).val(n);$(this).select()});var e=[];var i={};d.children("option").each(function(){var o=$(this).text();var n=$(this).attr("value");e.push(o);i[o]=n;i[n]=n;if(n==m){c.attr("value",o)}});if(m===""||m==="?"){c.attr("value","Click to Search or Select")}if(d.attr("name")=="dbkey"){e=e.sort(naturalSort)}var f={selectFirst:false,autoFill:false,mustMatch:false,matchContains:true,max:b,minChars:0,hideForLessThanMinChars:false};c.autocomplete(e,f);d.replaceWith(c);var k=function(){var o=c.attr("value");var n=i[o];if(n!==null&&n!==undefined){c.attr("value",n)}else{if(m!==""){c.attr("value",m)}else{c.attr("value","?")}}};c.parents("form").submit(function(){k()});$(document).bind("convert_to_values",function(){k()});if(d.attr("refresh_on_change")=="true"){var h=d.attr("refresh_on_change_values"),l=d.attr("last_selected_value");if(h!==undefined){h=h.split(",")}var j=function(){var n=i[c.attr("value")];if(l!==n&&n!==null&&n!==undefined){if(h!==undefined&&$.inArray(n,h)===-1&&$.inArray(l,h)===-1){return}c.attr("value",n);$(window).trigger("refresh_on_change");c.parents("form").submit()}};c.bind("result",j);c.keyup(function(n){if(n.keyCode===13){j()}});c.keydown(function(n){if(n.keyCode===13){return false}})}})}function async_save_text(d,f,e,a,c,h,i,g,b){if(c===undefined){c=30}if(i===undefined){i=4}$("#"+d).live("click",function(){if($("#renaming-active").length>0){return}var l=$("#"+f),k=l.text(),j;if(h){j=$("<textarea></textarea>").attr({rows:i,cols:c}).text($.trim(k))}else{j=$("<input type='text'></input>").attr({value:$.trim(k),size:c})}j.attr("id","renaming-active");j.blur(function(){$(this).remove();l.show();if(b){b(j)}});j.keyup(function(n){if(n.keyCode===27){$(this).trigger("blur")}else{if(n.keyCode===13){var m={};m[a]=$(this).val();$(this).trigger("blur");$.ajax({url:e,data:m,error:function(){alert("Text editing for elt "+f+" failed")},success:function(o){if(o!==""){l.text(o)}else{l.html("<em>None</em>")}if(b){b(j)}}})}}});if(g){g(j)}l.hide();j.insertAfter(l);j.focus();j.select();return})}function init_history_items(d,a,c){var b=function(){try{var e=$.jStorage.get("history_expand_state");if(e){for(var g in e){$("#"+g+" div.historyItemBody").show()}}}catch(f){$.jStorage.deleteKey("history_expand_state")}if($.browser.mozilla){$("div.historyItemBody").each(function(){if(!$(this).is(":visible")){$(this).find("pre.peek").css("overflow","hidden")}})}d.each(function(){var j=this.id,h=$(this).children("div.historyItemBody"),i=h.find("pre.peek");$(this).find(".historyItemTitleBar > .historyItemTitle").wrap("<a href='javascript:void(0);'></a>").click(function(){var k;if(h.is(":visible")){if($.browser.mozilla){i.css("overflow","hidden")}h.slideUp("fast");if(!c){k=$.jStorage.get("history_expand_state");if(k){delete k[j];$.jStorage.set("history_expand_state",k)}}}else{h.slideDown("fast",function(){if($.browser.mozilla){i.css("overflow","auto")}});if(!c){k=$.jStorage.get("history_expand_state");if(!k){k={}}k[j]=true;$.jStorage.set("history_expand_state",k)}}return false})});$("#top-links > a.toggle").click(function(){var h=$.jStorage.get("history_expand_state");if(!h){h={}}$("div.historyItemBody:visible").each(function(){if($.browser.mozilla){$(this).find("pre.peek").css("overflow","hidden")}$(this).slideUp("fast");if(h){delete h[$(this).parent().attr("id")]}});$.jStorage.set("history_expand_state",h)}).show()};b()}function commatize(b){b+="";var a=/(\d+)(\d{3})/;while(a.test(b)){b=b.replace(a,"$1,$2")}return b}function reset_tool_search(a){var c=$("#galaxy_tools").contents();if(c.length===0){c=$(document)}$(this).removeClass("search_active");c.find(".toolTitle").removeClass("search_match");c.find(".toolSectionBody").hide();c.find(".toolTitle").show();c.find(".toolPanelLabel").show();c.find(".toolSectionWrapper").each(function(){if($(this).attr("id")!="recently_used_wrapper"){$(this).show()}else{if($(this).hasClass("user_pref_visible")){$(this).show()}}});c.find("#search-no-results").hide();c.find("#search-spinner").hide();if(a){var b=c.find("#tool-search-query");b.val("search tools");b.css("font-style","italic")}}var GalaxyAsync=function(a){this.url_dict={};this.log_action=(a===undefined?false:a)};GalaxyAsync.prototype.set_func_url=function(a,b){this.url_dict[a]=b};GalaxyAsync.prototype.set_user_pref=function(a,b){var c=this.url_dict[arguments.callee];if(c===undefined){return false}$.ajax({url:c,data:{pref_name:a,pref_value:b},error:function(){return false},success:function(){return true}})};GalaxyAsync.prototype.log_user_action=function(c,b,d){if(!this.log_action){return}var a=this.url_dict[arguments.callee];if(a===undefined){return false}$.ajax({url:a,data:{action:c,context:b,params:d},error:function(){return false},success:function(){return true}})};$(document).ready(function(){$("select[refresh_on_change='true']").change(function(){var a=$(this),e=a.val(),d=false,c=a.attr("refresh_on_change_values");if(c){c=c.split(",");var b=a.attr("last_selected_value");if($.inArray(e,c)===-1&&$.inArray(b,c)===-1){return}}$(window).trigger("refresh_on_change");$(document).trigger("convert_to_values");a.get(0).form.submit()});$("a[confirm]").click(function(){return confirm($(this).attr("confirm"))});if($.fn.tipsy){$(".tooltip").tipsy({gravity:"s"})}make_popup_menus();replace_big_select_inputs(20,1500);$("a").click(function(){var b=$(this);var c=(parent.frames&&parent.frames.galaxy_main);if((b.attr("target")=="galaxy_main")&&(!c)){var a=b.attr("href");if(a.indexOf("?")==-1){a+="?"}else{a+="&"}a+="use_panels=True";b.attr("href",a);b.attr("target","_self")}return b})});
\ No newline at end of file
--- a/static/scripts/packed/jquery.jstore.js Fri Feb 18 14:53:35 2011 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-/*
- * jStore 2.0 - Persistent Client Side Storage
- *
- * Copyright (c) 2010 Eric Garside (http://eric.garside.name/)
- * Dual licensed under:
- * MIT: http://www.opensource.org/licenses/mit-license.php
- * GPLv3: http://www.opensource.org/licenses/gpl-3.0.html
- *
- * ---------------------------
- *
- * jStore Flash Storage Component
- *
- * Copyright (c) 2006 Jeff Lerman (jeff(a)blip.tv)
- * Licensed under the Creative Commons Attribution 3.0 United States License:
- * http://creativecommons.org/licenses/by/3.0/us
- */
-(function(i,n){var h="JSTORE_ENGINE_UNSTABLE",t="JSTORE_UNKNOWN_ENGINE_REQUESTED",r="JSTORE_ENGINE_NAMESPACE_COLLISION",j="JSTORE_RESOURCE_NAMESPACE_COLLISION",m="JSTORE_ENGINE_UNAVAILABLE",o="JSTORE_INVALID_FLAVOR",f=(function(){try{return new RegExp('^("(\\\\.|[^"\\\\\\n\\r])*?"|[,:{}\\[\\]0-9.\\-+Eaeflnr-u \\n\\r\\t])+?$')}catch(I){return(/^(true|false|null|\[.*\]|\{.*\}|".*"|\d+|\d+\.\d+)$/)}}()),b="jstore-html5-local",y="jstore-html5-sql",F="jstore-flash",G="jstore-google-gears",A="jstore-msie",u,E={},D={},C={},c=false,d={},q={project:undefined,flash:"jStore.Flash.html",json:"browser.json.js"},l;function z(I){switch(I){case b:case y:case F:case G:case A:return true;default:return false}}function g(I,J){return !I?false:I.constructor.toString().match(new RegExp(J+"\\(\\)","i"))!==null}function s(K,I,J){if(g(K,"Function")){return K.apply(I||E,g(J,"Array")?J:[J])}}function p(J,I){i.ajax({url:J,complete:I||i.noop(),type:"GET",dataType:"script",cache:false})}function x(I){if(I===undefined){return""}if(g(I,"Object")||g(I,"Array")||g(I,"Function")){return JSON.stringify(I)}return I}function k(I){return f.test(I)?JSON.parse(I):I}function w(I){return I.replace(/^\s+|\s+$/g,"")}function e(I,J,K){if(!z(I)){throw o}if(K[I]!==undefined){throw r}if(s(K)===true){E.available[I]=true;J.flavor=I;D[I]=u.extend(J)}else{E.available[I]=false;E.enginePriority=i.map(E.enginePriority,function(L){if(L===I){return null}else{return L}})}}function v(){if(E.isReady){return}if((c&&E.isFlashReady)||!c){E.isReady=true;E.trigger("jstore-ready",[C[l]])}}function a(){E.create(E.enginePriority[0],undefined,"best-fit")}function H(){try{var J=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");try{J.AllowScriptAccess="always"}catch(L){return"6,0,0"}return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}catch(K){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1]}}catch(I){}}return"0,0,0"}function B(I){var N=H().match(/\d+/g),L=I.match(/\d+/g),J=0,K,M;for(;J<3;J++){K=parseInt(N[J],10);M=parseInt(L[J],10);if(K<M){return false}else{if(K>M){return true}}}return true}i.extend(E,{enginePriority:[b,y,F,A],available:{},isReady:false,isFlashReady:false,flavors:{local:b,sql:y,flash:F,gears:G,msie:A},init:function(J,K,I){i.extend(q,{project:J},K);i(function(){if(n.JSON===undefined){p(q.json)}if(I!==undefined){E.create(I,J,"default")}else{a()}});return E},create:function(I,M,J){M=M||q.project||location.hostname.replace(/\./g,"-")||"unknown";if(!z(I)){throw o}if(D[I]===undefined){throw m}var L=(J!==undefined?J+".":"")+M+"."+I,K;if(C[L]!==undefined){throw j}K=C[L]=new D[I](M,L);K.ready(function(){E.trigger("jstore-engine-ready",[K])});if(I===F&&!E.isFlashReady){if(l===undefined){c=true}n.jstore_ready=function(){E.isFlashReady=true;E.trigger("flash-ready");if(l===undefined){v()}n.flash_ready=undefined};n.jstore_error=function(N){E.trigger("jstore-error",["JSTORE_FLASH_EXCEPTION",null,N])};i('<iframe style="height:1px;width:1px;position:absolute;left:0;top:0;margin-left:-100px;" id="jStoreFlashFrame" src="'+q.flash+'"></iframe>').appendTo("body")}else{if(l===undefined){l=L;v()}}return K},engine:function(I){return C[I]},activeEngine:function(I){if(I!==undefined){if(C[I]===undefined){throw t}else{l=I}}return C[l]},bind:function(J,K,I){I=I||"jstore";if(d[I]===undefined){d[I]={}}if(d[I][J]===undefined){d[I][J]=[K]}else{d[I][J].push(K)}return E},trigger:function(K,J,I){I=I||"jstore";if(d[I]!==undefined){if(d[I][K]!==undefined){i.each(d[I][K],function(){s(this,E,J)})}}return E},error:function(I){E.bind("jstore-error",I)},ready:function(I){if(E.isReady){s(I)}else{E.bind("jstore-ready",I)}return E},engineReady:function(I){if(E.isReady){s(I)}else{E.bind("jstore-engine-ready",I)}return E},store:function(I,J){return J===undefined?E.get(I):E.set(I,J)},remove:function(I){return E.activeEngine().remove(I)},get:function(I){return E.activeEngine().get(I)},set:function(I,J){return E.activeEngine().set(I,J)}});u=Class.extend({project:undefined,jri:undefined,flavor:undefined,database:undefined,data:undefined,limit:undefined,isReady:undefined,init:function(J,I){this.project=J;this.jri=I;this.data={};this.isReady=false;this.updateCache()},updateCache:function(){this.isReady=true;this.trigger("engine-ready",[this])},bind:function(I,J){E.bind(I,J,this.jri)},trigger:function(J,I){E.trigger(J,I,this.jri)},ready:function(I){if(this.isReady){s(I,this)}else{this.bind("engine-ready",I)}},get:function(I){this.__interruptAccess();return this.data[I]},set:function(I,J){this.__interruptAccess();I=w(I);try{this.__set(I,J)}catch(K){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,K])}this.data[I]=J;return J},remove:function(J){this.__interruptAccess();J=w(J);try{this.__remove(J)}catch(K){E.trigger("jstore-error",["JSTORE_REMOVE_FAILURE",this.jri,K])}var I=this.data[J];this.data[J]=undefined;return I},__interruptAccess:function(){if(!this.isReady){throw h}},__set:function(I,J){return},__remove:function(I){return}});i.extend(i.fn,{store:function(I,J){if(J===undefined){E.get(I)}else{E.set(I,J)}return this},removeStore:function(I){E.activeEngine().remove(I);return this},getStore:function(I){return E.activeEngine().get(I)},setStore:function(I,J){E.activeEngine().set(I,J);return this}});n.jStore=i.jStore=E;e(b,{limit:parseInt(500000,16),init:function(J,I){this.database=n.globalStorage===undefined?n.localStorage:n.globalStorage[location.hostname];this._super(J,I)},updateCache:function(){var J,K;for(J in this.database){var I=false;if(this.database.hasOwnProperty){if(this.database.hasOwnProperty(J)){I=true}}else{if(this.database.getItem(J)!==null){I=true}}if(I){K=this.database.getItem(J);this.data[J]=k(K&&K.value?K.value:K)}}this._super()},__set:function(I,J){this.database.setItem(I,x(J))},__remove:function(I){this.database.removeItem(I)}},function(){return n.localStorage!==undefined||n.globalStorage!==undefined});e(y,{limit:parseInt(32000,16),init:function(J,I){this.database=n.openDatabase("jstore-"+J,"1.0",J,this.limit);if(!this.database){throw"JSTORE_SQL_NO_DB"}this.database.transaction(function(K){K.executeSql("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)")});this._super(J,I)},updateCache:function(){var I=this,J=this._super;this.database.transaction(function(K){K.executeSql("SELECT k,v FROM jstore",[],function(O,L){var N=L.rows,M=0,P;for(;M<N.length;++M){P=N.item(M);I.data[P.k]=k(P.v)}J.apply(I)})})},__set:function(I,J){this.database.transaction(function(K){K.executeSql("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)])})},__remove:function(I){this.database.transaction(function(J){J.executeSql("DELETE FROM jstore WHERE k = ?",[I])})}},function(){return n.openDatabase!==undefined});e(F,{limit:-1,init:function(K,J){var I=this;E.bind("flash-ready",function(){I.__flashReadyListener()});this._super(K,J)},updateCache:function(I){if(I===true){var J,K=this.database.jstore_get_all();for(J in K){if(K.hasOwnProperty(J)){this.data[J]=k(this.database.jstore_get(J))}}this._super()}},__set:function(I,J){if(!this.database.jstore_set(I,x(J))){E.trigger("jstore-error",["JSTORE_STORAGE_FAILURE",this.jri,"Flash Exception"])}},__remove:function(I){this.database.jstore_remove(I)},__flashReadyListener:function(){var I=i("#jStoreFlashFrame")[0],J;if(I.Document!==undefined&&g(I.Document.jStoreFlash.jstore_get,"Function")){this.database=I.Document.jStoreFlash}else{if(I.contentWindow&&I.contentWindow.document){J=i(I.contentWindow.document);if(g(i("object",J)[0].jstore_get,"Function")){this.database=i("object",J)[0]}else{if(g(i("embed",J)[0].jstore_get,"Function")){this.database=i("embed",J)[0]}}}}if(this.database===undefined){throw"JSTORE_FLASH_REFERENCE_ISSUE"}else{this.updateCache(true)}}},function(){return B("9.0.0")});e(G,{limit:-1,init:function(J,I){this.database=google.gears.factory.create("beta.database");this.database.open("jstore-"+J);this.database.execute("CREATE TABLE IF NOT EXISTS jstore (k TEXT UNIQUE NOT NULL PRIMARY KEY, v TEXT NOT NULL)");this._super(J,I)},updateCache:function(){var I=this.database.execute("SELECT k,v FROM jstore");while(I.isValidRow()){this.data[I.field(0)]=k(I.field(1));I.next()}I.close();this._super()},__set:function(I,J){this.database.execute("BEGIN");this.database.execute("INSERT OR REPLACE INTO jstore(k, v) VALUES (?, ?)",[I,x(J)]);this.database.execute("COMMIT")},__remove:function(I){this.database.execute("BEGIN");this.database.execute("DELETE FROM jstore WHERE k = ?",[I]);this.database.execute("COMMIT")}},function(){return n.google!==undefined&&n.google.gears!==undefined});e(A,{limit:parseInt(10000,16),init:function(J,I){this.database=i('<div style="display:none;behavior:url(\'#default#userData\')" id="jstore-'+J+'"></div>').appendTo(document.body).get(0);this._super(J,I)},updateCache:function(){this.database.load(this.project);var K=document.getElementById("jstore-"+this.project),L=K.XMLDocument,I,J=0;if(L&&L.documentElement&&L.documentElement.attributes){I=L.documentElement;for(;J<I.attributes.length;++J){this.data[I.attributes.item(J).nodeName]=k(I.attributes.item(J).nodeValue)}}this._super()},__set:function(I,J){this.database.setAttribute(I,x(J));this.database.save(this.project)},__remove:function(I){this.database.removeAttribute(I);this.database.save(this.project)}},function(){return n.ActiveXObject!==undefined})}(jQuery,window));
\ No newline at end of file
--- a/templates/display_base.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/display_base.mako Fri Feb 18 15:06:34 2011 -0500
@@ -32,7 +32,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "class", "jquery.jstore", "jquery.autocomplete", "jquery.rating", "autocomplete_tagging", "trackster" )}
+ ${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "jstorage", "jquery.autocomplete", "jquery.rating", "autocomplete_tagging", "trackster" )}
<script type="text/javascript">
--- a/templates/history/view.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/history/view.mako Fri Feb 18 15:06:34 2011 -0500
@@ -5,7 +5,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "galaxy.base", "jquery", "json2", "class", "jquery.jstore" )}
+ ${h.js( "galaxy.base", "jquery", "json2", "jstorage" )}
<script type="text/javascript">
$(function() {
init_history_items( $("div.historyItemWrapper"), false, "nochanges" );
--- a/templates/library/common/browse_library.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/library/common/browse_library.mako Fri Feb 18 15:06:34 2011 -0500
@@ -48,7 +48,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js("class", "jquery.jstore")}
+ ${h.js("json2", "jstorage")}
${common_javascripts()}
${self.grid_javascripts()}
</%def>
@@ -56,11 +56,10 @@
<%def name="grid_javascripts()"><script type="text/javascript">
$(function() {
- $.jStore.init("galaxy"); // Auto-select best storage
var storage_id = "library-expand-state-${trans.security.encode_id(library.id)}";
var restore_folder_state = function() {
- var state = $.jStore.store(storage_id);
+ var state = $.jStorage.get(storage_id);
if (state) {
for (var id in state) {
if (state[id] === true) {
@@ -79,7 +78,7 @@
var folder = $(this);
state[folder.attr("id")] = folder.hasClass("expanded");
});
- $.jStore.store(storage_id, state);
+ $.jStorage.set(storage_id, state);
};
$("#library-grid").each(function() {
@@ -131,10 +130,10 @@
// Initialize dict[parent_id] = rows_which_have_that_parent_id_as_parent_attr
var par_child_dict = {},
no_parent = [];
-
+
$(this).find("tbody tr").each( function() {
- if (this.hasAttribute("parent")) {
- var parent = this.getAttribute("parent");
+ if ( $(this).attr("parent")) {
+ var parent = $(this).attr("parent");
if (par_child_dict[parent] !== undefined) {
par_child_dict[parent].push(this);
} else {
@@ -151,9 +150,7 @@
});
});
- $.jStore.engineReady(function() {
- restore_folder_state();
- });
+ restore_folder_state();
});
// Looks for changes in dataset state using an async request. Keeps
--- a/templates/library/common/library_dataset_search_results.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/library/common/library_dataset_search_results.mako Fri Feb 18 15:06:34 2011 -0500
@@ -46,7 +46,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js("class", "jquery.jstore")}
+ ${h.js("jstorage")}
${common_javascripts()}
</%def>
--- a/templates/page/editor.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/page/editor.mako Fri Feb 18 15:06:34 2011 -0500
@@ -21,7 +21,7 @@
<%def name="javascripts()">
${parent.javascripts()}
- ${h.js( "jquery.event.drag", "jquery.event.drop", "jquery.event.hover", "jquery.form", "class", "jquery.jstore", "json2",
+ ${h.js( "jquery.event.drag", "jquery.event.drop", "jquery.event.hover", "jquery.form", "json2", "jstorage"
"galaxy.base", "jquery.wymeditor", "jquery.autocomplete", "autocomplete_tagging")}
<script type="text/javascript">
--- a/templates/root/history.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/root/history.mako Fri Feb 18 15:06:34 2011 -0500
@@ -15,7 +15,7 @@
<meta http-equiv="Pragma" content="no-cache">
${h.css( "base", "history", "autocomplete_tagging" )}
-${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "class", "jquery.jstore", "jquery.autocomplete", "autocomplete_tagging" )}
+${h.js( "jquery", "jquery.tipsy", "galaxy.base", "json2", "jstorage", "jquery.autocomplete", "autocomplete_tagging" )}
<script type="text/javascript">
--- a/templates/workflow/editor.mako Fri Feb 18 14:53:35 2011 -0500
+++ b/templates/workflow/editor.mako Fri Feb 18 15:06:34 2011 -0500
@@ -31,9 +31,8 @@
"jquery.event.drop",
"jquery.event.hover",
"jquery.form",
- "class",
"json2",
- "jquery.jstore",
+ "jstorage",
"galaxy.base",
"galaxy.workflow_editor.canvas",
"jquery.autocomplete",
@@ -177,9 +176,6 @@
});
%endif
- // Load jStore for local storage
- $.jStore.init("galaxy"); // Auto-select best storage
-
// Canvas overview management
canvas_manager = new CanvasManager( $("#canvas-viewport"), $("#overview") );
@@ -309,23 +305,21 @@
}
- $.jStore.ready(function() {
- // On load, set the size to the pref stored in local storage if it exists
- overview_size = $.jStore.store("overview-size");
- if (overview_size !== undefined) {
- $("#overview-border").css( {
- width: overview_size,
- height: overview_size
- });
- }
-
- // Show viewport on load unless pref says it's off
- if ($.jStore.store("overview-off")) {
- hide_overview();
- } else {
- show_overview();
- }
- });
+ // On load, set the size to the pref stored in local storage if it exists
+ overview_size = $.jStorage.get("overview-size");
+ if (overview_size !== undefined) {
+ $("#overview-border").css( {
+ width: overview_size,
+ height: overview_size
+ });
+ }
+
+ // Show viewport on load unless pref says it's off
+ if ($.jStorage.get("overview-off")) {
+ hide_overview();
+ } else {
+ show_overview();
+ }
// Stores the size of the overview into local storage when it's resized
$("#overview-border").bind( "dragend", function( e, d ) {
@@ -333,17 +327,17 @@
var opo = op.offset();
var new_size = Math.max( op.width() - ( d.offsetX - opo.left ),
op.height() - ( d.offsetY - opo.top ) );
- $.jStore.store("overview-size", new_size + "px");
+ $.jStorage.set("overview-size", new_size + "px");
});
function show_overview() {
- $.jStore.remove("overview-off");
+ $.jStorage.set("overview-off", false);
$("#overview-border").css("right", "0px");
$("#close-viewport").css("background-position", "0px 0px");
}
function hide_overview() {
- $.jStore.store("overview-off", true);
+ $.jStorage.set("overview-off", true);
$("#overview-border").css("right", "20000px");
$("#close-viewport").css("background-position", "12px 0px");
}
Repository URL: https://bitbucket.org/galaxy/galaxy-central/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
1
0