forked from sbenz/Paradigm
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathevidencesource.h
110 lines (91 loc) · 2.95 KB
/
evidencesource.h
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/********************************************************************************/
/* Copyright 2009-2011 -- The Regents of the University of California */
/* This code is provided for research purposes to scientists at non-profit */
/* organizations. All other use is strictly prohibited. For further */
/* details please contact University of California, Santa Cruz or */
/* Five3 Genomics, LLC (http://five3genomics.com). */
/********************************************************************************/
#ifndef HEADER_EVIDENCESOURCE_H
#define HEADER_EVIDENCESOURCE_H
#include <vector>
#include <dai/alldai.h>
#include <dai/evidence.h>
#include "pathwaytab.h"
using namespace std;
using namespace dai;
class EvidenceFactorGen : public FactorGenerator {
public:
vector<Real> _params;
EvidenceFactorGen(const PropertySet& p);
~EvidenceFactorGen() {}
void generateValues(const vector< string >& edge_types,
vector< Real >& outVals) const;
};
typedef map<string, map<string,int> > SampleEvidMap;
class EvidenceSource
{
private:
vector<double> cutoffs;
PropertySet options;
string attachPoint;
string _suffix;
string _evidenceFile;
// add these from main.cpp
vector<SampleEvidMap> _disc;
vector<string> _sampleNames;
vector<string> _sampleFactors;
vector<int> _sampleFactorNum;
public:
/// Default constructor
EvidenceSource() : cutoffs(),
attachPoint(),
_suffix(),
_evidenceFile(),
_disc(),
_sampleNames(),
_sampleFactors(),
_sampleFactorNum()
{
setCutoffs("-1.3;1.3");
}
/// Copy constructor
EvidenceSource(const EvidenceSource &x)
: cutoffs(x.cutoffs),
attachPoint(x.attachPoint),
_suffix(x._suffix),
_evidenceFile(x._evidenceFile),
_disc(x._disc),
_sampleNames(x._sampleNames),
_sampleFactors(x._sampleFactors),
_sampleFactorNum(x._sampleFactorNum) {}
/// Assignment operator
EvidenceSource& operator=(const EvidenceSource &x) {
if (this != &x) {
cutoffs = x.cutoffs;
options = x.options;
attachPoint = x.attachPoint;
_suffix = x._suffix;
_evidenceFile = x._evidenceFile;
_disc = x._disc;
_sampleNames = x._sampleNames;
_sampleFactors = x._sampleFactors;
_sampleFactorNum = x._sampleFactorNum;
}
return *this;
}
/// Useful constructor
EvidenceSource(PropertySet &p, string base);
void setCutoffs(string discLimits);
int discCutoffs (float x);
void loadFromFile(PathwayTab& p,
map<string, size_t>& sampleMap,
vector<Evidence::Observation>& sampleData);
const string& evidenceFile() {return _evidenceFile;}
const vector<string>& sampleNames() {return _sampleNames;}
const int factorCount(size_t sample) {return _sampleFactorNum.at(sample);}
const string& factorString(size_t sample) {return _sampleFactors.at(sample);}
};
void Tokenize(const string& str,
vector<string>& tokens,
const string& delimiters = " ");
#endif