Skip to content

Commit 6da6467

Browse files
author
a_anil
committed
Remove WashU file generation from ProximityDetector
1 parent 47f688d commit 6da6467

File tree

1 file changed

+49
-73
lines changed

1 file changed

+49
-73
lines changed

src/Find_Interactions.cpp

Lines changed: 49 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
9696
FileName.append(".txt");
9797
std::ofstream outf1(FileName.c_str());
9898

99+
/**
99100
FileName2.append(BaseFileName); //washU ouput
100101
FileName2.append(".");
101102
FileName2.append(reInfo.genomeAssembly.substr(0, reInfo.genomeAssembly.find_first_of(',')));
@@ -105,7 +106,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
105106
FileName2.append(reInfo.currTime);
106107
FileName2.append(".txt");
107108
std::ofstream outf2(FileName2.c_str());
108-
109+
**/
109110

110111
outf1 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t' << "Probe_ID" << '\t' << "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
111112

@@ -239,43 +240,43 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
239240
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
240241

241242
outf1 << featiter->second.chr << '\t' << it->first << '\t' << it->second.refragend << '\t';
242-
243+
/**
243244
//WashU
244245
int wStart, wEnd;
245246
if(featiter->second.start > featiter->second.end){
246-
wStart=featiter->second.end;
247-
wEnd= featiter->second.start;
247+
wStart=featiter->second.end - 100;
248+
wEnd= featiter->second.end + 100;
248249
}
249250
else if(featiter->second.start == featiter->second.end){
250-
wStart=featiter->second.start;
251-
wEnd= featiter->second.end + 1;
251+
wStart=featiter->second.start-100;
252+
wEnd= featiter->second.end + 100;
252253
}
253254
else if(featiter->second.start < featiter->second.end){
254-
wStart=featiter->second.start;
255-
wEnd= featiter->second.end;
255+
wStart=featiter->second.start - 100;
256+
wEnd= featiter->second.start + 100;
256257
}
257258
258259
outf2 << featiter->second.chr << ':' << wStart << '-' << wEnd<< '\t'<< featiter->second.chr<<':' << it->first << '-' << it->second.refragend << '\t';
259260
260-
261+
**/
261262
outf1 << it->second.distance;
262263

263264
//WashU
264-
double avgscore=0;
265+
// double avgscore=0;
265266

266267
for (int e = 0; e < NumberofExperiments; ++e){
267268

268269
outf1 << '\t' << it->second.paircount[e] << '\t' << it->second.p_val[e] ;
269270

270271
//calculate washU score
271-
avgscore = avgscore + (it->second.paircount[e]/double(NumberofExperiments));
272+
//avgscore = avgscore + (it->second.paircount[e]/double(NumberofExperiments));
272273

273274

274275
}
275276
outf1 << std::endl;
276277

277278
//washU
278-
outf2 << avgscore <<std::endl;
279+
// outf2 << avgscore <<std::endl;
279280
}
280281
}
281282
}
@@ -293,19 +294,20 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
293294

294295
outf1 << itx->maptochrname << '\t' << itt->first << '\t' << itt->second.refragend << '\t' << -1 ;
295296

297+
/**
296298
//WashU
297299
int wStart, wEnd;
298300
if(featiter->second.start > featiter->second.end){
299-
wStart=featiter->second.end;
300-
wEnd= featiter->second.start;
301+
wStart=featiter->second.end - 100;
302+
wEnd= featiter->second.end + 100;
301303
}
302304
else if(featiter->second.start == featiter->second.end){
303-
wStart=featiter->second.start;
304-
wEnd= featiter->second.end + 1;
305+
wStart=featiter->second.start - 100;
306+
wEnd= featiter->second.end + 100;
305307
}
306308
else if(featiter->second.start < featiter->second.end){
307-
wStart=featiter->second.start;
308-
wEnd= featiter->second.end;
309+
wStart=featiter->second.start -100;
310+
wEnd= featiter->second.start + 100;
309311
}
310312
311313
int dStart, dEnd;
@@ -321,19 +323,19 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
321323
outf2 << featiter->second.chr << ':' << wStart << '-' << wEnd<< '\t'<< itx->maptochrname<<':' << dStart << '-' << dEnd ;
322324
323325
//WashU
324-
double avgscore=0;
326+
double avgscore=0; **/
325327

326328
for (int e = 0; e < NumberofExperiments; ++e){
327329
outf1 << '\t'<< itt->second.paircount[e] << '\t' << -1 ;
328330

329331
//calculate washU score
330-
avgscore = avgscore + (itt->second.paircount[e]/double(NumberofExperiments));
332+
//avgscore = avgscore + (itt->second.paircount[e]/double(NumberofExperiments));
331333

332334
}
333335
outf1 << std::endl;
334336

335337
//washU
336-
outf2 << avgscore <<std::endl;
338+
//outf2 << avgscore <<std::endl;
337339
}
338340
}
339341
}
@@ -354,7 +356,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
354356
std::string FileName3, FileNameWashU;
355357

356358
//WashU
357-
std::vector<std::string> seenPP;
359+
//std::vector<std::string> seenPP;
358360

359361
FileName3.append(BaseFileName);
360362
FileName3.append(".");
@@ -366,7 +368,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
366368
FileName3.append(".txt");
367369

368370
std::ofstream outf3(FileName3.c_str());
369-
371+
/**
370372
//WashU
371373
FileNameWashU.append(BaseFileName);
372374
FileNameWashU.append(".");
@@ -378,7 +380,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
378380
FileNameWashU.append(".txt");
379381
380382
std::ofstream outfwu(FileNameWashU.c_str());
381-
383+
**/
382384

383385
outf3 << "RefSeqName_1" << '\t' << "TranscriptName_1" << '\t' << "Feature_ID_1" << '\t' << "Probe_ID_1" << '\t' << "FeatureChr_1" << '\t' << "FeatureStart_1" << '\t' << "FeatureEnd_1"
384386
<< '\t' << "Annotation_1" << '\t' << "Strand_1" << '\t';
@@ -415,43 +417,44 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
415417
outf3 << featiter2->second.Name << '\t' << featiter2->second.TranscriptName << '\t' << featiter2->first << '\t' << featiter2->second.probe_name << '\t'
416418
<< featiter2->second.chr << '\t' << featiter2->second.start << '\t' << featiter2->second.end << '\t'
417419
<< featiter2->second.FeatureType << '\t' << featiter2->second.strand << '\t';
420+
/***
418421
//WashU
419422
bool seen=false;
420423
std::string constructPP = featiter2->first+":"+featiter->first;
421424
if(std::find(seenPP.begin(), seenPP.end(), constructPP)==seenPP.end()){ //If the interaction does not already have the duplicate written
422425
seenPP.push_back(constructPP);
423426
int start1, end1, start2, end2;
424427
if(featiter->second.start>featiter->second.end){
425-
start1=featiter->second.end;
426-
end1=featiter->second.start;
428+
start1=featiter->second.end - 100;
429+
end1=featiter->second.end + 100;
427430
}
428431
else if(featiter->second.start==featiter->second.end){
429-
start1=featiter->second.start;
430-
end1=featiter->second.end + 1;
432+
start1=featiter->second.start -100;
433+
end1=featiter->second.end + 100;
431434
}
432435
else if(featiter->second.start<featiter->second.end){
433-
start1=featiter->second.start;
434-
end1=featiter->second.end;
436+
start1=featiter->second.start -100;
437+
end1=featiter->second.start + 100;
435438
}
436439
437440
if(featiter2->second.start > featiter2->second.end){
438-
start2=featiter2->second.end;
439-
end2=featiter2->second.start;
441+
start2=featiter2->second.end -100;
442+
end2=featiter2->second.end + 100;
440443
}
441444
else if(featiter2->second.start==featiter2->second.end){
442-
start2=featiter2->second.start;
443-
end2=featiter2->second.end + 1;
445+
start2=featiter2->second.start - 100;
446+
end2=featiter2->second.end + 100;
444447
}
445448
else if(featiter2->second.start < featiter2->second.end){
446-
start2=featiter2->second.start;
447-
end2=featiter2->second.end;
449+
start2=featiter2->second.start -100;
450+
end2=featiter2->second.start + 100;
448451
}
449452
450453
outfwu<< featiter->second.chr << ':' << start1 << '-' << end1<< '\t'<< featiter2->second.chr<<':' << start2 << '-' << end2 << '\t';
451454
}
452455
else
453456
seen = true;
454-
457+
***/
455458
bin=0;
456459
flag=0;
457460
if(featiter->second.chr == featiter2->second.chr){
@@ -463,14 +466,14 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
463466
outf3 << -1 ;
464467

465468
//WashU
466-
double avgscore=0;
469+
//double avgscore=0;
467470

468471
for (int e = 0; e < NumberofExperiments; ++e){
469472
outf3 << '\t' << itff->signal[e] << '\t';
470473

471474
//WashU
472-
if(!seen)
473-
avgscore = avgscore + (itff->signal[e]/double(NumberofExperiments));
475+
// if(!seen)
476+
// avgscore = avgscore + (itff->signal[e]/double(NumberofExperiments));
474477

475478
///////Pval calc begins
476479

@@ -511,8 +514,8 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
511514
outf3 << std::endl;
512515

513516
//WashU
514-
if(!seen)
515-
outfwu<< avgscore<<std::endl;
517+
// if(!seen)
518+
// outfwu<< avgscore<<std::endl;
516519
}
517520

518521
}
@@ -539,18 +542,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
539542
FileName2.append(".txt");
540543
std::ofstream outf2(FileName2.c_str());
541544

542-
/***
543-
//WashU
544-
washUFileName.append(BaseFileName);
545-
washUFileName.append(".");
546-
washUFileName.append(reInfo.genomeAssembly.substr(0, reInfo.genomeAssembly.find_first_of(',')));
547-
washUFileName.append(".");
548-
washUFileName.append(whichchr);
549-
washUFileName.append(".Proximities.Probe_Distal.NegCtrls.WashU.");
550-
washUFileName.append(reInfo.currTime);
551-
washUFileName.append(".txt");
552-
std::ofstream outf3(washUFileName.c_str());
553-
***/
545+
554546
outf2 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t' << "Probe_ID" << '\t' << "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
555547

556548
outf2 << "Interactor_Chr" << '\t' << "Interactor_Start" << '\t' << "Interactor_End" << '\t' << "distance" ;
@@ -668,23 +660,15 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
668660
outf2 << featiter->second.chr << '\t' << it->first << '\t' << it->second.refragend << '\t';
669661

670662
outf2 << it->second.distance ;
671-
/***
672-
//WashU
673-
outf3 << featiter->second.chr << ':' << featiter->second.start << '-' << featiter->second.end<< '\t'<< featiter->second.chr <<':' << it->first << '-' << it->second.refragend << '\t';
674-
675-
//WashU
676-
double avgscore=0;
677-
***/
663+
678664
for (int e = 0; e < NumberofExperiments; ++e){
679665

680666
outf2 << '\t'<< it->second.paircount[e] << '\t' << it->second.p_val[e] ;
681-
//WashU
682-
//avgscore = avgscore + (it->second.paircount[e]/double(NumberofExperiments));
667+
683668

684669
}
685670
outf2 << std::endl;
686-
//WashU
687-
//outf3 << avgscore<<std::endl;
671+
688672
}
689673
}
690674
}
@@ -700,22 +684,14 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
700684

701685
outf2 << itx->maptochrname << '\t' << itt->first << '\t' << itt->second.refragend << '\t' << -1 ;
702686

703-
//WashU
704-
//outf3 << featiter->second.chr << ':' << featiter->second.start << '-' << featiter->second.end<< '\t'<< itx->maptochrname<<':' << itt->first << '-' << itt->second.refragend << '\t';
705687

706-
//WashU
707-
// double avgscore=0;
708688

709689
for (int e = 0; e < NumberofExperiments; ++e){
710690
outf2 << '\t' << itt->second.paircount[e] << '\t' << -1 ;
711691

712-
//WashU
713-
// avgscore = avgscore + (itt->second.paircount[e]/double(NumberofExperiments));
714692

715693
}
716694
outf2 << std::endl;
717-
//WashU
718-
//outf3 << avgscore<<std::endl;
719695
}
720696
}
721697
}

0 commit comments

Comments
 (0)