# HG changeset patch # User peterjc # Date 1366817652 14400 # Node ID abdd608c869b046b8363b4494c02d3ae9def4a94 # Parent 262f08104540217aa57a66bd417c789b5b517a09 Uploaded v0.0.5, checked script return code for errors X copes with a FASTA entry missing an ID. diff -r 262f08104540 -r abdd608c869b tools/filters/seq_filter_by_id.py --- a/tools/filters/seq_filter_by_id.py Mon Apr 15 12:27:30 2013 -0400 +++ b/tools/filters/seq_filter_by_id.py Wed Apr 24 11:34:12 2013 -0400 @@ -29,7 +29,7 @@ (formerly the Scottish Crop Research Institute, SCRI), UK. All rights reserved. See accompanying text file for licence details (MIT/BSD style). -This is version 0.0.4 of the script, use -v or --version to get the version. +This is version 0.0.5 of the script, use -v or --version to get the version. """ import sys @@ -38,7 +38,7 @@ sys.exit(err) if "-v" in sys.argv or "--version" in sys.argv: - print "v0.0.4" + print "v0.0.5" sys.exit(0) #Parse Command Line @@ -89,11 +89,18 @@ if line[0] == ">": break + no_id_warned = False while True: if line[0] != ">": raise ValueError( "Records in Fasta files should start with '>' character") - id = line[1:].split(None, 1)[0] + try: + id = line[1:].split(None, 1)[0] + except IndexError: + if not no_id_warned: + sys.stderr.write("WARNING - Malformed FASTA entry with no identifier\n") + no_id_warned = True + id = None lines = [line] line = handle.readline() while True: diff -r 262f08104540 -r abdd608c869b tools/filters/seq_filter_by_id.txt --- a/tools/filters/seq_filter_by_id.txt Mon Apr 15 12:27:30 2013 -0400 +++ b/tools/filters/seq_filter_by_id.txt Wed Apr 24 11:34:12 2013 -0400 @@ -38,6 +38,8 @@ v0.0.4 - Record script version when run from Galaxy. - Faster FASTA code which preserves the original line wrapping. - Basic unit test included. +v0.0.5 - Check for errors using Python script's return code. + - Cope with malformed FASTA entries without an identifier. Developers diff -r 262f08104540 -r abdd608c869b tools/filters/seq_filter_by_id.xml --- a/tools/filters/seq_filter_by_id.xml Mon Apr 15 12:27:30 2013 -0400 +++ b/tools/filters/seq_filter_by_id.xml Wed Apr 24 11:34:12 2013 -0400 @@ -1,4 +1,4 @@ - + from a tabular file seq_filter_by_id.py --version @@ -11,6 +11,11 @@ - $output_neg #end if + + + + +