From a98c06411dc19e443b7d6e519271150aebfff804 Mon Sep 17 00:00:00 2001 From: "Mitchell R. Vollger" Date: Fri, 15 Dec 2023 10:14:01 -0800 Subject: [PATCH] add skip no m6a opts --- src/cli.rs | 3 +++ src/fire.rs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/cli.rs b/src/cli.rs index 79fcf4de..327cb21a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -274,6 +274,9 @@ pub struct FireOptions { /// Output just FIRE elements in bed9 format #[clap(short, long)] pub extract: bool, + /// Don't write reads with no m6A calls to the output bam + #[clap(short, long)] + pub skip_no_m6a: bool, /// Width of bin for feature collection #[clap(short, long, default_value = "40")] pub width_bin: i64, diff --git a/src/fire.rs b/src/fire.rs index 524a2103..bc2b4d10 100644 --- a/src/fire.rs +++ b/src/fire.rs @@ -519,6 +519,9 @@ pub fn add_fire_to_bam(fire_opts: &FireOptions) -> Result<(), anyhow::Error> { else { let mut out = bam_writer(&fire_opts.out, &bam, 8); for mut rec in FiberseqRecords::new(&mut bam, 0) { + if fire_opts.skip_no_m6a && rec.m6a.starts.is_empty() { + continue; + } let fire_feats = FireFeats::new(&rec, fire_opts); let mut precisions = fire_feats.predict_with_xgb(&model, &precision_table); if rec.record.is_reverse() {