diff options
author | mutantturkey <mutantturke@gmail.com> | 2013-03-08 14:28:04 -0500 |
---|---|---|
committer | mutantturkey <mutantturke@gmail.com> | 2013-03-08 14:28:04 -0500 |
commit | d86ae7aecd3d4ea677db6133198a3cb2381a873c (patch) | |
tree | 2f2175eca01f29a1bbb8a15c6c49e755945f1dd5 /quikr.py | |
parent | d1c402420cfe75a04a7c181d5b3e45cdde7bcf72 (diff) |
convert into a module, rename out functions so all quikr functions are withing quikr.function name
Diffstat (limited to 'quikr.py')
-rwxr-xr-x | quikr.py | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -4,7 +4,6 @@ import sys import scipy.optimize.nnls import scipy.sparse import numpy as np -import quikr_util as qu from subprocess import * import argparse import platform @@ -29,7 +28,7 @@ def isCompressed(filename): return False -def quikr_train(input_file_location, kmer): +def train_matrix(input_file_location, kmer): """ Takes a input fasta file, and kmer, returns a custom trained matrix """ @@ -57,21 +56,20 @@ def quikr_train(input_file_location, kmer): return matrix -def quikr_load_trained_matrix_from_file(input_fasta_location, trained_matrix_location, kmer, default_lambda): +def load_trained_matrix_from_file(trained_matrix_location): """ This is a helper function to load our trained matrix and run quikr """ - if qu.isCompressed(trained_matrix_location): + if isCompressed(trained_matrix_location): trained_matrix_file = gzip.open(trained_matrix_location, "rb") else: trained_matrix_file = open(trained_matrix_location, "rb") trained_matrix = np.load(trained_matrix_file) - xstar = quikr(input_fasta_location, trained_matrix, kmer, default_lambda) - return xstar + return trained_matrix -def quikr(input_fasta_location, trained_matrix, kmer, default_lambda): +def calculate_estimated_frequencies(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 |