Skip to content

Commit 52a43d9

Browse files
committed
added RC_Feature::movlcount to keep track of exon overlap lengths
1 parent 38372f2 commit 52a43d9

2 files changed

Lines changed: 21 additions & 10 deletions

File tree

tablemaker.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,18 @@ struct COvlSorter {
4141
}
4242
} OvlSorter;
4343

44-
void rc_updateExonCounts(const RC_Feature* exon, int nh) {
45-
exon->rcount++;
46-
exon->mrcount += (nh > 1) ? (1.0/nh) : 1;
47-
if (nh<=1) exon->ucount++;
44+
void rc_updateExonCounts(const RC_ExonOvl& exonovl, int nh) {
45+
//this only gets read overlaps > 5bp and otherwise filtered in evalReadAln()
46+
exonovl.feature->rcount++;
47+
if (nh>1) {
48+
exonovl.feature->mrcount += (1.0/nh);
49+
exonovl.feature->movlcount += ((double)exonovl.ovlen/nh);
50+
}
51+
else { // nh<=1
52+
exonovl.feature->mrcount++;
53+
exonovl.feature->movlcount += exonovl.ovlen;
54+
exonovl.feature->ucount++;
55+
}
4856
}
4957

5058
bool BundleData::evalReadAln(GReadAlnData& alndata, char& xstrand) {
@@ -81,7 +89,7 @@ bool BundleData::evalReadAln(GReadAlnData& alndata, char& xstrand) {
8189
// spanned by this same read alignment
8290
//counting this overlap for multiple exons if it's similarly large
8391
//(in the shared region of overlapping exons)
84-
rc_updateExonCounts(exonOverlaps[k].feature, nh);
92+
rc_updateExonCounts(exonOverlaps[k], nh);
8593
}
8694
//} //exon overlap >= 5
8795
} //ref exon overlaps

tablemaker.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ struct RC_Feature { //exon or intron of a reference transcript
5858
char strand;
5959
mutable uint rcount; //# read alignments overlapping this feature (>5bp overlaps for exons;
6060
// exact coord. match for introns)
61-
mutable uint ucount; //# uniquely mapped reads overlapping this ref feature
62-
mutable double mrcount; //multi-mapping weighted counts
61+
mutable uint ucount; //# uniquely mapped reads overlapping/matching this ref feature
62+
mutable double mrcount; //multi-map weighted read counts overlapping/matching this feature
63+
64+
mutable double movlcount; //exons only: multi-map weighted sum of overlap lengths
65+
6366
double avg;
6467
double stdev;
6568
double mavg;
@@ -72,16 +75,16 @@ struct RC_Feature { //exon or intron of a reference transcript
7275
};
7376

7477
RC_Feature(int l0=0, int r0=0, char s='.', uint fid=0, uint tid=0): id(fid), t_ids(1), l(l0), r(r0),
75-
strand(s), rcount(0),ucount(0),mrcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
78+
strand(s), rcount(0),ucount(0),mrcount(0), movlcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
7679
if (l>r) { int t=l; l=r; r=t; }
7780
if (tid>0) t_ids.Add(tid);
7881
}
7982
RC_Feature(const RC_Feature& seg): id(seg.id), t_ids(seg.t_ids), l(seg.l), r(seg.r),
80-
strand(seg.strand), rcount(0),ucount(0),mrcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
83+
strand(seg.strand), rcount(0),ucount(0),mrcount(0), movlcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
8184
}
8285

8386
RC_Feature(const RC_Feature& seg, uint tid): id(seg.id), t_ids(1), l(seg.l), r(seg.r),
84-
strand(seg.strand), rcount(0),ucount(0),mrcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
87+
strand(seg.strand), rcount(0),ucount(0),mrcount(0), movlcount(0), avg(0), stdev(0), mavg(0), mstdev(0) {
8588
if (l>r) { int t=l; l=r; r=t; }
8689
if (tid>0) t_ids.Add(tid);
8790
}

0 commit comments

Comments
 (0)