Skip to content

Commit

Permalink
cargo fix
Browse files Browse the repository at this point in the history
  • Loading branch information
khb7840 committed Oct 16, 2024
1 parent 1fadf43 commit 1e89d07
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 17 deletions.
11 changes: 5 additions & 6 deletions src/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,24 @@ pub mod mode;

use std::cell::UnsafeCell;
use std::io::Write;
use std::sync::{Arc, Mutex};
use std::sync::Arc;
use feature::get_geometric_hash_as_u32_from_structure;
use mode::IndexMode;
// External imports
use rayon::prelude::*;

use crate::index::indextable::FolddiscoIndex;
// Internal imports
use crate::{measure_time, PDBReader};
use crate::geometry::core::{GeometricHash, HashType};
use crate::index::alloc::IndexBuilder;
use crate::PDBReader;
use crate::geometry::core::HashType;
use crate::utils::log::{ print_log_msg, log_msg, FAIL, WARN, INFO };

#[cfg(feature = "foldcomp")]
use crate::structure::io::fcz::FoldcompDbReader;

const DEFAULT_NUM_THREADS: usize = 4;
const DEFAULT_HASH_TYPE: HashType = HashType::PDBTrRosetta;
const DEFAULT_MAX_RESIDUE: usize = 50000;
// const DEFAULT_HASH_TYPE: HashType = HashType::PDBTrRosetta;
const DEFAULT_MAX_RESIDUE: usize = 65535;
const DEFAULT_DIST_CUTOFF: f32 = 20.0;

unsafe impl Send for FoldDisco {}
Expand Down
7 changes: 3 additions & 4 deletions src/controller/retrieve.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
use std::{collections::{BTreeSet, HashMap, HashSet}, fs::File};
use petgraph::Graph;
use rayon::iter::{IntoParallelRefIterator, ParallelDrainFull, ParallelIterator};
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};

use crate::utils::convert::{map_aa_to_u8, map_u8_to_aa};
use crate::prelude::*;
Expand All @@ -13,7 +13,6 @@ use crate::controller::feature::get_single_feature;
#[cfg(feature = "foldcomp")]
use crate::structure::io::fcz::FoldcompDbReader;

use super::feature;

pub fn hash_vec_to_aa_pairs(hash_vec: &Vec<GeometricHash>) -> HashSet<(u32, u32)> {
let mut output: HashSet<(u32, u32)> = HashSet::new();
Expand Down Expand Up @@ -348,7 +347,7 @@ pub fn retrieval_wrapper_for_foldcompdb(
} else {
res_vec_from_hash.push("_".to_string());
if candidate_pair_map.contains_key(&i) {
let mut pairs = candidate_pair_map.get(&i).unwrap().clone();
let pairs = candidate_pair_map.get(&i).unwrap().clone();
for (j, k) in pairs {
// If retrieved_indices contains k, add j to mapping
if retrieved_indices.contains(&k) {
Expand Down Expand Up @@ -501,7 +500,7 @@ pub fn retrieval_wrapper(
} else {
res_vec_from_hash.push("_".to_string());
if candidate_pair_map.contains_key(&i) {
let mut pairs = candidate_pair_map.get(&i).unwrap().clone();
let pairs = candidate_pair_map.get(&i).unwrap().clone();
// pairs.sort_by(|a, b| a.0.cmp(&b.0));
// pairs.dedup();
for (j, k) in pairs {
Expand Down
4 changes: 2 additions & 2 deletions src/geometry/pdb_tr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ mod tests {
];
let start = std::time::Instant::now();
for _ in 0..10000 {
let hash = HashValue::perfect_hash_default(&raw_feature);
let hash2 = HashValue::perfect_hash_default(&raw_feature2);
let _ = HashValue::perfect_hash_default(&raw_feature);
let _ = HashValue::perfect_hash_default(&raw_feature2);
}
let duration = start.elapsed();
println!("Time elapsed in perfect_hash_default() is: {:?}", duration);
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/trrosetta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl HashValue {
let h_cb_dist = discretize_value(cb_dist, MIN_DIST, MAX_DIST, nbin_dist);

// Convert angles to sin and cos
let angles = [omega, theta1, theta2, phi1, phi2];
// let angles = [omega, theta1, theta2, phi1, phi2];
let sin_cos_angles = [
(omega.sin(), omega.cos()), (theta1.sin(), theta1.cos()),
(theta2.sin(), theta2.cos()), (phi1.sin(), phi1.cos()),
Expand Down
2 changes: 1 addition & 1 deletion src/index/lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// id\tpath\tinteger\tfloat
// id\tpath\tn_res\tplddt

use std::io::{Write, BufRead};
use std::io::Write;
use std::fs::File;
use std::io::BufWriter;

Expand Down
1 change: 0 additions & 1 deletion src/structure/io/fcz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use rayon::prelude::ParallelSliceMut;
use rayon::prelude::ParallelString;
use rayon::prelude::*;
use std::fs::File;
use std::io::BufRead;
use std::mem::ManuallyDrop;

use crate::structure::atom::Atom;
Expand Down
5 changes: 3 additions & 2 deletions src/utils/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,12 @@ pub fn map_aa_to_u8(aa: &[u8; 3]) -> u8 {
}

mod tests {
use super::*;

#[test]
fn test_map_aa_to_u8() {
use super::map_aa_to_u8;
let start = std::time::Instant::now();
for i in 0..1000 {
for _ in 0..1000 {
assert_eq!(map_aa_to_u8(b"ALA"), 0);
assert_eq!(map_aa_to_u8(b"ARG"), 1);
assert_eq!(map_aa_to_u8(b"ASN"), 2);
Expand Down

0 comments on commit 1e89d07

Please sign in to comment.