diff --git a/NOTE.md b/NOTE.md index 9382073..704dcc6 100644 --- a/NOTE.md +++ b/NOTE.md @@ -8,6 +8,7 @@ QUERYING - [x] DONE: Matching query and reference positions - [x] DONE: rayon based parallelization - [ ] TODO: For partial match, fill in with "_" in the output where the query does not match +- [ ] TODO: Rename features --> default goes to PDBTrRosetta DEV - [ ] Write rustdoc diff --git a/src/cli/workflows/query_pdb.rs b/src/cli/workflows/query_pdb.rs index bc56e40..cf1f8de 100644 --- a/src/cli/workflows/query_pdb.rs +++ b/src/cli/workflows/query_pdb.rs @@ -161,7 +161,7 @@ pub fn query_pdb(env: AppArgs) { ); if retrieve { // match_count_filter[1] = residue_count; - match_count_filter[1] = if match_count_filter[1] < 3 { 3 } else { match_count_filter[1] }; + // match_count_filter[1] = if match_count_filter[1] < 3 { 3 } else { match_count_filter[1] }; } let mut query_count_vec: Vec<(usize, QueryResult)> = query_count_map.into_iter().filter(|(_k, v)| { v.total_match_count >= match_count_filter[0] && v.node_count >= match_count_filter[1] && @@ -201,7 +201,7 @@ pub fn query_pdb(env: AppArgs) { ); if retrieve { // match_count_filter[1] = residue_count; - match_count_filter[1] = if match_count_filter[1] < 3 { 3 } else { match_count_filter[1] }; + // match_count_filter[1] = if match_count_filter[1] < 3 { 3 } else { match_count_filter[1] }; } let mut query_count_vec: Vec<(usize, QueryResult)> = query_count_map.into_iter().filter(|(_k, v)| { v.total_match_count >= match_count_filter[0] && v.node_count >= match_count_filter[1] && @@ -220,6 +220,7 @@ pub fn query_pdb(env: AppArgs) { v.matching_residues = retrieval_result; }); query_count_vec.retain(|(_, v)| v.matching_residues.len() > 0); + println!("{:?}", query_count_vec.len()); drop(mmap); drop(match_count_filter); return query_count_vec; diff --git a/src/controller/graph.rs b/src/controller/graph.rs index 77fa123..7ebdee2 100644 --- a/src/controller/graph.rs +++ b/src/controller/graph.rs @@ -41,7 +41,8 @@ pub fn connected_components_with_given_node_count( scc.append(&mut wcc); // Filter components with the same node count // scc.retain(|component| component.len() == node_count); - scc.retain(|component| component.len() >= 3); + // Filter components with the node count greater than or equal to the given node count + // scc.retain(|component| component.len() >= 3); // Uniqueness cheking. Sort all inner vectors and dedup scc.iter_mut().for_each(|component| component.sort()); diff --git a/src/controller/retrieve.rs b/src/controller/retrieve.rs index 3a646de..e54f517 100644 --- a/src/controller/retrieve.rs +++ b/src/controller/retrieve.rs @@ -123,17 +123,35 @@ pub fn retrieve_with_prefilter( compact: &CompactStructure, hash: &GeometricHash, prefilter: &Vec<(usize, usize)>, nbin_dist: usize, nbin_angle: usize ) -> Vec<(usize, usize)> { let mut output: Vec<(usize, usize)> = Vec::new(); - for (i, j) in prefilter { - let feature = get_single_feature(*i, *j, compact, hash.hash_type()); - if feature.is_some() { - let feature = feature.unwrap(); - let curr_hash = if nbin_dist == 0 || nbin_angle == 0 { - GeometricHash::perfect_hash_default(feature, hash.hash_type()) - } else { - GeometricHash::perfect_hash(feature, hash.hash_type(), nbin_dist, nbin_angle) - }; - if curr_hash == *hash { - output.push((*i, *j)); + if prefilter.is_empty() { + let comb = CombinationIterator::new(compact.num_residues); + comb.for_each(|(i, j)| { + let feature = get_single_feature(i, j, compact, hash.hash_type()); + if feature.is_some() { + let feature = feature.unwrap(); + let curr_hash = if nbin_dist == 0 || nbin_angle == 0 { + GeometricHash::perfect_hash_default(feature, hash.hash_type()) + } else { + GeometricHash::perfect_hash(feature, hash.hash_type(), nbin_dist, nbin_angle) + }; + if curr_hash == *hash { + output.push((i, j)); + } + } + }); + } else { + for (i, j) in prefilter { + let feature = get_single_feature(*i, *j, compact, hash.hash_type()); + if feature.is_some() { + let feature = feature.unwrap(); + let curr_hash = if nbin_dist == 0 || nbin_angle == 0 { + GeometricHash::perfect_hash_default(feature, hash.hash_type()) + } else { + GeometricHash::perfect_hash(feature, hash.hash_type(), nbin_dist, nbin_angle) + }; + if curr_hash == *hash { + output.push((*i, *j)); + } } } }