[med-svn] [fastaq] 01/05: Imported Upstream version 3.13.0

Sascha Steinbiss satta at debian.org
Fri Aug 12 14:24:22 UTC 2016


This is an automated email from the git hooks/post-receive script.

satta pushed a commit to branch master
in repository fastaq.

commit 21955d0f9af15f30a403d5b50d041c124e45b020
Author: Sascha Steinbiss <satta at debian.org>
Date:   Fri Aug 12 14:14:56 2016 +0000

    Imported Upstream version 3.13.0
---
 .travis.yml                          |  6 ++++++
 README.md                            | 10 ++++++++--
 pyfastaq/runners/to_random_subset.py |  6 ++++--
 setup.py                             |  2 +-
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..c3ded3b
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,6 @@
+language: python
+python:
+  - "3.4"
+sudo: false
+script:
+  - "python setup.py test"
diff --git a/README.md b/README.md
index 46f0828..6986255 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Install with pip3:
 
 
 Alternatively, you can download the latest release from this github repository,
-or clone the repository. Then run the tests: 
+or clone the repository. Then run the tests:
 
     python3 setup.py test
 
@@ -25,7 +25,7 @@ Usage
 -----
 
 The installation will put a single script called `fastaq` in your path.
-The usage is: 
+The usage is:
 
     fastaq <command> [options]
 
@@ -109,3 +109,9 @@ Here is a template for counting the sequences in a FASTA or FASTQ file:
     print(count)
 
 Hopefully you get the idea and there are plenty of examples in tasks.py. Detection of the input file type and whether gzipped or not is automatic. See help(sequences) for the various methods already defined in the classes Fasta and Fastq.
+
+---------------------------------
+
+Build status: [![Build Status](https://travis-ci.org/sanger-pathogens/Fastaq.svg?branch=master)](https://travis-ci.org/sanger-pathogens/Fastaq)
+
+
diff --git a/pyfastaq/runners/to_random_subset.py b/pyfastaq/runners/to_random_subset.py
index 211f7f2..0f94c33 100644
--- a/pyfastaq/runners/to_random_subset.py
+++ b/pyfastaq/runners/to_random_subset.py
@@ -9,11 +9,13 @@ def run(description):
                       'from a mates file.  Ouptut is interleaved if mates file given',
         usage = 'fastaq to_random_subset [options] <infile> <outfile> <percent>')
     parser.add_argument('--mate_file', help='Name of mates file')
+    parser.add_argument('--seed', help='Seed for random number generator. If not given, python\'s default is used', metavar='INT')
     parser.add_argument('infile', help='Name of input file')
     parser.add_argument('outfile', help='Name of output file')
-    parser.add_argument('percent', type=int, help='Per cent probability of keeping any given read (pair) in [0,100]', metavar='INT')
+    parser.add_argument('percent', type=float, help='Per cent probability of keeping any given read (pair) in [0,100]', metavar='FLOAT')
     options = parser.parse_args()
 
+    random.seed(a=options.seed)
     seq_reader = sequences.file_reader(options.infile)
     fout = utils.open_file_write(options.outfile)
 
@@ -27,7 +29,7 @@ def run(description):
             except StopIteration:
                 print('Error! Didn\'t get mate for read', seq.id, file=sys.stderr)
                 sys.exit(1)
-        if random.randint(0, 100) <= options.percent:
+        if 100 * random.random() <= options.percent:
             print(seq, file=fout)
             if options.mate_file:
                 print(mate_seq, file=fout)
diff --git a/setup.py b/setup.py
index 50f19c9..cb326b6 100644
--- a/setup.py
+++ b/setup.py
@@ -4,7 +4,7 @@ from setuptools import setup, find_packages
 
 setup(
     name='pyfastaq',
-    version='3.12.1',
+    version='3.13.0',
     description='Script to manipulate FASTA and FASTQ files, plus API for developers',
     packages = find_packages(),
     author='Martin Hunt',

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/fastaq.git



More information about the debian-med-commit mailing list