databio / gtars

Performance-critical tools to manipulate, analyze, and process genomic interval data. Primarily focused on building tools for geniml - our genomic machine learning python package.
3 stars 2 forks source link

Error from uniwig regarding mismatched chromosomes in BED and .sizes files #29

Closed ClaudeHu closed 3 months ago

ClaudeHu commented 3 months ago

Run uniwig with this command:

cargo run uniwig -b $FOLDER/combined/combined_chrsort.bed  -m 5  -c $FOLDER/chrom.sizes  -l $FOLDER/coverage_wig/all -t 1  -y wig

caused this error(RUST_BACKTRACE=full):

Reading Bed file complete.
Processing each chromosome...
thread 'main' panicked at src/uniwig/mod.rs:236:45:
no entry found for key
stack backtrace:
   0:     0x599fc5bea875 - std::backtrace_rs::backtrace::libunwind::trace::h58eed11393533053
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x599fc5bea875 - std::backtrace_rs::backtrace::trace_unsynchronized::h6af9bae28ebb6388
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x599fc5bea875 - std::sys_common::backtrace::_print_fmt::hb6748916642a4fb2
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x599fc5bea875 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3692694645b1bb6a
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x599fc5c0d6fb - core::fmt::rt::Argument::fmt::h7aa93977ba74ae0f
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/fmt/rt.rs:165:63
   5:     0x599fc5c0d6fb - core::fmt::write::h5131d80b4c69b88d
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/fmt/mod.rs:1168:21
   6:     0x599fc5be842f - std::io::Write::write_fmt::h1fb327a7d8b0eb36
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/io/mod.rs:1835:15
   7:     0x599fc5bea64e - std::sys_common::backtrace::_print::he6ebb7b9d89f4456
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x599fc5bea64e - std::sys_common::backtrace::print::h998d75b840f75a73
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x599fc5beb9e9 - std::panicking::default_hook::{{closure}}::h18ec7fe6a38b9da0
  10:     0x599fc5beb78a - std::panicking::default_hook::hfb3f22c2e4075a6a
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:298:9
  11:     0x599fc5bebe83 - std::panicking::rust_panic_with_hook::h51af00bcb4660c4e
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:795:13
  12:     0x599fc5bebd64 - std::panicking::begin_panic_handler::{{closure}}::h39f76aa863fbe8ce
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:664:13
  13:     0x599fc5bead39 - std::sys_common::backtrace::__rust_end_short_backtrace::h4d10fc2251b89840
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:171:18
  14:     0x599fc5beba97 - rust_begin_unwind
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:652:5
  15:     0x599fc591da83 - core::panicking::panic_fmt::h319840fcbcd912ef
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/panicking.rs:72:14
  16:     0x599fc591da4b - core::panicking::panic_display::he059be8e88d372e3
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/panicking.rs:262:5
  17:     0x599fc591da4b - core::option::expect_failed::h1726eaf02b540434
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/option.rs:1995:5
  18:     0x599fc592ab75 - core::option::Option<T>::expect::hcecd8d53d3cc140c
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/option.rs:898:21
  19:     0x599fc592ab75 - <std::collections::hash::map::HashMap<K,V,S> as core::ops::index::Index<&Q>>::index::hcd4bbdeb4a01515a
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/collections/hash/map.rs:1343:23
  20:     0x599fc592296e - gtars::uniwig::uniwig_main::h15f91875abc4f4c5
                               at /home/claudehu/Desktop/repo/gtars/gtars/src/uniwig/mod.rs:236:45
  21:     0x599fc592156c - gtars::uniwig::run_uniwig::h3fae24fdcbb4aaa7
                               at /home/claudehu/Desktop/repo/gtars/gtars/src/uniwig/mod.rs:154:5
  22:     0x599fc591fa7a - gtars::main::h47c1a87f0d2d97aa
                               at /home/claudehu/Desktop/repo/gtars/gtars/src/main.rs:35:13
  23:     0x599fc591f26b - core::ops::function::FnOnce::call_once::he9b5e97923dfb976
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/ops/function.rs:250:5
  24:     0x599fc591f57e - std::sys_common::backtrace::__rust_begin_short_backtrace::h0682dd7eb5503476
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/sys_common/backtrace.rs:155:18
  25:     0x599fc591f6f1 - std::rt::lang_start::{{closure}}::hbf8edd2d178baaf6
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/rt.rs:159:18
  26:     0x599fc5be268d - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb84c63630a35bb05
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/core/src/ops/function.rs:284:13
  27:     0x599fc5be268d - std::panicking::try::do_call::h8d62108d97b3e028
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:559:40
  28:     0x599fc5be268d - std::panicking::try::h0c0b9a214b9691f1
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:523:19
  29:     0x599fc5be268d - std::panic::catch_unwind::ha8912f28da143edb
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panic.rs:149:14
  30:     0x599fc5be268d - std::rt::lang_start_internal::{{closure}}::h2baf77487fc7f90d
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/rt.rs:141:48
  31:     0x599fc5be268d - std::panicking::try::do_call::h36fdc82521d3343f
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:559:40
  32:     0x599fc5be268d - std::panicking::try::h58aa1415c41e30ec
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panicking.rs:523:19
  33:     0x599fc5be268d - std::panic::catch_unwind::h3c4b5a8c3b1c4acf
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/panic.rs:149:14
  34:     0x599fc5be268d - std::rt::lang_start_internal::h63a185b0ddd212e9
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/rt.rs:141:20
  35:     0x599fc591f6ca - std::rt::lang_start::hef717630019a074f
                               at /rustc/051478957371ee0084a7c0913941d2a8c4757bb9/library/std/src/rt.rs:158:17
  36:     0x599fc591fb9e - main
  37:     0x76f773c29d90 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  38:     0x76f773c29e40 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:392:3
  39:     0x599fc591e4f5 - _start
  40:                0x0 - <unknown>

The combined BED file and chrom.size file are attached in the format of txt.

chrom_sizes.txt combined_chrsort.txt

nleroy917 commented 3 months ago

One of your chromosomes doesnt seem represented in the chrome sizes hashmap. Not immediately sure the solution... however...

You should probably be running with the --release flag. Or running cargo build --release. Then running the binary. It drastically speeds things up

donaldcampbelljr commented 3 months ago

I added a better error message for this situation as well as a test condition.

donaldcampbelljr commented 3 months ago

It appears as though the original uniwig would not error in this situation. It would instead ignore/skip these chromosomes, but it would not alert the user while doing so. Do we actually want to replicate that behavior? Or should it be left as is, where the user must remove unlisted chromosomes when using a chrom.sizes file?

donaldcampbelljr commented 3 months ago

Make this a warning and just have it continue.

donaldcampbelljr commented 3 months ago

Ok, this has been changed to a warning and pushed to dev branch.

nleroy917 commented 3 months ago

Should we just do a release? I guess its not crazy important right now and you can just build from source if truly needed

donaldcampbelljr commented 3 months ago

Uniwig still doesn't have python bindings yet.