Commit 52586cce authored by NOEL Philippe's avatar NOEL Philippe

add func get_atom_index

parent 26d47246
......@@ -175,4 +175,30 @@ impl<'a> Protein {
let atom = Atom::new(atom_name, atom_number, coord);
residue.add_atom(atom);
}
/// function that return a vector for atom index
/// Can be used in other program like rrmsd_map to select specific atom
///
/// # Examples
/// ```
/// use pdbparser;
///
/// let my_prot = pdbparser::open_pdb_file("src/tests/f2_adn.pdb");
/// let atom_index = my_prot.get_atom_index();
///
/// assert_eq!(atom_index.next(), 1);
/// assert_eq!(atom_index.next(), 2);
///
/// ```
pub fn get_atom_index(&self) -> Vec<u64> {
let mut lst: Vec<u64> = Vec::new();
for chain in &self.lst_chain {
for res in &chain.lst_res {
for atom in &res.lst_atom {
lst.push(atom.number);
}
}
}
lst
}
}
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