Skip to content

Commit

Permalink
X_FILTERED_COUNT semantics adjusted in FlowFeatureMapper (#8894)
Browse files Browse the repository at this point in the history
  • Loading branch information
dror27 authored Jul 25, 2024
1 parent 747df1a commit 3d99f22
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ public VCFHeader makeVCFHeader(final SAMSequenceDictionary sequenceDictionary, f
headerInfo.add(new VCFInfoHeaderLine(VCF_MAPQ, 1, VCFHeaderLineType.Integer, "Read mapqe"));
headerInfo.add(new VCFInfoHeaderLine(VCF_CIGAR, 1, VCFHeaderLineType.String, "Read CIGAR"));
headerInfo.add(new VCFInfoHeaderLine(VCF_READ_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location"));
headerInfo.add(new VCFInfoHeaderLine(VCF_FILTERED_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location that agree with reference according to fitler"));
headerInfo.add(new VCFInfoHeaderLine(VCF_FILTERED_COUNT, 1, VCFHeaderLineType.Integer, "Number of reads containing this location that pass the adjacent base filter"));
headerInfo.add(new VCFInfoHeaderLine(VCF_FC1, 1, VCFHeaderLineType.Integer, "Number of M bases different on read from references"));
headerInfo.add(new VCFInfoHeaderLine(VCF_FC2, 1, VCFHeaderLineType.Integer, "Number of features before score threshold filter"));
headerInfo.add(new VCFInfoHeaderLine(VCF_LENGTH, 1, VCFHeaderLineType.Integer, "Read length"));
Expand Down Expand Up @@ -475,7 +475,8 @@ private void enrichFeature(final MappedFeature fr) {
for ( ReadContext rc : readQueue ) {
if ( rc.read.contains(loc) ) {
fr.readCount++;
if ( mapper.noFeatureButFilterAt(rc.read, rc.referenceContext, fr.start) == FeatureMapper.FilterStatus.Filtered ) {
FeatureMapper.FilterStatus fs = mapper.noFeatureButFilterAt(rc.read, rc.referenceContext, fr.start);
if ( (fs == FeatureMapper.FilterStatus.Filtered) || (fs == FeatureMapper.FilterStatus.NoFeatureAndFiltered) ) {
fr.filteredCount++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,40 +277,37 @@ public FilterStatus noFeatureButFilterAt(GATKRead read, ReferenceContext referen
readOfs += delta;
refOfs += delta;

if ( bases[readOfs] == ref[refOfs] ) {

// check that this is really a SNV (must be surrounded by identical ref)
boolean surrounded = true;
for ( int i = 0 ; i < surroundBefore && surrounded ; i++ ) {
final int bIndex = readOfs-1-i;
final int rIndex = refOfs-1-i;
if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) {
surrounded = false;
continue;
}
if ( bases[bIndex] != ref[rIndex] ) {
surrounded = false;
}
final boolean noFeature = bases[readOfs] == ref[refOfs];

// check that this is really a SNV (must be surrounded by identical ref)
boolean surrounded = true;
for ( int i = 0 ; i < surroundBefore && surrounded ; i++ ) {
final int bIndex = readOfs-1-i;
final int rIndex = refOfs-1-i;
if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) {
surrounded = false;
continue;
}
for (int i = 0; i < surroundAfter && surrounded ; i++ ) {
final int bIndex = readOfs+1+i;
final int rIndex = refOfs+1+i;
if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) {
surrounded = false;
continue;
}
if ( bases[bIndex] != ref[rIndex] ) {
surrounded = false;
}
if ( bases[bIndex] != ref[rIndex] ) {
surrounded = false;
}
if ( !surrounded ) {
}
for (int i = 0; i < surroundAfter && surrounded ; i++ ) {
final int bIndex = readOfs+1+i;
final int rIndex = refOfs+1+i;
if ( bIndex < 0 || bIndex >= bases.length || rIndex < 0 || rIndex >= ref.length ) {
surrounded = false;
continue;
}
if ( bases[bIndex] != ref[rIndex] ) {
surrounded = false;
}
}
if ( !surrounded ) {
continue;
}

// this is it! no feature but filtered in
return FilterStatus.NoFeatureAndFiltered;
} else
return FilterStatus.Filtered;
return noFeature ? FilterStatus.NoFeatureAndFiltered : FilterStatus.Filtered;

} else {

Expand Down
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown
Git LFS file not shown

0 comments on commit 3d99f22

Please sign in to comment.