Skip to content

Commit

Permalink
Merge branch 'DOR-402_sam_out_when_tty' into 'master'
Browse files Browse the repository at this point in the history
DOR-402 ensure that aligner outputs SAM on tty

Closes DOR-402

See merge request machine-learning/dorado!717
  • Loading branch information
iiSeymour committed Nov 20, 2023
2 parents 14beca3 + d24a299 commit 20b5637
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dorado/cli/aligner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,15 @@ int aligner(int argc, char* argv[]) {
auto header = sam_hdr_dup(reader.header);
add_pg_hdr(header);

auto output_mode = HtsWriter::OutputMode::BAM;
if (utils::is_fd_tty(stdout)) {
output_mode = HtsWriter::OutputMode::SAM;
} else if (utils::is_fd_pipe(stdout)) {
output_mode = HtsWriter::OutputMode::UBAM;
}

PipelineDescriptor pipeline_desc;
auto hts_writer =
pipeline_desc.add_node<HtsWriter>({}, "-", HtsWriter::OutputMode::BAM, writer_threads);
auto hts_writer = pipeline_desc.add_node<HtsWriter>({}, "-", output_mode, writer_threads);
auto aligner =
pipeline_desc.add_node<AlignerNode>({hts_writer}, index, options, aligner_threads);

Expand Down

0 comments on commit 20b5637

Please sign in to comment.