Browse Source

filter variant cat

Thomas 10 months ago
parent
commit
d230a27155
1 changed files with 9 additions and 0 deletions
  1. 9 0
      src/variant/variant_collection.rs

+ 9 - 0
src/variant/variant_collection.rs

@@ -318,6 +318,15 @@ impl Variants {
         debug!("Successfully loaded variants from {}", filename);
         Ok(variants)
     }
+
+    pub fn get_alteration_cat(&self, cat: AlterationCategory) -> Vec<Variant> {
+        self
+            .data
+            .iter()
+            .filter(|v| v.alteration_category().contains(&cat))
+            .cloned()
+            .collect()
+    }
 }
 
 fn create_variant(vcf_variants: Vec<VcfVariant>, annotations: &Annotations) -> Variant {