• 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/main.cpp
1
/*************************************************************************\
2
 * AdapterRemoval - cleaning next-generation sequencing reads            *
3
 *                                                                       *
4
 * Copyright (C) 2011 by Stinus Lindgreen - stinus@binf.ku.dk            *
5
 * Copyright (C) 2014 by Mikkel Schubert - mikkelsch@gmail.com           *
6
 *                                                                       *
7
 * This program is free software: you can redistribute it and/or modify  *
8
 * it under the terms of the GNU General Public License as published by  *
9
 * the Free Software Foundation, either version 3 of the License, or     *
10
 * (at your option) any later version.                                   *
11
 *                                                                       *
12
 * This program is distributed in the hope that it will be useful,       *
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 * GNU General Public License for more details.                          *
16
 *                                                                       *
17
 * You should have received a copy of the GNU General Public License     *
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. *
19
\*************************************************************************/
20
#include "main.hpp"
21
#include "argparse.hpp"   // for parse_result, parse_result::error, parse_...
22
#include "debug.hpp"      // for AR_FAIL
23
#include "logging.hpp"    // for log_stream, error
24
#include "reports.hpp"    // for print_terminal_postamble, print_terminal_...
25
#include "userconfig.hpp" // for ar_command, userconfig, ar_command::demul...
26
#include <cstdlib>        // for abort, size_t
27
#include <ios>            // for ios_base
28

29
namespace adapterremoval {
30

31
// See main_adapter_rm.cpp
32
int
33
remove_adapter_sequences(const userconfig& config);
34
// See main_adapter_id.cpp
35
int
36
identify_adapter_sequences(const userconfig& config);
37
// See main_demultiplex.cpp
38
int
39
demultiplex_sequences(const userconfig& config);
40
// See main_fastq_ro.cpp
41
int
42
fastq_report_only(const userconfig& config);
43
// See main_benchmark.cpp
44
int
45
benchmark(const userconfig& config);
46

47
[[noreturn]] void
48
terminate(const std::string& message)
×
49
{
50
  log::error()
×
51
    << message << "\n"
×
52
    << "This should not happen! Please file a bug-report at\n"
×
53
    << "    https://github.com/MikkelSchubert/adapterremoval/issues/new\n\n"
×
54
    << "Please specify the AdapterRemoval version used (" << VERSION << ")\n"
×
55
    << "and if possible describe the steps taken to reproduce this problem.";
×
56

57
  std::abort();
×
58
}
59

60
} // namespace adapterremoval
61

62
int
63
main(int argc, char* argv[])
×
64
{
65
  using namespace adapterremoval;
×
66

67
  std::ios_base::sync_with_stdio(false);
×
68

69
  userconfig config;
×
70

71
  const std::vector<std::string> argvec(argv, argv + argc);
×
72
  switch (config.parse_args(argvec)) {
×
73
    case argparse::parse_result::error:
74
      return 1;
75

76
    case argparse::parse_result::exit:
×
77
      // --version, --help, or similar used.
78
      return 0;
×
79

80
    case argparse::parse_result::ok:
×
81
      // Ok
82
      break;
×
83

84
    default:
×
85
      AR_FAIL("invalid argparse::parse_result");
×
86
  }
87

88
  print_terminal_preamble(config);
×
89

90
  auto returncode = 0;
×
91
  switch (config.run_type) {
×
92
    case ar_command::demultiplex_only:
×
93
    case ar_command::trim_adapters: {
×
94
      returncode = remove_adapter_sequences(config);
×
95
      break;
96
    }
97

98
    case ar_command::benchmark: {
×
99
      returncode = benchmark(config);
×
100
      break;
101
    }
102

103
    case ar_command::report_only: {
×
104
      returncode = identify_adapter_sequences(config);
×
105
      break;
106
    }
107

108
    default: {
×
109
      log::error() << "Unknown run-type: "
×
110
                   << static_cast<size_t>(config.run_type);
×
111
      return 1;
×
112
    }
113
  }
114

115
  print_terminal_postamble(config, returncode);
×
116

117
  return returncode;
118
}
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

© 2025 Coveralls, Inc