5555mafftpara = "--auto"
5656
5757auto_build_log = getLogging ('Used time' )
58+
59+
5860def start_args (input ):
5961 """
6062Argument parse
@@ -92,6 +94,9 @@ def start_args(input):
9294 default = False ,
9395 help = "The esrna mode is use SSU RNA sequence with extend SSU RNA sequence \
9496 (users provide) to reconstruct phylogenetic tree. " )
97+ autobuild_args .add_argument ('-db' , action = 'store' , dest = "db" ,
98+ default = "" ,
99+ help = "The absolute path for local database." )
95100 advance_args .add_argument ('--muscle' , action = 'store_true' , dest = 'muscle' ,
96101 default = True ,
97102 help = "Multiple sequence alignment by muscle. The default multiple sequence \
@@ -134,9 +139,9 @@ def starting(args):
134139starting run reconstruct tree
135140 :param args: arguments
136141 """
137- print ("Loading organism's names success.....\n " )
138- print ("The result are store in:{0}\n " .format (args .outdata ))
139- print ("Now loading data and constructing phylogenetic tree......" )
142+ print ("Loading organism's names success.....\n " )
143+ print ("The result are store in:{0}\n " .format (args .outdata ))
144+ print ("Now loading data and constructing phylogenetic tree......" )
140145
141146 in_put = args .spenames
142147
@@ -151,7 +156,6 @@ def starting(args):
151156 else :
152157 pass
153158
154-
155159 # Reconstruct phylogenetic tree by ssu RNA.
156160 if args .ssurna :
157161 setlogdir (out_put )
@@ -178,7 +182,8 @@ def starting(args):
178182 args .raxml , args .raxml_parameter ,
179183 args .fasttree , args .fasttree_parameter ,
180184 args .iqtree , args .iqtree_parameter ,
181- args .thread , args .extenddata )
185+ args .thread , args .extenddata ,
186+ args .db )
182187
183188 # Reconstruct phylogenetic tree by extend ssu rna method.
184189 elif args .essurna :
@@ -197,15 +202,16 @@ def starting(args):
197202 elif args .HCP :
198203 setlogdir (out_put )
199204 starting_hcp (in_put , out_put ,
200- args .muscle , args .muscle_parameter ,
201- args .clustalw , args .clustalw_parameter ,
202- args .mafft , args .mafft_parameter ,
203- args .gblocks , args .gblocks_parameter ,
204- args .trimal , args .trimal_parameter ,
205- args .raxml , args .raxml_parameter ,
206- args .fasttree , args .fasttree_parameter ,
207- args .iqtree , args .iqtree_parameter ,
208- args .thread )
205+ args .muscle , args .muscle_parameter ,
206+ args .clustalw , args .clustalw_parameter ,
207+ args .mafft , args .mafft_parameter ,
208+ args .gblocks , args .gblocks_parameter ,
209+ args .trimal , args .trimal_parameter ,
210+ args .raxml , args .raxml_parameter ,
211+ args .fasttree , args .fasttree_parameter ,
212+ args .iqtree , args .iqtree_parameter ,
213+ args .thread , args .db )
214+
209215
210216def starting_hcp (in_put , out_put ,
211217 args_muscle , args_muscle_p ,
@@ -215,25 +221,25 @@ def starting_hcp(in_put, out_put,
215221 args_trimal , args_trimal_p ,
216222 args_raxml , args_raxml_p ,
217223 args_fasttree , args_fasttree_p ,
218- args_iqtree ,args_iqtree_p ,
219- args_thread ):
224+ args_iqtree , args_iqtree_p ,
225+ args_thread , args_db ):
220226 '''reconstruct phylogenetic tree by hcp method'''
221227 hcp_input , recovery_dic = checkKeggOrganism (in_put )
222228 start = time .time ()
223- out_retrieve = doretrieve (hcp_input , out_put )
229+ out_retrieve = doretrieve (hcp_input , out_put , args_db )
224230 end = time .time ()
225231 auto_build_log .info ('Retrieving HCP sequences used time: {} Seconds' .format (end - start ))
226232
227233 if not recovery_dic == {}:
228- recovery (out_retrieve ,recovery_dic )
234+ recovery (out_retrieve , recovery_dic )
229235 # set default aligned by muscle if not specify clustalw
230236 start2 = time .time ()
231237 if args_clustalw :
232238 out_alg = doclustalw_file (out_retrieve , out_put , args_clustalw_p )
233239 elif args_mafft :
234- out_alg = domafft_file (out_retrieve , out_put , args_mafft_p ,args_thread )
240+ out_alg = domafft_file (out_retrieve , out_put , args_mafft_p , args_thread )
235241 elif args_muscle :
236- out_alg = domuscle_file (out_retrieve , out_put , args_muscle_p ,args_thread )
242+ out_alg = domuscle_file (out_retrieve , out_put , args_muscle_p , args_thread )
237243
238244 out_concat = cocat_path (out_alg )
239245
@@ -263,17 +269,16 @@ def starting_srna(in_put, out_put,
263269 args_trimal , args_trimal_p ,
264270 args_raxml , args_raxml_p ,
265271 args_fasttree , args_fasttree_p ,
266- args_iqtree ,args_iqtree_p ,
272+ args_iqtree , args_iqtree_p ,
267273 args_thread ):
268274 '''reconstruct phylogenetic tree by ssu rna method'''
269- ssu_input ,recovery_dic = checkSilvaOrganism (in_put )
275+ ssu_input , recovery_dic = checkSilvaOrganism (in_put )
270276 start = time .time ()
271277 out_retrieve = retrieve16srna (ssu_input , out_put )
272278 end = time .time ()
273279 auto_build_log .info ('Retrieving SSU rRNA sequences used time: {} Seconds' .format (end - start ))
274280 if not recovery_dic == []:
275- recovery_silva (out_retrieve ,recovery_dic ,ssu_input )
276-
281+ recovery_silva (out_retrieve , recovery_dic , ssu_input )
277282
278283 # set default aligned by muscle if not specify clustalw or mafft
279284 start2 = time .time ()
@@ -306,6 +311,7 @@ def starting_srna(in_put, out_put,
306311 end2 = time .time ()
307312 auto_build_log .info ('Constructing species tree used time: {} Seconds' .format (end2 - start2 ))
308313
314+
309315def starting_ehcp (in_put , out_put ,
310316 args_muscle , args_muscle_p ,
311317 args_clustalw , args_clustalw_p ,
@@ -314,17 +320,18 @@ def starting_ehcp(in_put, out_put,
314320 args_trimal , args_trimal_p ,
315321 args_raxml , args_raxml_p ,
316322 args_fasttree , args_fasttree_p ,
317- args_iqtree ,args_iqtree_p ,
318- args_thread , args_extenddata ):
323+ args_iqtree , args_iqtree_p ,
324+ args_thread , args_extenddata ,
325+ args_db ):
319326 '''reconstruct phylogenetic tree by ehcp method'''
320327 hcp_input , recovery_dic = checkKeggOrganism (in_put )
321328 start = time .time ()
322- out_retrieve = doretrieve (hcp_input , out_put )
329+ out_retrieve = doretrieve (hcp_input , out_put , args_db )
323330 end = time .time ()
324331 auto_build_log .info ('Retrieving HCP sequences used time: {} Seconds' .format (end - start ))
325332
326333 if not recovery_dic == {}:
327- recovery (out_retrieve ,recovery_dic )
334+ recovery (out_retrieve , recovery_dic )
328335 retrieve_pro = os .listdir (out_retrieve )
329336 for reline in retrieve_pro :
330337 fw_name = os .path .join (out_retrieve , reline )
@@ -341,7 +348,7 @@ def starting_ehcp(in_put, out_put,
341348 if args_clustalw :
342349 out_alg = doclustalw_file (out_retrieve , out_put , args_clustalw_p )
343350 elif args_mafft :
344- out_alg = domafft_file (out_retrieve , out_put , args_mafft_p ,args_thread )
351+ out_alg = domafft_file (out_retrieve , out_put , args_mafft_p , args_thread )
345352 elif args_muscle :
346353 out_alg = domuscle_file (out_retrieve , out_put , args_muscle_p , args_thread )
347354
@@ -363,6 +370,7 @@ def starting_ehcp(in_put, out_put,
363370 end2 = time .time ()
364371 auto_build_log .info ('Constructing species tree used time: {} Seconds' .format (end2 - start2 ))
365372
373+
366374def starting_esrna (in_put , out_put ,
367375 args_muscle , args_muscle_p ,
368376 args_clustalw , args_clustalw_p ,
@@ -371,17 +379,17 @@ def starting_esrna(in_put, out_put,
371379 args_trimal , args_trimal_p ,
372380 args_raxml , args_raxml_p ,
373381 args_fasttree , args_fasttree_p ,
374- args_iqtree ,args_iqtree_p ,
382+ args_iqtree , args_iqtree_p ,
375383 args_thread , args_extenddata ):
376384 '''reconstruct phylogenetic tree by ssu rna extend method'''
377385 extend_check = checkFile (args_extenddata )
378- ssu_input ,recovery_dic = checkSilvaOrganism (in_put )
386+ ssu_input , recovery_dic = checkSilvaOrganism (in_put )
379387 start = time .time ()
380388 out_retrieve = retrieve16srna (ssu_input , out_put )
381389 end = time .time ()
382390 auto_build_log .info ('Retrieving SSU rRNA sequences used time: {} Seconds' .format (end - start ))
383391 if not recovery_dic == {}:
384- recovery (out_retrieve ,recovery_dic )
392+ recovery (out_retrieve , recovery_dic )
385393 retrieve_srna_path = os .path .join (out_retrieve , 'rna_sequence.fasta' )
386394
387395 fw = open (retrieve_srna_path , 'a' )
@@ -418,4 +426,4 @@ def starting_esrna(in_put, out_put,
418426 args_raxml_p = raxmlpara_dna
419427 doraxml (out_f2p , out_put , args_raxml_p , args_thread )
420428 end2 = time .time ()
421- auto_build_log .info ('Constructing species tree used time: {} Seconds' .format (end2 - start2 ))
429+ auto_build_log .info ('Constructing species tree used time: {} Seconds' .format (end2 - start2 ))
0 commit comments