Commit 64412560 authored by NOEL Philippe's avatar NOEL Philippe

Add test and doc for refine_dialing

parent bd1a3928
......@@ -2,6 +2,7 @@
//!
//! `pdbparser` is a library to manipulate protein structure. It can parse, and filter PDB files.
//! You can create a protein structure by parsing with parse_pdb function. Then you can add filters on your protein.
//! And save it with write_pdb function.
//!
mod pdb;
......
......@@ -9,6 +9,18 @@ fn main() {
Err(e) => println!("Error : {}", e),
};
use pdbparser;
let my_prot = pdbparser::parse_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]);
// println!("Prot : {} \nn chain: {}\nn res: {}\nn atom: {}", my_prot.name, my_prot.get_number_chain(), my_prot.get_number_residue(), my_prot.get_number_atom());
// println!("Reduce protein");
......
......@@ -310,10 +310,26 @@ impl<'a> Protein {
}
/// Used to clean the dialing of atoms in the proteins
/// Does not change the dialing of residues
/// Does not change the dialing of residues.
///
///
/// # Examples
/// ```
/// use pdbparser;
///
/// let my_prot = pdbparser::parse_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 = 0;
let mut n_atom = 1;
for chain in &mut self.lst_chain {
for residue in &mut chain.lst_res {
for atom in &mut residue.lst_atom {
......
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