mailr28109 - /trunk/pipe_control/structure/main.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on November 25, 2015 - 18:38:
Author: bugman
Date: Wed Nov 25 18:38:15 2015
New Revision: 28109

URL: http://svn.gna.org/viewcvs/relax?rev=28109&view=rev
Log:
The structure.pca user function now creates graphs of the PC projections.

This includes PC1 vs. PC2, PC2 vs. PC3, etc.

Modified:
    trunk/pipe_control/structure/main.py

Modified: trunk/pipe_control/structure/main.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/pipe_control/structure/main.py?rev=28109&r1=28108&r2=28109&view=diff
==============================================================================
--- trunk/pipe_control/structure/main.py        (original)
+++ trunk/pipe_control/structure/main.py        Wed Nov 25 18:38:15 2015
@@ -35,7 +35,7 @@
 from lib.errors import RelaxError, RelaxFileError
 from lib.geometry.vectors import vector_angle_atan2
 from lib.io import get_file_path, open_write_file, write_data
-from lib.plotting.api import correlation_matrix
+from lib.plotting.api import correlation_matrix, write_xy_data, 
write_xy_header
 from lib.selection import tokenise
 from lib.sequence import write_spin_data
 from lib.sequence_alignment.msa import msa_general, msa_residue_numbers, 
msa_residue_skipping
@@ -1034,7 +1034,7 @@
     check_pipe()
 
     # Assemble the structural coordinates.
-    coord, ids, mol_names, res_names, res_nums, atom_names, elements = 
assemble_structural_coordinates(pipes=pipes, models=models, 
molecules=molecules, atom_id=atom_id)
+    coord, ids, object_id_list, model_list, molecule_list, mol_names, 
res_names, res_nums, atom_names, elements = 
assemble_structural_coordinates(pipes=pipes, models=models, 
molecules=molecules, atom_id=atom_id, lists=True)
 
     # Perform the PCA analysis.
     values, vectors, proj = pca_analysis(coord=coord, algorithm=algorithm, 
num_modes=num_modes)
@@ -1043,6 +1043,24 @@
     cdp.structure.pca_values = values
     cdp.structure.pca_vectors = vectors
     cdp.structure.pca_proj = proj
+
+    # Generate the graphs.
+    M = len(proj[0])
+    for i in range(num_modes - 1):
+        # Open the file for writing.
+        file = open_write_file("graph_pc%s_pc%s.agr" % (i+1, i+2), dir=dir, 
force=True)
+
+        # The header.
+        write_xy_header(format=format, file=file, title="Principle mode 
projections", sets=[M], axis_labels=[['PC mode %i' % (i+1), 'PC mode %i' % 
(i+2)]])
+
+        # The data.
+        data = [[]]
+        for j in range(M):
+            data[0].append([[proj[i, j], proj[i+1, j]]])
+        write_xy_data(format=format, data=data, file=file, graph_type='xy')
+
+        # Close the file.
+        file.close()
 
 
 def read_gaussian(file=None, dir=None, set_mol_name=None, 
set_model_num=None, verbosity=1, fail=True):




Related Messages


Powered by MHonArc, Updated Wed Nov 25 18:40:03 2015