Python 3.8
Modules:
- Numpy
- Pandas
- Matplotlib
- Scipy
- CV2
- Biopython
- OS
- Argparse
Install with pip:
pip install numpy pandas matplotlib scipy biopython matplotlib argparse opencv-python
Minimal run example:
python RamachandranPlotter.py --pdb /path_to_file/<file-name.pdb>
Optional arguments:
--help : Prints summary of arguments
--verbose : Increase output verbosity
--models <int> : Desired model number (default = use all models). Model number corresponds to order in PDB file.
--chains <int> : Desired chain number (default = use all chains). Chain number corresponds to order in PDB file.
--out_dir <path> : Out directory. Must be available before-hand.
--plot_type <int> : Type of angles plotted Ramachandran diagram. Options detailed below.
--save_csv : Saves calculated dihedral angles in a separate CSV file.
--plot_type <int>
can be any of the following integers to determine the type of output plot desired:
0 : All
1 : General (All residues bar Gly, Pro, Ile, Val and pre-Pro)
2 : Glycine
3 : Proline (cis and trans)
4 : Pre-proline (residues preceeding a proline)
5 : Ile or Val
Backgrounds to Ramachandran plots are generated using dihedral angle data from peptide structures solved at high resolution from the Top8000 peptide database.
These are peptides for which models have been solved at very high resolutions and dihedral angles are assumed to be at their true values.
Several parameters can be easily adjusted to change the appearance of the returned graph.
python RamachandranPlotter.py --pdb 6GVE.pdb --plot_type 0
Parameter | Variable name | Description |
---|---|---|
Figure size | figure_size |
Adjusts the output figure size (inches) as a tuple |
Figure resolution | out_resolution |
Output final figure resolution (high values will slow the process down) |
Inner contour line level | contour_level_inner |
Level at which to draw the inner contour lines. Should be a value between 0-100 to represent to percemtile at which dihedral angles from the Top8000 peptide DB fall within. e.g. a value 96 coresponds to the area where at least 96 % of dihedral angles fall within. |
Outer contour line level | contour_level_outer |
Level at which to draw the outer contour lines. Should be a value between 0-100 to represent to percemtile at which dihedral angles from the Top8000 peptide DB fall within. e.g. a value 15 coresponds to the area where at least 15 % of dihedral angles fall within. |
Favoured region colour | background_colour |
Colour of the favoured dihedral angle region data points are plotted against*. |
Inner contour line colour | contour_line_color_inner |
Colour of inner contour lines. |
Outer contour line colour | contour_line_color_outer |
Colour of outer contour lines. |
Data point colour | data_point_colour |
Colour of data point for all dihedral angle pairs. |
Data point edge colour | data_point_edge_colour |
Colour of the borders for data point colours. |
* options for sequential colour maps (recommended):
['Greys'
, 'Purples'
, 'Blues'
, 'Greens'
, 'Oranges'
, 'Reds'
,
'YlOrBr'
, 'YlOrRd'
, 'OrRd'
, 'PuRd'
, 'RdPu'
, 'BuPu'
,
'GnBu'
, 'PuBu'
, 'YlGnBu'
, 'PuBuGn'
, 'BuGn'
, 'YlGn'
]
Find a complete description of available colour maps and how to make your own at: https://matplotlib.org/stable/tutorials/colors/colormaps.html
Only one command is required to generate Ramachandran plot. Before, the CSV of dihedral angles had to be generated using a separate script. In v2.0.2, a CSV of dihedral angles can be generated by parsing the --save_csv
argument.
The dependence previous versions of Ramachandran-Plotter had on Phenix has been replaced with Biopython.
01/08/2021: User can specify desired file type of final plot on execution of RamachandranPlotter.py
. Options: PNG
(default, 96 dpi. Refer to table above to change), PDF
, SVG
, EPS
or PS
.
Crash fixes:
- Dataframe.append(...) is deprecated since pandas 2.0, replaced by pandas.concat(...)
- Matplotlib style seaborn-poster was renamed seaborn-v0_8-poster since 3.6.3 version
Bug fixes:
- Temporary png image was not deleted on Windows, replace os.command() by os.remove()
- Improved readability:
- Better comment brevity
- Majority of code fit within column width of 88, where possible/appropriate
Crash fixes:
- Replaced LaTeX package implementation from Matplotlib (for rendering phi and psi symbols) with unicode chars.
Crash fixes:
- Top8000 file decompression error has been fixed.
- Plotting Proline-only plots has been patched.
- Corrections to dependency install instructions.
Bug fixes:
- Contour lines for specified plot now render correctly.
- Background plot of all dihedral angles is now only created with
plot_type 0
, if specified. - Out directory bug fixed.
- PDB file name is now appended to out files.
Optimisation improvements:
- Specified angles, if user does not want to plot all dihedral types, are now selected once at the start.
Joseph I. J. Ellaway
MSc Bioinformatics and Theoretical Systems Biology, Imperial College London