Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…o add/zipfile_use_storage
  • Loading branch information
ctb committed Jun 25, 2021
2 parents 65646fb + a5a52b1 commit fc0c6fe
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/core/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub fn prepare(index_path: &str) -> Result<(), Error> {

impl Signature {
pub fn from_params(params: &ComputeParameters) -> Signature {
let template = build_template(&params);
let template = build_template(params);

Signature::builder()
.hash_function("0.murmur64")
Expand Down
14 changes: 7 additions & 7 deletions src/core/src/index/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ where
N: Comparable<L>,
{
fn similarity(&self, other: &L) -> f64 {
(*self).similarity(&other)
(*self).similarity(other)
}

fn containment(&self, other: &L) -> f64 {
(*self).containment(&other)
(*self).containment(other)
}
}

Expand Down Expand Up @@ -195,7 +195,7 @@ impl SigStore<Signature> {
// TODO: better matching here, what if it is not a mh?
if let Sketch::MinHash(mh) = &ng.signatures[0] {
if let Sketch::MinHash(omh) = &ong.signatures[0] {
return mh.count_common(&omh, false).unwrap() as u64;
return mh.count_common(omh, false).unwrap() as u64;
}
}
unimplemented!();
Expand Down Expand Up @@ -252,7 +252,7 @@ impl Comparable<SigStore<Signature>> for SigStore<Signature> {
// TODO: better matching here, what if it is not a mh?
if let Sketch::MinHash(mh) = &ng.signatures[0] {
if let Sketch::MinHash(omh) = &ong.signatures[0] {
return mh.similarity(&omh, true, false).unwrap();
return mh.similarity(omh, true, false).unwrap();
}
}

Expand All @@ -275,7 +275,7 @@ impl Comparable<SigStore<Signature>> for SigStore<Signature> {
// TODO: better matching here, what if it is not a mh?
if let Sketch::MinHash(mh) = &ng.signatures[0] {
if let Sketch::MinHash(omh) = &ong.signatures[0] {
let common = mh.count_common(&omh, false).unwrap();
let common = mh.count_common(omh, false).unwrap();
let size = mh.size();
return common as f64 / size as f64;
}
Expand All @@ -290,7 +290,7 @@ impl Comparable<Signature> for Signature {
// TODO: better matching here, what if it is not a mh?
if let Sketch::MinHash(mh) = &self.signatures[0] {
if let Sketch::MinHash(omh) = &other.signatures[0] {
return mh.similarity(&omh, true, false).unwrap();
return mh.similarity(omh, true, false).unwrap();
}
}

Expand All @@ -310,7 +310,7 @@ impl Comparable<Signature> for Signature {
// TODO: better matching here, what if it is not a mh?
if let Sketch::MinHash(mh) = &self.signatures[0] {
if let Sketch::MinHash(omh) = &other.signatures[0] {
let common = mh.count_common(&omh, false).unwrap();
let common = mh.count_common(omh, false).unwrap();
let size = mh.size();
return common as f64 / size as f64;
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/src/index/sbt/mhbt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ impl Comparable<Node<Nodegraph>> for Node<Nodegraph> {
fn similarity(&self, other: &Node<Nodegraph>) -> f64 {
let ng: &Nodegraph = self.data().unwrap();
let ong: &Nodegraph = other.data().unwrap();
ng.similarity(&ong)
ng.similarity(ong)
}

fn containment(&self, other: &Node<Nodegraph>) -> f64 {
let ng: &Nodegraph = self.data().unwrap();
let ong: &Nodegraph = other.data().unwrap();
ng.containment(&ong)
ng.containment(ong)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/index/sbt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ impl BinaryTree {
let mut similar_node_pos = 0;
let mut current_max = 0;
for (pos, cmpe) in current_round.iter().enumerate() {
let common = BinaryTree::intersection_size(&next_node, &cmpe);
let common = BinaryTree::intersection_size(&next_node, cmpe);
if common > current_max {
current_max = common;
similar_node_pos = pos;
Expand Down
8 changes: 4 additions & 4 deletions src/core/src/signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub trait SigsTrait {

if hash_function.protein() {
for aa_kmer in seq.windows(ksize) {
let hash = crate::_hash_murmur(&aa_kmer, self.seed());
let hash = crate::_hash_murmur(aa_kmer, self.seed());
self.add_hash(hash);
}
return Ok(());
Expand All @@ -151,7 +151,7 @@ pub trait SigsTrait {
};

for aa_kmer in aa_seq.windows(ksize) {
let hash = crate::_hash_murmur(&aa_kmer, self.seed());
let hash = crate::_hash_murmur(aa_kmer, self.seed());
self.add_hash(hash);
}

Expand Down Expand Up @@ -478,7 +478,7 @@ impl Signature {
self.signatures
.iter_mut()
.for_each(|sketch| {
sketch.add_sequence(&seq, force).unwrap(); }
sketch.add_sequence(seq, force).unwrap(); }
);
}
}
Expand All @@ -498,7 +498,7 @@ impl Signature {
self.signatures
.iter_mut()
.try_for_each(|sketch| {
sketch.add_protein(&seq) }
sketch.add_protein(seq) }
)?;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/sketch/hyperloglog/estimators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ pub fn joint_mle(
let mut ceq = vec![0; q + 2];

for (k1_, k2_) in k1.iter().zip(k2.iter()) {
match k1_.cmp(&k2_) {
match k1_.cmp(k2_) {
cmp::Ordering::Less => {
c1[*k1_ as usize] += 1;
cg2[*k2_ as usize] += 1;
Expand Down
2 changes: 1 addition & 1 deletion src/core/src/sketch/hyperloglog/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ impl HyperLogLog {
wtr.write_u8(self.p as u8)?; // number of bits used for indexing
wtr.write_u8(self.q as u8)?; // number of bits used for counting leading zeroes
wtr.write_u8(self.ksize as u8)?; // ksize
wtr.write_all(&self.registers.as_slice())?;
wtr.write_all(self.registers.as_slice())?;

Ok(())
}
Expand Down
28 changes: 14 additions & 14 deletions src/core/src/sketch/minhash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -597,8 +597,8 @@ impl KmerMinHash {
self.num,
);

combined_mh.merge(&self)?;
combined_mh.merge(&other)?;
combined_mh.merge(self)?;
combined_mh.merge(other)?;

let it1 = Intersection::new(self.mins.iter(), other.mins.iter());

Expand Down Expand Up @@ -630,8 +630,8 @@ impl KmerMinHash {
self.num,
);

combined_mh.merge(&self)?;
combined_mh.merge(&other)?;
combined_mh.merge(self)?;
combined_mh.merge(other)?;

let it1 = Intersection::new(self.mins.iter(), other.mins.iter());

Expand Down Expand Up @@ -721,9 +721,9 @@ impl KmerMinHash {
let downsampled_mh = second.downsample_max_hash(first.max_hash)?;
first.similarity(&downsampled_mh, ignore_abundance, false)
} else if ignore_abundance || self.abunds.is_none() || other.abunds.is_none() {
self.jaccard(&other)
self.jaccard(other)
} else {
self.angular_similarity(&other)
self.angular_similarity(other)
}
}

Expand Down Expand Up @@ -1311,7 +1311,7 @@ impl KmerMinHashBTree {

for hash in &self.mins {
*new_abunds.entry(*hash).or_insert(0) +=
abunds.get(&hash).unwrap_or(&0) + oabunds.get(&hash).unwrap_or(&0);
abunds.get(hash).unwrap_or(&0) + oabunds.get(hash).unwrap_or(&0);
}
self.abunds = Some(new_abunds)
}
Expand Down Expand Up @@ -1378,8 +1378,8 @@ impl KmerMinHashBTree {
self.num,
);

combined_mh.merge(&self)?;
combined_mh.merge(&other)?;
combined_mh.merge(self)?;
combined_mh.merge(other)?;

let it1 = Intersection::new(self.mins.iter(), other.mins.iter());

Expand Down Expand Up @@ -1410,8 +1410,8 @@ impl KmerMinHashBTree {
self.num,
);

combined_mh.merge(&self)?;
combined_mh.merge(&other)?;
combined_mh.merge(self)?;
combined_mh.merge(other)?;

let it1 = Intersection::new(self.mins.iter(), other.mins.iter());

Expand Down Expand Up @@ -1455,7 +1455,7 @@ impl KmerMinHashBTree {
let b_sq: u64 = other_abunds.values().map(|a| (a * a)).sum();

for (hash, value) in abunds.iter() {
if let Some(oa) = other_abunds.get(&hash) {
if let Some(oa) = other_abunds.get(hash) {
prod += value * oa
}
}
Expand Down Expand Up @@ -1486,9 +1486,9 @@ impl KmerMinHashBTree {
let downsampled_mh = second.downsample_max_hash(first.max_hash)?;
first.similarity(&downsampled_mh, ignore_abundance, false)
} else if ignore_abundance || self.abunds.is_none() || other.abunds.is_none() {
self.jaccard(&other)
self.jaccard(other)
} else {
self.angular_similarity(&other)
self.angular_similarity(other)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/src/sketch/nodegraph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Nodegraph {
let len = size_of::<u32>() * slice.len();
slice::from_raw_parts(slice.as_ptr() as *const u8, len)
};
wtr.write_all(&buf)?;
wtr.write_all(buf)?;
// Replace when byteorder PR is released

if rem != 0 {
Expand Down

0 comments on commit fc0c6fe

Please sign in to comment.