identify_molecular_types

Function identify_molecular_types 

Source
pub fn identify_molecular_types(
    structure: &PDB,
) -> HashMap<String, Vec<MolecularType>>
Expand description

Identifies molecular types in the given PDB structure.

This function analyzes the chains and residues in a PDB structure to categorize each residue into molecular types such as Protein, DNA, or Other. It returns a HashMap where the keys are chain IDs and the values are vectors of unique MolecularTypes present in each chain.

§Arguments

  • structure - A reference to a pdbtbx::PDB structure representing the PDB file to be analyzed.

§Returns

A HashMap<String, Vec<MolecularType>> where each key is a chain ID and each value is a vector of unique MolecularTypes found in that chain.

§Example

use pdbtbx::PDB;
use pdb_handler::{identify_molecular_types, MolecularType};

let (mut pdb, _errors) = pdbtbx::open("example-pdbs/1crn.pdb").unwrap();
let mol_types = identify_molecular_types(&pdb);

for (chain_id, types) in mol_types {
    println!("Chain {}: {:?}", chain_id, types);
}

§Panics

This function will panic if the residue name cannot be retrieved (res.name().unwrap()).