bacpop/ska.rust

`ska map` fails with some fragmented reference sequences

Closed this issue · 3 comments

  • ska version: v0.3.2
  • installed with cargo

I ran into an issue with ska map where it fails with some fragmented reference sequences (but not all, I also had some cases with fragmented references that ran just fine). This seems to have something to do with the reference assembly being fragmented because manually concatenating the contigs with something like

cat reference.fa | grep -v "^>" | tr -d '\n' | awk '{print ">concatenated_ref\n" $0}' > concatenated.fa

produces a reference assembly that is okay. I've included instructions and data for how to reproduce this on my x86_64 Linux laptop below.

Reproducing

Data that fails: https://urly.fi/3fm0

Commands that fail:

ska build -f SKA_input_list.tsv -o assemblies -k 31 --threads 1
ska map -o assemblies.aln --ambig-mask --threads 1 assemblies/LA069.fa.gz assemblies.skf

Commands that work (reference concatenated):

ska build -f SKA_input_list.tsv -o assemblies -k 31 --threads 1
gzip -dc assemblies/LA069.fa.gz | grep -v "^>" | tr -d '\n' | awk '{print ">LA069\n" $0}' > ref.fa
ska map -o assemblies.aln --ambig-mask --threads 1 ref.fa assemblies.skf
Errors from failed commands with `RUST_BACKTRACE=1` (click to expand):
SKA: Split K-mer Analysis (the alignment-free aligner)
2023-10-11T18:44:07.178Z WARN  [ska::ska_ref] Reference contained multiple contigs, in the output they will be concatenated
thread '<unnamed>' panicked at 'range end index 1988 out of range for slice of length 1283', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: rayon_core::join::join_context::{{closure}}
  13: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  14: rayon_core::registry::WorkerThread::wait_until_cold
  15: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 12660 out of range for slice of length 4873', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: rayon_core::join::join_context::{{closure}}
  19: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  20: rayon_core::registry::WorkerThread::wait_until_cold
  21: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 17466 out of range for slice of length 4873', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  10: rayon_core::registry::WorkerThread::wait_until_cold
  11: rayon_core::join::join_recover_from_panic
  12: rayon_core::join::join_context::{{closure}}
  13: rayon_core::registry::in_worker
  14: rayon::iter::plumbing::bridge_producer_consumer::helper
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  19: rayon_core::registry::WorkerThread::wait_until_cold
  20: rayon_core::join::join_recover_from_panic
  21: rayon_core::join::join_context::{{closure}}
  22: rayon_core::registry::in_worker
  23: rayon::iter::plumbing::bridge_producer_consumer::helper
  24: rayon_core::join::join_context::{{closure}}
  25: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  26: rayon_core::registry::WorkerThread::wait_until_cold
  27: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2974 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  10: rayon_core::registry::WorkerThread::wait_until_cold
  11: rayon_core::join::join_recover_from_panic
  12: rayon_core::join::join_context::{{closure}}
  13: rayon_core::registry::in_worker
  14: rayon::iter::plumbing::bridge_producer_consumer::helper
  15: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  16: rayon_core::registry::WorkerThread::wait_until_cold
  17: rayon_core::join::join_recover_from_panic
  18: rayon_core::join::join_context::{{closure}}
  19: rayon_core::registry::in_worker
  20: rayon::iter::plumbing::bridge_producer_consumer::helper
  21: rayon_core::join::join_context::{{closure}}
  22: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  23: rayon_core::registry::WorkerThread::wait_until_cold
  24: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 12706 out of range for slice of length 4873', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::job::StackJob<L,F,R>::run_inline
   7: rayon_core::join::join_context::{{closure}}
   8: rayon_core::registry::in_worker
   9: rayon::iter::plumbing::bridge_producer_consumer::helper
  10: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  11: rayon_core::registry::WorkerThread::wait_until_cold
  12: rayon_core::join::join_recover_from_panic
  13: rayon_core::join::join_context::{{closure}}
  14: rayon_core::registry::in_worker
  15: rayon::iter::plumbing::bridge_producer_consumer::helper
  16: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  17: rayon_core::registry::WorkerThread::wait_until_cold
  18: rayon_core::join::join_recover_from_panic
  19: rayon_core::join::join_context::{{closure}}
  20: rayon_core::registry::in_worker
  21: rayon::iter::plumbing::bridge_producer_consumer::helper
  22: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  23: rayon_core::registry::WorkerThread::wait_until_cold
  24: rayon_core::join::join_recover_from_panic
  25: rayon_core::join::join_context::{{closure}}
  26: rayon_core::registry::in_worker
  27: rayon::iter::plumbing::bridge_producer_consumer::helper
  28: rayon_core::join::join_context::{{closure}}
  29: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  30: rayon_core::registry::WorkerThread::wait_until_cold
  31: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 17647 out of range for slice of length 4873', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  17: rayon_core::registry::WorkerThread::wait_until_cold
  18: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::job::StackJob<L,F,R>::run_inline
  10: rayon_core::join::join_context::{{closure}}
  11: rayon_core::registry::in_worker
  12: rayon::iter::plumbing::bridge_producer_consumer::helper
  13: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  14: rayon_core::registry::WorkerThread::wait_until_cold
  15: rayon_core::join::join_recover_from_panic
  16: rayon_core::join::join_context::{{closure}}
  17: rayon_core::registry::in_worker
  18: rayon::iter::plumbing::bridge_producer_consumer::helper
  19: rayon_core::join::join_context::{{closure}}
  20: rayon_core::registry::in_worker
  21: rayon::iter::plumbing::bridge_producer_consumer::helper
  22: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  23: rayon_core::registry::WorkerThread::wait_until_cold
  24: rayon_core::join::join_recover_from_panic
  25: rayon_core::join::join_context::{{closure}}
  26: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  27: rayon_core::registry::WorkerThread::wait_until_cold
  28: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
   7: rayon_core::registry::WorkerThread::wait_until_cold
   8: rayon_core::join::join_recover_from_panic
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: rayon_core::job::StackJob<L,F,R>::run_inline
  13: rayon_core::join::join_context::{{closure}}
  14: rayon_core::registry::in_worker
  15: rayon::iter::plumbing::bridge_producer_consumer::helper
  16: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  17: rayon_core::registry::WorkerThread::wait_until_cold
  18: rayon_core::join::join_recover_from_panic
  19: rayon_core::join::join_context::{{closure}}
  20: rayon_core::registry::in_worker
  21: rayon::iter::plumbing::bridge_producer_consumer::helper
  22: rayon_core::join::join_context::{{closure}}
  23: rayon_core::registry::in_worker
  24: rayon::iter::plumbing::bridge_producer_consumer::helper
  25: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  26: rayon_core::registry::WorkerThread::wait_until_cold
  27: rayon_core::join::join_recover_from_panic
  28: rayon_core::join::join_context::{{closure}}
  29: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  30: rayon_core::registry::WorkerThread::wait_until_cold
  31: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  19: rayon_core::registry::WorkerThread::wait_until_cold
  20: rayon_core::join::join_recover_from_panic
  21: rayon_core::join::join_context::{{closure}}
  22: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  23: rayon_core::registry::WorkerThread::wait_until_cold
  24: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  10: rayon_core::registry::WorkerThread::wait_until_cold
  11: rayon_core::join::join_recover_from_panic
  12: rayon_core::join::join_context::{{closure}}
  13: rayon_core::registry::in_worker
  14: rayon::iter::plumbing::bridge_producer_consumer::helper
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  19: rayon_core::registry::WorkerThread::wait_until_cold
  20: rayon_core::join::join_recover_from_panic
  21: rayon_core::join::join_context::{{closure}}
  22: rayon_core::registry::in_worker
  23: rayon::iter::plumbing::bridge_producer_consumer::helper
  24: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  25: rayon_core::registry::WorkerThread::wait_until_cold
  26: rayon_core::join::join_recover_from_panic
  27: rayon_core::join::join_context::{{closure}}
  28: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  29: rayon_core::registry::WorkerThread::wait_until_cold
  30: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 1988 out of range for slice of length 1283', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
   7: rayon_core::registry::WorkerThread::wait_until_cold
   8: rayon_core::join::join_recover_from_panic
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: rayon_core::join::join_context::{{closure}}
  19: rayon_core::registry::in_worker
  20: rayon::iter::plumbing::bridge_producer_consumer::helper
  21: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  22: rayon_core::registry::WorkerThread::wait_until_cold
  23: rayon_core::join::join_recover_from_panic
  24: rayon_core::join::join_context::{{closure}}
  25: rayon_core::registry::in_worker
  26: rayon::iter::plumbing::bridge_producer_consumer::helper
  27: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  28: rayon_core::registry::WorkerThread::wait_until_cold
  29: rayon_core::join::join_recover_from_panic
  30: rayon_core::join::join_context::{{closure}}
  31: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  32: rayon_core::registry::WorkerThread::wait_until_cold
  33: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  19: rayon_core::registry::WorkerThread::wait_until_cold
  20: rayon_core::join::join_recover_from_panic
  21: rayon_core::join::join_context::{{closure}}
  22: rayon_core::registry::in_worker
  23: rayon::iter::plumbing::bridge_producer_consumer::helper
  24: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  25: rayon_core::registry::WorkerThread::wait_until_cold
  26: rayon_core::join::join_recover_from_panic
  27: rayon_core::join::join_context::{{closure}}
  28: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  29: rayon_core::registry::WorkerThread::wait_until_cold
  30: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
   7: rayon_core::registry::WorkerThread::wait_until_cold
   8: rayon_core::join::join_recover_from_panic
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: rayon_core::join::join_context::{{closure}}
  13: rayon_core::registry::in_worker
  14: rayon::iter::plumbing::bridge_producer_consumer::helper
  15: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  16: rayon_core::registry::WorkerThread::wait_until_cold
  17: rayon_core::join::join_recover_from_panic
  18: rayon_core::join::join_context::{{closure}}
  19: rayon_core::registry::in_worker
  20: rayon::iter::plumbing::bridge_producer_consumer::helper
  21: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  22: rayon_core::registry::WorkerThread::wait_until_cold
  23: rayon_core::join::join_recover_from_panic
  24: rayon_core::join::join_context::{{closure}}
  25: rayon_core::registry::in_worker
  26: rayon::iter::plumbing::bridge_producer_consumer::helper
  27: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  28: rayon_core::registry::WorkerThread::wait_until_cold
  29: rayon_core::join::join_recover_from_panic
  30: rayon_core::join::join_context::{{closure}}
  31: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  32: rayon_core::registry::WorkerThread::wait_until_cold
  33: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: rayon_core::join::join_context::{{closure}}
   7: rayon_core::registry::in_worker
   8: rayon::iter::plumbing::bridge_producer_consumer::helper
   9: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  10: rayon_core::registry::WorkerThread::wait_until_cold
  11: rayon_core::join::join_recover_from_panic
  12: rayon_core::join::join_context::{{closure}}
  13: rayon_core::registry::in_worker
  14: rayon::iter::plumbing::bridge_producer_consumer::helper
  15: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  16: rayon_core::registry::WorkerThread::wait_until_cold
  17: rayon_core::join::join_recover_from_panic
  18: rayon_core::join::join_context::{{closure}}
  19: rayon_core::registry::in_worker
  20: rayon::iter::plumbing::bridge_producer_consumer::helper
  21: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  22: rayon_core::registry::WorkerThread::wait_until_cold
  23: rayon_core::join::join_recover_from_panic
  24: rayon_core::join::join_context::{{closure}}
  25: rayon_core::registry::in_worker
  26: rayon::iter::plumbing::bridge_producer_consumer::helper
  27: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  28: rayon_core::registry::WorkerThread::wait_until_cold
  29: rayon_core::join::join_recover_from_panic
  30: rayon_core::join::join_context::{{closure}}
  31: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  32: rayon_core::registry::WorkerThread::wait_until_cold
  33: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'range end index 2955 out of range for slice of length 595', src/ska_ref/aln_writer.rs:148:35
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::slice::index::slice_end_index_len_fail
   3: ska::ska_ref::aln_writer::AlnWriter::write_split_kmer
   4: rayon::iter::plumbing::Producer::fold_with
   5: rayon::iter::plumbing::bridge_producer_consumer::helper
   6: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
   7: rayon_core::registry::WorkerThread::wait_until_cold
   8: rayon_core::join::join_recover_from_panic
   9: rayon_core::join::join_context::{{closure}}
  10: rayon_core::registry::in_worker
  11: rayon::iter::plumbing::bridge_producer_consumer::helper
  12: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  13: rayon_core::registry::WorkerThread::wait_until_cold
  14: rayon_core::join::join_recover_from_panic
  15: rayon_core::join::join_context::{{closure}}
  16: rayon_core::registry::in_worker
  17: rayon::iter::plumbing::bridge_producer_consumer::helper
  18: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  19: rayon_core::registry::WorkerThread::wait_until_cold
  20: rayon_core::join::join_recover_from_panic
  21: rayon_core::join::join_context::{{closure}}
  22: rayon_core::registry::in_worker
  23: rayon::iter::plumbing::bridge_producer_consumer::helper
  24: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  25: rayon_core::registry::WorkerThread::wait_until_cold
  26: rayon_core::join::join_recover_from_panic
  27: rayon_core::join::join_context::{{closure}}
  28: rayon_core::registry::in_worker
  29: rayon::iter::plumbing::bridge_producer_consumer::helper
  30: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  31: rayon_core::registry::WorkerThread::wait_until_cold
  32: rayon_core::join::join_recover_from_panic
  33: rayon_core::join::join_context::{{closure}}
  34: <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute
  35: rayon_core::registry::WorkerThread::wait_until_cold
  36: rayon_core::registry::ThreadBuilder::run
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Thanks for the detailed report, I will look into this asap. I only tested with a two contig reference to map to so I probably made some error in the indexing code

I had assumed only one contig (chromosome) would be skipped at a time, but here there are some short ones with no mapping k-mers. Just need to change an if to while which is a pleasing fix!

Well that was easy 😄!