wdecoster/cramino

thread 'main' panicked at 'Unexpected type of Aux for phaseset

Closed this issue · 11 comments

Hi,

I'm trying to run cramino for a phased .bam that was generated from PacBio Revio data using PacBio HiPhase. When I used the --phased option I get the following error

thread 'main' panicked at 'Unexpected type of Aux for phaseset: I32(11863)', src/extract_from_bam.rs:171:18
stack backtrace:
   0: rust_begin_unwind
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/d5c2e9c342b358556da91d61ed4133f6f50fc0c3/library/core/src/panicking.rs:67:14
   2: cramino::extract_from_bam::extract
   3: cramino::main

If I remove --phased, cramino runs. I'm wondering if somehow the phaseset ID is inconsistent with what cramino is expecting. When I look at representative phase set IDs in .bam it looks something like this: PS:i:11863. Could this be an issue with integer type I32 vs U32? Seems to think this is I32 however looking in your code looks like its expected U32, which I thought "11863" would be.

fn get_phaseset(record: &bam::Record) -> Option<u32> {
    match record.aux(b"PS") {
        Ok(value) => match value {
            Aux::U8(v) => Some(u32::from(v)),
            Aux::U16(v) => Some(u32::from(v)),
            Aux::U32(v) => Some(v),
            _ => panic!("Unexpected type of Aux for phaseset: {:?}", value),
        },
        Err(_e) => None,
    }
}

Thank you !

Thank you for reporting this! I'm not entirely sure what it means, and how the type of the tags is determined to be one of the numeric types, but I know how to fix it. I'll make a new release soon.

Fixed: https://github.com/wdecoster/cramino/releases/tag/v0.14.3

Please let me know if there is anything else :)

Thank you Wouter for addressing that so quickly! Phasing option is working now.

I'm still running into this issue on a couple of my phased BAMs:

$ cramino --version
cramino 0.14.3
$ cramino --phased --hist --karyotype .input.bam
thread 'main' panicked at src/extract_from_bam.rs:212:18:
Unexpected type of Aux for phaseset: I16(10315)
stack backtrace:
   0:     0x555555c5fb26 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x555555c5fb26 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x555555c5fb26 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x555555c5fb26 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x555555c85360 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:     0x555555c85360 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:     0x555555c5daaf - std::io::Write::write_fmt::h78b18af5775fedb5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:     0x555555c5f904 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x555555c5f904 - std::sys_common::backtrace::print::h85035a511aafe7a8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x555555c60e67 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
  10:     0x555555c60bc9 - std::panicking::default_hook::hf5fcb0f213fe709a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:     0x555555c612f8 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:779:13
  12:     0x555555c611d2 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:657:13
  13:     0x555555c60026 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x555555c60f30 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  15:     0x555555642355 - core::panicking::panic_fmt::h784f20a50eaab275
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  16:     0x55555566d323 - cramino::extract_from_bam::extract::h3257e57c03b7dd7d
  17:     0x55555564afb7 - cramino::main::h5743bcf7a7fc162e
  18:     0x55555566e3a6 - std::sys_common::backtrace::__rust_begin_short_backtrace::h92ecbbaae377e0d0
  19:     0x555555661315 - std::rt::lang_start::{{closure}}::h95130c0d8c374453
  20:     0x555555c578d1 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  21:     0x555555c578d1 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  22:     0x555555c578d1 - std::panicking::try::h8bbf75149211aaaa
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  23:     0x555555c578d1 - std::panic::catch_unwind::h8c78ec68ebea34cb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  24:     0x555555c578d1 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  25:     0x555555c578d1 - std::panicking::try::do_call::hcb3194972c74716d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  26:     0x555555c578d1 - std::panicking::try::hcdc6892c5f0dba4c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  27:     0x555555c578d1 - std::panic::catch_unwind::h4910beb4573f4776
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  28:     0x555555c578d1 - std::rt::lang_start_internal::h6939038e2873596b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  29:     0x5555556526f5 - main
  30:     0x1555545ecd85 - __libc_start_main
  31:     0x555555642ba1 - <unknown>

Ah, then I will also fix it for I16 :-D

New release https://github.com/wdecoster/cramino/releases/tag/v0.14.4

I am simply running cramino without the --phased flag and it throws me this error:

thread 'main' panicked at src/extract_from_bam.rs:180:18:
Unexpected type of Aux for NM tag: I8(1)

I am using a dorado bam with modified bases and cramino version 0.14.4

Aha, another unexpected Aux value. I will fix that one too :)

Thanks a lot :) I will patiently wait the next release.

Should be solved in v0.14.5

Should be solved in v0.14.5

Thanks a lot, I can confirm it has been fixed!

Good to hear!