Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: skipmer improvements #3415

Merged
merged 16 commits into from
Dec 12, 2024
Merged
27 changes: 24 additions & 3 deletions src/core/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ pub struct ComputeParameters {

#[getset(get_copy = "pub", set = "pub")]
#[builder(default = false)]
skipmer: bool,
skipm1n3: bool,

#[getset(get_copy = "pub", set = "pub")]
#[builder(default = false)]
skipm2n3: bool,

#[getset(get_copy = "pub", set = "pub")]
#[builder(default = false)]
Expand Down Expand Up @@ -169,12 +173,29 @@ pub fn build_template(params: &ComputeParameters) -> Vec<Sketch> {
));
}

if params.skipmer {
if params.skipm1n3 {
ksigs.push(Sketch::LargeMinHash(
KmerMinHashBTree::builder()
.num(params.num_hashes)
.ksize(*k)
.hash_function(HashFunctions::Murmur64Skipm1n3)
.max_hash(max_hash)
.seed(params.seed)
.abunds(if params.track_abundance {
Some(Default::default())
} else {
None
})
.build(),
));
}

if params.skipm2n3 {
ksigs.push(Sketch::LargeMinHash(
KmerMinHashBTree::builder()
.num(params.num_hashes)
.ksize(*k)
.hash_function(HashFunctions::Murmur64Skipmer)
.hash_function(HashFunctions::Murmur64Skipm2n3)
.max_hash(max_hash)
.seed(params.seed)
.abunds(if params.track_abundance {
Expand Down
18 changes: 13 additions & 5 deletions src/core/src/encodings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
Murmur64Protein,
Murmur64Dayhoff,
Murmur64Hp,
Murmur64Skipmer,
Murmur64Skipm1n3,
Murmur64Skipm2n3,
Custom(String),
}

Expand All @@ -51,8 +52,13 @@
pub fn hp(&self) -> bool {
*self == HashFunctions::Murmur64Hp
}
pub fn skipmer(&self) -> bool {
*self == HashFunctions::Murmur64Skipmer

pub fn skipm1n3(&self) -> bool {

Check warning on line 56 in src/core/src/encodings.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/encodings.rs#L56

Added line #L56 was not covered by tests
*self == HashFunctions::Murmur64Skipm1n3
}

pub fn skipm2n3(&self) -> bool {

Check warning on line 60 in src/core/src/encodings.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/encodings.rs#L60

Added line #L60 was not covered by tests
*self == HashFunctions::Murmur64Skipm2n3
}
}

Expand All @@ -66,7 +72,8 @@
HashFunctions::Murmur64Protein => "protein",
HashFunctions::Murmur64Dayhoff => "dayhoff",
HashFunctions::Murmur64Hp => "hp",
HashFunctions::Murmur64Skipmer => "skipmer",
HashFunctions::Murmur64Skipm1n3 => "skipm1n3",
HashFunctions::Murmur64Skipm2n3 => "skipm2n3",

Check warning on line 76 in src/core/src/encodings.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/encodings.rs#L75-L76

Added lines #L75 - L76 were not covered by tests
HashFunctions::Custom(v) => v,
}
)
Expand All @@ -82,7 +89,8 @@
"dayhoff" => Ok(HashFunctions::Murmur64Dayhoff),
"hp" => Ok(HashFunctions::Murmur64Hp),
"protein" => Ok(HashFunctions::Murmur64Protein),
"skipmer" => Ok(HashFunctions::Murmur64Skipmer),
"skipm1n3" => Ok(HashFunctions::Murmur64Skipm1n3),
"skipm2n3" => Ok(HashFunctions::Murmur64Skipm2n3),

Check warning on line 93 in src/core/src/encodings.rs

View check run for this annotation

Codecov / codecov/patch

src/core/src/encodings.rs#L92-L93

Added lines #L92 - L93 were not covered by tests
v => unimplemented!("{v}"),
}
}
Expand Down
Loading
Loading