pdbrust
A Rust library for parsing PDB (Protein Data Bank) files
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.6%) to scientific vocabulary
Keywords
Repository
A Rust library for parsing PDB (Protein Data Bank) files
Basic Info
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
- Releases: 0
Topics
Metadata Files
README.md
PDBRust
A comprehensive Rust library for parsing and analyzing PDB (Protein Data Bank) files. This library provides a robust and efficient way to work with protein structure data in PDB format.
Features
Complete Record Support
- ATOM/HETATM records with full coordinate and metadata support
- MODEL/ENDMDL for multi-model structures
- SEQRES records for sequence information
- CONECT records for connectivity data
- SSBOND records for disulfide bonds
- REMARK records with categorization
- HEADER and TITLE metadata
Robust Error Handling
- Custom error types for different parsing scenarios
- Detailed error messages for debugging
- Safe handling of malformed PDB files
Utility Functions
- Chain identification and analysis
- Residue sequence extraction
- Connectivity analysis
- Model-based structure organization
- Disulfide bond analysis
Installation
Add this to your Cargo.toml:
toml
[dependencies]
pdbrust = "0.1.0"
Usage
Basic Structure Loading
```rust use pdbrust::PdbStructure;
fn main() -> Result<(), Box
// Access basic information
if let Some(header) = &structure.header {
println!("Structure header: {}", header);
}
println!("Number of atoms: {}", structure.atoms.len());
println!("Number of models: {}", structure.models.len());
Ok(())
} ```
Chain and Residue Analysis
```rust use pdbrust::PdbStructure;
fn analyzechains(structure: &PdbStructure) { // Get all chain IDs let chainids = structure.getchainids();
for chain_id in chain_ids {
// Get residues in this chain
let residues = structure.get_residues_for_chain(&chain_id);
println!("Chain {} has {} residues", chain_id, residues.len());
// Get sequence if available
let sequence = structure.get_sequence(&chain_id);
if !sequence.is_empty() {
println!("Sequence: {}", sequence.join("-"));
}
}
} ```
Connectivity Analysis
```rust use pdbrust::PdbStructure;
fn analyzeconnectivity(structure: &PdbStructure) { // Analyze disulfide bonds for bond in &structure.ssbonds { println!("Disulfide bond between:"); println!(" Residue 1: {} {} {}", bond.residue1name, bond.chain1id, bond.residue1seq); println!(" Residue 2: {} {} {}", bond.residue2name, bond.chain2id, bond.residue2_seq); println!(" Distance: {:.2} Å", bond.length); } } ```
Parallel Processing
```rust use pdbrust::PdbStructure; use pdbrust::features::parallel;
[cfg(feature = "parallel")]
fn processstructuresparallel(structures: Vec
let results: Vec<_> = structures.par_iter()
.map(|structure| {
// Process each structure in parallel
structure.atoms.len()
})
.collect();
println!("Total atoms across all structures: {}", results.iter().sum::<usize>());
} ```
Geometric Analysis
```rust use pdbrust::PdbStructure; use pdbrust::features::geometry;
[cfg(feature = "geometry")]
fn analyzestructuregeometry(structure: &PdbStructure) { use nalgebra::Vector3;
// Calculate center of mass
let com = structure.calculate_center_of_mass();
println!("Center of mass: {:?}", com);
// Calculate radius of gyration
let rg = structure.calculate_radius_of_gyration();
println!("Radius of gyration: {:.2} Å", rg);
} ```
Features
PDBRust supports several optional features that can be enabled in your Cargo.toml:
toml
[dependencies]
pdbrust = { version = "0.1.0", features = ["parallel", "geometry"] }
parallel: Enables parallel processing capabilities using Rayongeometry: Adds geometric analysis functions using nalgebra
Contributing
We welcome contributions! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Development Setup
Clone the repository:
bash git clone https://github.com/hfooladi/pdbrust.git cd pdbrustInstall dependencies:
bash cargo buildRun tests:
bash cargo testRun benchmarks:
bash cargo bench
Code Style
- Follow the Rust standard style guide
- Run
cargo fmtbefore committing - Run
cargo clippyto check for linting issues - Ensure all tests pass with
cargo test - Add tests for new functionality
- Update documentation as needed
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- The Protein Data Bank (PDB) for providing the standard format
- The Rust community for excellent tools and libraries
- All contributors to this project
Owner
- Name: Hosein Fooladi
- Login: HFooladi
- Kind: user
- Website: https://hfooladi.github.io/
- Repositories: 2
- Profile: https://github.com/HFooladi
Machine Learning researcher. Deep learning for drug discovery. Finding bugs in intelligence. Interested in Artificial Life. @ShenakhtPajouh
Citation (citation.cff)
cff-version: 1.2.0
message: "If you use this software, please cite it using these metadata."
type: software
abstract: "PDBRust is a high-performance Rust library designed for parsing and analyzing Protein Data Bank (PDB) files. It provides efficient data structures and methods for working with molecular structures, making it suitable for structural biology and bioinformatics applications."
authors:
- given-names: "Hossein"
family-names: "Fooladi"
orcid: "https://orcid.org/0000-0002-3124-2761"
title: "PDBRust: A Rust library for parsing and analyzing PDB files"
version: 0.1.0
date-released: "2025-03-25"
repository-code: "https://github.com/hfooladi/pdbrust"
repository-artifact: "https://github.com/hfooladi/pdbrust/releases"
url: "https://github.com/hfooladi/pdbrust"
keywords:
- bioinformatics
- structural biology
- PDB
- protein structure
- crystallography
- Rust
license: MIT
programming-languages:
- Rust
operating-systems:
- cross-platform
dependencies:
- type: "software"
name: "Rust"
version: ">=1.70.0"
url: "https://www.rust-lang.org/"
GitHub Events
Total
- Delete event: 2
- Issue comment event: 4
- Push event: 25
- Pull request event: 5
- Create event: 4
Last Year
- Delete event: 2
- Issue comment event: 4
- Push event: 25
- Pull request event: 5
- Create event: 4
Issues and Pull Requests
Last synced: 9 months ago
Dependencies
- actions/cache v3 composite
- actions/checkout v4 composite
- codecov/codecov-action v4 composite
- dtolnay/rust-toolchain stable composite
- dtolnay/rust-toolchain master composite
- taiki-e/install-action cargo-llvm-cov composite