Thomas 7 сар өмнө
parent
commit
21eeae81ae
1 өөрчлөгдсөн 11 нэмэгдсэн , 16 устгасан
  1. 11 16
      src/variant/variant.rs

+ 11 - 16
src/variant/variant.rs

@@ -336,20 +336,15 @@ impl VcfVariant {
     }
 
     pub fn deletion_desc(&self) -> Option<DeletionDesc> {
-        if let Some(len) = self.deletion_len() {
-            info!("{len}");
-            Some(DeletionDesc {
-                contig: self.position.contig(),
-                start: self.position.position + 1,
-                end: self
-                    .position
-                    .position
-                    .checked_add(len)
-                    .unwrap_or(self.position.position + 1),
-            })
-        } else {
-            None
-        }
+        self.deletion_len().map(|len| DeletionDesc {
+            contig: self.position.contig(),
+            start: self.position.position + 2,
+            end: self
+                .position
+                .position
+                .checked_add(len)
+                .unwrap_or(self.position.position + 1),
+        })
     }
 }
 
@@ -812,7 +807,7 @@ impl<E: Default> ToBNDGraph<E> for Vec<BNDDesc> {
 #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, Hash)]
 pub struct DeletionDesc {
     pub contig: String,
-    pub start: u32, // 1-based
+    pub start: u32, // 1-based [)
     pub end: u32,
 }
 
@@ -824,7 +819,7 @@ impl fmt::Display for DeletionDesc {
 
 impl DeletionDesc {
     pub fn len(&self) -> u32 {
-        self.end.saturating_sub(self.start)
+        self.end.saturating_sub(self.start) + 1
     }
 
     pub fn is_empty(&self) -> bool {