summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-03-07 14:45:04 -0500
committerCalvin <calvin@EESI>2013-03-07 14:45:04 -0500
commit748ba238758d92b74eff059e00384249673b2fa2 (patch)
tree705a3a92bdb02fe4ed749b6a9c7398df63b2dab9
parent29a242c629a37cc6099f55b38f18b86b2df28cf4 (diff)
multifasta_to_otu.py support for compression
-rwxr-xr-xmultifasta_to_otu.py9
-rwxr-xr-xquikr.py1
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)
diff --git a/quikr.py b/quikr.py
index 401b5ca..f83cdf2 100755
--- a/quikr.py
+++ b/quikr.py
@@ -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")