diff --git a/docs/src/density_maps.md b/docs/src/density_maps.md index a95730fc..f81aed01 100644 --- a/docs/src/density_maps.md +++ b/docs/src/density_maps.md @@ -42,7 +42,7 @@ The output of `ResidueContributions` is by default shown as a simple unicode plo ``` -The `ResidueContribution` object can be used to produce a high-quality contour plot using the `Plots.contourf` function: +The `ResidueContribution` object can be used to produce a high-quality contour plot using the `Plots.contourf` (or `contour`, or `heatmap`) function: ```@docs Plots.contourf(::ResidueContributions) @@ -192,6 +192,7 @@ save(::String, ::ResidueContributions) The above produces a matrix with a number of columns equal to the number of residues and a number of rows equal to the number of MDDF points. That matrix can be plotted as a contour map with adequate plotting software. + ## [3D density map around a macromolecule](@id grid3D) Three-dimensional representations of the distribution functions can also be obtained from the MDDF results. These 3D representations are obtained from the fact that the MDDFs can be decomposed into the contributions of each solute atom, and that each point in space is closest to a single solute atom as well. Thus, each point in space can be associated to one solute atom, and the contribution of that atom to the MDDF at the corresponding distance can be obtained. @@ -225,3 +226,4 @@ In the figure on the left, the points in space around the protein are selected w Clicking on those points we obtain which are the atoms of the protein contributing to the MDDF at that region. In particular, the arrow on the right points to the strongest red region, which corresponds to an Aspartic acid. These residues are shown explicitly under the density (represented as a transparent surface) on the figure in the center. The figure on the right displays, overlapped with the hydrogen-bonding residues, the most important contributions to the second peak of the distribution, corresponding to distances from the protein between 2.0 and 3.5Å. Notably, the regions involved are different from the ones forming hydrogen bonds, indicating that non-specific interactions with the protein (and not a second solvation shell) are responsible for the second peak. + diff --git a/ext/Plotting.jl b/ext/Plotting.jl index a737c318..cff1b3ca 100644 --- a/ext/Plotting.jl +++ b/ext/Plotting.jl @@ -11,13 +11,14 @@ using PDBTools: Residue, residue_ticks, Atom, eachresidue, resnum """ contourf( rc::ResidueContributions; - step::Int=1, - oneletter=false, - xlabel="Residue", - ylabel="r / Å", + step::Int=1, + oneletter=false, + xlabel="Residue", + ylabel="r / Å", + kargs... ) - contour(rc::ResidueContributions, args...; kargs...) - heatmap(rc::ResidueContributions, args...; kargs...) + contour(rc::ResidueContributions; kargs...) + heatmap(rc::ResidueContributions; kargs...) Plot the contribution of each residue to the solute-solvent pair distribution function as a 2D density map. This function requires loading the `Plots` package. The calling syntax for `contour` and `heatmap` is the same as for `contourf`. @@ -64,14 +65,13 @@ julia> plt = contourf(rc; step=5, size=(800,400), title="Title", clims=(-0.1, 0. This function requires loading the `Plots` package. Support for all `Plots.contourf` parameters was introduced in ComplexMixtures v2.6.0, and support for - `contour` and `heatmap` were introduced in ComplexMixtures v2.11.0. + `contour` and `heatmap` was introduced in ComplexMixtures v2.11.0. """ -Plots.contourf, Plots.contour, Plots.heatmap +Plots.contourf(rc::ResidueContributions; kargs...) = _density2D(Plots.contourf, rc; kargs...) -Plots.contourf(rc::ResidueContributions, args...; kargs...) = _density2D(Plots.contourf, rc, args...; kargs...) -Plots.contour(rc::ResidueContributions, args...; kargs...) = _density2D(Plots.contour, rc, args...; kargs...) -Plots.heatmap(rc::ResidueContributions, args...; kargs...) = _density2D(Plots.heatmap, rc, args...; kargs...) +Plots.contour(rc::ResidueContributions; kargs...) = _density2D(Plots.contour, rc; kargs...) +Plots.heatmap(rc::ResidueContributions; kargs...) = _density2D(Plots.heatmap, rc; kargs...) function _density2D( plot_type::Function,