File: RangeFinder.hpp

package info (click to toggle)
consensuscore 1.1.1%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 3,404 kB
  • sloc: cpp: 38,940; python: 2,083; ansic: 542; sh: 184; makefile: 82; cs: 10
file content (55 lines) | stat: -rw-r--r-- 1,555 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once

#include <ConsensusCore/Interval.hpp>
#include <ConsensusCore/Poa/PoaGraph.hpp>

#include <cstddef>
#include <map>
#include <string>
#include <utility>
#include <vector>

namespace ConsensusCore {
namespace detail {

// an Anchor represents a point (cssPos, readPos)
typedef std::pair<size_t, size_t> SdpAnchor;
typedef std::vector<SdpAnchor> SdpAnchorVector;

class PoaGraphImpl;

using ConsensusCore::PoaGraph;
using ConsensusCore::Interval;

//
// SdpRangeFinder objects are responsible for identifying the range
// of read positions that we should seek to align to a POA vertex;
// this implementation uses SDP to identify fairly narrow bands,
// enabling sparse memory usage.
//
// This is an abstract class that will be inherited in a client
// library that has access to an SDP method.
//
// RangeFinder state goes away on next call to InitRangeFinder.  We could
// have dealt with this using a factory pattern but bleh.
//
class SdpRangeFinder
{
private:
    std::map<PoaGraph::Vertex, Interval> alignableReadIntervalByVertex_;

public:
    virtual ~SdpRangeFinder();

    void InitRangeFinder(const PoaGraphImpl& poaGraph,
                         const std::vector<PoaGraph::Vertex>& consensusPath,
                         const std::string& consensusSequence, const std::string& readSequence);

    Interval FindAlignableRange(PoaGraph::Vertex v);

protected:
    virtual SdpAnchorVector FindAnchors(const std::string& consensusSequence,
                                        const std::string& readSequence) const = 0;
};
}
}