Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small addition to FeatureMap tool #8347

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@

public interface FeatureMapper {

enum FilterStatus {
None,
Filtered,
NoFeatureAndFiltered
};

void forEachOnRead(GATKRead read, ReferenceContext referenceContext, Consumer<? super FlowFeatureMapper.MappedFeature> action);
boolean noFeatureButFilterAt(GATKRead read, ReferenceContext referenceContext, int start);
FilterStatus noFeatureButFilterAt(GATKRead read, ReferenceContext referenceContext, int start);
}
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected static class MappedFeature implements Comparable<MappedFeature> {
byte[] readBases;
byte[] refBases;
int readBasesOffset; // offset of read bases array
int start; // location (on rerence)
int start; // location (on reference)
int offsetDelta;
double score;
int readCount;
Expand Down Expand Up @@ -405,7 +405,7 @@ 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) ) {
if ( mapper.noFeatureButFilterAt(rc.read, rc.referenceContext, fr.start) == FeatureMapper.FilterStatus.Filtered ) {
fr.filteredCount++;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private int calcSmq(final byte[] quals, int from, int to, boolean median) {
}
}

public boolean noFeatureButFilterAt(GATKRead read, ReferenceContext referenceContext, int start) {
public FilterStatus noFeatureButFilterAt(GATKRead read, ReferenceContext referenceContext, int start) {

// access bases
final byte[] bases = read.getBasesNoCopy();
Expand All @@ -245,7 +245,7 @@ public boolean noFeatureButFilterAt(GATKRead read, ReferenceContext referenceCon
// break out if not enough clearing
if ( (start < referenceContext.getStart() + refOfs + identBefore) ||
(start >= referenceContext.getStart() + refOfs + length - identAfter) )
return false;
return FilterStatus.Filtered;

int delta = start - (referenceContext.getStart() + refOfs);
readOfs += delta;
Expand All @@ -269,10 +269,10 @@ public boolean noFeatureButFilterAt(GATKRead read, ReferenceContext referenceCon
continue;
}

// this is it! no feature but filtred in
return true;
// this is it! no feature but filtered in
return FilterStatus.NoFeatureAndFiltered;
} else
return false;
return FilterStatus.Filtered;

} else {

Expand All @@ -287,7 +287,7 @@ public boolean noFeatureButFilterAt(GATKRead read, ReferenceContext referenceCon
};

// if here, false
return false;
return FilterStatus.None;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,11 @@

private void applyClipping(int clipLeft, final int leftHmerClip, int clipRight, final int rightHmerClip, final boolean spread){
if ((clipLeft < 0) || (clipRight < 0) || (clipLeft >= getKeyLength() ) || ( clipRight >= getKeyLength())) {
throw new IllegalStateException("Weird read clip calculated");
throw new IllegalStateException(String.format("Weird read clip calculated: left/right/keyLength %d/%d/%d", clipLeft, clipRight, getKeyLength()));

Check warning on line 594 in src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java#L594

Added line #L594 was not covered by tests
}

if ((leftHmerClip < 0) || (rightHmerClip < 0) || (leftHmerClip >= 14 ) || ( rightHmerClip >= 14)) {
throw new IllegalStateException("Weird read clip calculated");
if ((leftHmerClip < 0) || (rightHmerClip < 0) || (leftHmerClip >= (getMaxHmer() + 2) ) || ( rightHmerClip >= (getMaxHmer() + 2))) {
throw new IllegalStateException(String.format("Weird read clip calculated: left/right/maxHmer+2 %d/%d/%d", leftHmerClip, rightHmerClip, getMaxHmer() + 2));

Check warning on line 598 in src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/broadinstitute/hellbender/utils/read/FlowBasedRead.java#L598

Added line #L598 was not covered by tests
}

final int originalLength = key.length;
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
Loading