annotate ramachandran_plots.py @ 6:b17ce46509ad draft default tip

"planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit f1c3c88c7395f2e84cbc533199406aadb79c5c07"
author chemteam
date Fri, 13 Nov 2020 19:39:59 +0000
parents 4c36f5ad2799
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
1 #!/usr/bin/env python
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
2
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
3 import argparse
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
4 import csv
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
5 import sys
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
6 from collections import namedtuple
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
7
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
8 import MDAnalysis as mda
469ad3ea5a5f 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
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
10
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
11 import matplotlib
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
12 import matplotlib.pyplot as plt
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
13 import matplotlib.ticker as ticker
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
14
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
15
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
16 import numpy as np
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
17
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
18 import seaborn as sns
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
19
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
20
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
21 import yaml
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
22
3
5efd0c95f97e "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 7a25958195ccc8f448dd64ddcc36e8f5e5979d8b"
chemteam
parents: 1
diff changeset
23 matplotlib.use('Agg') # noqa
5efd0c95f97e "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 7a25958195ccc8f448dd64ddcc36e8f5e5979d8b"
chemteam
parents: 1
diff changeset
24
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
25
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
26 def parse_command_line(argv):
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
27 parser = argparse.ArgumentParser()
1
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
28 parser.add_argument('--itraj', help='input traj')
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
29 parser.add_argument('--istr', help='input str')
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
30 parser.add_argument('--itrajext', help='input traj ext')
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
31 parser.add_argument('--istrext', help='input str ext')
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
32 parser.add_argument('--iyml', help='input in yml format')
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
33 parser.add_argument('--output', help='output')
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
34 parser.add_argument('--oramachandran_plot', help='dihedral plot')
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
35 return parser.parse_args()
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
36
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
37
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
38 args = parse_command_line(sys.argv)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
39
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
40 with open(args.iyml) as file:
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
41 params = yaml.load(file, Loader=yaml.FullLoader)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
42
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
43 Dihedral = namedtuple(
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
44 'Dihedral', ['atom1', 'atom2', 'atom3', 'atom4'])
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
45
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
46 for k, v in params.items():
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
47 for a in ['phi', 'psi']:
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
48 assert (a in v), "Key %s is missing in inputs: %s " % (a, k)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
49 atoms = []
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
50 for b in ['atom1', 'atom2', 'atom3', 'atom4']:
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
51 assert (b in v[a]), "Key %s is missing in inputs: %s %s" % (
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
52 b, k, a)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
53 for c in ['segid', 'resid', 'name']:
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
54 assert (c in v[a][b]), \
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
55 "Key %s is missing in inputs: %s %s %s " % (c, k, a, b)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
56 atoms.append("(segid %s and resid %s and name %s)" %
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
57 (v[a][b]['segid'], v[a][b]['resid'], v[a][b]['name']))
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
58 print(atoms)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
59 if a == 'phi':
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
60 dihe_phi = Dihedral(atoms[0], atoms[1], atoms[2], atoms[3])
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
61 if a == 'psi':
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
62 dihe_psi = Dihedral(atoms[0], atoms[1], atoms[2], atoms[3])
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
63
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
64 # order of dihedral atom is the crystallographic definition
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
65 # (see glycanstructure.org)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
66
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
67 assert(dihe_phi), "phi dihedral doesn't exist"
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
68 assert(dihe_psi), "psi dihedral doesn't exist"
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
69
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
70
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
71 def calc_torsion(dihedral):
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
72 """atom 1 -4 are valid atom selections. torsion in degrees is returned"""
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
73 A = u.select_atoms(dihedral.atom1).positions
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
74 B = u.select_atoms(dihedral.atom2).positions
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
75 C = u.select_atoms(dihedral.atom3).positions
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
76 D = u.select_atoms(dihedral.atom4).positions
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
77
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
78 dihe = calc_dihedrals(A, B, C, D)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
79 return np.rad2deg(dihe)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
80
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
81
1
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
82 u = mda.Universe(args.istr, args.itraj,
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
83 topology_format=args.istrext, format=args.itrajext)
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
84
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
85 phi_trajdata = np.array(
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
86 [(u.trajectory.frame, calc_torsion(dihe_phi)) for ts in u.trajectory])
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
87 psi_trajdata = np.array(
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
88 [(u.trajectory.frame, calc_torsion(dihe_psi)) for ts in u.trajectory])
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
89
1
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
90 print(phi_trajdata, psi_trajdata)
5c38e38dbc35 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3b99f08f22b9e0c16c0a0adc82f8c16c1a25cedf"
chemteam
parents: 0
diff changeset
91
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
92 phi_frame, phi_series = phi_trajdata.T
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
93 psi_frame, psi_series = psi_trajdata.T
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
94
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
95 phi_series = np.concatenate(phi_series, axis=0)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
96 psi_series = np.concatenate(psi_series, axis=0)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
97
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
98 zip(phi_frame, phi_series, psi_series)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
99
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
100 with open(args.output, 'w') as f:
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
101 writer = csv.writer(f, delimiter='\t')
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
102 writer.writerows(zip(phi_frame, phi_series, psi_series))
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
103
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
104 with sns.axes_style("white"):
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
105 h = sns.jointplot(x=phi_series, y=psi_series,
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
106 kind="kde", space=0, legend=True)
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
107 h.set_axis_labels(r'$\phi$ (degrees)', r'$\psi$ (degrees)')
0
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
108 h.ax_joint.set_xlim(-180, 180)
469ad3ea5a5f planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1
chemteam
parents:
diff changeset
109 h.ax_joint.set_ylim(-180, 180)
4
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
110 h.ax_joint.xaxis.set_major_locator(ticker.MultipleLocator(60))
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
111 h.ax_joint.yaxis.set_major_locator(ticker.MultipleLocator(60))
4c36f5ad2799 "planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 1b23e024af45cc0999d9142d07de6897d4189ec2"
chemteam
parents: 3
diff changeset
112 plt.savefig(args.oramachandran_plot, format='png', bbox_inches='tight')