3fd214a1c4377327dc4776875a861f407c9163cc cline Mon Jan 3 21:43:14 2011 -0800 Added one more condition to bedCompatibleExtension. After checking that all the introns in the old bed also exist in the new bed, check to make sure that the new bed does not have any additional introns within the old bed's start-stop range. In other words, check that the new bed doesn't have some intron that overlaps with a terminal exon in the old bed diff --git src/lib/basicBed.c src/lib/basicBed.c index 0ad62b2..f8f24fa 100644 --- src/lib/basicBed.c +++ src/lib/basicBed.c @@ -1106,30 +1106,42 @@ break; } if (newIx == newLastBlock) return FALSE; /* Now we go through all introns in old bed, and make sure they match. */ for (oldIx=0; oldIx < oldLastBlock; ++oldIx, ++newIx) { int iStartOld = oldBed->chromStart + oldBed->chromStarts[oldIx] + oldBed->blockSizes[oldIx]; int iEndOld = oldBed->chromStart + oldBed->chromStarts[oldIx+1]; int iStartNew = newBed->chromStart + newBed->chromStarts[newIx] + newBed->blockSizes[newIx]; int iEndNew = newBed->chromStart + newBed->chromStarts[newIx+1]; if (iStartOld != iStartNew || iEndOld != iEndNew) return FALSE; } + +/* Finally, make sure that the new bed doesn't contain any introns that overlap with the + * last exon of the old bed */ +for(; newIx < newLastBlock; ++newIx) + { + int iStartNew = newBed->chromStart + newBed->chromStarts[newIx] + newBed->blockSizes[newIx]; + if (iStartNew < oldBed->chromEnd) + return FALSE; + else if (iStartNew >= oldBed->chromEnd) + break; + } + return TRUE; } struct bed3 *bed3New(char *chrom, int start, int end) /* Make new bed3. */ { struct bed3 *bed; AllocVar(bed); bed->chrom = cloneString(chrom); bed->chromStart = start; bed->chromEnd = end; return bed; } struct bed *bedThickOnly(struct bed *in)