diff options
author | Calvin <calvin@EESI> | 2013-05-10 12:58:01 -0400 |
---|---|---|
committer | Calvin <calvin@EESI> | 2013-05-10 12:58:01 -0400 |
commit | 59161d6a4072e35d09433ec6e6f957b28a2ff009 (patch) | |
tree | eb14a4d78b8c731ecbd52c601bbeeac6545e3d6a /src/python | |
parent | cb668cbf756c2d5454877d8f90c4b9dc89043c1d (diff) |
don't use an output directory, and use basename's for the OTU_table
Diffstat (limited to 'src/python')
-rwxr-xr-x | src/python/multifasta_to_otu | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/python/multifasta_to_otu b/src/python/multifasta_to_otu index 9039709..3cc8f3e 100755 --- a/src/python/multifasta_to_otu +++ b/src/python/multifasta_to_otu @@ -34,7 +34,6 @@ def main(): parser.add_argument("-o", "--otu-table", help="otu_table", required=True) parser.add_argument("-t", "--trained-matrix", help="your trained matrix ", required=True) parser.add_argument("-f", "--trained-fasta", help="the fasta file used to train your matrix", required=True) - parser.add_argument("-d", "--output-directory", help="quikr output directory", required=True) parser.add_argument("-l", "--lamb", type=int, help="the default lambda value is 10,000") parser.add_argument("-k", "--kmer", type=int, help="specifies which kmer to use, default=6") parser.add_argument("-j", "--jobs", type=int, help="specifies how many jobs to run at once, default=number of CPUs") @@ -44,16 +43,11 @@ def main(): jobs = multiprocessing.cpu_count() trained_matrix = args.trained_matrix input_directory = args.input_directory - output_directory = args.output_directory # Make sure our input exist if not os.path.isdir(args.input_directory): parser.error("Input directory not found") - if not os.path.isdir(args.output_directory): - print "Output directory not found, creating directory" - os.mkdir(args.output_directory) - if not os.path.isfile(args.trained_matrix): parser.error("Custom trained matrix not found") @@ -109,7 +103,7 @@ def main(): count_sequences = Popen(["grep", "-c" , "^>", fasta], stdout=PIPE) number_of_sequences = int(count_sequences.stdout.readline()) - proportions = np.loadtxt(output_directory + "/" + os.path.basename(fasta)); + proportions = results[fasta_it] for proportion, proportion_it in map(None, proportions, range(len(proportions))): number_of_reads[proportion_it, fasta_it] = round(proportion * number_of_sequences) @@ -135,6 +129,9 @@ def main(): #write out our fasta file row writer.writerow(['# QIIME vGail OTU table']) + for fasta, it, in map(None, fasta_list, range(len(fasta_list))): + fasta_list[it] = os.path.basename(fasta) + fasta_row = ['#OTU_ID'] fasta_row.append(' '.join(fasta_list)) fasta_row = [' '.join(fasta_row)] @@ -150,10 +147,8 @@ def main(): def quikr_call(fasta_file): print os.path.basename(fasta_file) - output_location = output_directory + "/" + os.path.basename(fasta_file) xstar = q.calculate_estimated_frequencies(fasta_file, trained_matrix, kmer, lamb) - np.savetxt(output_location, xstar, delimiter=",", fmt="%f") return xstar if __name__ == "__main__": |