Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

range end index 20 out of range for slice of length 14 #8

Closed
p-levy opened this issue Mar 18, 2022 · 4 comments
Closed

range end index 20 out of range for slice of length 14 #8

p-levy opened this issue Mar 18, 2022 · 4 comments

Comments

@p-levy
Copy link

p-levy commented Mar 18, 2022

Hi!

I'm having an issue while trying to run guide-counter count for the first time.

Here's the command I'm trying to run:

guide-counter count --input \
sample1.fastq \
sample2.fastq \
sample3.fastq \
sample4.fastq \
sample5.fastq \
sample6.fastq \
sample7.fastq \
sample8.fastq \
sample9.fastq \
sample10.fastq \
sample11.fastq \
--control-pattern control \
--library /lib/library.txt \
--output guide_counter

And here's the answer:

[2022-03-18T10:42:51Z INFO  guide_counter::guide] Loaded library with 77440 guides for 19115 genes; 0=essential, 0=nonessential, 1000=control, 76440=other.
[2022-03-18T10:42:51Z INFO  guide_counter::commands::count] Building lookup.
[2022-03-18T10:42:53Z INFO  guide_counter::commands::count] Lookup built with 4719224 entries.
thread 'main' panicked at 'range end index 20 out of range for slice of length 14', src/commands/count.rs:258:38
stack backtrace:
   0:     0x55b229a3b1fd - std::backtrace_rs::backtrace::libunwind::trace::h09f7e4e089375279
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55b229a3b1fd - std::backtrace_rs::backtrace::trace_unsynchronized::h1ec96f1c7087094e
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55b229a3b1fd - std::sys_common::backtrace::_print_fmt::h317b71fc9a5cf964
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55b229a3b1fd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he3555b48e7dfe7f0
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x55b2299bf41c - core::fmt::write::h513b07ca38f4fb1b
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/fmt/mod.rs:1149:17
   5:     0x55b229a39cf4 - std::io::Write::write_fmt::haf8c932b52111354
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/io/mod.rs:1697:15
   6:     0x55b229a3a3d0 - std::sys_common::backtrace::_print::h195c38364780a303
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x55b229a3a3d0 - std::sys_common::backtrace::print::hc09dfdea923b6730
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x55b229a3a3d0 - std::panicking::default_hook::{{closure}}::hb2e38ec0d91046a3
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:211:50
   9:     0x55b229a397ca - std::panicking::default_hook::h60284635b0ad54a8
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:228:9
  10:     0x55b229a397ca - std::panicking::rust_panic_with_hook::ha677a669fb275654
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:606:17
  11:     0x55b229a5e298 - std::panicking::begin_panic_handler::{{closure}}::h976246fb95d93c31
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:502:13
  12:     0x55b229a5e216 - std::sys_common::backtrace::__rust_end_short_backtrace::h38077ee5b7b9f99a
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/sys_common/backtrace.rs:139:18
  13:     0x55b229a5e1d2 - rust_begin_unwind
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
  14:     0x55b2299315f0 - core::panicking::panic_fmt::h35f3a62252ba0fd2
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
  15:     0x55b2299316f1 - core::slice::index::slice_end_index_len_fail::h735e748f7023a8c4
                               at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/slice/index.rs:41:5
  16:     0x55b229955428 - guide_counter::commands::count::Count::determine_prefixes::{{closure}}::h3e1e1356877818da
  17:     0x55b22994ff13 - <guide_counter::commands::count::Count as guide_counter::commands::command::Command>::execute::h32ae3439f4cdfe2c
  18:     0x55b22995ea0c - guide_counter::main::h56f2ffd0731cd338
  19:     0x55b229937f73 - std::sys_common::backtrace::__rust_begin_short_backtrace::h231446ae02769ddb
  20:     0x55b229963e07 - main
  21:     0x7f1f3df6ed0a - __libc_start_main
  22:     0x55b2299360e9 - <unknown> 

The library is Brunello human and it's formatted like:

sg_1	CATCTTCTTTCACCTGAACG	A1BG
sg_2	CTCCGGGGAGAACTCCGGCG	A1BG
sg_3	TCTCCATGGTGCATCAGCAC	A1BG
sg_4	TGGAAGTCCACTCCACTCAG	A1BG
sg_5	ACTGCATCTGTGCAAACGGG	A2M
sg_6	ATGTCTCATGAACTACCCTG	A2M
sg_7	TGAAATGAAACTTCACACTG	A2M
sg_8	TTACTCATATAGGATCCCAA	A2M 

Do you know what could be the problem?

Thanks!
Pierre

@tfenne
Copy link
Member

tfenne commented Mar 21, 2022

Thanks for submitting this. Is it possible that there are reads in your fastq file that are less than 20bp (i.e. the guide length) in length? That's my best guess, and if that is the case if should be an easy fix (and workaround too).

@tfenne
Copy link
Member

tfenne commented Mar 21, 2022

I'm fairly sure this is due to very short reads in the fastq. I've pushed a fix here: #9. I'll cut a release with that fix later tonight (time permitting). There's always a chance it was something else, but I think that's it based on the line the error is coming from and that the test I added failed initially.

@p-levy
Copy link
Author

p-levy commented Mar 22, 2022

Thanks a lot Tim! It's working great now! Congrats for that very nice tool.

One question (not sure if I should open an issue only for that, I'm kinda new to Github): would you recommend trimming the reads (for example from lentiguide vector or adapter sequences) before running guide-counter count or from raw fastq files should be fine?

@tfenne
Copy link
Member

tfenne commented Mar 22, 2022

You're welcome. The new release should be in bioconda later today.

Happy to answer questions here, or in a new issue. Generally speaking there's no advantage to clipping your reads before feeding them to guide-counter. It samples the first ~100k reads to figure out where the guides are in the reads, and this phase might go the tiniest bit faster if a) you have lots of short inserts and b) you adapter trimmed first. But I think it would likely save you <= 1s per sample, so not worth it. After that, everything is based off detected positions of the guides within the reads, and I don't think you'd see any difference here before/after clipping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants