Skip to content

Commit

Permalink
Ensafen short read chaining preset
Browse files Browse the repository at this point in the history
This renames the "sr" preset so it is more clearly using chaining and
not the recommended short read mode. It also stops you from accidentally
using chaining presets or the chaining flag with paired-end inputs,
which can't actually run on the chaining codepath.
  • Loading branch information
adamnovak committed Jan 6, 2025
1 parent 16ad7dd commit 450b618
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
10 changes: 8 additions & 2 deletions src/subcommand/giraffe_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ int main_giraffe(int argc, char** argv) {
// What GAM should we realign?
string gam_filename;
// What FASTQs should we align.
// Note: multiple FASTQs are not interpreted as paired.
// Multiple FASTQs are interpreted as paired.
string fastq_filename_1;
string fastq_filename_2;
// Is the input interleaved/are we in paired-end mode?
Expand Down Expand Up @@ -1019,7 +1019,7 @@ int main_giraffe(int argc, char** argv) {
.add_entry<double>("wfa-max-mismatches-per-base", 0.05)
.add_entry<int>("wfa-max-max-mismatches", 15);
// And a short reads with chaining preset
presets["sr"]
presets["chaining-sr"]
.add_entry<bool>("align-from-chains", true)
.add_entry<bool>("explored-cap", true)
// Cap minimizers at a number we won't reach.
Expand Down Expand Up @@ -1551,6 +1551,12 @@ int main_giraffe(int argc, char** argv) {
cerr << "warning:[vg giraffe] Attempting to set paired-end parameters but running in single-end mode" << endl;
}

if (parser->get_option_value<bool>("align-from-chains") && paired) {
// TODO: Implement chaining for paired-end alignment
cerr << "error:[vg giraffe] Paired-end alignment is not yet implemented for --align-from-chains or chaining-based presets" << endl;
exit(1);
}

bool haplotype_sampling = !haplotype_name.empty() & !kff_name.empty();
if (!index_basename_override.empty()) {
index_basename = index_basename_override;
Expand Down
11 changes: 8 additions & 3 deletions test/t/50_vg_giraffe.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ BASH_TAP_ROOT=../deps/bash-tap

PATH=../bin:$PATH # for vg

plan tests 60
plan tests 62

vg construct -a -r small/x.fa -v small/x.vcf.gz >x.vg
vg index -x x.xg x.vg
Expand Down Expand Up @@ -45,10 +45,15 @@ is "${?}" "0" "a read can be mapped with the fast preset"
vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.fq -b default >/dev/null
is "${?}" "0" "a read can be mapped with the default preset"

vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.fq -b sr >/dev/null
vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.fq -b chaining-sr >/dev/null
is "${?}" "0" "a read can be mapped with the short read chaining preset"

vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.mismatched.fq -b sr >/dev/null
vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.fq -f reads/small.middle.ref.fq -b chaining-sr >/dev/null 2>log.txt
is "${?}" "1" "a read pair cannot be mapped with the short read chaining preset"
is "$(cat log.txt | grep "not yet implemented" | wc -l)" "1" "trying to map paired-end data with chaining produces an informative error"
rm -f log.txt

vg giraffe -Z x.giraffe.gbz -f reads/small.middle.ref.mismatched.fq -b chaining-sr >/dev/null
is "${?}" "0" "a read with a mismatch can be mapped with the short read chaining preset"

rm -Rf grid-out
Expand Down

1 comment on commit 450b618

@adamnovak
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vg CI tests complete for branch sr-lockout. View the full report here.

16 tests passed, 0 tests failed and 0 tests skipped in 17394 seconds

Please sign in to comment.