Mercurial > repos > peterjc > align_back_trans
changeset 8:174a38262fae draft
planemo upload for repository https://github.com/peterjc/pico_galaxy/tools/align_back_trans commit 46f2d39f2030b3b0f883748f0c1a7c256b57ff34
author | peterjc |
---|---|
date | Tue, 12 May 2015 11:07:05 -0400 |
parents | a7c7f10488f5 |
children | 4f713de76cf2 |
files | tools/align_back_trans/README.rst tools/align_back_trans/align_back_trans.py tools/align_back_trans/align_back_trans.xml |
diffstat | 3 files changed, 37 insertions(+), 25 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- 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")
--- 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 @@ -<tool id="align_back_trans" name="Thread nucleotides onto a protein alignment (back-translation)" version="0.0.5"> +<tool id="align_back_trans" name="Thread nucleotides onto a protein alignment (back-translation)" version="0.0.6"> <description>Gives a codon aware alignment</description> <requirements> <requirement type="package" version="1.63">biopython</requirement> <requirement type="python-module">Bio</requirement> </requirements> - <version_command interpreter="python">align_back_trans.py --version</version_command> - <command interpreter="python"> -align_back_trans.py $prot_align.ext "$prot_align" "$nuc_file" "$out_nuc_align" "$table" - </command> <stdio> <!-- Anything other than zero is an error --> <exit_code range="1:" /> <exit_code range=":-1" /> </stdio> + <version_command interpreter="python">align_back_trans.py --version</version_command> + <command interpreter="python"> +align_back_trans.py $prot_align.ext "$prot_align" "$nuc_file" "$out_nuc_align" "$table" + </command> <inputs> <param name="prot_align" type="data" format="fasta,muscle,clustal" label="Aligned protein file" help="Mutliple sequence file in FASTA, ClustalW or PHYLIP format." /> <param name="table" type="select" label="Genetic code" help="Tables from the NCBI, these determine the start and stop codons"> @@ -38,7 +38,7 @@ <param name="nuc_file" type="data" format="fasta" label="Unaligned nucleotide sequences" help="FASTA format, using same identifiers as your protein alignment" /> </inputs> <outputs> - <data name="out_nuc_align" format="input" metadata_source="prot_align" label="${prot_align.name} (back-translated)"/> + <data name="out_nuc_align" format_source="prot_align" metadata_source="prot_align" label="${prot_align.name} (back-translated)"/> </outputs> <tests> <test>