Package: pcaviz-durrantlab
PCAVizIntroductionPCAViz is an open-source Python/JavaScript toolkit for sharing and visualizing
MD trajectories via a web browser. We release it under the terms of the
open-source GNU General Public License, version 2 (seeLICENSE.md). This
package includes only the Compressor (Python) component of the toolkit. Seehttp://git.durrantlab.com/jdurrant/pcavizfor the complete toolkit, including the JavaScript and WordPress components.PCAViz Compressor (Python)The PCAViz Compressor is a Python script that uses lossy compression (i.e.,
principal component analysis and other strategies) to process trajectories.
The compressor saves this data as a minified JSON file that can itself be
further compressed using algorithms such as GZIP.DownloadTheGit repository:pcaviz-compressor-python/If you would like to download the compressor without downloading (or cloning)
the entire repository, click onpcaviz-compressor-python.zip.You can also install the PCAViz Compressor viapip:pipinstallpcaviz-durrantlabAvailable User Parameters-h, --help         show this help message and exit
  --top_file [t]     The topology filename (e.g., psf).
  --coor_file [c]    The coordinate (trajectory) filename (e.g., dcd).
  --selection [s]    Which atoms to save to the JSON output file (default:
                     "name CA C N O"). See https://goo.gl/kVeQuN to learn how
                     to construct an atom selection string.
  --output_dir [od]  The directory where output files should be saved. The
                     directory will be created if it does not exist. (default:
                     the directory where the coordinate file is located).
  --stride [ns]      How many frames to stride. For example, stride = 2 means
                     every other frame will be saved, and stride = 3 means
                     every third frame will be saved. (default: 1, no stride).
  --cum_var [var]    The target cumulative variance, as a float. PCAViz will
                     use the minimum number of principal components required
                     to capture at least this variance (default: 0.90).
  --precision [p]    The number of decimal places to retain when rounding PCA
                     vectors, coefficients, and atomic coordinates (default:
                     2, meaning round to the hundredths).
  --check_accuracy   Create a csv file containing the frame-to-frame RMSDs
                     between original- and decompressed-trajectory frames.
                     Useful for testing the impact of different settings on
                     atom-position accuracy.
  --test             Tests PCAViz to make sure all components are functioning.Examples of Use(Note: if you install the PCAViz Compressor viapip, use the globalpcavizcommand in place ofpython PCAViz.pybelow.)Create a compressed JSON file from a topology (1J8K_example.psf) and a
trajectory/coordinate (1J8K_example.dcd) file.python PCAViz.py --top_file examples/1J8K_example.psf --coor_file examples/1J8K_example.dcdPDB files can also contain multiple frames. In this case, the same file
serves as the topology and trajectory file.python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdbBy default, PCAViz includes only the backbone atoms in the output. These
atoms should be enough for cartoon-style visualization. But you can select
your own atoms to include in the output. Seehttps://goo.gl/kVeQuNto learn
how to construct an atom-selection string.python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdb --selection "name *"Striding the trajectory frames can reduce file sizes. PCAViz will
interpolate between the remaining frames to fill in the frames that are
missing. Here we keep only every other frame:python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdb --stride 2PCAViz allows users to control the compression settings. Two settings are
available. First, the user can specify how much of the cumulative variance
should be explained by the principal components. PCAViz will pick the
number of components required to meet that goal. Second, the user can
specify how precisely PCAViz should represent numeric values (e.g.,
principal-component coefficients). For example, here we tell PCAViz to
produce a trajectory that accounts for 80% of the variance, and to round all
numbers in the output JSON file to the nearest hundredth (two decimal
places):python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdb --cum_var 0.8 --precision 2To find the ideal --cum_var and --precision parameters, you may wish to
check how closely the PCAViz-compressed trajectory matches the original
trajectory. You can instruct PCAViz to output a CSV file that provides a
frame-by-frame RMSD comparison between the two trajectories. This option
also outputs an XYZ trajectory file that you can visually compare to the
original.python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdb --check_accuracyBy default, PCAViz saves the compressed JSON file to the same directory
where the coordinate file is located. You can specify a different output
directory if needed. The directory will be created if it doesn't exist.python PCAViz.py --top_file examples/1J8K_example.pdb --coor_file examples/1J8K_example.pdb --output_dir "my_dir"For debugging purposes, PCAViz also includes an option to test whether the
code is fully functional.python PCAViz.py --test