|
41 | 41 | //! pdbtbx::save(&pdb, "dump/1ubq_no_hydrogens.pdb", pdbtbx::StrictnessLevel::Loose); |
42 | 42 | //! ``` |
43 | 43 | //! |
44 | | -//! ## PDB Hierarchy |
45 | | -//! As explained in depth in the [documentation of CCTBX](https://cci.lbl.gov/cctbx_docs/iotbx/iotbx.pdb.html#iotbx-pdb-hierarchy) |
46 | | -//! it can be quite hard to properly define a hierarchy for PDB files which works for all files. |
47 | | -//! This library follows the hierarchy presented by CCTBX [`Grosse-Kunstleve, R. W. et al`], but renames the `residue_group` and |
48 | | -//! `atom_group` constructs. This gives the following hierarchy, with the main identifying characteristics annotated per level. |
49 | | -//! |
50 | | -//! * [PDB] |
51 | | -//! * [Model] \ |
52 | | -//! Serial number |
53 | | -//! * [Chain] \ |
54 | | -//! Id |
55 | | -//! * [Residue] (analogous to `residue_group` in CCTBX) \ |
56 | | -//! Serial number \ |
57 | | -//! Insertion code |
58 | | -//! * [Conformer] (analogous to `atom_group` in CCTBX) \ |
59 | | -//! Name \ |
60 | | -//! Alternative location |
61 | | -//! * [Atom] \ |
62 | | -//! Serial number \ |
63 | | -//! Name |
64 | | -//! |
65 | | -//! ## Iterating over the PDB Hierarchy |
66 | | -//! |
67 | | -//! ```rust |
68 | | -//! use pdbtbx::*; |
69 | | -//! let (mut pdb, _errors) = pdbtbx::open( |
70 | | -//! "example-pdbs/1ubq.pdb", |
71 | | -//! pdbtbx::StrictnessLevel::Medium |
72 | | -//! ).unwrap(); |
73 | | -//! |
74 | | -//! // Iterating over all levels |
75 | | -//! for model in pdb.models() { |
76 | | -//! for chain in model.chains() { |
77 | | -//! for residue in chain.residues() { |
78 | | -//! for conformer in residue.conformers() { |
79 | | -//! for atom in conformer.atoms() { |
80 | | -//! // Do the calculations |
81 | | -//! } |
82 | | -//! } |
83 | | -//! } |
84 | | -//! } |
85 | | -//! } |
86 | | -//! // Or only over a couple of levels (just like in the example above) |
87 | | -//! for residue in pdb.residues() { |
88 | | -//! for atom in residue.atoms() { |
89 | | -//! // Do the calculations |
90 | | -//! } |
91 | | -//! } |
92 | | -//! // Or with access to the information with a single line |
93 | | -//! for hierarchy in pdb.atoms_with_hierarchy() { |
94 | | -//! println!("Atom {} in Conformer {} in Residue {} in Chain {} in Model {}", |
95 | | -//! hierarchy.atom().serial_number(), |
96 | | -//! hierarchy.conformer().name(), |
97 | | -//! hierarchy.residue().serial_number(), |
98 | | -//! hierarchy.chain().id(), |
99 | | -//! hierarchy.model().serial_number() |
100 | | -//! ); |
101 | | -//! } |
102 | | -//! // Or with mutable access to the members of the hierarchy |
103 | | -//! for mut hierarchy in pdb.atoms_with_hierarchy_mut() { |
104 | | -//! let new_x = hierarchy.atom().x() * 1.5; |
105 | | -//! hierarchy.atom_mut().set_x(new_x); |
106 | | -//! } |
107 | | -//! ``` |
| 44 | +//! ## High level documentation |
| 45 | +//! [general_docs] |
108 | 46 | //! |
109 | 47 | //! ## Parallelization |
110 | 48 | //! [Rayon](https://crates.io/crates/rayon) is used to create parallel iterators for all logical candidates. Use |
@@ -150,7 +88,6 @@ println!("There are {} backbone atoms within 3.5Aͦ of the atom at index 42", to |
150 | 88 | "## |
151 | 89 | )] |
152 | 90 | #![doc = "## References"] |
153 | | -#![doc = "1. [`Grosse-Kunstleve, R. W. et al`] Grosse-Kunstleve, R. W., Sauter, N. K., Moriarty, N. W., & Adams, P. D. (2002). TheComputational Crystallography Toolbox: crystallographic algorithms in a reusable software framework. Journal of Applied Crystallography, 35(1), 126–136. [https://doi.org/10.1107/s0021889801017824](https://doi.org/10.1107/s0021889801017824)"] |
154 | 91 | #![doc = "1. [`Perkel, J. M.`] Perkel, J. M. (2020). Why scientists are turning to Rust. Nature, 588(7836), 185–186. [https://doi.org/10.1038/d41586-020-03382-2](https://doi.org/10.1038/d41586-020-03382-2)"] |
155 | 92 | // Set linting behaviour |
156 | 93 | #![deny( |
@@ -202,6 +139,9 @@ mod transformation; |
202 | 139 | /// To validate certain invariants of PDB files |
203 | 140 | mod validate; |
204 | 141 |
|
| 142 | +#[cfg(doc)] |
| 143 | +pub mod general_docs; |
| 144 | + |
205 | 145 | pub use error::*; |
206 | 146 | pub use read::*; |
207 | 147 | pub use save::*; |
|
0 commit comments