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