Mercurial > repos > qfab > usearch_map_reads_to_otus
view 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 |
line wrap: on
line source
import sys, os #sys.path.insert(0, 'scripts'); import parseFasta # Create OTU Table # OTU_Lable | Count | Sequence # # Author: Anne Kunert # OTUmap = sys.argv[1] OTUcount = sys.argv[2] def transform(file): seq = parseFasta.FastaParser(OTUmap) with open(file) as f: lis=[x.split() for x in f] end="" line="" myseq="" for x in zip(*lis): otu_lable = x[0] for item in seq: if item == otu_lable: myseq = seq.records[item]['sequence'] myseq = myseq.replace('\n','') for y in x: line= line+str(y)+"\t" print(line+"\t"+myseq) line="" myseq="" # transform(OTUcount)