commit/galaxy-central: jgoecks: Enable fasta_to_len conversion to use only first word in title; this is standards compliant and used by default for automatic conversion.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/91a437977be1/ changeset: 91a437977be1 user: jgoecks date: 2012-03-08 17:09:14 summary: Enable fasta_to_len conversion to use only first word in title; this is standards compliant and used by default for automatic conversion. affected #: 2 files diff -r 5ffd9f8983538741cf0597e6e61ccc70256ad585 -r 91a437977be1b1ae6eabd510e553f86f86f74ac0 lib/galaxy/datatypes/converters/fasta_to_len.py --- a/lib/galaxy/datatypes/converters/fasta_to_len.py +++ b/lib/galaxy/datatypes/converters/fasta_to_len.py @@ -9,7 +9,7 @@ assert sys.version_info[:2] >= ( 2, 4 ) -def compute_fasta_length( fasta_file, out_file, keep_first_char ): +def compute_fasta_length( fasta_file, out_file, keep_first_char, keep_first_word=False ): infile = fasta_file out = open( out_file, 'w') @@ -32,6 +32,8 @@ continue if line[0] == '>': if first_entry == False: + if keep_first_word: + fasta_title = fasta_title.split()[0] out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first_char ], seq_len ) ) else: first_entry = False @@ -41,8 +43,10 @@ seq_len += len(line) # last fasta-entry + if keep_first_word: + fasta_title = fasta_title.split()[0] out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first_char ], seq_len ) ) out.close() -if __name__ == "__main__" : - compute_fasta_length( sys.argv[1], sys.argv[2], sys.argv[3] ) \ No newline at end of file +if __name__ == "__main__" : + compute_fasta_length( sys.argv[1], sys.argv[2], sys.argv[3], True ) \ No newline at end of file diff -r 5ffd9f8983538741cf0597e6e61ccc70256ad585 -r 91a437977be1b1ae6eabd510e553f86f86f74ac0 tools/fasta_tools/fasta_compute_length.py --- a/tools/fasta_tools/fasta_compute_length.py +++ b/tools/fasta_tools/fasta_compute_length.py @@ -6,4 +6,4 @@ import sys from galaxy.datatypes.converters.fasta_to_len import compute_fasta_length -compute_fasta_length( sys.argv[1], sys.argv[2], sys.argv[3]) \ No newline at end of file +compute_fasta_length( sys.argv[1], sys.argv[2], sys.argv[3], False ) \ No newline at end of file Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
Bitbucket