Skip to content

Commit 79b3265

Browse files
author
Travis Hesketh
committed
Updates to README to add more examples
1 parent 64fb363 commit 79b3265

File tree

3 files changed

+80
-14
lines changed

3 files changed

+80
-14
lines changed

README.md

+64-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
# pygen-structures [![Documentation Status](https://readthedocs.org/projects/pygen-structures/badge/?version=latest)](https://pygen-structures.readthedocs.io/en/latest/?badge=latest)[![Build Status](https://travis-ci.org/thesketh/pygen-structures.svg?branch=master)](https://travis-ci.org/thesketh/pygen-structures)
1+
# pygen-structures
22

3-
`pygen-structures` (pigeon structures) is a Python utility which allows for the generation of 3 dimensional molecular structures which can be used in molecular dynamics or Monte Carlo simulations. Molecules are generated from a list of residues and patches in the format of the CHARMM forcefield, and can be written out as valid PSF and PDB files.
3+
[![Documentation Status](https://readthedocs.org/projects/pygen-structures/badge/?version=latest)](https://pygen-structures.readthedocs.io/en/latest/?badge=latest)[![Build Status](https://travis-ci.org/thesketh/pygen-structures.svg?branch=master)](https://travis-ci.org/thesketh/pygen-structures)[![codecov](https://codecov.io/gh/thesketh/pygen-structures/branch/master/graph/badge.svg)](https://codecov.io/gh/thesketh/pygen-structures)
44

5-
The package can be installed using pip (`pip install pygen-structures`), but relies upon _RDKit_, which must be installed using the [conda package manager](https://docs.conda.io/projects/conda/en/latest/) (`conda install -c rdkit rdkit`). _numpy_ is an additional dependency, and both _pytest_ and _OpenMM_ are required to run all the tests. Python 3.6 and 3.7 are supported.
5+
`pygen-structures` (pigeon structures) is a Python utility which allows for the generation of 3 dimensional molecular structures which can be used in molecular dynamics or Monte Carlo simulations. Molecules are generated from a list of residues and patches in the format of the CHARMM forcefield, and can be written out as valid PSF and PDB files. The package can be used as a command line utility, or as a Python library.
6+
7+
`pygen-structures` can be installed using pip (`pip install pygen-structures`), but relies upon _RDKit_, which must be installed using the [conda package manager](https://docs.conda.io/projects/conda/en/latest/). For installation instructions, see the 'Installation' section of the readme. Python 3.6 and 3.7 are supported.
68

79
In essence, `pygen-structures` aims (eventually) to be a complete [psfgen](https://www.ks.uiuc.edu/Research/vmd/plugins/psfgen/) replacement with more autonomous functionality and without the necessity for an initial 3D structure. This should make it significantly easier to perform combinatorial searches on particular sequence lengths and linkages, requiring no manual intervention provided the molecules of interest are reasonably small and the residue/patch definitions already exist in the forcefield.
810

9-
The package can be used as a command line utility, or as a Python library.
11+
## Installation
12+
13+
1. [Install the `conda` package manager](https://docs.anaconda.com/anaconda/install/).
14+
2. Set up a `conda` environment with the relevant dependencies (or install them in your base distribuion). This can be done with the following command: `conda create -n pygen-structures -c rdkit -c omnia 'python>=3.6' 'rdkit>=2018.3' numpy 'openmm>=7.4' pytest`.
15+
3. Activate the `conda` environment: `conda activate pygen-structures`
16+
4. Use `pip` to install `pygen-structures` in this environment: `pip install pygen-structures`.
17+
5. Installation complete! You will have to activate this environment using `conda activate pygen-structures` each time you want to use it.
18+
6. Test the installation using `pytest --pyargs pygen_structures`
1019

1120
## Command line usage
1221

@@ -16,18 +25,62 @@ Command line usage for peptides is simple, and takes the following form:
1625
pygen-structures SEQUENCE -o OUTPUT_PREFIX
1726
```
1827

19-
Sequences are specified using the one letter protein code, and terminal patches can be supplied by using hyphens as delimiters (e.g. `NNEU-AFK-CT2`, note that both termini must be supplied). OUTPUT_PREFIX.psf and OUTPUT_PREFIX.pdb are created. If the output prefix is not specified, the PDB file is written to stdout and no PSF file is generated. D-amino acids need only be preceded by a lowercase 'd'. The histidine form used can be set using `--histidine`, and defaults to HSE. Patches can be supplied using `--patches`, the name of the patch, and the 0-based indices the patch is to be applied to (or 'FIRST'/'LAST').
28+
Sequences are specified using the one letter protein code, and terminal patches can be supplied by using hyphens as delimiters (e.g. `NNEU-AFK-CT2`, note that both termini must be supplied). D-amino acids need only be preceded by a lowercase 'd'.
29+
30+
OUTPUT_PREFIX.psf and OUTPUT_PREFIX.pdb are created. If `-o` is not specified, the PDB file is written to stdout and no PSF file is generated.
31+
32+
The histidine form used can be set using `--histidine`, and defaults to HSE.
33+
34+
Patches can be supplied using `--patches`, the name of the patch, and the 0-based indices the patch is to be applied to (or 'FIRST'/'LAST').
35+
36+
To generate more complex structures, such as sugars, the residue names should be supplied (hyphen delimited) and the `-u`/`--use-charmm-names` option selected. Some example usage is given below.
37+
38+
`--name` and `--segid` control the names given in the COMPND record and the segment id respectively.
39+
40+
### Examples
2041

21-
To generate more complex structures, such as sugars, the residue names should be supplied (hyphen delimited) and the `-u`/`--use-charmm-names` option selected. `--name` and `--segid` control the names given in the COMPND record and the segment id respectively. For the trisaccharide raffinose, the following command would be used:
42+
To produce a simple peptide sequence, the one letter code can be used. To produce the peptide HIS-GLU-TYR, creating `HEY.psf` and `HEY.pdb`:
2243

2344
```
24-
pygen-structures --use-charmm-names AGLC-BFRU-AGAL --patches RAFF 0 1 2 --segid RAFF --name Raffinose -o RAFF
45+
pygen-structures HEY -o HEY
2546
```
2647

27-
## Library usage
48+
Supposing we think histidine should be protonated, we can change the protonation state of histidine by specifying a different histidine form:
49+
50+
```
51+
pygen-structures HEY -o HEY --histidine HSP
52+
```
2853

29-
Information about classes and functions for usage as a library can be found on [the project's ReadtheDocs page](https://pygen-structures.readthedocs.io/en/latest/). At present this is limited to an API reference, but there are plans for expansion.
54+
Or we could use the three letter codes:
55+
56+
```
57+
pygen-structures -u HSP-GLU-TYR -o HEY
58+
```
3059

31-
## Running tests
60+
For the trisaccharide raffinose, we must use the residue codes. The default segid is PROT, so we can specify a more specific segid using the `--segid` flag, and set the name given in the `COMPND` header using `--name`. The the following command produces `RAFF.psf` and `RAFF.pdb`:
61+
62+
```
63+
pygen-structures -u AGLC-BFRU-AGAL --patches RAFF 0 1 2 --segid RAFF --name Raffinose -o RAFF
64+
```
65+
66+
We can also make glycopeptides. To link alpha-glucose to an arginine residue (in this case, from an ALA-ASN-ALA peptide), we can use the NGLA patch. Note that because the protein residue is not the last in the chain, we have to apply the C-terminus patch manually.
67+
68+
```
69+
pygen-structures -u ALA-ASN-ALA-AGLC --patches CTER -2 NGLA 1 -1 -o ANA-NAGLC
70+
```
71+
72+
By default, if parameters are missing then the files are not created and the missing parameters are written to stdout. Using the `-v` flag will disable verification.
73+
74+
```
75+
$ pygen-structures AdP -o AdP
76+
Missing parameters:
77+
bonds {('CPD1', 'CC')}
78+
$ pygen-structures -v AdP -o AdP
79+
$
80+
```
81+
82+
A different CHARMM distribution can be loaded using the `-t` option, with the path to the folder. `pygen-structures` ships with the latest CHARMM distribution (July 2019) at the time of writing. The function which parses the folder will pick the latest versions of the parameter and topology files (36 over 27, 36m over 36), so if you plan on using an older version of the forcefield (this is not recommended) you will have to remove the newer versions and change the extensions to match the current conventions (.rtf, .prm).
83+
84+
## Library usage
3285

33-
To run the tests using pytest, run the following command in the shell: `pytest --pyargs pygen_structures`. `python -m pytest --pyargs pygen_structures` should also work.
86+
Information about classes and functions for usage as a library can be found on [the project's ReadtheDocs page](https://pygen-structures.readthedocs.io/en/latest/).

doc/conf.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#
1313
import os
1414
import sys
15+
import sphinx_rtd_theme
1516
sys.path.insert(0, os.path.abspath('.'))
1617
sys.path.insert(0, os.path.abspath('../'))
1718

@@ -23,7 +24,7 @@
2324
author = 'Travis Hesketh'
2425

2526
# The full version, including alpha/beta/rc tags
26-
release = '0.2'
27+
release = '0.2.2'
2728

2829

2930
# -- General configuration ---------------------------------------------------
@@ -33,7 +34,8 @@
3334
# ones.
3435
extensions = [
3536
# "recommonmark",
36-
"sphinx.ext.autodoc"
37+
"sphinx.ext.autodoc",
38+
"sphinx_rtd_theme"
3739
]
3840

3941
# Add any paths that contain templates here, relative to this directory.
@@ -50,7 +52,7 @@
5052
# The theme to use for HTML and HTML Help pages. See the documentation for
5153
# a list of builtin themes.
5254
#
53-
html_theme = 'alabaster'
55+
html_theme = 'sphinx_rtd_theme'
5456

5557
# Add any paths that contain custom static files (such as style sheets) here,
5658
# relative to this directory. They are copied after the builtin static files,

testing.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name: pygen_structures
2+
channels:
3+
- rdkit
4+
- omnia
5+
dependencies:
6+
- rdkit>=2018.03
7+
- numpy
8+
- openmm>=7.4
9+
- pytest
10+
- pytest-cov
11+
- codecov

0 commit comments

Comments
 (0)