Skip to content

Commit 9ba8577

Browse files
author
a_anil
committed
Added Strand Combination in ProximityDetector output and minor bug fixes
1 parent 35358b5 commit 9ba8577

File tree

7 files changed

+108
-50
lines changed

7 files changed

+108
-50
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,13 @@ This file is required as input for the `ProximityDetector`. This should be in th
384384
* Probe_Distal Proximities files : The files contain information about the proximities with distal interacting regions gainst the Probe sets called from the input experiment files. They are named in the format 'BaseFileName.AssemblyVer.chrN.Proximities.Probe_Distal.date.txt'. The file with proximities from the negative control probe set will be indicated with a 'NegCtrl' in the file name. The following information is reported for each proximity
385385
1. Probe : Target feature, location in chromosome, type of probe
386386
2. Distal region : location in chromosome
387-
3. Proximity : Distance between interacting fragments, and Supporting pairs and p-value from each input experiment file.
387+
3. Proximity : Distance between interacting fragments, and Supporting pairs, p-value and strand combination\* from each input experiment file.
388388
* Probe_Probe Proximities files : The files contain information about the proximities with Probe regions against the Probe sets called from the input experiment files. These files are named in the format 'BaseFileName.AssemblyVer.chrN.Proximities.Probe_Probe.date.txt'. The file with proximities from the negative control probe set will be indicated with a 'NegCtrl' in the file name. The following information is reported for each proximity
389389
1. Probe region 1: Target feature, location in chromosome, type of probe
390390
2. Probe region 2: Target feature, location in chromosome, type of probe
391-
3. Proximity : Distance between interacting fragments, and Supporting pairs and p-value from each input experiment file.
392-
391+
3. Proximity : Distance between interacting fragments, and Supporting pairs, p-value and strand combination\* from each input experiment file.
392+
393+
\* The strand combination (or orientation) gives the read orientations of the read pairs, that is, if the reads are on the forward or reverse strands. This means that there will be four possible combinations - forward-forward, forward-reverse, reverse-forward and reverse-reverse depending on the orientation of the first and second read pairs respectively. The ProximityDetector output files report the strand combination in the format a_b_c_d, where a gives the number of forward-forward read pair combinations, b gives the number of forward-reverse, c the reverse-forward and d the reverse-reverse. The sum of a, b, c and d is equal to the total number of supporting pairs, which is also reported separately. The strand combination information may reveal information on how constrained the chromosome conformation is at that location.
393394

394395
##### III. Common
395396

include/Proximities.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ class ProximityClass{
5353

5454
public:
5555

56-
void RecordProximities(Alignment, std::string, std::string, int);
57-
void AnnotateDistalInteractor(std::string, std::string, std::string, int*, int);
58-
void AnnotateFeatFeatInteraction(std::string, std::string, int);
59-
void PopulateInteractions(std::map<int, Junction >&, int*, int);
56+
void RecordProximities(Alignment, std::string, std::string, int, int);
57+
void AnnotateDistalInteractor(std::string, std::string, std::string, int*, int, int);
58+
void AnnotateFeatFeatInteraction(std::string, std::string, int, int);
59+
void PopulateInteractions(std::map<int, Junction >&, int*, int, int);
6060
void CountProximities(ProbeSet, int);
6161
ProximityClass(int nOfExp) : NOFEXPERIMENTS (nOfExp) {}
6262

src/DesignProbes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ bool DesignClass::WritetoFile(std::ofstream &outfile, std::string chr, int chrin
450450
outfile <<"; ";
451451
}
452452
else{
453-
outfile << "none"<<"; " <<'\t';
453+
outfile << "none"<<"; ";
454454
}
455455

456456
outfile<< "targettss="<<feats.promFeatures[values[0]].TSS<<"; "<<"distancetotss="<<disttotss<< std::endl;

src/Find_Interactions.cpp

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,13 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
108108
std::ofstream outf2(FileName2.c_str());
109109
**/
110110

111-
outf1 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t' << "Probe_ID" << '\t' << "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
111+
outf1 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t'
112+
<< "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
112113

113114
outf1 << "Interactor_Chr" << '\t' << "Interactor_Start" << '\t' << "Interactor_End" << '\t' << "distance" ;
114115

115116
for (int e = 0; e < NumberofExperiments; ++e)
116-
outf1 << '\t'<< ExperimentNames[e] << "_SuppPairs" << '\t' << ExperimentNames[e] << "_p_value" ;
117+
outf1 << '\t'<< ExperimentNames[e] << "_SuppPairs" << '\t' << ExperimentNames[e] << "_p_value" << '\t' << ExperimentNames[e] << "_StrandCombination" ;
117118
outf1 << std::endl;
118119

119120
std::map<std::string, FeatureStruct>::iterator featiter;
@@ -235,7 +236,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
235236

236237
if(it->second.reportit){
237238

238-
outf1 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
239+
outf1 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
239240
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
240241
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
241242

@@ -266,7 +267,10 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
266267

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

269-
outf1 << '\t' << it->second.paircount[e] << '\t' << it->second.p_val[e] ;
270+
outf1 << '\t' << it->second.paircount[e] << '\t' << it->second.p_val[e] << '\t';
271+
for(int s = 0; s < 3; ++s)
272+
outf1 << it->second.strandcombination[(e*4)+s] << "_";
273+
outf1 << it->second.strandcombination[(e*4)+3];
270274

271275
//calculate washU score
272276
//avgscore = avgscore + (it->second.paircount[e]/double(NumberofExperiments));
@@ -288,7 +292,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
288292
enoughpairs = CheckSupportingPairs(itt->second.paircount, NumberofExperiments);
289293
if(enoughpairs){
290294

291-
outf1 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
295+
outf1 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
292296
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
293297
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
294298

@@ -326,7 +330,10 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal(ProbeSet&
326330
double avgscore=0; **/
327331

328332
for (int e = 0; e < NumberofExperiments; ++e){
329-
outf1 << '\t'<< itt->second.paircount[e] << '\t' << -1 ;
333+
outf1 << '\t'<< itt->second.paircount[e] << '\t' << -1 << '\t';
334+
for(int s = 0; s < 3; ++s)
335+
outf1 << itt->second.strandcombination[(e*4) + s] << "_";
336+
outf1 << itt->second.strandcombination[(e*4) + 3];
330337

331338
//calculate washU score
332339
//avgscore = avgscore + (itt->second.paircount[e]/double(NumberofExperiments));
@@ -382,16 +389,18 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
382389
std::ofstream outfwu(FileNameWashU.c_str());
383390
**/
384391

385-
outf3 << "RefSeqName_1" << '\t' << "TranscriptName_1" << '\t' << "Feature_ID_1" << '\t' << "Probe_ID_1" << '\t' << "FeatureChr_1" << '\t' << "FeatureStart_1" << '\t' << "FeatureEnd_1"
392+
outf3 << "RefSeqName_1" << '\t' << "TranscriptName_1" << '\t' << "Feature_ID_1" << '\t'
393+
<< "FeatureChr_1" << '\t' << "FeatureStart_1" << '\t' << "FeatureEnd_1"
386394
<< '\t' << "Annotation_1" << '\t' << "Strand_1" << '\t';
387395

388-
outf3 << "RefSeqName_2" << '\t' << "TranscriptName_2" << '\t' << "Feature_ID_2" << '\t' << "Probe_ID_2" << '\t' << "FeatureChr_2" << '\t' << "FeatureStart_2" << '\t' << "FeatureEnd_2"
396+
outf3 << "RefSeqName_2" << '\t' << "TranscriptName_2" << '\t' << "Feature_ID_2" << '\t'
397+
<< "FeatureChr_2" << '\t' << "FeatureStart_2" << '\t' << "FeatureEnd_2"
389398
<< '\t' << "Annotation_2" << '\t' << "Strand_2" << '\t';
390399

391400
outf3 << "abs(Distance)";
392401

393402
for (int e = 0; e < NumberofExperiments; ++e)
394-
outf3 << '\t' << ExperimentNames[e] << "_SuppPairs"<< '\t' << ExperimentNames[e] << "_p_value";
403+
outf3 << '\t' << ExperimentNames[e] << "_SuppPairs"<< '\t' << ExperimentNames[e] << "_p_value" << '\t' << ExperimentNames[e] << "_StrandCombination";
395404
outf3 << std::endl;
396405
std::vector< FeattoFeatSignalStruct >::const_iterator itff; //first: REpos, second: signal
397406
std::string f;
@@ -410,11 +419,11 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
410419

411420

412421

413-
outf3 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
422+
outf3 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
414423
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
415424
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
416425

417-
outf3 << featiter2->second.Name << '\t' << featiter2->second.TranscriptName << '\t' << featiter2->first << '\t' << featiter2->second.probe_name << '\t'
426+
outf3 << featiter2->second.Name << '\t' << featiter2->second.TranscriptName << '\t' << featiter2->first << '\t'
418427
<< featiter2->second.chr << '\t' << featiter2->second.start << '\t' << featiter2->second.end << '\t'
419428
<< featiter2->second.FeatureType << '\t' << featiter2->second.strand << '\t';
420429
/***
@@ -506,10 +515,12 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe(ProbeSet& p
506515
else
507516
outf3 << "1.0";
508517

509-
510518
/////Pval calc ends
511-
512-
519+
outf3<<"\t";
520+
for(int s=0; s<3; ++s){
521+
outf3 << itff->strandcombination[(e*4) + s] << "_";
522+
}
523+
outf3 << itff->strandcombination[(e*4) + 3];
513524
}
514525
outf3 << std::endl;
515526

@@ -543,11 +554,12 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
543554
std::ofstream outf2(FileName2.c_str());
544555

545556

546-
outf2 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t' << "Probe_ID" << '\t' << "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
557+
outf2 << "RefSeqName" << '\t' << "TranscriptName" << '\t' << "Feature_ID" << '\t'
558+
<< "Feature_Chr" << '\t' << "Feature_Start" << '\t' << "Feature_End" << '\t' << "Annotation" << '\t' << "Strand" << '\t';
547559

548560
outf2 << "Interactor_Chr" << '\t' << "Interactor_Start" << '\t' << "Interactor_End" << '\t' << "distance" ;
549561
for (int e = 0; e < NumberofExperiments; ++e)
550-
outf2 << '\t'<< ExperimentNames[e] << "_SuppPairs" << '\t' << ExperimentNames[e] << "_p_value";
562+
outf2 << '\t'<< ExperimentNames[e] << "_SuppPairs" << '\t' << ExperimentNames[e] << "_p_value" << '\t' << ExperimentNames[e] << "_StrandCombination";
551563
outf2 << std::endl;
552564

553565
std::map<std::string, FeatureStruct>::iterator featiter;
@@ -653,7 +665,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
653665
}
654666

655667
if(it->second.reportit){
656-
outf2 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
668+
outf2 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
657669
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
658670
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
659671

@@ -663,9 +675,10 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
663675

664676
for (int e = 0; e < NumberofExperiments; ++e){
665677

666-
outf2 << '\t'<< it->second.paircount[e] << '\t' << it->second.p_val[e] ;
667-
668-
678+
outf2 << '\t'<< it->second.paircount[e] << '\t' << it->second.p_val[e] << '\t';
679+
for(int s = 0; s < 3; ++s)
680+
outf2 << it->second.strandcombination[(e*4)+s] << "_";
681+
outf2 << it->second.strandcombination[(e*4)+3];
669682
}
670683
outf2 << std::endl;
671684

@@ -678,7 +691,7 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
678691
for(itt = itx->junctions_ctx.begin(); itt != itx->junctions_ctx.end(); ++itt){
679692
enoughpairs = CheckSupportingPairs(itt->second.paircount, NumberofExperiments);
680693
if(enoughpairs){
681-
outf2 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
694+
outf2 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
682695
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
683696
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
684697

@@ -687,9 +700,10 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeDistal_NegCtrls(P
687700

688701

689702
for (int e = 0; e < NumberofExperiments; ++e){
690-
outf2 << '\t' << itt->second.paircount[e] << '\t' << -1 ;
691-
692-
703+
outf2 << '\t' << itt->second.paircount[e] << '\t' << -1 << '\t';
704+
for(int s = 0; s < 3; ++s)
705+
outf2 << itt->second.strandcombination[(e*4) + s] << "_";
706+
outf2 << itt->second.strandcombination[(e*4) + 3];
693707
}
694708
outf2 << std::endl;
695709
}
@@ -721,13 +735,13 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe_NegCtrls(Pr
721735
FileName4.append(".txt");
722736
std::ofstream outf4(FileName4.c_str());
723737

724-
outf4<< "RefSeqName_1" << '\t' << "TranscriptName_1" << '\t' << "Feature_ID_1" << '\t' << "Probe_ID_1" << '\t' << "FeatureChr_1" << '\t' << "FeatureStart_1" << '\t' << "FeatureEnd_1" << '\t' << "Annotation_1" << '\t' << "Strand_1" << '\t';
738+
outf4<< "RefSeqName_1" << '\t' << "TranscriptName_1" << '\t' << "Feature_ID_1" << '\t' << "FeatureChr_1" << '\t' << "FeatureStart_1" << '\t' << "FeatureEnd_1" << '\t' << "Annotation_1" << '\t' << "Strand_1" << '\t';
725739

726-
outf4 << "RefSeqName_2" << '\t' << "TranscriptName_2" << '\t' << "Feature_ID_2" << '\t' << "Probe_ID_2" << '\t' << "FeatureChr_2" << '\t' << "FeatureStart_2" << '\t' << "FeatureEnd_2" << '\t' << "Annotation_2" << '\t' << "Strand_2" << '\t';
740+
outf4 << "RefSeqName_2" << '\t' << "TranscriptName_2" << '\t' << "Feature_ID_2" << '\t' << "FeatureChr_2" << '\t' << "FeatureStart_2" << '\t' << "FeatureEnd_2" << '\t' << "Annotation_2" << '\t' << "Strand_2" << '\t';
727741

728742
outf4 << "abs(Distance)";
729743
for (int e = 0; e < NumberofExperiments; ++e)
730-
outf4 << '\t' << ExperimentNames[e] << "_SuppPairs"<< '\t' << ExperimentNames[e]<<"_pval";
744+
outf4 << '\t' << ExperimentNames[e] << "_SuppPairs"<< '\t' << ExperimentNames[e]<<"_pval" << '\t' << ExperimentNames[e]<<"_StrandCombination";
731745
outf4 << std::endl;
732746

733747
std::vector< FeattoFeatSignalStruct >::const_iterator itff; //first: REpos, second: signal
@@ -740,11 +754,11 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe_NegCtrls(Pr
740754
f = itff->interacting_feature_id;
741755
auto featiter2 = Features.find(f);
742756
if((featiter->second.FeatureType == 3 || featiter2->second.FeatureType == 3) && featiter->second.TranscriptName != featiter2->second.TranscriptName && (abs(featiter->second.start - featiter2->second.start) >= MinimumJunctionDistance)){
743-
outf4 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t' << featiter->second.probe_name << '\t'
757+
outf4 << featiter->second.Name << '\t' << featiter->second.TranscriptName << '\t' << featiter->first << '\t'
744758
<< featiter->second.chr << '\t' << featiter->second.start << '\t' << featiter->second.end << '\t'
745759
<< featiter->second.FeatureType << '\t' << featiter->second.strand << '\t';
746760

747-
outf4 << featiter2->second.Name << '\t' << featiter2->second.TranscriptName << '\t' << featiter2->first << '\t' << featiter2->second.probe_name << '\t'
761+
outf4 << featiter2->second.Name << '\t' << featiter2->second.TranscriptName << '\t' << featiter2->first << '\t'
748762
<< featiter2->second.chr << '\t' << featiter2->second.start << '\t' << featiter2->second.end << '\t'
749763
<< featiter2->second.FeatureType << '\t' << featiter2->second.strand << '\t';
750764

@@ -798,6 +812,10 @@ void DetectInteractions::CalculatePvalAndPrintInteractionsProbeProbe_NegCtrls(Pr
798812

799813

800814
/////Pval calc ends
815+
outf4 << "\t" ;
816+
for(int s = 0; s < 3; ++s)
817+
outf4 << itff->strandcombination[(e*4) + s] << "_";
818+
outf4 << itff->strandcombination[(e*4) + 3];
801819

802820
}
803821
outf4 << std::endl;

0 commit comments

Comments
 (0)