|
|
@@ -1,7 +1,11 @@
|
|
|
use crate::{
|
|
|
- annotation::Annotations, positions::{GenomePosition, GetGenomePosition, VcfPosition}, runners::Run, variant::variant_collection::VariantCollection
|
|
|
+ annotation::Annotations,
|
|
|
+ positions::{GenomePosition, GetGenomePosition, VcfPosition},
|
|
|
+ runners::Run,
|
|
|
+ variant::variant_collection::VariantCollection,
|
|
|
};
|
|
|
use anyhow::{anyhow, Context, Ok};
|
|
|
+use blake3::Hasher;
|
|
|
use rayon::prelude::*;
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
use std::{cmp::Ordering, collections::HashSet, fmt, hash::Hash, str::FromStr};
|
|
|
@@ -29,9 +33,13 @@ impl PartialEq for VcfVariant {
|
|
|
|
|
|
impl Hash for VcfVariant {
|
|
|
fn hash<H: std::hash::Hasher>(&self, state: &mut H) {
|
|
|
- self.position.hash(state);
|
|
|
- self.reference.hash(state);
|
|
|
- self.alternative.hash(state);
|
|
|
+ let mut hasher = Hasher::new();
|
|
|
+ hasher.update(&self.position.contig.to_ne_bytes()); // Convert position to bytes
|
|
|
+ hasher.update(&self.position.position.to_ne_bytes()); // Convert position to bytes
|
|
|
+ hasher.update(self.reference.to_string().as_bytes()); // Reference string as bytes
|
|
|
+ hasher.update(self.alternative.to_string().as_bytes()); // Alternative string as bytes
|
|
|
+ let hash = hasher.finalize();
|
|
|
+ state.write(&hash.as_bytes()[..16]);
|
|
|
}
|
|
|
}
|
|
|
|