Skip to content

Commit

Permalink
Emit M CIGAR operations by default instead of =/X and add --eqx option
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelm committed Apr 11, 2023
1 parent 7f26bbe commit 56742b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 15 deletions.
18 changes: 9 additions & 9 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,27 @@

## development version

* #258: Fix compilation on MinGW. Thanks @teepean.
* #260: Include full command line in the SAM PG header.
* #20: Add command-line option `--m-op`. If used, emit `M` CIGAR operations
instead of `=` and `X`.
* #258: Fixed compilation on MinGW. Thanks @teepean.
* #260: Include full command line in the SAM PG header. Thanks @telmin.
* #20: By default, emit `M` CIGAR operations instead of `=` and `X`.
Added option `--eqx` to use `=` and `X` as before.

## v0.9.0 (2023-03-16)

* Add progress report (only shown if output is not a terminal; can be
* Added progress report (only shown if output is not a terminal; can be
disabled with `--no-progress`)
* PR #250: Avoid overeager soft clipping by adding an “end bonus” to the
alignment score if the alignment reaches the 5' or 3' end of the read.
This is equivalent to penalizing soft-clipping and improves mapping
accuracy, in particular for short reads, as candidate mapping sites with and
without soft clipping are compared more fairly. Use `-L` to change the end
bonus. (This emulates a feature found in BWA-MEM.)
* Issue #238: Fix occasionally incorrect soft clipping.
* PR #239: Fix an uninitialized variable that could lead to nondeterministic
* Issue #238: Fixed occasionally incorrect soft clipping.
* PR #239: Fixed an uninitialized variable that could lead to nondeterministic
results.
* Issue #137: Compute TLEN (in SAM output) correctly
* PR #255: Add support for reading gzip-compressed reference FASTA files.
* Issue #222: Make it possible again to build strobealign from the release
* PR #255: Added support for reading gzip-compressed reference FASTA files.
* Issue #222: Made it possible again to build strobealign from the release
tarball (not only from the Git repository).

## v0.8.0 (2023-02-01)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ options. Some important ones are:
`--create-index`, see [index files](#index-files).
* `-t N`, `--threads=N`: Use N threads. This mainly applies to the mapping step
as the indexing step is only partially parallelized.
* `--eqx`: Emit `=` and `X` CIGAR operations instead of `M`.
* `-x`: Only map reads, do not do no base-level alignment. This switches the
output format from SAM to [PAF](https://github.com/lh3/miniasm/blob/master/PAF.md).
* `--rg-id=ID`: Add RG tag to each SAM record.
Expand Down
4 changes: 2 additions & 2 deletions src/cmdline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ CommandLineOptions parse_command_line_arguments(int argc, char **argv) {
args::ValueFlag<std::string> o(parser, "PATH", "redirect output to file [stdout]", {'o'});
args::Flag v(parser, "v", "Verbose output", {'v'});
args::Flag no_progress(parser, "no-progress", "Disable progress report (enabled by default if output is a terminal)", {"no-progress"});
args::Flag cigar_m(parser, "cigar-m", "Use CIGAR M instead of =/X", {"m-op"});
args::Flag eqx(parser, "eqx", "Emit =/X instead of M CIGAR operations", {"eqx"});
args::Flag x(parser, "x", "Only map reads, no base level alignment (produces PAF file)", {'x'});
args::Flag U(parser, "U", "Suppress output of unmapped reads", {'U'});
args::Flag interleaved(parser, "interleaved", "Interleaved input", {"interleaved"});
Expand Down Expand Up @@ -89,7 +89,7 @@ CommandLineOptions parse_command_line_arguments(int argc, char **argv) {
if (o) { opt.output_file_name = args::get(o); opt.write_to_stdout = false; }
if (v) { opt.verbose = true; }
if (no_progress) { opt.show_progress = false; }
if (cigar_m) { opt.cigar_eqx = false; }
if (eqx) { opt.cigar_eqx = true; }
if (x) { opt.is_sam_out = false; }
if (U) { opt.output_unmapped = false; }
if (rgid) { opt.read_group_id = args::get(rgid); }
Expand Down
2 changes: 1 addition & 1 deletion src/cmdline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ struct CommandLineOptions {
bool write_to_stdout { true };
bool verbose { false };
bool show_progress { true };
bool cigar_eqx { true };
bool cigar_eqx { false };
std::string read_group_id { "" };
std::vector<std::string> read_group_fields;
std::string logfile_name { "" };
Expand Down
6 changes: 3 additions & 3 deletions tests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ if strobealign -G > /dev/null 2> /dev/null; then false; fi
strobealign -h > /dev/null

# Single-end SAM
strobealign --chunk-size 3 --rg-id 1 --rg SM:sample --rg LB:library -v tests/phix.fasta tests/phix.1.fastq | grep -v '^@PG' > phix.se.sam
strobealign --eqx --chunk-size 3 --rg-id 1 --rg SM:sample --rg LB:library -v tests/phix.fasta tests/phix.1.fastq | grep -v '^@PG' > phix.se.sam
diff tests/phix.se.sam phix.se.sam
rm phix.se.sam

# Single-end SAM, M CIGAR operators
strobealign --m-op tests/phix.fasta tests/phix.1.fastq | grep -v '^@PG' > phix.se.m.sam
strobealign tests/phix.fasta tests/phix.1.fastq | grep -v '^@PG' > phix.se.m.sam
if samtools view phix.se.m.sam | cut -f6 | grep -q '[X=]'; then false; fi

rm phix.se.m.sam

# Paired-end SAM
strobealign --chunk-size 3 --rg-id 1 --rg SM:sample --rg LB:library tests/phix.fasta tests/phix.1.fastq tests/phix.2.fastq | grep -v '^@PG' > phix.pe.sam
strobealign --eqx --chunk-size 3 --rg-id 1 --rg SM:sample --rg LB:library tests/phix.fasta tests/phix.1.fastq tests/phix.2.fastq | grep -v '^@PG' > phix.pe.sam
diff tests/phix.pe.sam phix.pe.sam
rm phix.pe.sam

Expand Down

0 comments on commit 56742b9

Please sign in to comment.