annotate mirgene.py @ 35:293aa8cbbc20 draft

Uploaded
author glogobyte
date Mon, 25 Apr 2022 07:34:04 +0000
parents 23a88a3ec37d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
1 from mirgene_functions import *
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
2 from mirgene_graphs import *
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
3 import time
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
4 from multiprocessing import Process, Queue, Lock, Pool, Manager, Value
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
5 import subprocess
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
6 import argparse
31
23a88a3ec37d Uploaded
glogobyte
parents: 30
diff changeset
7 import sys
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
8
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
9 subprocess.call(['mkdir','-p','split1','split2','split3','split4','Counts','Diff/temp_con','Diff/temp_tre','Diff/n_temp_con','Diff/n_temp_tre'])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
10
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
11 parser = argparse.ArgumentParser()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
12 parser.add_argument("-analysis", "--anal", help="choose type of analysis", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
13 parser.add_argument("-con", "--control", help="input fastq file (controls)", nargs='+', default=[])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
14 parser.add_argument("-tre", "--treated", help="input fastq file (treated)", nargs='+', default=[] )
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
15 parser.add_argument("-tool_dir", "--tool_directory", help="tool directory path", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
16 parser.add_argument("-gen", "--org_name", help="Organism", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
17 parser.add_argument("-f", "--flag", help="choose the database (MirBase,MirGene)", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
18 parser.add_argument("-percentage", "--per", help="Percentage of Samples", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
19 parser.add_argument("-counts", "--count", help="Counts for filtering", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
20 parser.add_argument("-name1", "--group1", help="Samples group 1", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
21 parser.add_argument("-name2", "--group2", help="Samples group 2", action="store")
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
22 args = parser.parse_args()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
23
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
24
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
25 #########################################################################3###############################################################################################################################################################################################
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
26
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
27 if __name__ == '__main__':
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
28
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
29 starttime = time.time()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
30
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
31 lock = Lock()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
32 manager = Manager()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
33
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
34 # Download reference miRNA sequences from MirBase
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
35 mature_mirnas=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
36 ps_mature=Process(target=download_matures,args=(mature_mirnas,args.org_name))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
37 ps_mature.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
38
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
39 # Keep the names of the files and location paths
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
40 args.control[0]=args.control[0][1:]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
41 args.control[len(args.control)-1][:-1]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
42 control = [(args.control[i:i+2]) for i in range(0, len(args.control), 2)]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
43
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
44 args.treated[0]=args.treated[0][1:]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
45 args.treated[len(args.treated)-1][:-1]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
46 treated = [(args.treated[i:i+2]) for i in range(0, len(args.treated), 2)]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
47
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
48
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
49 ############## Detection of templated isoforms ################
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
50
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
51 #radar = manager.list([0,0,0,0])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
52 con_samples = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
53 con_data= manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
54 con_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
55 con_names_seqs=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
56 deseq=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
57 con_unmap_seq=manager.Value('i',0)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
58 con_unmap_counts=manager.Value('i',0)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
59 con_mirna_names=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
60 ini_con_samples = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
61
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
62 #radar1 = manager.list([0,0,0,0])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
63 tre_samples = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
64 tre_data = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
65 tre_file_order = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
66 tre_names_seqs=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
67 deseq1=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
68 tre_unmap_seq = manager.Value('i',0)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
69 tre_unmap_counts = manager.Value('i',0)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
70 tre_mirna_names=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
71 ini_tre_samples = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
72
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
73 # Wait for the download of reference miRNA sequences
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
74 ps_mature.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
75 mature_mirnas=list(mature_mirnas)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
76
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
77 # Processing of the detected miRNAs from SAM files
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
78 ps_sam = [Process(target=sam_edit,args=(mature_mirnas,path[1][:-1],path[0].split(",")[0],"c",lock,con_samples,con_data,con_file_order,con_unmap_seq,con_names_seqs,deseq,con_mirna_names,ini_con_samples,con_unmap_counts)) for path in control]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
79 ps_sam.extend([Process(target=sam_edit,args=(mature_mirnas,path[1][:-1],path[0].split(",")[0],"t",lock,tre_samples,tre_data,tre_file_order,tre_unmap_seq,tre_names_seqs,deseq1,tre_mirna_names,ini_tre_samples,tre_unmap_counts)) for path in treated])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
80
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
81 # Wait for processing of SAM files to finish
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
82 [p.start() for p in ps_sam]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
83 [p.join() for p in ps_sam]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
84
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
85 # Generate a histogram
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
86 ps_hist=[Process(target=hist_red,args=(ini_con_samples,'c',args.group1))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
87 ps_hist.extend([Process(target=hist_red,args=(ini_tre_samples,'t',args.group2))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
88 [x.start() for x in ps_hist]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
89
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
90 # Convert managers to lists
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
91 con_samples = list(con_samples)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
92 tre_samples = list(tre_samples)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
93 con_file_order=list(con_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
94 tre_file_order=list(tre_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
95 deseq=list(deseq)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
96 deseq1=list(deseq1)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
97
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
98 # Remove duplicates and sorting
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
99 con_names_seqs=list(con_names_seqs)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
100 con_names_seqs.sort()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
101 con_names_seqs=list(con_names_seqs for con_names_seqs,_ in itertools.groupby(con_names_seqs))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
102
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
103 tre_names_seqs=list(tre_names_seqs)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
104 tre_names_seqs.sort()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
105 tre_names_seqs=list(tre_names_seqs for tre_names_seqs,_ in itertools.groupby(tre_names_seqs))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
106
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
107 # initialization of new managers
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
108 new_con_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
109 new_tre_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
110 new_deseq=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
111 new_deseq1=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
112
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
113 # add uncommon detected mirnas among the samples
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
114 ps_un_mirnas=[Process(target=uncommon_mirnas,args=(sampp,con_names_seqs,lock,new_deseq,con_file_order[i],new_con_file_order)) for i,sampp in enumerate(deseq)]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
115 ps_un_mirnas.extend([Process(target=uncommon_mirnas,args=(sampp,tre_names_seqs,lock,new_deseq1,tre_file_order[i],new_tre_file_order)) for i,sampp in enumerate(deseq1)])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
116
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
117 # Wait for processing of uncommon detected mirnas to finish
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
118 [z.start() for z in ps_un_mirnas]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
119 [z.join() for z in ps_un_mirnas]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
120
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
121 # Convert managers to lists
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
122 new_deseq=list(new_deseq)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
123 new_deseq1=list(new_deseq1)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
124 con_file_order=list(new_con_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
125 tre_file_order=list(new_tre_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
126
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
127 # Genereation of count matrices per group (controls - treated)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
128 control_group=[[x[0],x[2]] for x in new_deseq[0]]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
129 [control_group[i].append(y[i][1]) for i,_ in enumerate(control_group) for y in new_deseq]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
130
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
131 treated_group=[[x[0],x[2]] for x in new_deseq1[0]]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
132 [treated_group[i].append(y[i][1]) for i,_ in enumerate(treated_group) for y in new_deseq1]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
133
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
134 # Keep a copy of count matrices
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
135 control_group_copy=copy.deepcopy(list(control_group))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
136 treated_group_copy=copy.deepcopy(list(treated_group))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
137
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
138 # Initialization of managers
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
139 merg_nam_control_group=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
140 merg_nam_treated_group=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
141
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
142 # Merging of names different names for the same mirna sequence per group (controls, treated) to avoid duplicates
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
143 ps_merge = [Process(target=merging_names,args=(control_group_copy,merg_nam_control_group))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
144 ps_merge.extend([Process(target=merging_names,args=(treated_group_copy,merg_nam_treated_group))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
145 [x.start() for x in ps_merge]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
146
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
147 # Add unique mirna sequences between groups (all groups will have the same amount of sequences)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
148 con_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
149 tre_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
150
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
151 ps_bw = [Process(target=black_white,args=(con_names_seqs,tre_names_seqs,treated_group,tre_list))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
152 ps_bw.extend([Process(target=black_white,args=(tre_names_seqs,con_names_seqs,control_group,con_list))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
153 [x.start() for x in ps_bw]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
154 [x.join() for x in ps_bw]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
155
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
156 control_group=list(con_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
157 treated_group=list(tre_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
158
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
159 # Detection of duplications
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
160 dupes=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
161
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
162 ps_dupes = Process(target=merging_dupes,args=(control_group,dupes))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
163 ps_dupes.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
164 ps_dupes.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
165
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
166 dupes=list(dupes)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
167
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
168 # Merging the duplications in one entry with all different names
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
169 con_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
170 tre_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
171
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
172 ps_ap_merg_dupes = [Process(target=apply_merging_dupes,args=(control_group,dupes,con_list))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
173 ps_ap_merg_dupes.extend([Process(target=apply_merging_dupes,args=(treated_group,dupes,tre_list))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
174 [x.start() for x in ps_ap_merg_dupes]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
175
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
176 # Preparation of reference sequences (isodforms) for the detection of non template mirnas
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
177 if args.anal=="2":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
178 all_iso = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
179 ps_non_iso = Process(target=non_template_ref,args=(con_samples,tre_samples,all_iso))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
180 ps_non_iso.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
181
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
182 # Finishing the process for merging
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
183 [x.join() for x in ps_merge]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
184 merg_nam_control_group=list(merg_nam_control_group)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
185 merg_nam_treated_group=list(merg_nam_treated_group)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
186
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
187 # Export the database and the graphs
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
188 procs = [Process(target=DB_write,args=(x[0],x[1],x[2],x[3],1)) for x in con_data]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
189 procs.extend([Process(target=DB_write,args=(x[0],x[1],x[2],x[3],1)) for x in tre_data])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
190 procs.extend([Process(target=make_spider,args=(merg_nam_control_group,merg_nam_treated_group,args.group1,args.group2))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
191
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
192 if args.anal == "1":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
193 procs.extend([Process(target=pie_temp,args=(merg_nam_control_group,con_unmap_seq.value,con_unmap_counts.value,merg_nam_treated_group,tre_unmap_seq.value,tre_unmap_counts.value,args.group1,args.group2))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
194
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
195 [p.start() for p in procs]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
196
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
197 # Export the pdf report file
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
198 if args.anal=="1":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
199 [x.join() for x in ps_hist]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
200 [p.join() for p in procs]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
201 ps_pdf = Process(target=pdf_before_DE,args=(args.anal,args.group1,args.group2))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
202 ps_pdf.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
203
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
204 [x.join() for x in ps_ap_merg_dupes]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
205 control_group=list(con_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
206 treated_group=list(tre_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
207
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
208 # Filters low count mirnas (otpional)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
209 if int(args.per)!=-1:
31
23a88a3ec37d Uploaded
glogobyte
parents: 30
diff changeset
210 if int(args.per)>0 and int(args.per)<=100 and int(args.count)>0:
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
211 fil_con_group=manager.list()
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
212 fil_tre_group=manager.list()
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
213
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
214 ps_low_counts = Process(target=filter_low_counts,args=(control_group,treated_group,fil_con_group,fil_tre_group,args.per,args.count))
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
215 ps_low_counts.start()
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
216 ps_low_counts.join()
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
217
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
218 fil_con_group=list(fil_con_group)
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
219 fil_tre_group=list(fil_tre_group)
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
220
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
221 else:
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
222 sys.exit("Not acceptable values for filter")
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
223
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
224 if "fil_con_group" not in locals() or "fil_con_group" not in globals():
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
225 fil_con_group=control_group
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
226 fil_tre_group=treated_group
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
227
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
228 # export count matrices
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
229 ps_write = Process(target=write_main,args=(control_group, treated_group, fil_con_group, fil_tre_group, con_file_order,tre_file_order,1,args.group1,args.group2,args.per))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
230 ps_write.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
231
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
232 # export counts files compatible with Deseq2 and EdgeR
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
233 ps1_matrix = [Process(target=temp_counts_to_diff,args=(con_file_order,fil_con_group,"Diff/temp_con/",0))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
234 ps1_matrix.extend([Process(target=temp_counts_to_diff,args=(tre_file_order,fil_tre_group,"Diff/temp_tre/",0))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
235 [p.start() for p in ps1_matrix]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
236
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
237 if args.anal=="1":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
238 ps_pdf.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
239 if args.anal=="2":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
240 [p.join() for p in procs]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
241 [x.join() for x in ps_hist]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
242
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
243 ps_write.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
244 [p.join() for p in ps1_matrix]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
245
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
246 ############################## Detection of Both #######################################
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
247
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
248 if args.anal == "2":
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
249
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
250 # Initialization of the managers between the proccesses
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
251 # First group of samples (controls)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
252 n_con_data= manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
253 n_con_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
254 n_con_names_seqs=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
255 n_deseq=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
256
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
257 # Second group of samples (treated)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
258 n_tre_data = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
259 n_tre_file_order = manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
260 n_tre_names_seqs=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
261 n_deseq1=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
262
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
263 # Preparation of reference sequences
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
264 new_ref_mirnas = list(mature_mirnas)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
265 ps_non_iso.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
266
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
267
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
268 all_iso=list(all_iso)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
269 new_ref_mirnas.extend(all_iso)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
270
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
271 # Processing of non template miRNAs from SAM files
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
272 ps_sam = [Process(target=non_sam_edit,args=(new_ref_mirnas,path[1][:-1],path[0].split(",")[0],"c",lock,n_con_data,n_con_file_order,n_deseq,n_con_names_seqs)) for path in control]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
273 ps_sam.extend([Process(target=non_sam_edit,args=(new_ref_mirnas,path[1][:-1],path[0].split(",")[0],"t",lock,n_tre_data,n_tre_file_order,n_deseq1,n_tre_names_seqs)) for path in treated])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
274
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
275 [p.start() for p in ps_sam]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
276 [p.join() for p in ps_sam]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
277
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
278 # Convert managers to lists
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
279 n_con_file_order=list(n_con_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
280 n_tre_file_order=list(n_tre_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
281 n_deseq=list(n_deseq)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
282 n_deseq1=list(n_deseq1)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
283
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
284 # Remove duplicates and sorting
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
285 n_con_names_seqs=list(n_con_names_seqs)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
286 n_con_names_seqs.sort()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
287 n_con_names_seqs=list(n_con_names_seqs for n_con_names_seqs,_ in itertools.groupby(n_con_names_seqs))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
288
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
289 n_tre_names_seqs=list(n_tre_names_seqs)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
290 n_tre_names_seqs.sort()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
291 n_tre_names_seqs=list(n_tre_names_seqs for n_tre_names_seqs,_ in itertools.groupby(n_tre_names_seqs))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
292
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
293 # initialization of new managers
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
294 new_n_con_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
295 new_n_tre_file_order=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
296 n_new_deseq=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
297 n_new_deseq1=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
298
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
299 # add uncommon detected mirnas among the samples
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
300 ps_deseq=[Process(target=uncommon_mirnas,args=(sampp,n_con_names_seqs,lock,n_new_deseq,n_con_file_order[i],new_n_con_file_order)) for i,sampp in enumerate(n_deseq)]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
301 ps_deseq.extend([Process(target=uncommon_mirnas,args=(sampp,n_tre_names_seqs,lock,n_new_deseq1,n_tre_file_order[i],new_n_tre_file_order)) for i,sampp in enumerate(n_deseq1)])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
302
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
303 # Wait for processing of uncommon detected mirnas to finish
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
304 [x.start() for x in ps_deseq]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
305 [x.join() for x in ps_deseq]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
306
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
307 # Convert managers to lists
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
308 n_new_deseq=list(n_new_deseq)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
309 n_new_deseq1=list(n_new_deseq1)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
310 n_con_file_order=list(new_n_con_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
311 n_tre_file_order=list(new_n_tre_file_order)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
312
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
313 # Genereation of count matrices per group (controls - treated)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
314 n_control_group=[[x[0],x[2]] for x in n_new_deseq[0]]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
315 [n_control_group[i].append(y[i][1]) for i,_ in enumerate(n_control_group) for y in n_new_deseq]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
316
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
317 n_treated_group=[[x[0],x[2]] for x in n_new_deseq1[0]]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
318 [n_treated_group[i].append(y[i][1]) for i,_ in enumerate(n_treated_group) for y in n_new_deseq1]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
319
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
320 # Keep a copy of count matrices
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
321 n_control_group_copy=copy.deepcopy(list(n_control_group))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
322 n_treated_group_copy=copy.deepcopy(list(n_treated_group))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
323
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
324 # Initialization of managers
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
325 merg_nam_n_control_group=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
326 merg_nam_n_treated_group=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
327
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
328 # Merging of different names for the same mirna sequence per group (controls, treated) to avoid duplicates
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
329 ps_merge = [Process(target=merging_names,args=(n_control_group_copy,merg_nam_n_control_group))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
330 ps_merge.extend([Process(target=merging_names,args=(n_treated_group_copy,merg_nam_n_treated_group))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
331 [x.start() for x in ps_merge]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
332
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
333 # Add unique mirna sequences between groups (all groups will have the same amount of sequences)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
334 n_con_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
335 n_tre_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
336
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
337 ps_bw = [Process(target=black_white,args=(n_con_names_seqs,n_tre_names_seqs,n_treated_group,n_tre_list))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
338 ps_bw.extend([Process(target=black_white,args=(n_tre_names_seqs,n_con_names_seqs,n_control_group,n_con_list))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
339 [x.start() for x in ps_bw]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
340 [x.join() for x in ps_bw]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
341
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
342 n_control_group=list(n_con_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
343 n_treated_group=list(n_tre_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
344
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
345 # Detection of duplications
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
346 n_dupes=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
347
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
348 ps_dupes = Process(target=merging_dupes,args=(n_control_group,n_dupes))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
349 ps_dupes.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
350 ps_dupes.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
351
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
352 n_dupes=list(n_dupes)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
353
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
354 # Merging the duplications in one entry with all different names
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
355 n_con_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
356 n_tre_list=manager.list()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
357
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
358 ps_ap_merg_dupes = [Process(target=apply_merging_dupes,args=(n_control_group,n_dupes,n_con_list))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
359 ps_ap_merg_dupes.extend([Process(target=apply_merging_dupes,args=(n_treated_group,n_dupes,n_tre_list))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
360 [x.start() for x in ps_ap_merg_dupes]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
361
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
362 # Finishing the process for merging
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
363 [x.join() for x in ps_merge]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
364 merg_nam_n_control_group=list(merg_nam_n_control_group)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
365 merg_nam_n_treated_group=list(merg_nam_n_treated_group)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
366
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
367 # Export the database and the graphs
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
368 procs = [Process(target=DB_write,args=(x[0],x[1],x[2],x[3],2)) for x in n_con_data]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
369 procs.extend([Process(target=DB_write,args=(x[0],x[1],x[2],x[3],2)) for x in n_tre_data])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
370 procs.extend([Process(target=logo_seq_red,args=(merg_nam_n_control_group,'c',args.group1))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
371 procs.extend([Process(target=logo_seq_red,args=(merg_nam_n_treated_group,'t',args.group2))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
372 procs.extend([Process(target=pie_non_temp,args=(merg_nam_control_group,merg_nam_n_control_group,merg_nam_treated_group,merg_nam_n_treated_group,con_unmap_seq.value,tre_unmap_seq.value,con_unmap_counts.value,tre_unmap_counts.value,args.group1,args.group2))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
373
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
374 [p.start() for p in procs]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
375 [p.join() for p in procs]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
376
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
377 procs1 = Process(target=pdf_before_DE,args=(args.anal,args.group1,args.group2))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
378 procs1.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
379
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
380 [x.join() for x in ps_ap_merg_dupes]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
381 n_control_group=list(n_con_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
382 n_treated_group=list(n_tre_list)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
383
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
384 # Filters low count mirnas (otpional)
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
385 if int(args.per)!=-1:
31
23a88a3ec37d Uploaded
glogobyte
parents: 30
diff changeset
386 if int(args.per)>0 and int(args.per)<=100 and int(args.count)>0:
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
387
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
388 n_fil_con_group=manager.list()
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
389 n_fil_tre_group=manager.list()
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
390
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
391 ps_low_counts = Process(target=filter_low_counts,args=(n_control_group,n_treated_group,n_fil_con_group,n_fil_tre_group,args.per,args.count))
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
392 ps_low_counts.start()
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
393 ps_low_counts.join()
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
394
30
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
395 n_fil_con_group=list(n_fil_con_group)
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
396 n_fil_tre_group=list(n_fil_tre_group)
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
397 else:
d119424f67b6 Uploaded
glogobyte
parents: 28
diff changeset
398 sys.exit("Not acceptable values for filter")
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
399
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
400 if "n_fil_con_group" not in locals() or "n_fil_con_group"not in globals():
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
401 n_fil_con_group=n_control_group
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
402 n_fil_tre_group=n_treated_group
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
403
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
404
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
405 ps_write = Process(target=write_main,args=(n_control_group, n_treated_group,n_fil_con_group, n_fil_tre_group, n_con_file_order, n_tre_file_order,2,args.group1,args.group2,args.per))
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
406 ps_write.start()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
407
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
408 ps1_matrix = [Process(target=nontemp_counts_to_diff,args=(n_con_file_order,n_fil_con_group,con_file_order,fil_con_group,"Diff/n_temp_con/",0))]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
409 ps1_matrix.extend([Process(target=nontemp_counts_to_diff,args=(n_tre_file_order,n_fil_tre_group,tre_file_order,fil_tre_group,"Diff/n_temp_tre/",0))])
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
410 [p.start() for p in ps1_matrix]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
411
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
412 ps_write.join()
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
413 [p.join() for p in ps1_matrix]
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
414 procs1.join()
28
537dcf5b0133 Uploaded
glogobyte
parents: 21
diff changeset
415 print('Running time: {} seconds'.format(round(time.time() - starttime,2)))
4
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
416
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
417
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
418
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
419
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
420
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
421
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
422
f44185f616bc Uploaded
glogobyte
parents:
diff changeset
423