Skip to content

Commit

Permalink
Refactor query_pdb and make_query_map functions
Browse files Browse the repository at this point in the history
  • Loading branch information
khb7840 committed Mar 26, 2024
1 parent 9f1af24 commit 669bd3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cli/workflows/query_pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
11 changes: 11 additions & 0 deletions src/controller/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<f32>, angle_thresholds: Vec<f32>
) -> HashMap<GeometricHash, ((usize, usize), bool)> {
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();
Expand All @@ -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();
Expand Down

0 comments on commit 669bd3b

Please sign in to comment.