Mercurial > repos > qfab > usearch_map_reads_to_otus
comparison usearch_map_reads_to_otu/scripts/otu_table_transform.py @ 0:c10d09023766 draft
Uploaded
author | qfab |
---|---|
date | Thu, 29 May 2014 00:51:18 -0400 |
parents | |
children | 87603fcae838 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c10d09023766 |
---|---|
1 import sys, os | |
2 #sys.path.insert(0, 'scripts'); | |
3 import parseFasta | |
4 | |
5 # Create OTU Table | |
6 # OTU_Lable | Count | Sequence | |
7 # | |
8 # Author: Anne Kunert | |
9 # | |
10 | |
11 OTUmap = sys.argv[1] | |
12 OTUcount = sys.argv[2] | |
13 | |
14 def transform(file): | |
15 seq = parseFasta.FastaParser(OTUmap) | |
16 with open(file) as f: | |
17 lis=[x.split() for x in f] | |
18 end="" | |
19 line="" | |
20 myseq="" | |
21 for x in zip(*lis): | |
22 otu_lable = x[0] | |
23 for item in seq: | |
24 if item == otu_lable: | |
25 myseq = seq.records[item]['sequence'] | |
26 myseq = myseq.replace('\n','') | |
27 for y in x: | |
28 line= line+str(y)+"\t" | |
29 print(line+"\t"+myseq) | |
30 line="" | |
31 myseq="" | |
32 # | |
33 transform(OTUcount) |