-
Notifications
You must be signed in to change notification settings - Fork 0
/
Run_IS_IGC.py
55 lines (47 loc) · 2.41 KB
/
Run_IS_IGC.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from IGCexpansion.CodonGeneconv import ReCodonGeneconv
from IGCexpansion.IndCodonGeneconv import IndCodonGeneconv
import argparse
def main(args):
paralog = [args.paralog1, args.paralog2]
Force = None
alignment_file = './MafftAlignment/' + '_'.join(paralog) + '/' + '_'.join(paralog) + '_input.fasta'
newicktree = './YeastTree.newick'
if args.force:
if args.model == 'MG94':
Force = {5:0.0}
elif args.model == 'HKY':
Force = {4:0.0}
else:
Force = None
test = ReCodonGeneconv( newicktree, alignment_file, paralog, Model = args.model, Force = Force, clock = args.clock)
test.get_mle(True, True, 0, 'BFGS')
test.get_individual_summary(summary_path = './summary/')
#test.get_SitewisePosteriorSummary(summary_path = './Summary/')
if Force == None:
test.get_sitewise_loglikelihood_summary('./summary/' + '_'.join(paralog) + '_MG94_nonclock_sw_lnL.txt')
else:
test.get_sitewise_loglikelihood_summary('./summary/Force_' + '_'.join(paralog) + '_MG94_nonclock_sw_lnL.txt')
if __name__ == '__main__':
pair = ["EDN", "ECP"]
paralog = pair
Force = None
#Force = {5:0.0}
alignment_file = './EDN_ECP_Cleaned.fasta'
newicktree = './input_tree.newick'
test = ReCodonGeneconv( newicktree, alignment_file, paralog, Model = 'MG94', Force = Force, clock = None)
test.get_mle(True, True, 0, 'BFGS')
test.get_sitewise_loglikelihood_summary('./Summary/' + '_'.join(paralog) + '_MG94_nonclock_sw_lnL.txt')
Force = {5:0.0}
test_force = ReCodonGeneconv( newicktree, alignment_file, paralog, Model = 'MG94', Force = Force, clock = None)
test_force.update_by_x(test.x)
test_force._loglikelihood2()
test_force.get_sitewise_loglikelihood_summary('./Summary/Force_' + '_'.join(paralog) + '_MG94_nonclock_sw_lnL.txt')
Force = None
test = IndCodonGeneconv( newicktree, alignment_file, paralog, Model = 'MG94', Force = Force, clock = None)
test.get_mle(True, True, 0, 'BFGS')
test.get_sitewise_loglikelihood_summary('./Summary/' + '_'.join(paralog) + '_Ind_MG94_nonclock_sw_lnL.txt')
Force = {5:0.0}
test_force = IndCodonGeneconv( newicktree, alignment_file, paralog, Model = 'MG94', Force = Force, clock = None)
test_force.update_by_x(test.x)
test_force._loglikelihood2()
test_force.get_sitewise_loglikelihood_summary('./Summary/Force_' + '_'.join(paralog) + '_Ind_MG94_nonclock_sw_lnL.txt')