#!/usr/bin/env python import sys import os import argparse import quikr import numpy as np def main(): parser = argparse.ArgumentParser(description= "Quikr returns the estimated frequencies of batcteria present when given a \ input FASTA file. \n") parser.add_argument("-f", "--fasta", help="the sample's fasta file of NGS READS", required=True) parser.add_argument("-o", "--output", help="OTU_FRACTION_PRESENT, a vector \ representing the percentage of database sequence's presence in a sequence. (csv output)", required=True) parser.add_argument("-s", "--sensing-matrix", help="the sensing matrix", required=True) parser.add_argument("-l", "--lamb", type=int, help="the lambda size. (default is 10,000") parser.add_argument("-k", "--kmer", type=int, required=True, help="specifies the size of the kmer to use (the default is 6)") args = parser.parse_args() # our default lambda is 10,000 lamb = 10000 # our default kmer size is 6 kmer = 6 # Make sure our input exist if not os.path.isfile(args.fasta): parser.error( "Input fasta file not found") if not os.path.isfile(args.sensing_matrix): parser.error("Custom sensing matrix not found") # use alternative lambda if args.lamb is not None: lamb = args.lamb # use alternative kmer if args.kmer is not None: kmer = args.kmer sensing_matrix = quikr.load_sensing_matrix_from_file(args.sensing_matrix) xstar = quikr.calculate_estimated_frequencies(args.fasta, sensing_matrix, kmer, lamb) np.savetxt(args.output, xstar, delimiter=",", fmt="%f") return 0 if __name__ == "__main__": sys.exit(main())