@@ -65,9 +65,12 @@ def _extract_orf_scores(self):
65
65
f .write (crispr_seq )
66
66
f .write ("\n " )
67
67
68
- cmd = 'tools/prodigal/prodigal'
69
- cmd += ' -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta'
70
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
68
+ #cmd = 'tools/prodigal/prodigal'
69
+ #cmd += ' -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta'
70
+
71
+ no_binary_cmd = "prodigal -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta"
72
+
73
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
71
74
process .communicate ()
72
75
73
76
with open ("prodigal_result.txt" ) as f :
@@ -207,14 +210,19 @@ def _extract_orf_scores_and_proteins(self):
207
210
f .write (crispr_seq )
208
211
f .write ("\n " )
209
212
210
- cmd = 'tools/prodigal/prodigal'
211
- cmd += ' -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta'
212
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
213
+ #cmd = 'tools/prodigal/prodigal'
214
+ #cmd += ' -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta'
215
+
216
+ no_binary_cmd = "prodigal -i file_for_prodigal.fa -o prodigal_result.txt -c -p meta"
217
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
213
218
process .communicate ()
214
219
215
- cmd = 'tools/prodigal/prodigal'
216
- cmd += ' -i file_for_prodigal.fa -p meta -a protein_results.fa'
217
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
220
+ #cmd = 'tools/prodigal/prodigal'
221
+ #cmd += ' -i file_for_prodigal.fa -p meta -a protein_results.fa'
222
+
223
+ no_binary_cmd = "prodigal -i file_for_prodigal.fa -p meta -a protein_results.fa"
224
+
225
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
218
226
process .communicate ()
219
227
220
228
with open ("prodigal_result.txt" ) as f :
@@ -290,8 +298,11 @@ def _extract_orf_scores_and_proteins(self):
290
298
self .dict_final_orf_result [key ] = list_scores
291
299
292
300
def _run_hmm_search (self ):
293
- cmd = 'tools/hmm_search/hmmsearch --tblout result_hmm.out tools/hmm_search/models_tandem.hmm protein_results.fa'
294
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
301
+ #cmd = 'tools/hmm_search/hmmsearch --tblout result_hmm.out tools/hmm_search/models_tandem.hmm protein_results.fa'
302
+
303
+ no_binary_cmd = "hmmsearch --tblout result_hmm.out tools/hmm_search/models_tandem.hmm protein_results.fa"
304
+
305
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
295
306
process .communicate ()
296
307
297
308
def _extract_best_score_from_hmm (self ):
@@ -386,24 +397,28 @@ def _extract_all_blast_scores(self):
386
397
387
398
db_file = 'Verified_repeats_dataset1.fa'
388
399
389
- cmd = 'tools/blasting/blastn -query file_with_all_consensus.fa'
390
- cmd += ' -db tools/blasting/'
391
- cmd += db_file
392
- cmd += ' -word_size 6'
393
- cmd += ' -outfmt 6 -out output_fasta_bulk_extraction1'
400
+ #cmd = 'tools/blasting/blastn -query file_with_all_consensus.fa'
401
+ #cmd += ' -db tools/blasting/'
402
+ #cmd += db_file
403
+ #cmd += ' -word_size 6'
404
+ #cmd += ' -outfmt 6 -out output_fasta_bulk_extraction1'
405
+
406
+ no_binary_cmd = f"blastn -query file_with_all_consensus.fa -db tools/blasting/{ db_file } -word_size 6 -outfmt 6 -out output_fasta_bulk_extraction1"
394
407
395
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
408
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
396
409
process .communicate ()
397
410
398
411
db_file = 'Verified_repeats_dataset2.fa'
399
412
400
- cmd = 'tools/blasting/blastn -query file_with_all_consensus.fa'
401
- cmd += ' -db tools/blasting/'
402
- cmd += db_file
403
- cmd += ' -word_size 6'
404
- cmd += ' -outfmt 6 -out output_fasta_bulk_extraction2'
413
+ #cmd = 'tools/blasting/blastn -query file_with_all_consensus.fa'
414
+ #cmd += ' -db tools/blasting/'
415
+ #cmd += db_file
416
+ #cmd += ' -word_size 6'
417
+ #cmd += ' -outfmt 6 -out output_fasta_bulk_extraction2'
418
+
419
+ no_binary_cmd = f"blastn -query file_with_all_consensus.fa -db tools/blasting/{ db_file } -word_size 6 -outfmt 6 -out output_fasta_bulk_extraction2"
405
420
406
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
421
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
407
422
process .communicate ()
408
423
409
424
with open ("output_fasta_bulk_extraction1" ) as f :
@@ -495,9 +510,11 @@ def _extract_mfe_scores(self):
495
510
f .write (consensus )
496
511
f .write ("\n " )
497
512
498
- cmd = "cat file_for_mfe.fa | tools/rna_fold/RNAfold --noLP --noPS > rna_fold_output.txt"
513
+ # cmd = "cat file_for_mfe.fa | tools/rna_fold/RNAfold --noLP --noPS > rna_fold_output.txt"
499
514
500
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
515
+ no_binary_cmd = "cat file_for_mfe.fa | RNAfold --noLP --noPS > rna_fold_output.txt"
516
+
517
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
501
518
process .communicate ()
502
519
503
520
with open ("rna_fold_output.txt" ) as f :
@@ -867,18 +884,22 @@ def _create_file(self):
867
884
f .write (self .crispr_seq )
868
885
869
886
def _call_prodigal (self ):
870
- cmd = 'tools/prodigal/prodigal'
871
- cmd += ' -i fasta_to_do_hmm_{}.fa -p meta -a protein_{}.fa' .format (self .index , self .index )
887
+ # cmd = 'tools/prodigal/prodigal'
888
+ # cmd += ' -i fasta_to_do_hmm_{}.fa -p meta -a protein_{}.fa'.format(self.index, self.index)
872
889
873
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
890
+ no_binary_cmd = f"prodigal -i fasta_to_do_hmm_{ self .index } .fa -p meta -a protein_{ self .index } .fa"
891
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
874
892
a , b = process .communicate ()
875
893
876
894
def _run_hmm_search (self , hmm_model ):
877
895
if os .stat ('protein_{}.fa' .format (self .index )).st_size != 0 :
878
- cmd = 'tools/hmm_search/hmmsearch --tblout {} {} {}' .format ('result_hmm_{}.out' .format (self .index ),
879
- hmm_model ,
880
- 'protein_{}.fa' .format (self .index ))
881
- process = subprocess .Popen (cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
896
+ #cmd = 'tools/hmm_search/hmmsearch --tblout {} {} {}'.format('result_hmm_{}.out'.format(self.index),
897
+ # hmm_model,
898
+ # 'protein_{}.fa'.format(self.index))
899
+
900
+ no_binary_cmd = f"tools/hmm_search/hmmsearch --tblout result_hmm_{ self .index } .out hmm_model protein_{ self .index } .fa"
901
+
902
+ process = subprocess .Popen (no_binary_cmd , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = True )
882
903
process .communicate ()
883
904
else :
884
905
self .hmm_score = 0.0
0 commit comments