Commit 3d86a8d9 authored by Emmanuel Bresso's avatar Emmanuel Bresso

remove H

parent a13767d7
Pipeline #74479 passed with stages
in 54 seconds
......@@ -297,7 +297,7 @@ impl<'a> Protein {
Some(x) => x,
None => {
println!("Can't parse the protein with these attributes");
return None;
return None;let mut n_prot = Protein::new(self.name.clone());
}
};
for chain in &self.lst_chain {
......@@ -351,4 +351,41 @@ impl<'a> Protein {
}
}
}
/// Used to remove Hydrogens in the proteins
///
///
/// # Examples
/// ```
/// use pdbparser;
///
/// let my_prot = pdbparser::parse_pdb("tests/tests_file/f2.pdb", "f2");
/// let ss_h = my_prot.remove_h().unwrap();
/// assert_eq!(541, ss_h.get_number_atom());
/// ```
pub fn remove_h(&self) -> Option<Protein> {
let mut new_prot = Protein::new(self.name.clone());
for chain in &self.lst_chain {
let c_chain = chain.name;
for residue in &chain.lst_res {
let c_res = residue.res_num;
for atom in &residue.lst_atom {
if !(atom.name().starts_with("H")){
new_prot.update_protein(
c_chain,
residue.name.clone(),
c_res,
atom.name.clone(),
atom.number,
atom.coord,
);
}
}
}
}
new_prot.refine_dialing();
Some(new_prot)
}
}
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