Browse Source

AlterationCategory::TRL

Thomas 9 months ago
parent
commit
229f1a818e
1 changed files with 14 additions and 3 deletions
  1. 14 3
      src/variant/variant.rs

+ 14 - 3
src/variant/variant.rs

@@ -5,7 +5,7 @@ use crate::{
     runners::Run,
     variant::variant_collection::VariantCollection,
 };
-use anyhow::{anyhow, Context, Ok};
+use anyhow::{anyhow, Context};
 use rayon::prelude::*;
 use serde::{Deserialize, Serialize};
 use std::{cmp::Ordering, collections::HashSet, fmt, hash::Hash, str::FromStr};
@@ -246,7 +246,17 @@ impl VcfVariant {
                 AlterationCategory::DEL
             }
             _ => match self.svtype() {
-                Some(sv_type) => AlterationCategory::from(sv_type),
+                Some(sv_type) => {
+                    if let Ok(bnd_desc) = self.bnd_desc() {
+                        if bnd_desc.a_contig != bnd_desc.b_contig {
+                            AlterationCategory::TRL
+                        } else {
+                            AlterationCategory::DEL
+                        }
+                    } else {
+                        AlterationCategory::from(sv_type) 
+                    }
+                },
                 None => AlterationCategory::Other,
             },
         }
@@ -334,6 +344,7 @@ pub enum AlterationCategory {
     DUP,
     INV,
     CNV,
+    TRL,
     BND,
     Other,
 }
@@ -350,7 +361,7 @@ impl fmt::Display for AlterationCategory {
                 AlterationCategory::DUP => "DUP",
                 AlterationCategory::INV => "INV",
                 AlterationCategory::CNV => "CNV",
-                AlterationCategory::BND => "BND",
+                AlterationCategory::BND | AlterationCategory::TRL => "BND",
                 AlterationCategory::Other => "Other",
             }
         )