details: http://www.bx.psu.edu/hg/galaxy/rev/78e84936b7a3 changeset: 1470:78e84936b7a3 user: Greg Von Kuster <greg@bx.psu.edu> date: Tue Aug 12 09:18:47 2008 -0400 description: Fix for Extract Genomic DNA when input file metadata missing strand column value. 2 file(s) affected in this change: tools/extract/extract_genomic_dna.py tools/extract/extract_genomic_dna.xml diffs (79 lines): diff -r b9142bbae4ad -r 78e84936b7a3 tools/extract/extract_genomic_dna.py --- a/tools/extract/extract_genomic_dna.py Fri Aug 08 13:42:32 2008 -0400 +++ b/tools/extract/extract_genomic_dna.py Tue Aug 12 09:18:47 2008 -0400 @@ -1,7 +1,10 @@ #!/usr/bin/env python """ -usage: extract_genomic_dna.py $input $out_file1 ${input.metadata.chromCol} ${input.metadata.startCol} ${input.metadata.endCol} ${input.metadata.strandCol} $dbkey $out_format GALAXY_DATA_INDEX_DIR -by Wen-Yu Chung +usage: %prog $input $out_file1 + -1, --cols=N,N,N,N: Columns for start, end, strand in input file + -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 and twobit.loc """ from galaxy import eggs import pkg_resources @@ -10,6 +13,7 @@ from bx.cookbook import doc_optparse import bx.seq.nib import bx.seq.twobit +from galaxy.tools.util.galaxyops import * assert sys.version_info[:2] >= ( 2, 4 ) @@ -54,32 +58,18 @@ return twobit_path def __main__(): - input_filename = sys.argv[1] - output_filename = sys.argv[2] - includes_strand_col = False + options, args = doc_optparse.parse( __doc__ ) + try: + chrom_col, start_col, end_col, strand_col = parse_cols_arg( options.cols ) + dbkey = options.dbkey + output_format = options.output_format + GALAXY_DATA_INDEX_DIR = options.GALAXY_DATA_INDEX_DIR + input_filename, output_filename = args + except: + doc_optparse.exception() + + includes_strand_col = strand_col >= 0 strand = None - # If any of the following exceptions are thrown, we need to improve the metadata validator. - try: - chrom_col = int( sys.argv[3] ) - 1 - except: - stop_err( "Chrom column not properly set, click the pencil icon in your history item to set it." ) - try: - start_col = int( sys.argv[4] ) - 1 - except: - stop_err( "Start column not properly set, click the pencil icon in your history item to set it." ) - try: - end_col = int( sys.argv[5] ) - 1 - except: - stop_err( "End column not properly set, click the pencil icon in your history item to set it." ) - try: - strand_col = int( sys.argv[6] ) - 1 - if strand_col >= 0: - includes_strand_col = True - except: - pass - dbkey = sys.argv[7] - output_format = sys.argv[8] - GALAXY_DATA_INDEX_DIR = sys.argv[9] nibs = {} twobits = {} nib_path = check_nib_file( dbkey, GALAXY_DATA_INDEX_DIR ) diff -r b9142bbae4ad -r 78e84936b7a3 tools/extract/extract_genomic_dna.xml --- a/tools/extract/extract_genomic_dna.xml Fri Aug 08 13:42:32 2008 -0400 +++ b/tools/extract/extract_genomic_dna.xml Tue Aug 12 09:18:47 2008 -0400 @@ -1,6 +1,6 @@ <tool id="Extract genomic DNA 1" name="Extract Genomic DNA" version="2.1.0"> <description>using coordinates from assembled/unassembled genomes</description> - <command interpreter="python">extract_genomic_dna.py $input $out_file1 ${input.metadata.chromCol} ${input.metadata.startCol} ${input.metadata.endCol} ${input.metadata.strandCol} $dbkey $out_format ${GALAXY_DATA_INDEX_DIR}</command> + <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> <inputs> <param format="interval" name="input" type="data" label="Fetch sequences corresponding to Query"> <validator type="unspecified_build" />