ContextSV v1.0.0
Loading...
Searching...
No Matches
dbscan.h
Go to the documentation of this file.
1#ifndef DBSCAN_H
2#define DBSCAN_H
3
4#include <vector>
5#include <utility>
6#include <cmath>
7#include <algorithm>
8
9#include "sv_object.h"
10
11class DBSCAN {
12 public:
13 DBSCAN(double epsilon, int minPts) : epsilon(epsilon), minPts(minPts) {}
14
15 // Fit the DBSCAN algorithm to SV calls
16 void fit(const std::vector<SVCall>& sv_calls);
17
18 const std::vector<int>& getClusters() const;
19
20 private:
21 double epsilon;
22 int minPts;
23 std::vector<int> clusters;
24
25 // Expand the cluster for a given SV call
26 bool expandCluster(const std::vector<SVCall>& sv_calls, size_t pointIdx, int clusterId);
27
28 // Find the region query for a given SV call
29 std::vector<size_t> regionQuery(const std::vector<SVCall>& sv_calls, size_t pointIdx) const;
30
31 // Calculate the distance between two SV calls
32 double distance(const SVCall& a, const SVCall& b) const;
33};
34
35#endif // DBSCAN_H
Definition dbscan.h:11
DBSCAN(double epsilon, int minPts)
Definition dbscan.h:13
const std::vector< int > & getClusters() const
Definition dbscan.cpp:22
void fit(const std::vector< SVCall > &sv_calls)
Definition dbscan.cpp:9
Definition sv_object.h:16