# HG changeset patch # User peterjc # Date 1366817628 14400 # Node ID 66d1ca92fb38143af99e8d48c0c2eeac19470553 # Parent 21a065d5f0e26dd04bc012a22845bd597445c096 Uploaded v0.0.5, checked script return code for errors X copes with a FASTA entry missing an ID. diff -r 21a065d5f0e2 -r 66d1ca92fb38 tools/filters/seq_filter_by_id.py --- a/tools/filters/seq_filter_by_id.py Mon Apr 15 12:11:16 2013 -0400 +++ b/tools/filters/seq_filter_by_id.py Wed Apr 24 11:33:48 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 21a065d5f0e2 -r 66d1ca92fb38 tools/filters/seq_filter_by_id.txt --- a/tools/filters/seq_filter_by_id.txt Mon Apr 15 12:11:16 2013 -0400 +++ b/tools/filters/seq_filter_by_id.txt Wed Apr 24 11:33:48 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 21a065d5f0e2 -r 66d1ca92fb38 tools/filters/seq_filter_by_id.xml --- a/tools/filters/seq_filter_by_id.xml Mon Apr 15 12:11:16 2013 -0400 +++ b/tools/filters/seq_filter_by_id.xml Wed Apr 24 11:33:48 2013 -0400 @@ -1,4 +1,4 @@ - + from a tabular file seq_filter_by_id.py --version @@ -11,6 +11,11 @@ - $output_neg #end if + + + + +