-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHuGO_tree.py
More file actions
48 lines (42 loc) · 1.54 KB
/
Copy pathHuGO_tree.py
File metadata and controls
48 lines (42 loc) · 1.54 KB
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
46
47
48
import os
import csv
import time
import pandas as pd
import subprocess
from HuGO import HuGOvars
def clustalo(path, f_input):
cmd_clustalo = [
'clustalo',
'--infile',f_input,
'--MAC-RAM', '8000',
'--verbose',
'--guidetree-out', path + os.path.splitext(os.path.basename(f_input))[0] + '_tree.tree',
'--outfmt', 'clustal',
'--resno',
'--outfile', path + os.path.splitext(os.path.basename(f_input))[0] + '_alignment.clustal',
'--output-order', 'tree-order',
'--seqtype', 'protein',
'--force',
'--distmat-out=' + path + os.path.splitext(os.path.basename(f_input))[0] + '_matrix.pim',
'--percent-id',
'--full',
# '--hmm-in=HuGO/gbpc/GbpC.hmm',
# '--max-hmm-iterations=-1'
]
output,error = subprocess.Popen(cmd_clustalo, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
return(output,error)
def main(HuGO = HuGOvars()):
files = HuGO['files']
if HuGO['full']:
f_input = files['curated_fasta_full_clustered']
else:
f_input = files['curated_fasta_clustered']
print('Running HuGO tree using {}'.format(f_input))
output,error = clustalo(HuGO['paths']['clustalo'], f_input)
print(error)
f_treelog = HuGO['paths']['clustalo'] + 'clustalo.log'
with open(f_treelog, 'w+', newline='') as o:
o.write(output)
print('HuGO tree done.')
if __name__ == "__main__":
main()