Next changeset 1:ce0728b92289 (2019-10-07) |
Commit message:
planemo upload for repository https://github.com/galaxycomputationalchemistry/galaxy-tools-compchem/ commit 3ff06e3182c3a1546ea0a3b29e0d4383e12169e1 |
added:
angle.py dihedrals.py distance.py hbonds.py macros.xml pca_cosine.py ramachandran_plots.py ramachandran_plots.xml rdf.py test-data/Angle_Analysis_Plot.png test-data/Angle_Analysis_raw_data.tabular test-data/Dihedral_Analysis_Plot.png test-data/Dihedral_analysis_raw_data.tabular test-data/Distance_Analysis_Plot.png test-data/Distance_Analysis_raw_data.tabular test-data/RDF_Analysis_Plot.png test-data/RDF_raw_data.tabular test-data/Ramachandran_Plot_raw_data.tabular test-data/test.dcd test-data/test.pdb |
b |
diff -r 000000000000 -r d710c7f00ae6 angle.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/angle.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,71 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys + +import MDAnalysis as mda + +import matplotlib +matplotlib.use('Agg') # noqa +import matplotlib.pyplot as plt + +import numpy as np +from numpy.linalg import norm + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--iresid1', help='resid 1') + parser.add_argument('--iname1', help='name 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--iresid2', help='resid 2') + parser.add_argument('--iname2', help='name 2') + parser.add_argument('--isegid3', help='segid 3') + parser.add_argument('--iresid3', help='resid 3') + parser.add_argument('--iname3', help='name 3') + parser.add_argument('--output', help='output') + parser.add_argument('--oangle_plot', help='angle plot') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid1, args.iresid1, args.iname1) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid2, args.iresid2, args.iname2) +atom3 = "(segid %s and resid %s and name %s)" % \ + (args.isegid3, args.iresid3, args.iname3) + + +def theta(u): + A = u.select_atoms(atom1).center_of_geometry() + B = u.select_atoms(atom2).center_of_geometry() + C = u.select_atoms(atom3).center_of_geometry() + BA = A - B + BC = C - B + theta = np.arccos(np.dot(BA, BC)/(norm(BA)*norm(BC))) + return np.rad2deg(theta) + + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") +data = np.array([(u.trajectory.frame, theta(u)) for ts in u.trajectory]) +frame, theta = data.T + +with open(args.output, 'w') as f: + writer = csv.writer(f, delimiter='\t') + writer.writerows(zip(frame, theta)) + +with open(args.output) as f: + g = [xtmp.strip() for xtmp in f] + data = [tuple(map(float, xtmp.split())) for xtmp in g[0:]] + time = [xtmp[0] for xtmp in data] + angle = [xtmp[1] for xtmp in data] + plt.plot(time, angle) + plt.xlabel('Frame No.') + plt.ylabel('Angle (degrees)') + plt.savefig(args.oangle_plot, format='png') |
b |
diff -r 000000000000 -r d710c7f00ae6 dihedrals.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dihedrals.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,78 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys + +import MDAnalysis as mda +from MDAnalysis.lib.distances import calc_dihedrals + +import matplotlib +matplotlib.use('Agg') # noqa +import matplotlib.pyplot as plt + +import numpy as np + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--iresid1', help='resid 1') + parser.add_argument('--iname1', help='name 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--iresid2', help='resid 2') + parser.add_argument('--iname2', help='name 2') + parser.add_argument('--isegid3', help='segid 3') + parser.add_argument('--iresid3', help='resid 3') + parser.add_argument('--iname3', help='name 3') + parser.add_argument('--isegid4', help='segid 4') + parser.add_argument('--iresid4', help='resid 4') + parser.add_argument('--iname4', help='name 4') + parser.add_argument('--output', help='output') + parser.add_argument('--odihedral_plot', help='dihedral plot') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid1, args.iresid1, args.iname1) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid2, args.iresid2, args.iname2) +atom3 = "(segid %s and resid %s and name %s)" % \ + (args.isegid3, args.iresid3, args.iname3) +atom4 = "(segid %s and resid %s and name %s)" % \ + (args.isegid4, args.iresid4, args.iname4) + + +def psi(u): + A = u.select_atoms(atom1).positions + B = u.select_atoms(atom2).positions + C = u.select_atoms(atom3).positions + D = u.select_atoms(atom4).positions + psi = calc_dihedrals(A, B, C, D) + return np.rad2deg(psi) + + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") +data = np.array([(u.trajectory.frame, psi(u)) for ts in u.trajectory]) +frame, psi = data.T +PSI = np.concatenate(psi, axis=0) + +zip(frame, PSI) + +with open(args.output, 'w') as f: + writer = csv.writer(f, delimiter='\t') + writer.writerows(zip(frame, PSI)) + +with open(args.output) as f: + g = [xtmp.strip() for xtmp in f] + data = [tuple(map(float, xtmp.split())) for xtmp in g[0:]] + time = [xtmp[0] for xtmp in data] + dihedral = [xtmp[1] for xtmp in data] + plt.plot(time, dihedral) + plt.xlabel('Frame No.') + plt.ylabel('Dihedral (degrees)') + plt.savefig(args.odihedral_plot, format='png') |
b |
diff -r 000000000000 -r d710c7f00ae6 distance.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/distance.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,56 @@ +#!/usr/bin/env python + +import argparse +import sys + +import MDAnalysis as mda + +import matplotlib +matplotlib.use('Agg') # noqa +import matplotlib.pyplot as plt + +import numpy as np + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--iresid1', help='resid 1') + parser.add_argument('--iname1', help='name 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--iresid2', help='resid 2') + parser.add_argument('--iname2', help='name 2') + parser.add_argument('--output', help='output') + parser.add_argument('--odistance_plot', help='odistance plot') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid1, args.iresid1, args.iname1) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid2, args.iresid2, args.iname2) + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") +x = u.select_atoms(atom1) +y = u.select_atoms(atom2) + +with open(args.output, 'w') as f: + for t in u.trajectory: + r = x.positions - y.positions + d = np.linalg.norm(r) + f.write(str(t.frame) + '\t ') + f.write(str(d) + '\n') + +with open(args.output) as f: + g = [xtmp.strip() for xtmp in f] + data = [tuple(map(float, xtmp.split())) for xtmp in g[0:]] + time = [xtmp[0] for xtmp in data] + distance = [xtmp[1] for xtmp in data] + plt.plot(time, distance) + plt.xlabel('Frame No.') + plt.ylabel(r'Distance ($\AA$)') + plt.savefig(args.odistance_plot, format='png') |
b |
diff -r 000000000000 -r d710c7f00ae6 hbonds.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hbonds.py Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,69 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys + +import MDAnalysis.analysis.hbonds + +import pandas as pd + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--idistance', help='cutoff distance') + parser.add_argument('--iangle', help='ctoff angle') + parser.add_argument('--output', help='output') + parser.add_argument('--ofreq_output', help='frequency output') + parser.add_argument('--onumber_output', help='number of hbond output') + parser.add_argument('--otime_output', help='time steps output') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +selection1 = "segid %s" % args.isegid1 +selection2 = "segid %s" % args.isegid2 +distance = float(args.idistance) +angle = float(args.iangle) + +u = MDAnalysis.Universe( + args.ipdb, args.idcd, topology_format="PDB", format="DCD") + +h = MDAnalysis.analysis.hbonds.HydrogenBondAnalysis( + u, selection1, selection2, distance=distance, angle=angle) +h.run() +h.generate_table() + +df = pd.DataFrame.from_records(h.table) +df.to_csv(args.output, sep='\t') + +t1 = list(h.count_by_type()) +t2 = list(h.count_by_time()) +t3 = list(h.timesteps_by_type()) + +with open(args.ofreq_output, 'w') as f: + f.write("donor_index\tacceptor_index\t\ + donor_resname\tdonor_resid\tdonor_atom\t\ + hydrogen_atom\tacceptor_reansme\tacceptor_resid\t\ + acceptor_atom\tfrequency\n") + writer = csv.writer(f, delimiter='\t') + writer.writerows(t1) + + +with open(args.onumber_output, 'w') as f1: + f1.write("time_step\tno_of_h_bonds\n") + writer = csv.writer(f1, delimiter='\t') + writer.writerows(t2) + +with open(args.otime_output, 'w') as f2: + f2.write("donor_index\tacceptor_index\t\ + donor_resname\tdonor_resid\tdonor_atom\t\ + hydrogen_atom\tacceptor_reansme\tacceptor_resid\t\ + acceptor_atom\ttime_step\n") + writer = csv.writer(f2, delimiter='\t') + writer.writerows(t3) |
b |
diff -r 000000000000 -r d710c7f00ae6 macros.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/macros.xml Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,38 @@ +<macros> + <token name="@VERSION@">0.19</token> + <xml name="requirements"> + <requirements> + <requirement type="package" version="0.19.2">mdanalysis</requirement> + <yield/> + </requirements> + </xml> + <xml name="analysis_inputs"> + <param format="dcd" name="dcdin" type="data" label="dcd trajectory input"/> + <param format="pdb" name="pdbin" type="data" label="pdb input"/> + <yield/> + </xml> + <xml name="sanitizer"> + <sanitizer invalid_char=""> + <valid initial="string.ascii_letters,string.digits"/> + </sanitizer> + <yield/> + </xml> + <xml name="sanitizer_resids"> + <sanitizer invalid_char=""> + <valid initial="string.digits"/> + </sanitizer> + <yield/> + </xml> + <xml name="tests_inputs"> + <param name="dcdin" value="test.dcd" /> + <param name="pdbin" value="test.pdb" /> + <yield/> + </xml> + <xml name="citations"> + <citations> + <citation type="doi">10.1093/bioinformatics/btz107</citation> + <citation type="doi">10.1002/jcc.21787</citation> + <yield/> + </citations> + </xml> +</macros> |
b |
diff -r 000000000000 -r d710c7f00ae6 pca_cosine.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pca_cosine.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,46 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys + +import MDAnalysis as mda +import MDAnalysis.analysis.pca as pca + +import numpy as np + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--icomponents', help='number of principle components') + parser.add_argument('--iindex', help='index of the PC') + parser.add_argument('--output', help='output') + parser.add_argument('--cosout', help='cosine output') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") + +components = int(args.icomponents) +pca_index = int(args.iindex) + +PSF_pca = pca.PCA(u, select='backbone') +PSF_pca.run() +n_pcs = np.where(PSF_pca.cumulated_variance > 0.95)[0][0] +atomgroup = u.select_atoms('backbone') + +pca_space = PSF_pca.transform(atomgroup, n_components=components) +cosine = mda.analysis.pca.cosine_content(pca_space, pca_index) + +PCA = list(pca_space) + +with open(args.output, 'w') as f: + writer = csv.writer(f, delimiter='\t') + writer.writerows(PCA) + +with open(args.cosout, 'w') as f1: + f1.write(str(cosine)) |
b |
diff -r 000000000000 -r d710c7f00ae6 ramachandran_plots.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ramachandran_plots.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,121 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys +from collections import namedtuple + +import MDAnalysis as mda +from MDAnalysis.lib.distances import calc_dihedrals + +import matplotlib +matplotlib.use('Agg') # noqa +import matplotlib.pyplot as plt + +import numpy as np + +import seaborn as sns + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--iresid1', help='resid 1') + parser.add_argument('--iname1', help='name 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--iresid2', help='resid 2') + parser.add_argument('--iname2', help='name 2') + parser.add_argument('--isegid3', help='segid 3') + parser.add_argument('--iresid3', help='resid 3') + parser.add_argument('--iname3', help='name 3') + parser.add_argument('--isegid4', help='segid 4') + parser.add_argument('--iresid4', help='resid 4') + parser.add_argument('--iname4', help='name 4') + parser.add_argument('--isegid5', help='segid 1') + parser.add_argument('--iresid5', help='resid 1') + parser.add_argument('--iname5', help='name 1') + parser.add_argument('--isegid6', help='segid 2') + parser.add_argument('--iresid6', help='resid 2') + parser.add_argument('--iname6', help='name 2') + parser.add_argument('--isegid7', help='segid 3') + parser.add_argument('--iresid7', help='resid 3') + parser.add_argument('--iname7', help='name 3') + parser.add_argument('--isegid8', help='segid 4') + parser.add_argument('--iresid8', help='resid 4') + parser.add_argument('--iname8', help='name 4') + parser.add_argument('--output', help='output') + parser.add_argument('--oramachandran_plot', help='dihedral plot') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +Dihedral = namedtuple( + 'Dihedral', ['atom1', 'atom2', 'atom3', 'atom4']) + +# order of dihedral atom is the crystallographic definition +# (see glycanstructure.org) + +# phi +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid1, args.iresid1, args.iname1) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid2, args.iresid2, args.iname2) +atom3 = "(segid %s and resid %s and name %s)" % \ + (args.isegid3, args.iresid3, args.iname3) +atom4 = "(segid %s and resid %s and name %s)" % \ + (args.isegid4, args.iresid4, args.iname4) + +dihe_phi = Dihedral(atom1, atom2, atom3, atom4) + +# psi +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid5, args.iresid5, args.iname5) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid6, args.iresid6, args.iname6) +atom3 = "(segid %s and resid %s and name %s)" % \ + (args.isegid7, args.iresid7, args.iname7) +atom4 = "(segid %s and resid %s and name %s)" % \ + (args.isegid8, args.iresid8, args.iname8) + +dihe_psi = Dihedral(atom1, atom2, atom3, atom4) + + +def calc_torsion(dihedral): + """atom 1 -4 are valid atom selections. torsion in degrees is returned""" + A = u.select_atoms(dihedral.atom1).positions + B = u.select_atoms(dihedral.atom2).positions + C = u.select_atoms(dihedral.atom3).positions + D = u.select_atoms(dihedral.atom4).positions + + dihe = calc_dihedrals(A, B, C, D) + return np.rad2deg(dihe) + + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") + +phi_trajdata = np.array( + [(u.trajectory.frame, calc_torsion(dihe_phi)) for ts in u.trajectory]) +psi_trajdata = np.array( + [(u.trajectory.frame, calc_torsion(dihe_psi)) for ts in u.trajectory]) + +phi_frame, phi_series = phi_trajdata.T +psi_frame, psi_series = psi_trajdata.T + +phi_series = np.concatenate(phi_series, axis=0) +psi_series = np.concatenate(psi_series, axis=0) + +zip(phi_frame, phi_series, psi_series) + +with open(args.output, 'w') as f: + writer = csv.writer(f, delimiter='\t') + writer.writerows(zip(phi_frame, phi_series, psi_series)) + +with sns.axes_style("white"): + h = sns.jointplot(x=phi_series, y=psi_series, kind="kde", legend=True) + h.set_axis_labels(r'$\Phi$ (degrees)', r'$\Psi$ (degrees)') + h.ax_joint.set_xlim(-180, 180) + h.ax_joint.set_ylim(-180, 180) + plt.savefig(args.oramachandran_plot, format='png') |
b |
diff -r 000000000000 -r d710c7f00ae6 ramachandran_plots.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ramachandran_plots.xml Wed Apr 03 15:46:32 2019 -0400 |
[ |
b'@@ -0,0 +1,193 @@\n+<tool id="mdanalysis_ramachandran_plot" name="Ramachandran Plots" version="0.1.3">\n+ <description>Calculate and plot the distribution of two diheadrals in a trajectory</description>\n+ <macros>\n+ <import>macros.xml</import>\n+ </macros>\n+ <expand macro="requirements">\n+ <requirement type="package" version="1.2.1">scipy</requirement>\n+ <requirement type="package" version="0.9.0">seaborn</requirement>\n+ <requirement type="package" version="1.0.5">nbdime</requirement>\n+ </expand>\n+ <command detect_errors="exit_code">\n+<![CDATA[\n+ python \'$__tool_directory__/ramachandran_plots.py\'\n+ --idcd \'$dcdin\' \n+ --ipdb \'$pdbin\'\n+ --isegid1 \'$phi.segid1\'\n+ --iresid1 \'$phi.resid1\' \n+ --iname1 \'$phi.name1\'\n+ --isegid2 \'$phi.segid2\'\n+ --iresid2 \'$phi.resid2\' \n+ --iname2 \'$phi.name2\'\n+ --isegid3 \'$phi.segid3\'\n+ --iresid3 \'$phi.resid3\' \n+ --iname3 \'$phi.name3\'\n+ --isegid4 \'$phi.segid4\'\n+ --iresid4 \'$phi.resid4\' \n+ --iname4 \'$phi.name4\'\n+ --isegid5 \'$psi.segid1\'\n+ --iresid5 \'$psi.resid1\' \n+ --iname5 \'$psi.name1\'\n+ --isegid6 \'$psi.segid2\'\n+ --iresid6 \'$psi.resid2\' \n+ --iname6 \'$psi.name2\' \n+ --isegid7 \'$psi.segid3\' \n+ --iresid7 \'$psi.resid3\' \n+ --iname7 \'$psi.name3\' \n+ --isegid8 \'$psi.segid4\' \n+ --iresid8 \'$psi.resid4\' \n+ --iname8 \'$psi.name4\' \n+ --output \'$output\' \n+ --oramachandran_plot \'$ramachandran_plot\'\n+ 2>&1\n+]]></command>\n+ <inputs>\n+ <expand macro="analysis_inputs"/>\n+ <section name="phi" title="Phi" expanded="False">\n+ <param name="segid1" type="text" value="HET" label="Segid of atom 1">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid1" type="text" value="3" label="Resid of atom 1">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name1" type="text" value="O5" label="Atom name of atom 1">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="segid2" type="text" value="HET" label="Segid of atom 2">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid2" type="text" value="3" label="Resid of atom 2">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name2" type="text" value="C1" label="Atom name of atom 2">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="segid3" type="text" value="HET" label="Segid of atom 3">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid3" type="text" value="2" label="Resid of atom 3">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name3" type="text" value="O4" label="Atom name of atom 3">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="segid4" type="text" value="HET" label="Segid of atom 4">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid4" type="text" value="2" label="Resid of atom 4">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name4" type="text" value="C4" label="Atom name of atom 4">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ </section>\n+ <section name="psi" title="Psi" expanded="False">\n+ <param name="segid1" type="text" value="HET" label="Segid of atom 1">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid1" type="text" value="3" label="Resid of atom 1">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name1" type="text" value="C1" label="Atom name of atom 1">\n+ <expand macro="sanitizer"/>\n+ </p'..b'"text" value="HET" label="Segid of atom 2">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid2" type="text" value="2" label="Resid of atom 2">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name2" type="text" value="O4" label="Atom name of atom 2">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="segid3" type="text" value="HET" label="Segid of atom 3">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid3" type="text" value="2" label="Resid of atom 3">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name3" type="text" value="C4" label="Atom name of atom 3">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="segid4" type="text" value="HET" label="Segid of atom 4">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ <param name="resid4" type="text" value="2" label="Resid of atom 4">\n+ <expand macro="sanitizer_resids"/>\n+ </param>\n+ <param name="name4" type="text" value="C3" label="Atom name of atom 4">\n+ <expand macro="sanitizer"/>\n+ </param>\n+ </section>\n+ </inputs>\n+ <outputs>\n+ <data format="tabular" name="output" label="Ramachandran Plot raw data"/>\n+ <data format="png" name="ramachandran_plot" label="Ramachandran Plot"/>\n+ </outputs>\n+ <tests>\n+ <test>\n+ <expand macro="tests_inputs"/>\n+ <param name="phi.segid1" value="HET"/>\n+ <param name="phi.resid1" value="3"/>\n+ <param name="phi.name1" value="O5"/>\n+ <param name="phi.segid2" value="HET"/>\n+ <param name="phi.resid2" value="3"/>\n+ <param name="phi.name2" value="C1"/>\n+ <param name="phi.segid3" value="HET"/>\n+ <param name="phi.resid3" value="2"/>\n+ <param name="phi.name3" value="O4"/>\n+ <param name="phi.segid4" value="HET"/>\n+ <param name="phi.resid4" value="2"/>\n+ <param name="phi.name4" value="C4"/>\n+ <param name="psi.segid1" value="HET"/>\n+ <param name="psi.resid1" value="3"/>\n+ <param name="psi.name1" value="C1"/>\n+ <param name="psi.segid2" value="HET"/>\n+ <param name="psi.resid2" value="2"/>\n+ <param name="psi.name2" value="O4"/>\n+ <param name="psi.segid3" value="HET"/>\n+ <param name="psi.resid3" value="2"/>\n+ <param name="psi.name3" value="C4"/>\n+ <param name="psi.segid4" value="HET"/>\n+ <param name="psi.resid4" value="2"/>\n+ <param name="psi.name4" value="C3"/>\n+ <output name="output" file="Ramachandran_Plot_raw_data.tabular" />\n+ </test>\n+ </tests>\n+ <help><![CDATA[\n+.. class:: infomark\n+\n+**What it does**\n+ \n+A Ramachandran plot ([\xcf\x86,\xcf\x88] plot), originally developed as a way to visualize energetically allowed regions for backbone dihedral angles \xcf\x88 against \xcf\x86 of amino acid.\n+This can be also used to calculate glycosidic \xcf\x86 and \xcf\x88 angles formed between carbohydrates. This tool can calculate and plot the histogram (ramachandran plot) of user define \xcf\x86 and \xcf\x88 angles of a trajectory. \n+\n+ - For protien \xcf\x86 and \xcf\x88 diheadral definitions see https://proteinstructures.com/Structure/Structure/Ramachandran-plot.html.\n+ \n+ - For glycan \xcf\x86 and \xcf\x88 diheadral definitions see http://www.glycanstructure.org/\n+\n+_____\n+\n+\n+.. class:: infomark\n+\n+**Input**\n+\n+ - Trajectory file (DCD).\n+ - PDB file.\n+ - Segids, resids and names of the four atoms to calculate diheadrals.\n+ \n+_____\n+\n+ \n+.. class:: infomark\n+\n+**Output**\n+\n+ - Tab-separated file of raw data of the \xcf\x86,\xcf\x88 angles time series.\n+ - Image (as png) of the Ramachandran Plot.\n+\n+\n+ ]]></help>\n+ <expand macro="citations" />\n+</tool>\n' |
b |
diff -r 000000000000 -r d710c7f00ae6 rdf.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rdf.py Wed Apr 03 15:46:32 2019 -0400 |
[ |
@@ -0,0 +1,68 @@ +#!/usr/bin/env python + +import argparse +import csv +import sys + +import MDAnalysis as mda +from MDAnalysis.analysis.rdf import InterRDF + +import matplotlib +matplotlib.use('Agg') # noqa +import matplotlib.pyplot as plt + +import numpy as np + + +def parse_command_line(argv): + parser = argparse.ArgumentParser() + parser.add_argument('--idcd', help='input dcd') + parser.add_argument('--ipdb', help='input pdb') + parser.add_argument('--isegid1', help='segid 1') + parser.add_argument('--iresid1', help='resid 1') + parser.add_argument('--iname1', help='name 1') + parser.add_argument('--isegid2', help='segid 2') + parser.add_argument('--iresid2', help='resid 2') + parser.add_argument('--iname2', help='name 2') + parser.add_argument('--inbins', help='Number of bins in the histogram') + parser.add_argument('--istart', help='Starting Point') + parser.add_argument('--iend', help='End point') + parser.add_argument('--output', help='output') + parser.add_argument('--ordf_plot', help='RDF plot') + return parser.parse_args() + + +args = parse_command_line(sys.argv) + +atom1 = "(segid %s and resid %s and name %s)" % \ + (args.isegid1, args.iresid1, args.iname1) +atom2 = "(segid %s and resid %s and name %s)" % \ + (args.isegid2, args.iresid2, args.iname2) +bins = int(args.inbins) +start = float(args.istart) +end = float(args.iend) + +u = mda.Universe(args.ipdb, args.idcd, topology_format="PDB", format="DCD") +x = u.select_atoms(atom1) +y = u.select_atoms(atom2) + +rdf = InterRDF(x, y, nbins=bins, range=(start, end)) +rdf.run() +bins = rdf.bins +bins = np.around(bins, decimals=3) +RDF = rdf.rdf +zip(bins, RDF) + +with open(args.output, 'w') as f: + writer = csv.writer(f, delimiter='\t') + writer.writerows(zip(bins, RDF)) + +with open(args.output) as f: + g = [xtmp.strip() for xtmp in f] + data = [tuple(map(float, xtmp.split())) for xtmp in g[0:]] + time = [xtmp[0] for xtmp in data] + rdf = [xtmp[1] for xtmp in data] + plt.plot(time, rdf) + plt.xlabel(r'r ($\AA$)') + plt.ylabel('g(r)') + plt.savefig(args.ordf_plot, format='png') |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Angle_Analysis_Plot.png |
b |
Binary file test-data/Angle_Analysis_Plot.png has changed |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Angle_Analysis_raw_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Angle_Analysis_raw_data.tabular Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,15 @@ +0.0 70.84919180880273 +1.0 70.97155495136695 +2.0 70.37097279938007 +3.0 70.12692388497567 +4.0 71.15946406922332 +5.0 71.91362565497833 +6.0 71.91268728348935 +7.0 71.97418402125982 +8.0 72.1521609490865 +9.0 72.3083065219282 +10.0 71.5291313235259 +11.0 81.56576116363512 +12.0 73.46330915394758 +13.0 67.04185741201445 +14.0 70.0710549275429 |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Dihedral_Analysis_Plot.png |
b |
Binary file test-data/Dihedral_Analysis_Plot.png has changed |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Dihedral_analysis_raw_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Dihedral_analysis_raw_data.tabular Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,15 @@ +0 -61.75347431106646 +1 -63.57940223575045 +2 -64.3468375822089 +3 -64.2932006449013 +4 -66.17815780069928 +5 -64.57418410935712 +6 -63.95470182210953 +7 -63.215898370961455 +8 -63.05227933072821 +9 -63.350881174296354 +10 -64.12889787645014 +11 -59.11099982465991 +12 -76.10678081593274 +13 -74.55530125465415 +14 -71.01850912317343 |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Distance_Analysis_Plot.png |
b |
Binary file test-data/Distance_Analysis_Plot.png has changed |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Distance_Analysis_raw_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Distance_Analysis_raw_data.tabular Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,15 @@ +0 3.8900816 +1 3.7835152 +2 3.7693398 +3 3.7851014 +4 3.6331043 +5 3.6525042 +6 3.684632 +7 3.7285593 +8 3.7090275 +9 3.6880326 +10 3.7261977 +11 3.4300115 +12 3.3902843 +13 3.3456264 +14 3.2583153 |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/RDF_Analysis_Plot.png |
b |
Binary file test-data/RDF_Analysis_Plot.png has changed |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/RDF_raw_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/RDF_raw_data.tabular Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,100 @@ +0.025 0.0 +0.075 0.0 +0.125 0.0 +0.175 0.0 +0.225 0.0 +0.275 0.0 +0.325 0.0 +0.375 0.0 +0.425 0.0 +0.475 0.0 +0.525 0.0 +0.575 0.0 +0.625 0.0 +0.675 0.0 +0.725 0.0 +0.775 0.0 +0.825 0.0 +0.875 0.0 +0.925 0.0 +0.975 0.0 +1.025 0.0 +1.075 0.0 +1.125 0.0 +1.175 0.0 +1.225 0.0 +1.275 0.0 +1.325 0.0 +1.375 0.0 +1.425 0.0 +1.475 0.0 +1.525 0.0 +1.575 0.0 +1.625 0.0 +1.675 0.0 +1.725 0.0 +1.775 0.0 +1.825 0.0 +1.875 0.0 +1.925 0.0 +1.975 0.0 +2.025 0.0 +2.075 0.0 +2.125 0.0 +2.175 0.0 +2.225 0.0 +2.275 0.0 +2.325 0.0 +2.375 0.0 +2.425 0.0 +2.475 0.0 +2.525 0.0 +2.575 0.0 +2.625 0.0 +2.675 0.0 +2.725 0.0 +2.775 0.0 +2.825 0.0 +2.875 0.0 +2.925 0.0 +2.975 0.0 +3.025 0.0 +3.075 0.0 +3.125 0.0 +3.175 0.0 +3.225 0.0 +3.275 6336.434022284689 +3.325 6147.300995012225 +3.375 5966.511251797981 +3.425 5793.58118212878 +3.475 0.0 +3.525 0.0 +3.575 0.0 +3.625 5171.934954710286 +3.675 15096.484661102078 +3.725 14693.935913907942 +3.775 14307.27600154838 +3.825 0.0 +3.875 4526.124773895681 +3.925 0.0 +3.975 0.0 +4.025 0.0 +4.075 0.0 +4.125 0.0 +4.175 0.0 +4.225 0.0 +4.275 0.0 +4.325 0.0 +4.375 0.0 +4.425 0.0 +4.475 0.0 +4.525 0.0 +4.575 0.0 +4.625 0.0 +4.675 0.0 +4.725 0.0 +4.775 0.0 +4.825 0.0 +4.875 0.0 +4.925 0.0 +4.975 0.0 |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/Ramachandran_Plot_raw_data.tabular --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Ramachandran_Plot_raw_data.tabular Wed Apr 03 15:46:32 2019 -0400 |
b |
@@ -0,0 +1,15 @@ +0 -144.50369390751567 97.28315803510958 +1 -140.8182020539229 98.03359173250509 +2 -140.72994628351444 97.24540656140032 +3 -139.74848490172678 96.50804547826581 +4 -134.87886646306 95.11565955448816 +5 -133.72523437825183 98.27907111162767 +6 -132.95986510869454 98.00598700434969 +7 -132.83978048218802 97.90284983563569 +8 -132.446606581017 97.95362964393432 +9 -132.8171707044048 98.22639981540117 +10 -129.18708154562577 93.19031937895272 +11 -138.70826130463465 99.35902431554985 +12 -134.31372026825582 86.39732109628024 +13 -135.62845675103858 89.17557531169159 +14 -151.1966272020228 101.09732806451846 |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/test.dcd |
b |
Binary file test-data/test.dcd has changed |
b |
diff -r 000000000000 -r d710c7f00ae6 test-data/test.pdb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/test.pdb Wed Apr 03 15:46:32 2019 -0400 |
b |
b'@@ -0,0 +1,61655 @@\n+REMARK FILENAME: MINIMIZE.INP \n+REMARK PURPOSE: SETUP PERIODIC BOUNDARY CONDITIONS AND ENERGY MINIMIZATION \n+REMARK AUTHOR: THARINDU SENAPATHI \n+REMARK DATE: 9/25/18 11:16:58 CREATED BY USER: galaxy \n+ATOM 1 N SER 2 23.711 4.396 5.292 1.00 0.00 PRO \n+ATOM 2 HT1 SER 2 22.774 4.012 5.048 1.00 0.00 PRO \n+ATOM 3 HT2 SER 2 23.993 4.056 6.233 1.00 0.00 PRO \n+ATOM 4 HT3 SER 2 24.412 4.016 4.606 1.00 0.00 PRO \n+ATOM 5 CA SER 2 23.692 5.909 5.232 1.00 0.00 PRO \n+ATOM 6 HA SER 2 23.045 6.255 6.026 1.00 0.00 PRO \n+ATOM 7 CB SER 2 25.129 6.479 5.468 1.00 0.00 PRO \n+ATOM 8 HB1 SER 2 25.502 6.112 6.451 1.00 0.00 PRO \n+ATOM 9 HB2 SER 2 25.108 7.590 5.522 1.00 0.00 PRO \n+ATOM 10 OG SER 2 26.032 6.062 4.445 1.00 0.00 PRO \n+ATOM 11 HG1 SER 2 26.928 6.382 4.649 1.00 0.00 PRO \n+ATOM 12 C SER 2 23.087 6.445 3.945 1.00 0.00 PRO \n+ATOM 13 O SER 2 22.287 5.741 3.315 1.00 0.00 PRO \n+ATOM 14 N ALA 3 23.417 7.674 3.515 1.00 0.00 PRO \n+ATOM 15 HN ALA 3 24.112 8.236 3.961 1.00 0.00 PRO \n+ATOM 16 CA ALA 3 22.937 8.280 2.293 1.00 0.00 PRO \n+ATOM 17 HA ALA 3 22.421 7.554 1.681 1.00 0.00 PRO \n+ATOM 18 CB ALA 3 22.012 9.476 2.583 1.00 0.00 PRO \n+ATOM 19 HB1 ALA 3 22.509 10.220 3.241 1.00 0.00 PRO \n+ATOM 20 HB2 ALA 3 21.086 9.125 3.082 1.00 0.00 PRO \n+ATOM 21 HB3 ALA 3 21.718 9.984 1.638 1.00 0.00 PRO \n+ATOM 22 C ALA 3 24.147 8.753 1.509 1.00 0.00 PRO \n+ATOM 23 O ALA 3 25.174 9.077 2.073 1.00 0.00 PRO \n+ATOM 24 N CYS 4 24.005 8.749 0.169 1.00 0.00 PRO \n+ATOM 25 HN CYS 4 23.142 8.478 -0.258 1.00 0.00 PRO \n+ATOM 26 CA CYS 4 25.025 9.149 -0.766 1.00 0.00 PRO \n+ATOM 27 HA CYS 4 25.769 9.761 -0.272 1.00 0.00 PRO \n+ATOM 28 CB CYS 4 25.700 7.948 -1.484 1.00 0.00 PRO \n+ATOM 29 HB1 CYS 4 26.256 8.290 -2.382 1.00 0.00 PRO \n+ATOM 30 HB2 CYS 4 24.907 7.257 -1.851 1.00 0.00 PRO \n+ATOM 31 SG CYS 4 26.887 7.076 -0.411 1.00 0.00 PRO \n+ATOM 32 C CYS 4 24.341 10.034 -1.774 1.00 0.00 PRO \n+ATOM 33 O CYS 4 23.104 10.106 -1.853 1.00 0.00 PRO \n+ATOM 34 N THR 5 25.135 10.817 -2.507 1.00 0.00 PRO \n+ATOM 35 HN THR 5 26.125 10.731 -2.426 1.00 0.00 PRO \n+ATOM 36 CA THR 5 24.625 11.886 -3.343 1.00 0.00 PRO \n+ATOM 37 HA THR 5 23.595 11.683 -3.608 1.00 0.00 PRO \n+ATOM 38 CB THR 5 24.715 13.266 -2.674 1.00 0.00 PRO \n+ATOM 39 HB THR 5 24.358 14.060 -3.371 1.00 0.00 PRO \n+ATOM 40 OG1 THR 5 26.051 13.580 -2.272 1.00 0.00 PRO \n+ATOM 41 HG1 THR 5 26.535 13.523 -3.104 1.00 0.00 PRO \n+ATOM 42 CG2 THR 5 23.787 13.298 -1.447 1.00 0.00 PRO \n+ATOM 43 HG21 THR 5 24.126 12.589 -0.663 1.00 0.00 PRO \n+ATOM 44 HG22 THR 5 22.759 13.003 -1.749 1.00 0.00 PRO \n+ATOM 45 HG23 THR 5 23.752 14.313 -1.003 1.00 0.00 PRO \n+ATOM 46 C THR 5 25.385 11.902 -4.645 1.00 0.00 PRO \n+ATOM 47 O THR 5 25.810'..b' CLA CLA 2 5.975 -34.097 -14.115 1.00 0.00 CLA \n+ATOM 61600 CLA CLA 3 3.049 -40.330 0.268 1.00 0.00 CLA \n+ATOM 61601 CLA CLA 4 -29.182 -19.908 -21.287 1.00 0.00 CLA \n+ATOM 61602 CLA CLA 5 32.119 26.809 -14.613 1.00 0.00 CLA \n+ATOM 61603 CLA CLA 6 -12.762 38.902 39.703 1.00 0.00 CLA \n+ATOM 61604 CLA CLA 7 -41.352 -6.310 -21.092 1.00 0.00 CLA \n+ATOM 61605 CLA CLA 8 -40.105 19.915 21.883 1.00 0.00 CLA \n+ATOM 61606 CLA CLA 9 -37.875 -10.640 -26.651 1.00 0.00 CLA \n+ATOM 61607 CLA CLA 10 -22.511 41.548 12.784 1.00 0.00 CLA \n+ATOM 61608 CLA CLA 11 35.216 33.731 -35.093 1.00 0.00 CLA \n+ATOM 61609 CLA CLA 12 -40.102 5.647 -2.397 1.00 0.00 CLA \n+ATOM 61610 CLA CLA 13 39.024 -12.398 -40.371 1.00 0.00 CLA \n+ATOM 61611 CLA CLA 14 18.261 -39.450 23.742 1.00 0.00 CLA \n+ATOM 61612 CLA CLA 15 6.178 41.435 -35.101 1.00 0.00 CLA \n+ATOM 61613 CLA CLA 16 24.358 15.109 39.388 1.00 0.00 CLA \n+ATOM 61614 CLA CLA 17 6.888 21.632 -18.643 1.00 0.00 CLA \n+ATOM 61615 CLA CLA 18 21.744 6.136 36.952 1.00 0.00 CLA \n+ATOM 61616 CLA CLA 19 37.313 -8.363 36.386 1.00 0.00 CLA \n+ATOM 61617 CLA CLA 20 -2.999 -20.832 23.104 1.00 0.00 CLA \n+ATOM 61618 CLA CLA 21 2.857 18.626 -27.815 1.00 0.00 CLA \n+ATOM 61619 CLA CLA 22 4.436 -15.917 42.798 1.00 0.00 CLA \n+ATOM 61620 CLA CLA 23 -36.824 -9.651 27.515 1.00 0.00 CLA \n+ATOM 61621 CLA CLA 24 30.595 -26.534 -13.854 1.00 0.00 CLA \n+ATOM 61622 CLA CLA 25 2.683 14.798 30.965 1.00 0.00 CLA \n+ATOM 61623 CLA CLA 26 29.848 -11.446 -12.895 1.00 0.00 CLA \n+ATOM 61624 CLA CLA 27 42.574 -16.385 39.148 1.00 0.00 CLA \n+ATOM 61625 CLA CLA 28 21.090 22.680 27.072 1.00 0.00 CLA \n+ATOM 61626 CLA CLA 29 31.477 21.841 -9.460 1.00 0.00 CLA \n+ATOM 61627 CLA CLA 30 -42.789 33.106 -42.003 1.00 0.00 CLA \n+ATOM 61628 CLA CLA 31 41.212 26.460 28.038 1.00 0.00 CLA \n+ATOM 61629 CLA CLA 32 31.330 -23.211 30.873 1.00 0.00 CLA \n+ATOM 61630 CLA CLA 33 -11.882 24.746 17.676 1.00 0.00 CLA \n+ATOM 61631 CLA CLA 34 42.509 41.966 29.673 1.00 0.00 CLA \n+ATOM 61632 CLA CLA 35 -21.155 -25.909 40.988 1.00 0.00 CLA \n+ATOM 61633 CLA CLA 36 -16.645 33.397 -20.493 1.00 0.00 CLA \n+ATOM 61634 CLA CLA 37 24.008 16.848 3.761 1.00 0.00 CLA \n+ATOM 61635 CLA CLA 38 -3.042 -26.229 -6.954 1.00 0.00 CLA \n+ATOM 61636 CLA CLA 39 -25.242 -29.525 -14.531 1.00 0.00 CLA \n+ATOM 61637 CLA CLA 40 34.942 -28.883 -36.691 1.00 0.00 CLA \n+ATOM 61638 CLA CLA 41 -35.913 -6.707 3.266 1.00 0.00 CLA \n+ATOM 61639 CLA CLA 42 -30.968 4.607 -32.953 1.00 0.00 CLA \n+ATOM 61640 CLA CLA 43 -5.809 15.242 42.418 1.00 0.00 CLA \n+ATOM 61641 CLA CLA 44 39.399 18.809 -13.827 1.00 0.00 CLA \n+ATOM 61642 CLA CLA 45 -15.805 29.210 -37.376 1.00 0.00 CLA \n+ATOM 61643 CLA CLA 46 0.091 -36.491 -34.859 1.00 0.00 CLA \n+ATOM 61644 CLA CLA 47 -12.875 -40.099 38.366 1.00 0.00 CLA \n+ATOM 61645 CLA CLA 48 -24.191 19.188 36.959 1.00 0.00 CLA \n+ATOM 61646 CLA CLA 49 16.215 -18.186 -29.406 1.00 0.00 CLA \n+ATOM 61647 CLA CLA 50 34.647 -7.708 -32.869 1.00 0.00 CLA \n+ATOM 61648 CLA CLA 51 -20.320 -38.996 6.847 1.00 0.00 CLA \n+ATOM 61649 CLA CLA 52 -28.453 0.614 -25.838 1.00 0.00 CLA \n+TER 61650 CLA 52\n+END\n' |