From e7473956c15a9881174d63a99cac735e9482038e Mon Sep 17 00:00:00 2001 From: Calvin Date: Wed, 27 Feb 2013 12:07:51 -0500 Subject: * add helper quikr_load_trained_from_file to load file * change quikr to load a numpy matrix, not file --- quikr.py | 10 ++++++++-- 1 file 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; -- cgit v1.2.3