galaxy-commits
Threads by month
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
galaxy-dist commit 63db00b2f0a3: Enhance Tool Repeat Grouping parameter to allow specifying min, max, and default repeat unit counts.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1279124114 14400
# Node ID 63db00b2f0a3ef973666c81b8cd4934ad36c5317
# Parent 3a6b81352293854ff58970c19590ce14a218fb57
Enhance Tool Repeat Grouping parameter to allow specifying min, max, and default repeat unit counts.
Bug Fix for when, under certain conditions, error messages were associated with the incorrect repeat unit.
usage example:
<repeat name="vcf_file" title="VCF population file" min="1" max="3" default="2">
<param format="tabular" name="vcf_input" type="data" label="VCF file"/>
<param name="population_name" type="text" label="Name for this population" value=""/>
</repeat>
Remove previously unused "min" value specified in a single tool config (fastq_manipulation), to maintain existing behavior.
Future Enhancement: Allow min/max/default values to be configured dynamically based upon other tool parameter values (e.g. similarly to dynamic options).
--- a/tools/fastq/fastq_manipulation.xml
+++ b/tools/fastq/fastq_manipulation.xml
@@ -7,7 +7,7 @@
<page><param name="input_file" type="data" format="fastqsanger,fastqcssanger" label="FASTQ File" help="Requires groomed data: if your data does not appear here try using the FASTQ groomer."/><!-- Match Reads -->
- <repeat name="match_blocks" title="Match Reads" min="1">
+ <repeat name="match_blocks" title="Match Reads"><conditional name="match_type"><param name="match_type_selector" type="select" label="Match Reads by"><option value="identifier">Name/Identifier</option>
@@ -47,7 +47,7 @@
</conditional></repeat><!-- Manipulate Matched Reads -->
- <repeat name="manipulate_blocks" title="Manipulate Reads" min="1">
+ <repeat name="manipulate_blocks" title="Manipulate Reads"><conditional name="manipulation_type"><param name="manipulation_type_selector" type="select" label="Manipulate Reads on"><option value="identifier">Name/Identifier</option>
--- a/templates/tool_form.mako
+++ b/templates/tool_form.mako
@@ -91,6 +91,9 @@ function checkUncheckAll( name, check )
${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>
+ %endif
%endfor
<div class="form-row"><input type="submit" name="${prefix}${input.name}_add" value="Add new ${input.title}"></div></div>
--- a/lib/galaxy/tools/__init__.py
+++ b/lib/galaxy/tools/__init__.py
@@ -614,6 +614,11 @@ class Tool:
group.name = elem.get( "name" )
group.title = elem.get( "title" )
group.inputs = self.parse_input_elem( elem, enctypes, context )
+ group.default = int( elem.get( "default", 0 ) )
+ group.min = int( elem.get( "min", 0 ) )
+ group.max = float( elem.get( "max", "inf" ) ) #use float instead of int so that 'inf' can be used for no max
+ assert group.min <= group.max, ValueError( "Min repeat count must be less-than-or-equal to the max." )
+ group.default = min( max( group.default, group.min ), group.max ) #force default to be within min-max range
rval[group.name] = group
elif elem.tag == "conditional":
group = Conditional()
@@ -914,7 +919,7 @@ class Tool:
key = prefix + input.name
if isinstance( input, Repeat ):
group_state = state[input.name]
- group_errors = []
+ group_errors = [ {} for i in range( len( group_state ) ) ] #create list of empty errors for each previously existing state
group_old_errors = old_errors.get( input.name, None )
any_group_errors = False
# Check any removals before updating state -- only one
@@ -922,10 +927,16 @@ class Tool:
for i, rep_state in enumerate( group_state ):
rep_index = rep_state['__index__']
if key + "_" + str(rep_index) + "_remove" in incoming:
- del group_state[i]
- if group_old_errors:
- del group_old_errors[i]
- break
+ if len( group_state ) > input.min:
+ del group_state[i]
+ del group_errors[i]
+ if group_old_errors:
+ del group_old_errors[i]
+ break
+ else:
+ group_errors[i] = { '__index__': 'Cannot remove repeat (min size=%i).' % input.min }
+ any_group_errors = True
+ break #only need to find one that can't be removed due to size, since only one removal is processed at a time anyway
# Update state
max_index = -1
for i, rep_state in enumerate( group_state ):
@@ -947,17 +958,18 @@ class Tool:
item_callback=item_callback )
if rep_errors:
any_group_errors = True
- group_errors.append( rep_errors )
- else:
- group_errors.append( {} )
+ group_errors[i].update( rep_errors )
# Check for addition
if key + "_add" in incoming:
- new_state = {}
- new_state['__index__'] = max_index + 1
- self.fill_in_new_state( trans, input.inputs, new_state, context )
- group_state.append( new_state )
- if any_group_errors:
+ if len( group_state ) < input.max:
+ new_state = {}
+ new_state['__index__'] = max_index + 1
+ self.fill_in_new_state( trans, input.inputs, new_state, context )
+ group_state.append( new_state )
group_errors.append( {} )
+ else:
+ group_errors[-1] = { '__index__': 'Cannot add repeat (max size=%i).' % input.max }
+ any_group_errors = True
# Were there *any* errors for any repetition?
if any_group_errors:
errors[input.name] = group_errors
--- a/lib/galaxy/tools/parameters/grouping.py
+++ b/lib/galaxy/tools/parameters/grouping.py
@@ -41,6 +41,9 @@ class Repeat( Group ):
Group.__init__( self )
self.title = None
self.inputs = None
+ self.default = 0
+ self.min = None
+ self.max = None
@property
def title_plural( self ):
if self.title.endswith( "s" ):
@@ -87,7 +90,13 @@ class Repeat( Group ):
else:
input.visit_inputs( new_prefix, d[input.name], callback )
def get_initial_value( self, trans, context ):
- return []
+ rval = []
+ for i in range( self.default ):
+ rval_dict = { '__index__': i}
+ for input in self.inputs.itervalues():
+ rval_dict[ input.name ] = input.get_initial_value( trans, context )
+ rval.append( rval_dict )
+ return rval
class UploadDataset( Group ):
type = "upload_dataset"
1
0
galaxy-dist commit 3aaca346bc07: Fix typo in 4024:7084aafd2e1a.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278989049 14400
# Node ID 3aaca346bc07a6e13ce48bdee8c27dfd32a3d00b
# Parent 7084aafd2e1a77200935a15b64774b0f65ca06f5
Fix typo in 4024:7084aafd2e1a.
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -354,8 +354,8 @@ class BedGraph( Interval ):
line = line.rstrip( '\r\n' )
if not line:
continue
- elts = line.split('\t')
- if len( elts ) == 4:
+ elems = line.split('\t')
+ if len( elems ) == 4:
# Update seq id, start, end.
if not seqid:
# We can only set the viewport for a single chromosome
1
0
galaxy-dist commit 673926931994: Fixed creation of new tracks, missing template-generated css for trackster, add .DS_Store, *.rej and *.orig to hgignore
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1278961151 14400
# Node ID 67392693199489978700ecd35ec463d1901ffe1e
# Parent 3a6391d4f46980fd8b86c9f9b15fd5684357552b
Fixed creation of new tracks, missing template-generated css for trackster, add .DS_Store, *.rej and *.orig to hgignore
--- a/templates/tracks/browser.mako
+++ b/templates/tracks/browser.mako
@@ -85,8 +85,8 @@
%endfor
init();
%else:
- continue_fn = function() {
- view = new View( undefined, $("#new-title").val(), undefined, $("#new-dbkey").val() );
+ var continue_fn = function() {
+ view = new View( $("#center"), undefined, $("#new-title").val(), undefined, $("#new-dbkey").val() );
init();
hide_modal();
};
@@ -105,18 +105,20 @@
});
%endif
- $(document).bind( "redraw", function( e ) {
+ $(document).bind( "redraw", function() {
view.redraw();
});
// To adjust the size of the viewport to fit the fixed-height footer
- var refresh = function( e ) {
- view.viewport_container.height( $(window).height() - 100 );
- view.nav_container.width( $("#center").width() );
- view.redraw();
+ var refresh = function() {
+ if (view !== undefined) {
+ view.viewport_container.height( $(window).height() - 100 );
+ view.nav_container.width( $("#center").width() );
+ view.redraw();
+ }
};
- $(window).bind( "resize", function(e) { refresh(e); } );
- $("#right-border").bind( "click dragend", function(e) { refresh(e); } );
+ $(window).bind( "resize", function() { refresh(); } );
+ $("#right-border").bind( "click dragend", function() { refresh(); } );
$(window).trigger( "resize" );
// Execute initializer for EDITOR specific javascript
@@ -154,9 +156,10 @@
error: function() {},
success: function(track_data) {
var td = track_data,
- track_types = { "LineTrack": LineTrack, "FeatureTrack": FeatureTrack, "ReadTrack": ReadTrack };
-
- view.add_track(new track_types[track_data.track_type]( track_data.name, view, track_data.dataset_id, track_data.prefs) );
+ track_types = { "LineTrack": LineTrack, "FeatureTrack": FeatureTrack, "ReadTrack": ReadTrack },
+ new_track = new track_types[track_data.track_type]( track_data.name, view, track_data.dataset_id, track_data.prefs);
+
+ view.add_track(new_track);
view.has_changes = true;
sidebar_box(new_track);
}
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -110,15 +110,15 @@ var View = function( container, chrom, t
this.low_input = $("<input/>").addClass("low").css("width", "10em").appendTo(this.chrom_form);
$("<span/>").text(" - ").appendTo(this.chrom_form);
this.high_input = $("<input/>").addClass("high").css("width", "10em").appendTo(this.chrom_form);
- this.hidden_input = $("<input/>").attr("type", "hidden").val(this.vis_id).appendTo(this.chrom_form);
+ if (this.vis_id !== undefined) {
+ this.hidden_input = $("<input/>").attr("type", "hidden").val(this.vis_id).appendTo(this.chrom_form);
+ }
this.zi_link = $("<a/>").click(function() { view.zoom_in(); view.redraw() }).html('<img src="../images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);
this.zo_link = $("<a/>").click(function() { view.zoom_out(); view.redraw() }).html('<img src="../images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);;
- var data_d = (this.vis_id !== undefined ? { vis_id: this.vis_id } : { dbkey: this.dbkey });
-
$.ajax({
url: chrom_url,
- data: data_d,
+ data: (this.vis_id !== undefined ? { vis_id: this.vis_id } : { dbkey: this.dbkey }),
dataType: "json",
success: function ( result ) {
if (result['reference']) {
--- a/.hgignore
+++ b/.hgignore
@@ -38,3 +38,9 @@ run_functional_tests.html
# Chrom len files
*.len
+
+# Misc
+*.orig
+.DS_Store
+*.rej
+
--- a/static/june_2007_style/blue/trackster.css
+++ b/static/june_2007_style/blue/trackster.css
@@ -1,125 +1,23 @@
-.viewport-container {
- overflow-x: hidden;
- overflow-y: auto;
-}
-
-/*canvas{
- border-left: 1px solid green;
- border-right: 1px solid red; } /* debugging */
-.nav {
- padding: 0 0;
- color:#333;font-weight:bold;
-}
-
-.nav-controls {
- text-align: center;
- background:#cccccc;
- background-image:url(style/panel_header_bg.png);
- background-position:top center;
- background-repeat:repeat-x;
- padding: 2px 0;
-}
-.nav-controls input {
- margin: 0 5px;
-}
-.nav-controls a {
- padding: 0 0.4em;
-}
-
-.overview {
- width: 100%;
- margin: 0px;
- color: white;
- margin-top: -6px;
- margin-bottom: -4px;
-}
-
-.overview-viewport {
- position: relative;
- height: 14px;
-/* border-top: solid #666 1px;*/
-/* border-bottom: solid #aaa 1px;*/
- background: white;
- border-top: solid gray 1px;
- border-bottom: solid gray 1px;
- margin: 5px 0;
-}
-.overview-box {
- position: absolute;
- margin-top: 0px;
- height: 14px;
- background: #ddd url(images/visualization/draggable_horizontal.png) center center no-repeat;
- /*border-style: outset;*/
-}
-
-.viewport {
-/* overflow-x: hidden;*/
- background-color: #fff;
-/* overflow: scroll;*/
-/* border-bottom: 2px solid black;*/
-}
-
-.viewport-canvas {
- width: 100%;
- height: 100px;
-}
-
-.yaxislabel {
- color: #777;
-}
-/* Line track needs borders to show range */
-.line-track .track-content {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
-}
-
-.track {
- /* border-top: solid #DDDDDD 1px; */
- /* border-bottom: solid #DDDDDD 1px; */
- background: white;
-}
-
-.track-header {
- text-align: center;
- padding: 4px;
- color: #666;
-}
-
-.track-content {
- overflow: hidden;
- text-align: center;
-}
-
-.track.error {
- background-color: #ECB4AF;
-}
-.track.nodata {
- background-color: #ddd;
-}
-
-.loading {
- min-height: 100px;
-}
-
-.label-track {
- /* font-weight: bold; */
- /* font-size: 10px; */
-}
-.label-track .label {
- border-left: solid #999 1px;
- padding: 1px;
- display: inline-block;
-}
-.right-float {
- float: right;
- margin-left: 5px;
-}
-
-.top-labeltrack {
- border-bottom: solid #999 1px;
-}
-
-.nav-labeltrack {
- border-top: solid #999 1px;
- border-bottom: solid #999 1px;
-}
+.viewport-container{overflow-x:hidden;overflow-y:auto;}
+.nav{padding:0 0;color:#333;font-weight:bold;}
+.nav-controls{text-align:center;background:#cccccc;background-image:url(panel_header_bg.png);background-position:top center;background-repeat:repeat-x;padding:2px 0;}
+.nav-controls input{margin:0 5px;}
+.nav-controls a{padding:0 0.4em;}
+.overview{width:100%;margin:0px;color:white;margin-top:-6px;margin-bottom:-4px;}
+.overview-viewport{position:relative;height:14px;background:white;border-top:solid gray 1px;border-bottom:solid gray 1px;margin:5px 0;}
+.overview-box{position:absolute;margin-top:0px;height:14px;background:#ddd url(../images/visualization/draggable_horizontal.png) center center no-repeat;}
+.viewport{background-color:#fff;}
+.viewport-canvas{width:100%;height:100px;}
+.yaxislabel{color:#777;}
+.line-track .track-content{border-top:1px solid #ddd;border-bottom:1px solid #ddd;}
+.track{background:white;}
+.track-header{text-align:center;padding:4px;color:#666;}
+.track-content{overflow:hidden;text-align:center;}
+.track.error{background-color:#ECB4AF;}
+.track.nodata{background-color:#ddd;}
+.loading{min-height:100px;}
+.label-track{}
+.label-track .label{border-left:solid #999 1px;padding:1px;display:inline-block;}
+.right-float{float:right;margin-left:5px;}
+.top-labeltrack{border-bottom:solid #999 1px;}
+.nav-labeltrack{border-top:solid #999 1px;border-bottom:solid #999 1px;}
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/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="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.p
rototype,{init:function(){var c=this.container,a=this;this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.content_div);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.viewport=$("<div/>").addClass("viewport").appendTo(this.viewport_container);this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form
=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);this.low_input=$("<input/>").addClass("low").css("width","10em").appendTo(this.chrom_form);$("<span/>").text(" - ").appendTo(this.chrom_form);this.high_input=$("<input/>").addClass("high").css("width","10em").appendTo(this.chrom_form);this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);var b=(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey});$.ajax({url:chrom_url,data:b,dataT
ype:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.chrom_select.bind("change",function(){a.chrom=a.chrom_select.val();var h=$.grep(a.chrom_data,function(k,l){return k.chrom===a.chrom})[0];a.max_high=h.len;a.reset();a.redraw(true);for(var j in a.tracks){var g=a.tracks[j];if(g.init){g.init()}}a.redraw()})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("mousewheel",function(d,f){if(Math.abs(f)<0.5){return}if(f>0){a.zoom_in(d.pageX,this.viewport_container)}else{a.zoom_out()}d.preventDefault()});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-
this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.high-a.low));a.move_delta(-2*f)});this.viewport_container.bind("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX}).bind("drag",function(g){var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);if(f<d.get(0).scrollHeight-d.height()){d.scrollTop(f)}this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height(),top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x),d=Math.max(j.c
lientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width();a.low_input.val(commatize(Math.round(f/g*h)+a.low));a.high_input.val(commatize(Math.round(d/g*h)+a.low));this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.
track_id_counter+=1},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)]},update_options:function(){this.has_changes=true;var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];this.viewport.append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(f){var d=this.high-this.low,b=this.low,e=this.high;if(b<this.max_low){b=this.max_low}if(e>this.max_high){e=this.max_high}if(d<this.min_separation){e=b+this.min_separation}this.low=Math.floor(b);this.high=Math.ceil(e);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEAT
URE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));this.overview_box.css({left:(this.low/(this.max_high-this.max_low))*this.overview_viewport.width(),width:Math.max(12,(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())}).show();this.low_input.val(commatize(this.low));this.high_input.val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor
)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()}});var Track=function(b,a,c){this.name=b;this.parent_element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div />").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error")
;$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){this.left_offset=200};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove()
;this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a,b){Track.call(this,null,a,b);this.track_type="LabelTrack";this.hidden=true;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(1
0,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";Track.call(this,null,a,a.nav_labeltrack);TiledTrack.call(this);this.hidden=true;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:
a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),n=e.get(0).getContext("2d"),j=f+"_"+b;if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o+this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o);n.fillText(m[h],a+this.left_offset,10)}k.append(e);return e}}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,
mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}if(c.mode!==undefined){this.prefs.mode=c.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div />").add
Class("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=M
ath.ceil(a*e+this.left_offset);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(o){var a=$("<div />").addClass("form-row");var h="track_"+o+"_minval",m=$("<label></label>"
).attr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),n=$("<input></input>").attr("id",h).val(b),l="track_"+o+"_maxval",g=$("<label></label>").attr("for",l).text("Max value:"),k=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",l).val(k),e="track_"+o+"_mode",d=$("<label></label>").attr("for",e).text("Display mode:"),j=(this.prefs.mode===undefined?"Line":this.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+j).attr("selected","selected");return a.append(m).append(n).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this
.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:false};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.
label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;a.mode="Auto";if(a.mode_div){a.mode_div.remove()}this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(d){a.mode_div=$("<div class='right-float menubutton popup' />").text("Display Mode");a.header_div.append(a.mode_div);a.mode="Auto";var c=function(e){a.mode_div.text(e);a.mode=e;a.tile_cache.clear();a.draw()};make_popupmenu(a.mode_div,{Auto:function(){c("Auto")},Dense:function(){c("Dense")},Squish:function(){c("Squish")},Pack:function(){c("Pack")}});a.data_cache.set(b,d);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,res
olution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_
by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(X,h,n,ak){var E=h*DENSITY*X,ad=(h+1)*DENSITY*X,D=DENSITY*X;var ae=E+"_"+ad;var z=this.data_cache.get(ae);if(z===undefined){this.data_queue[[E,ad]]=true;this.get_data(E,ad);return}var a=Math.ceil(D*ak),L=$("<canvas class='tile'></canvas>"),Z=this.prefs.label_color,f=this.pr
efs.block_color,m=this.mode,V=(m==="Squish")||(m==="Dense")&&(m!=="Pack")||(m==="Auto"&&(z.extra_info==="no_detail")),P=this.left_offset,aj,s,al;if(z.dataset_type==="summary_tree"){s=30}else{if(m==="Dense"){s=15;al=10}else{al=(V?this.vertical_nodetail_px:this.vertical_detail_px);s=this.incremental_slots(this.view.zoom_res,z.data,V,m)*al+15;aj=this.inc_slots[this.view.zoom_res]}}L.css({position:"absolute",top:0,left:(E-this.view.low)*ak-P});L.get(0).width=a+P;L.get(0).height=s;n.parent().css("height",Math.max(this.height_px,s)+"px");var A=L.get(0).getContext("2d");A.fillStyle=f;A.font=this.default_font;A.textAlign="right";if(z.dataset_type=="summary_tree"){var K,H=55,ac=255-H,g=ac*2/3,R=z.data,C=z.max,l=z.avg;if(R.length>2){var b=Math.ceil((R[1][0]-R[0][0])*ak)}else{var b=50}for(var ag=0,w=R.length;ag<w;ag++){var T=Math.ceil((R[ag][0]-E)*ak);var S=R[ag][1];if(!S){continue}K=Math.floor(ac-(S/C)*ac);A.fillStyle="rgb("+K+","+K+","+K+")";A.fillRect(T+P,0,b,20);if(this.prefs.show_
counts){if(K>g){A.fillStyle="black"}else{A.fillStyle="#ddd"}A.textAlign="center";A.fillText(R[ag][1],T+P+(b/2),12)}}n.append(L);return L}var ai=z.data;var af=0;for(var ag=0,w=ai.length;ag<w;ag++){var M=ai[ag],J=M[0],ah=M[1],U=M[2],F=M[3];if(ah<=ad&&U>=E){var W=Math.floor(Math.max(0,(ah-E)*ak)),B=Math.ceil(Math.min(a,Math.max(0,(U-E)*ak))),Q=(m==="Dense"?0:aj[J]*al);if(z.dataset_type==="bai"){A.fillStyle=f;if(M[4] instanceof Array){var t=Math.floor(Math.max(0,(M[4][0]-E)*ak)),I=Math.ceil(Math.min(a,Math.max(0,(M[4][1]-E)*ak))),r=Math.floor(Math.max(0,(M[5][0]-E)*ak)),p=Math.ceil(Math.min(a,Math.max(0,(M[5][1]-E)*ak)));if(M[4][1]>=E&&M[4][0]<=ad){this.rect_or_text(A,ak,E,ad,M[4][0],M[4][2],t+P,I-t,Q)}if(M[5][1]>=E&&M[5][0]<=ad){this.rect_or_text(A,ak,E,ad,M[5][0],M[5][2],r+P,p-r,Q)}if(r>I){A.fillStyle="#999";A.fillRect(I+P,Q+5,r-I,1)}}else{A.fillStyle=f;this.rect_or_text(A,ak,E,ad,ah,F,W+P,B-W,Q)}if(m!=="Dense"&&!V&&ah>E){A.fillStyle=this.prefs.label_color;if(h===0&&W-A.measur
eText(F).width<0){A.textAlign="left";A.fillText(J,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(J,W-2+P,Q+8)}A.fillStyle=f}}else{if(z.dataset_type==="interval_index"){if(V){A.fillRect(W+P,Q+5,B-W,1)}else{var v=M[4],O=M[5],Y=M[6],e=M[7];var u,aa,G=null,am=null;if(O&&Y){G=Math.floor(Math.max(0,(O-E)*ak));am=Math.ceil(Math.min(a,Math.max(0,(Y-E)*ak)))}if(m!=="Dense"&&F!==undefined&&ah>E){A.fillStyle=Z;if(h===0&&W-A.measureText(F).width<0){A.textAlign="left";A.fillText(F,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(F,W-2+P,Q+8)}A.fillStyle=f}if(e){if(v){if(v=="+"){A.fillStyle=RIGHT_STRAND}else{if(v=="-"){A.fillStyle=LEFT_STRAND}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=f}for(var ae=0,d=e.length;ae<d;ae++){var o=e[ae],c=Math.floor(Math.max(0,(o[0]-E)*ak)),N=Math.ceil(Math.min(a,Math.max((o[1]-E)*ak)));if(c>N){continue}u=5;aa=3;A.fillRect(c+P,Q+aa,N-c,u);if(G!==undefined&&!(c>am||N<G)){u=9;aa=1;var ab=Math.max(c,G),q=Math.min(N,am);A.fillRect(ab+P,Q+aa,q-ab,u)}}}else{u=9;aa=1;A.fil
lRect(W+P,Q+aa,B-W,u);if(M.strand){if(M.strand=="+"){A.fillStyle=RIGHT_STRAND_INV}else{if(M.strand=="-"){A.fillStyle=LEFT_STRAND_INV}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=prefs.block_color}}}}}af++}}n.append(L);return L},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_l
abel_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/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="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.p
rototype,{init:function(){var b=this.container,a=this;this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(b);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.content_div);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.viewport=$("<div/>").addClass("viewport").appendTo(this.viewport_container);this.nav_container=$("<div/>").addClass("nav-container").appendTo(b);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form
=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);this.low_input=$("<input/>").addClass("low").css("width","10em").appendTo(this.chrom_form);$("<span/>").text(" - ").appendTo(this.chrom_form);this.high_input=$("<input/>").addClass("high").css("width","10em").appendTo(this.chrom_form);if(this.vis_id!==undefined){this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form)}this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);$.ajax({url:chrom_url,data:(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbke
y:this.dbkey}),dataType:"json",success:function(c){if(c.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=c.chrom_info;var e='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var d=a.chrom_data[i]["chrom"];e+='<option value="'+d+'">'+d+"</option>"}a.chrom_select.html(e);a.chrom_select.bind("change",function(){a.chrom=a.chrom_select.val();var g=$.grep(a.chrom_data,function(j,k){return j.chrom===a.chrom})[0];a.max_high=g.len;a.reset();a.redraw(true);for(var h in a.tracks){var f=a.tracks[h];if(f.init){f.init()}}a.redraw()})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("mousewheel",function(c,d){if(Math.abs(d)<0.5){return}if(d>0){a.zoom_in(c.pageX,this.viewport_container)}else{a.zoom_out()}c.preventDefault()});this.content_div.bind("dblclick",function(c){a.zoom_in(c.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(c){this.current_x=c.offsetX}).bind("drag",function
(c){var f=c.offsetX-this.current_x;this.current_x=c.offsetX;var d=Math.round(f/a.viewport_container.width()*(a.high-a.low));a.move_delta(-2*d)});this.viewport_container.bind("dragstart",function(c){this.original_low=a.low;this.current_height=c.clientY;this.current_x=c.offsetX}).bind("drag",function(f){var c=$(this);var h=f.offsetX-this.current_x;var d=c.scrollTop()-(f.clientY-this.current_height);if(d<c.get(0).scrollHeight-c.height()){c.scrollTop(d)}this.current_height=f.clientY;this.current_x=f.offsetX;var g=Math.round(h/a.viewport_container.width()*(a.high-a.low));a.move_delta(g)});this.top_labeltrack.bind("dragstart",function(c){this.drag_origin_x=c.clientX;this.drag_origin_pos=c.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height(),top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5}).appendTo($(this))}).bind("drag",function(h){var d=Math.min(h.clientX,this.drag_orig
in_x),c=Math.max(h.clientX,this.drag_origin_x),g=(a.high-a.low),f=a.viewport_container.width();a.low_input.val(commatize(Math.round(d/f*g)+a.low));a.high_input.val(commatize(Math.round(c/f*g)+a.low));this.drag_div.css({left:d+"px",width:(c-d)+"px"})}).bind("dragend",function(j){var d=Math.min(j.clientX,this.drag_origin_x),c=Math.max(j.clientX,this.drag_origin_x),g=(a.high-a.low),f=a.viewport_container.width(),h=a.low;a.low=Math.round(d/f*g)+h;a.high=Math.round(c/f*g)+h;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track
_"+a.track_id);this.track_id_counter+=1},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)]},update_options:function(){this.has_changes=true;var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];this.viewport.append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(f){var d=this.high-this.low,b=this.low,e=this.high;if(b<this.max_low){b=this.max_low}if(e>this.max_high){e=this.max_high}if(d<this.min_separation){e=b+this.min_separation}this.low=Math.floor(b);this.high=Math.ceil(e);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zo
om_res=Math.pow(FEATURE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));this.overview_box.css({left:(this.low/(this.max_high-this.max_low))*this.overview_viewport.width(),width:Math.max(12,(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())}).show();this.low_input.val(commatize(this.low));this.high_input.val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a
=(b*this.zoom_factor)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()}});var Track=function(b,a,c){this.name=b;this.parent_element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div />").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("C
lick to view error");$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){this.left_offset=200};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.childre
n(":first").remove();this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a,b){Track.call(this,null,a,b);this.track_type="LabelTrack";this.hidden=true;this.container_div.addClass("label-track")};$.extend(LabelTrack.prototype,Track.prototype,{draw:function(){var c=this.view,d=c.high-c.low,g=M
ath.floor(Math.pow(10,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";Track.call(this,null,a,a.nav_labeltrack);TiledTrack.call(this);this.hidden=true;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:
this.view.chrom,low:a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),n=e.get(0).getContext("2d"),j=f+"_"+b;if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o+this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o);n.fillText(m[h],a+this.left_offset,10)}k.append(e);return e}}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,
max_value:undefined,mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}if(c.mode!==undefined){this.prefs.mode=c.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);va
r d=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*
e});b.get(0).width=Math.ceil(a*e+this.left_offset);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(o){var a=$("<div />").addClass("form-row");var h="track_"+o+"_minval",m
=$("<label></label>").attr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),n=$("<input></input>").attr("id",h).val(b),l="track_"+o+"_maxval",g=$("<label></label>").attr("for",l).text("Max value:"),k=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",l).val(k),e="track_"+o+"_mode",d=$("<label></label>").attr("for",e).text("Display mode:"),j=(this.prefs.mode===undefined?"Line":this.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+j).attr("selected","selected");return a.append(m).append(n).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs
.max_value||b!==this.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:false};if(c.block_color!==undefined){this.prefs.block_color
=c.block_color}if(c.label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;a.mode="Auto";if(a.mode_div){a.mode_div.remove()}this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(d){a.mode_div=$("<div class='right-float menubutton popup' />").text("Display Mode");a.header_div.append(a.mode_div);a.mode="Auto";var c=function(e){a.mode_div.text(e);a.mode=e;a.tile_cache.clear();a.draw()};make_popupmenu(a.mode_div,{Auto:function(){c("Auto")},Dense:function(){c("Dense")},Squish:function(){c("Squish")},Pack:function(){c("Pack")}});a.data_cache.set(b,d);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset
_id:b.dataset_id,resolution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for
(var u=0,A=this.s_e_by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(X,h,n,ak){var E=h*DENSITY*X,ad=(h+1)*DENSITY*X,D=DENSITY*X;var ae=E+"_"+ad;var z=this.data_cache.get(ae);if(z===undefined){this.data_queue[[E,ad]]=true;this.get_data(E,ad);return}var a=Math.ceil(D*ak),L=$("<canvas class='tile'></canvas>"),Z=this.prefs.l
abel_color,f=this.prefs.block_color,m=this.mode,V=(m==="Squish")||(m==="Dense")&&(m!=="Pack")||(m==="Auto"&&(z.extra_info==="no_detail")),P=this.left_offset,aj,s,al;if(z.dataset_type==="summary_tree"){s=30}else{if(m==="Dense"){s=15;al=10}else{al=(V?this.vertical_nodetail_px:this.vertical_detail_px);s=this.incremental_slots(this.view.zoom_res,z.data,V,m)*al+15;aj=this.inc_slots[this.view.zoom_res]}}L.css({position:"absolute",top:0,left:(E-this.view.low)*ak-P});L.get(0).width=a+P;L.get(0).height=s;n.parent().css("height",Math.max(this.height_px,s)+"px");var A=L.get(0).getContext("2d");A.fillStyle=f;A.font=this.default_font;A.textAlign="right";if(z.dataset_type=="summary_tree"){var K,H=55,ac=255-H,g=ac*2/3,R=z.data,C=z.max,l=z.avg;if(R.length>2){var b=Math.ceil((R[1][0]-R[0][0])*ak)}else{var b=50}for(var ag=0,w=R.length;ag<w;ag++){var T=Math.ceil((R[ag][0]-E)*ak);var S=R[ag][1];if(!S){continue}K=Math.floor(ac-(S/C)*ac);A.fillStyle="rgb("+K+","+K+","+K+")";A.fillRect(T+P,0,b,20)
;if(this.prefs.show_counts){if(K>g){A.fillStyle="black"}else{A.fillStyle="#ddd"}A.textAlign="center";A.fillText(R[ag][1],T+P+(b/2),12)}}n.append(L);return L}var ai=z.data;var af=0;for(var ag=0,w=ai.length;ag<w;ag++){var M=ai[ag],J=M[0],ah=M[1],U=M[2],F=M[3];if(ah<=ad&&U>=E){var W=Math.floor(Math.max(0,(ah-E)*ak)),B=Math.ceil(Math.min(a,Math.max(0,(U-E)*ak))),Q=(m==="Dense"?0:aj[J]*al);if(z.dataset_type==="bai"){A.fillStyle=f;if(M[4] instanceof Array){var t=Math.floor(Math.max(0,(M[4][0]-E)*ak)),I=Math.ceil(Math.min(a,Math.max(0,(M[4][1]-E)*ak))),r=Math.floor(Math.max(0,(M[5][0]-E)*ak)),p=Math.ceil(Math.min(a,Math.max(0,(M[5][1]-E)*ak)));if(M[4][1]>=E&&M[4][0]<=ad){this.rect_or_text(A,ak,E,ad,M[4][0],M[4][2],t+P,I-t,Q)}if(M[5][1]>=E&&M[5][0]<=ad){this.rect_or_text(A,ak,E,ad,M[5][0],M[5][2],r+P,p-r,Q)}if(r>I){A.fillStyle="#999";A.fillRect(I+P,Q+5,r-I,1)}}else{A.fillStyle=f;this.rect_or_text(A,ak,E,ad,ah,F,W+P,B-W,Q)}if(m!=="Dense"&&!V&&ah>E){A.fillStyle=this.prefs.label_color;
if(h===0&&W-A.measureText(F).width<0){A.textAlign="left";A.fillText(J,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(J,W-2+P,Q+8)}A.fillStyle=f}}else{if(z.dataset_type==="interval_index"){if(V){A.fillRect(W+P,Q+5,B-W,1)}else{var v=M[4],O=M[5],Y=M[6],e=M[7];var u,aa,G=null,am=null;if(O&&Y){G=Math.floor(Math.max(0,(O-E)*ak));am=Math.ceil(Math.min(a,Math.max(0,(Y-E)*ak)))}if(m!=="Dense"&&F!==undefined&&ah>E){A.fillStyle=Z;if(h===0&&W-A.measureText(F).width<0){A.textAlign="left";A.fillText(F,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(F,W-2+P,Q+8)}A.fillStyle=f}if(e){if(v){if(v=="+"){A.fillStyle=RIGHT_STRAND}else{if(v=="-"){A.fillStyle=LEFT_STRAND}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=f}for(var ae=0,d=e.length;ae<d;ae++){var o=e[ae],c=Math.floor(Math.max(0,(o[0]-E)*ak)),N=Math.ceil(Math.min(a,Math.max((o[1]-E)*ak)));if(c>N){continue}u=5;aa=3;A.fillRect(c+P,Q+aa,N-c,u);if(G!==undefined&&!(c>am||N<G)){u=9;aa=1;var ab=Math.max(c,G),q=Math.min(N,am);A.fillRect(ab+P,Q+aa,q-ab,u)}}
}else{u=9;aa=1;A.fillRect(W+P,Q+aa,B-W,u);if(M.strand){if(M.strand=="+"){A.fillStyle=RIGHT_STRAND_INV}else{if(M.strand=="-"){A.fillStyle=LEFT_STRAND_INV}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=prefs.block_color}}}}}af++}}n.append(L);return L},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val()
,d=$("#track_"+e+"_label_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0
galaxy-dist commit 7084aafd2e1a: Enable bedgraph files to be displayed in UCSC genome browser.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278981206 14400
# Node ID 7084aafd2e1a77200935a15b64774b0f65ca06f5
# Parent 67392693199489978700ecd35ec463d1901ffe1e
Enable bedgraph files to be displayed in UCSC genome browser.
--- a/lib/galaxy/datatypes/interval.py
+++ b/lib/galaxy/datatypes/interval.py
@@ -332,6 +332,56 @@ class BedGraph( Interval ):
def get_track_type( self ):
return "LineTrack", {"data": "array_tree"}
+
+ def as_ucsc_display_file( self, dataset, **kwd ):
+ """
+ Returns file contents as is with no modifications.
+ TODO: this is a functional stub and will need to be enhanced moving forward to provide additional support for bedgraph.
+ """
+ return open( dataset.file_name )
+
+ def get_estimated_display_viewport( self, dataset ):
+ """
+ Set viewport based on dataset's first 100 lines.
+ """
+ if dataset.has_data() and dataset.state == dataset.states.OK:
+ try:
+ # Set seqid, start, stop.
+ seqid = None
+ start = 2147483647 # Maximum value of a signed 32 bit integer ( 2**31 - 1 )
+ stop = 0
+ for i, line in enumerate( file( dataset.file_name ) ):
+ line = line.rstrip( '\r\n' )
+ if not line:
+ continue
+ elts = line.split('\t')
+ if len( elts ) == 4:
+ # Update seq id, start, end.
+ if not seqid:
+ # We can only set the viewport for a single chromosome
+ seqid = elems[0]
+ if seqid == elems[0]:
+ # Make sure we have not spanned chromosomes
+ start = min( start, int( elems[1] ) )
+ stop = max( stop, int( elems[2] ) )
+ else:
+ # We've spanned a chromosome
+ break
+ else:
+ continue
+ # Only look through 100 lines.
+ if i > 100:
+ break
+
+ # Set valid values for start, stop if necessary.
+ if start == 2147483647:
+ start = 0
+ if stop == 0:
+ stop = 1
+ return ( seqid, str( start ), str( stop ) )
+ except:
+ return( '', '', '' )
+ return( '', '', '' )
class Bed( Interval ):
"""Tab delimited data in BED format"""
1
0
galaxy-dist commit e785da8dfaa2: Move trackster.css to current stylesheets folder.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278944456 14400
# Node ID e785da8dfaa235cebbd6d932e3943f15ac091d04
# Parent e65936a1fa4923925a7a5c3848c9ced7c1ad883f
Move trackster.css to current stylesheets folder.
--- a/static/june_2007_style/trackster.css
+++ /dev/null
@@ -1,125 +0,0 @@
-.viewport-container {
- overflow-x: hidden;
- overflow-y: auto;
-}
-
-/*canvas{
- border-left: 1px solid green;
- border-right: 1px solid red; } /* debugging */
-.nav {
- padding: 0 0;
- color:#333;font-weight:bold;
-}
-
-.nav-controls {
- text-align: center;
- background:#cccccc;
- background-image:url(style/panel_header_bg.png);
- background-position:top center;
- background-repeat:repeat-x;
- padding: 2px 0;
-}
-.nav-controls input {
- margin: 0 5px;
-}
-.nav-controls a {
- padding: 0 0.4em;
-}
-
-.overview {
- width: 100%;
- margin: 0px;
- color: white;
- margin-top: -6px;
- margin-bottom: -4px;
-}
-
-.overview-viewport {
- position: relative;
- height: 14px;
-/* border-top: solid #666 1px;*/
-/* border-bottom: solid #aaa 1px;*/
- background: white;
- border-top: solid gray 1px;
- border-bottom: solid gray 1px;
- margin: 5px 0;
-}
-.overview-box {
- position: absolute;
- margin-top: 0px;
- height: 14px;
- background: #ddd url(images/visualization/draggable_horizontal.png) center center no-repeat;
- /*border-style: outset;*/
-}
-
-.viewport {
-/* overflow-x: hidden;*/
- background-color: #fff;
-/* overflow: scroll;*/
-/* border-bottom: 2px solid black;*/
-}
-
-.viewport-canvas {
- width: 100%;
- height: 100px;
-}
-
-.yaxislabel {
- color: #777;
-}
-/* Line track needs borders to show range */
-.line-track .track-content {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
-}
-
-.track {
- /* border-top: solid #DDDDDD 1px; */
- /* border-bottom: solid #DDDDDD 1px; */
- background: white;
-}
-
-.track-header {
- text-align: center;
- padding: 4px;
- color: #666;
-}
-
-.track-content {
- overflow: hidden;
- text-align: center;
-}
-
-.track.error {
- background-color: #ECB4AF;
-}
-.track.nodata {
- background-color: #ddd;
-}
-
-.loading {
- min-height: 100px;
-}
-
-.label-track {
- /* font-weight: bold; */
- /* font-size: 10px; */
-}
-.label-track .label {
- border-left: solid #999 1px;
- padding: 1px;
- display: inline-block;
-}
-.right-float {
- float: right;
- margin-left: 5px;
-}
-
-.top-labeltrack {
- border-bottom: solid #999 1px;
-}
-
-.nav-labeltrack {
- border-top: solid #999 1px;
- border-bottom: solid #999 1px;
-}
--- /dev/null
+++ b/static/june_2007_style/blue/trackster.css
@@ -0,0 +1,125 @@
+.viewport-container {
+ overflow-x: hidden;
+ overflow-y: auto;
+}
+
+/*canvas{
+ border-left: 1px solid green;
+ border-right: 1px solid red; } /* debugging */
+.nav {
+ padding: 0 0;
+ color:#333;font-weight:bold;
+}
+
+.nav-controls {
+ text-align: center;
+ background:#cccccc;
+ background-image:url(style/panel_header_bg.png);
+ background-position:top center;
+ background-repeat:repeat-x;
+ padding: 2px 0;
+}
+.nav-controls input {
+ margin: 0 5px;
+}
+.nav-controls a {
+ padding: 0 0.4em;
+}
+
+.overview {
+ width: 100%;
+ margin: 0px;
+ color: white;
+ margin-top: -6px;
+ margin-bottom: -4px;
+}
+
+.overview-viewport {
+ position: relative;
+ height: 14px;
+/* border-top: solid #666 1px;*/
+/* border-bottom: solid #aaa 1px;*/
+ background: white;
+ border-top: solid gray 1px;
+ border-bottom: solid gray 1px;
+ margin: 5px 0;
+}
+.overview-box {
+ position: absolute;
+ margin-top: 0px;
+ height: 14px;
+ background: #ddd url(images/visualization/draggable_horizontal.png) center center no-repeat;
+ /*border-style: outset;*/
+}
+
+.viewport {
+/* overflow-x: hidden;*/
+ background-color: #fff;
+/* overflow: scroll;*/
+/* border-bottom: 2px solid black;*/
+}
+
+.viewport-canvas {
+ width: 100%;
+ height: 100px;
+}
+
+.yaxislabel {
+ color: #777;
+}
+/* Line track needs borders to show range */
+.line-track .track-content {
+ border-top: 1px solid #ddd;
+ border-bottom: 1px solid #ddd;
+}
+
+.track {
+ /* border-top: solid #DDDDDD 1px; */
+ /* border-bottom: solid #DDDDDD 1px; */
+ background: white;
+}
+
+.track-header {
+ text-align: center;
+ padding: 4px;
+ color: #666;
+}
+
+.track-content {
+ overflow: hidden;
+ text-align: center;
+}
+
+.track.error {
+ background-color: #ECB4AF;
+}
+.track.nodata {
+ background-color: #ddd;
+}
+
+.loading {
+ min-height: 100px;
+}
+
+.label-track {
+ /* font-weight: bold; */
+ /* font-size: 10px; */
+}
+.label-track .label {
+ border-left: solid #999 1px;
+ padding: 1px;
+ display: inline-block;
+}
+.right-float {
+ float: right;
+ margin-left: 5px;
+}
+
+.top-labeltrack {
+ border-bottom: solid #999 1px;
+}
+
+.nav-labeltrack {
+ border-top: solid #999 1px;
+ border-bottom: solid #999 1px;
+}
1
0
galaxy-dist commit 399d6d2b7eee: Make URLs for viz zoom in/out images relative.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278947222 14400
# Node ID 399d6d2b7eee9a4e6e9670c44ca3b3a2848ea7a4
# Parent e785da8dfaa235cebbd6d932e3943f15ac091d04
Make URLs for viz zoom in/out images relative.
--- a/static/scripts/trackster.js
+++ b/static/scripts/trackster.js
@@ -111,8 +111,8 @@ var View = function( container, chrom, t
$("<span/>").text(" - ").appendTo(this.chrom_form);
this.high_input = $("<input/>").addClass("high").css("width", "10em").appendTo(this.chrom_form);
this.hidden_input = $("<input/>").attr("type", "hidden").val(this.vis_id).appendTo(this.chrom_form);
- this.zi_link = $("<a/>").click(function() { view.zoom_in(); view.redraw() }).html('<img src="/images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);
- this.zo_link = $("<a/>").click(function() { view.zoom_out(); view.redraw() }).html('<img src="/images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);;
+ this.zi_link = $("<a/>").click(function() { view.zoom_in(); view.redraw() }).html('<img src="../images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);
+ this.zo_link = $("<a/>").click(function() { view.zoom_out(); view.redraw() }).html('<img src="../images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);;
var data_d = (this.vis_id !== undefined ? { vis_id: this.vis_id } : { dbkey: this.dbkey });
1
0
galaxy-dist commit 3a6391d4f469: Fix bug so that page editor's 'insert link to page' option works.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278956233 14400
# Node ID 3a6391d4f46980fd8b86c9f9b15fd5684357552b
# Parent e683c6995fb5d032660d1c28cff2e1bc578d1298
Fix bug so that page editor's 'insert link to page' option works.
--- a/templates/page/editor.mako
+++ b/templates/page/editor.mako
@@ -104,12 +104,13 @@
item_plural = "Pages";
item_controller = "page";
item_class = "Page";
+ break;
case( Galaxy.ITEM_VISUALIZATION ):
item_singular = "Visualization";
item_plural = "Visualizations";
item_controller = "visualization";
item_class = "Visualization";
- break;
+ break;
}
// Build ajax URL that lists items for selection.
1
0
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dannon Baker <dannon.baker(a)emory.edu>
# Date 1278796427 14400
# Node ID e65936a1fa4923925a7a5c3848c9ced7c1ad883f
# Parent 19e07ef6eb25ea4bd1531ba42c2187f3f5d384d6
# Parent 2d046444998edb1c4a5126897990bddd25de69f5
Merge
--- a/templates/admin/requests/show_request.mako
+++ /dev/null
@@ -1,528 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-<%namespace file="/requests/sample_state.mako" import="render_sample_state" />
-<%namespace file="/requests/sample_datasets.mako" import="render_sample_datasets" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#show_request" ).submit();
- }
- });
-});
-</script>
-
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-</script>
-
-<script type="text/javascript">
- // Looks for changes in sample states using an async request. Keeps
- // calling itself (via setTimeout) until all samples are in a terminal
- // state.
- var updater = function ( sample_states ) {
- // Check if there are any items left to track
- var empty = true;
- for ( i in sample_states ) {
- empty = false;
- break;
- }
- if ( ! empty ) {
- setTimeout( function() { updater_callback( sample_states ) }, 1000 );
- }
- };
- var updater_callback = function ( sample_states ) {
- // Build request data
- var ids = []
- var states = []
- $.each( sample_states, function ( id, state ) {
- ids.push( id );
- states.push( state );
- });
- // Make ajax call
- $.ajax( {
- type: "POST",
- url: "${h.url_for( controller='requests_admin', action='sample_state_updates' )}",
- dataType: "json",
- data: { ids: ids.join( "," ), states: states.join( "," ) },
- success : function ( data ) {
- $.each( data, function( id, val ) {
- // Replace HTML
- var cell1 = $("#sampleState-" + id);
- cell1.html( val.html_state );
- var cell2 = $("#sampleDatasets-" + id);
- cell2.html( val.html_datasets );
- sample_states[ parseInt(id) ] = val.state;
- });
- updater( sample_states );
- },
- error: function() {
- // Just retry, like the old method, should try to be smarter
- updater( sample_states );
- }
- });
- };
-</script>
-
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-</style>
-
-<script type="text/javascript">
- function stopRKey(evt) {
- var evt = (evt) ? evt : ((event) ? event : null);
- var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
- if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
- }
- document.onkeypress = stopRKey
-</script>
-
-%if request.submitted():
- <% samples_not_ready = request.sequence_run_ready() %>
- %if samples_not_ready:
- ${render_msg( "Select a target library and folder for all the samples before starting the sequence run", "warning" )}
- %endif
-%endif
-
-%if request.rejected():
- ${render_msg( "Reason for rejection: "+request.last_comment(), "warning" )}
-%endif
-
-<div class="grid-header">
- <h2>Sequencing Request "${request.name}"</h2>
-</div>
-
-<ul class="manage-table-actions">
-
- %if request.unsubmitted() and request.samples:
- <li>
- <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_admin', action='list', operation='Submit', id=trans.security.encode_id(request.id) )}">
- <span>Submit request</span></a>
- </li>
- %endif
- %if request.submitted():
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='Reject', id=trans.security.encode_id(request.id))}">
- <span>Reject request</span></a>
- </li>
- %endif
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='events', id=trans.security.encode_id(request.id) )}">
- <span>History</span></a>
- </li>
-
-
-</ul>
-
-<%def name="show_basic_info_form( sample_index, sample, info )">
- <td>
- <input type="text" name=sample_${sample_index}_name value="${info['name']}" size="10"/>
- <div class="toolParamHelp" style="clear: both;">
- <i>${' (required)' }</i>
- </div>
- </td>
- %if sample:
- %if sample.request.unsubmitted():
- <td></td>
- %else:
- <td><input type="text" name=sample_${sample_index}_barcode value="${info['barcode']}" size="10"/></td>
- %endif
- %else:
- <td></td>
- %endif
- %if sample:
- %if sample.request.unsubmitted():
- <td>Unsubmitted</td>
- %else:
- <td><a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a></td>
- %endif
- %else:
- <td></td>
- %endif
- <td>${info['lib_widget'].get_html()}</td>
- <td>${info['folder_widget'].get_html()}</td>
- %if request.submitted() or request.complete():
- %if sample:
- <td><a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a></td>
- %else:
- <td><a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">Add</a></td>
- %endif
- %endif
-</%def>
-
-## This function displays the "Basic Information" grid
-<%def name="render_basic_info_grid()">
- <h4>Sample Information</h4>
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- <th>Barcode</th>
- <th>State</th>
- <th>Data Library</th>
- <th>Folder</th>
- %if request.submitted() or request.complete():
- <th>Dataset(s) Transferred</th>
- %endif
- <th></th>
- </tr>
- <thead>
- <tbody>
- <%
- trans.sa_session.refresh( request )
- %>
- %for sample_index, info in enumerate(current_samples):
- <%
- if sample_index in range(len(request.samples)):
- sample = request.samples[sample_index]
- else:
- sample = None
- %>
- %if edit_mode == 'True':
- <tr>
- ${show_basic_info_form( sample_index, sample, info )}
- </tr>
- %else:
- <tr>
- %if sample_index in range(len(request.samples)):
- <td>${info['name']}</td>
- <td>${info['barcode']}</td>
- %if sample.request.unsubmitted():
- <td>Unsubmitted</td>
- %else:
- <td id="sampleState-${sample.id}">${render_sample_state( sample )}</td>
- %endif
-
-## <td>
-## %if sample:
-## %if sample.request.unsubmitted():
-## Unsubmitted
-## %else:
-## <a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
-## %endif
-## %endif
-## </td>
- %if info['library']:
- <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( info['library'].id ) )}">${info['library'].name}</a></td>
- %else:
- <td></td>
- %endif
- %if info['folder']:
- <td>${info['folder'].name}</td>
- %else:
- <td></td>
- %endif
- %if request.submitted() or request.complete():
- <td id="sampleDatasets-${sample.id}">
- ${render_sample_datasets( sample )}
-## <a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a>
- </td>
- %endif
-
-
- %else:
- ${show_basic_info_form( sample_index, sample, info )}
- %endif
- %if request.unsubmitted() or request.rejected():
- <td>
- %if sample:
- %if sample.request.unsubmitted():
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_sample', request_id=request.id, sample_id=sample_index )}">
- <img src="${h.url_for('/static/images/delete_icon.png')}" />
- <span></span></a>
- %endif
- %endif
- </td>
- %endif
- </tr>
- %endif
- %endfor
- </tbody>
- </table>
-</%def>
-
-<%def name="render_sample_form( index, sample_name, sample_values, fields_dict )">
- <td>
- ${sample_name}
- </td>
- %for field_index, field in fields_dict.items():
- <td>
- %if field['type'] == 'TextField':
- <input type="text" name="sample_${index}_field_${field_index}" value="${sample_values[field_index]}" size="7"/>
- %elif field['type'] == 'SelectField':
- <select name="sample_${index}_field_${field_index}" last_selected_value="2">
- %for option_index, option in enumerate(field['selectlist']):
- %if option == sample_values[field_index]:
- <option value="${option}" selected>${option}</option>
- %else:
- <option value="${option}">${option}</option>
- %endif
- %endfor
- </select>
- %elif field['type'] == 'WorkflowField':
- <select name="sample_${index}_field_${field_index}">
- %if str(sample_values[field_index]) == 'none':
- <option value="none" selected>Select one</option>
- %else:
- <option value="none">Select one</option>
- %endif
- %for option_index, option in enumerate(request.user.stored_workflows):
- %if not option.deleted:
- %if str(option.id) == str(sample_values[field_index]):
- <option value="${option.id}" selected>${option.name}</option>
- %else:
- <option value="${option.id}">${option.name}</option>
- %endif
- %endif
- %endfor
- </select>
- %elif field['type'] == 'CheckboxField':
- <input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes"/>
- %endif
- <div class="toolParamHelp" style="clear: both;">
- <i>${'('+field['required']+')' }</i>
- </div>
- </td>
- %endfor
-</%def>
-
-<%def name="render_sample( index, sample_name, sample_values, fields_dict )">
- <td>
- ${sample_name}
- </td>
- %for field_index, field in fields_dict.items():
- <td>
- %if sample_values[field_index]:
- %if field['type'] == 'WorkflowField':
- %if str(sample_values[field_index]) != 'none':
- <% workflow = trans.sa_session.query( trans.app.model.StoredWorkflow ).get( int(sample_values[field_index]) ) %>
- <a href="${h.url_for( controller='workflow', action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name}</a>
- %endif
- %else:
- ${sample_values[field_index]}
- %endif
- %else:
- <i>None</i>
- %endif
- </td>
- %endfor
-</%def>
-
-<div class="toolForm">
- <div class="form-row">
- <div class="msg_list">
- <h4 class="msg_head"><u>Request Information</u></h4>
- <div class="msg_body">
- %for index, rd in enumerate(request_details):
- <div class="form-row">
- <label>${rd['label']}</label>
- %if not rd['value']:
- <i>None</i>
- %else:
- %if rd['label'] == 'State':
- <a href="${h.url_for( controller='requests_admin', action='list', operation='events', id=trans.security.encode_id(request.id) )}">${rd['value']}</a>
- %else:
- ${rd['value']}
- %endif
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- <div class="form-row">
- <ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='Edit', id=trans.security.encode_id(request.id))}">
- <span>Edit request details</span></a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
-</div>
-
-<br/>
-
-
-<%def name="render_grid( grid_index, grid_name, fields_dict )">
- <br/>
- <div class="msg_list">
- %if grid_name:
- <h4 class="msg_head"><u>${grid_name}</u></h4>
- %else:
- <h4>Grid ${grid_index}</h4>
- %endif
- %if edit_mode == 'False' or len(current_samples) <= len(request.samples):
- <div class="msg_body">
- %else:
- <div class="msg_body2">
- %endif
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- %for index, field in fields_dict.items():
- <th>
- ${field['label']}
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- </th>
- %endfor
- <th></th>
- </tr>
- <thead>
- <tbody>
- <%
- trans.sa_session.refresh( request )
- %>
- %for sample_index, sample in enumerate(current_samples):
- %if edit_mode == 'True':
- <tr>
- ${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
- </tr>
- %else:
- <tr>
- %if sample_index in range(len(request.samples)):
- ${render_sample( sample_index, sample['name'], sample['field_values'], fields_dict )}
- %else:
- ${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
- %endif
- </tr>
- %endif
- %endfor
- </tbody>
- </table>
- </div>
- </div>
-</%def>
-
-<div class="toolForm">
- ##<div class="toolFormTitle">Samples (${len(request.samples)})</div>
- <form id="show_request" name="show_request" action="${h.url_for( controller='requests_admin', action='show_request', edit_mode=edit_mode )}" enctype="multipart/form-data" method="post" >
- <div class="form-row">
- %if current_samples:
- ## first render the basic info grid
- ${render_basic_info_grid()}
- ## then render the other grid(s)
- <% trans.sa_session.refresh( request.type.sample_form ) %>
- %for grid_index, grid_name in enumerate(request.type.sample_form.layout):
- ${render_grid( grid_index, grid_name, request.type.sample_form.fields_of_grid( grid_index ) )}
- <br/>
- %endfor
- %else:
- <label>There are no samples.</label>
- %endif
- </div>
- %if request.samples and request.submitted():
- <script type="text/javascript">
- // Updater
- updater({${ ",".join( [ '"%s" : "%s"' % ( s.id, s.current_state().name ) for s in request.samples ] ) }});
- </script>
- %endif
-
- %if edit_mode == 'False':
- <table class="grid">
- <tbody>
- <tr>
- <div class="form-row">
-
- %if request.unsubmitted():
- <td>
- %if current_samples:
- <label>Copy </label>
- <input type="integer" name="num_sample_to_copy" value="1" size="3"/>
- <label>sample(s) from sample</label>
- ${sample_copy.get_html()}
- %endif
- <input type="submit" name="add_sample_button" value="Add New"/>
- </td>
- %endif
- <td>
- %if len(current_samples) and len(current_samples) <= len(request.samples):
- <input type="submit" name="edit_samples_button" value="Edit samples"/>
- %endif
- </td>
- </div>
- </tr>
- </tbody>
- </table>
- %endif
- %if request.samples or current_samples:
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- %if edit_mode == 'True':
- <div class="form-row">
- <input type="submit" name="save_samples_button" value="Save"/>
- <input type="submit" name="cancel_changes_button" value="Cancel"/>
- </div>
- %elif request.unsubmitted():
- <div class="form-row">
- <input type="submit" name="save_samples_button" value="Save"/>
- </div>
- %endif
-
- %endif
- <input type="hidden" name="request_id" value="${request.id}" />
- </form>
-</div>
-
-<br/>
-
-%if request.unsubmitted():
-<div class="toolForm">
- <form id="show_request" name="show_request" action="${h.url_for( controller='requests_admin', action='show_request', edit_mode=edit_mode )}" enctype="multipart/form-data" method="post" >
- <div class="form-row">
- <div class="msg_list">
- <h4 class="msg_head"><u>Import samples from csv file</u></h4>
- <div class="msg_body">
- <input type="file" name="file_data" />
- <input type="submit" name="import_samples_button" value="Import samples"/>
- <br/>
- <div class="toolParamHelp" style="clear: both;">
- The csv file must be in the following format:<br/>
- SampleName,DataLibrary,DataLibraryFolder,FieldValue1,FieldValue2...
- </div>
- </div>
- </div>
- </div>
- <input type="hidden" name="request_id" value="${request.id}" />
- </form>
-</div>
-%endif
-
--- a/templates/admin/samples/events.mako
+++ /dev/null
@@ -1,63 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%def name="title()">Events for Sample ${sample.name}</%def>
-
-<h2>Events for Sample "${sample.name}"</h2>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='show_request', id=trans.security.encode_id(sample.request.id) )}">
- <span>Browse this request</span></a>
- </li>
-</ul>
-<h3>User: ${sample.request.user.email}</h3>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Description</th>
- <th>Last Update</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, desc, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${desc}</a></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
-<div class="toolForm">
- <div class="toolFormTitle">Change current state</div>
- <div class="toolFormBody">
- <form name="event" action="${h.url_for( controller='requests_admin', action='save_state', new=True, sample_id=sample.id)}" method="post" >
- %for w in widgets:
- <div class="form-row">
- <label>
- ${w[0]}
- </label>
- ${w[1].get_html()}
- %if w[0] == 'Comments':
- <div class="toolParamHelp" style="clear: both;">
- Optional
- </div>
- %endif
- </div>
- %endfor
- <div class="form-row">
- <input type="submit" name="add_event_button" value="Save"/>
- </div>
- </form>
- </div>
-</div>
--- a/tool-data/shared/bx/bx_build_sites.txt
+++ /dev/null
@@ -1,1 +0,0 @@
-main http://main.genome-browser.bx.psu.edu/cgi-bin/hgTracks? hg18,hg19,mm8,mm9 bx-main
--- a/static/trackster.css
+++ /dev/null
@@ -1,132 +0,0 @@
-#content {
- width: 100%;
-}
-
-#center {
- overflow: auto;
-}
-
-#nav-container {
- position: fixed;
- left: 0;
- bottom: 0;
-}
-
-/*canvas{
- border-left: 1px solid green;
- border-right: 1px solid red; } /* debugging */
-#nav {
- padding: 0 0;
- color:#333;font-weight:bold;
-}
-
-#nav-controls {
- text-align: center;
- background:#cccccc;
- background-image:url(style/panel_header_bg.png);
- background-position:top center;
- background-repeat:repeat-x;
- padding-bottom: 5px;
-}
-
-#nav-controls a {
- padding: 5px 0.4em;
-}
-
-#overview {
- width: 100%;
- margin: 0px;
- color: white;
- margin-top: -6px;
- margin-bottom: -4px;
-}
-
-#overview-viewport {
- position: relative;
- height: 14px;
-/* border-top: solid #666 1px;*/
-/* border-bottom: solid #aaa 1px;*/
- background: white;
- border-top: solid gray 1px;
- border-bottom: solid gray 1px;
- margin: 5px 0;
-}
-#overview-box {
- position: absolute;
- margin-top: 0px;
- height: 14px;
- background: #ddd url(images/visualization/draggable_horizontal.png) center center no-repeat;
- /*border-style: outset;*/
-}
-
-#viewport {
-/* overflow-x: hidden;*/
- background-color: #fff;
-/* overflow: scroll;*/
-/* border-bottom: 2px solid black;*/
-}
-
-#viewport-canvas {
- width: 100%;
- height: 100px;
-}
-
-.yaxislabel {
- color: #777;
-}
-/* Line track needs borders to show range */
-.line-track .track-content {
- border-top: 1px solid #ddd;
- border-bottom: 1px solid #ddd;
-}
-
-.track {
- /* border-top: solid #DDDDDD 1px; */
- /* border-bottom: solid #DDDDDD 1px; */
- background: white;
-}
-
-.track-header {
- text-align: center;
- padding: 4px;
- color: #666;
-}
-
-.track-content {
- overflow: hidden;
- text-align: center;
-}
-
-.track.error {
- background-color: #ECB4AF;
-}
-.track.nodata {
- background-color: #ddd;
-}
-
-.loading {
- min-height: 100px;
-}
-
-.label-track {
- /* font-weight: bold; */
- /* font-size: 10px; */
-}
-.label-track .label {
- border-left: solid #999 1px;
- padding: 1px;
- display: inline-block;
-}
-.right-float {
- float: right;
- margin-left: 5px;
-}
-
-#top-labeltrack {
- border-bottom: solid #999 1px;
-}
-
-#nav-labeltrack {
- border-top: solid #999 1px;
- border-bottom: solid #999 1px;
-}
--- a/templates/requests/sample_state.mako
+++ /dev/null
@@ -1,5 +0,0 @@
-<%def name="render_sample_state( sample )">
- <a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
-</%def>
-
-${render_sample_state( sample )}
--- a/templates/admin/samples/bar_codes.mako
+++ /dev/null
@@ -1,46 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-
-<h2>Bar codes for Samples of Request "${request.name}"</h2>
-<h3>User: ${user.email}</h3>
-
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='show_request', id=trans.security.encode_id(request.id) )}">
- <span>Browse this request</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <form name="bar_codes" action="${h.url_for( controller='requests_admin', action='save_bar_codes', request_id=request.id)}" method="post" >
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- <th>Description</th>
- <th>Bar code</th>
- </tr>
- </thead>
- <tbody>
- %for index, sample in enumerate(samples_list):
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${sample.name}</a></b></td>
- <td><a>${sample.desc}</a></td>
- <td>
- ${widgets[index].get_html()}
- </td>
- </tr>
- %endfor
- </tbody>
- </table>
- <div class="form-row">
- <input type="submit" name="save_bar_codes" value="Save"/>
- </div>
- </form>
-</div>
--- a/lib/galaxy/web/base/controller.py
+++ b/lib/galaxy/web/base/controller.py
@@ -1251,7 +1251,9 @@ class Admin( object ):
# sort filter instead of this class's.
kwargs[ 'user_id' ] = kwargs[ 'id' ]
kwargs[ 'sort' ] = 'name'
- return self.browse_tools( trans, **kwargs )
+ return trans.response.send_redirect( web.url_for( controller='admin',
+ action='browse_tools',
+ **kwargs ) )
# Render the list view
return self.user_list_grid( trans, **kwargs )
@web.expose
--- a/templates/requests/edit_request.mako
+++ /dev/null
@@ -1,84 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#edit_request" ).submit();
- }
- });
-});
-</script>
-
-<br/>
-<br/>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <div class="toolFormTitle">Edit request "${request.name}"</div>
- %if len(select_request_type.options) == 1:
- There are no request types created for a new request.
- %else:
- <div class="toolFormBody">
- <form name="edit_request" id="edit_request" action="${h.url_for( controller='requests', action='edit', request_id=request.id)}" method="post" >
- <div class="form-row">
- <label>
- Select Request Type:
- </label>
- ${select_request_type.get_html()}
- </div>
-
- %if select_request_type.get_selected() != ('Select one', 'none'):
- %for i, field in enumerate(widgets):
- <div class="form-row">
- <label>${field['label']}</label>
- ${field['widget'].get_html()}
- %if field['label'] == 'Data library' and new_library:
- ${new_library.get_html()}
- %endif
- <div class="toolParamHelp" style="clear: both;">
- ${field['helptext']}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="save_changes_request_button" value="Save changes"/>
- ##<input type="submit" name="edit_samples_button" value="Edit samples"/>
- </div>
- %endif
- </form>
- </div>
-</div>
-%endif
--- a/templates/root/index.mako
+++ b/templates/root/index.mako
@@ -43,9 +43,9 @@
"Show structure": function() {
galaxy_main.location = "${h.url_for( controller='history', action='display_structured' )}";
},
- "Export to File": function() {
- galaxy_main.location = "${h.url_for( controller='history', action='export_archive' )}";
- },
+ ##"Export to File": function() {
+ ## galaxy_main.location = "${h.url_for( controller='history', action='export_archive' )}";
+ ##},
"Delete": function()
{
if ( confirm( "Really delete the current history?" ) )
@@ -53,10 +53,10 @@
galaxy_main.location = "${h.url_for( controller='history', action='delete_current' )}";
}
},
- "Other Actions": null,
- "Import from File": function() {
- galaxy_main.location = "${h.url_for( controller='history', action='import_archive' )}";
- }
+ ##"Other Actions": null,
+ ##"Import from File": function() {
+ ## galaxy_main.location = "${h.url_for( controller='history', action='import_archive' )}";
+ ##}
});
// Init tool options.
--- a/templates/requests/new_request.mako
+++ /dev/null
@@ -1,94 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#new_request" ).submit();
- }
- });
-});
-</script>
-
-<%def name="javascripts()">
- ${parent.javascripts()}
- ${h.js("jquery.autocomplete", "autocomplete_tagging" )}
-</%def>
-
-<%def name="stylesheets()">
- ${parent.stylesheets()}
- ${h.css( "autocomplete_tagging" )}
-</%def>
-
-<br/>
-<br/>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <div class="toolFormTitle">Add a new request</div>
- %if len(select_request_type.options) == 1:
- There are no request types created for a new request.
- %else:
- <div class="toolFormBody">
- <form name="new_request" id="new_request" action="${h.url_for( controller='requests', action='new', create=True )}" method="post" >
- <div class="form-row">
- <label>
- Select Request Type:
- </label>
- ${select_request_type.get_html()}
- </div>
-
- %if select_request_type.get_selected() != ('Select one', 'none'):
- %for i, field in enumerate(widgets):
- <div class="form-row">
- <label>${field['label']}</label>
- ${field['widget'].get_html()}
- ##%if field['label'] == 'Data library' and new_library:
- ## ${new_library.get_html()}
- ##%endif
- <div class="toolParamHelp" style="clear: both;">
- ${field['helptext']}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="create_request_button" value="Save"/>
- <input type="submit" name="create_request_samples_button" value="Add samples"/>
- </div>
- %endif
- </form>
- </div>
-</div>
-%endif
--- a/lib/galaxy/util/memory_usage.py
+++ /dev/null
@@ -1,44 +0,0 @@
-import os, platform, logging
-from galaxy.datatypes.data import nice_size
-
-log = logging.getLogger( __name__ )
-
-_proc_status = '/proc/%d/status' % os.getpid()
-
-_scale = { 'kB': 1024.0, 'mB': 1024.0*1024.0, 'KB': 1024.0, 'MB': 1024.0*1024.0 }
-
-def _VmB( VmKey ):
- '''Private.
- '''
- global _proc_status, _scale
- # get pseudo file /proc/<pid>/status
- try:
- t = open( _proc_status )
- v = t.read()
- t.close()
- except:
- log.debug("memory_usage is currently supported only on Linux, your platform is %s %s" % ( platform.system(), platform.release() ) )
- return 0.0 # non-Linux?
- # get VmKey line e.g. 'VmRSS: 9999 kB\n ...'
- i = v.index( VmKey )
- v = v[ i: ].split( None, 3 ) # whitespace
- if len( v ) < 3:
- return 0.0 # invalid format?
- # convert Vm value to bytes
- return float( v[ 1 ] ) * _scale[ v[ 2 ] ]
-def memory( since=0.0, pretty=False ):
- '''Return memory usage in bytes.
- '''
- size = _VmB( 'VmSize:' ) - since
- if pretty:
- return nice_size( size )
- else:
- return size
-def resident( since=0.0 ):
- '''Return resident memory usage in bytes.
- '''
- return _VmB( 'VmRSS:' ) - since
-def stacksize( since=0.0 ):
- '''Return stack size in bytes.
- '''
- return _VmB( 'VmStk:' ) - since
--- a/templates/sample/index.mako
+++ /dev/null
@@ -1,16 +0,0 @@
-<%inherit file="/webapps/galaxy/base_panels.mako"/>
-
-<%def name="init()">
-<%
- self.has_left_panel=False
- self.has_right_panel=False
- self.active_view="requests"
-
-%>
-</%def>
-
-<%def name="center_panel()">
-
- <iframe name="galaxy_main" id="galaxy_main" frameborder="0" style="position: absolute; width: 100%; height: 100%;" src="${h.url_for( controller="sample", action="list", request_id=request_id )}"></iframe>
-
-</%def>
--- a/templates/requests/show_request.mako
+++ /dev/null
@@ -1,430 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#show_request" ).submit();
- }
- });
-});
-</script>
-
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-</script>
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-
-}
-</style>
-
-%if request.rejected():
- ${render_msg( "Reason for rejection: "+request.last_comment(), "warning" )}
-%endif
-
-<div class="grid-header">
- <h2>Sequencing Request "${request.name}"</h2>
-</div>
-
-<ul class="manage-table-actions">
- %if request.unsubmitted() and request.samples:
- <li>
- <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests', action='list', operation='Submit', id=trans.security.encode_id(request.id) )}">
- <span>Submit request</span></a>
- </li>
- %endif
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list', operation='events', id=trans.security.encode_id(request.id) )}">
- <span>History</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-<%def name="show_basic_info_form( sample_index, sample, info )">
- <td>
- <input type="text" name=sample_${sample_index}_name value="${info['name']}" size="10"/>
- <div class="toolParamHelp" style="clear: both;">
- <i>${' (required)' }</i>
- </div>
- </td>
- %if sample:
- %if sample.request.unsubmitted():
- <td></td>
- %else:
- <td><input type="text" name=sample_${sample_index}_barcode value="${info['barcode']}" size="10"/></td>
- %endif
- %else:
- <td></td>
- %endif
- %if sample:
- %if not sample.current_state():
- <td>Unsubmitted</td>
- %else:
- <td><a href="${h.url_for( controller='requests_admin', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a></td>
- %endif
- %else:
- <td></td>
- %endif
- <td>${info['lib_widget'].get_html()}</td>
- <td>${info['folder_widget'].get_html()}</td>
- %if request.submitted() or request.complete():
- %if sample:
- <td><a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a></td>
- %else:
- <td><a href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">Add</a></td>
- %endif
- %endif
-</%def>
-
-## This function displays the "Basic Information" grid
-<%def name="render_basic_info_grid()">
- <h4>Sample Information</h4>
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- <th>Barcode</th>
- <th>State</th>
- <th>Data Library</th>
- <th>Folder</th>
- %if request.submitted() or request.complete():
- <th>Dataset(s) Transferred</th>
- %endif
- <th></th>
- </tr>
- <thead>
- <tbody>
- <%
- trans.sa_session.refresh( request )
- %>
- %for sample_index, info in enumerate(current_samples):
- <%
- if sample_index in range(len(request.samples)):
- sample = request.samples[sample_index]
- else:
- sample = None
- %>
- %if edit_mode == 'True':
- <tr>
- ${show_basic_info_form( sample_index, sample, info )}
- </tr>
- %else:
- <tr>
- %if sample_index in range(len(request.samples)):
- <td>${info['name']}</td>
- <td>${info['barcode']}</td>
- <td>
- %if sample.current_state():
- <a href="${h.url_for( controller='requests', action='show_events', sample_id=sample.id)}">${sample.current_state().name}</a>
- %else:
- Unsubmitted
- %endif
- </td>
- %if info['library']:
- <td><a href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( info['library'].id ) )}">${info['library'].name}</a></td>
- %else:
- <td></td>
- %endif
- %if info['folder']:
- <td>${info['folder'].name}</td>
- %else:
- <td></td>
- %endif
- %if request.submitted() or request.complete():
- <td>
- <a href="${h.url_for( controller='requests', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">${len(sample.dataset_files)}</a>
- </td>
- %endif
-
-
- %else:
- ${show_basic_info_form( sample_index, sample, info )}
- %endif
- %if request.unsubmitted() or request.rejected():
- <td>
- %if sample:
- %if sample.request.unsubmitted():
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='delete_sample', request_id=request.id, sample_id=sample_index )}">
- <img src="${h.url_for('/static/images/delete_icon.png')}" />
- <span></span></a>
- %endif
- %endif
- </td>
- %endif
- </tr>
- %endif
- %endfor
- </tbody>
- </table>
-</%def>
-
-<%def name="render_sample_form( index, sample_name, sample_values, fields_dict )">
- <td>
- ${sample_name}
- </td>
- %for field_index, field in fields_dict.items():
- <td>
- %if field['type'] == 'TextField':
- <input type="text" name="sample_${index}_field_${field_index}" value="${sample_values[field_index]}" size="7"/>
- %elif field['type'] == 'SelectField':
- <select name="sample_${index}_field_${field_index}" last_selected_value="2">
- %for option_index, option in enumerate(field['selectlist']):
- %if option == sample_values[field_index]:
- <option value="${option}" selected>${option}</option>
- %else:
- <option value="${option}">${option}</option>
- %endif
- %endfor
- </select>
- %elif field['type'] == 'WorkflowField':
- <select name="sample_${index}_field_${field_index}">
- %if str(sample_values[field_index]) == 'none':
- <option value="none" selected>Select one</option>
- %else:
- <option value="none">Select one</option>
- %endif
- %for option_index, option in enumerate(request.user.stored_workflows):
- %if not option.deleted:
- %if str(option.id) == str(sample_values[field_index]):
- <option value="${option.id}" selected>${option.name}</option>
- %else:
- <option value="${option.id}">${option.name}</option>
- %endif
- %endif
- %endfor
- </select>
- %elif field['type'] == 'CheckboxField':
- <input type="checkbox" name="sample_${index}_field_${field_index}" value="Yes"/>
- %endif
- <div class="toolParamHelp" style="clear: both;">
- <i>${'('+field['required']+')' }</i>
- </div>
- </td>
- %endfor
-</%def>
-
-<%def name="render_sample( index, sample_name, sample_values, fields_dict )">
- <td>
- ${sample_name}
- </td>
- %for field_index, field in fields_dict.items():
- <td>
- %if sample_values[field_index]:
- %if field['type'] == 'WorkflowField':
- %if str(sample_values[field_index]) != 'none':
- <% workflow = trans.sa_session.query( trans.app.model.StoredWorkflow ).get( int(sample_values[field_index]) ) %>
- <a href="${h.url_for( controller='workflow', action='run', id=trans.security.encode_id(workflow.id) )}">${workflow.name}</a>
- %endif
- %else:
- ${sample_values[field_index]}
- %endif
- %else:
- <i>None</i>
- %endif
-
- </td>
- %endfor
-</%def>
-
-<%def name="render_grid( grid_index, grid_name, fields_dict )">
- <br/>
- <div class="msg_list">
- %if grid_name:
- <h4 class="msg_head"><u>${grid_name}</u></h4>
- %else:
- <h4>Grid ${grid_index}</h4>
- %endif
- %if edit_mode == 'False' or len(current_samples) <= len(request.samples):
- <div class="msg_body">
- %else:
- <div class="msg_body2">
- %endif
- <table class="grid">
- <thead>
- <tr>
- <th>Name</th>
- %for index, field in fields_dict.items():
- <th>
- ${field['label']}
- <div class="toolParamHelp" style="clear: both;">
- <i>${field['helptext']}</i>
- </div>
- </th>
- %endfor
- <th></th>
- </tr>
- <thead>
- <tbody>
- <%
- trans.sa_session.refresh( request )
- %>
- %for sample_index, sample in enumerate(current_samples):
- %if edit_mode == 'True':
- <tr>
- ${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
- </tr>
- %else:
- <tr>
- %if sample_index in range(len(request.samples)):
- ${render_sample( sample_index, sample['name'], sample['field_values'], fields_dict )}
- %else:
- ${render_sample_form( sample_index, sample['name'], sample['field_values'], fields_dict)}
- %endif
- </tr>
- %endif
- %endfor
- </tbody>
- </table>
- </div>
- </div>
-</%def>
-
-<div class="toolForm">
- <form id="request_details" name="request_details" >
- <div class="form-row">
- <div class="msg_list">
- <h4 class="msg_head"><u>Request Information</u></h4>
- <div class="msg_body">
- %for index, rd in enumerate(request_details):
- <div class="form-row">
- <label>${rd['label']}</label>
- %if not rd['value']:
- <i>None</i>
- %else:
- %if rd['label'] == 'State':
- <a href="${h.url_for( controller='requests_admin', action='list', operation='events', id=trans.security.encode_id(request.id) )}">${rd['value']}</a>
- %else:
- ${rd['value']}
- %endif
- %endif
- </div>
- <div style="clear: both"></div>
- %endfor
- <div class="form-row">
- <ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='Edit', id=trans.security.encode_id(request.id))}">
- <span>Edit request details</span></a>
- </li>
- </ul>
- </div>
- </div>
- </div>
- </div>
- </form>
- <form id="show_request" name="show_request" action="${h.url_for( controller='requests', action='show_request', edit_mode=edit_mode )}" enctype="multipart/form-data" method="post" >
- <div class="form-row">
- %if current_samples:
- ## first render the basic info grid
- ${render_basic_info_grid()}
- ## then render the other grid(s)
- <% trans.sa_session.refresh( request.type.sample_form ) %>
- %for grid_index, grid_name in enumerate(request.type.sample_form.layout):
- ${render_grid( grid_index, grid_name, request.type.sample_form.fields_of_grid( grid_index ) )}
- <br/>
- %endfor
- %else:
- <label>There are no samples.</label>
- %endif
- </div>
- %if request.unsubmitted() and edit_mode == 'False':
- <table class="grid">
- <tbody>
- <tr>
- <div class="form-row">
- <td>
- %if current_samples:
- <label>Copy </label>
- <input type="integer" name="num_sample_to_copy" value="1" size="3"/>
- <label>sample(s) from sample</label>
- ${sample_copy.get_html()}
- %endif
- <input type="submit" name="add_sample_button" value="Add New"/>
- </td>
- <td>
- %if len(current_samples) and len(current_samples) <= len(request.samples):
- <input type="submit" name="edit_samples_button" value="Edit samples"/>
- %endif
- </td>
- </div>
- </tr>
- </tbody>
- </table>
- %endif
- %if request.unsubmitted() and (request.samples or current_samples):
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="save_samples_button" value="Save"/>
- %if edit_mode == 'True':
- <input type="submit" name="cancel_changes_button" value="Cancel"/>
- %endif
- </div>
- %endif
- <input type="hidden" name="request_id" value="${request.id}" />
- </form>
-</div>
-
-
-<br/>
-%if request.unsubmitted():
-<div class="toolForm">
- <form id="show_request" name="show_request" action="${h.url_for( controller='requests', action='show_request', edit_mode=edit_mode )}" enctype="multipart/form-data" method="post" >
- <div class="form-row">
- <div class="msg_list">
- <h4 class="msg_head"><u>Import samples from csv file</u></h4>
- <div class="msg_body">
- <input type="file" name="file_data" />
- <input type="submit" name="import_samples_button" value="Import samples"/>
- <br/>
- <div class="toolParamHelp" style="clear: both;">
- The csv file must be in the following format:<br/>
- SampleName,DataLibrary,DataLibraryFolder,FieldValue1,FieldValue2...
- </div>
- </div>
- </div>
- </div>
- <input type="hidden" name="request_id" value="${request.id}" />
- </form>
-</div>
-%endif
--- a/templates/admin/requests/get_data.mako
+++ /dev/null
@@ -1,227 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-
-
-
-
-</script>
-
-<script type="text/javascript">
- function display_file_details(sample_id, folder_path)
- {
- var w = document.get_data.files_list.selectedIndex;
- var selected_value = document.get_data.files_list.options[w].value;
- var cell = $("#file_details");
- if(selected_value.charAt(selected_value.length-1) != '/')
- {
- // Make ajax call
- $.ajax( {
- type: "POST",
- url: "${h.url_for( controller='requests_admin', action='get_file_details' )}",
- dataType: "json",
- data: { id: sample_id, folder_path: document.get_data.folder_path.value+selected_value },
- success : function ( data ) {
- cell.html( '<label>'+data+'</label>' )
- }
- });
- }
- else
- {
- cell.html( '' )
- }
-
-
- }
-</script>
-
-<script type="text/javascript">
- function open_folder1(sample_id, folder_path)
- {
- var w = document.get_data.files_list.selectedIndex;
- var selected_value = document.get_data.files_list.options[w].value;
- var cell = $("#file_details");
- if(selected_value.charAt(selected_value.length-1) == '/')
- {
- document.get_data.folder_path.value = document.get_data.folder_path.value+selected_value
- // Make ajax call
- $.ajax( {
- type: "POST",
- url: "${h.url_for( controller='requests_admin', action='open_folder' )}",
- dataType: "json",
- data: { id: sample_id, folder_path: document.get_data.folder_path.value },
- success : function ( data ) {
- document.get_data.files_list.options.length = 0
- for(i=0; i<data.length; i++)
- {
- var newOpt = new Option(data[i], data[i]);
- document.get_data.files_list.options[i] = newOpt;
- }
- //cell.html( '<label>'+data+'</label>' )
-
- }
- });
- }
- else
- {
- cell.html( '' )
- }
- }
-</script>
-
-
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-
-}
-</style>
-
-
-<h2>Data transfer from Sequencer</h2>
-<h3>Sample "${sample.name}" of Request "${sample.request.name}"</h3>
-<br/>
-<br/>
-
-<ul class="manage-table-actions">
- %if sample.request.submitted() and sample.inprogress_dataset_files():
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">
- <span>Refresh this page</span></a>
- </li>
- %endif
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_request_types', operation='view', id=trans.security.encode_id(sample.request.type.id) )}">
- <span>Sequencer information</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller='library_admin', id=trans.security.encode_id( sample.library.id ) )}">
- <span>${sample.library.name} Data Library</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='show_request', id=trans.security.encode_id(sample.request.id) )}">
- <span>Browse this request</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- %if len(dataset_files):
-## <form name="get_data" action="${h.url_for( controller='requests_admin', action='get_data', sample_id=sample.id)}" method="post" >
- <div class="form-row">
- <h4>Sample Dataset(s)</h4>
- %if sample.untransferred_dataset_files():
- <div class="form-row">
- <ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', start_transfer_button=True, sample_id=sample.id )}">
- <span>Start transfer</span></a>
- </li>
- </ul>
- </div>
- %endif
- <div class="form-row">
- <table class="grid">
- <thead>
- <tr>
- <th>Dataset File</th>
- <th>Transfer Status</th>
- <th></th>
- </tr>
- <thead>
- <tbody>
- %for dataset_index, dataset_file in enumerate(dataset_files):
- ${sample_dataset_files( dataset_index, dataset_file['name'], dataset_file['status'] )}
- %endfor
- </tbody>
- </table>
- </div>
- </div>
-
-## </form>
-##</div>
-
-
-<br/>
-<br/>
-%endif
-
-##<div class="toolForm">
- <form name="get_data" id="get_data" action="${h.url_for( controller='requests_admin', action='get_data', sample_id=sample.id)}" method="post" >
- <div class="form-row">
- ##<div class="toolFormTitle">Select files for transfer</div>
- <h4>Select files for transfer</h4>
- <div style="width: 60%;">
- <div class="form-row">
- <label>Folder path on the sequencer:</label>
- <input type="text" name="folder_path" value="${folder_path}" size="100"/>
- <input type="submit" name="browse_button" value="List contents"/>
- ##<input type="submit" name="open_folder" value="Open folder"/>
- <input type="submit" name="folder_up" value="Up"/>
- </div>
- <div class="form-row">
- <select name="files_list" id="files_list" style="max-width: 98%; width: 98%; height: 150px; font-size: 100%;" ondblclick="open_folder1(${sample.id}, '${folder_path}')" onChange="display_file_details(${sample.id}, '${folder_path}')" multiple>
- %for index, f in enumerate(files):
- <option value="${f}">${f}</option>
- %endfor
- </select>
- <br/>
- <div id="file_details" class="toolParamHelp" style="clear: both;">
-
- </div>
- </div>
- <div class="form-row">
- <div class="toolParamHelp" style="clear: both;">
- After selecting dataset(s), be sure to click on the <b>Start transfer</b> button.
- Once the transfer is complete the dataset(s) will show up on this page.
- </div>
- <input type="submit" name="select_files_button" value="Select"/>
- </div>
- </div>
- </div>
- </form>
-</div>
-
-<%def name="sample_dataset_files( dataset_index, dataset_name, status )">
- <tr>
- <td>
- <label class="msg_head"><a href="${h.url_for( controller='requests_admin', action='dataset_details', sample_id=trans.security.encode_id(sample.id), dataset_index=dataset_index )}">${dataset_name}</a></label>
-## <div class="msg_head"><u>${dataset_file.split('/')[-1]}</u></div>
-## <div class="msg_body">
-## ${dataset_file}
-## </div>
- </td>
- <td>
- %if status not in [sample.transfer_status.NOT_STARTED, sample.transfer_status.COMPLETE]:
- <i>${status}</i>
- %else:
- ${status}
- %endif
- </td>
- ##<td></td>
- %if status == sample.transfer_status.NOT_STARTED:
- <td>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='get_data', sample_id=sample.id, remove_dataset_button=True, dataset_index=dataset_index )}">
- <img src="${h.url_for('/static/images/delete_icon.png')}" />
- <span></span></a>
- </td>
- %else:
- <td></td>
- %endif
- </tr>
-</%def>
--- a/templates/admin/requests/add_states.mako
+++ /dev/null
@@ -1,26 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <div class="toolFormTitle">Create ${num_states} states for the '${request_type_name}' request type</div>
- <form name="new_form_fields" action="${h.url_for( controller='requests_admin', action='request_type', name=request_type_name, description=desc, num_states=num_states, request_form_id=request_form_id, sample_form_id=sample_form_id)}" method="post" >
- <div class="toolFormBody">
- %for element_count in range( num_states ):
- <div class="form-row">
- <label>${1+element_count}) State name:</label>
- <input type="text" name="state_name_${element_count}" value="" size="40"/>
- <label>State help text (optional):</label>
- <input type="text" name="state_desc_${element_count}" value="" size="40"/>
- </div>
- <div style="clear: both"></div>
- %endfor
- </div>
- <div class="form-row">
- <input type="submit" name="save_request_type" value="Save"/>
- </div>
- </form>
-</div>
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -115,6 +115,7 @@ class Job( object ):
self.job_runner_name = None
self.job_runner_external_id = None
self.post_job_actions = None
+ self.imported = False
def add_parameter( self, name, value ):
self.parameters.append( JobParameter( name, value ) )
@@ -964,16 +965,16 @@ class LibraryFolder( object ):
intermed.sort()
return map( operator.getitem, intermed, ( -1, ) * len( intermed ) )
# This needs to be a list
- active_library_datasets = [ ld for ld in self.datasets if not ld.library_dataset_dataset_association.deleted ]
+ active_library_datasets = [ ld for ld in self.datasets if ld.library_dataset_dataset_association and not ld.library_dataset_dataset_association.deleted ]
return sort_by_attr( [ ld for ld in active_library_datasets ], 'name' )
@property
def activatable_library_datasets( self ):
# This needs to be a list
- return [ ld for ld in self.datasets if not ld.library_dataset_dataset_association.dataset.deleted ]
+ return [ ld for ld in self.datasets if ld.library_dataset_dataset_association and not ld.library_dataset_dataset_association.dataset.deleted ]
@property
def active_datasets( self ):
# This needs to be a list
- return [ ld.library_dataset_dataset_association.dataset for ld in self.datasets if not ld.library_dataset_dataset_association.deleted ]
+ return [ ld.library_dataset_dataset_association.dataset for ld in self.datasets if ld.library_dataset_dataset_association and not ld.library_dataset_dataset_association.deleted ]
def get_display_name( self ):
# Library folder name can be either a string or a unicode object. If string,
# convert to unicode object assuming 'utf-8' format.
@@ -1558,6 +1559,7 @@ class RequestEvent( object ):
class RequestType( object ):
rename_dataset_options = Bunch( NO = 'Do not rename',
SAMPLE_NAME = 'Preprend sample name',
+ EXPERIMENT_NAME = 'Prepend experiment name',
EXPERIMENT_AND_SAMPLE_NAME = 'Prepend experiment and sample name')
permitted_actions = get_permitted_actions( filter='REQUEST_TYPE' )
def __init__(self, name=None, desc=None, request_form=None, sample_form=None,
--- a/templates/admin/requests/edit_request.mako
+++ /dev/null
@@ -1,88 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#edit_request" ).submit();
- }
- });
-});
-</script>
-
-<br/>
-<br/>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='show_request', id=trans.security.encode_id(request.id) )}">
- <span>Browse this request</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <div class="toolFormTitle">Edit request "${request.name}" from ${request.user.email}</div>
- %if len(select_request_type.options) == 1:
- There are no request types created for a new request.
- %else:
- <div class="toolFormBody">
- <form name="edit_request" id="edit_request" action="${h.url_for( controller='requests_admin', action='edit', request_id=request.id)}" method="post" >
- <div class="form-row">
- <label>
- Select Request Type:
- </label>
- ${select_request_type.get_html()}
- </div>
-
- %if select_request_type.get_selected() != ('Select one', 'none'):
- %for i, field in enumerate(widgets):
- <div class="form-row">
- <label>${field['label']}</label>
- ${field['widget'].get_html()}
- %if field['label'] == 'Library' and new_library:
- ${new_library.get_html()}
- %endif
- <div class="toolParamHelp" style="clear: both;">
- ${field['helptext']}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="save_changes_request_button" value="Save changes"/>
- ##<input type="submit" name="edit_samples_button" value="Edit samples"/>
- </div>
- %endif
- </form>
- </div>
-</div>
-%endif
--- a/static/about.html
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<meta name="generator" content="Docutils 0.3.9: http://docutils.sourceforge.net/" />
-<title>ABOUT GALAXY</title>
-<link rel="stylesheet" href="/static/style/base.css" type="text/css" />
-<link rel="stylesheet" href="/static/style/help.css" type="text/css" />
-</head>
-<body>
-<div class="document" id="about-galaxy">
-<h1 class="title">ABOUT GALAXY</h1>
-<div class="section" id="people">
-<h2><a name="people">People:</a></h2>
-<ul class="simple">
-<li>Istvan Albert - <em>Co-PI</em></li>
-<li>Daniel Blankenberg - <em>Graduate student</em></li>
-<li>Richard Burhans - <em>Sysadmin</em></li>
-<li>Laura Elnitski - <em>Co-PI</em></li>
-<li>Belinda Giardine - <em>Programmer</em></li>
-<li>Ross Hardison - <em>Co-PI</em></li>
-<li>Jim Kent - <em>Co-PI</em></li>
-<li>David King - <em>Graduate student</em></li>
-<li>Webb Miller - <em>Co-PI</em></li>
-<li>Anton Nekrutenko - <em>PI</em></li>
-<li>Cathy Riemer - <em>Programmer</em></li>
-<li>Prachi Shah - <em>Programmer</em></li>
-<li>Ian Schenck - <em>Undergraduate student</em></li>
-<li>James Taylor - <em>Graduate student</em></li>
-<li>Yi Zhang - <em>Programmer</em></li>
-</ul>
-</div>
-<hr class="docutils" />
-<div class="section" id="development">
-<h2><a name="development">Development:</a></h2>
-<p><strong>Galaxy core</strong> - <em>Istvan Albert</em> and <em>James Taylor</em></p>
-<p><strong>Interface</strong> - <em>James Taylor</em>, <em>Istvan Albert</em>, <em>Anton Nekrutenko</em></p>
-<p><strong>Tools</strong> -</p>
-<ul class="simple">
-<li>Data sources - <em>Istvan Albert</em></li>
-<li>EMBOSS, Phylip, mafs - <em>Daniel Blankenberg</em></li>
-<li>Text Tools, Sequence Extractors - <em>Richard Burhans</em>, <em>Anton Nekrutenko</em>, <em>Ian Schenck</em></li>
-<li>Operations - <em>James Taylor</em>, <em>Yi Zhang</em></li>
-<li>Statistics, Graphs - <em>Istvan Albert</em>, <em>David King</em></li>
-</ul>
-<p><strong>Project management</strong> - <em>Anton Nekrutenko</em></p>
-<p>Current version of Galaxy uses many ideas developed by <em>Laura Elnitski</em>, <em>Belinda Giardine</em>, and <em>Cathy Riemer</em> in Galaxy1 and GALA.</p>
-</div>
-<hr class="docutils" />
-<div class="section" id="special-thanks-to">
-<h2><a name="special-thanks-to">Special thanks to:</a></h2>
-<ul class="simple">
-<li>David Haussler</li>
-<li>Ewan Birney</li>
-<li>Hiram Clawson</li>
-<li>Angie Hinrichs</li>
-<li>Darin London</li>
-<li>Members of Hardison, Makova, Miller, and Nekrutenko Labs</li>
-</ul>
-</div>
-<hr class="docutils" />
-<div class="section" id="technology">
-<h2><a name="technology">Technology:</a></h2>
-<p>Galaxy core is written entirely in Python. It uses the following open source technologies:</p>
-<ul class="simple">
-<li>web-server <a class="reference" href="http://www.cherrypy.org/">CherryPy</a></li>
-<li>database <a class="reference" href="http://www.sleepycat.com/products/db.shtml">BerkelyDB</a></li>
-<li>XML library <a class="reference" href="http://effbot.org/zone/element-index.htm">ElementTree</a></li>
-<li>HTML templating library <a class="reference" href="http://www.cheetahtemplate.org/">Cheetah</a></li>
-</ul>
-<p>Galaxy API generated from source code can be found <a class="reference" href="http://www.bx.psu.edu/trac/local/docs/index.html">here</a></p>
-<hr class="docutils" />
-<p><a class="reference" href="http://www.bx.psu.edu">The Center for Comparative Genomics and Bioinformatics</a> at <a class="reference" href="http://www.psu.edu">Penn State</a> | 2005</p>
-</div>
-</div>
-</body>
-</html>
--- a/templates/requests/sample_datasets.mako
+++ /dev/null
@@ -1,7 +0,0 @@
-<%def name="render_sample_datasets( sample )">
- <a href="${h.url_for(controller='requests_admin', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id))}">${sample.transferred_dataset_files()}/${len(sample.dataset_files)}</a>
-</%def>
-
-
-
-${render_sample_datasets( sample )}
--- a/static/about.rst
+++ /dev/null
@@ -1,82 +0,0 @@
-ABOUT GALAXY
-============
-
-People:
--------
-
-* Istvan Albert - *Co-PI*
-* Daniel Blankenberg - *Graduate student*
-* Richard Burhans - *Sysadmin*
-* Laura Elnitski - *Co-PI*
-* Belinda Giardine - *Programmer*
-* Ross Hardison - *Co-PI*
-* Jim Kent - *Co-PI*
-* David King - *Graduate student*
-* Webb Miller - *Co-PI*
-* Anton Nekrutenko - *PI*
-* Cathy Riemer - *Programmer*
-* Prachi Shah - *Programmer*
-* Ian Schenck - *Undergraduate student*
-* James Taylor - *Graduate student*
-* Yi Zhang - *Programmer*
-
------
-
-Development:
-------------
-
-**Galaxy core** - *Istvan Albert* and *James Taylor*
-
-**Interface** - *James Taylor*, *Istvan Albert*, *Anton Nekrutenko*
-
-**Tools** -
-
-* Data sources - *Istvan Albert*
-* EMBOSS, Phylip, mafs - *Daniel Blankenberg*
-* Text Tools, Sequence Extractors - *Richard Burhans*, *Anton Nekrutenko*, *Ian Schenck*
-* Operations - *James Taylor*, *Yi Zhang*
-* Statistics, Graphs - *Istvan Albert*, *David King*
-
-**Project management** - *Anton Nekrutenko*
-
-Current version of Galaxy uses many ideas developed by *Laura Elnitski*, *Belinda Giardine*, and *Cathy Riemer* in Galaxy1 and GALA.
-
------
-
-Special thanks to:
-------------------
-
-* David Haussler
-* Ewan Birney
-* Hiram Clawson
-* Angie Hinrichs
-* Darin London
-* Members of Hardison, Makova, Miller, and Nekrutenko Labs
-
------
-
-Technology:
------------
-
-Galaxy core is written entirely in Python. It uses the following open source technologies:
-
-* web-server `CherryPy`__
-* database `BerkelyDB`__
-* XML library `ElementTree`__
-* HTML templating library `Cheetah`__
-
-Galaxy API generated from source code can be found `here`__
-
-.. __: http://www.cherrypy.org/
-.. __: http://www.sleepycat.com/products/db.shtml
-.. __: http://effbot.org/zone/element-index.htm
-.. __: http://www.cheetahtemplate.org/
-.. __: http://www.bx.psu.edu/trac/local/docs/index.html
-
------
-
-`The Center for Comparative Genomics and Bioinformatics`__ at `Penn State`__ | 2005
-
-.. __: http://www.bx.psu.edu
-.. __: http://www.psu.edu
-
--- a/templates/admin/requests/new_request.mako
+++ /dev/null
@@ -1,94 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$( function() {
- $( "select[refresh_on_change='true']").change( function() {
- var refresh = false;
- var refresh_on_change_values = $( this )[0].attributes.getNamedItem( 'refresh_on_change_values' )
- if ( refresh_on_change_values ) {
- refresh_on_change_values = refresh_on_change_values.value.split( ',' );
- var last_selected_value = $( this )[0].attributes.getNamedItem( 'last_selected_value' );
- for( i= 0; i < refresh_on_change_values.length; i++ ) {
- if ( $( this )[0].value == refresh_on_change_values[i] || ( last_selected_value && last_selected_value.value == refresh_on_change_values[i] ) ){
- refresh = true;
- break;
- }
- }
- }
- else {
- refresh = true;
- }
- if ( refresh ){
- $( "#new_request" ).submit();
- }
- });
-});
-</script>
-
-<%def name="javascripts()">
- ${parent.javascripts()}
- ${h.js("jquery.autocomplete", "autocomplete_tagging" )}
-</%def>
-
-<%def name="stylesheets()">
- ${parent.stylesheets()}
- ${h.css( "autocomplete_tagging" )}
-</%def>
-
-<br/>
-<br/>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <div class="toolFormTitle">Add a new request</div>
- %if len(select_request_type.options) == 1:
- There are no request types created for a new request.
- %else:
- <div class="toolFormBody">
- <form name="new_request" id="new_request" action="${h.url_for( controller='requests_admin', action='new', create=True )}" method="post" >
- <div class="form-row">
- <label>
- Select Request Type
- </label>
- ${select_request_type.get_html()}
- </div>
-
- %if select_request_type.get_selected() != ('Select one', 'none'):
- %for i, field in enumerate(widgets):
- <div class="form-row">
- <label>${field['label']}</label>
- ${field['widget'].get_html()}
- %if field['label'] == 'Library' and new_library:
- ${new_library.get_html()}
- %endif
- <div class="toolParamHelp" style="clear: both;">
- ${field['helptext']}
- </div>
- <div style="clear: both"></div>
- </div>
- %endfor
- <div class="form-row">
- <div style="float: left; width: 250px; margin-right: 10px;">
- <input type="hidden" name="refresh" value="true" size="40"/>
- </div>
- <div style="clear: both"></div>
- </div>
- <div class="form-row">
- <input type="submit" name="create_request_button" value="Save"/>
- <input type="submit" name="create_request_samples_button" value="Add samples"/>
- </div>
- %endif
- </form>
- </div>
-</div>
-%endif
--- a/templates/sample/sample_events.mako
+++ /dev/null
@@ -1,45 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%def name="title()">Events for Sample ${sample_name}</%def>
-
-
-<h2>Events for Sample "${sample_name}"</h2>
-
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list', operation='show_request', id=trans.security.encode_id(request.id) )}">
- <span>Browse this request</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list')}">
- <span>Browse requests</span></a>
- </li>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Description</th>
- <th>Updated</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, desc, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${desc}</a></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
Binary file test-data/1.scf.zip has changed
--- a/templates/requests/show_data.mako
+++ /dev/null
@@ -1,86 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<script type="text/javascript">
-$(document).ready(function(){
- //hide the all of the element with class msg_body
- $(".msg_body").hide();
- //toggle the componenet with class msg_body
- $(".msg_head").click(function(){
- $(this).next(".msg_body").slideToggle(450);
- });
-});
-</script>
-<style type="text/css">
-.msg_head {
- padding: 0px 0px;
- cursor: pointer;
-}
-
-}
-</style>
-
-
-<h2>Data transfer from Sequencer</h2>
-<h3>Sample "${sample.name}" of Request "${sample.request.name}"</h3>
-
-<ul class="manage-table-actions">
- %if sample.request.submitted() and sample.inprogress_dataset_files():
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='show_datatx_page', sample_id=trans.security.encode_id(sample.id) )}">
- <span>Refresh this page</span></a>
- </li>
- %endif
- %if sample.library:
- <li>
- <a class="action-button" href="${h.url_for( controller='library_common', action='browse_library', cntrller='library', id=trans.security.encode_id( sample.library.id ) )}">
- <span>${sample.library.name} Data Library</span></a>
- </li>
- %endif
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list', operation='show_request', id=trans.security.encode_id(sample.request.id) )}">
- <span>Browse this request</span></a>
- </li>
-</ul>
-
-<div class="toolForm">
- <form name="get_data" action="${h.url_for( controller='requests_admin', action='get_data', sample_id=sample.id)}" method="post" >
- <div class="form-row">
- %if len(dataset_files):
- <table class="grid">
- <thead>
- <tr>
- <th>Dataset File</th>
- <th>Transfer Status</th>
- </tr>
- <thead>
- <tbody>
- %for dataset_index, dataset_file in enumerate(dataset_files):
- ${sample_dataset_files( dataset_index, dataset_file[0], dataset_file[1] )}
- %endfor
- </tbody>
- </table>
- %else:
- There are no dataset files.
- %endif
- </div>
- </form>
-</div>
-
-<%def name="sample_dataset_files( dataset_index, dataset_file, status )">
- <tr>
- <td>${dataset_file.split('/')[-1]}</td>
- <td>
- %if status == sample.transfer_status.IN_PROGRESS:
- <i>${status}</i>
- %else:
- ${status}
- %endif
- </td>
- </tr>
-</%def>
--- a/templates/requests/events.mako
+++ /dev/null
@@ -1,39 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<h2>History of Sequencing Request "${request.name}"</h2>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list', operation='show_request', id=trans.security.encode_id(request.id) )}">
- <span>Browse this request</span></a>
- </li>
- <li>
- <a class="action-button" href="${h.url_for( controller='requests', action='list')}">
- <span>Browse all requests</span></a>
- </li>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Last Update</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
--- a/templates/admin/requests/events.mako
+++ /dev/null
@@ -1,36 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<h2>History of Sequencing Request "${request.name}"</h2>
-<ul class="manage-table-actions">
- <li>
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='list', operation='show_request', id=trans.security.encode_id(request.id) )}">
- <span>Browse this request</span></a>
- </li>
-</ul>
-<h3>User: ${request.user.email}</h3>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<div class="toolForm">
- <table class="grid">
- <thead>
- <tr>
- <th>State</th>
- <th>Last Update</th>
- <th>Comments</th>
- </tr>
- </thead>
- <tbody>
- %for state, updated, comments in events_list:
- <tr class="libraryRow libraryOrFolderRow" id="libraryRow">
- <td><b><a>${state}</a></b></td>
- <td><a>${updated}</a></td>
- <td><a>${comments}</a></td>
- </tr>
- %endfor
- </tbody>
- </table>
-</div>
1
0
galaxy-dist commit e683c6995fb5: Pack scripts and update JS version.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278947449 14400
# Node ID e683c6995fb5d032660d1c28cff2e1bc578d1298
# Parent 399d6d2b7eee9a4e6e9670c44ca3b3a2848ea7a4
Pack scripts and update JS version.
--- a/lib/galaxy/web/framework/helpers/__init__.py
+++ b/lib/galaxy/web/framework/helpers/__init__.py
@@ -44,7 +44,7 @@ def js( *args ):
TODO: This has a hardcoded "?v=X" to defeat caching. This should be done
in a better way.
"""
- return "\n".join( [ javascript_include_tag( "/static/scripts/" + name + ".js?v=5" ) for name in args ] )
+ return "\n".join( [ javascript_include_tag( "/static/scripts/" + name + ".js?v=6" ) for name in args ] )
# Hashes
--- a/static/scripts/packed/trackster.js
+++ b/static/scripts/packed/trackster.js
@@ -1,1 +1,1 @@
-var DENSITY=200,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/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="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.p
rototype,{init:function(){var c=this.container,a=this;this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.content_div);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.viewport=$("<div/>").addClass("viewport").appendTo(this.viewport_container);this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form
=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);this.low_input=$("<input/>").addClass("low").css("width","10em").appendTo(this.chrom_form);$("<span/>").text(" - ").appendTo(this.chrom_form);this.high_input=$("<input/>").addClass("high").css("width","10em").appendTo(this.chrom_form);this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="/images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="/images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);var b=(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey});$.ajax({url:chrom_url,data:b,dataType:
"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.chrom_select.bind("change",function(){a.chrom=a.chrom_select.val();var h=$.grep(a.chrom_data,function(k,l){return k.chrom===a.chrom})[0];a.max_high=h.len;a.reset();a.redraw(true);for(var j in a.tracks){var g=a.tracks[j];if(g.init){g.init()}}a.redraw()})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("mousewheel",function(d,f){if(Math.abs(f)<0.5){return}if(f>0){a.zoom_in(d.pageX,this.viewport_container)}else{a.zoom_out()}d.preventDefault()});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-this
.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.high-a.low));a.move_delta(-2*f)});this.viewport_container.bind("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX}).bind("drag",function(g){var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);if(f<d.get(0).scrollHeight-d.height()){d.scrollTop(f)}this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height(),top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x),d=Math.max(j.clien
tX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width();a.low_input.val(commatize(Math.round(f/g*h)+a.low));a.high_input.val(commatize(Math.round(d/g*h)+a.low));this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.trac
k_id_counter+=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)]},update_options:function(){this.has_changes=true;var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];this.viewport.append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(f){var d=this.high-this.low,b=this.low,e=this.high;if(b<this.max_low){b=this.max_low}if(e>this.max_high){e=this.max_high}if(d<this.min_separation){e=b+this.min_separation}this.low=Math.floor(b);this.high=Math.ceil(e);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))));this.overview_box.css({left:(this.low/(this.max_high-this.max_low))*this.overview_viewport.width(),width:Math.max(12,(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())}).show();this.low_input.val(commatize(this.low));this.high_input.val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor)/2;
this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()}});var Track=function(b,a,c){this.name=b;this.parent_element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div />").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error");$("
#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){this.left_offset=200};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove();thi
s.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a,b){Track.call(this,null,a,b);this.track_type="LabelTrack";this.hidden=true;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,Ma
th.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";Track.call(this,null,a,a.nav_labeltrack);TiledTrack.call(this);this.hidden=true;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:a,hi
gh:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),n=e.get(0).getContext("2d"),j=f+"_"+b;if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o+this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o);n.fillText(m[h],a+this.left_offset,10)}k.append(e);return e}}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,mode
:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}if(c.mode!==undefined){this.prefs.mode=c.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div />").addClas
s("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=Math.
ceil(a*e+this.left_offset);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(o){var a=$("<div />").addClass("form-row");var h="track_"+o+"_minval",m=$("<label></label>").at
tr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),n=$("<input></input>").attr("id",h).val(b),l="track_"+o+"_maxval",g=$("<label></label>").attr("for",l).text("Max value:"),k=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",l).val(k),e="track_"+o+"_mode",d=$("<label></label>").attr("for",e).text("Display mode:"),j=(this.prefs.mode===undefined?"Line":this.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+j).attr("selected","selected");return a.append(m).append(n).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this.pre
fs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:false};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.labe
l_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;a.mode="Auto";if(a.mode_div){a.mode_div.remove()}this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(d){a.mode_div=$("<div class='right-float menubutton popup' />").text("Display Mode");a.header_div.append(a.mode_div);a.mode="Auto";var c=function(e){a.mode_div.text(e);a.mode=e;a.tile_cache.clear();a.draw()};make_popupmenu(a.mode_div,{Auto:function(){c("Auto")},Dense:function(){c("Dense")},Squish:function(){c("Squish")},Pack:function(){c("Pack")}});a.data_cache.set(b,d);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,resolut
ion:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_by_t
ile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(X,h,n,ak){var E=h*DENSITY*X,ad=(h+1)*DENSITY*X,D=DENSITY*X;var ae=E+"_"+ad;var z=this.data_cache.get(ae);if(z===undefined){this.data_queue[[E,ad]]=true;this.get_data(E,ad);return}var a=Math.ceil(D*ak),L=$("<canvas class='tile'></canvas>"),Z=this.prefs.label_color,f=this.prefs.
block_color,m=this.mode,V=(m==="Squish")||(m==="Dense")&&(m!=="Pack")||(m==="Auto"&&(z.extra_info==="no_detail")),P=this.left_offset,aj,s,al;if(z.dataset_type==="summary_tree"){s=30}else{if(m==="Dense"){s=15;al=10}else{al=(V?this.vertical_nodetail_px:this.vertical_detail_px);s=this.incremental_slots(this.view.zoom_res,z.data,V,m)*al+15;aj=this.inc_slots[this.view.zoom_res]}}L.css({position:"absolute",top:0,left:(E-this.view.low)*ak-P});L.get(0).width=a+P;L.get(0).height=s;n.parent().css("height",Math.max(this.height_px,s)+"px");var A=L.get(0).getContext("2d");A.fillStyle=f;A.font=this.default_font;A.textAlign="right";if(z.dataset_type=="summary_tree"){var K,H=55,ac=255-H,g=ac*2/3,R=z.data,C=z.max,l=z.avg;if(R.length>2){var b=Math.ceil((R[1][0]-R[0][0])*ak)}else{var b=50}for(var ag=0,w=R.length;ag<w;ag++){var T=Math.ceil((R[ag][0]-E)*ak);var S=R[ag][1];if(!S){continue}K=Math.floor(ac-(S/C)*ac);A.fillStyle="rgb("+K+","+K+","+K+")";A.fillRect(T+P,0,b,20);if(this.prefs.show_coun
ts){if(K>g){A.fillStyle="black"}else{A.fillStyle="#ddd"}A.textAlign="center";A.fillText(R[ag][1],T+P+(b/2),12)}}n.append(L);return L}var ai=z.data;var af=0;for(var ag=0,w=ai.length;ag<w;ag++){var M=ai[ag],J=M[0],ah=M[1],U=M[2],F=M[3];if(ah<=ad&&U>=E){var W=Math.floor(Math.max(0,(ah-E)*ak)),B=Math.ceil(Math.min(a,Math.max(0,(U-E)*ak))),Q=(m==="Dense"?0:aj[J]*al);if(z.dataset_type==="bai"){A.fillStyle=f;if(M[4] instanceof Array){var t=Math.floor(Math.max(0,(M[4][0]-E)*ak)),I=Math.ceil(Math.min(a,Math.max(0,(M[4][1]-E)*ak))),r=Math.floor(Math.max(0,(M[5][0]-E)*ak)),p=Math.ceil(Math.min(a,Math.max(0,(M[5][1]-E)*ak)));if(M[4][1]>=E&&M[4][0]<=ad){this.rect_or_text(A,ak,E,ad,M[4][0],M[4][2],t+P,I-t,Q)}if(M[5][1]>=E&&M[5][0]<=ad){this.rect_or_text(A,ak,E,ad,M[5][0],M[5][2],r+P,p-r,Q)}if(r>I){A.fillStyle="#999";A.fillRect(I+P,Q+5,r-I,1)}}else{A.fillStyle=f;this.rect_or_text(A,ak,E,ad,ah,F,W+P,B-W,Q)}if(m!=="Dense"&&!V&&ah>E){A.fillStyle=this.prefs.label_color;if(h===0&&W-A.measureTex
t(F).width<0){A.textAlign="left";A.fillText(J,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(J,W-2+P,Q+8)}A.fillStyle=f}}else{if(z.dataset_type==="interval_index"){if(V){A.fillRect(W+P,Q+5,B-W,1)}else{var v=M[4],O=M[5],Y=M[6],e=M[7];var u,aa,G=null,am=null;if(O&&Y){G=Math.floor(Math.max(0,(O-E)*ak));am=Math.ceil(Math.min(a,Math.max(0,(Y-E)*ak)))}if(m!=="Dense"&&F!==undefined&&ah>E){A.fillStyle=Z;if(h===0&&W-A.measureText(F).width<0){A.textAlign="left";A.fillText(F,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(F,W-2+P,Q+8)}A.fillStyle=f}if(e){if(v){if(v=="+"){A.fillStyle=RIGHT_STRAND}else{if(v=="-"){A.fillStyle=LEFT_STRAND}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=f}for(var ae=0,d=e.length;ae<d;ae++){var o=e[ae],c=Math.floor(Math.max(0,(o[0]-E)*ak)),N=Math.ceil(Math.min(a,Math.max((o[1]-E)*ak)));if(c>N){continue}u=5;aa=3;A.fillRect(c+P,Q+aa,N-c,u);if(G!==undefined&&!(c>am||N<G)){u=9;aa=1;var ab=Math.max(c,G),q=Math.min(N,am);A.fillRect(ab+P,Q+aa,q-ab,u)}}}else{u=9;aa=1;A.fillRec
t(W+P,Q+aa,B-W,u);if(M.strand){if(M.strand=="+"){A.fillStyle=RIGHT_STRAND_INV}else{if(M.strand=="-"){A.fillStyle=LEFT_STRAND_INV}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=prefs.block_color}}}}}af++}}n.append(L);return L},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_label
_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
+var DENSITY=200,FEATURE_LEVELS=10,DATA_ERROR="There was an error in indexing this dataset. ",DATA_NOCONVERTER="A converter for this dataset is not installed. Please check your datatypes_conf.xml file.",DATA_NONE="No data for this chrom/contig.",DATA_PENDING="Currently indexing... please wait",DATA_LOADING="Loading data...",CACHED_TILES_FEATURE=10,CACHED_TILES_LINE=30,CACHED_DATA=5,CONTEXT=$("<canvas></canvas>").get(0).getContext("2d"),PX_PER_CHAR=CONTEXT.measureText("A").width,RIGHT_STRAND,LEFT_STRAND;var right_img=new Image();right_img.src="/static/images/visualization/strand_right.png";right_img.onload=function(){RIGHT_STRAND=CONTEXT.createPattern(right_img,"repeat")};var left_img=new Image();left_img.src="/static/images/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="/static/images/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="/static/images/visualization/strand_left_inv.png";left_img_inv.onload=function(){LEFT_STRAND_INV=CONTEXT.createPattern(left_img_inv,"repeat")};var Cache=function(a){this.num_elements=a;this.clear()};$.extend(Cache.prototype,{get:function(b){var a=this.key_ary.indexOf(b);if(a!=-1){this.key_ary.splice(a,1);this.key_ary.push(b)}return this.obj_cache[b]},set:function(b,c){if(!this.obj_cache[b]){if(this.key_ary.length>=this.num_elements){var a=this.key_ary.shift();delete this.obj_cache[a]}this.key_ary.push(b)}this.obj_cache[b]=c;return c},clear:function(){this.obj_cache={};this.key_ary=[]}});var View=function(a,c,e,d,b){this.container=a;this.vis_id=d;this.dbkey=b;this.title=e;this.chrom=c;this.tracks=[];this.label_tracks=[];this.max_low=0;this.max_high=0;this.track_id_counter=0;this.zoom_factor=3;this.min_separation=30;this.has_changes=false;this.init();this.reset()};$.extend(View.p
rototype,{init:function(){var c=this.container,a=this;this.content_div=$("<div/>").addClass("content").css("position","relative").appendTo(c);this.top_labeltrack=$("<div/>").addClass("top-labeltrack").appendTo(this.content_div);this.viewport_container=$("<div/>").addClass("viewport-container").addClass("viewport-container").appendTo(this.content_div);this.viewport=$("<div/>").addClass("viewport").appendTo(this.viewport_container);this.nav_container=$("<div/>").addClass("nav-container").appendTo(c);this.nav_labeltrack=$("<div/>").addClass("nav-labeltrack").appendTo(this.nav_container);this.nav=$("<div/>").addClass("nav").appendTo(this.nav_container);this.overview=$("<div/>").addClass("overview").appendTo(this.nav);this.overview_viewport=$("<div/>").addClass("overview-viewport").appendTo(this.overview);this.overview_box=$("<div/>").addClass("overview-box").appendTo(this.overview_viewport);this.nav_controls=$("<div/>").addClass("nav-controls").appendTo(this.nav);this.chrom_form
=$("<form/>").attr("action",function(){void (0)}).appendTo(this.nav_controls);this.chrom_select=$("<select/>").attr({name:"chrom"}).css("width","15em").addClass("no-autocomplete").append("<option value=''>Loading</option>").appendTo(this.chrom_form);this.low_input=$("<input/>").addClass("low").css("width","10em").appendTo(this.chrom_form);$("<span/>").text(" - ").appendTo(this.chrom_form);this.high_input=$("<input/>").addClass("high").css("width","10em").appendTo(this.chrom_form);this.hidden_input=$("<input/>").attr("type","hidden").val(this.vis_id).appendTo(this.chrom_form);this.zi_link=$("<a/>").click(function(){a.zoom_in();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom.png" />').appendTo(this.chrom_form);this.zo_link=$("<a/>").click(function(){a.zoom_out();a.redraw()}).html('<img src="../images/fugue/magnifier-zoom-out.png" />').appendTo(this.chrom_form);var b=(this.vis_id!==undefined?{vis_id:this.vis_id}:{dbkey:this.dbkey});$.ajax({url:chrom_url,data:b,dataT
ype:"json",success:function(d){if(d.reference){a.add_label_track(new ReferenceTrack(a))}a.chrom_data=d.chrom_info;var f='<option value="">Select Chrom/Contig</option>';for(i in a.chrom_data){var e=a.chrom_data[i]["chrom"];f+='<option value="'+e+'">'+e+"</option>"}a.chrom_select.html(f);a.chrom_select.bind("change",function(){a.chrom=a.chrom_select.val();var h=$.grep(a.chrom_data,function(k,l){return k.chrom===a.chrom})[0];a.max_high=h.len;a.reset();a.redraw(true);for(var j in a.tracks){var g=a.tracks[j];if(g.init){g.init()}}a.redraw()})},error:function(){alert("Could not load chroms for this dbkey:",a.dbkey)}});this.content_div.bind("mousewheel",function(d,f){if(Math.abs(f)<0.5){return}if(f>0){a.zoom_in(d.pageX,this.viewport_container)}else{a.zoom_out()}d.preventDefault()});this.content_div.bind("dblclick",function(d){a.zoom_in(d.pageX,this.viewport_container)});this.overview_box.bind("dragstart",function(d){this.current_x=d.offsetX}).bind("drag",function(d){var g=d.offsetX-
this.current_x;this.current_x=d.offsetX;var f=Math.round(g/a.viewport_container.width()*(a.high-a.low));a.move_delta(-2*f)});this.viewport_container.bind("dragstart",function(d){this.original_low=a.low;this.current_height=d.clientY;this.current_x=d.offsetX}).bind("drag",function(g){var d=$(this);var j=g.offsetX-this.current_x;var f=d.scrollTop()-(g.clientY-this.current_height);if(f<d.get(0).scrollHeight-d.height()){d.scrollTop(f)}this.current_height=g.clientY;this.current_x=g.offsetX;var h=Math.round(j/a.viewport_container.width()*(a.high-a.low));a.move_delta(h)});this.top_labeltrack.bind("dragstart",function(d){this.drag_origin_x=d.clientX;this.drag_origin_pos=d.clientX/a.viewport_container.width()*(a.high-a.low)+a.low;this.drag_div=$("<div />").css({height:a.content_div.height(),top:"0px",position:"absolute","background-color":"#cfc",border:"1px solid #6a6",opacity:0.5}).appendTo($(this))}).bind("drag",function(j){var f=Math.min(j.clientX,this.drag_origin_x),d=Math.max(j.c
lientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width();a.low_input.val(commatize(Math.round(f/g*h)+a.low));a.high_input.val(commatize(Math.round(d/g*h)+a.low));this.drag_div.css({left:f+"px",width:(d-f)+"px"})}).bind("dragend",function(k){var f=Math.min(k.clientX,this.drag_origin_x),d=Math.max(k.clientX,this.drag_origin_x),h=(a.high-a.low),g=a.viewport_container.width(),j=a.low;a.low=Math.round(f/g*h)+j;a.high=Math.round(d/g*h)+j;this.drag_div.remove();a.redraw()});this.add_label_track(new LabelTrack(this,this.top_labeltrack));this.add_label_track(new LabelTrack(this,this.nav_labeltrack))},move_delta:function(c){var a=this;var b=a.high-a.low;if(a.low-c<a.max_low){a.low=a.max_low;a.high=a.max_low+b}else{if(a.high-c>a.max_high){a.high=a.max_high;a.low=a.max_high-b}else{a.high-=c;a.low-=c}}a.redraw()},add_track:function(a){a.view=this;a.track_id=this.track_id_counter;this.tracks.push(a);if(a.init){a.init()}a.container_div.attr("id","track_"+a.track_id);this.
track_id_counter+=1},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)]},update_options:function(){this.has_changes=true;var b=$("ul#sortable-ul").sortable("toArray");for(var c in b){var e=b[c].split("_li")[0].split("track_")[1];this.viewport.append($("#track_"+e))}for(var d in view.tracks){var a=view.tracks[d];if(a&&a.update_options){a.update_options(d)}}},reset:function(){this.low=this.max_low;this.high=this.max_high;this.viewport_container.find(".yaxislabel").remove()},redraw:function(f){var d=this.high-this.low,b=this.low,e=this.high;if(b<this.max_low){b=this.max_low}if(e>this.max_high){e=this.max_high}if(d<this.min_separation){e=b+this.min_separation}this.low=Math.floor(b);this.high=Math.ceil(e);this.resolution=Math.pow(10,Math.ceil(Math.log((this.high-this.low)/200)/Math.LN10));this.zoom_res=Math.pow(FEAT
URE_LEVELS,Math.max(0,Math.ceil(Math.log(this.resolution,FEATURE_LEVELS)/Math.log(FEATURE_LEVELS))));this.overview_box.css({left:(this.low/(this.max_high-this.max_low))*this.overview_viewport.width(),width:Math.max(12,(this.high-this.low)/(this.max_high-this.max_low)*this.overview_viewport.width())}).show();this.low_input.val(commatize(this.low));this.high_input.val(commatize(this.high));if(!f){for(var c=0,a=this.tracks.length;c<a;c++){if(this.tracks[c]&&this.tracks[c].enabled){this.tracks[c].draw()}}for(var c=0,a=this.label_tracks.length;c<a;c++){this.label_tracks[c].draw()}}},zoom_in:function(b,c){if(this.max_high===0||this.high-this.low<this.min_separation){return}var d=this.high-this.low,e=d/2+this.low,a=(d/this.zoom_factor)/2;if(b){e=b/this.viewport_container.width()*(this.high-this.low)+this.low}this.low=Math.round(e-a);this.high=Math.round(e+a);this.redraw()},zoom_out:function(){if(this.max_high===0){return}var b=this.high-this.low,c=b/2+this.low,a=(b*this.zoom_factor
)/2;this.low=Math.round(c-a);this.high=Math.round(c+a);this.redraw()}});var Track=function(b,a,c){this.name=b;this.parent_element=c;this.view=a;this.init_global()};$.extend(Track.prototype,{init_global:function(){this.header_div=$("<div class='track-header'>").text(this.name);this.content_div=$("<div class='track-content'>");this.container_div=$("<div />").addClass("track").append(this.header_div).append(this.content_div);this.parent_element.append(this.container_div)},init_each:function(c,b){var a=this;a.enabled=false;a.data_queue={};a.tile_cache.clear();a.data_cache.clear();if(!a.content_div.text()){a.content_div.text(DATA_LOADING)}a.container_div.removeClass("nodata error pending");if(a.view.chrom){$.getJSON(data_url,c,function(d){if(!d||d==="error"||d.kind==="error"){a.container_div.addClass("error");a.content_div.text(DATA_ERROR);if(d.message){var f=a.view.tracks.indexOf(a);var e=$("<a href='javascript:void(0);'></a>").attr("id",f+"_error");e.text("Click to view error")
;$("#"+f+"_error").live("click",function(){show_modal("Trackster Error","<pre>"+d.message+"</pre>",{Close:hide_modal})});a.content_div.append(e)}}else{if(d==="no converter"){a.container_div.addClass("error");a.content_div.text(DATA_NOCONVERTER)}else{if(d.data!==undefined&&(d.data===null||d.data.length===0)){a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}else{if(d==="pending"){a.container_div.addClass("pending");a.content_div.text(DATA_PENDING);setTimeout(function(){a.init()},5000)}else{a.content_div.text("");a.content_div.css("height",a.height_px+"px");a.enabled=true;b(d);a.draw()}}}}})}else{a.container_div.addClass("nodata");a.content_div.text(DATA_NONE)}}});var TiledTrack=function(){this.left_offset=200};$.extend(TiledTrack.prototype,Track.prototype,{draw:function(){var j=this.view.low,e=this.view.high,f=e-j,d=this.view.resolution;var l=$("<div style='position: relative;'></div>"),m=this.content_div.width()/f,h;this.content_div.children(":first").remove()
;this.content_div.append(l),this.max_height=0;var a=Math.floor(j/d/DENSITY);while((a*DENSITY*d)<e){var k=this.content_div.width()+"_"+m+"_"+a;var c=this.tile_cache.get(k);if(c){var g=a*DENSITY*d;var b=(g-j)*m;if(this.left_offset){b-=this.left_offset}c.css({left:b});l.append(c);this.max_height=Math.max(this.max_height,c.height());this.content_div.css("height",this.max_height+"px")}else{this.delayed_draw(this,k,j,e,a,d,l,m)}a+=1}},delayed_draw:function(c,e,a,f,b,d,g,h){setTimeout(function(){if(!(a>c.view.high||f<c.view.low)){tile_element=c.draw_tile(d,b,g,h);if(tile_element){c.tile_cache.set(e,tile_element);c.max_height=Math.max(c.max_height,tile_element.height());c.content_div.css("height",c.max_height+"px")}}},50)}});var LabelTrack=function(a,b){Track.call(this,null,a,b);this.track_type="LabelTrack";this.hidden=true;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(1
0,Math.floor(Math.log(d)/Math.log(10)))),a=Math.floor(c.low/g)*g,e=this.content_div.width(),b=$("<div style='position: relative; height: 1.3em;'></div>");while(a<c.high){var f=(a-c.low)/d*e;b.append($("<div class='label'>"+commatize(a)+"</div>").css({position:"absolute",left:f-1}));a+=g}this.content_div.children(":first").remove();this.content_div.append(b)}});var ReferenceTrack=function(a){this.track_type="ReferenceTrack";Track.call(this,null,a,a.nav_labeltrack);TiledTrack.call(this);this.hidden=true;this.height_px=12;this.container_div.addClass("reference-track");this.dummy_canvas=$("<canvas></canvas>").get(0).getContext("2d");this.data_queue={};this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE)};$.extend(ReferenceTrack.prototype,TiledTrack.prototype,{get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:reference_url,dataType:"json",data:{chrom:this.view.chrom,low:
a,high:f,dbkey:this.view.dbkey},success:function(g){c.data_cache.set(e,g);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(f,b,k,o){var g=b*DENSITY*f,d=DENSITY*f,e=$("<canvas class='tile'></canvas>"),n=e.get(0).getContext("2d"),j=f+"_"+b;if(o>PX_PER_CHAR){if(this.data_cache.get(j)===undefined){this.get_data(f,b);return}var m=this.data_cache.get(j);if(m===null){return}e.get(0).width=Math.ceil(d*o+this.left_offset);e.get(0).height=this.height_px;e.css({position:"absolute",top:0,left:(g-this.view.low)*o+this.left_offset});for(var h=0,l=m.length;h<l;h++){var a=Math.round(h*o);n.fillText(m[h],a+this.left_offset,10)}k.append(e);return e}}});var LineTrack=function(d,b,a,c){this.track_type="LineTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=100;this.dataset_id=a;this.data_cache=new Cache(CACHED_DATA);this.tile_cache=new Cache(CACHED_TILES_LINE);this.prefs={min_value:undefined,max_value:undefined,
mode:"Line"};if(c.min_value!==undefined){this.prefs.min_value=c.min_value}if(c.max_value!==undefined){this.prefs.max_value=c.max_value}if(c.mode!==undefined){this.prefs.mode=c.mode}};$.extend(LineTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.tracks.indexOf(a);a.vertical_range=undefined;this.init_each({stats:true,chrom:a.view.chrom,low:null,high:null,dataset_id:a.dataset_id},function(c){a.container_div.addClass("line-track");data=c.data;if(isNaN(parseFloat(a.prefs.min_value))||isNaN(parseFloat(a.prefs.max_value))){a.prefs.min_value=data.min;a.prefs.max_value=data.max;$("#track_"+b+"_minval").val(a.prefs.min_value);$("#track_"+b+"_maxval").val(a.prefs.max_value)}a.vertical_range=a.prefs.max_value-a.prefs.min_value;a.total_frequency=data.total_frequency;$("#linetrack_"+b+"_minval").remove();$("#linetrack_"+b+"_maxval").remove();var e=$("<div />").addClass("yaxislabel").attr("id","linetrack_"+b+"_minval").text(a.prefs.min_value);var d=$("<div />").add
Class("yaxislabel").attr("id","linetrack_"+b+"_maxval").text(a.prefs.max_value);d.css({position:"relative",top:"25px",left:"10px"});d.prependTo(a.container_div);e.css({position:"relative",top:a.height_px+55+"px",left:"10px"});e.prependTo(a.container_div)})},get_data:function(d,b){var c=this,a=b*DENSITY*d,f=(b+1)*DENSITY*d,e=d+"_"+b;if(!c.data_queue[e]){c.data_queue[e]=true;$.ajax({url:data_url,dataType:"json",data:{chrom:this.view.chrom,low:a,high:f,dataset_id:this.dataset_id,resolution:this.view.resolution},success:function(g){data=g.data;c.data_cache.set(e,data);delete c.data_queue[e];c.draw()},error:function(h,g,j){console.log(h,g,j)}})}},draw_tile:function(p,r,c,e){if(this.vertical_range===undefined){return}var s=r*DENSITY*p,a=DENSITY*p,b=$("<canvas class='tile'></canvas>"),v=p+"_"+r;if(this.data_cache.get(v)===undefined){this.get_data(p,r);return}var j=this.data_cache.get(v);if(j===null){return}b.css({position:"absolute",top:0,left:(s-this.view.low)*e});b.get(0).width=M
ath.ceil(a*e+this.left_offset);b.get(0).height=this.height_px;var o=b.get(0).getContext("2d"),k=false,l=this.prefs.min_value,g=this.prefs.max_value,n=this.vertical_range,t=this.total_frequency,d=this.height_px,m=this.prefs.mode;o.beginPath();if(data.length>1){var f=Math.ceil((data[1][0]-data[0][0])*e)}else{var f=10}var u,h;for(var q=0;q<data.length;q++){u=(data[q][0]-s)*e;h=data[q][1];if(m=="Intensity"){if(h===null){continue}if(h<=l){h=l}else{if(h>=g){h=g}}h=255-Math.floor((h-l)/n*255);o.fillStyle="rgb("+h+","+h+","+h+")";o.fillRect(u,0,f,this.height_px)}else{if(h===null){if(k&&m==="Filled"){o.lineTo(u,d)}k=false;continue}else{if(h<=l){h=l}else{if(h>=g){h=g}}h=Math.round(d-(h-l)/n*d);if(k){o.lineTo(u,h)}else{k=true;if(m==="Filled"){o.moveTo(u,d);o.lineTo(u,h)}else{o.moveTo(u,h)}}}}}if(m==="Filled"){if(k){o.lineTo(u,d)}o.fill()}else{o.stroke()}c.append(b);return b},gen_options:function(o){var a=$("<div />").addClass("form-row");var h="track_"+o+"_minval",m=$("<label></label>"
).attr("for",h).text("Min value:"),b=(this.prefs.min_value===undefined?"":this.prefs.min_value),n=$("<input></input>").attr("id",h).val(b),l="track_"+o+"_maxval",g=$("<label></label>").attr("for",l).text("Max value:"),k=(this.prefs.max_value===undefined?"":this.prefs.max_value),f=$("<input></input>").attr("id",l).val(k),e="track_"+o+"_mode",d=$("<label></label>").attr("for",e).text("Display mode:"),j=(this.prefs.mode===undefined?"Line":this.prefs.mode),c=$('<select id="'+e+'"><option value="Line" id="mode_Line">Line</option><option value="Filled" id="mode_Filled">Filled</option><option value="Intensity" id="mode_Intensity">Intensity</option></select>');c.children("#mode_"+j).attr("selected","selected");return a.append(m).append(n).append(g).append(f).append(d).append(c)},update_options:function(d){var a=$("#track_"+d+"_minval").val(),c=$("#track_"+d+"_maxval").val(),b=$("#track_"+d+"_mode option:selected").val();if(a!==this.prefs.min_value||c!==this.prefs.max_value||b!==this
.prefs.mode){this.prefs.min_value=parseFloat(a);this.prefs.max_value=parseFloat(c);this.prefs.mode=b;this.vertical_range=this.prefs.max_value-this.prefs.min_value;$("#linetrack_"+d+"_minval").text(this.prefs.min_value);$("#linetrack_"+d+"_maxval").text(this.prefs.max_value);this.tile_cache.clear();this.draw()}}});var FeatureTrack=function(d,b,a,c){this.track_type="FeatureTrack";Track.call(this,d,b,b.viewport_container);TiledTrack.call(this);this.height_px=0;this.container_div.addClass("feature-track");this.dataset_id=a;this.zo_slots={};this.show_labels_scale=0.001;this.showing_details=false;this.vertical_detail_px=10;this.vertical_nodetail_px=3;this.default_font="9px Monaco, Lucida Console, monospace";this.inc_slots={};this.data_queue={};this.s_e_by_tile={};this.tile_cache=new Cache(CACHED_TILES_FEATURE);this.data_cache=new Cache(20);this.prefs={block_color:"black",label_color:"black",show_counts:false};if(c.block_color!==undefined){this.prefs.block_color=c.block_color}if(c.
label_color!==undefined){this.prefs.label_color=c.label_color}if(c.show_counts!==undefined){this.prefs.show_counts=c.show_counts}};$.extend(FeatureTrack.prototype,TiledTrack.prototype,{init:function(){var a=this,b=a.view.max_low+"_"+a.view.max_high;a.mode="Auto";if(a.mode_div){a.mode_div.remove()}this.init_each({low:a.view.max_low,high:a.view.max_high,dataset_id:a.dataset_id,chrom:a.view.chrom,resolution:this.view.resolution},function(d){a.mode_div=$("<div class='right-float menubutton popup' />").text("Display Mode");a.header_div.append(a.mode_div);a.mode="Auto";var c=function(e){a.mode_div.text(e);a.mode=e;a.tile_cache.clear();a.draw()};make_popupmenu(a.mode_div,{Auto:function(){c("Auto")},Dense:function(){c("Dense")},Squish:function(){c("Squish")},Pack:function(){c("Pack")}});a.data_cache.set(b,d);a.draw()})},get_data:function(a,d){var b=this,c=a+"_"+d;if(!b.data_queue[c]){b.data_queue[c]=true;$.getJSON(data_url,{chrom:b.view.chrom,low:a,high:d,dataset_id:b.dataset_id,res
olution:this.view.resolution,mode:this.mode},function(e){b.data_cache.set(c,e);delete b.data_queue[c];b.draw()})}},incremental_slots:function(a,h,c,r){if(!this.inc_slots[a]){this.inc_slots[a]={};this.inc_slots[a].w_scale=1/a;this.inc_slots[a].mode=r;this.s_e_by_tile[a]={}}var n=this.inc_slots[a].w_scale,z=[],l=0,b=$("<canvas></canvas>").get(0).getContext("2d"),o=this.view.max_low;var B=[];if(this.inc_slots[a].mode!==r){delete this.inc_slots[a];this.inc_slots[a]={mode:r,w_scale:n};delete this.s_e_by_tile[a];this.s_e_by_tile[a]={}}for(var w=0,x=h.length;w<x;w++){var g=h[w],m=g[0];if(this.inc_slots[a][m]!==undefined){l=Math.max(l,this.inc_slots[a][m]);B.push(this.inc_slots[a][m])}else{z.push(w)}}for(var w=0,x=z.length;w<x;w++){var g=h[z[w]],m=g[0],s=g[1],d=g[2],q=g[3],e=Math.floor((s-o)*n),f=Math.ceil((d-o)*n);if(q!==undefined&&!c){var t=b.measureText(q).width;if(e-t<0){f+=t}else{e-=t}}var v=0;while(true){var p=true;if(this.s_e_by_tile[a][v]!==undefined){for(var u=0,A=this.s_e_
by_tile[a][v].length;u<A;u++){var y=this.s_e_by_tile[a][v][u];if(f>y[0]&&e<y[1]){p=false;break}}}if(p){if(this.s_e_by_tile[a][v]===undefined){this.s_e_by_tile[a][v]=[]}this.s_e_by_tile[a][v].push([e,f]);this.inc_slots[a][m]=v;l=Math.max(l,v);break}v++}}return l},rect_or_text:function(n,o,f,m,b,d,k,e,h){n.textAlign="center";var j=Math.round(o/2);if((this.mode==="Pack"||this.mode==="Auto")&&d!==undefined&&o>PX_PER_CHAR){n.fillStyle=this.prefs.block_color;n.fillRect(k,h+1,e,9);n.fillStyle="#eee";for(var g=0,l=d.length;g<l;g++){if(b+g>=f&&b+g<=m){var a=Math.floor(Math.max(0,(b+g-f)*o));n.fillText(d[g],a+this.left_offset+j,h+9)}}}else{n.fillStyle=this.prefs.block_color;n.fillRect(k,h+4,e,3)}},draw_tile:function(X,h,n,ak){var E=h*DENSITY*X,ad=(h+1)*DENSITY*X,D=DENSITY*X;var ae=E+"_"+ad;var z=this.data_cache.get(ae);if(z===undefined){this.data_queue[[E,ad]]=true;this.get_data(E,ad);return}var a=Math.ceil(D*ak),L=$("<canvas class='tile'></canvas>"),Z=this.prefs.label_color,f=this.pr
efs.block_color,m=this.mode,V=(m==="Squish")||(m==="Dense")&&(m!=="Pack")||(m==="Auto"&&(z.extra_info==="no_detail")),P=this.left_offset,aj,s,al;if(z.dataset_type==="summary_tree"){s=30}else{if(m==="Dense"){s=15;al=10}else{al=(V?this.vertical_nodetail_px:this.vertical_detail_px);s=this.incremental_slots(this.view.zoom_res,z.data,V,m)*al+15;aj=this.inc_slots[this.view.zoom_res]}}L.css({position:"absolute",top:0,left:(E-this.view.low)*ak-P});L.get(0).width=a+P;L.get(0).height=s;n.parent().css("height",Math.max(this.height_px,s)+"px");var A=L.get(0).getContext("2d");A.fillStyle=f;A.font=this.default_font;A.textAlign="right";if(z.dataset_type=="summary_tree"){var K,H=55,ac=255-H,g=ac*2/3,R=z.data,C=z.max,l=z.avg;if(R.length>2){var b=Math.ceil((R[1][0]-R[0][0])*ak)}else{var b=50}for(var ag=0,w=R.length;ag<w;ag++){var T=Math.ceil((R[ag][0]-E)*ak);var S=R[ag][1];if(!S){continue}K=Math.floor(ac-(S/C)*ac);A.fillStyle="rgb("+K+","+K+","+K+")";A.fillRect(T+P,0,b,20);if(this.prefs.show_
counts){if(K>g){A.fillStyle="black"}else{A.fillStyle="#ddd"}A.textAlign="center";A.fillText(R[ag][1],T+P+(b/2),12)}}n.append(L);return L}var ai=z.data;var af=0;for(var ag=0,w=ai.length;ag<w;ag++){var M=ai[ag],J=M[0],ah=M[1],U=M[2],F=M[3];if(ah<=ad&&U>=E){var W=Math.floor(Math.max(0,(ah-E)*ak)),B=Math.ceil(Math.min(a,Math.max(0,(U-E)*ak))),Q=(m==="Dense"?0:aj[J]*al);if(z.dataset_type==="bai"){A.fillStyle=f;if(M[4] instanceof Array){var t=Math.floor(Math.max(0,(M[4][0]-E)*ak)),I=Math.ceil(Math.min(a,Math.max(0,(M[4][1]-E)*ak))),r=Math.floor(Math.max(0,(M[5][0]-E)*ak)),p=Math.ceil(Math.min(a,Math.max(0,(M[5][1]-E)*ak)));if(M[4][1]>=E&&M[4][0]<=ad){this.rect_or_text(A,ak,E,ad,M[4][0],M[4][2],t+P,I-t,Q)}if(M[5][1]>=E&&M[5][0]<=ad){this.rect_or_text(A,ak,E,ad,M[5][0],M[5][2],r+P,p-r,Q)}if(r>I){A.fillStyle="#999";A.fillRect(I+P,Q+5,r-I,1)}}else{A.fillStyle=f;this.rect_or_text(A,ak,E,ad,ah,F,W+P,B-W,Q)}if(m!=="Dense"&&!V&&ah>E){A.fillStyle=this.prefs.label_color;if(h===0&&W-A.measur
eText(F).width<0){A.textAlign="left";A.fillText(J,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(J,W-2+P,Q+8)}A.fillStyle=f}}else{if(z.dataset_type==="interval_index"){if(V){A.fillRect(W+P,Q+5,B-W,1)}else{var v=M[4],O=M[5],Y=M[6],e=M[7];var u,aa,G=null,am=null;if(O&&Y){G=Math.floor(Math.max(0,(O-E)*ak));am=Math.ceil(Math.min(a,Math.max(0,(Y-E)*ak)))}if(m!=="Dense"&&F!==undefined&&ah>E){A.fillStyle=Z;if(h===0&&W-A.measureText(F).width<0){A.textAlign="left";A.fillText(F,B+2+P,Q+8)}else{A.textAlign="right";A.fillText(F,W-2+P,Q+8)}A.fillStyle=f}if(e){if(v){if(v=="+"){A.fillStyle=RIGHT_STRAND}else{if(v=="-"){A.fillStyle=LEFT_STRAND}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=f}for(var ae=0,d=e.length;ae<d;ae++){var o=e[ae],c=Math.floor(Math.max(0,(o[0]-E)*ak)),N=Math.ceil(Math.min(a,Math.max((o[1]-E)*ak)));if(c>N){continue}u=5;aa=3;A.fillRect(c+P,Q+aa,N-c,u);if(G!==undefined&&!(c>am||N<G)){u=9;aa=1;var ab=Math.max(c,G),q=Math.min(N,am);A.fillRect(ab+P,Q+aa,q-ab,u)}}}else{u=9;aa=1;A.fil
lRect(W+P,Q+aa,B-W,u);if(M.strand){if(M.strand=="+"){A.fillStyle=RIGHT_STRAND_INV}else{if(M.strand=="-"){A.fillStyle=LEFT_STRAND_INV}}A.fillRect(W+P,Q,B-W,10);A.fillStyle=prefs.block_color}}}}}af++}}n.append(L);return L},gen_options:function(j){var a=$("<div />").addClass("form-row");var e="track_"+j+"_block_color",l=$("<label />").attr("for",e).text("Block color:"),m=$("<input />").attr("id",e).attr("name",e).val(this.prefs.block_color),k="track_"+j+"_label_color",g=$("<label />").attr("for",k).text("Text color:"),h=$("<input />").attr("id",k).attr("name",k).val(this.prefs.label_color),f="track_"+j+"_show_count",c=$("<label />").attr("for",f).text("Show summary counts"),b=$('<input type="checkbox" style="float:left;"></input>').attr("id",f).attr("name",f).attr("checked",this.prefs.show_counts),d=$("<div />").append(b).append(c);return a.append(l).append(m).append(g).append(h).append(d)},update_options:function(e){var b=$("#track_"+e+"_block_color").val(),d=$("#track_"+e+"_l
abel_color").val(),c=$("#track_"+e+"_mode option:selected").val(),a=$("#track_"+e+"_show_count").attr("checked");if(b!==this.prefs.block_color||d!==this.prefs.label_color||a!==this.prefs.show_counts){this.prefs.block_color=b;this.prefs.label_color=d;this.prefs.show_counts=a;this.tile_cache.clear();this.draw()}}});var ReadTrack=function(d,b,a,c){FeatureTrack.call(this,d,b,a,c);this.track_type="ReadTrack";this.vertical_detail_px=10;this.vertical_nodetail_px=5};$.extend(ReadTrack.prototype,TiledTrack.prototype,FeatureTrack.prototype,{});
1
0
galaxy-dist commit 2d046444998e: Enable 'extract genomic DNA' tool to accept and produce GFF files and added functional tests for this feature.
by commits-noreply@bitbucket.org 16 Jul '10
by commits-noreply@bitbucket.org 16 Jul '10
16 Jul '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1278618202 14400
# Node ID 2d046444998edb1c4a5126897990bddd25de69f5
# Parent 41089d12cdd9eaaeb8e75e09157d412ccf935eae
Enable 'extract genomic DNA' tool to accept and produce GFF files and added functional tests for this feature.
--- a/tools/extract/extract_genomic_dna.xml
+++ b/tools/extract/extract_genomic_dna.xml
@@ -1,20 +1,27 @@
<tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.2.1"><description>using coordinates from assembled/unassembled genomes</description>
- <command interpreter="python">extract_genomic_dna.py $input $out_file1 -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol} -d $dbkey -o $out_format -g ${GALAXY_DATA_INDEX_DIR}</command>
+ <command interpreter="python">
+ extract_genomic_dna.py $input $out_file1 -d $dbkey -o $out_format -g ${GALAXY_DATA_INDEX_DIR}
+ #if isinstance( $input.datatype, $__app__.datatypes_registry.get_datatype_by_extension('gff').__class__):
+ -1 1,4,5,7 --gff
+ #else:
+ -1 ${input.metadata.chromCol},${input.metadata.startCol},${input.metadata.endCol},${input.metadata.strandCol}
+ #end if
+ </command><inputs>
- <param format="interval" name="input" type="data" label="Fetch sequences corresponding to Query">
- <validator type="unspecified_build" />
- <validator type="dataset_metadata_in_file" filename="alignseq.loc" metadata_name="dbkey" metadata_column="1" message="Sequences are not currently available for the specified build." line_startswith="seq" />
+ <param format="interval,gff" name="input" type="data" label="Fetch sequences corresponding to Query">
+ <validator type="unspecified_build" />
+ <validator type="dataset_metadata_in_file" filename="alignseq.loc" metadata_name="dbkey" metadata_column="1" message="Sequences are not currently available for the specified build." line_startswith="seq" /></param><param name="out_format" type="select" label="Output data type">
- <option value="fasta">FASTA</option>
- <option value="interval">Interval</option>
+ <option value="fasta">FASTA</option>
+ <option value="interval">Interval</option></param></inputs><outputs>
- <data format="fasta" name="out_file1" metadata_source="input">
+ <data format="input" name="out_file1" metadata_source="input"><change_format>
- <when input="out_format" value="interval" format="interval" />
+ <when input="out_format" value="fasta" format="fasta" /></change_format></data></outputs>
@@ -34,6 +41,17 @@
<param name="out_format" value="interval"/><output name="out_file1" file="extract_genomic_dna_out3.interval" /></test>
+ <!-- Test GFF file support. -->
+ <test>
+ <param name="input" value="gff_filtering_out1.gff" dbkey="mm9" ftype="gff" />
+ <param name="out_format" value="interval"/>
+ <output name="out_file1" file="extract_genomic_dna_out4.gff" />
+ </test>
+ <test>
+ <param name="input" value="gff_filtering_out1.gff" dbkey="mm9" ftype="gff" />
+ <param name="out_format" value="fasta"/>
+ <output name="out_file1" file="extract_genomic_dna_out5.fasta" />
+ </test></tests><help>
@@ -90,7 +108,7 @@ Extracting sequences with **FASTA** outp
CACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCAC
ACACG
-Extrracting sequences with **Interval** output data type returns::
+Extracting sequences with **Interval** output data type returns::
chr7 127475281 127475310 NM_000230 0 + GTAGGAATCGCAGCGCCAGCGGTTGCAAG
chr7 127485994 127486166 NM_000230 0 + GCCCAAGAAGCCCATCCTGGGAAGGAAAATGCATTGGGGAACCCTGTGCGGATTCTTGTGGCTTTGGCCCTATCTTTTCTATGTCCAAGCTGTGCCCATCCAAAAAGTCCAAGATGACACCAAAACCCTCATCAAGACAATTGTCACCAGGATCAATGACATTTCACACACG
--- /dev/null
+++ b/test-data/extract_genomic_dna_out5.fasta
@@ -0,0 +1,258 @@
+>mm9_chr10_62044836_62045189_+
+AATTACAAGATCGACACACCAAGATAGGCAGATCCATGGTTGGTTTTACT
+TTGTAAATCTAAAAGTATGTTGGAAAACGATGCAATGAATTCTTATCCTT
+TTTCAAAATGAAGAATTTGTGATGGTTAGTGGACAGTTCAGAAGCCTCTC
+TGCAAGAAAGGGGGCGCTGAGAAGTGGTAAAAAAAGGAAGGAAGCACTCG
+GGCTTTGTCAGCAGGGTGGACCCTGGGGTCCACAGTGGGAACAGTCCCTT
+CTGGCCTCTACTCACTGACCAAACGCTTTACTAAAACTCCGCTTCTGGCC
+TCTGTTGCCACCTCCTGGTCGCTGTCCTCGGAAGTTTCTACTTCCTCCTC
+GCT
+>mm9_chr10_75372918_75373002_+
+GCGTCTCGCAGCTTCTGCCCGTCGATCTCCATGTCGAGCCGGATGGGCAC
+CAGCACCTCAGGCTGTGACGCATTCTCATGGATC
+>mm9_chr10_80362427_80363292_-
+ATGACGGACAAGTGTTTCCGGAAGTGCATCGGGAAGCCCGGGGGCTCCTT
+GGATAACTCGGAGCAGGTGAGACATCTCGGGAACCCGGGGTGGTGAGGGG
+CGCGGGGTCAGGAGCGTCTAGGAGGTTGAGAGATGTGCGCGTGCGCGGCC
+TCTAGCCTTAGCTACTGAGGAAGTTGTGCGCGTGCGCGGGGTGAGGACCC
+GGCTTCTGTGCCTAGATCGGTGCAGCCTTCATGGGTGATCCTCGGGTCGT
+GTGACCGTCAGTCAGGGATCCCCCTCCACGCTTTGCAGAAATGCATCGCC
+ATGTGCATGGACCGCTACATGGACGCCTGGAATACCGTGTCCCGCGCCTA
+CAACTCTCGACTGCAGCGGGAACGAGCCAACATGTGACCGGGACCTGTGC
+CTCGGGACACCGTGCTTATGGTCTGAACTGTTTTCCCTGCCAGTTAGGGT
+GTCTCCTCCTAGCCGCCCTGAAGTCTGGCAGCATGGAGGGCTTGGGGATC
+GAGGCCTCTCCCCTGGGTTGCTGCGTCCAGCTCAATCTCAGAAGAGAGTG
+AGGACCCGACAGAGCACAGGGATCTGGCTGGCCCCACTGACCTGTGACCT
+CAGGAGAGCAGGCCAATAAATCGCTGCTGGGGCAGTAAAGCAGGCGTGTC
+ACCTCACTGCTTCAGGTCCCTTCCCCTGAGTAGGCCCAGACCTCCCAGGG
+TATCTTTCCCCTTGGGGTCAGTGGGCTGCTGGCTCTCAGGGAATTCGGAG
+CATGATCTCAGGTGTTTGGTCATCCCGGGGAGACCAGCCGAGGTTAAGAA
+GCAAGGCTTCATGTagccttcacctatcatgcatgaggcccagggtgctg
+accttaactctgaat
+>mm9_chr11_7904564_7904642_+
+CATCTTCTATTTGAGCCTCCATCCAGGCACCTCTGAAACAAAGGTGCACT
+CACTGCATGTCCACTTGTCACAGGAGCC
+>mm9_chr11_78140155_78140259_+
+CTGCTTGCTAATTTTCTCTCTTGGGATCAGGGGGACGTGAACTCCAGCCC
+TGACTCGTGCTCCTTATGCTCTGAGTACATAGCAAATAAATGAGAGCAAA
+ACAC
+>mm9_chr11_105616461_105616737_+
+TAGGTGTAATAGTGGAAAACAATAGTTTTTAAACTTCAGAGTCCAGGGCT
+GTAACTCAGTAGTAACAGTGTTCTCTAAGTATGTTATTCTTCCTCTACAT
+GCTGAAATTTTTCATATTTGGAGCATTCACTGTTCCATGTATCAGTAAAT
+TATATTGTGAGCTGTCATCATATCTAAGCACCATATTGAATATTTTTCAT
+GATTAAAATTTGTTGAAACAACAATTCTATGACCGAAAAAAGCAAGGCTT
+TGTAAATAACATGTTTGTTACTAGTA
+>mm9_chr12_30701761_30702509_+
+TGTGGAGTGTACTTATATGATCCCTATGCTGATAGGATTACCTTCCTAGA
+CATAGCTAGACGCAAAGCCACATGTGTAAGGCTGCTGAGCAAAGACAGCA
+TCCCAGCATGGGTGTGTTCACGGTGGATTCACCACGTTGCATATGTAAAG
+TGGTCCCCTTGGCTTACCCTTCACTTTGCTCATGAGATTCAGAAGCTGGT
+GGTCCAGCAGGGGTGAGCATTTGTGAAATAGTAAGCTGAACTTAGTGGTG
+AGATTTCAGAACAGACTTCTGTGAAGTAAGAGATGTAACCATGCATCTAA
+AATCAGATGGCCGTGTAACTGCTCGGGCATAGAAATGGTGGGAGAACCTG
+TCCTGGGTACCTGGCATTTCACATGAGCCCAGGGATATGTCTTGTGCCAA
+GGCACACAAGTGTCCATGGACTTGGACAGGTGCCAAGGGTTTTTGTCTCT
+GTTCCTATGTGGGAGGCTGGCTGTGATTTACATTAATTTCTGTATTTCAA
+ACGAAGATGTCTGCAGATCTCCATTTTGATGTTACAGCCTCATTGCCCAG
+GCAGTGGGCAGTGCCCAGACACCCTTTCTGACTAGCCACTGCATTGGGCT
+TCTGTGATTCAAAGTAGTGTATATATTTATTTACTTCTCTGACTGTGGCC
+AACAGCCAAATGCCATTTTATGTTCCTTGTATTCAGTCCATTACCAAAGA
+GGTGTTTGCACTTTGTAATGATACCTTTCAGTTCAAATAAAAGGACCA
+>mm9_chr13_49159495_49159569_+
+ttttcttttggattacttgatttttttttatttgatcttatttatgatga
+ttttgagtacatttttgaacagtt
+>mm9_chr13_100200303_100200330_+
+TCTCATATGAATAGCCACCCTCTTCTG
+>mm9_chr14_31949102_31949152_+
+GGATGCTATCCGCGATGTGCATGTAAAGGGCCTCATGTACCAGTGGATCG
+>mm9_chr14_67604226_67604668_+
+TTCACCGTGAGAGTTTTCTCCATTTCACTCTTCACTGTGCTGTTCTCTGT
+GCCGCTTTCCTCTTGACTTATAAACATCTGAGCCAGTTTTCAATAAACTT
+AAAACGAAGCCTGCTTCTCATCCCAAATTGTAAACAGGAATAAAGCTTTT
+TAAACCTTATCTTAAATTTTAACTTTGTTGAATTCTGCTTTGTGATAGGA
+CAATCTGTTTCACCCAACAAGAATCTGTGTAGGAGGATGAACATCCCGCA
+TGTTGGAGCTGCAAATCAGCACTGTACAAGCTCACTGATGGACAGCTGTT
+CTGTGATGTATTCCATGATTTTACTAATACTTTCAAAAATGGCAAAACTA
+ACTTCAGTTTTAATGTTGAAAGAAAATCATAAATGTTCCCATAGTTCAAT
+GGCACTGTCGATGAAACTGCTACTGAATTTAGAGAGAAAACG
+>mm9_chr14_75165581_75165744_+
+ggccctgggatgataTAACAGAAGAGTCTAAAGGAGGCTTCTGAGATGTG
+CAGTAGGAAAGCCTGGCACATAATAGGTTATTATCTAAATCCCTTCACTA
+CTCTTCAAAGACAGCAGGATGCCTCTGCTCCCATGTTTTATCTCTACTTA
+TGTGGAATTTATG
+>mm9_chr16_57154026_57154067_+
+GTTGAGGTTTATTTAAGTAAAATGATTTTTTAAAAAAGCAA
+>mm9_chr16_74862301_74862560_+
+GCATTGGCAGCAGATATTGGTACCCAGTGGCACTGCAGAGTACTTACAAT
+CAGGACTCGCTACTGTGCTTCATTCTGCTTTTCTCTCTGCTTCTATTACA
+GTTAAAGTGTTGCTAATTATAGAAACTCTCTGTTTATTGAACCTCGGTGT
+TAAGAAAAACTTGTAATCTTCAGATATGATCCGAAAGATTCCCAAACAAA
+TGTAACAAGGTCCACTTTTGTAGCCCTTTCTACCAGAAcactggttatca
+acctgtggg
+>mm9_chr16_98168778_98168914_+
+CCTATTTATTTCACTAAACATCTGCCTGCTAGCTGAGATAAACATTCTCT
+AAAAAACTGTTTACTGCAAAAAGTGATTACTGTTTTTTATTAGTTTCTTA
+GCATTTGAAATAGTTACATGAATGGAAGGATAGAGT
+>mm9_chr17_8483211_8483268_+
+AGACTTGTCAACAGCTCACCCAATGATGGAACTGAGGCTGCCCCTCAAGT
+GGCCAGA
+>mm9_chr17_30355790_30355913_+
+atctcatacccataagctcagaactcggggtggtaacataggaggactgc
+catgagtgtgactaacctgggctataggaggaggatctaccttaagcaaa
+tgaCCAACAAAACTAACAAGCTC
+>mm9_chr18_39571717_39571880_+
+TATAACATTCCATAAATGTACAATAATCTATTTTTGAGAAGCTCATTTTG
+AAACTTAACACTGTCATTGATAATCTTCAAGTGGTATTTCTTAGGCACCA
+TAAATTTCACATCCAGCTGGGTTACAATTATTTTAAAGTACTTTGAGACC
+AATTTAAACCATT
+>mm9_chr19_17633087_17633203_+
+TGGGAAATGAACTGCATGGCAATGAACCCCAGGGAATTTGGTGGTTAATT
+GTCTAAGGATAAGGACATCAGTTTTGTCTTTTGCATCACTGTGACCTTTG
+CCTCTAATTGTATAGA
+>mm9_chr19_41997623_41997859_+
+gctacacaacgactcacatagagggaagcaggcacacatcagataaaaca
+cAAAAGGATGGGTTGGTGATGGGCATAGTTAATGAGGGCCACTAGGTAAA
+TACACCTGATCCAAAAGTCACGCTACTACTTAGATTCTTCTCTCTGCTAA
+AGACAACAGAAgacatgttagccatgcttgtaatccctgcattggggaga
+tggagtcagaaatatcactgcaagttcacccaatag
+>mm9_chr19_56516514_56516684_+
+TGTATTCATTCACTATTCACTGATTTGTCAGATCATCCATCCACACAGGT
+GCTGAAGAGTAACCCATTTCACTTTGTATACAAGATAATGTTTTTGTACT
+TCAAATACATCTGGAATTCTTTCAAATATTCCAAGATTTTTTTTTTTTCT
+GAATAATCTTTGGTTACCTC
+>mm9_chr2_4543773_4543977_+
+gagccatttctccagccccTTTATGTGGAATATTAACAAGAGAAGACAAC
+ATAAAATGACTTACCATGCTGTGTGGCCTAACAGTGGATGAAGAATGAGT
+GATTTGGGCATTTCTGATAGTATTTATAAAGAAGACTTTTATGACCAAAC
+CACATGTCACAGTAGGGATTTGCTGCACATCTTATGAGAGTTTCTTCTTT
+GTCA
+>mm9_chr2_30200330_30200938_+
+CGCACACAAAGGATTTATTTGCCAGAGAGCAAGCAGACAGGCAGAGGTCA
+GAATGTTAGTTAGAAACTGAAGGAATGACTGCTGTAGCCACTGTGCCCAG
+CCAGAGCCATGAGGGAAGTGGGAGGCAGCACTTGGTGCTGCTGCTCTGGC
+TGACCCTTCTGGTTTCCTGCCACACTCCTAGCCCTGCCTGTGTGCTGCTG
+TCCCCCTCAACCTTCCACAGCCAGAAGGCAGATGTTCTTTCATGCCAAGA
+GCATCCATCCCCAGCATATCCTGGGCCCATGGTGGTGTCAAATGTAGTGA
+CCCTTCTGCCTTAAGGGAGCTGGGAAGCCTGGGGTGTGCAGGGTTGCAGG
+TCAGAAGCAGGACTAGCAGAGGGGCCTGGGGCCATTCTGTCTTGTGGGCT
+CTTTAATAGCTGAATGACGGGCACAGCCAGAAAAGGGTTAGGTCCCTTAT
+CCTAAGCAGCTCTGTGGCCAGCAGACGACTCTAAGTGGCAGAGCCTGGGA
+AGGGGCTGCTTAGCTGAGAAGTTCCAGGTAGGTGACAGGAACCTTGCCCT
+TCTTGTTGCCTCTCTCACCAATGAGCCAGTCGGGATCCATGCCTGGCAGG
+CTGTAGAC
+>mm9_chr2_106644219_106644341_+
+attcttaaggtaaatacctaggagtgatgtaacccagtcatagggaagaa
+ctacttttaatttgttgagcaacccccaacctgattttgacacaggtttg
+agtagtttacacttctactaac
+>mm9_chr2_125388930_125389219_+
+AGAGCACACAGCACATCACTTAGGCCTCCAACATTAAGGCAGCGCAAGTG
+CCTCAAGTAACTGAGAATACTTTACTCAGATACAAGGGTATCAAAAACAT
+GAGAACTGGCAGGAAGACCTCACAATGGTTTGTTAGCATCAAGTATTACC
+ATCCAGTTTCCTGTTTAAATAGTAATTAATGACTATTCTGAAATAAGGCA
+AATAATTACTCAAGCGGGCTGTCAAAGCCACTATCCTGTTGGCTGGGCAT
+CGGAGCAGTTAACTTTATCAAAGGCTTCTGACACAATGA
+>mm9_chr3_130936638_130936898_+
+CGAGGCTGCAGGCTGCAAATGTTCCCAGGCAGGCAAGACCTCACGTCCTA
+CTGGCTGCTGCCCTTGGGTGCATCTGTAGGCCCCGTGGCTCCTGCCCCTG
+GGGTTCAACACCGATAAACATAGAATACTCATTTTCAGAAGACCTGAGGG
+AATGAGTCTAAGCAACGCTTTTTACAAAAAGTGGCAAGGTTCAGGAAAAA
+AAAAAAAAAAGATGTTGCTCCAAGGCACCAAGGGTGTAATTTTTTTTCAG
+AAAAAGTCAG
+>mm9_chr3_136592670_136592771_+
+TGTCAGCCCATCACATTTTAGTGACAACAGTCATAGCCTTTATTTTCAGA
+TGACTTTCCTCTAAAACCACTGTCTATGAGTTGCCCCCCAAAACTCAAAA
+A
+>mm9_chr3_152861373_152861508_+
+ATCAAAAGCGACATGCAAGCATCTTGCTCTCACCACAGATCACTGAGACA
+TTAAGAGTGACGTCTCTTGAACTGTTGGCACGCCTAAGTTATTTCAGCAT
+TTCTTGCTCAGCAGTTGTTCTCTTGGCTTCCTCTG
+>mm9_chr4_13715309_13715630_+
+AACACATGGCCACATCATGTGATATTTTCAAAACACTTACACATAGCTTT
+GAGAAGGTCCCTGCAGGAATGATCCATCCTCTCACAGTTGGCCCATTTTT
+TAACAGCATATCTGCATTTTCCATTTAGGAGAGCTATATATTATTAGCTT
+ACATTTTTGGGTAGTAAAACAGTGCATTGCTGATTGTAAAACATGGACTT
+TATTATCTGCTGAAAATTGATTTGGCATTTATAGCCACTGTGTATTAGAC
+TGTTTTTCTGTTTTTAACATCAATGCTTAAAAGCGATGATTTGTGTTTaa
+aaaaattaaaaaaataaaata
+>mm9_chr4_147515028_147515097_+
+GCTGACGTGCTCTCCGAGTTCCTGGAGGTGGCCGTGCACCTGATTCTCTA
+TGTGCGCGAGGTCTACCCG
+>mm9_chr5_3949521_3949685_+
+AGTCCCAACCACCCCCTTGTTTAATGTATAACTTTCTGAAATGGGAGCGT
+TAGAATGGATTAAAATGGTTGGTAGGTGGTTGGATCACCAACCAAGACCA
+GAAATAGAGGGGTAGGCTGCTCAGGAGAGTATTGGGAGGGTAGCTATTAT
+TTGCATTTTGTGCT
+>mm9_chr5_68089693_68089831_+
+CAATGATAGAGAAGACTAAAATAAAAGCAGGCATGCTGGCACAAGCGACA
+GAAGGAAAAAGCCTCACCCGGCCCTGTTTGAGGCCACTCCTGGTGGCTCC
+TTTTCCAAGGACCATGCGGTCAAGCCTCTGAGTTGTTC
+>mm9_chr5_122819525_122819619_+
+CTTTAGAAAAGATGCATCTGTCATTGATTTAGGGATATGAATTGTTTGGA
+TTTGAGTAGTTTTCCATAACTCCTGCAGTTTGGCAATGTGTGCG
+>mm9_chr5_145619547_145619710_+
+CGGCGTTCTGAAAACTGTGCTCCGGGATGAGATCATTGCTTGGCACAAAA
+AGACACAGGAGGACACTTCCTCTCCACTGTCGGCCGCAGGGCAGCCTGAG
+AACATGGACAGCCAGCAGCTGGTTTCCTTAGTTCAGAAAGCCGTCACTGC
+CATCATGACCCGC
+>mm9_chr6_83928983_83929105_+
+ACAGGAACCATTATTTACATTTAATTTGGATGAATTTGTTACTGTGGATG
+AAGTCATAGAAGAAGTAAATCCTTCTCAAGCCAAGCAGAATCCATTAAAA
+GGAAAAAGAAAGGAAGCCCTCA
+>mm9_chr6_118857948_118858148_+
+CCAGGCTTGCTAGTTGGTGCAGTTAGCTACATCTCAGGACAGAGACAAGG
+TACTCTGAGCTCCCCTTGAACTGCCACACAAGCTGTCTCCTGGATGCCAA
+GCAGAGAAACCTGGAGACAACAATCATCATACTCAAAACCAGGATCTCTT
+TCTTAAGACTTTTGTATTTTGTCCCAGCCCTAACCCTGAGTTCTGCTGAA
+>mm9_chr7_85554209_85554343_+
+GTGAAACATCATGCTTCTGCATCAAGTTATTAGTGGGAAACCTGTAAAAG
+TTGACATTGAATGCTGATAACAAATTACTTTCATCCTGTCTCATAATGAA
+TCCTACATCAAGACAAGGCAAGTGAGAAAGAGGG
+>mm9_chr7_104055490_104055589_+
+ACATTTCTCCTCTCTTGGGGGAGCGCATCTCCTTGGGTGTGTCCACATCC
+GCCCCTAGGTACCCAGTGTGATGTGAGACACGAGTGTCTGTGCTAACTT
+>mm9_chr8_9970397_9970545_+
+AGTCTTCACCAAAATTAAGTCTCAGCTAACTTAAAAGTTGCAAGGATTTT
+TTTCAATAAAATTAATATCTTAAGTGTTTGGTGTTTAGATGATTCTCTCT
+CAACTTCCCCCACATTATCAAAAAACATTTGATGAACCTTAAAAACTC
+>mm9_chr9_20449845_20449932_+
+CCAGCACCGATGACACCATCGGCGACTTGAAGAAACTGATAGCTGCTCAA
+ACTGGCACCCGCTGGAACAAGATCGTTCTTAAAAAGT
+>mm9_chr9_107445869_107445930_+
+CAAGCAGAAGCTGGTGCCCATCATGACCATCCTGCTGGAAGAGCTGAATG
+CCTCCGGCCGC
+>mm9_chr9_120860475_120860606_+
+CTGCCATTGTACGCACCATGCAGAATACAAATGATGTAGAGACAGCTCGT
+TGTACTGCTGGGACTCTGCACAACCTTTCTCACCACCGCGAGGGCTTGCT
+GGCCATCTTTAAGTCTGGTGGCATCCCAGCG
+>mm9_chrX_10274056_10274087_+
+ACTTCGCTGTCATCATTTGTACAAACTCTTT
+>mm9_chrX_39881430_39881678_+
+AGCTAAAAAGAGTCCTTTTCTGACAGAAAGGCTGGACTTCTCCTTTTCAC
+CGTTTCTCTTACTGATGCTTTTGCCAGAAGAACAGTAAAGATTTAGACAC
+TGTCATGATTCATACACGTAAAATATTTTTCAAGGACACAATCTGATATA
+CTAACATTTATTTAAGAGGTTAAAGTCCACCACTAAATCTAAGGAAAGAT
+TTTTAACTGCCAAACACATTTCCTTTGACAAATAATGTAAGATGACAA
+>mm9_chrX_148249671_148249713_+
+AATGCTAGTATGAACAGTGGGAGGAATGAGCAAAATGTTACA
+>mm9_chrX_148481504_148482455_+
+CGCCACAACCTGCTACAGGCCTGTAAGATGCAGGACATCAAACTGCCACT
+GTCAAAGGGCACCATGGATGATATTAGTCAGGAAGAAGTGAGTATTATGG
+TGGGTGGTAGGAGTCATCTATGAATATTTAACCAGTAATGGGAGATTACA
+GATGGCCAGGAAGGGCAGGCAACAGATAGGACCACATAGAGTTGTGAGGG
+GCATAAAGATGGATGCAGAAGAAATGTGGCAAGGTGGAAGTAGTGAAGTC
+AGGCTTTGGTATGAGAGAGACATTGATTTGAGAGGAGAGCTGCAAGCCAG
+TGAGTACTCAGAAAGACCAAGAATGGGTCATTAATCTTAAGGATTTGAGC
+TCTTAGCTGCAGCAGATACTGGGCATGGGTAGGAGTGAGAATTGAGGAGC
+AGAGGAAGATGGGAAACTGGAGAACCTAAGGAGACTGATAGCTTAGCTGC
+AGTAAGGGAGGTTGGCCAGAAGAGGGTTGGGTAGGGGACTCAGCAAGGCA
+GAACTAAGGAAGCTTAGGTGGAGGGGAAGGAACAACATCTGAGCAACTAA
+AGCACTCTATCAACTGGAAGTGCAAGATGGTAGTGAGGGGTGGACAGGTG
+TAACTGAGTAACTCTTTGTAGGTAGCCTTTCAGTTTAATTCAGTAAAATA
+TTTTGAACACTAGTATTCCAGATACTGGTAGGCCATGACTTAACCATTCC
+TAATGTTAATCTCAGCTGTGCTAGCTGAGCTTGTGTTCACATTAGACATG
+AAGAAACTTAGTAAAAGGTAGAGCCCAGTTTTCGGTTTGGACCTTCCTGT
+TGGCCTCTGCTTCCGTGCCATCTAGCAAAGGAGTTCCTAATCTCTAGAGG
+GATACAAATGACTAGTCTGCTCCATCTGCCTCTTCCAACATTGCAGGGTA
+GCTCCCAGGGAGAAGAGTCAGTGAGTGGTTCCCAGAGAACATCCAGTATC
+T
--- a/tools/new_operations/gops_intersect.py
+++ b/tools/new_operations/gops_intersect.py
@@ -70,7 +70,7 @@ def main():
for line in intersect( [g1,g2], pieces=pieces, mincols=mincols ):
if type( line ) == GenomicInterval:
if in1_gff_format:
- line = convert_to_gff_coordinates( line )
+ line = convert_bed_coords_to_gff( line )
out_file.write( "%s\n" % "\t".join( line.fields ) )
else:
out_file.write( "%s\n" % line )
--- a/tools/extract/extract_genomic_dna.py
+++ b/tools/extract/extract_genomic_dna.py
@@ -5,6 +5,7 @@ usage: %prog $input $out_file1
-d, --dbkey=N: Genome build of input file
-o, --output_format=N: the data type of the output file
-g, --GALAXY_DATA_INDEX_DIR=N: the directory containing alignseq.loc
+ -G, --gff: input and output file, when it is interval, coordinates are treated as GFF format (1-based, half-open) rather than 'traditional' 0-based, closed format.
"""
from galaxy import eggs
import pkg_resources
@@ -14,6 +15,7 @@ from bx.cookbook import doc_optparse
import bx.seq.nib
import bx.seq.twobit
from galaxy.tools.util.galaxyops import *
+from galaxy.tools.util.gff_util import *
assert sys.version_info[:2] >= ( 2, 4 )
@@ -50,6 +52,7 @@ def __main__():
chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols )
dbkey = options.dbkey
output_format = options.output_format
+ gff_format = options.gff
GALAXY_DATA_INDEX_DIR = options.GALAXY_DATA_INDEX_DIR
input_filename, output_filename = args
except:
@@ -80,6 +83,8 @@ def __main__():
chrom = fields[chrom_col]
start = int( fields[start_col] )
end = int( fields[end_col] )
+ if gff_format:
+ start, end = convert_gff_coords_to_bed( [start, end] )
if includes_strand_col:
strand = fields[strand_col]
except:
@@ -162,7 +167,11 @@ def __main__():
c = b
else: # output_format == "interval"
meta_data = "\t".join( fields )
- fout.write( "%s\t%s\n" % ( meta_data, str( sequence ) ) )
+ if gff_format:
+ format_str = "%s seq \"%s\";\n"
+ else:
+ format_str = "%s\t%s\n"
+ fout.write( format_str % ( meta_data, str( sequence ) ) )
fout.close()
--- a/tools/new_operations/gops_subtract.py
+++ b/tools/new_operations/gops_subtract.py
@@ -71,7 +71,7 @@ def main():
for line in subtract( [g1,g2], pieces=pieces, mincols=mincols ):
if type( line ) is GenomicInterval:
if in1_gff_format:
- line = convert_to_gff_coordinates( line )
+ line = convert_bed_coords_to_gff( line )
out_file.write( "%s\n" % "\t".join( line.fields ) )
else:
out_file.write( "%s\n" % line )
--- /dev/null
+++ b/test-data/extract_genomic_dna_out4.gff
@@ -0,0 +1,46 @@
+chr10 Cufflinks transcript 62044837 62045189 1000 . . gene_id "CUFF.23531"; transcript_id "CUFF.23531.1"; FPKM "19.5178121606"; frac "1.000000"; conf_lo "9.264456"; conf_hi "29.771168"; cov "1.108611"; seq "AATTACAAGATCGACACACCAAGATAGGCAGATCCATGGTTGGTTTTACTTTGTAAATCTAAAAGTATGTTGGAAAACGATGCAATGAATTCTTATCCTTTTTCAAAATGAAGAATTTGTGATGGTTAGTGGACAGTTCAGAAGCCTCTCTGCAAGAAAGGGGGCGCTGAGAAGTGGTAAAAAAAGGAAGGAAGCACTCGGGCTTTGTCAGCAGGGTGGACCCTGGGGTCCACAGTGGGAACAGTCCCTTCTGGCCTCTACTCACTGACCAAACGCTTTACTAAAACTCCGCTTCTGGCCTCTGTTGCCACCTCCTGGTCGCTGTCCTCGGAAGTTTCTACTTCCTCCTCGCT";
+chr10 Cufflinks transcript 75372919 75373002 1000 . . gene_id "CUFF.24985"; transcript_id "CUFF.24985.1"; FPKM "124.4970510798"; frac "1.000000"; conf_lo "71.411330"; conf_hi "177.582772"; cov "7.071429"; seq "GCGTCTCGCAGCTTCTGCCCGTCGATCTCCATGTCGAGCCGGATGGGCACCAGCACCTCAGGCTGTGACGCATTCTCATGGATC";
+chr10 Cufflinks transcript 80362428 80363292 1000 - . gene_id "CUFF.26065"; transcript_id "CUFF.26065.1"; FPKM "43.6170921216"; frac "1.000000"; conf_lo "32.260169"; conf_hi "54.974016"; cov "2.477449"; seq "ATGACGGACAAGTGTTTCCGGAAGTGCATCGGGAAGCCCGGGGGCTCCTTGGATAACTCGGAGCAGGTGAGACATCTCGGGAACCCGGGGTGGTGAGGGGCGCGGGGTCAGGAGCGTCTAGGAGGTTGAGAGATGTGCGCGTGCGCGGCCTCTAGCCTTAGCTACTGAGGAAGTTGTGCGCGTGCGCGGGGTGAGGACCCGGCTTCTGTGCCTAGATCGGTGCAGCCTTCATGGGTGATCCTCGGGTCGTGTGACCGTCAGTCAGGGATCCCCCTCCACGCTTTGCAGAAATGCATCGCCATGTGCATGGACCGCTACATGGACGCCTGGAATACCGTGTCCCGCGCCTACAACTCTCGACTGCAGCGGGAACGAGCCAACATGTGACCGGGACCTGTGCCTCGGGACACCGTGCTTATGGTCTGAACTGTTTTCCCTGCCAGTTAGGGTGTCTCCTCCTAGCCGCCCTGAAGTCTGGCAGCATGGAGGGCTTGGGGATCGAGGCCTCTCCCCTGGGTTGCTGCGTCCAGCTCAATCTCAGAAGAGAGTGAGGACCCGACAGAGCACAGGGATCTGGCTGGCCCCACTGACCTGTGACCTCAGGAGAGCAGGCCAATAAATCGCTGCTGGGGCAGTAAAGCAGGCGTGTCACCTCACTGCTTCAGGTCCCTTCCCCTGAGTAGGCCCAGACCTCCCAGGGTATCTTTCCCCTTGGGGTCAGTGGGCTGCTGGCTCTCAGGGAATTCGGAGCATGATCTCAGGTGTTTGGTCATCCCGGGGA
GACCAGCCGAGGTTAAGAAGCAAGGCTTCATGTagccttcacctatcatgcatgaggcccagggtgctgaccttaactctgaat";
+chr11 Cufflinks transcript 7904565 7904642 1000 . . gene_id "CUFF.33508"; transcript_id "CUFF.33508.1"; FPKM "61.6484988869"; frac "1.000000"; conf_lo "22.882428"; conf_hi "100.414569"; cov "3.501633"; seq "CATCTTCTATTTGAGCCTCCATCCAGGCACCTCTGAAACAAAGGTGCACTCACTGCATGTCCACTTGTCACAGGAGCC";
+chr11 Cufflinks exon 78140156 78140259 1000 . . gene_id "CUFF.43148"; transcript_id "CUFF.43148.1"; exon_number "1"; FPKM "54.8483511750"; frac "1.000000"; conf_lo "23.181641"; conf_hi "86.515061"; cov "3.115385"; seq "CTGCTTGCTAATTTTCTCTCTTGGGATCAGGGGGACGTGAACTCCAGCCCTGACTCGTGCTCCTTATGCTCTGAGTACATAGCAAATAAATGAGAGCAAAACAC";
+chr11 Cufflinks exon 105616462 105616737 1000 . . gene_id "CUFF.48385"; transcript_id "CUFF.48385.1"; exon_number "1"; FPKM "18.9452034252"; frac "1.000000"; conf_lo "7.520816"; conf_hi "30.369591"; cov "1.076087"; seq "TAGGTGTAATAGTGGAAAACAATAGTTTTTAAACTTCAGAGTCCAGGGCTGTAACTCAGTAGTAACAGTGTTCTCTAAGTATGTTATTCTTCCTCTACATGCTGAAATTTTTCATATTTGGAGCATTCACTGTTCCATGTATCAGTAAATTATATTGTGAGCTGTCATCATATCTAAGCACCATATTGAATATTTTTCATGATTAAAATTTGTTGAAACAACAATTCTATGACCGAAAAAAGCAAGGCTTTGTAAATAACATGTTTGTTACTAGTA";
+chr12 Cufflinks exon 30701762 30702509 1000 . . gene_id "CUFF.53897"; transcript_id "CUFF.53897.1"; exon_number "1"; FPKM "48.9333329111"; frac "1.000000"; conf_lo "37.780391"; conf_hi "60.086275"; cov "2.779412"; seq "TGTGGAGTGTACTTATATGATCCCTATGCTGATAGGATTACCTTCCTAGACATAGCTAGACGCAAAGCCACATGTGTAAGGCTGCTGAGCAAAGACAGCATCCCAGCATGGGTGTGTTCACGGTGGATTCACCACGTTGCATATGTAAAGTGGTCCCCTTGGCTTACCCTTCACTTTGCTCATGAGATTCAGAAGCTGGTGGTCCAGCAGGGGTGAGCATTTGTGAAATAGTAAGCTGAACTTAGTGGTGAGATTTCAGAACAGACTTCTGTGAAGTAAGAGATGTAACCATGCATCTAAAATCAGATGGCCGTGTAACTGCTCGGGCATAGAAATGGTGGGAGAACCTGTCCTGGGTACCTGGCATTTCACATGAGCCCAGGGATATGTCTTGTGCCAAGGCACACAAGTGTCCATGGACTTGGACAGGTGCCAAGGGTTTTTGTCTCTGTTCCTATGTGGGAGGCTGGCTGTGATTTACATTAATTTCTGTATTTCAAACGAAGATGTCTGCAGATCTCCATTTTGATGTTACAGCCTCATTGCCCAGGCAGTGGGCAGTGCCCAGACACCCTTTCTGACTAGCCACTGCATTGGGCTTCTGTGATTCAAAGTAGTGTATATATTTATTTACTTCTCTGACTGTGGCCAACAGCCAAATGCCATTTTATGTTCCTTGTATTCAGTCCATTACCAAAGAGGTGTTTGCACTTTGTAATGATACCTTTCAGTTCAAATAAAAGGACCA";
+chr13 Cufflinks exon 49159496 49159569 1000 . . gene_id "CUFF.67788"; transcript_id "CUFF.67788.1"; exon_number "1"; FPKM "44.9657653777"; frac "1.000000"; conf_lo "10.974842"; conf_hi "78.956689"; cov "2.554054"; seq "ttttcttttggattacttgatttttttttatttgatcttatttatgatgattttgagtacatttttgaacagtt";
+chr13 Cufflinks transcript 100200304 100200330 1000 . . gene_id "CUFF.73108"; transcript_id "CUFF.73108.1"; FPKM "123.2395051093"; frac "1.000000"; conf_lo "30.079196"; conf_hi "216.399814"; cov "7.000000"; seq "TCTCATATGAATAGCCACCCTCTTCTG";
+chr14 Cufflinks transcript 31949103 31949152 1000 . . gene_id "CUFF.77316"; transcript_id "CUFF.77316.1"; FPKM "85.5634278330"; frac "1.000000"; conf_lo "28.521143"; conf_hi "142.605713"; cov "4.860000"; seq "GGATGCTATCCGCGATGTGCATGTAAAGGGCCTCATGTACCAGTGGATCG";
+chr14 Cufflinks exon 67604227 67604668 1000 . . gene_id "CUFF.81446"; transcript_id "CUFF.81446.1"; exon_number "1"; FPKM "123.6776546104"; frac "1.000000"; conf_lo "100.611653"; conf_hi "146.743656"; cov "7.024887"; seq "TTCACCGTGAGAGTTTTCTCCATTTCACTCTTCACTGTGCTGTTCTCTGTGCCGCTTTCCTCTTGACTTATAAACATCTGAGCCAGTTTTCAATAAACTTAAAACGAAGCCTGCTTCTCATCCCAAATTGTAAACAGGAATAAAGCTTTTTAAACCTTATCTTAAATTTTAACTTTGTTGAATTCTGCTTTGTGATAGGACAATCTGTTTCACCCAACAAGAATCTGTGTAGGAGGATGAACATCCCGCATGTTGGAGCTGCAAATCAGCACTGTACAAGCTCACTGATGGACAGCTGTTCTGTGATGTATTCCATGATTTTACTAATACTTTCAAAAATGGCAAAACTAACTTCAGTTTTAATGTTGAAAGAAAATCATAAATGTTCCCATAGTTCAATGGCACTGTCGATGAAACTGCTACTGAATTTAGAGAGAAAACG";
+chr14 Cufflinks exon 75165582 75165744 1000 . . gene_id "CUFF.82088"; transcript_id "CUFF.82088.1"; exon_number "1"; FPKM "20.4139057543"; frac "1.000000"; conf_lo "4.982443"; conf_hi "35.845368"; cov "1.159509"; seq "ggccctgggatgataTAACAGAAGAGTCTAAAGGAGGCTTCTGAGATGTGCAGTAGGAAAGCCTGGCACATAATAGGTTATTATCTAAATCCCTTCACTACTCTTCAAAGACAGCAGGATGCCTCTGCTCCCATGTTTTATCTCTACTTATGTGGAATTTATG";
+chr16 Cufflinks transcript 57154027 57154067 1000 . . gene_id "CUFF.103364"; transcript_id "CUFF.103364.1"; FPKM "162.3154457537"; frac "1.000000"; conf_lo "75.554191"; conf_hi "249.076701"; cov "9.219512"; seq "GTTGAGGTTTATTTAAGTAAAATGATTTTTTAAAAAAGCAA";
+chr16 Cufflinks exon 74862302 74862560 1000 . . gene_id "CUFF.105450"; transcript_id "CUFF.105450.1"; exon_number "1"; FPKM "11.0120241741"; frac "1.000000"; conf_lo "2.020744"; conf_hi "20.003304"; cov "0.625483"; seq "GCATTGGCAGCAGATATTGGTACCCAGTGGCACTGCAGAGTACTTACAATCAGGACTCGCTACTGTGCTTCATTCTGCTTTTCTCTCTGCTTCTATTACAGTTAAAGTGTTGCTAATTATAGAAACTCTCTGTTTATTGAACCTCGGTGTTAAGAAAAACTTGTAATCTTCAGATATGATCCGAAAGATTCCCAAACAAATGTAACAAGGTCCACTTTTGTAGCCCTTTCTACCAGAAcactggttatcaacctgtggg";
+chr16 Cufflinks transcript 98168779 98168914 1000 . . gene_id "CUFF.107834"; transcript_id "CUFF.107834.1"; FPKM "24.4666664555"; frac "1.000000"; conf_lo "5.971605"; conf_hi "42.961728"; cov "1.389706"; seq "CCTATTTATTTCACTAAACATCTGCCTGCTAGCTGAGATAAACATTCTCTAAAAAACTGTTTACTGCAAAAAGTGATTACTGTTTTTTATTAGTTTCTTAGCATTTGAAATAGTTACATGAATGGAAGGATAGAGT";
+chr17 Cufflinks exon 8483212 8483268 1000 . . gene_id "CUFF.108498"; transcript_id "CUFF.108498.1"; exon_number "1"; FPKM "50.0370923000"; frac "1.000000"; conf_lo "9.181978"; conf_hi "90.892207"; cov "2.842105"; seq "AGACTTGTCAACAGCTCACCCAATGATGGAACTGAGGCTGCCCCTCAAGTGGCCAGA";
+chr17 Cufflinks exon 30355791 30355913 1000 . . gene_id "CUFF.111759"; transcript_id "CUFF.111759.1"; exon_number "1"; FPKM "19.3232673516"; frac "1.000000"; conf_lo "2.040012"; conf_hi "36.606523"; cov "1.097561"; seq "atctcatacccataagctcagaactcggggtggtaacataggaggactgccatgagtgtgactaacctgggctataggaggaggatctaccttaagcaaatgaCCAACAAAACTAACAAGCTC";
+chr18 Cufflinks transcript 39571718 39571880 1000 . . gene_id "CUFF.123569"; transcript_id "CUFF.123569.1"; FPKM "20.4139057543"; frac "1.000000"; conf_lo "4.982443"; conf_hi "35.845368"; cov "1.159509"; seq "TATAACATTCCATAAATGTACAATAATCTATTTTTGAGAAGCTCATTTTGAAACTTAACACTGTCATTGATAATCTTCAAGTGGTATTTCTTAGGCACCATAAATTTCACATCCAGCTGGGTTACAATTATTTTAAAGTACTTTGAGACCAATTTAAACCATT";
+chr19 Cufflinks exon 17633088 17633203 1000 . . gene_id "CUFF.131333"; transcript_id "CUFF.131333.1"; exon_number "1"; FPKM "20.4893265884"; frac "1.000000"; conf_lo "2.163116"; conf_hi "38.815537"; cov "1.163793"; seq "TGGGAAATGAACTGCATGGCAATGAACCCCAGGGAATTTGGTGGTTAATTGTCTAAGGATAAGGACATCAGTTTTGTCTTTTGCATCACTGTGACCTTTGCCTCTAATTGTATAGA";
+chr19 Cufflinks transcript 41997624 41997859 1000 . . gene_id "CUFF.133569"; transcript_id "CUFF.133569.1"; FPKM "28.1988698132"; frac "1.000000"; conf_lo "13.125940"; conf_hi "43.271800"; cov "1.601695"; seq "gctacacaacgactcacatagagggaagcaggcacacatcagataaaacacAAAAGGATGGGTTGGTGATGGGCATAGTTAATGAGGGCCACTAGGTAAATACACCTGATCCAAAAGTCACGCTACTACTTAGATTCTTCTCTCTGCTAAAGACAACAGAAgacatgttagccatgcttgtaatccctgcattggggagatggagtcagaaatatcactgcaagttcacccaatag";
+chr19 Cufflinks exon 56516515 56516684 1000 . . gene_id "CUFF.135203"; transcript_id "CUFF.135203.1"; exon_number "1"; FPKM "33.5542854247"; frac "1.000000"; conf_lo "14.181710"; conf_hi "52.926861"; cov "1.905882"; seq "TGTATTCATTCACTATTCACTGATTTGTCAGATCATCCATCCACACAGGTGCTGAAGAGTAACCCATTTCACTTTGTATACAAGATAATGTTTTTGTACTTCAAATACATCTGGAATTCTTTCAAATATTCCAAGATTTTTTTTTTTTCTGAATAATCTTTGGTTACCTC";
+chr2 Cufflinks transcript 4543774 4543977 1000 . . gene_id "CUFF.136435"; transcript_id "CUFF.136435.1"; FPKM "37.2825393608"; frac "1.000000"; conf_lo "18.641270"; conf_hi "55.923809"; cov "2.117647"; seq "gagccatttctccagccccTTTATGTGGAATATTAACAAGAGAAGACAACATAAAATGACTTACCATGCTGTGTGGCCTAACAGTGGATGAAGAATGAGTGATTTGGGCATTTCTGATAGTATTTATAAAGAAGACTTTTATGACCAAACCACATGTCACAGTAGGGATTTGCTGCACATCTTATGAGAGTTTCTTCTTTGTCA";
+chr2 Cufflinks transcript 30200331 30200938 1000 . . gene_id "CUFF.140289"; transcript_id "CUFF.140289.1"; FPKM "100.0741846001"; frac "1.000000"; conf_lo "82.383401"; conf_hi "117.764968"; cov "5.684211"; seq "CGCACACAAAGGATTTATTTGCCAGAGAGCAAGCAGACAGGCAGAGGTCAGAATGTTAGTTAGAAACTGAAGGAATGACTGCTGTAGCCACTGTGCCCAGCCAGAGCCATGAGGGAAGTGGGAGGCAGCACTTGGTGCTGCTGCTCTGGCTGACCCTTCTGGTTTCCTGCCACACTCCTAGCCCTGCCTGTGTGCTGCTGTCCCCCTCAACCTTCCACAGCCAGAAGGCAGATGTTCTTTCATGCCAAGAGCATCCATCCCCAGCATATCCTGGGCCCATGGTGGTGTCAAATGTAGTGACCCTTCTGCCTTAAGGGAGCTGGGAAGCCTGGGGTGTGCAGGGTTGCAGGTCAGAAGCAGGACTAGCAGAGGGGCCTGGGGCCATTCTGTCTTGTGGGCTCTTTAATAGCTGAATGACGGGCACAGCCAGAAAAGGGTTAGGTCCCTTATCCTAAGCAGCTCTGTGGCCAGCAGACGACTCTAAGTGGCAGAGCCTGGGAAGGGGCTGCTTAGCTGAGAAGTTCCAGGTAGGTGACAGGAACCTTGCCCTTCTTGTTGCCTCTCTCACCAATGAGCCAGTCGGGATCCATGCCTGGCAGGCTGTAGAC";
+chr2 Cufflinks transcript 106644220 106644341 1000 . . gene_id "CUFF.148977"; transcript_id "CUFF.148977.1"; FPKM "27.2743167045"; frac "1.000000"; conf_lo "6.656871"; conf_hi "47.891762"; cov "1.549180"; seq "attcttaaggtaaatacctaggagtgatgtaacccagtcatagggaagaactacttttaatttgttgagcaacccccaacctgattttgacacaggtttgagtagtttacacttctactaac";
+chr2 Cufflinks exon 125388931 125389219 1000 . . gene_id "CUFF.151331"; transcript_id "CUFF.151331.1"; exon_number "1"; FPKM "23.0274507817"; frac "1.000000"; conf_lo "10.718761"; conf_hi "35.336141"; cov "1.307958"; seq "AGAGCACACAGCACATCACTTAGGCCTCCAACATTAAGGCAGCGCAAGTGCCTCAAGTAACTGAGAATACTTTACTCAGATACAAGGGTATCAAAAACATGAGAACTGGCAGGAAGACCTCACAATGGTTTGTTAGCATCAAGTATTACCATCCAGTTTCCTGTTTAAATAGTAATTAATGACTATTCTGAAATAAGGCAAATAATTACTCAAGCGGGCTGTCAAAGCCACTATCCTGTTGGCTGGGCATCGGAGCAGTTAACTTTATCAAAGGCTTCTGACACAATGA";
+chr3 Cufflinks transcript 130936639 130936898 1000 . . gene_id "CUFF.171349"; transcript_id "CUFF.171349.1"; FPKM "20.1110620975"; frac "1.000000"; conf_lo "7.983635"; conf_hi "32.238489"; cov "1.142308"; seq "CGAGGCTGCAGGCTGCAAATGTTCCCAGGCAGGCAAGACCTCACGTCCTACTGGCTGCTGCCCTTGGGTGCATCTGTAGGCCCCGTGGCTCCTGCCCCTGGGGTTCAACACCGATAAACATAGAATACTCATTTTCAGAAGACCTGAGGGAATGAGTCTAAGCAACGCTTTTTACAAAAAGTGGCAAGGTTCAGGAAAAAAAAAAAAAAAGATGTTGCTCCAAGGCACCAAGGGTGTAATTTTTTTTCAGAAAAAGTCAG";
+chr3 Cufflinks exon 136592671 136592771 1000 . . gene_id "CUFF.171861"; transcript_id "CUFF.171861.1"; exon_number "1"; FPKM "32.9452142371"; frac "1.000000"; conf_lo "8.040973"; conf_hi "57.849455"; cov "1.871287"; seq "TGTCAGCCCATCACATTTTAGTGACAACAGTCATAGCCTTTATTTTCAGATGACTTTCCTCTAAAACCACTGTCTATGAGTTGCCCCCCAAAACTCAAAAA";
+chr3 Cufflinks transcript 152861374 152861508 1000 . . gene_id "CUFF.173007"; transcript_id "CUFF.173007.1"; FPKM "24.6479010219"; frac "1.000000"; conf_lo "6.015839"; conf_hi "43.279963"; cov "1.400000"; seq "ATCAAAAGCGACATGCAAGCATCTTGCTCTCACCACAGATCACTGAGACATTAAGAGTGACGTCTCTTGAACTGTTGGCACGCCTAAGTTATTTCAGCATTTCTTGCTCAGCAGTTGTTCTCTTGGCTTCCTCTG";
+chr4 Cufflinks exon 13715310 13715630 1000 . . gene_id "CUFF.174817"; transcript_id "CUFF.174817.1"; exon_number "1"; FPKM "19.2510308382"; frac "1.000000"; conf_lo "8.572480"; conf_hi "29.929581"; cov "1.093458"; seq "AACACATGGCCACATCATGTGATATTTTCAAAACACTTACACATAGCTTTGAGAAGGTCCCTGCAGGAATGATCCATCCTCTCACAGTTGGCCCATTTTTTAACAGCATATCTGCATTTTCCATTTAGGAGAGCTATATATTATTAGCTTACATTTTTGGGTAGTAAAACAGTGCATTGCTGATTGTAAAACATGGACTTTATTATCTGCTGAAAATTGATTTGGCATTTATAGCCACTGTGTATTAGACTGTTTTTCTGTTTTTAACATCAATGCTTAAAAGCGATGATTTGTGTTTaaaaaaattaaaaaaataaaata";
+chr4 Cufflinks exon 147515029 147515097 1000 . . gene_id "CUFF.190627"; transcript_id "CUFF.190627.1"; exon_number "1"; FPKM "34.4458244094"; frac "1.000000"; conf_lo "3.636542"; conf_hi "65.255106"; cov "1.956522"; seq "GCTGACGTGCTCTCCGAGTTCCTGGAGGTGGCCGTGCACCTGATTCTCTATGTGCGCGAGGTCTACCCG";
+chr5 Cufflinks exon 3949522 3949685 1000 . . gene_id "CUFF.192485"; transcript_id "CUFF.192485.1"; exon_number "1"; FPKM "23.1879208220"; frac "1.000000"; conf_lo "6.791585"; conf_hi "39.584257"; cov "1.317073"; seq "AGTCCCAACCACCCCCTTGTTTAATGTATAACTTTCTGAAATGGGAGCGTTAGAATGGATTAAAATGGTTGGTAGGTGGTTGGATCACCAACCAAGACCAGAAATAGAGGGGTAGGCTGCTCAGGAGAGTATTGGGAGGGTAGCTATTATTTGCATTTTGTGCT";
+chr5 Cufflinks transcript 68089694 68089831 1000 . . gene_id "CUFF.199409"; transcript_id "CUFF.199409.1"; FPKM "17.2229122047"; frac "1.000000"; conf_lo "1.818271"; conf_hi "32.627553"; cov "0.978261"; seq "CAATGATAGAGAAGACTAAAATAAAAGCAGGCATGCTGGCACAAGCGACAGAAGGAAAAAGCCTCACCCGGCCCTGTTTGAGGCCACTCCTGGTGGCTCCTTTTCCAAGGACCATGCGGTCAAGCCTCTGAGTTGTTC";
+chr5 Cufflinks exon 122819526 122819619 1000 . . gene_id "CUFF.205487"; transcript_id "CUFF.205487.1"; exon_number "1"; FPKM "25.2486782797"; frac "1.000000"; conf_lo "2.649470"; conf_hi "47.847887"; cov "1.434124"; seq "CTTTAGAAAAGATGCATCTGTCATTGATTTAGGGATATGAATTGTTTGGATTTGAGTAGTTTTCCATAACTCCTGCAGTTTGGCAATGTGTGCG";
+chr5 Cufflinks transcript 145619548 145619710 1000 . . gene_id "CUFF.209965"; transcript_id "CUFF.209965.1"; FPKM "40.8278115086"; frac "1.000000"; conf_lo "19.004428"; conf_hi "62.651195"; cov "2.319018"; seq "CGGCGTTCTGAAAACTGTGCTCCGGGATGAGATCATTGCTTGGCACAAAAAGACACAGGAGGACACTTCCTCTCCACTGTCGGCCGCAGGGCAGCCTGAGAACATGGACAGCCAGCAGCTGGTTTCCTTAGTTCAGAAAGCCGTCACTGCCATCATGACCCGC";
+chr6 Cufflinks exon 83928984 83929105 1000 . . gene_id "CUFF.219317"; transcript_id "CUFF.219317.1"; exon_number "1"; FPKM "46.7559714935"; frac "1.000000"; conf_lo "19.761399"; conf_hi "73.750544"; cov "2.655738"; seq "ACAGGAACCATTATTTACATTTAATTTGGATGAATTTGTTACTGTGGATGAAGTCATAGAAGAAGTAAATCCTTCTCAAGCCAAGCAGAATCCATTAAAAGGAAAAAGAAAGGAAGCCCTCA";
+chr6 Cufflinks exon 118857949 118858148 1000 . . gene_id "CUFF.223543"; transcript_id "CUFF.223543.1"; exon_number "1"; FPKM "19.0140950740"; frac "1.000000"; conf_lo "5.569100"; conf_hi "32.459091"; cov "1.080000"; seq "CCAGGCTTGCTAGTTGGTGCAGTTAGCTACATCTCAGGACAGAGACAAGGTACTCTGAGCTCCCCTTGAACTGCCACACAAGCTGTCTCCTGGATGCCAAGCAGAGAAACCTGGAGACAACAATCATCATACTCAAAACCAGGATCTCTTTCTTAAGACTTTTGTATTTTGTCCCAGCCCTAACCCTGAGTTCTGCTGAA";
+chr7 Cufflinks transcript 85554210 85554343 1000 . . gene_id "CUFF.235778"; transcript_id "CUFF.235778.1"; FPKM "17.7370289869"; frac "1.000000"; conf_lo "1.872548"; conf_hi "33.601510"; cov "1.007463"; seq "GTGAAACATCATGCTTCTGCATCAAGTTATTAGTGGGAAACCTGTAAAAGTTGACATTGAATGCTGATAACAAATTACTTTCATCCTGTCTCATAATGAATCCTACATCAAGACAAGGCAAGTGAGAAAGAGGG";
+chr7 Cufflinks exon 104055491 104055589 1000 . . gene_id "CUFF.238474"; transcript_id "CUFF.238474.1"; exon_number "1"; FPKM "28.8092349606"; frac "1.000000"; conf_lo "5.286593"; conf_hi "52.331877"; cov "1.636364"; seq "ACATTTCTCCTCTCTTGGGGGAGCGCATCTCCTTGGGTGTGTCCACATCCGCCCCTAGGTACCCAGTGTGATGTGAGACACGAGTGTCTGTGCTAACTT";
+chr8 Cufflinks exon 9970398 9970545 1000 . . gene_id "CUFF.245320"; transcript_id "CUFF.245320.1"; exon_number "1"; FPKM "22.4828826889"; frac "1.000000"; conf_lo "5.487421"; conf_hi "39.478345"; cov "1.277027"; seq "AGTCTTCACCAAAATTAAGTCTCAGCTAACTTAAAAGTTGCAAGGATTTTTTTCAATAAAATTAATATCTTAAGTGTTTGGTGTTTAGATGATTCTCTCTCAACTTCCCCCACATTATCAAAAAACATTTGATGAACCTTAAAAACTC";
+chr9 Cufflinks transcript 20449846 20449932 1000 . . gene_id "CUFF.260747"; transcript_id "CUFF.260747.1"; FPKM "234.9313045507"; frac "1.000000"; conf_lo "163.275950"; conf_hi "306.586659"; cov "13.344091"; seq "CCAGCACCGATGACACCATCGGCGACTTGAAGAAACTGATAGCTGCTCAAACTGGCACCCGCTGGAACAAGATCGTTCTTAAAAAGT";
+chr9 Cufflinks exon 107445870 107445930 1000 . . gene_id "CUFF.272761"; transcript_id "CUFF.272761.1"; exon_number "1"; FPKM "38.9633095779"; frac "1.000000"; conf_lo "4.113466"; conf_hi "73.813153"; cov "2.213115"; seq "CAAGCAGAAGCTGGTGCCCATCATGACCATCCTGCTGGAAGAGCTGAATGCCTCCGGCCGC";
+chr9 Cufflinks transcript 120860476 120860606 1000 . . gene_id "CUFF.275115"; transcript_id "CUFF.275115.1"; FPKM "25.4005086867"; frac "1.000000"; conf_lo "6.199529"; conf_hi "44.601488"; cov "1.442748"; seq "CTGCCATTGTACGCACCATGCAGAATACAAATGATGTAGAGACAGCTCGTTGTACTGCTGGGACTCTGCACAACCTTTCTCACCACCGCGAGGGCTTGCTGGCCATCTTTAAGTCTGGTGGCATCCCAGCG";
+chrX Cufflinks exon 10274057 10274087 1000 . . gene_id "CUFF.276147"; transcript_id "CUFF.276147.1"; exon_number "1"; FPKM "99.5432248142"; frac "1.000000"; conf_lo "21.405127"; conf_hi "177.681323"; cov "5.654052"; seq "ACTTCGCTGTCATCATTTGTACAAACTCTTT";
+chrX Cufflinks transcript 39881431 39881678 1000 . . gene_id "CUFF.277419"; transcript_id "CUFF.277419.1"; FPKM "42.1683560109"; frac "1.000000"; conf_lo "24.187709"; conf_hi "60.149003"; cov "2.395161"; seq "AGCTAAAAAGAGTCCTTTTCTGACAGAAAGGCTGGACTTCTCCTTTTCACCGTTTCTCTTACTGATGCTTTTGCCAGAAGAACAGTAAAGATTTAGACACTGTCATGATTCATACACGTAAAATATTTTTCAAGGACACAATCTGATATACTAACATTTATTTAAGAGGTTAAAGTCCACCACTAAATCTAAGGAAAGATTTTTAACTGCCAAACACATTTCCTTTGACAAATAATGTAAGATGACAA";
+chrX Cufflinks transcript 148249672 148249713 1000 . . gene_id "CUFF.282847"; transcript_id "CUFF.282847.1"; FPKM "56.5895686726"; frac "1.000000"; conf_lo "5.974320"; conf_hi "107.204818"; cov "3.214286"; seq "AATGCTAGTATGAACAGTGGGAGGAATGAGCAAAATGTTACA";
+chrX Cufflinks transcript 148481505 148482455 1000 + . gene_id "CUFF.282965"; transcript_id "CUFF.282965.1"; FPKM "40.1706233958"; frac "1.000000"; conf_lo "16.978103"; conf_hi "63.363144"; cov "2.281690"; seq "CGCCACAACCTGCTACAGGCCTGTAAGATGCAGGACATCAAACTGCCACTGTCAAAGGGCACCATGGATGATATTAGTCAGGAAGAAGTGAGTATTATGGTGGGTGGTAGGAGTCATCTATGAATATTTAACCAGTAATGGGAGATTACAGATGGCCAGGAAGGGCAGGCAACAGATAGGACCACATAGAGTTGTGAGGGGCATAAAGATGGATGCAGAAGAAATGTGGCAAGGTGGAAGTAGTGAAGTCAGGCTTTGGTATGAGAGAGACATTGATTTGAGAGGAGAGCTGCAAGCCAGTGAGTACTCAGAAAGACCAAGAATGGGTCATTAATCTTAAGGATTTGAGCTCTTAGCTGCAGCAGATACTGGGCATGGGTAGGAGTGAGAATTGAGGAGCAGAGGAAGATGGGAAACTGGAGAACCTAAGGAGACTGATAGCTTAGCTGCAGTAAGGGAGGTTGGCCAGAAGAGGGTTGGGTAGGGGACTCAGCAAGGCAGAACTAAGGAAGCTTAGGTGGAGGGGAAGGAACAACATCTGAGCAACTAAAGCACTCTATCAACTGGAAGTGCAAGATGGTAGTGAGGGGTGGACAGGTGTAACTGAGTAACTCTTTGTAGGTAGCCTTTCAGTTTAATTCAGTAAAATATTTTGAACACTAGTATTCCAGATACTGGTAGGCCATGACTTAACCATTCCTAATGTTAATCTCAGCTGTGCTAGCTGAGCTTGTGTTCACATTAGACATGAAGAAACTTAGTAAAAGGTAGAGCCCAG
TTTTCGGTTTGGACCTTCCTGTTGGCCTCTGCTTCCGTGCCATCTAGCAAAGGAGTTCCTAATCTCTAGAGGGATACAAATGACTAGTCTGCTCCATCTGCCTCTTCCAACATTGCAGGGTAGCTCCCAGGGAGAAGAGTCAGTGAGTGGTTCCCAGAGAACATCCAGTATCT";
--- a/lib/galaxy/tools/util/gff_util.py
+++ b/lib/galaxy/tools/util/gff_util.py
@@ -6,23 +6,37 @@ from bx.intervals.io import NiceReaderWr
class GFFReaderWrapper( NiceReaderWrapper ):
"""
- Reader wrapper converts GFF format--starting and ending coordinates are 1-based, closed--to the 'traditional' interval format--0 based,
- half-open. This is useful when using GFF files as inputs to tools that expect traditional interval format.
+ Reader wrapper converts GFF format--starting and ending coordinates are 1-based, closed--to the
+ 'traditional'/BED interval format--0 based, half-open. This is useful when using GFF files as inputs
+ to tools that expect traditional interval format.
"""
def parse_row( self, line ):
- interval = GenomicInterval( self, line.split( "\t" ), self.chrom_col, self.start_col, self.end_col, self.strand_col, self.default_strand, fix_strand=self.fix_strand )
- # Change from 1-based to 0-based format.
- interval.start -= 1
- # Add 1 to end to move from closed to open format for end coordinate.
- interval.end += 1
+ interval = GenomicInterval( self, line.split( "\t" ), self.chrom_col, self.start_col, self.end_col, \
+ self.strand_col, self.default_strand, fix_strand=self.fix_strand )
+ interval = convert_gff_coords_to_bed( interval )
return interval
-def convert_to_gff_coordinates( interval ):
+def convert_bed_coords_to_gff( interval ):
"""
- Converts a GenomicInterval's coordinates to GFF format.
+ Converts an interval object's coordinates from BED format to GFF format. Accepted object types include
+ GenomicInterval and list (where the first element in the list is the interval's start, and the second
+ element is the interval's end).
"""
if type( interval ) is GenomicInterval:
interval.start += 1
- interval.end -= 1
- return interval
+ elif type ( interval ) is list:
+ interval[ 0 ] += 1
return interval
+
+def convert_gff_coords_to_bed( interval ):
+ """
+ Converts an interval object's coordinates from GFF format to BED format. Accepted object types include
+ GenomicInterval and list (where the first element in the list is the interval's start, and the second
+ element is the interval's end).
+ """
+ if type( interval ) is GenomicInterval:
+ interval.start -= 1
+ elif type ( interval ) is list:
+ interval[ 0 ] -= 1
+ return interval
+
1
0