comparison fasta_tabular_converter.py @ 2:330dd8a8c31a draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/msp_fasta_tabular_converter commit 030207144f0811822dbdda9a10e036ff8e794d7c
author drosofff
date Fri, 25 Mar 2016 19:29:40 -0400
parents 2f7278120be9
children 36388b666bfc
comparison
equal deleted inserted replaced
1:2f7278120be9 2:330dd8a8c31a
24 seqdic["".join(stringlist)] += 1 # to dump the sequence of the previous item - try because of first missing stringlist variable 24 seqdic["".join(stringlist)] += 1 # to dump the sequence of the previous item - try because of first missing stringlist variable
25 except: pass 25 except: pass
26 stringlist=[] 26 stringlist=[]
27 else: 27 else:
28 stringlist.append(line[:-1]) 28 stringlist.append(line[:-1])
29 seqdic["".join(stringlist)] += 1 # for the last sequence 29 try:
30 seqdic["".join(stringlist)] += 1 # for the last sequence
31 except: pass # in case file to convert is empty
30 F.close() 32 F.close()
31 F = open(tabular, "w") 33 F = open(tabular, "w")
32 for seq in sorted(seqdic, key=seqdic.get, reverse=True): 34 for seq in sorted(seqdic, key=seqdic.get, reverse=True):
33 print >> F, "%s\t%s" % (seq, seqdic[seq]) 35 print >> F, "%s\t%s" % (seq, seqdic[seq])
34 F.close() 36 F.close()