changeset 2:4283011f4be2 draft

v0.0.3 Internal Python style updates
author peterjc
date Wed, 01 Feb 2017 10:00:22 -0500
parents c0eb0e5792f3
children 7a26bb458806
files tools/seq_composition/README.rst tools/seq_composition/seq_composition.py tools/seq_composition/seq_composition.xml tools/seq_composition/tool_dependencies.xml
diffstat 4 files changed, 14 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/tools/seq_composition/README.rst	Wed May 13 10:49:27 2015 -0400
+++ b/tools/seq_composition/README.rst	Wed Feb 01 10:00:22 2017 -0500
@@ -1,7 +1,7 @@
 Galaxy tool reporting sequence composition
 ==========================================
 
-This tool is copyright 2014-2015 by Peter Cock, The James Hutton Institute
+This tool is copyright 2014-2017 by Peter Cock, The James Hutton Institute
 (formerly SCRI, Scottish Crop Research Institute), UK. All rights reserved.
 See the licence text below (MIT licence).
 
@@ -60,6 +60,7 @@
         - Tool definition now embeds citation information.
 v0.0.2  - Reorder XML elements (internal change only).
         - Planemo for Tool Shed upload (``.shed.yml``, internal change only).
+v0.0.3  - Python style updates (internal change only).
 ======= ======================================================================
 
 
@@ -74,12 +75,12 @@
 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/seq_composition/
+    $ planemo shed_update -t testtoolshed --check_diff ~/repositories/pico_galaxy/tools/seq_composition/
     ...
 
 or::
 
-    $ planemo shed_upload --shed_target toolshed --check_diff ~/repositories/pico_galaxy/tools/seq_composition/
+    $ planemo shed_update -t toolshed --check_diff ~/repositories/pico_galaxy/tools/seq_composition/
     ...
 
 To just build and check the tar ball, use::
--- a/tools/seq_composition/seq_composition.py	Wed May 13 10:49:27 2015 -0400
+++ b/tools/seq_composition/seq_composition.py	Wed Feb 01 10:00:22 2017 -0500
@@ -15,17 +15,12 @@
 
 Use -v or --version to get the version, -h or --help for help.
 """
-import os
 import sys
 from optparse import OptionParser
 
 from Bio import SeqIO
 
-def sys_exit(msg, err=1):
-    sys.stderr.write(msg.rstrip() + "\n")
-    sys.exit(err)
-
-#Parse Command Line
+# Parse Command Line
 usage = """Example usage:
 
 $ python seq_composition.py -o my_output.tsv -q input1.fastq -q input2.fastq
@@ -34,9 +29,9 @@
 If the expected alphabet is given, the sequence composition is verfied against
 it.
 """
-#TODO - Case senstivity?
-#TODO - GenBank / EMBL input? Needs the datatype defined...
-#TODO - Handle all the FASTQ datatype subclasses in the XML cheetah code?
+# TODO - Case senstivity?
+# TODO - GenBank / EMBL input? Needs the datatype defined...
+# TODO - Handle all the FASTQ datatype subclasses in the XML cheetah code?
 parser = OptionParser(usage=usage)
 parser.add_option('-f', '--fasta', dest='fasta', action="append", default=[],
                   help='Input sequence filename in FASTA format')
@@ -54,13 +49,13 @@
 options, args = parser.parse_args()
 
 if options.version:
-    print("v0.0.1")
+    print("v0.0.3")
     sys.exit(0)
 
 if not (options.fasta or options.fastq or options.sff):
-    sys_exit("Require an input filename")
+    sys.exit("Requires an input filename")
 if not options.output:
-    sys_exit("Require an output filename")
+    sys.exit("Requires an output filename")
 
 
 file_count = 0
@@ -78,7 +73,7 @@
             for letter in record:
                 try:
                     counts[letter] += 1
-                except:
+                except KeyError:
                     counts[letter] = 1
 
 total = sum(counts.values())
--- a/tools/seq_composition/seq_composition.xml	Wed May 13 10:49:27 2015 -0400
+++ b/tools/seq_composition/seq_composition.xml	Wed Feb 01 10:00:22 2017 -0500
@@ -1,4 +1,4 @@
-<tool id="seq_composition" name="Sequence composition" version="0.0.2">
+<tool id="seq_composition" name="Sequence composition" version="0.0.3">
     <description>Count bases or amino-acids</description>
     <requirements>
         <requirement type="package" version="1.64">biopython</requirement>
--- a/tools/seq_composition/tool_dependencies.xml	Wed May 13 10:49:27 2015 -0400
+++ b/tools/seq_composition/tool_dependencies.xml	Wed Feb 01 10:00:22 2017 -0500
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <tool_dependency>
     <package name="biopython" version="1.64">
-        <repository changeset_revision="5477a05cc158" name="package_biopython_1_64" owner="biopython" toolshed="https://toolshed.g2.bx.psu.edu" />
+        <repository changeset_revision="0c7526e8ea70" name="package_biopython_1_64" owner="biopython" toolshed="https://toolshed.g2.bx.psu.edu" />
     </package>
 </tool_dependency>