galaxy-commits
Threads by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- 15302 discussions
galaxy-dist commit ecc1cefbccba: Enhance GFFReader to read and return complete features (genes/transcripts), which are composed of multiple intervals/blocks. This required hacking around a couple limitations of bx-python, but these can be easily fixed when bx-python is updated. Use enhanced functionality to correctly create converted datasets for visualizing GFF files.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1289591537 18000
# Node ID ecc1cefbccba6135f824f9573f06c130fd6d08b4
# Parent b124f54952dee106f4ca87ea89a7f828c41562c3
Enhance GFFReader to read and return complete features (genes/transcripts), which are composed of multiple intervals/blocks. This required hacking around a couple limitations of bx-python, but these can be easily fixed when bx-python is updated. Use enhanced functionality to correctly create converted datasets for visualizing GFF files.
Also updated GOPS tools to use a simpler GFF reader wrapper to read in intervals and convert to BED coordinates.
--- a/tools/new_operations/gops_subtract.py
+++ b/tools/new_operations/gops_subtract.py
@@ -44,11 +44,11 @@ def main():
# Set readers to handle either GFF or default format.
if in1_gff_format:
- in1_reader_wrapper = GFFReaderWrapper
+ in1_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in1_reader_wrapper = NiceReaderWrapper
if in2_gff_format:
- in2_reader_wrapper = GFFReaderWrapper
+ in2_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in2_reader_wrapper = NiceReaderWrapper
--- a/tools/new_operations/gops_intersect.py
+++ b/tools/new_operations/gops_intersect.py
@@ -44,11 +44,11 @@ def main():
# Set readers to handle either GFF or default format.
if in1_gff_format:
- in1_reader_wrapper = GFFReaderWrapper
+ in1_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in1_reader_wrapper = NiceReaderWrapper
if in2_gff_format:
- in2_reader_wrapper = GFFReaderWrapper
+ in2_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in2_reader_wrapper = NiceReaderWrapper
@@ -66,10 +66,10 @@ def main():
fix_strand=True )
out_file = open( out_fname, "w" )
-
+
try:
for line in intersect( [g1,g2], pieces=pieces, mincols=mincols ):
- if type( line ) == GenomicInterval:
+ if isinstance( line, GenomicInterval ):
if in1_gff_format:
line = convert_bed_coords_to_gff( line )
out_file.write( "%s\n" % "\t".join( line.fields ) )
--- /dev/null
+++ b/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.py
@@ -0,0 +1,55 @@
+#!/usr/bin/env python
+
+"""
+Convert from GFF file to interval index file.
+
+usage:
+ python gff_to_interval_index_converter.py [input] [output]
+"""
+
+from __future__ import division
+
+import sys, fileinput
+from galaxy import eggs
+import pkg_resources; pkg_resources.require( "bx-python" )
+from galaxy.tools.util.gff_util import *
+from bx.interval_index_file import Indexes
+
+def main():
+ # Arguments
+ input_fname, out_fname = sys.argv[1:]
+
+ # Do conversion.
+ chr_col, start_col, end_col, strand_col = ( 0, 3, 4, 6 )
+ index = Indexes()
+ offset = 0
+ reader_wrapper = GFFReaderWrapper( fileinput.FileInput( input_fname ),
+ chrom_col=chr_col,
+ start_col=start_col,
+ end_col=end_col,
+ strand_col=strand_col,
+ fix_strand=True )
+ for feature in list( reader_wrapper ):
+ # TODO: need to address comments:
+ # if comment:
+ # increment_offset.
+
+ # Add feature; index expects BED coordinates.
+ convert_gff_coords_to_bed( feature )
+ index.add( feature.chrom, feature.start, feature.end, offset )
+
+ # Increment offset by feature length; feature length is all
+ # intervals/lines that comprise feature.
+ feature_len = 0
+ for interval in feature.intervals:
+ # HACK: +1 for EOL char. Need bx-python to provide raw_line itself
+ # b/c TableReader strips EOL characters, thus changing the line
+ # length.
+ feature_len += len( interval.raw_line ) + 1
+ offset += feature_len
+
+ index.write( open(out_fname, "w") )
+
+if __name__ == "__main__":
+ main()
+
--- a/lib/galaxy/datatypes/converters/interval_to_summary_tree_converter.py
+++ b/lib/galaxy/datatypes/converters/interval_to_summary_tree_converter.py
@@ -14,7 +14,7 @@ import pkg_resources; pkg_resources.requ
from galaxy.visualization.tracks.summary import *
from bx.intervals.io import *
from bx.cookbook import doc_optparse
-from galaxy.tools.util.gff_util import GFFReaderWrapper
+from galaxy.tools.util.gff_util import *
def main():
# Read options, args.
@@ -40,9 +40,12 @@ def main():
strand_col=strand_col,
fix_strand=True )
st = SummaryTree(block_size=25, levels=6, draw_cutoff=150, detail_cutoff=30)
- for line in list( reader_wrapper ):
- if type( line ) is GenomicInterval:
- st.insert_range( line.chrom, long( line.start ), long( line.end ) )
+ for feature in list( reader_wrapper ):
+ if isinstance( feature, GenomicInterval ):
+ # Tree expects BED coordinates.
+ if type( feature ) is GFFFeature:
+ convert_gff_coords_to_bed( feature )
+ st.insert_range( feature.chrom, long( feature.start ), long( feature.end ) )
st.write(out_fname)
--- a/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.xml
+++ b/lib/galaxy/datatypes/converters/gff_to_interval_index_converter.xml
@@ -1,6 +1,6 @@
-<tool id="CONVERTER_gff_to_interval_index_0" name="Convert BED to Interval Index" version="1.0.0" hidden="true">
+<tool id="CONVERTER_gff_to_interval_index_0" name="Convert GFF to Interval Index" version="1.0.0" hidden="true"><!-- <description>__NOT_USED_CURRENTLY_FOR_CONVERTERS__</description> -->
- <command interpreter="python">interval_to_interval_index_converter.py $input1 $output1 --gff</command>
+ <command interpreter="python">gff_to_interval_index_converter.py $input1 $output1</command><inputs><page><param format="gff" name="input1" type="data" label="Choose GFF file"/>
--- a/tools/new_operations/flanking_features.py
+++ b/tools/new_operations/flanking_features.py
@@ -153,11 +153,11 @@ def main():
# Set readers to handle either GFF or default format.
if in1_gff_format:
- in1_reader_wrapper = GFFReaderWrapper
+ in1_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in1_reader_wrapper = NiceReaderWrapper
if in2_gff_format:
- in2_reader_wrapper = GFFReaderWrapper
+ in2_reader_wrapper = GFFIntervalToBEDReaderWrapper
else:
in2_reader_wrapper = NiceReaderWrapper
--- a/lib/galaxy/tools/util/gff_util.py
+++ b/lib/galaxy/tools/util/gff_util.py
@@ -2,25 +2,173 @@
Provides utilities for working with GFF files.
"""
-from bx.intervals.io import NiceReaderWrapper, GenomicInterval
+from bx.intervals.io import *
+
+class GFFInterval( GenomicInterval ):
+ """
+ A GFF interval, including attributes. If file is strictly a GFF file,
+ only attribute is 'group.'
+ """
+ def __init__( self, reader, fields, chrom_col, start_col, end_col, strand_col, default_strand, \
+ fix_strand=False, raw_line='' ):
+ GenomicInterval.__init__( self, reader, fields, chrom_col, start_col, end_col, strand_col, \
+ default_strand, fix_strand=fix_strand )
+ self.raw_line = raw_line
+ self.attributes = parse_gff_attributes( fields[8] )
+
+class GFFFeature( GenomicInterval ):
+ """
+ A GFF feature, which can include multiple intervals.
+ """
+ def __init__( self, reader, chrom_col, start_col, end_col, strand_col, default_strand, \
+ fix_strand=False, intervals=[] ):
+ GenomicInterval.__init__( self, reader, intervals[0].fields, chrom_col, start_col, end_col, \
+ strand_col, default_strand, fix_strand=fix_strand )
+ self.intervals = intervals
+ # Use intervals to set feature attributes.
+ for interval in self.intervals:
+ # Error checking.
+ if interval.chrom != self.chrom:
+ raise ValueError( "interval chrom does not match self chrom: %i != %i" % \
+ ( interval.chrom, self.chrom ) )
+ if interval.strand != self.strand:
+ raise ValueError( "interval strand does not match self strand: %s != %s" % \
+ ( interval.strand, self.strand ) )
+ # Set start, end of interval.
+ if interval.start < self.start:
+ self.start = interval.start
+ if interval.end > self.end:
+ self.end = interval.end
+
+class GFFIntervalToBEDReaderWrapper( NiceReaderWrapper ):
+ """
+ Reader wrapper that reads GFF intervals/lines and automatically converts
+ them to BED format.
+ """
+
+ def parse_row( self, line ):
+ # HACK: this should return a GFF interval, but bx-python operations
+ # require GenomicInterval objects and subclasses will not work.
+ 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
class GFFReaderWrapper( NiceReaderWrapper ):
"""
- 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.
+ Reader wrapper for GFF files.
+
+ Wrapper has two major functions:
+ (1) group entries for GFF file (via group column), GFF3 (via id attribute ),
+ or GTF (via gene_id/transcript id);
+ (2) convert coordinates from 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 __init__( self, reader, **kwargs ):
+ """
+ Create wrapper. Defaults are group_entries=False and
+ convert_coords_to_bed=True to support backward compatibility.
+ """
+ NiceReaderWrapper.__init__( self, reader, **kwargs )
+ self.group_entries = kwargs.get( 'group_entries', False )
+ self.convert_coords_to_bed = kwargs.get( 'convert_coords_to_bed', True )
+ self.last_line = None
+ self.cur_offset = 0
+ self.seed_interval = None
+
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 )
- interval = convert_gff_coords_to_bed( interval )
+ interval = GFFInterval( self, line.split( "\t" ), self.chrom_col, self.start_col, \
+ self.end_col, self.strand_col, self.default_strand, \
+ fix_strand=self.fix_strand, raw_line=line )
+ if self.convert_coords_to_bed:
+ interval = convert_gff_coords_to_bed( interval )
return interval
+ def next( self ):
+ """ Returns next GFFFeature. """
+
+ #
+ # Helper function.
+ #
+
+ def handle_parse_error( parse_error ):
+ """ Actions to take when ParseError found. """
+ if self.outstream:
+ if self.print_delegate and hasattr(self.print_delegate,"__call__"):
+ self.print_delegate( self.outstream, e, self )
+ self.skipped += 1
+ # no reason to stuff an entire bad file into memmory
+ if self.skipped < 10:
+ self.skipped_lines.append( ( self.linenum, self.current_line, str( e ) ) )
+
+ #
+ # Get next GFFFeature
+ #
+
+ # If there is no seed interval, set one. Also, if there are no more
+ # intervals to read, this is where iterator dies.
+ if not self.seed_interval:
+ while not self.seed_interval:
+ try:
+ self.seed_interval = GenomicIntervalReader.next( self )
+ except ParseError, e:
+ handle_parse_error( e )
+
+ # Initialize feature name from seed.
+ feature_group = self.seed_interval.attributes.get( 'group', None ) # For GFF
+ feature_id = self.seed_interval.attributes.get( 'id', None ) # For GFF3
+ feature_gene_id = self.seed_interval.attributes.get( 'gene_id', None ) # For GTF
+ feature_transcript_id = self.seed_interval.attributes.get( 'transcript_id', None ) # For GTF
+
+ # Read all intervals associated with seed.
+ feature_intervals = []
+ feature_intervals.append( self.seed_interval )
+ while True:
+ try:
+ interval = GenomicIntervalReader.next( self )
+ except StopIteration, e:
+ # No more intervals to read, but last feature needs to be
+ # returned.
+ interval = None
+ break
+ except ParseError, e:
+ handle_parse_error( e )
+
+ # If interval not associated with feature, break.
+ group = interval.attributes.get( 'group', None )
+ if group and feature_group != group:
+ break
+ id = interval.attributes.get( 'id', None )
+ if id and feature_id != id:
+ break
+ gene_id = interval.attributes.get( 'gene_id', None )
+ transcript_id = interval.attributes.get( 'transcript_id', None )
+ if transcript_id and transcript_id != feature_transcript_id and gene_id and \
+ gene_id != feature_gene_id:
+ break
+
+ # Interval associated with feature.
+ feature_intervals.append( interval )
+
+ # Last interval read is the seed for the next interval.
+ self.seed_interval = interval
+
+ # Return GFF feature with all intervals.
+ return GFFFeature( self, self.chrom_col, self.start_col, self.end_col, self.strand_col, \
+ self.default_strand, fix_strand=self.fix_strand, \
+ intervals=feature_intervals )
+
+
def convert_bed_coords_to_gff( interval ):
"""
- 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).
+ 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
@@ -30,9 +178,10 @@ def convert_bed_coords_to_gff( 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).
+ 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
@@ -42,10 +191,15 @@ def convert_gff_coords_to_bed( interval
def parse_gff_attributes( attr_str ):
"""
- Parses a GFF/GTF attribute string and returns a dictionary of name-value pairs.
- The general format for a GFF3 attributes string is name1=value1;name2=value2
- The general format for a GTF attribute string is name1 "value1" ; name2 "value2"
- """
+ Parses a GFF/GTF attribute string and returns a dictionary of name-value
+ pairs. The general format for a GFF3 attributes string is
+ name1=value1;name2=value2
+ The general format for a GTF attribute string is
+ name1 "value1" ; name2 "value2"
+ The general format for a GFF attribute string is a single string that
+ denotes the interval's group; in this case, method returns a dictionary
+ with a single key-value pair, and key name is 'group'
+ """
attributes_list = attr_str.split(";")
attributes = {}
for name_value_pair in attributes_list:
@@ -53,6 +207,9 @@ def parse_gff_attributes( attr_str ):
pair = name_value_pair.strip().split(" ")
if len( pair ) == 1:
pair = name_value_pair.strip().split("=")
+ if len( pair ) == 1:
+ # Could not split for some reason -- raise exception?
+ continue
if pair == '':
continue
name = pair[0].strip()
@@ -61,4 +218,9 @@ def parse_gff_attributes( attr_str ):
# Need to strip double quote from values
value = pair[1].strip(" \"")
attributes[ name ] = value
+
+ if len( attributes ) == 0:
+ # Could not split attributes string, so entire string must be
+ # 'group' attribute. This is the case for strictly GFF files.
+ attributes['group'] = attr_str
return attributes
1
0
galaxy-dist commit b124f54952de: Small fixes and refactor to workflows: remove unused ensure_popup_helper(), and fix extra comma that was returning error in IE.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289591135 18000
# Node ID b124f54952dee106f4ca87ea89a7f828c41562c3
# Parent b7f712cecaa9f527f1161f923ebe798eba526cb6
Small fixes and refactor to workflows: remove unused ensure_popup_helper(), and fix extra comma that was returning error in IE.
--- a/templates/workflow/editor.mako
+++ b/templates/workflow/editor.mako
@@ -13,7 +13,6 @@
ensure_dd_helper();
make_left_panel( $("#left"), $("#center"), $("#left-border" ) );
make_right_panel( $("#right"), $("#center"), $("#right-border" ) );
- ensure_popup_helper();
## handle_minwidth_hint = rp.handle_minwidth_hint;
</script></%def>
@@ -82,8 +81,7 @@
"${initial_text}": function() {
// Show/hide menu and update vars, user preferences.
var menu = $('#tool-search');
- if (menu.is(":visible"))
- {
+ if (menu.is(":visible")) {
// Hide menu.
pref_value = "False";
menu_option_text = "Search Tools";
@@ -91,9 +89,7 @@
// Reset search.
reset_tool_search(true);
- }
- else
- {
+ } else {
// Show menu.
pref_value = "True";
menu_option_text = "Hide Search";
@@ -158,18 +154,17 @@
var next = this_label.next();
var no_visible_tools = true;
// Look through tools following label and, if none are visible, hide label.
- while (next.length != 0 && next.hasClass("toolTitle"))
- {
- if (next.is(":visible"))
- {
+ while (next.length !== 0 && next.hasClass("toolTitle")) {
+ if (next.is(":visible")) {
no_visible_tools = false;
break;
+ } else {
+ next = next.next();
}
- else
- next = next.next();
}
- if (no_visible_tools)
+ if (no_visible_tools) {
this_label.hide();
+ }
});
} else {
$("#search-no-results").show();
@@ -211,9 +206,9 @@
scroll_to_nodes();
canvas_manager.draw_overview();
// Determine if any parameters were 'upgraded' and provide message
- upgrade_message = ""
- $.each( data['upgrade_messages'], function( k, v ) {
- upgrade_message += ( "<li>Step " + ( parseInt(k) + 1 ) + ": " + workflow.nodes[k].name + "<ul>");
+ upgrade_message = "";
+ $.each( data.upgrade_messages, function( k, v ) {
+ upgrade_message += ( "<li>Step " + ( parseInt(k, 10) + 1 ) + ": " + workflow.nodes[k].name + "<ul>");
$.each( v, function( i, vv ) {
upgrade_message += "<li>" + vv +"</li>";
});
@@ -256,7 +251,7 @@
"Layout": layout_editor,
"Save" : save_current_workflow,
##"Load a Workflow" : load_workflow,
- "Close": close_editor,
+ "Close": close_editor
});
function edit_workflow_outputs(){
@@ -297,21 +292,21 @@
workflow.has_changes = true;
});
$('#workflow-output-area').show();
- };
+ }
function layout_editor() {
workflow.layout();
workflow.fit_canvas_to_nodes();
scroll_to_nodes();
canvas_manager.draw_overview();
- };
+ }
function edit_workflow_attributes() {
workflow.clear_active_node();
$('.right-content').hide();
$('#edit-attributes').show();
- };
+ }
$.jStore.engineReady(function() {
// On load, set the size to the pref stored in local storage if it exists
@@ -354,7 +349,11 @@
// Lets the overview be toggled visible and invisible, adjusting the arrows accordingly
$("#close-viewport").click( function() {
- $("#overview-border").css("right") == "0px" ? hide_overview() : show_overview();
+ if ( $("#overview-border").css("right") === "0px" ) {
+ hide_overview();
+ } else {
+ show_overview();
+ }
});
// Unload handler
@@ -405,7 +404,7 @@
function scroll_to_nodes() {
var cv = $("#canvas-viewport");
- var cc = $("#canvas-container")
+ var cc = $("#canvas-container");
var top, left;
if ( cc.width() < cv.width() ) {
left = ( cv.width() - cc.width() ) / 2;
@@ -436,14 +435,14 @@
node.init_field_data( data );
},
error: function( x, e ) {
- var m = "error loading field data"
- if ( x.status == 0 ) {
- m += ", server unavailable"
+ var m = "error loading field data";
+ if ( x.status === 0 ) {
+ m += ", server unavailable";
}
node.error( m );
}
});
- };
+ }
function add_node_for_module( type, title ) {
node = prebuild_node( type, title );
@@ -466,7 +465,7 @@
node.error( m );
}
});
- };
+ }
<%
from galaxy.jobs.actions.post import ActionBox
@@ -500,12 +499,12 @@
}
function new_pja(action_type, target, node){
- if (node.post_job_actions == undefined){
+ if (node.post_job_actions === undefined){
//New tool node, set up dict.
node.post_job_actions = {};
}
- if (node.post_job_actions[action_type+target] == undefined){
- var new_pja = new Object();
+ if (node.post_job_actions[action_type+target] === undefined){
+ var new_pja = {};
new_pja.action_type = action_type;
new_pja.output_name = target;
node.post_job_actions[action_type+target] = null;
@@ -513,7 +512,7 @@
display_pja(new_pja, node);
workflow.active_form_has_changes = true;
return true;
- }else{
+ } else {
return false;
}
}
@@ -576,7 +575,7 @@
var value = $(this).attr( 'value' );
options[ $(this).text() ] = function() {
$(form).append( "<input type='hidden' name='"+name+"' value='"+value+"' />" ).submit();
- }
+ };
});
b.insertAfter( this );
$(this).remove();
@@ -613,9 +612,9 @@
"Don't Save": do_close
} );
} else {
- window.document.location = "${next_url}"
+ window.document.location = "${next_url}";
}
- }
+ };
var save_current_workflow = function ( eventObj, success_callback ) {
show_modal( "Saving workflow", "progress" );
@@ -634,14 +633,14 @@
type: "POST",
data: {
id: "${trans.security.encode_id( stored.id )}",
- workflow_data: function() { return JSON.stringify( workflow.to_simple() ) },
+ workflow_data: function() { return JSON.stringify( workflow.to_simple() ); },
"_": "true"
},
dataType: 'json',
success: function( data ) {
var body = $("<div></div>").text( data.message );
if ( data.errors ) {
- body.addClass( "warningmark" )
+ body.addClass( "warningmark" );
var errlist = $( "<ul/>" );
$.each( data.errors, function( i, v ) {
$("<li></li>").text( v ).appendTo( errlist );
@@ -663,7 +662,7 @@
}
}
});
- }
+ };
// We bind to ajaxStop because of auto-saving, since the form submission ajax
// call needs to be completed so that the new data is saved
@@ -677,7 +676,7 @@
} else {
savefn(success_callback);
}
- }
+ };
</script></%def>
1
0
galaxy-dist commit caed55b53f5a: Allows the downloading of metadata files associated with datasets (such as bai indices for bam files). This is done by adding a dropdown menu to the Save icon of appropriate datasets. Could potentially be modified to access implicitly converted datatypes as well in the future. Closes #410
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Kanwei Li <kanwei(a)gmail.com>
# Date 1289525191 18000
# Node ID caed55b53f5a811226e0bfa1c177e7b3e57a909a
# Parent ff7327f2946e9121139cefbf4a45dba2791b7162
Allows the downloading of metadata files associated with datasets (such as bai indices for bam files). This is done by adding a dropdown menu to the Save icon of appropriate datasets. Could potentially be modified to access implicitly converted datatypes as well in the future. Closes #410
--- a/templates/root/history_common.mako
+++ b/templates/root/history_common.mako
@@ -1,8 +1,10 @@
<% _=n_ %>
## Render the dataset `data` as history item, using `hid` as the displayed id
<%def name="render_dataset( data, hid, show_deleted_on_refresh = False, for_editing = True )">
- <a name="${trans.security.encode_id( data.id )}"></a><%
+ dataset_id = trans.security.encode_id( data.id )
+ from galaxy.datatypes.metadata import FileParameter
+
if data.state in ['no state','',None]:
data_state = "queued"
else:
@@ -41,7 +43,6 @@
%endif
%else:
<%
- dataset_id = trans.security.encode_id( data.id )
if for_editing:
display_url = h.url_for( controller='dataset', action='display', dataset_id=dataset_id, preview=True, filename='' )
else:
@@ -117,10 +118,25 @@
%endif
</div><div class="info">${_('Info: ')}${data.display_info()}</div>
- <div>
- <% dataset_id=trans.security.encode_id( data.id ) %>
+ <div>
%if data.has_data():
+
+ ## Check for downloadable metadata files
+ <% meta_files = [ k for k in data.metadata.spec.keys() if isinstance( data.metadata.spec[k].param, FileParameter ) ] %>
+ %if meta_files:
+ <div popupmenu="dataset-${dataset_id}-popup">
+ %for file_type in meta_files:
+ <a class="action-button" href="${h.url_for( controller='dataset', action='get_metadata_file', hda_id=dataset_id, metadata_type=file_type )}">
+ Download ${file_type}</a>
+ %endfor
+ </div>
+ <div style="float:left;" class="menubutton split popup" id="dataset-${dataset_id}-popup">
+ %endif
<a href="${h.url_for( controller='dataset', action='display', dataset_id=dataset_id, to_ext=data.ext )}" title="Save" class="icon-button disk tooltip"></a>
+ %if meta_files:
+ </div>
+ %endif
+
%if for_editing:
<a href="${h.url_for( controller='tool_runner', action='rerun', id=data.id )}" target="galaxy_main" title="Run this job again" class="icon-button arrow-circle tooltip"></a>
%if app.config.get_bool( 'enable_tracks', False ) and data.ext in app.datatypes_registry.get_available_tracks():
--- a/templates/root/history.mako
+++ b/templates/root/history.mako
@@ -277,6 +277,7 @@ var updater_callback = function ( tracke
// Keep going (if there are still any items to track)
updater( tracked_datasets );
}
+ make_popup_menus();
},
error: function() {
// Just retry, like the old method, should try to be smarter
--- a/lib/galaxy/web/controllers/dataset.py
+++ b/lib/galaxy/web/controllers/dataset.py
@@ -305,7 +305,18 @@ class DatasetInterface( BaseController,
return trans.show_error_message( msg )
-
+ @web.expose
+ def get_metadata_file(self, trans, hda_id, metadata_type):
+ """ Allows the downloading of metadata files associated with datasets (eg. bai index for bam files) """
+ data = trans.sa_session.query( trans.app.model.HistoryDatasetAssociation ).get( trans.security.decode_id( hda_id ) )
+ if not data or not trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ):
+ return trans.show_error_message( "You are not allowed to access this dataset" )
+
+ valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
+ fname = ''.join(c in valid_chars and c or '_' for c in data.name)[0:150]
+ trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s].%s" % (data.hid, fname, metadata_type)
+ return open(data.metadata.get(metadata_type).file_name)
+
@web.expose
def display(self, trans, dataset_id=None, preview=False, filename=None, to_ext=None, **kwd):
"""Catches the dataset id and displays file contents as directed"""
@@ -323,8 +334,7 @@ class DatasetInterface( BaseController,
data = None
if not data:
raise paste.httpexceptions.HTTPRequestRangeNotSatisfiable( "Invalid reference dataset id: %s." % str( dataset_id ) )
- current_user_roles = trans.get_current_user_roles()
- if not trans.app.security_agent.can_access_dataset( current_user_roles, data.dataset ):
+ if not trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), data.dataset ):
return trans.show_error_message( "You are not allowed to access this dataset" )
if data.state == trans.model.Dataset.states.UPLOAD:
@@ -358,8 +368,7 @@ class DatasetInterface( BaseController,
if not to_ext:
to_ext = data.extension
valid_chars = '.,^_-()[]0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
- fname = data.name
- fname = ''.join(c in valid_chars and c or '_' for c in fname)[0:150]
+ fname = ''.join(c in valid_chars and c or '_' for c in data.name)[0:150]
trans.response.headers["Content-Disposition"] = "attachment; filename=Galaxy%s-[%s].%s" % (data.hid, fname, to_ext)
return open( data.file_name )
if not os.path.exists( data.file_name ):
1
0
galaxy-dist commit 122aaabe2c7e: Workaround Issue 397 using 'if' in Cheetah template to avoid hidden parameters
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286965628 -3600
# Node ID 122aaabe2c7eb48726f65233370926b838b6b444
# Parent 10d0ffe5b7e22b2d122945ab5b7fa951a18c6e4a
Workaround Issue 397 using 'if' in Cheetah template to avoid hidden parameters
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -12,11 +12,12 @@ blastn
#end if
-task $blast_type
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.strand
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.strand
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ blastn
-word_size $adv_opts.word_size
#end if
$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -78,13 +81,7 @@ blastn
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <param name="ungapped" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'level window linker' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with DUST)" truevalue="-dust yes" falsevalue="-dust no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -12,11 +12,12 @@ blastp
#end if
-task $blast_type
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.matrix
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.matrix
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -27,6 +28,8 @@ blastp
#end if
##Ungapped disabled for now - see comments below
##$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -73,16 +76,7 @@ blastp
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <!--
- Ungapped disabled for now, see comments below
- <param name="ungapped" type="hidden" value="" />
- -->
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -11,12 +11,13 @@ tblastx
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
+-out $output1
+$out_format
+-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
$adv_opts.filter_query
$adv_opts.strand
$adv_opts.matrix
--out $output1
-$out_format
--num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -25,6 +26,8 @@ tblastx
#if (str($adv_opts.word_size) and int(str($adv_opts.word_size)) > 0):
-word_size $adv_opts.word_size
#end if
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -67,13 +70,7 @@ tblastx
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -11,12 +11,13 @@ blastx
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
+-out $output1
+$out_format
+-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
$adv_opts.filter_query
$adv_opts.strand
$adv_opts.matrix
--out $output1
-$out_format
--num_threads 8
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ blastx
-word_size $adv_opts.word_size
#end if
$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Nucleotide query sequence(s)"/>
@@ -68,14 +71,7 @@ blastx
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="strand" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <param name="ungapped" type="hidden" value="" />
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -11,11 +11,12 @@ tblastn
-subject "$db_opts.subject"
#end if
-evalue $evalue_cutoff
-$adv_opts.filter_query
-$adv_opts.matrix
-out $output1
$out_format
-num_threads 8
+#if $adv_opts.adv_opts_selector=="advanced":
+$adv_opts.filter_query
+$adv_opts.matrix
## Need int(str(...)) because $adv_opts.max_hits is an InputValueWrapper object not a string
## Note -max_target_seqs overrides -num_descriptions and -num_alignments
#if (str($adv_opts.max_hits) and int(str($adv_opts.max_hits)) > 0):
@@ -26,6 +27,8 @@ tblastn
#end if
##Ungapped disabled for now - see comments below
##$adv_opts.ungapped
+## End of advanced options:
+#end if
</command><inputs><param name="query" type="data" format="fasta" label="Protein query sequence(s)"/>
@@ -68,16 +71,7 @@ tblastn
<option value="basic" selected="True">Hide Advanced Options</option><option value="advanced">Show Advanced Options</option></param>
- <when value="basic">
- <param name="filter_query" type="hidden" value="" />
- <param name="matrix" type="hidden" value="" />
- <param name="max_hits" type="hidden" value="" />
- <param name="word_size" type="hidden" value="" />
- <!--
- Ungapped disabled for now, see comments below
- <param name="ungapped" type="hidden" value="" />
- -->
- </when>
+ <when value="basic" /><when value="advanced"><!-- Could use a select (yes, no, other) where other allows setting 'window locut hicut' --><param name="filter_query" type="boolean" label="Filter out low complexity regions (with SEG)" truevalue="-seg yes" falsevalue="-seg no" checked="true" />
1
0
galaxy-dist commit dfc848840870: Various sample tracking bug fixes: samples no longer require bar codes, change all references to 'barcode' to be 'bar_code' since that is what the model uses, and mixing the 2 is not maintainable, enhance sample popup menu options, fix broken logic that handles bulk sample library and folderr changes.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289503442 18000
# Node ID dfc848840870fa9936a69e62322446fcb940fb40
# Parent ca23ea683d26df004e666ede82950c712e3ac637
Various sample tracking bug fixes: samples no longer require bar codes, change all references to 'barcode' to be 'bar_code' since that is what the model uses, and mixing the 2 is not maintainable, enhance sample popup menu options, fix broken logic that handles bulk sample library and folderr changes.
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -725,7 +725,7 @@ class RequestsCommon( BaseController, Us
search_type = params.get( 'search_type', '' )
request_states = util.listify( params.get( 'request_states', '' ) )
samples = []
- if search_type == 'barcode':
+ if search_type == 'bar_code':
samples = trans.sa_session.query( trans.model.Sample ) \
.filter( and_( trans.model.Sample.table.c.deleted==False,
func.lower( trans.model.Sample.table.c.bar_code ).like( "%" + search_string.lower() + "%" ) ) ) \
@@ -763,7 +763,7 @@ class RequestsCommon( BaseController, Us
display='checkboxes' )
# Build the search_type SelectField
selected_value = kwd.get( 'search_type', 'sample name' )
- types = [ 'sample name', 'barcode', 'dataset' ]
+ types = [ 'sample name', 'bar_code', 'dataset' ]
search_type = build_select_field( trans, types, 'self', 'search_type', selected_value=selected_value, refresh_on_change=False )
# Build the search_box TextField
search_box = TextField( 'search_box', 50, kwd.get('search_box', '' ) )
@@ -846,7 +846,7 @@ class RequestsCommon( BaseController, Us
# Append the new sample to the current list of samples for the request
displayable_sample_widgets.append( dict( id=None,
name=name,
- barcode='',
+ bar_code='',
library=None,
library_id=library_id,
folder=None,
@@ -999,7 +999,7 @@ class RequestsCommon( BaseController, Us
**kwd )
displayable_sample_widgets.append( dict( id=None,
name=row[0],
- barcode='',
+ bar_code='',
library=None,
folder=None,
library_select_field=library_select_field,
@@ -1029,7 +1029,10 @@ class RequestsCommon( BaseController, Us
editing_samples=False )
def __save_samples( self, trans, cntrller, request, samples, **kwd ):
# Here we handle saving all new samples added by the user as well as saving
- # changes to any subset of the request's samples.
+ # changes to any subset of the request's samples. A sample will not have an
+ # associated SampleState until the request is submitted, at which time the
+ # sample is automatically associated with the first SampleState configured by
+ # the admin for the request's RequestType.
params = util.Params( kwd )
message = util.restore_text( params.get( 'message', '' ) )
status = params.get( 'status', 'done' )
@@ -1065,7 +1068,7 @@ class RequestsCommon( BaseController, Us
# Send the encoded sample_ids to update_sample_state.
# TODO: make changes necessary to just send the samples...
encoded_selected_sample_ids = self.__get_encoded_selected_sample_ids( trans, request, **kwd )
- # Make sure all samples have a unique barcode if the state is changing
+ # Make sure all samples have a unique bar_code if the state is changing
for sample_index in range( len( samples ) ):
current_sample = samples[ sample_index ]
if current_sample is None:
@@ -1073,13 +1076,15 @@ class RequestsCommon( BaseController, Us
# on which to perform the action.
continue
request_sample = request.samples[ sample_index ]
- bc_message = self.__validate_barcode( trans, request_sample, current_sample[ 'barcode' ] )
- if bc_message:
- #status = 'error'
- message += bc_message
- kwd[ 'message' ] = message
- del kwd[ 'save_samples_button' ]
- handle_error( **kwd )
+ bar_code = current_sample[ 'bar_code' ]
+ if bar_code:
+ # If the sample has a new bar_code, make sure it is unique.
+ bc_message = self.__validate_bar_code( trans, request_sample, bar_code )
+ if bc_message:
+ message += bc_message
+ kwd[ 'message' ] = message
+ del kwd[ 'save_samples_button' ]
+ handle_error( **kwd )
self.update_sample_state( trans, cntrller, encoded_selected_sample_ids, new_state, comment=sample_event_comment )
return trans.response.send_redirect( web.url_for( controller='requests_common',
cntrller=cntrller,
@@ -1088,18 +1093,22 @@ class RequestsCommon( BaseController, Us
elif sample_operation == 'Select data library and folder':
# TODO: fix the code so that the sample_operation_select_field does not use
# sample_0_library_id as it's name. it should use something like sample_operation_library_id
- # and sample_operation-folder_id because the name sample_0_library_id should belong to the
+ # and sample_operation_folder_id because the name sample_0_library_id should belong to the
# first sample since all other form field values are named like this. The library and folder
# are skewed to be named +1 resulting in the forced use of id_index everywhere...
library_id = params.get( 'sample_0_library_id', 'none' )
folder_id = params.get( 'sample_0_folder_id', 'none' )
library, folder = self.__get_library_and_folder( trans, library_id, folder_id )
+ for sample_index in range( len( samples ) ):
+ current_sample = samples[ sample_index ]
+ current_sample[ 'library' ] = library
+ current_sample[ 'folder' ] = folder
self.__update_samples( trans, cntrller, request, samples, **kwd )
# Samples will not have an associated SampleState until the request is submitted, at which
# time all samples of the request will be set to the first SampleState configured for the
# request's RequestType defined by the admin.
if request.is_submitted:
- # See if all the samples' barcodes are in the same state, and if so send email if configured to.
+ # See if all the samples' bar_codes are in the same state, and if so send email if configured to.
common_state = request.samples_have_common_state
if common_state and common_state.id == request.type.states[1].id:
comment = "All samples of this request are in the (%s) sample state. " % common_state.name
@@ -1136,10 +1145,12 @@ class RequestsCommon( BaseController, Us
status=status,
message=message ) )
def __update_samples( self, trans, cntrller, request, sample_widgets, **kwd ):
- # Determine if the values in kwd require updating the request's samples. The list of
- # sample_widgets must have the same number of objects as request.samples, but some of
- # the objects can be None. Those that are not None correspond to samples selected by
- # the user for performing an action on multiple samples simultaneously.
+ # The list of sample_widgets must have the same number of objects as request.samples,
+ # but some of the objects can be None. Those that are not None correspond to samples
+ # selected by the user for performing an action on multiple samples simultaneously.
+ # The items in the sample_widgets list have already been populated with any changed
+ # param values (changed implies the value in kwd is different from the attribute value
+ # in the database) in kwd before this method is reached.
def handle_error( **kwd ):
kwd[ 'status' ] = 'error'
return trans.response.send_redirect( web.url_for( controller='requests_common',
@@ -1147,12 +1158,6 @@ class RequestsCommon( BaseController, Us
cntrller=cntrller,
**kwd ) )
params = util.Params( kwd )
- sample_operation = params.get( 'sample_operation', 'none' )
- if sample_operation != 'none':
- # These values will be in kwd if the user checked 1 or more checkboxes for performing this action
- # on a set of samples.
- library_id = params.get( 'sample_0_library_id', 'none' )
- folder_id = params.get( 'sample_0_folder_id', 'none' )
for index, sample_widget in enumerate( sample_widgets ):
if sample_widget is not None:
# sample_widget will be None if the user checked sample check boxes and selected an action
@@ -1161,21 +1166,16 @@ class RequestsCommon( BaseController, Us
# Get the sample's form values to see if they have changed.
form_values = trans.sa_session.query( trans.model.FormValues ).get( sample.values.id )
if sample.name != sample_widget[ 'name' ] or \
- sample.bar_code != sample_widget[ 'barcode' ] or \
+ sample.bar_code != sample_widget[ 'bar_code' ] or \
sample.library != sample_widget[ 'library' ] or \
sample.folder != sample_widget[ 'folder' ] or \
form_values.content != sample_widget[ 'field_values' ]:
# Information about this sample has been changed.
sample.name = sample_widget[ 'name' ]
- barcode = sample_widget[ 'barcode' ]
- # The bar_code field requires special handling because after a request is submitted, the
- # state of a sample cannot be changed without a bar_code associated with the sample. Bar
- # codes can only be added to a sample after the request is submitted. Also, a samples will
- # not have an associated SampleState until the request is submitted, at which time the sample
- # is automatically associated with the first SamplesState configured by the admin for the
- # request's RequestType.
- if barcode:
- bc_message = self.__validate_barcode( trans, sample, bar_code )
+ bar_code = sample_widget[ 'bar_code' ]
+ # If the sample has a new bar_code, make sure it is unique.
+ if bar_code:
+ bc_message = self.__validate_bar_code( trans, sample, bar_code )
if bc_message:
kwd[ 'message' ] = bc_message
del kwd[ 'save_samples_button' ]
@@ -1191,7 +1191,7 @@ class RequestsCommon( BaseController, Us
'Bar code associated with the sample' )
trans.sa_session.add( event )
trans.sa_session.flush()
- sample.bar_code = barcode
+ sample.bar_code = bar_code
sample.library = sample_widget[ 'library' ]
sample.folder = sample_widget[ 'folder' ]
form_values.content = sample_widget[ 'field_values' ]
@@ -1281,7 +1281,7 @@ class RequestsCommon( BaseController, Us
# Update the sample attributes from kwd
sample_id = None
name = util.restore_text( params.get( 'sample_%i_name' % index, sample.name ) )
- bar_code = util.restore_text( params.get( 'sample_%i_barcode' % index, sample.bar_code ) )
+ bar_code = util.restore_text( params.get( 'sample_%i_bar_code' % index, sample.bar_code ) )
library_id = util.restore_text( params.get( 'sample_%i_library_id' % id_index, '' ) )
if not library_id and sample.library:
library_id = trans.security.encode_id( sample.library.id )
@@ -1303,7 +1303,7 @@ class RequestsCommon( BaseController, Us
**kwd )
sample_widgets.append( dict( id=sample_id,
name=name,
- barcode=bar_code,
+ bar_code=bar_code,
library=library,
folder=folder,
field_values=field_values,
@@ -1317,7 +1317,7 @@ class RequestsCommon( BaseController, Us
if not name:
break
id_index = index + 1
- bar_code = util.restore_text( params.get( 'sample_%i_barcode' % index, '' ) )
+ bar_code = util.restore_text( params.get( 'sample_%i_bar_code' % index, '' ) )
library_id = util.restore_text( params.get( 'sample_%i_library_id' % id_index, '' ) )
folder_id = util.restore_text( params.get( 'sample_%i_folder_id' % id_index, '' ) )
library, folder = self.__get_library_and_folder( trans, library_id, folder_id )
@@ -1334,7 +1334,7 @@ class RequestsCommon( BaseController, Us
**kwd )
sample_widgets.append( dict( id=None,
name=name,
- barcode=bar_code,
+ bar_code=bar_code,
library=library,
folder=folder,
field_values=field_values,
@@ -1492,31 +1492,24 @@ class RequestsCommon( BaseController, Us
action='edit_samples',
cntrller=cntrller,
**kwd ) )
- def __validate_barcode( self, trans, sample, barcode ):
+ def __validate_bar_code( self, trans, sample, bar_code ):
"""
- Makes sure that the barcode about to be assigned to a sample is globally unique.
- That is, barcodes must be unique across requests in Galaxy sample tracking.
+ Make sure that the bar_code about to be assigned to a sample is globally unique.
+ That is, bar_codes must be unique across requests in Galaxy sample tracking.
+ Bar codes are not required, but if used, they can only be added to a sample after
+ the request is submitted.
"""
message = ''
unique = True
for index in range( len( sample.request.samples ) ):
- # Check for empty bar code
- if not barcode.strip():
- if sample.state.id == sample.request.type.states[0].id:
- # The user has not yet filled in the barcode value, but the sample is
- # 'new', so all is well.
- break
- else:
- message = "Fill in the barcode for sample (%s) before changing it's state." % sample.name
- break
# TODO: Add a unique constraint to sample.bar_code table column
# Make sure bar code is unique
- for sample_with_barcode in trans.sa_session.query( trans.model.Sample ) \
- .filter( trans.model.Sample.table.c.bar_code == barcode ):
- if sample_with_barcode and sample_with_barcode.id != sample.id:
+ for sample_with_bar_code in trans.sa_session.query( trans.model.Sample ) \
+ .filter( trans.model.Sample.table.c.bar_code == bar_code ):
+ if sample_with_bar_code and sample_with_bar_code.id != sample.id:
message = '''The bar code (%s) associated with the sample (%s) belongs to another sample.
Bar codes must be unique across all samples, so use a different bar code
- for this sample.''' % ( barcode, sample.name )
+ for this sample.''' % ( bar_code, sample.name )
unique = False
break
if not unique:
--- a/templates/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -122,7 +122,7 @@
is_rejected = request.is_rejected
is_submitted = sample.request.is_submitted
is_unsubmitted = sample.request.is_unsubmitted
- can_delete_samples = not is_complete
+ can_delete_samples = editing_samples and request.samples and ( ( is_admin and not is_complete ) or is_unsubmitted )
display_checkboxes = editing_samples and ( is_complete or is_rejected or is_submitted )
display_bar_code = request.samples and ( is_complete or is_rejected or is_submitted )
display_datasets = request.samples and ( is_complete or is_submitted )
@@ -153,10 +153,10 @@
%if display_bar_code:
<td valign="top">
%if is_admin:
- <input type="text" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}" size="10"/>
+ <input type="text" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}" size="10"/>
%else:
- ${sample_widget['barcode']}
- <input type="hidden" name="sample_${sample_widget_index}_barcode" value="${sample_widget['barcode']}"/>
+ ${sample_widget['bar_code']}
+ <input type="hidden" name="sample_${sample_widget_index}_bar_code" value="${sample_widget['bar_code']}"/>
%endif
</td>
%endif
@@ -234,7 +234,7 @@
is_submitted = request.is_submitted
is_unsubmitted = request.is_unsubmitted
can_add_samples = request.is_unsubmitted
- can_delete_samples = editing_samples and request.samples and not is_complete
+ can_delete_samples = editing_samples and request.samples and ( ( is_admin and not is_complete ) or is_unsubmitted )
can_edit_samples = request.samples and ( is_admin or not is_complete )
can_select_datasets = is_admin and displayable_sample_widgets and ( is_submitted or is_complete )
can_transfer_datasets = is_admin and request.samples and not request.is_rejected
@@ -280,14 +280,14 @@
<tbody><% trans.sa_session.refresh( request ) %>
## displayable_sample_widgets is a dictionary whose keys are:
- ## id, name, barcode, library, folder, field_values, library_select_field, folder_select_field
+ ## id, name, bar_code, library, folder, field_values, library_select_field, folder_select_field
## A displayable_sample_widget will have an id == None if the widget's associated sample has not
## yet been saved (i.e., the use clicked the "Add sample" button but has not yet clicked the
## "Save" button.
%for sample_widget_index, sample_widget in enumerate( displayable_sample_widgets ):
<%
sample_widget_name = sample_widget[ 'name' ]
- sample_widget_barcode = sample_widget[ 'barcode' ]
+ sample_widget_bar_code = sample_widget[ 'bar_code' ]
sample_widget_library = sample_widget[ 'library' ]
if sample_widget_library:
if cntrller == 'requests':
@@ -309,7 +309,12 @@
<td>
%if sample.state and ( can_select_datasets or can_transfer_datasets ):
## A sample will have a state only after the request has been submitted.
- <% encoded_id = trans.security.encode_id( sample.id ) %>
+ <%
+ encoded_id = trans.security.encode_id( sample.id )
+ transferred_dataset_files = sample.transferred_dataset_files
+ if not transferred_dataset_files:
+ transferred_dataset_files = []
+ %><div style="float: left; margin-left: 2px;" class="menubutton split popup" id="sample-${sample.id}-popup">
${sample.name}
</div>
@@ -317,8 +322,10 @@
%if can_select_datasets:
<li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li>
%endif
- %if sample.untransferred_dataset_files:
- <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ):
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li>
+ %elif sample.datasets and len(sample.datasets ) == len( transferred_dataset_files ):
+ <li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">View transferred datasets</a></li>
%endif
</div>
%else:
@@ -326,7 +333,7 @@
%endif
</td>
%if display_bar_code:
- <td>${sample_widget_barcode}</td>
+ <td>${sample_widget_bar_code}</td>
%endif
%if is_unsubmitted:
<td>Unsubmitted</td>
@@ -361,9 +368,8 @@
<td>
%if is_admin:
<%
- if sample.transferred_dataset_files:
- transferred_dataset_files = sample.transferred_dataset_files
- else:
+ transferred_dataset_files = sample.transferred_dataset_files
+ if not transferred_dataset_files:
transferred_dataset_files = []
%>
%if not sample.datasets:
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1575,7 +1575,7 @@ class TwillTestCase( unittest.TestCase )
for index, field_value in enumerate( bar_codes ):
sample_field_name = "sample_%i_name" % index
sample_field_value = samples[ index ].name.replace( ' ', '+' )
- field_name = "sample_%i_barcode" % index
+ field_name = "sample_%i_bar_code" % index
url += "&%s=%s" % ( field_name, field_value )
url += "&%s=%s" % ( sample_field_name, sample_field_value )
url += "&save_samples_button=Save"
1
0
galaxy-dist commit f2383b761f4e: Make sure samples have associated target libraries befoe enabling ability to transfer datasets, use better naming convention for request history code and templates, eliminate the ability to submit a request unless it has samples.
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User Greg Von Kuster <greg(a)bx.psu.edu>
# Date 1289507783 18000
# Node ID f2383b761f4e05442fd5ba6b1cde517732aa2c03
# Parent dfc848840870fa9936a69e62322446fcb940fb40
Make sure samples have associated target libraries befoe enabling ability to transfer datasets, use better naming convention for request history code and templates, eliminate the ability to submit a request unless it has samples.
--- a/templates/requests/common/view_sample_datasets.mako
+++ b/templates/requests/common/view_sample_datasets.mako
@@ -7,14 +7,14 @@
is_complete = sample.request.is_complete
is_submitted = sample.request.is_submitted
can_select_datasets = is_admin and ( is_complete or is_submitted )
- can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder
%><br/><br/><ul class="manage-table-actions">
%if can_transfer_datasets:
- <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Transfer datasets</a></li>
+ <li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li>
%endif
<li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=transfer_status )}">Refresh page</a></li><li><a class="action-button" id="sample-${sample.id}-popup" class="menubutton">Dataset Actions</a></li>
--- a/templates/requests/common/edit_samples.mako
+++ b/templates/requests/common/edit_samples.mako
@@ -47,7 +47,7 @@
%if can_edit_request:
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
%if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
%endif
--- a/lib/galaxy/web/controllers/requests.py
+++ b/lib/galaxy/web/controllers/requests.py
@@ -57,9 +57,9 @@ class Requests( BaseController ):
action='undelete_request',
cntrller='requests',
**kwd ) )
- if operation == "request_events":
+ if operation == "view_request_history":
return trans.response.send_redirect( web.url_for( controller='requests_common',
- action='request_events',
+ action='view_request_history',
cntrller='requests',
**kwd ) )
--- a/lib/galaxy/web/controllers/requests_common.py
+++ b/lib/galaxy/web/controllers/requests_common.py
@@ -76,7 +76,7 @@ class RequestsGrid( grids.Grid ):
StateColumn( "State",
key='state',
filterable="advanced",
- link=( lambda item: iff( item.deleted, None, dict( operation="request_events", id=item.id ) ) )
+ link=( lambda item: iff( item.deleted, None, dict( operation="view_request_history", id=item.id ) ) )
)
]
columns.append( grids.MulticolFilterColumn( "Search",
@@ -579,8 +579,8 @@ class RequestsCommon( BaseController, Us
status=status,
message=message ) )
@web.expose
- @web.require_login( "sequencing request events" )
- def request_events( self, trans, cntrller, **kwd ):
+ @web.require_login( "sequencing request history" )
+ def view_request_history( self, trans, cntrller, **kwd ):
params = util.Params( kwd )
request_id = params.get( 'id', None )
try:
@@ -590,7 +590,7 @@ class RequestsCommon( BaseController, Us
events_list = []
for event in request.events:
events_list.append( ( event.state, time_ago( event.update_time ), event.comment ) )
- return trans.fill_template( '/requests/common/events.mako',
+ return trans.fill_template( '/requests/common/view_request_history.mako',
cntrller=cntrller,
events_list=events_list,
request=request )
--- a/templates/admin/requests/select_datasets_to_transfer.mako
+++ b/templates/admin/requests/select_datasets_to_transfer.mako
@@ -72,7 +72,7 @@
<%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_transfer_datasets = is_admin and sample.untransferred_dataset_files
+ can_transfer_datasets = is_admin and sample.untransferred_dataset_files and sample.library and sample.folder
%><br/><br/>
@@ -85,8 +85,15 @@
</ul>
%if not sample:
+ <br/><font color="red"><b><i>Select a sample before selecting datasets to transfer</i></b></font>
- <br/><br/>
+ <br/>
+%endif
+
+%if request.samples_without_library_destinations:
+ <br/>
+ <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
+ <br/>
%endif
%if message:
--- a/lib/galaxy/web/controllers/requests_admin.py
+++ b/lib/galaxy/web/controllers/requests_admin.py
@@ -175,9 +175,9 @@ class RequestsAdmin( BaseController, Use
action='view_request',
cntrller='requests_admin',
**kwd ) )
- if operation == "request_events":
+ if operation == "view_request_history":
return trans.response.send_redirect( web.url_for( controller='requests_common',
- action='request_events',
+ action='view_request_history',
cntrller='requests_admin',
**kwd ) )
if operation == "reject":
--- a/test/base/twilltestcase.py
+++ b/test/base/twilltestcase.py
@@ -1517,7 +1517,7 @@ class TwillTestCase( unittest.TestCase )
for check_str in strings_not_displayed:
self.check_string_not_in_page( check_str )
def view_request_history( self, cntrller, request_id, strings_displayed=[], strings_not_displayed=[] ):
- self.visit_url( "%s/requests_common/request_events?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
+ self.visit_url( "%s/requests_common/view_request_history?cntrller=%s&id=%s" % ( self.url, cntrller, request_id ) )
for check_str in strings_displayed:
self.check_page_for_string( check_str )
for check_str in strings_not_displayed:
--- a/templates/requests/common/events.mako
+++ /dev/null
@@ -1,53 +0,0 @@
-<%inherit file="/base.mako"/>
-<%namespace file="/message.mako" import="render_msg" />
-
-<%
- is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_edit_request = ( is_admin and not request.is_complete ) or request.is_unsubmitted
- can_reject_request = is_admin and request.is_submitted
- can_add_samples = request.is_unsubmitted
-%>
-
-<br/><br/>
-<ul class="manage-table-actions">
- <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li>
- <div popupmenu="request-${request.id}-popup">
- <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
- %if can_edit_request:
- <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
- %endif
- %if can_add_samples:
- <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
- %endif
- %if can_reject_request:
- <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
- %endif
- </div>
-</ul>
-
-%if message:
- ${render_msg( message, status )}
-%endif
-
-<h2>History of Sequencing Request "${request.name}"</h2>
-
-<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/requests/common/edit_basic_request_info.mako
+++ b/templates/requests/common/edit_basic_request_info.mako
@@ -3,7 +3,13 @@
<%
is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
- can_add_samples = request.is_unsubmitted
+ is_complete = request.is_complete
+ is_submitted = request.is_submitted
+ is_unsubmitted = request.is_unsubmitted
+ can_add_samples = is_unsubmitted
+ can_reject = is_admin and is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_submit_request = request.samples and is_unsubmitted
%><br/><br/>
@@ -11,12 +17,14 @@
<li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li><div popupmenu="request-${request.id}-popup"><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
- %if can_add_samples:
+ %if can_submit_request:
<a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
- %if is_admin and request.is_submitted:
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ %if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
+ %endif
+ %if can_select_datasets:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ) )}">Select datasets to transfer</a>
%endif
</div>
--- a/templates/admin/requests/reject.mako
+++ b/templates/admin/requests/reject.mako
@@ -8,7 +8,7 @@
<h2>Reject Sequencing Request "${request.name}"</h2><ul class="manage-table-actions"><li>
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">View history</a></li><li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id(request.id) )}">Browse this request</a>
--- a/templates/requests/common/view_request.mako
+++ b/templates/requests/common/view_request.mako
@@ -44,7 +44,7 @@
%if can_edit_request:
<a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
%endif
- <a class="action-button" href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">View history</a>
%if can_reject:
<a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
%endif
@@ -52,8 +52,15 @@
</ul>
%if request.is_rejected:
+ <br/><font color="red"><b><i>Reason for rejection: </i></b></font><b>${request.last_comment}</b>
- <br/><br/>
+ <br/>
+%endif
+
+%if request.samples_without_library_destinations:
+ <br/>
+ <font color="red"><b><i>Select a target data library and folder for all samples before starting the sequence run</i></b></font>
+ <br/>
%endif
%if message:
@@ -94,7 +101,7 @@
<div class="form-row"><label>${field_label}:</label>
%if field_label == 'State':
- <a href="${h.url_for( controller='requests_common', action='request_events', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a>
+ <a href="${h.url_for( controller='requests_common', action='view_request_history', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">${field_value}</a>
%else:
${field_value}
%endif
@@ -154,6 +161,11 @@
render_buttons = can_edit_samples
%>
${render_samples_grid( cntrller, request, displayable_sample_widgets=displayable_sample_widgets, action='view_request', editing_samples=False, encoded_selected_sample_ids=[], render_buttons=render_buttons, grid_header=grid_header )}
+ ## Render the other grids
+ <% trans.sa_session.refresh( request.type.sample_form ) %>
+ %for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
+ ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
+ %endfor
%else:
There are no samples.
%if can_add_samples:
@@ -162,8 +174,3 @@
</ul>
%endif
%endif
-## Render the other grids
-<% trans.sa_session.refresh( request.type.sample_form ) %>
-%for grid_index, grid_name in enumerate( request.type.sample_form.layout ):
- ${render_request_type_sample_form_grids( grid_index, grid_name, request.type.sample_form.grid_fields( grid_index ), displayable_sample_widgets=displayable_sample_widgets, editing_samples=False )}
-%endfor
--- /dev/null
+++ b/templates/requests/common/view_request_history.mako
@@ -0,0 +1,58 @@
+<%inherit file="/base.mako"/>
+<%namespace file="/message.mako" import="render_msg" />
+
+<%
+ is_admin = cntrller == 'requests_admin' and trans.user_is_admin()
+ is_complete = request.is_complete
+ is_submitted = request.is_submitted
+ is_unsubmitted = request.is_unsubmitted
+ can_add_samples = is_unsubmitted
+ can_edit_request = ( is_admin and not is_complete ) or is_unsubmitted
+ can_reject = is_admin and is_submitted
+ can_select_datasets = is_admin and ( is_complete or is_submitted )
+ can_submit_request = request.samples and is_unsubmitted
+%>
+
+<br/><br/>
+<ul class="manage-table-actions">
+ <li><a class="action-button" id="request-${request.id}-popup" class="menubutton">Request Actions</a></li>
+ <div popupmenu="request-${request.id}-popup">
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='view_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Browse this request</a>
+ %if can_edit_request:
+ <a class="action-button" href="${h.url_for( controller='requests_common', action='edit_basic_request_info', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Edit this request</a>
+ %endif
+ %if can_submit_request:
+ <a class="action-button" confirm="More samples cannot be added to this request once it is submitted. Click OK to submit." href="${h.url_for( controller='requests_common', action='submit_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Submit this request</a>
+ %endif
+ %if can_reject:
+ <a class="action-button" href="${h.url_for( controller='requests_admin', action='reject_request', cntrller=cntrller, id=trans.security.encode_id( request.id ) )}">Reject this request</a>
+ %endif
+ </div>
+</ul>
+
+%if message:
+ ${render_msg( message, status )}
+%endif
+
+<h2>History of sequencing request "${request.name}"</h2>
+
+<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/requests/common/common.mako
+++ b/templates/requests/common/common.mako
@@ -322,7 +322,7 @@
%if can_select_datasets:
<li><a class="action-button" href="${h.url_for( controller='requests_admin', action='select_datasets_to_transfer', request_id=trans.security.encode_id( request.id ), sample_id=trans.security.encode_id( sample.id ) )}">Select datasets to transfer</a></li>
%endif
- %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ):
+ %if sample.datasets and len( sample.datasets ) > len( transferred_dataset_files ) and sample.library and sample.folder:
<li><a class="action-button" href="${h.url_for( controller='requests_admin', action='manage_datasets', sample_id=trans.security.encode_id( sample.id ) )}">Manage selected datasets</a></li>
%elif sample.datasets and len(sample.datasets ) == len( transferred_dataset_files ):
<li><a class="action-button" href="${h.url_for( controller='requests_common', action='view_sample_datasets', cntrller=cntrller, sample_id=trans.security.encode_id( sample.id ), transfer_status=trans.model.SampleDataset.transfer_status.COMPLETE )}">View transferred datasets</a></li>
1
0
galaxy-dist commit 0f6ace5c397b: Ignore backup files from some editors
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286965717 -3600
# Node ID 0f6ace5c397b000993db8e491a33e42423cdc807
# Parent d8184d91928c83f0269bd0267be949bc5d676e8b
Ignore backup files from some editors
--- a/.hgignore
+++ b/.hgignore
@@ -43,4 +43,4 @@ run_functional_tests.html
*.orig
.DS_Store
*.rej
-
+*~
1
0
galaxy-dist commit d8184d91928c: Remove FASTA filter script from BLAST+ tools (I want to generalise it)
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1287998919 -3600
# Node ID d8184d91928c83f0269bd0267be949bc5d676e8b
# Parent 5c212dfc6189bb41d334b0519411ca4f04fde9ec
Remove FASTA filter script from BLAST+ tools (I want to generalise it)
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -269,7 +269,6 @@
<tool file="ncbi_blast_plus/ncbi_tblastn_wrapper.xml" /><tool file="ncbi_blast_plus/ncbi_tblastx_wrapper.xml" /><tool file="ncbi_blast_plus/blastxml_to_tabular.xml" />
- <tool file="ncbi_blast_plus/blast_filter_fasta.xml" /></section><section name="NGS: Mapping" id="solexa_tools"><tool file="sr_mapping/lastz_wrapper.xml" />
--- a/tools/ncbi_blast_plus/blast_filter_fasta.py
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env python
-"""Filter a FASTA file using tabular output, e.g. from BLAST.
-
-Takes five command line options, tabular BLAST filename, ID column number
-(using one based counting), input FASTA filename, and two output FASTA
-filenames (for records with and without any BLAST hits).
-
-In the default NCBI BLAST+ tabular output, the query sequence ID is in column
-one, and the ID of the match from the database is in column two.
-"""
-import sys
-from galaxy_utils.sequence.fasta import fastaReader, fastaWriter
-
-#Parse Command Line
-blast_file, blast_col, in_file, out_positive_file, out_negative_file = sys.argv[1:]
-blast_col = int(blast_col)-1
-assert blast_col >= 0
-
-#Read tabular BLAST file and record all queries with hit(s)
-ids = set()
-blast_handle = open(blast_file, "rU")
-for line in blast_handle:
- ids.add(line.split("\t")[blast_col])
-blast_handle.close()
-
-#Write filtered FASTA file based on IDs from BLAST file
-reader = fastaReader(open(in_file, "rU"))
-positive_writer = fastaWriter(open(out_positive_file, "w"))
-negative_writer = fastaWriter(open(out_negative_file, "w"))
-for record in reader:
- #The [1:] is because the fastaReader leaves the > on the identifer.
- if record.identifier and record.identifier.split()[0][1:] in ids:
- positive_writer.write(record)
- else:
- negative_writer.write(record)
-positive_writer.close()
-negative_writer.close()
-reader.close()
--- a/tools/ncbi_blast_plus/blast_filter_fasta.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<tool id="blast_filter_fasta" name="Filter FASTA using BLAST output" version="0.0.1">
- <description>Divide a FASTA file based on BLAST hits</description>
- <command interpreter="python">
- blast_filter_fasta.py $blast_file $blast_col $in_file $out_positive_file $out_negative_file
- </command>
- <inputs>
- <param name="in_file" type="data" format="fasta" label="FASTA file to filter"/>
- <param name="blast_file" type="data" format="tabular" label="Tabular BLAST output"/>
- <param name="blast_col" type="select" label="Column containing FASTA identifiers">
- <option value="1">Column 1 - BLAST query ID</option>
- <option value="2">Column 2 - BLAST match ID</option>
- </param>
- </inputs>
- <outputs>
- <data name="out_positive_file" format="fasta" label="Sequences with BLAST hits" />
- <data name="out_negative_file" format="fasta" label="Sequences without BLAST hits" />
- </outputs>
- <requirements>
- </requirements>
- <tests>
- </tests>
- <help>
-
-**What it does**
-
-Typical use would be to take a multi-sequence FASTA and the tabular output of
-running BLAST on it, and divide the FASTA file in two: those sequence with a
-BLAST hit, and those without.
-
-In the default NCBI BLAST+ tabular output, the query sequence ID is in column
-one, and the ID of the match from the database is in column two.
-
-This allows you to filter the FASTA file for the subjects in the BLAST search,
-rather than filtering the FASTA file for the queries in the BLAST search.
-
- </help>
-</tool>
1
0
galaxy-dist commit 5c212dfc6189: Fix a caption capitalisation
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286980710 -3600
# Node ID 5c212dfc6189bb41d334b0519411ca4f04fde9ec
# Parent 122aaabe2c7eb48726f65233370926b838b6b444
Fix a caption capitalisation
--- a/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastn_wrapper.xml
@@ -62,7 +62,7 @@ blastn
<option value="vecscreen">vecscreen</option>
--></param>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastp_wrapper.xml
@@ -57,7 +57,7 @@ blastp
<option value="blastp">blastp</option><option value="blastp-short">blastp-short</option></param>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastx_wrapper.xml
@@ -51,7 +51,7 @@ tblastx
<param name="subject" type="data" format="fasta" label="Nucleotide FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_blastx_wrapper.xml
@@ -52,7 +52,7 @@ blastx
<param name="subject" type="data" format="fasta" label="Protein FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
--- a/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
+++ b/tools/ncbi_blast_plus/ncbi_tblastn_wrapper.xml
@@ -52,7 +52,7 @@ tblastn
<param name="subject" type="data" format="fasta" label="Nucleotide FASTA file to use as database"/></when></conditional>
- <param name="evalue_cutoff" type="float" size="15" value="0.001" label="set expectation value cutoff" />
+ <param name="evalue_cutoff" type="float" size="15" value="0.001" label="Set expectation value cutoff" /><param name="out_format" type="select" label="Output format"><option value="-outfmt 6" selected="True">Tabular</option><option value="-outfmt 5">BLAST XML</option>
1
0
galaxy-dist commit 10d0ffe5b7e2: Include BLAST-XML to tabular in tool_conf.xml.sample
by commits-noreply@bitbucket.org 20 Nov '10
by commits-noreply@bitbucket.org 20 Nov '10
20 Nov '10
# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User peterjc <p.j.a.cock(a)googlemail.com>
# Date 1286962559 -3600
# Node ID 10d0ffe5b7e22b2d122945ab5b7fa951a18c6e4a
# Parent caed55b53f5a811226e0bfa1c177e7b3e57a909a
Include BLAST-XML to tabular in tool_conf.xml.sample
--- a/tool_conf.xml.sample
+++ b/tool_conf.xml.sample
@@ -268,6 +268,7 @@
<tool file="ncbi_blast_plus/ncbi_blastx_wrapper.xml" /><tool file="ncbi_blast_plus/ncbi_tblastn_wrapper.xml" /><tool file="ncbi_blast_plus/ncbi_tblastx_wrapper.xml" />
+ <tool file="ncbi_blast_plus/blastxml_to_tabular.xml" /><tool file="ncbi_blast_plus/blast_filter_fasta.xml" /></section><section name="NGS: Mapping" id="solexa_tools">
1
0