-
Notifications
You must be signed in to change notification settings - Fork 0
/
assess_bin_quality.py
45 lines (27 loc) · 971 Bytes
/
assess_bin_quality.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#Michael Hoffert and Sophie Gunn
import os
from create_df import *
def read_cluster_csv(csv):
csv = open(csv)
rtd = {}
for line in [i.split(',') for i in csv.readlines()][1:]:
rtd[int(line[0])] = int(line[1].strip('\n'))
return rtd
def write_cluster_fastas(csv, all_fasta):
cluster_dict = read_cluster_csv(csv)
seqs = read_fasta(all_fasta)
fastas = []
command = os.popen('mkdir cluster_fastas')
for i in range(len(set(cluster_dict.values()))):
fastas.append(open('cluster_' + str(i) + '_out.fa','w'))
for key in cluster_dict.keys():
fastas[cluster_dict[key]].write(seqs[key + 1][0])
fastas[cluster_dict[key]].write(seqs[key + 1][1] + '\n')
cmd = os.popen('pwd')
for i in range(len(set(cluster_dict.values()))):
fastas[i].close()
cmd = os.popen("mv ./*out.fa ./cluster_fastas")
def run_checkm(
if __name__ == '__main__':
write_cluster_fastas('clusters.csv','MidCaymanRise_FS856_idba_assembly_fixed.fa')
#def script(