Skip to content

Commit c4363ce

Browse files
committed
molecule graph docs
1 parent 944e1ca commit c4363ce

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

docs/src/documentation.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ The coordinate sets must be the same size and have the number of dimensions in t
527527

528528
The contacting elements in a molecular structure form a graph, and this can be retrieved using `MetaGraph`.
529529
This extends `MetaGraph` from [MetaGraphs.jl](https://github.com/JuliaGraphs/MetaGraphs.jl), allowing you to use all the graph analysis tools in [Graphs.jl](https://github.com/JuliaGraphs/Graphs.jl).
530-
For example:
530+
For example to find the graph from a contact map of Cβ atoms closer than 8 Å:
531531

532532
```julia-repl
533533
julia> using Graphs, MetaGraphs
@@ -552,6 +552,9 @@ See the [Graphs docs](https://juliagraphs.org/Graphs.jl/dev) for details on how
552552
Similar to [`ContactMap`](@ref), contacts are found between any element type passed in.
553553
So if you wanted the graph of chain contacts in a protein complex you could give a [`Model`](@ref) as the first argument.
554554

555+
Calling `MetaGraph` on a [`Chain`](@ref) without a contact distance does something different: it constructs a graph of atoms where edges are determined by the known bonds of standard amino acids in the chain.
556+
Hydrogens should be present and atom names should match those in OpenMM.
557+
555558
## Assigning secondary structure
556559

557560
Any secondary structure assignment at a residue is accessed via [`sscode`](@ref):

ext/BioStructuresGraphsExt.jl

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ using BioStructures: findatombyname
88
"""
99
MetaGraph(element, contact_distance)
1010
11-
Construct a graph of atoms where edges are contacts separated by less than `contact_distance`.
11+
Construct a graph of elements where edges are contacts separated by less
12+
than `contact_distance`.
1213
1314
See Graphs.jl and MetaGraphs.jl for more on how to use graphs.
1415
"""
@@ -30,22 +31,24 @@ function MetaGraphs.MetaGraph(el::StructuralElementOrList, contact_dist::Real)
3031
end
3132

3233
"""
33-
MetaGraph(chain::Chain; strict::Bool = true)
34+
MetaGraph(chain::Chain; strict::Bool=true)
3435
35-
Construct a graph of atoms where edges are determined by the known bonds of residues in the chain.
36+
Construct a graph of atoms where edges are determined by the known bonds
37+
of residues in the chain.
3638
3739
By default, the graph is constructed in `strict` mode, which means that:
3840
3941
- residue and atom names must be standard
4042
- all hydrogens are present
4143
- HIS must be disambiguated as HIE, HID, or HIP
4244
43-
These constraints can be relaxed by setting `strict = false`, at some risk to accuracy.
45+
These constraints can be relaxed by setting `strict = false`, at some
46+
risk to accuracy.
4447
4548
See Graphs.jl and MetaGraphs.jl for more on how to use graphs.
4649
"""
47-
function MetaGraphs.MetaGraph(chain::Chain; strict::Bool = true)
48-
el_list = collectatoms(chain; expand_disordered = true)
50+
function MetaGraphs.MetaGraph(chain::Chain; strict::Bool=true)
51+
el_list = collectatoms(chain; expand_disordered=true)
4952
mg = MetaGraph(length(el_list))
5053
for (i, el) in enumerate(el_list)
5154
set_prop!(mg, i, :element, el)

0 commit comments

Comments
 (0)