diff options
author | Calvin <calvin@EESI> | 2013-03-07 14:45:04 -0500 |
---|---|---|
committer | Calvin <calvin@EESI> | 2013-03-07 14:45:04 -0500 |
commit | 748ba238758d92b74eff059e00384249673b2fa2 (patch) | |
tree | 705a3a92bdb02fe4ed749b6a9c7398df63b2dab9 | |
parent | 29a242c629a37cc6099f55b38f18b86b2df28cf4 (diff) |
multifasta_to_otu.py support for compression
-rwxr-xr-x | multifasta_to_otu.py | 9 | ||||
-rwxr-xr-x | quikr.py | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/multifasta_to_otu.py b/multifasta_to_otu.py index 548633e..bcc8177 100755 --- a/multifasta_to_otu.py +++ b/multifasta_to_otu.py @@ -5,7 +5,9 @@ from Bio import SeqIO import multiprocessing from subprocess import * import os +import gzip import quikr as q +import quikr_util as qu import sys import numpy as np import argparse @@ -70,7 +72,12 @@ def main(): kmer = args.kmer # Load trained matrix - trained_matrix = np.load(args.trained_matrix) + if qu.isCompressed(args.trained_matrix): + trained_matrix_file = gzip.open(args.trained_matrix, "rb") + else: + trained_matrix_file = open(args.trained_matrix, "rb") + + trained_matrix = np.load(trained_matrix_file) # Return a list of the input directory fasta_list = os.listdir(args.input_directory) @@ -52,7 +52,6 @@ def main(): def quikr_load_trained_matrix_from_file(input_fasta_location, trained_matrix_location, kmer, default_lambda): if qu.isCompressed(trained_matrix_location): - print "compressed!" trained_matrix_file = gzip.open(trained_matrix_location, "rb") else: trained_matrix_file = open(trained_matrix_location, "rb") |