• 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_adapter_rm.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 "demultiplexing.hpp" // for demultiplex_pe_reads, demultiplex_se_r...
21
#include "fastq_io.hpp"       // for gzip_split_fastq, post_process_fastq
22
#include "output.hpp"         // for outpuT_file, DEV_NULL
23
#include "reports.hpp"        // for write_html_report, write_json_report
24
#include "scheduler.hpp"      // for scheduler
25
#include "sequence_sets.hpp"  // for adapter_set
26
#include "simd.hpp"           // for size_t
27
#include "statistics.hpp"     // for trim_stats_ptr, trimming_statistics
28
#include "trimming.hpp"       // for pe_reads_processor, se_reads_processor
29
#include "userconfig.hpp"     // for userconfig, output_files, DEV_NULL
30
#include <cstring>            // for size_t
31
#include <limits>             // for numeric_limits
32
#include <memory>             // for make_shared
33
#include <string>             // for operator!=, basic_string, string
34
#include <vector>             // for vector
35

36
namespace adapterremoval {
37

38
int
39
remove_adapter_sequences(const userconfig& config)
×
40
{
41
  scheduler sch;
×
42

43
  statistics stats = statistics_builder()
×
44
                       .sample_rate(config.report_sample_rate)
×
45
                       .estimate_duplication(config.report_duplication)
×
46
                       .demultiplexing(config.samples.size())
×
47
                       .initialize();
×
48

49
  auto output = config.get_output_filenames();
×
50
  // Add write steps for demultiplexed and per-samples output
51
  output.add_write_steps(sch, config);
×
52

53
  post_demux_steps steps;
×
54

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

59
    if (!config.is_adapter_trimming_enabled()) {
×
60
      steps.samples.push_back(sch.add<process_demultiplexed>(
×
61
        config, output.get_sample(nth), nth, stats.trimming.back()));
×
62
    } else if (config.paired_ended_mode) {
×
63
      steps.samples.push_back(sch.add<pe_reads_processor>(
×
64
        config, output.get_sample(nth), nth, stats.trimming.back()));
×
65
    } else {
66
      steps.samples.push_back(sch.add<se_reads_processor>(
×
67
        config, output.get_sample(nth), nth, stats.trimming.back()));
×
68
    }
69
  }
70

71
  // Step 3: Parse and demultiplex reads based on single or double indices
72
  size_t processing_step = std::numeric_limits<size_t>::max();
×
73
  if (config.is_demultiplexing_enabled()) {
×
74
    // Statistics and serialization of unidentified reads
75
    steps.unidentified =
×
76
      sch.add<processes_unidentified>(config, output, stats.demultiplexing);
×
77

78
    if (config.paired_ended_mode) {
×
79
      processing_step =
×
80
        sch.add<demultiplex_pe_reads>(config, steps, stats.demultiplexing);
×
81
    } else {
82
      processing_step =
×
83
        sch.add<demultiplex_se_reads>(config, steps, stats.demultiplexing);
×
84
    }
85
  } else {
86
    processing_step = steps.samples.back();
×
87
  }
88

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

93
  // Step 1: Read input file(s)
94
  read_fastq::add_steps(sch, config, postproc_step);
×
95

96
  if (!sch.run(config.max_threads)) {
×
97
    return 1;
98
  }
99

100
  if (!write_json_report(config, stats, output.settings_json)) {
×
101
    return 1;
102
  }
103

104
  return !write_html_report(config, stats, output.settings_html);
×
105
}
106

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