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

MikkelSchubert / adapterremoval / #45

20 Sep 2024 06:49PM UTC coverage: 26.244% (-49.2%) from 75.443%
#45

push

travis-ci

web-flow
attempt to fix coveralls run

2458 of 9366 relevant lines covered (26.24%)

4362.23 hits per line

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

0.0
/src/reports_terminal.cpp
1
/*************************************************************************\
2
 * AdapterRemoval - cleaning next-generation sequencing reads            *
3
 *                                                                       *
4
 * Copyright (C) 2022 by Mikkel Schubert - mikkelsch@gmail.com           *
5
 *                                                                       *
6
 * This program is free software: you can redistribute it and/or modify  *
7
 * it under the terms of the GNU General Public License as published by  *
8
 * the Free Software Foundation, either version 3 of the License, or     *
9
 * (at your option) any later version.                                   *
10
 *                                                                       *
11
 * This program is distributed in the hope that it will be useful,       *
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
14
 * GNU General Public License for more details.                          *
15
 *                                                                       *
16
 * You should have received a copy of the GNU General Public License     *
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. *
18
\*************************************************************************/
19
#include "commontypes.hpp" // for trimming_strategy, trimming_strategy::mott
20
#include "debug.hpp"       // for AR_FAIL
21
#include "logging.hpp"     // for info, log_stream, error, warn
22
#include "reports.hpp"     // for print_terminal_postamble, print_terminal_...
23
#include "simd.hpp"        // for name, instruction_set, instruction_set::none
24
#include "userconfig.hpp"  // for userconfig, ar_command, ar_command::demul...
25
#include <string>          // for string
26

27
namespace adapterremoval {
28

29
void
30
print_trimming_parameters(const userconfig& config)
×
31
{
32
  switch (config.trim) {
×
33
    case trimming_strategy::mott:
×
34
      log::info() << "  - Mott based quality based trimming with max "
×
35
                  << "error-rate " << config.trim_mott_rate;
×
36
      break;
×
37
    case trimming_strategy::window:
×
38
      log::info() << "  - Window based quality based trimming with window size "
×
39
                  << config.trim_window_length << "and minimum quality score "
×
40
                  << config.trim_quality_score
×
41
                  << (config.trim_ambiguous_bases ? " (including Ns)" : "");
×
42
      break;
×
43
    case trimming_strategy::per_base:
×
44
      if (config.trim_low_quality_bases) {
×
45
        log::info() << "  - Per-base based quality based trimming with minimum "
×
46
                    << "quality score " << config.trim_quality_score
×
47
                    << (config.trim_ambiguous_bases ? " (including Ns)" : "");
×
48
      } else if (config.trim_ambiguous_bases) {
×
49
        log::info() << "  - Per-base based trimming of Ns";
×
50
      } else {
51
        AR_FAIL("this should not be possible");
×
52
      }
53
      break;
54
    case trimming_strategy::none:
×
55
      log::info() << "  - Quality based trimming disabled";
×
56
      break;
×
57

58
    default:
×
59
      AR_FAIL("not implemented");
×
60
  }
61
}
62

63
void
64
print_terminal_preamble(const userconfig& config)
×
65
{
66
  log::log_preamble();
×
67

68
  if (config.simd == simd::instruction_set::none) {
×
69
    log::warn() << "Hardware accelerated alignments disabled!";
×
70
  } else {
71
    log::info() << "Using " << simd::name(config.simd)
×
72
                << " accelerated alignments";
×
73
  }
74

75
  switch (config.run_type) {
×
76
    case ar_command::trim_adapters:
×
77
      if (config.paired_ended_mode) {
×
78
        log::info() << "Trimming adapters from PE reads:";
×
79
      } else {
80
        log::info() << "Trimming adapters from SE reads:";
×
81
      }
82

83
      print_trimming_parameters(config);
×
84
      break;
×
85
    case ar_command::benchmark:
×
86
      log::info() << "Benchmarking sub-systems";
×
87
      break;
×
88
    case ar_command::demultiplex_only:
×
89
      log::info() << "Demultiplexing reads";
×
90
      break;
×
91
    case ar_command::report_only:
×
92
      log::info() << "Generating FASTQ quality report";
×
93
      break;
×
94
    default:
×
95
      AR_FAIL("invalid run type");
×
96
  }
97
}
98

99
void
100
print_terminal_postamble(const userconfig& config, bool any_errors)
×
101
{
102
  if (any_errors) {
×
103
    switch (config.run_type) {
×
104
      case ar_command::trim_adapters:
×
105
      case ar_command::demultiplex_only:
×
106
        log::error() << "AdapterRemoval did not run to completion;\n"
×
107
                     << "    do NOT make use of the resulting reads!";
×
108
      case ar_command::benchmark:
×
109
      case ar_command::report_only:
×
110
        break;
×
111
      default:
×
112
        AR_FAIL("invalid run type");
×
113
    }
114

115
    return;
×
116
  }
117

118
  switch (config.run_type) {
×
119
    case ar_command::benchmark:
×
120
      log::info() << "Benchmarking complete";
×
121
      break;
×
122
    case ar_command::trim_adapters:
×
123
      log::info() << "Adapter trimming complete";
×
124
      break;
×
125
    case ar_command::demultiplex_only:
×
126
      log::info() << "Demultiplexing complete";
×
127
      break;
×
128
    case ar_command::report_only:
×
129
      log::info() << "FASTQ quality report generation complete";
×
130
      break;
×
131
    default:
×
132
      AR_FAIL("invalid run type");
×
133
  }
134
}
135

136
} // 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