Commit 26d47246 authored by NOEL Philippe's avatar NOEL Philippe

add test for proteins (get_number_res)

parent 839d7caa
......@@ -115,6 +115,28 @@ impl<'a> Protein {
self.lst_chain.push(c);
}
/// Return the number of residue in the protein
///
/// # Examples
///
/// ````
/// use pdbparser;
///
/// let mut my_prot = pdbparser::Protein::new(String::from("my_prot"));
/// let mut my_chain = pdbparser::Chain::new('n');
/// let lys = pdbparser::Residue::new(String::from("lysine"), 1);
/// let pro = pdbparser::Residue::new(String::from("proline"), 2);
///
/// my_chain.add_res(lys);
/// my_chain.add_res(pro);
///
/// my_prot.add_chain(my_chain);
///
///
/// assert_eq!(2, my_prot.get_number_residue());
///
/// ````
pub fn get_number_residue(&self) -> u64 {
let mut n: u64 = 0;
for chain in self.lst_chain.iter() {
......@@ -125,6 +147,10 @@ impl<'a> Protein {
n
}
/// Function that add information on the protein (used in the parsing)
/// /!\Change this to a macro!
///
pub fn update_protein(&mut self, chain: char, res_name: String, res_number: u64, atom_name: String, atom_number: u64, coord: [f32; 3]) {
// Get a chain reference. If the chain exist, return a mutable reference to it. If not,
// create a new chain an return the mutable reference
......
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