• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

MikkelSchubert / adapterremoval / #106

28 Apr 2025 11:42AM UTC coverage: 66.997% (+0.07%) from 66.927%
#106

push

travis-ci

web-flow
gather phred<->p code and fix reported mott value (#132)

42 of 47 new or added lines in 6 files covered. (89.36%)

8 existing lines in 1 file now uncovered.

9732 of 14526 relevant lines covered (67.0%)

3044.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/reports_terminal.cpp
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
// SPDX-FileCopyrightText: 2022 Mikkel Schubert <mikkelsch@gmail.com>
3
#include "commontypes.hpp" // for trimming_strategy, trimming_strategy::mott
4
#include "debug.hpp"       // for AR_FAIL
5
#include "fastq_enc.hpp"   // for fastq_encoding
6
#include "logging.hpp"     // for info, log_stream, error, warn
7
#include "reports.hpp"     // for print_terminal_postamble, print_terminal_...
8
#include "simd.hpp"        // for name, instruction_set, instruction_set::none
9
#include "userconfig.hpp"  // for userconfig, ar_command, ar_command::demul...
10
#include <iomanip>         // for fixed, setprecision
11
#include <string>          // for string
12

13
namespace adapterremoval {
14

15
void
16
print_trimming_parameters(const userconfig& config)
×
17
{
18
  switch (config.trim) {
×
19
    case trimming_strategy::mott:
×
NEW
20
      log::info() << "  - Mott based trimming with Phred encoded quality score "
×
NEW
21
                  << std::fixed << std::setprecision(1)
×
NEW
22
                  << fastq_encoding::p_to_phred(config.trim_mott_rate);
×
23
      break;
×
24
    case trimming_strategy::window:
×
25
      log::info() << "  - Window based quality based trimming with window size "
×
26
                  << config.trim_window_length << "and minimum quality score "
×
27
                  << config.trim_quality_score
×
28
                  << (config.trim_ambiguous_bases ? " (including Ns)" : "");
×
29
      break;
×
30
    case trimming_strategy::per_base:
×
31
      if (config.trim_low_quality_bases) {
×
32
        log::info() << "  - Per-base based quality based trimming with minimum "
×
33
                    << "quality score " << config.trim_quality_score
×
34
                    << (config.trim_ambiguous_bases ? " (including Ns)" : "");
×
35
      } else if (config.trim_ambiguous_bases) {
×
36
        log::info() << "  - Per-base based trimming of Ns";
×
37
      } else {
38
        AR_FAIL("this should not be possible");
×
39
      }
40
      break;
41
    case trimming_strategy::none:
×
42
      log::info() << "  - Quality based trimming disabled";
×
43
      break;
×
44

45
    default:
×
46
      AR_FAIL("not implemented");
×
47
  }
48
}
49

50
void
51
print_terminal_preamble(const userconfig& config)
×
52
{
53
  log::log_preamble();
×
54

55
  if (config.simd == simd::instruction_set::none) {
×
56
    log::warn() << "Hardware accelerated alignments disabled!";
×
57
  } else {
58
    log::info() << "Using " << simd::name(config.simd)
×
59
                << " accelerated alignments";
×
60
  }
61

62
  switch (config.run_type) {
×
63
    case ar_command::trim_adapters:
×
64
      if (config.paired_ended_mode) {
×
65
        log::info() << "Trimming adapters from PE reads:";
×
66
      } else {
67
        log::info() << "Trimming adapters from SE reads:";
×
68
      }
69

70
      print_trimming_parameters(config);
×
71
      break;
×
72
    case ar_command::benchmark:
×
73
      log::info() << "Benchmarking sub-systems";
×
74
      break;
×
75
    case ar_command::demultiplex_only:
×
76
      log::info() << "Demultiplexing reads";
×
77
      break;
×
78
    case ar_command::report_only:
×
79
      log::info() << "Generating FASTQ quality report";
×
80
      break;
×
81
    default:
×
82
      AR_FAIL("invalid run type");
×
83
  }
84
}
85

86
void
87
print_terminal_postamble(const userconfig& config, bool any_errors)
×
88
{
89
  if (any_errors) {
×
90
    switch (config.run_type) {
×
91
      case ar_command::trim_adapters:
×
92
      case ar_command::demultiplex_only:
×
93
        log::error() << "AdapterRemoval did not run to completion;\n"
×
94
                     << "    do NOT make use of the resulting reads!";
×
95
      case ar_command::benchmark:
×
96
      case ar_command::report_only:
×
97
        break;
×
98
      default:
×
99
        AR_FAIL("invalid run type");
×
100
    }
101

102
    return;
×
103
  }
104

105
  switch (config.run_type) {
×
106
    case ar_command::benchmark:
×
107
      log::info() << "Benchmarking complete";
×
108
      break;
×
109
    case ar_command::trim_adapters:
×
110
      log::info() << "Adapter trimming complete";
×
111
      break;
×
112
    case ar_command::demultiplex_only:
×
113
      log::info() << "Demultiplexing complete";
×
114
      break;
×
115
    case ar_command::report_only:
×
116
      log::info() << "FASTQ quality report generation complete";
×
117
      break;
×
118
    default:
×
119
      AR_FAIL("invalid run type");
×
120
  }
121
}
122

123
} // namespace adapterremoval
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc