diff options
author | Calvin <calvin@EESI> | 2013-03-07 14:29:06 -0500 |
---|---|---|
committer | Calvin <calvin@EESI> | 2013-03-07 14:29:06 -0500 |
commit | 29a242c629a37cc6099f55b38f18b86b2df28cf4 (patch) | |
tree | 7659f4f95396e40d7842d106f635747d2b56690a /quikr_train.py | |
parent | 0240e880ce0f7b68553021d8a85dc1d092a8a5f9 (diff) |
added gzip compression support
Diffstat (limited to 'quikr_train.py')
-rwxr-xr-x | quikr_train.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/quikr_train.py b/quikr_train.py index 5089e2a..a427436 100755 --- a/quikr_train.py +++ b/quikr_train.py @@ -2,6 +2,7 @@ import numpy as np import os import sys +import gzip from subprocess import * import platform import argparse @@ -19,7 +20,10 @@ def main(): parser.add_argument("-i", "--input", help="training database of sequences (fasta format)", required=True) parser.add_argument("-o", "--output", help="sensing matrix (text file)", required=True) - parser.add_argument("-k", "--kmer", type=int, help="kmer size (integer)", required=False ) + parser.add_argument("-k", "--kmer", help="kmer size (integer)", + type=int, required=False ) + parser.add_argument("-z", "--compress", help="compress output (integer)", + action='store_true', required=False) args = parser.parse_args() @@ -29,7 +33,12 @@ def main(): # call the quikr train function, save the output with np.save matrix = quikr_train(args.input, args.kmer) - np.save(args.output, matrix) + if args.compress: + output_file = gzip.open(args.output, "wb") + else: + output_file = open(args.output, "wb") + + np.save(output_file, matrix) return 0 |