@@ -36,7 +36,7 @@ void Data::preprocDataPrep() {
36
36
fs::path trtmsPath = fs::path (this ->params [" trtms" ].as <std::string>());
37
37
38
38
GroupsPath groups = getGroupsPath (ctrlsPath, trtmsPath);
39
- getCondition (groups);
39
+ getCondition (groups, " preproc " );
40
40
}
41
41
42
42
void Data::alignDataPrep () {
@@ -57,7 +57,7 @@ void Data::alignDataPrep() {
57
57
* (ctrls -> "/Users/.../crtls")
58
58
*/
59
59
GroupsPath groups = getGroupsPath (ctrlsPath, trtmsPath);
60
- getCondition (groups);
60
+ getCondition (groups, " align " );
61
61
}
62
62
}
63
63
}
@@ -70,7 +70,7 @@ void Data::detectDataPrep() {
70
70
fs::path trtmsPath = fs::path (params[" outdir" ].as <std::string>()) / " align/trtms" ;
71
71
72
72
GroupsPath groups = getGroupsPath (ctrlsPath, trtmsPath);
73
- getCondition (groups);
73
+ getCondition (groups, " detect " );
74
74
}
75
75
76
76
void Data::clusteringDataPrep () {
@@ -81,7 +81,7 @@ void Data::clusteringDataPrep() {
81
81
fs::path trtmsPath = fs::path (params[" outdir" ].as <std::string>()) / " detect/trtms" ;
82
82
83
83
GroupsPath groups = getGroupsPath (ctrlsPath, trtmsPath);
84
- getCondition (groups);
84
+ getCondition (groups, " clustering " );
85
85
}
86
86
87
87
void Data::analysisDataPrep () {
@@ -92,7 +92,7 @@ void Data::analysisDataPrep() {
92
92
fs::path trtmsPath = fs::path (params[" outdir" ].as <std::string>()) / " detect/trtms" ;
93
93
94
94
GroupsPath groups = getGroupsPath (ctrlsPath, trtmsPath);
95
- getCondition (groups);
95
+ getCondition (groups, " analysis " );
96
96
}
97
97
98
98
GroupsPath Data::getGroupsPath (fs::path& ctrls, fs::path& trtms) {
@@ -115,7 +115,7 @@ GroupsPath Data::getGroupsPath(fs::path& ctrls, fs::path& trtms) {
115
115
}
116
116
117
117
//
118
- void Data::getCondition (GroupsPath& groups) {
118
+ void Data::getCondition (GroupsPath& groups, std::string subcall ) {
119
119
// ptree object containing
120
120
pt::ptree ptData, ptSubcall, ptPath, ptGroup, ptCondition;
121
121
@@ -134,7 +134,7 @@ void Data::getCondition(GroupsPath& groups) {
134
134
continue ;
135
135
}
136
136
137
- ptCondition = getData (group.first , condition);
137
+ ptCondition = getData (group.first , condition, subcall );
138
138
ptGroup.push_back (std::make_pair (" " , ptCondition));
139
139
140
140
}
@@ -152,16 +152,16 @@ void Data::getCondition(GroupsPath& groups) {
152
152
}
153
153
154
154
// write data structure to file
155
- std::string subcall = params[" subcall" ].as <std::string>();
155
+ // std::string subcall = params["subcall"].as<std::string>();
156
156
dataStructure.add_child (subcall, ptSubcall);
157
157
fs::path dataStructurePath = fs::path (params[" outdir" ].as <std::string>()) / fs::path (" data.json" );
158
158
jp::write_json (dataStructurePath.string (), dataStructure);
159
159
std::cout << helper::getTime () << " Data structure has been written to " << dataStructurePath << " \n " ;
160
160
}
161
161
162
162
//
163
- pt::ptree Data::getData (std::string group, fs::path& condition) {
164
- std::string subcall = params[" subcall" ].as <std::string>();
163
+ pt::ptree Data::getData (std::string group, fs::path& condition, std::string& subcall ) {
164
+ // std::string subcall = params["subcall"].as<std::string>();
165
165
std::string outdir = params[" outdir" ].as <std::string>();
166
166
167
167
pt::ptree ptCondition, ptFiles, ptSamples, ptSample, ptOutput;
@@ -176,8 +176,8 @@ pt::ptree Data::getData(std::string group, fs::path& condition) {
176
176
}*/
177
177
178
178
// define helper variables
179
- int numberElements = getNumberElements (dataFiles);
180
- std::vector<std::string> sampleKeys = getSampleKeys ();
179
+ int numberElements = getNumberElements (dataFiles, subcall );
180
+ std::vector<std::string> sampleKeys = getSampleKeys (subcall );
181
181
182
182
fs::path conditionOutDir = fs::path (outdir);
183
183
conditionOutDir /= fs::path (subcall);
@@ -190,7 +190,7 @@ pt::ptree Data::getData(std::string group, fs::path& condition) {
190
190
if (elementCounter == numberElements-1 ) {
191
191
ptSample.add_child (" input" , ptFiles);
192
192
// determine output TODO
193
- ptOutput = getOutputData (ptSample, conditionOutDir);
193
+ ptOutput = getOutputData (ptSample, conditionOutDir, subcall );
194
194
ptSample.add_child (" output" , ptOutput);
195
195
196
196
ptSamples.push_back (std::make_pair (" " , ptSample));
@@ -211,8 +211,8 @@ pt::ptree Data::getData(std::string group, fs::path& condition) {
211
211
}
212
212
213
213
214
- int Data::getNumberElements (PathVector& vec) {
215
- std::string subcall = params[" subcall" ].as <std::string>();
214
+ int Data::getNumberElements (PathVector& vec, std::string& subcall ) {
215
+ // std::string subcall = params["subcall"].as<std::string>();
216
216
int numberElements;
217
217
218
218
if (subcall == " preproc" ) { numberElements = (params[" readtype" ].as <std::string>() == " PE" ) ? 2 : 1 ; }
@@ -228,8 +228,8 @@ int Data::getNumberElements(PathVector& vec) {
228
228
return numberElements;
229
229
}
230
230
231
- std::vector<std::string> Data::getSampleKeys () {
232
- std::string subcall = params[" subcall" ].as <std::string>();
231
+ std::vector<std::string> Data::getSampleKeys (std::string& subcall ) {
232
+ // std::string subcall = params["subcall"].as<std::string>();
233
233
std::vector<std::string> sampleKeys;
234
234
if (subcall == " preproc" ) { sampleKeys = {" forward" , " reverse" }; }
235
235
@@ -249,8 +249,8 @@ std::vector<std::string> Data::getSampleKeys() {
249
249
return sampleKeys;
250
250
}
251
251
252
- pt::ptree Data::getOutputData (pt::ptree& input, fs::path& conditionOutDir) {
253
- std::string subcall = params[" subcall" ].as <std::string>();
252
+ pt::ptree Data::getOutputData (pt::ptree& input, fs::path& conditionOutDir, std::string& subcall ) {
253
+ // std::string subcall = params["subcall"].as<std::string>();
254
254
255
255
pt::ptree output;
256
256
if (subcall == " preproc" ) { output = getPreprocOutputData (input, conditionOutDir); }
@@ -349,11 +349,11 @@ pt::ptree Data::getAnalysisOutputData(pt::ptree& input, fs::path& conditionOutDi
349
349
}
350
350
351
351
template <typename Callable>
352
- void Data::callInAndOut (Callable f) {
352
+ void Data::callInAndOut (Callable f, std::string subcallStr ) {
353
353
354
354
// retrieve paths for parameters
355
355
fs::path outDir = fs::path (params[" outdir" ].as <std::string>());
356
- std::string subcallStr = params[" subcall" ].as <std::string>();
356
+ // std::string subcallStr = params["subcall"].as<std::string>();
357
357
fs::path outSubcallDir = outDir / fs::path (subcallStr);
358
358
359
359
pt::ptree subcall = dataStructure.get_child (subcallStr);
@@ -397,33 +397,33 @@ void Data::callInAndOut(Callable f) {
397
397
void Data::preproc () {
398
398
std::cout << helper::getTime () << " Start the Preprocessing\n " ;
399
399
SeqRickshaw srs (params);
400
- callInAndOut (std::bind (&SeqRickshaw::start, srs, std::placeholders::_1));
400
+ callInAndOut (std::bind (&SeqRickshaw::start, srs, std::placeholders::_1), " preproc " );
401
401
}
402
402
403
403
void Data::align () {
404
404
std::cout << helper::getTime () << " Start the Alignment\n " ;
405
405
Align aln (params);
406
- callInAndOut (std::bind (&Align::start, aln, std::placeholders::_1));
406
+ callInAndOut (std::bind (&Align::start, aln, std::placeholders::_1), " align " );
407
407
}
408
408
409
409
void Data::detect () {
410
410
std::cout << helper::getTime () << " Start the Split Read Calling\n " ;
411
411
SplitReadCalling src (params);
412
- callInAndOut (std::bind (&SplitReadCalling::start, &src, std::placeholders::_1, std::placeholders::_2));
412
+ callInAndOut (std::bind (&SplitReadCalling::start, &src, std::placeholders::_1, std::placeholders::_2), " detect " );
413
413
src.writeStats ();
414
414
}
415
415
416
416
void Data::clustering () {
417
417
std::cout << helper::getTime () << " Start the Clustering of the Split Reads\n " ;
418
418
Clustering clu (params);
419
- callInAndOut (std::bind (&Clustering::start, &clu, std::placeholders::_1));
419
+ callInAndOut (std::bind (&Clustering::start, &clu, std::placeholders::_1), " clustering " );
420
420
clu.sumup ();
421
421
}
422
422
423
423
void Data::analysis () {
424
424
std::cout << helper::getTime () << " Start the Analysis of the Split Reads\n " ;
425
425
Analysis ana (params);
426
- callInAndOut (std::bind (&Analysis::start, &ana, std::placeholders::_1, std::placeholders::_2));
426
+ callInAndOut (std::bind (&Analysis::start, &ana, std::placeholders::_1, std::placeholders::_2), " analysis " );
427
427
// write file output files
428
428
ana.writeAllInts ();
429
429
ana.writeAllIntsCounts ();
0 commit comments