@@ -50,11 +50,11 @@ using namespace std;
50
50
51
51
const static double pi = 3.141593 ;
52
52
53
- Fcr::Fcr () {
53
+ FcrWriter::FcrWriter () {
54
54
// empty constructor
55
55
}
56
56
57
- double Fcr ::BAF (double theta, Egt egt, long snpIndex) {
57
+ double FcrWriter ::BAF (double theta, Egt egt, long snpIndex) {
58
58
// estimate the B allele frequency by interpolating between known clusters
59
59
float *meanTheta = new float [egt.GENOTYPES_PER_SNP ];
60
60
egt.getMeanTheta (snpIndex, meanTheta);
@@ -73,7 +73,7 @@ double Fcr::BAF(double theta, Egt egt, long snpIndex) {
73
73
}
74
74
75
75
// sanity check on manifest and gtc file
76
- void Fcr ::compareNumberOfSNPs (Manifest *manifest, Gtc *gtc) {
76
+ void FcrWriter ::compareNumberOfSNPs (Manifest *manifest, Gtc *gtc) {
77
77
if (manifest->snps .size () != gtc->xRawIntensity .size ()) {
78
78
ostringstream msg;
79
79
msg << " Size mismatch: Manifest contains " << manifest->snps .size ()
@@ -84,7 +84,7 @@ void Fcr::compareNumberOfSNPs(Manifest *manifest, Gtc *gtc) {
84
84
}
85
85
}
86
86
87
- void Fcr ::illuminaCoordinates (double x, double y, double &theta, double &r) {
87
+ void FcrWriter ::illuminaCoordinates (double x, double y, double &theta, double &r) {
88
88
// convert (x,y) cartesian coordinates to Illumina coordinates (theta, r)
89
89
// these are ***NOT*** standard polar coordinates!
90
90
// the angle theta is rescaled s.t. pi/2 radians = 1 "Illumina angular unit"
@@ -94,7 +94,7 @@ void Fcr::illuminaCoordinates(double x, double y, double &theta, double &r) {
94
94
95
95
}
96
96
97
- string Fcr ::createHeader (string content, int samples, int snps) {
97
+ string FcrWriter ::createHeader (string content, int samples, int snps) {
98
98
// generate standard FCR header
99
99
// content argument is typically the manifest name
100
100
// includes data set summary, and column heads for main body
@@ -127,7 +127,7 @@ string Fcr::createHeader(string content, int samples, int snps) {
127
127
return header;
128
128
}
129
129
130
- double Fcr ::logR (double theta, double r, Egt egt, long snpIndex) {
130
+ double FcrWriter ::logR (double theta, double r, Egt egt, long snpIndex) {
131
131
// calculate the LogR metric for given (theta, r) of sample
132
132
// snpIndex is position in the manifest (starting from 0)
133
133
// get (theta, R) for AA, AB, BB from EGT and interpolate
@@ -151,7 +151,7 @@ double Fcr::logR(double theta, double r, Egt egt, long snpIndex) {
151
151
}
152
152
153
153
154
- void Fcr ::write (Egt *egt, Manifest *manifest, ostream *outStream,
154
+ void FcrWriter ::write (Egt *egt, Manifest *manifest, ostream *outStream,
155
155
vector<string> infiles, vector<string> sampleNames) {
156
156
// 'main' method to generate FCR and write to given output stream
157
157
Gtc *gtc = new Gtc ();
@@ -207,7 +207,7 @@ void Fcr::write(Egt *egt, Manifest *manifest, ostream *outStream,
207
207
}
208
208
209
209
210
- FcrData::FcrData (string infile) {
210
+ FcrReader::FcrReader (string infile) {
211
211
ifstream inStream;
212
212
string line;
213
213
bool body = false ;
@@ -268,8 +268,8 @@ FcrData::FcrData(string infile) {
268
268
this ->header = parseHeader (header_lines);
269
269
}
270
270
271
- bool FcrData ::equivalent (FcrData other, bool verbose) {
272
- // check for equality on data fields with another FcrData object
271
+ bool FcrReader ::equivalent (FcrReader other, bool verbose) {
272
+ // check for equality on data fields with another FcrReader object
273
273
bool equal = true ;
274
274
double epsilon = 1e-5 ;
275
275
if (totalPairs != other.totalPairs ) {
@@ -370,7 +370,7 @@ bool FcrData::equivalent(FcrData other, bool verbose) {
370
370
371
371
}
372
372
373
- bool FcrData ::equivalentHeaders (FcrData other, bool verbose) {
373
+ bool FcrReader ::equivalentHeaders (FcrReader other, bool verbose) {
374
374
map<string, string> myHead = this ->header ;
375
375
map<string, string> otherHead = other.header ;
376
376
bool equivalent = true ;
@@ -392,7 +392,7 @@ bool FcrData::equivalentHeaders(FcrData other, bool verbose) {
392
392
return equivalent;
393
393
}
394
394
395
- map<string, string> FcrData ::parseHeader (vector<string> input) {
395
+ map<string, string> FcrReader ::parseHeader (vector<string> input) {
396
396
// parse header fields
397
397
vector<unsigned int > keyLengths (headerKeys.size (), 0 );
398
398
for (unsigned int i=0 ; i<headerKeys.size (); i++) {
@@ -422,7 +422,7 @@ map<string, string> FcrData::parseHeader(vector<string> input) {
422
422
return header;
423
423
}
424
424
425
- vector<string> FcrData ::splitByWhiteSpace (string str) {
425
+ vector<string> FcrReader ::splitByWhiteSpace (string str) {
426
426
// split line into tokens by iterating over a stringstream
427
427
string buffer;
428
428
stringstream ss (str); // Insert the string into a stream
0 commit comments