# HG changeset patch # User devteam # Date 1487524348 18000 # Node ID e04dbae2abe0304062fea7820a7bfcc79a702421 # Parent 83bec71c5c9f17b76feb6fa1c59d84140bd57229 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/tool_collections/cufflinks/cufflinks commit 82ee6fc860c52c531b7a57bbb346ab1a67a434a5 diff -r 83bec71c5c9f -r e04dbae2abe0 cuff_macros.xml --- a/cuff_macros.xml Tue Feb 07 18:39:22 2017 -0500 +++ b/cuff_macros.xml Sun Feb 19 12:12:28 2017 -0500 @@ -8,14 +8,6 @@ - - - - - - - - diff -r 83bec71c5c9f -r e04dbae2abe0 cufflinks_wrapper.py --- a/cufflinks_wrapper.py Tue Feb 07 18:39:22 2017 -0500 +++ b/cufflinks_wrapper.py Sun Feb 19 12:12:28 2017 -0500 @@ -7,7 +7,71 @@ import sys import tempfile -from galaxy.datatypes.util.gff_util import gff_attributes_to_str, parse_gff_attributes + +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" + + 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: + # Try splitting by '=' (GFF3) first because spaces are allowed in GFF3 + # attribute; next, try double quotes for GTF. + 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() + if name == '': + continue + # 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 + + +def gff_attributes_to_str( attrs, gff_format ): + """ + Convert GFF attributes to string. Supported formats are GFF3, GTF. + """ + if gff_format == 'GTF': + format_string = '%s "%s"' + # Convert group (GFF) and ID, parent (GFF3) attributes to transcript_id, gene_id + id_attr = None + if 'group' in attrs: + id_attr = 'group' + elif 'ID' in attrs: + id_attr = 'ID' + elif 'Parent' in attrs: + id_attr = 'Parent' + if id_attr: + attrs['transcript_id'] = attrs['gene_id'] = attrs[id_attr] + elif gff_format == 'GFF3': + format_string = '%s=%s' + attrs_strs = [] + for name, value in attrs.items(): + attrs_strs.append( format_string % ( name, value ) ) + return " ; ".join( attrs_strs ) def stop_err(msg): @@ -70,23 +134,6 @@ (options, args) = parser.parse_args() - # output version # of tool - try: - with tempfile.NamedTemporaryFile() as tmp_stdout: - returncode = subprocess.call(args='cufflinks --no-update-check 2>&1', stdout=tmp_stdout, shell=True) - stdout = None - with open(tmp_stdout.name) as tmp_stdout2: - for line in tmp_stdout2: - if line.lower().find('cufflinks v') >= 0: - stdout = line.strip() - break - if stdout: - sys.stdout.write('%s\n' % stdout) - else: - raise Exception - except: - sys.stdout.write('Could not determine Cufflinks version\n') - # If doing bias correction, set/link to sequence file. if options.do_bias_correction: if options.ref_file: diff -r 83bec71c5c9f -r e04dbae2abe0 cufflinks_wrapper.xml --- a/cufflinks_wrapper.xml Tue Feb 07 18:39:22 2017 -0500 +++ b/cufflinks_wrapper.xml Sun Feb 19 12:12:28 2017 -0500 @@ -1,16 +1,11 @@ - + transcript assembly and FPKM (RPKM) estimates for RNA-Seq data cuff_macros.xml - - bx-python - six - cufflinks - - + cufflinks 2>&1 | head -n 1 - + python '$__tool_directory__/cufflinks_wrapper.py' --input '$input' --assembled-isoforms-output '$assembled_isoforms' diff -r 83bec71c5c9f -r e04dbae2abe0 tool_dependencies.xml --- a/tool_dependencies.xml Tue Feb 07 18:39:22 2017 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - -