Commit 3850e13c authored by NOEL Philippe's avatar NOEL Philippe

Add function to refine atom number's dialing

parent b0ff8506
Pipeline #73612 passed with stages
in 1 minute and 27 seconds
......@@ -320,4 +320,35 @@ impl Structure {
}
Some(new_struct)
}
/// Used to clean the dialing of atoms in the `Structure`
/// Does not change the dialing of residues.
///
///
/// # Examples
/// ```
/// use pdbparser;
///
/// let my_prot = pdbparser::read_pdb("tests/tests_file/f2.pdb", "f2");
/// let mut backbone = my_prot.select_atoms("backbone").unwrap();
/// let lst_atom_id = backbone.get_atom_index();
/// assert_eq!(1, lst_atom_id[0]);
/// assert_eq!(5, lst_atom_id[1]);
///
/// backbone.refine_dialing();
/// let lst_atom_id = backbone.get_atom_index();
/// assert_eq!(1, lst_atom_id[0]);
/// assert_eq!(2, lst_atom_id[1]);
/// ```
pub fn refine_dialing(&mut self) {
let mut n_atom = 1;
for chain in &mut self.chains {
for residue in &mut chain.lst_res {
for atom in &mut residue.lst_atom {
atom.number = n_atom;
n_atom += 1;
}
}
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment