• 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

33.33
/src/barcode_table.hpp
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
#pragma once
21

22
#include "sequence.hpp" // for sequence_pair_vec
23
#include <array>        // for array
24
#include <cstddef>      // for size_t
25
#include <cstdint>      // for int32_t
26
#include <vector>       // for vector
27

28
namespace adapterremoval {
29

30
class sample_set;
31
class fastq;
32
struct next_subsequence;
33

34
/**
35
 * Struct representing node in quad-tree; children are referenced using the
36
 * corresponding index in the vector representing the tree; -1 is used to
37
 * represent unassigned children.
38
 */
39
struct demultiplexer_node
40
{
41
  demultiplexer_node();
42

43
  std::array<int32_t, 4> children;
44
  int value;
45
};
46

47
using demux_node_vec = std::vector<demultiplexer_node>;
48

49
/**
50
 *
51
 */
52
class barcode_table
64✔
53
{
54
public:
55
  barcode_table(const sample_set& samples,
56
                size_t max_mm,
57
                size_t max_mm_r1,
58
                size_t max_mm_r2);
59

60
  barcode_table(const sequence_pair_vec& barcodes,
61
                size_t max_mm,
62
                size_t max_mm_r1,
63
                size_t max_mm_r2);
64

65
  int identify(const fastq& read_r1) const;
66
  int identify(const fastq& read_r1, const fastq& read_r2) const;
67

68
  [[nodiscard]] size_t length_1() const { return m_barcode_1_len; }
×
69

70
  [[nodiscard]] size_t length_2() const { return m_barcode_2_len; }
×
71

72
  constexpr static const int no_match = -1;
73
  constexpr static const int ambiguous = -2;
74

75
private:
76
  struct candidate
77
  {
78
    explicit candidate(int barcode = barcode_table::no_match,
79
                       size_t mismatches = -1);
80

81
    int barcode;
82
    size_t mismatches;
83
  };
84

85
  candidate lookup(const char* seq,
86
                   int parent,
87
                   size_t max_global_mismatches,
88
                   const next_subsequence* next) const;
89

90
  candidate lookup_with_mm(const char* seq,
91
                           int parent,
92
                           size_t max_global_mismatches,
93
                           size_t max_local_mismatches,
94
                           const next_subsequence* next) const;
95

96
  demux_node_vec m_nodes{};
97
  size_t m_max_mismatches = 0;
98
  size_t m_max_mismatches_r1 = 0;
99
  size_t m_max_mismatches_r2 = 0;
100
  size_t m_barcode_1_len = 0;
101
  size_t m_barcode_2_len = 0;
102
};
103

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