# HG changeset patch # User peterjc # Date 1431443225 14400 # Node ID 174a38262fae11d357f9395a04b24b6d63793d3d # Parent a7c7f10488f5f8007ec9d3dce3ef1a554af703f0 planemo upload for repository https://github.com/peterjc/pico_galaxy/tools/align_back_trans commit 46f2d39f2030b3b0f883748f0c1a7c256b57ff34 diff -r a7c7f10488f5 -r 174a38262fae tools/align_back_trans/README.rst --- a/tools/align_back_trans/README.rst Fri Nov 28 11:32:34 2014 -0500 +++ b/tools/align_back_trans/README.rst Tue May 12 11:07:05 2015 -0400 @@ -1,7 +1,7 @@ Galaxy tool to back-translate a protein alignment to nucleotides ================================================================ -This tool is copyright 2012-2014 by Peter Cock, The James Hutton Institute +This tool is copyright 2012-2015 by Peter Cock, The James Hutton Institute (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved. See the licence text below (MIT licence). @@ -66,6 +66,9 @@ - Fixed error message when sequence length not a multiple of three. v0.0.5 - More explicit error messages when seqences lengths do not match. - Tool definition now embeds citation information. +v0.0.6 - Reorder XML elements (internal change only). + - Use ``format_source=...`` tag. + - Planemo for Tool Shed upload (``.shed.yml``, internal change only). ======= ====================================================================== @@ -78,22 +81,31 @@ With the addition of a Galaxy wrapper, developement moved here: https://github.com/peterjc/pico_galaxy/tree/master/tools/align_back_trans -For making the "Galaxy Tool Shed" http://toolshed.g2.bx.psu.edu/ tarball use -the following command from the Galaxy root folder:: +For pushing a release to the test or main "Galaxy Tool Shed", use the following +Planemo commands (which requires you have set your Tool Shed access details in +``~/.planemo.yml`` and that you have access rights on the Tool Shed):: + + $ planemo shed_upload --shed_target testtoolshed --check_diff ~/repositories/pico_galaxy/tools/align_back_trans/ + ... + +or:: - $ tar -czf align_back_trans.tar.gz tools/align_back_trans/README.rst tools/align_back_trans/align_back_trans.py tools/align_back_trans/align_back_trans.xml tools/align_back_trans/tool_dependencies.xml test-data/demo_nucs.fasta test-data/demo_nucs_trailing_stop.fasta test-data/demo_prot_align.fasta test-data/demo_nuc_align.fasta + $ planemo shed_upload --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/align_back_trans/ + ... + +To just build and check the tar ball, use:: -Check this worked:: - - $ tar -tzf align_back_trans.tar.gz + $ planemo shed_upload --tar_only ~/repositories/pico_galaxy/tools/align_back_trans/ + ... + $ tar -tzf shed_upload.tar.gz + test-data/demo_nucs.fasta + test-data/demo_nucs_trailing_stop.fasta + test-data/demo_prot_align.fasta + test-data/demo_nuc_align.fasta tools/align_back_trans/README.rst tools/align_back_trans/align_back_trans.py tools/align_back_trans/align_back_trans.xml tools/align_back_trans/tool_dependencies.xml - test-data/demo_nucs.fasta - test-data/demo_nucs_trailing_stop.fasta - test-data/demo_prot_align.fasta - test-data/demo_nuc_align.fasta Licence (MIT) diff -r a7c7f10488f5 -r 174a38262fae tools/align_back_trans/align_back_trans.py --- a/tools/align_back_trans/align_back_trans.py Fri Nov 28 11:32:34 2014 -0500 +++ b/tools/align_back_trans/align_back_trans.py Tue May 12 11:07:05 2015 -0400 @@ -29,7 +29,7 @@ print "v0.0.5" sys.exit(0) -def stop_err(msg, error_level=1): +def sys_exit(msg, error_level=1): """Print error message to stdout and quit with given error level.""" sys.stderr.write("%s\n" % msg) sys.exit(error_level) @@ -37,7 +37,7 @@ def check_trans(identifier, nuc, prot, table): """Returns nucleotide sequence if works (can remove trailing stop)""" if len(nuc) % 3: - stop_err("Nucleotide sequence for %s is length %i (not a multiple of three)" + sys_exit("Nucleotide sequence for %s is length %i (not a multiple of three)" % (identifier, len(nuc))) p = str(prot).upper().replace("*", "X") @@ -60,7 +60,7 @@ err += "\nHowever, protein sequence found within translated nucleotides." elif p[1:] in t: err += "\nHowever, ignoring first amino acid, protein sequence found within translated nucleotides." - stop_err(err) + sys_exit(err) if t == p: @@ -70,7 +70,7 @@ if str(nuc[0:3]).upper() in ambiguous_generic_by_id[table].start_codons: return nuc else: - stop_err("Translation check failed for %s\n" + sys_exit("Translation check failed for %s\n" "Would match if %s was a start codon (check correct table used)\n" % (identifier, nuc[0:3].upper())) else: @@ -85,7 +85,7 @@ sys.stderr.write("Protein: %s\n" % p[offset:offset+60]) sys.stderr.write(" %s\n" % m[offset:offset+60]) sys.stderr.write("Translation: %s\n\n" % t[offset:offset+60]) - stop_err("Translation check failed for %s\n" % identifier) + sys_exit("Translation check failed for %s\n" % identifier) def sequence_back_translate(aligned_protein_record, unaligned_nucleotide_record, gap, table=0): #TODO - Separate arguments for protein gap and nucleotide gap? @@ -106,7 +106,7 @@ if table: ungapped_nucleotide = check_trans(aligned_protein_record.id, ungapped_nucleotide, ungapped_protein, table) elif len(ungapped_protein) * 3 != len(ungapped_nucleotide): - stop_err("Inconsistent lengths for %s, ungapped protein %i, " + sys_exit("Inconsistent lengths for %s, ungapped protein %i, " "tripled %i vs ungapped nucleotide %i" % (aligned_protein_record.id, len(ungapped_protein), @@ -159,7 +159,7 @@ elif len(sys.argv) == 6: align_format, prot_align_file, nuc_fasta_file, nuc_align_file, table = sys.argv[1:] else: - stop_err("""This is a Python script for 'back-translating' a protein alignment, + sys_exit("""This is a Python script for 'back-translating' a protein alignment, It requires three, four or five arguments: - alignment format (e.g. fasta, clustal), @@ -184,7 +184,7 @@ try: table = int(table) except: - stop_err("Bad table argument %r" % table) + sys_exit("Bad table argument %r" % table) prot_align = AlignIO.read(prot_align_file, align_format, alphabet=generic_protein) nuc_dict = SeqIO.index(nuc_fasta_file, "fasta") diff -r a7c7f10488f5 -r 174a38262fae tools/align_back_trans/align_back_trans.xml --- a/tools/align_back_trans/align_back_trans.xml Fri Nov 28 11:32:34 2014 -0500 +++ b/tools/align_back_trans/align_back_trans.xml Tue May 12 11:07:05 2015 -0400 @@ -1,18 +1,18 @@ - + Gives a codon aware alignment biopython Bio - align_back_trans.py --version - -align_back_trans.py $prot_align.ext "$prot_align" "$nuc_file" "$out_nuc_align" "$table" - + align_back_trans.py --version + +align_back_trans.py $prot_align.ext "$prot_align" "$nuc_file" "$out_nuc_align" "$table" + @@ -38,7 +38,7 @@ - +