galaxy-dist commit cce2225b8eea: Improvements to the GFF filtering tool.
# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User jeremy goecks <jeremy.goecks@emory.edu> # Date 1280946953 14400 # Node ID cce2225b8eea41c6ff3779aa4b406b0b6018913c # Parent 99a3437916457d1971820820733377664fab403f Improvements to the GFF filtering tool. --- a/tools/ngs_rna/gff_filtering.py +++ b/tools/ngs_rna/gff_filtering.py @@ -48,7 +48,7 @@ mapped_str = { for key, value in mapped_str.items(): cond_text = cond_text.replace( key, value ) -# Add attribute name to condition text. +# Condition text is 'attribute meets condition.' cond_text = attribute_name + cond_text # Attempt to determine if the condition includes executable stuff and, if so, exit @@ -62,7 +62,7 @@ for operand in operands: stop_err( "Illegal value '%s' in condition '%s'" % ( operand, cond_text ) ) # Set up assignment. -assignment = "%s = attributes[ '%s' ]" % ( attribute_name, attribute_name ) +assignment = "%s = attributes.get('%s', None)" % ( attribute_name, attribute_name ) # Set up type casting based on attribute type. type_cast = "%s = %s(%s)" % ( attribute_name, attribute_type, attribute_name) @@ -103,16 +103,18 @@ for i, line in enumerate( file( in_fname value = pair[1].strip(" \\"") attributes[name] = value %s - %s if %s: - lines_kept += 1 - print >> out, line - except: + %s + if %s: + lines_kept += 1 + print >> out, line + except Exception, e: skipped_lines += 1 if not invalid_line: first_invalid_line = i + 1 invalid_line = line -''' % ( assignment, type_cast, cond_text ) +''' % ( assignment, attribute_name, type_cast, cond_text ) + valid_filter = True try: --- a/tools/ngs_rna/gff_filtering.xml +++ b/tools/ngs_rna/gff_filtering.xml @@ -14,7 +14,7 @@ </param><param name="attribute_type" type="select" label="Attribute type"><option value="float">Float</option> - <option value="integer">Integer</option> + <option value="int">Integer</option><option value="str">String</option></param><param name="cond" size="40" type="text" value=">0" label="With following condition" help="Double equal signs, ==, must be used as shown above. To filter for an arbitrary string, use the Select tool.">
participants (1)
-
commits-noreply@bitbucket.org