Mercurial > repos > qfab > usearch_map_reads_to_otus
view usearch_map_reads_to_otu/scripts/otu_table_transform.py @ 2:87603fcae838 draft default tip
Uploaded
author | qfab |
---|---|
date | Thu, 05 Jun 2014 01:03:51 -0400 |
parents | c10d09023766 |
children |
line wrap: on
line source
import sys, os 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+myseq) line="" myseq="" transform(OTUcount)