From 669bd3bd0f8aa2b23720d05135767c6b4c78408c Mon Sep 17 00:00:00 2001 From: Hyunbin Kim Date: Tue, 26 Mar 2024 19:44:31 +0900 Subject: [PATCH] Refactor query_pdb and make_query_map functions --- src/cli/workflows/query_pdb.rs | 4 ++-- src/controller/query.rs | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/cli/workflows/query_pdb.rs b/src/cli/workflows/query_pdb.rs index e6f3baa..4a7116f 100644 --- a/src/cli/workflows/query_pdb.rs +++ b/src/cli/workflows/query_pdb.rs @@ -250,8 +250,8 @@ mod tests { let index_path = Some(String::from("data/serine_peptidases_pdb")); let exact_match = false; let retrieve = false; - let dist_threshold = Some(String::from("0.5,1.0")); - let angle_threshold = Some(String::from("5.0,10.0,15.0")); + let dist_threshold = Some(String::from("0.5")); + let angle_threshold = Some(String::from("5.0,10.0")); let help = false; let match_cutoff = 0.0; let score_cutoff = 0.0; diff --git a/src/controller/query.rs b/src/controller/query.rs index 192e4fd..c2ea092 100644 --- a/src/controller/query.rs +++ b/src/controller/query.rs @@ -144,6 +144,7 @@ pub fn make_query_map( path: &String, query_residues: &Vec<(u8, u64)>, hash_type: HashType, nbin_dist: usize, nbin_angle: usize, dist_thresholds: Vec, angle_thresholds: Vec ) -> HashMap { + let check_neighboring_index: bool = true; let pdb_reader = PDBReader::from_file(path).expect("PDB file not found"); let compact = pdb_reader.read_structure().expect("Failed to read PDB file"); let compact = compact.to_compact(); @@ -170,6 +171,16 @@ pub fn make_query_map( print_log_msg(INFO, &format!("Found residue: {}:{:?}({})", chain as char, ri, residue)); indices.push(index); } + if check_neighboring_index { + let index = compact.get_index(&chain, &(ri + 1)); + if let Some(index) = index { + indices.push(index); + } + let index = compact.get_index(&chain, &(ri - 1)); + if let Some(index) = index { + indices.push(index); + } + } } let dist_indices = hash_type.dist_index(); let angle_indices = hash_type.angle_index();