-
Notifications
You must be signed in to change notification settings - Fork 6
/
prodigal.py
39 lines (31 loc) · 1.72 KB
/
prodigal.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
"""
CRISPRCasIdentifier
Copyright (C) 2020 Victor Alexandre Padilha <[email protected]>,
Omer Salem Alkhnbashi <[email protected]>,
Shiraz Ali Shah <[email protected]>,
André Carlos Ponce de Leon Ferreira de Carvalho <[email protected]>,
Rolf Backofen <[email protected]>
This file is part of CRISPRcasIdentifier.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import subprocess as sp
import os
def prodigal(prodigal_cmd, fasta_file, completeness):
meta = ' -p meta ' if completeness == 'partial' else ''
fasta_file_preffix = fasta_file.rsplit('.', 1)[0]
output_fasta_file = fasta_file_preffix + '_proteins.fa'
log_file = fasta_file_preffix + '_prodigal.log'
prodigal_cmd += ' -i {input_fasta} -c -m -g 11 -a {output_fasta} -q' + meta
prodigal_cmd = prodigal_cmd.format(prodigal=prodigal_cmd, input_fasta=fasta_file, output_fasta=output_fasta_file)
with open(log_file, 'w') as lf:
sp.call(prodigal_cmd.split(), stdout=lf)
return output_fasta_file