changeset 16:4c79e75c4576 draft

v0.2.4 Depends on Biopython 1.67 via legacy Tool Shed package or bioconda.
author peterjc
date Thu, 11 May 2017 07:22:26 -0400
parents 19306a5f88b2
children 279828615e8c
files tools/sample_seqs/README.rst tools/sample_seqs/sample_seqs.py tools/sample_seqs/sample_seqs.xml
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/tools/sample_seqs/README.rst	Wed May 10 12:46:56 2017 -0400
+++ b/tools/sample_seqs/README.rst	Thu May 11 07:22:26 2017 -0400
@@ -71,7 +71,8 @@
         - Planemo for Tool Shed upload (``.shed.yml``, internal change only).
 v0.2.3  - Do the Biopython imports at the script start (internal change only).
         - Clarify paired read example in help text.
-        - Depends on Biopython 1.67 via legacy Tool Shed package or bioconda.
+v0.2.4  - Depends on Biopython 1.67 via legacy Tool Shed package or bioconda.
+        - Style changes to Python code (internal change only).
 ======= ======================================================================
 
 
--- a/tools/sample_seqs/sample_seqs.py	Wed May 10 12:46:56 2017 -0400
+++ b/tools/sample_seqs/sample_seqs.py	Thu May 11 07:22:26 2017 -0400
@@ -63,7 +63,7 @@
 options, args = parser.parse_args()
 
 if options.version:
-    print("v0.2.3")
+    print("v0.2.4")
     sys.exit(0)
 
 try:
@@ -146,6 +146,7 @@
         sys.stderr.write("Sampling every %ith sequence\n" % N)
 
     def sampler(iterator):
+        """Sample every Nth sequence."""
         global N
         count = 0
         for record in iterator:
@@ -157,11 +158,12 @@
         percent = float(options.percent) / 100.0
     except ValueError:
         sys.exit("Bad -p percent argument %r" % options.percent)
-    if percent <= 0.0 or 1.0 <= percent:
+    if not(0.0 <= percent <= 1.0):
         sys.exit("Bad -p percent argument %r" % options.percent)
     sys.stderr.write("Sampling %0.3f%% of sequences\n" % (100.0 * percent))
 
     def sampler(iterator):
+        """Sample given percentage of sequences."""
         global percent
         count = 0
         taken = 0
@@ -215,6 +217,7 @@
             assert taken == N, "Picked %i, wanted %i" % (taken, N)
     else:
         def sampler(iterator):
+            """Sample given number of sequences."""
             # Mimic the percentage sampler, with double check on final count
             global N, total
             # Do we need a floating point fudge factor epsilon?
--- a/tools/sample_seqs/sample_seqs.xml	Wed May 10 12:46:56 2017 -0400
+++ b/tools/sample_seqs/sample_seqs.xml	Thu May 11 07:22:26 2017 -0400
@@ -1,4 +1,4 @@
-<tool id="sample_seqs" name="Sub-sample sequences files" version="0.2.3">
+<tool id="sample_seqs" name="Sub-sample sequences files" version="0.2.4">
     <description>e.g. to reduce coverage</description>
     <requirements>
         <requirement type="package" version="1.67">biopython</requirement>