-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hphobic): detect hydrophobic contacts (#4)
* feat(hphobic): detect hydrophobic contacts * docs(readme): finished hydrophobic contact
- Loading branch information
Showing
4 changed files
with
91 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
use super::structs::Interaction; | ||
|
||
use pdbtbx::*; | ||
|
||
const HYDROPHOBIC_CONTACT_DIST: f64 = 4.5; | ||
|
||
/// Search for hydrophobic contacts. | ||
/// | ||
/// Check if the distance between two hydrophobics is within [`HYDROPHOBIC_CONTACT_DIST`]. | ||
pub fn find_hydrophobic_contact( | ||
entity1: &AtomConformerResidueChainModel, | ||
entity2: &AtomConformerResidueChainModel, | ||
) -> Option<Interaction> { | ||
let e1_atom = entity1.atom(); | ||
let e2_atom = entity2.atom(); | ||
match is_hydrophobic(entity1.residue().name().unwrap(), e1_atom.name()) | ||
& is_hydrophobic(entity2.residue().name().unwrap(), e2_atom.name()) | ||
& (e1_atom.distance(e2_atom) <= HYDROPHOBIC_CONTACT_DIST) | ||
{ | ||
true => Some(Interaction::HydrophobicContact), | ||
false => None, | ||
} | ||
} | ||
|
||
/// Check if the entity has an atom that belongs to the hydrophobic category. | ||
fn is_hydrophobic(res_name: &str, atom_name: &str) -> bool { | ||
// Carbon beta of all other than Glycine/Serine | ||
if (atom_name == "CB") & (res_name != "SER") { | ||
return true; | ||
} | ||
matches!( | ||
(res_name, atom_name), | ||
("ARG", "CG") | ("GLN", "CG") | ||
| ("GLU", "CG") | ||
| ("ILE", "CG1") | ||
| ("ILE", "CD1") | ||
| ("ILE", "CG2") | ||
| ("LEU", "CG") | ||
| ("LEU", "CD1") | ||
| ("LEU", "CD2") | ||
| ("LYS", "CG") | ||
| ("LYS", "CD") | ||
| ("MET", "CG") | ||
| ("MET", "SD") // sulfur in CYS has a hydrogen and is polarized | ||
| ("MET", "CE") | ||
| ("PHE", "CG") | ||
| ("PHE", "CD1") | ||
| ("PHE", "CD2") | ||
| ("PHE", "CE1") | ||
| ("PHE", "CE2") | ||
| ("PHE", "CZ") | ||
| ("PRO", "CG") | ||
| ("THR", "CG2") | ||
| ("TRP", "CG") | ||
| ("TRP", "CD2") | ||
| ("TRP", "CE3") | ||
| ("TRP", "CZ3") | ||
| ("TRP", "CH2") | ||
| ("TRP", "CZ2") | ||
| ("TYR", "CG") | ||
| ("TYR", "CD1") | ||
| ("TYR", "CD2") | ||
| ("TYR", "CE1") | ||
| ("TYR", "CE2") | ||
| ("VAL", "CG1") | ||
| ("VAL", "CG2") | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
pub mod complex; | ||
pub mod hbond; | ||
pub mod hydrophobic; | ||
pub mod ionic; | ||
pub mod structs; | ||
pub mod vdw; | ||
|
||
use hbond::{find_hydrogen_bond, find_weak_hydrogen_bond}; | ||
use hydrophobic::find_hydrophobic_contact; | ||
use ionic::find_ionic_bond; | ||
use structs::*; | ||
use vdw::find_vdw_contact; |