diff --git a/src/pdb/protein.rs b/src/pdb/protein.rs index 7199a88b008144db154a2dff09969dc716dd7b0f..be05aa80a263f0ba1ae0fc6ab87d1c657c39f542 100644 --- a/src/pdb/protein.rs +++ b/src/pdb/protein.rs @@ -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 { + let mut lst: Vec = 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 + } }