summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin <calvin@EESI>2013-02-27 12:07:51 -0500
committerCalvin <calvin@EESI>2013-02-27 12:07:51 -0500
commite7473956c15a9881174d63a99cac735e9482038e (patch)
treec38752e2a0b75f59e04a6cf4e57ea73a4dee9248
parent6da40aa924e2720f358c64fd5aaa54ec2c726f0a (diff)
* add helper quikr_load_trained_from_file to load file
* change quikr to load a numpy matrix, not file
-rwxr-xr-xquikr.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/quikr.py b/quikr.py
index 92c204b..065590d 100755
--- a/quikr.py
+++ b/quikr.py
@@ -47,7 +47,13 @@ def main():
np.savetxt(args.output, xstar, delimiter=",", fmt="%f")
return 0
-def quikr(input_fasta_location, trained_matrix_location, kmer, default_lambda):
+def quikr_load_trained_matrix_from_file(input_fasta_location, trained_matrix_location, kmer, default_lambda):
+
+ trained_matrix = np.load(trained_matrix_location)
+ xstar = quikr(input_fasta_location, trained_matrix, kmer, default_lambda)
+ return xstar
+
+def quikr(input_fasta_location, trained_matrix, kmer, default_lambda):
"""
input_fasta is the input fasta file to find the estimated frequencies of
trained_matrix is the trained matrix we are using to estimate the species
@@ -80,7 +86,7 @@ def quikr(input_fasta_location, trained_matrix_location, kmer, default_lambda):
counts = np.concatenate([np.zeros(1), counts])
# load our trained matrix
- trained_matrix = np.load(trained_matrix_location)
+
#form the k-mer sensing matrix
trained_matrix = trained_matrix * default_lambda;