Mercurial > repos > chemteam > mdanalysis_ramachandran_plot
annotate ramachandran_plots.py @ 3:8bd0e29927da draft
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 7a25958195ccc8f448dd64ddcc36e8f5e5979d8b"
| author | chemteam | 
|---|---|
| date | Wed, 20 May 2020 13:03:30 -0400 | 
| parents | ce0728b92289 | 
| children | 70a2d548e62c | 
| rev | line source | 
|---|---|
| 
0
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
1 #!/usr/bin/env python | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
2 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
3 import argparse | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
4 import csv | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
5 import sys | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
6 from collections import namedtuple | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
7 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
8 import MDAnalysis as mda | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
9 from MDAnalysis.lib.distances import calc_dihedrals | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
10 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
11 import matplotlib | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
12 import matplotlib.pyplot as plt | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
13 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
14 import numpy as np | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
15 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
16 import seaborn as sns | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
17 | 
| 
3
 
8bd0e29927da
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 7a25958195ccc8f448dd64ddcc36e8f5e5979d8b"
 
chemteam 
parents: 
1 
diff
changeset
 | 
18 matplotlib.use('Agg') # noqa | 
| 
 
8bd0e29927da
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 7a25958195ccc8f448dd64ddcc36e8f5e5979d8b"
 
chemteam 
parents: 
1 
diff
changeset
 | 
19 | 
| 
0
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
20 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
21 def parse_command_line(argv): | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
22 parser = argparse.ArgumentParser() | 
| 
1
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
23 parser.add_argument('--itraj', help='input traj') | 
| 
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
24 parser.add_argument('--istr', help='input str') | 
| 
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
25 parser.add_argument('--itrajext', help='input traj ext') | 
| 
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
26 parser.add_argument('--istrext', help='input str ext') | 
| 
0
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
27 parser.add_argument('--isegid1', help='segid 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
28 parser.add_argument('--iresid1', help='resid 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
29 parser.add_argument('--iname1', help='name 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
30 parser.add_argument('--isegid2', help='segid 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
31 parser.add_argument('--iresid2', help='resid 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
32 parser.add_argument('--iname2', help='name 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
33 parser.add_argument('--isegid3', help='segid 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
34 parser.add_argument('--iresid3', help='resid 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
35 parser.add_argument('--iname3', help='name 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
36 parser.add_argument('--isegid4', help='segid 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
37 parser.add_argument('--iresid4', help='resid 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
38 parser.add_argument('--iname4', help='name 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
39 parser.add_argument('--isegid5', help='segid 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
40 parser.add_argument('--iresid5', help='resid 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
41 parser.add_argument('--iname5', help='name 1') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
42 parser.add_argument('--isegid6', help='segid 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
43 parser.add_argument('--iresid6', help='resid 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
44 parser.add_argument('--iname6', help='name 2') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
45 parser.add_argument('--isegid7', help='segid 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
46 parser.add_argument('--iresid7', help='resid 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
47 parser.add_argument('--iname7', help='name 3') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
48 parser.add_argument('--isegid8', help='segid 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
49 parser.add_argument('--iresid8', help='resid 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
50 parser.add_argument('--iname8', help='name 4') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
51 parser.add_argument('--output', help='output') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
52 parser.add_argument('--oramachandran_plot', help='dihedral plot') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
53 return parser.parse_args() | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
54 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
55 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
56 args = parse_command_line(sys.argv) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
57 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
58 Dihedral = namedtuple( | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
59 'Dihedral', ['atom1', 'atom2', 'atom3', 'atom4']) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
60 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
61 # order of dihedral atom is the crystallographic definition | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
62 # (see glycanstructure.org) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
63 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
64 # phi | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
65 atom1 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
66 (args.isegid1, args.iresid1, args.iname1) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
67 atom2 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
68 (args.isegid2, args.iresid2, args.iname2) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
69 atom3 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
70 (args.isegid3, args.iresid3, args.iname3) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
71 atom4 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
72 (args.isegid4, args.iresid4, args.iname4) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
73 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
74 dihe_phi = Dihedral(atom1, atom2, atom3, atom4) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
75 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
76 # psi | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
77 atom1 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
78 (args.isegid5, args.iresid5, args.iname5) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
79 atom2 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
80 (args.isegid6, args.iresid6, args.iname6) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
81 atom3 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
82 (args.isegid7, args.iresid7, args.iname7) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
83 atom4 = "(segid %s and resid %s and name %s)" % \ | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
84 (args.isegid8, args.iresid8, args.iname8) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
85 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
86 dihe_psi = Dihedral(atom1, atom2, atom3, atom4) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
87 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
88 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
89 def calc_torsion(dihedral): | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
90 """atom 1 -4 are valid atom selections. torsion in degrees is returned""" | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
91 A = u.select_atoms(dihedral.atom1).positions | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
92 B = u.select_atoms(dihedral.atom2).positions | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
93 C = u.select_atoms(dihedral.atom3).positions | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
94 D = u.select_atoms(dihedral.atom4).positions | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
95 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
96 dihe = calc_dihedrals(A, B, C, D) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
97 return np.rad2deg(dihe) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
98 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
99 | 
| 
1
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
100 u = mda.Universe(args.istr, args.itraj, | 
| 
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
101 topology_format=args.istrext, format=args.itrajext) | 
| 
0
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
102 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
103 phi_trajdata = np.array( | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
104 [(u.trajectory.frame, calc_torsion(dihe_phi)) for ts in u.trajectory]) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
105 psi_trajdata = np.array( | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
106 [(u.trajectory.frame, calc_torsion(dihe_psi)) for ts in u.trajectory]) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
107 | 
| 
1
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
108 print(phi_trajdata, psi_trajdata) | 
| 
 
ce0728b92289
"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
 
chemteam 
parents: 
0 
diff
changeset
 | 
109 | 
| 
0
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
110 phi_frame, phi_series = phi_trajdata.T | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
111 psi_frame, psi_series = psi_trajdata.T | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
112 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
113 phi_series = np.concatenate(phi_series, axis=0) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
114 psi_series = np.concatenate(psi_series, axis=0) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
115 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
116 zip(phi_frame, phi_series, psi_series) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
117 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
118 with open(args.output, 'w') as f: | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
119 writer = csv.writer(f, delimiter='\t') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
120 writer.writerows(zip(phi_frame, phi_series, psi_series)) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
121 | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
122 with sns.axes_style("white"): | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
123 h = sns.jointplot(x=phi_series, y=psi_series, kind="kde", legend=True) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
124 h.set_axis_labels(r'$\Phi$ (degrees)', r'$\Psi$ (degrees)') | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
125 h.ax_joint.set_xlim(-180, 180) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
126 h.ax_joint.set_ylim(-180, 180) | 
| 
 
d710c7f00ae6
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
 
chemteam 
parents:  
diff
changeset
 | 
127 plt.savefig(args.oramachandran_plot, format='png') | 
