#![cfg_attr(
feature = "rstar",
doc = r##"
```rust
use pdbtbx::*;
let (mut pdb, _errors) = pdbtbx::open("example-pdbs/1ubq.pdb", pdbtbx::StrictnessLevel::Medium).unwrap();
// You can loop over all atoms within 3.5 Aͦ of a specific atom
// Note: The `locate_within_distance` method takes a squared distance
let tree = pdb.create_atom_rtree();
for atom in tree.locate_within_distance(pdb.atom(42).unwrap().pos(), 3.5 * 3.5) {
println!("{}", atom);
}
// You can even get information about the hierarchy of these atoms
// (the chain, residue and conformer that contain this atom)
let tree = pdb.create_hierarchy_rtree();
let mut total = 0;
for hierarchy in tree.locate_within_distance(pdb.atom(42).unwrap().pos(), 3.5 * 3.5) {
if hierarchy.is_backbone() {
total += 1;
}
}
println!("There are {} backbone atoms within 3.5Aͦ of the atom at index 42", total);
# assert_eq!(total, 6);
```
"##
)]
#![doc = "## References"]
#![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)"]
#![deny(
missing_docs,
trivial_casts,
trivial_numeric_casts,
missing_debug_implementations,
unused,
rust_2018_idioms
)]
#![deny(
clippy::all,
clippy::cast_possible_truncation,
clippy::cast_possible_wrap,
clippy::cast_precision_loss,
clippy::cast_sign_loss,
clippy::enum_glob_use,
clippy::implicit_clone,
clippy::map_unwrap_or,
clippy::missing_docs_in_private_items,
clippy::nonminimal_bool,
clippy::print_stdout,
clippy::redundant_clone,
clippy::redundant_closure_for_method_calls,
clippy::redundant_closure,
clippy::similar_names,
clippy::single_match_else,
clippy::unwrap_used,
clippy::use_debug
)]
#![allow(clippy::upper_case_acronyms)] #![cfg_attr(feature = "unstable-doc-cfg", feature(doc_cfg))]
mod error;
mod read;
mod reference_tables;
mod save;
mod strictness_level;
mod structs;
mod transformation;
mod validate;
#[cfg(doc)]
pub mod general_docs;
pub use error::*;
pub use read::*;
pub use save::*;
pub use strictness_level::StrictnessLevel;
pub use structs::*;
pub use transformation::*;
pub use validate::{validate, validate_pdb};
fn check_extension(filename: impl AsRef<str>, extension: impl AsRef<str>) -> bool {
filename
.as_ref()
.rsplit('.')
.next()
.map(|ext| ext.eq_ignore_ascii_case(extension.as_ref()))
== Some(true)
}