-
Notifications
You must be signed in to change notification settings - Fork 0
/
functions2.hpp
110 lines (91 loc) · 4.86 KB
/
functions2.hpp
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
#ifndef FUNCTIONS_H // To make sure you don't declare the function more than once by including the header multiple times.
#define FUNCTIONS_H
#include <vector>
#include <random>
using std::vector;
double logchisq_R(const double score, const int m_i);
void RemoveGeneFromVector(int GeneToRemove, vector <int> &X);
int RandomlySelectGeneToBan(const vector <int> vect, std::mt19937_64 rng);
vector <int> ConvertAffiliationsToInts(const vector<std::string> cellaffiliations_raw);
void readIn2dData(const char* filename, vector<vector<double> >& ranktable, vector<std::string> & gene_names, vector<std::string> & cell_affiliations);
void readIn2dData_int(const char* filename, vector<vector<int> >& ranktable);
vector<int> readInAffiliationsVector(const char* filename);
double objectivefunction(
int newGene,
bool add,
vector<double> &A,
vector<double> &B,
vector<double> &C,
vector<double> &D,
const vector<vector<double> > &T_ij,
const vector<vector<double> > &SSR,
vector<double> &Rc,
const vector<double> &GG,
const vector<double> &F,
const vector<double> &E,
vector<double> &logpvals,
const vector<int> &cellaffiliations,
const vector<vector<double> > &r,
const vector<int> m_i,
const int n,
vector<double> &S_hats,
const double factor,
const vector<int> &PriorState // State: < selected_gene_0, ..., selected_gene_k, unselected_gene_k+1, ..., unselected_gene_M, CurrentNumberOfGenes>
);
/** Auxilary function that takes mostly references to existing parts of the Friedman statistic and returns a sum of squares of log(pvalues)
* Same as the previous objectivefunction, but for swapping two genes instead of adding/substracting a gene.
*
* @param geneToSwapIn
* @param geneToSwapOut
*/
double objectivefunction_swap(int geneToSwapIn,
int geneToSwapOut,
vector<double> &A,
vector<double> &B,
vector<double> &C,
vector<double> &D,
const vector<vector<double> > &T_ij,
const vector<vector<double> > &SSR,
vector<double> &Rc,
const vector<double> &GG,
const vector<double> &F,
const vector<double> &E,
vector<double> &logpvals,
const vector<int> &cellaffiliations,
const vector<vector<double> > &r,
const vector<int> m_i,
const int n,
vector<double> &S_hats,
const double factor,
const vector<int> &PriorState);
vector <int> SampleBoundaries(const vector <int> cellaffiliations);
void ComputeSquaredRanksAndTieAdjustments(vector<vector <double> > &SSR,
vector<vector <double> > &T_ij,
const vector<vector <double> > &input_table,
const vector <int> &cellaffiliations
);
void PermuteRanksWithinEachGeneInEachSample(
vector<vector<double> > &r,
vector<int> &firstCellInSample,
std::uniform_real_distribution <> &runif,
std::mt19937_64 rng);
double KnownStartingTemperature(const int x);
vector <int> ConstructStateVector(vector <int> Geneset,
const int k, vector <int> banned_genes);
double InitializeFriedmanMembers(const vector<int> &G,
vector<double> &A,
vector<double> &B,
vector<double> &C,
vector<double> &D,
vector<double> &Rc,
vector<double> &GG,
vector<double> &F,
vector<double> &E,
vector<double> &S_hats,
vector<double> &logpvals,
vector<int> &m_i,
const vector<vector<double> > &r,
const vector <int> &cellaffiliations,
const vector<vector<double> > &T_ij,
const double factor);
#endif