Skip to content

Commit

Permalink
Modified the ResidueResult name to a combination of chainID-resname-r…
Browse files Browse the repository at this point in the history
…esnum to allow mapping of the residues.
  • Loading branch information
nbruciaferri committed Sep 13, 2024
1 parent a4c415f commit bf47e1e
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,25 +335,27 @@ pub fn calculate_sasa(
}
SASALevel::Residue => {
let mut residue_sasa = vec![];
for residue in pdb.residues() {
let residue_atom_index = parent_to_atoms
.get(&residue.serial_number())
.context(AtomMapToLevelElementFailedSnafu)?;
let residue_atoms: Vec<_> = residue_atom_index
.iter()
.map(|&index| atom_sasa[index])
.collect();
let sum = simd_sum(residue_atoms.as_slice());
let name = residue
.name()
.context(FailedToGetResidueNameSnafu)?
.to_string();
residue_sasa.push(ResidueResult {
serial_number: residue.serial_number(),
value: sum,
is_polar: POLAR_AMINO_ACIDS.contains(&name),
name,
})
for chain in pdb.chains() {
for residue in chain.residues() {
let residue_atom_index = parent_to_atoms
.get(&residue.serial_number())
.context(AtomMapToLevelElementFailedSnafu)?;
let residue_atoms: Vec<_> = residue_atom_index
.iter()
.map(|&index| atom_sasa[index])
.collect();
let sum = simd_sum(residue_atoms.as_slice());
let name = residue
.name()
.context(FailedToGetResidueNameSnafu)?
.to_string();
residue_sasa.push(ResidueResult {
serial_number: residue.serial_number(),
value: sum,
is_polar: POLAR_AMINO_ACIDS.contains(&name),
name: format!("{}-{}-{}", chain.id(), name, residue.serial_number()),
})
}
}
Ok(SASAResult::Residue(residue_sasa))
}
Expand Down

0 comments on commit bf47e1e

Please sign in to comment.