ソースを参照

jq format rule

Thomas 1 年間 前
コミット
cd0c877566
3 ファイル変更8 行追加5 行削除
  1. 4 0
      jq_filters/format.jq
  2. 1 2
      src/README.md
  3. 3 3
      src/variant/variant_collection.rs

+ 4 - 0
jq_filters/format.jq

@@ -0,0 +1,4 @@
+def format:
+  del(.hash, .position)
+  | .vcf_variants[] |= (del(.hash) | .infos |= map(select(. != "Empty")));
+

+ 1 - 2
src/README.md

@@ -2,6 +2,5 @@
 
 * Somatic Variants of chrM (25) 
 ```
- zcat /data/longreads_basic_pipe/*/diag/somatic_variants.json.gz | jq -C '[.data[] | select(.position.contig == 25 and ((.annotations[] | select(.ConstitAlt != null).ConstitAlt) // 0) <= 1 ) | del(.hash) | (.vcf_variants[] |= (del(.hash,.position,.reference,.alternative) | .infos |= map(select(. != "Empty"))))]'
-
+ zcat /data/longreads_basic_pipe/*/diag/somatic_variants.json.gz | jq -L ./jq_filters -C 'include "format"; [.data[] | select(.position.contig == 25 and ((.annotations[] | select(.ConstitAlt != null).ConstitAlt) // 0) <= 1) | format]'
 ```

+ 3 - 3
src/variant/variant_collection.rs

@@ -1,7 +1,7 @@
 use std::{
     collections::{HashMap, HashSet},
     fs::{self, File},
-    io::{Read, Write},
+    io::Write,
 };
 
 use anyhow::Context;
@@ -282,8 +282,8 @@ impl Variants {
     }
 
     pub fn load_from_json(filename: &str) -> anyhow::Result<Self> {
-        let file = File::open(filename)
-            .with_context(|| format!("Failed to open file: {}", filename))?;
+        let file =
+            File::open(filename).with_context(|| format!("Failed to open file: {}", filename))?;
         let mut reader = BGZFReader::new(file)
             .with_context(|| format!("Failed to create BGZF reader for file: {}", filename))?;