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

MikkelSchubert / adapterremoval / #117

25 May 2025 03:01PM UTC coverage: 66.932% (-0.07%) from 67.006%
#117

push

travis-ci

web-flow
iwyu and reduce build-time inter-dependencies (#144)

26 of 145 new or added lines in 20 files covered. (17.93%)

89 existing lines in 5 files now uncovered.

9738 of 14549 relevant lines covered (66.93%)

3041.19 hits per line

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

0.0
/src/main_adapter_rm.cpp
1
// SPDX-License-Identifier: GPL-3.0-or-later
2
// SPDX-FileCopyrightText: 2011 Stinus Lindgreen <stinus@binf.ku.dk>
3
// SPDX-FileCopyrightText: 2014 Mikkel Schubert <mikkelsch@gmail.com>
4
#include "demultiplexing.hpp" // for demultiplex_pe_reads, demultiplex_se_r...
5
#include "fastq_io.hpp"       // for gzip_split_fastq, post_process_fastq
6
#include "output.hpp"         // for outpuT_file, DEV_NULL
7
#include "reports.hpp"        // for write_html_report, write_json_report
8
#include "scheduler.hpp"      // for scheduler
9
#include "sequence_sets.hpp"  // for adapter_set
10
#include "statistics.hpp"     // for trim_stats_ptr, trimming_statistics
11
#include "trimming.hpp"       // for pe_reads_processor, se_reads_processor
12
#include "userconfig.hpp"     // for userconfig, output_files, DEV_NULL
13
#include <cstring>            // for size_t
14
#include <limits>             // for numeric_limits
15
#include <memory>             // for make_shared
16
#include <vector>             // for vector
17

18
namespace adapterremoval {
19

20
int
21
remove_adapter_sequences(const userconfig& config)
×
22
{
23
  scheduler sch;
×
24

25
  statistics stats = statistics_builder()
×
26
                       .sample_rate(config.report_sample_rate)
×
27
                       .estimate_duplication(config.report_duplication)
×
NEW
28
                       .demultiplexing(config.samples->size())
×
29
                       .initialize();
×
30

31
  auto output = config.get_output_filenames();
×
32
  // Add write steps for demultiplexed and per-samples output
33
  output.add_write_steps(sch, config);
×
34

35
  post_demux_steps steps;
×
36

37
  // Step 4 - N: Trim and write (demultiplexed) reads
38
  for (size_t nth = 0; nth < output.samples().size(); ++nth) {
×
39
    stats.trimming.push_back(std::make_shared<trimming_statistics>());
×
40

41
    if (!config.is_adapter_trimming_enabled()) {
×
42
      steps.samples.push_back(
×
43
        sch.add<process_demultiplexed>(config,
×
44
                                       output.get_sample(nth),
45
                                       nth,
46
                                       stats.trimming.back()));
×
47
    } else if (config.paired_ended_mode) {
×
48
      steps.samples.push_back(
×
49
        sch.add<pe_reads_processor>(config,
×
50
                                    output.get_sample(nth),
51
                                    nth,
52
                                    stats.trimming.back()));
×
53
    } else {
54
      steps.samples.push_back(
×
55
        sch.add<se_reads_processor>(config,
×
56
                                    output.get_sample(nth),
57
                                    nth,
58
                                    stats.trimming.back()));
×
59
    }
60
  }
61

62
  // Step 3: Parse and demultiplex reads based on single or double indices
63
  size_t processing_step = std::numeric_limits<size_t>::max();
×
64
  if (config.is_demultiplexing_enabled()) {
×
65
    // Statistics and serialization of unidentified reads
66
    steps.unidentified =
×
67
      sch.add<processes_unidentified>(config, output, stats.demultiplexing);
×
68

69
    if (config.paired_ended_mode) {
×
70
      processing_step =
×
71
        sch.add<demultiplex_pe_reads>(config, steps, stats.demultiplexing);
×
72
    } else {
73
      processing_step =
×
74
        sch.add<demultiplex_se_reads>(config, steps, stats.demultiplexing);
×
75
    }
76
  } else {
77
    processing_step = steps.samples.back();
×
78
  }
79

80
  // Step 2: Post-process, validate, and collect statistics on FASTQ reads
81
  const size_t postproc_step =
×
82
    sch.add<post_process_fastq>(config, processing_step, stats);
×
83

84
  // Step 1: Read input file(s)
85
  read_fastq::add_steps(sch, config, postproc_step, stats);
×
86

87
  if (!sch.run(config.max_threads)) {
×
88
    return 1;
89
  }
90

91
  if (!write_json_report(config, stats, output.settings_json)) {
×
92
    return 1;
93
  }
94

95
  return !write_html_report(config, stats, output.settings_html);
×
96
}
97

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

© 2025 Coveralls, Inc