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

Realignment filter annotates vcf with passing and failing read counts #5328

Merged
merged 1 commit into from
Oct 18, 2018
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 @@ -137,6 +137,7 @@ public void onTraversalStart() {
final Set<VCFHeaderLine> headerLines = new HashSet<>(inputHeader.getMetaDataInSortedOrder());
headerLines.add(GATKVCFHeaderLines.getFilterLine(GATKVCFConstants.ALIGNMENT_ARTIFACT_FILTER_NAME));
headerLines.addAll(getDefaultToolVCFHeaderLines());
headerLines.add(GATKVCFHeaderLines.getInfoLine(GATKVCFConstants.REALIGNMENT_COUNTS_VCF_ATTRIBUTE));
final VCFHeader vcfHeader = new VCFHeader(headerLines, inputHeader.getGenotypeSamples());
vcfWriter.writeHeader(vcfHeader);
}
Expand Down Expand Up @@ -200,8 +201,10 @@ public void apply(final VariantContext vc, final ReadsContext readsContext, fina
// if we haven't decided yet due to too few supporting reads, fail if there are more failures than successes
passesFilter = passesFilter != Trilean.UNKNOWN ? passesFilter :
Trilean.of(failedRealignmentCount.intValue() <= succeededRealignmentCount.intValue());
final VariantContextBuilder vcb = new VariantContextBuilder(vc)
.attribute(GATKVCFConstants.REALIGNMENT_COUNTS_VCF_ATTRIBUTE, new int[] {succeededRealignmentCount.intValue(), failedRealignmentCount.intValue()});

vcfWriter.add(passesFilter == Trilean.TRUE ? vc : new VariantContextBuilder(vc).filter(GATKVCFConstants.ALIGNMENT_ARTIFACT_FILTER_NAME).make());
vcfWriter.add( (passesFilter == Trilean.TRUE ? vcb : vcb.filter(GATKVCFConstants.ALIGNMENT_ARTIFACT_FILTER_NAME)).make());
}

private static int pairScore(final Pair<BwaMemAlignment, BwaMemAlignment> pair) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public final class GATKVCFConstants {
public static final String NORMAL_ARTIFACT_LOD_ATTRIBUTE = "N_ART_LOD";
public static final String POPULATION_AF_VCF_ATTRIBUTE = "POP_AF";
public static final String GERMLINE_POSTERIORS_VCF_ATTRIBUTE = "P_GERMLINE";
public static final String REALIGNMENT_COUNTS_VCF_ATTRIBUTE = "RCNTS";
public static final String POSTERIOR_PROB_OF_CONTAMINATION_ATTRIBUTE = "P_CONTAM";
public static final List<String> STANDARD_MUTECT_INFO_FIELDS = Arrays.asList(NORMAL_LOD_KEY, TUMOR_LOD_KEY, NORMAL_ARTIFACT_LOD_ATTRIBUTE,
EVENT_COUNT_IN_HAPLOTYPE_KEY, IN_PON_VCF_ATTRIBUTE, POPULATION_AF_VCF_ATTRIBUTE, GERMLINE_POSTERIORS_VCF_ATTRIBUTE, POSTERIOR_PROB_OF_CONTAMINATION_ATTRIBUTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ private static void addFilterLine(final VCFFilterHeaderLine line) {
// M2-related info lines
addInfoLine(new VCFInfoHeaderLine(EVENT_COUNT_IN_HAPLOTYPE_KEY, 1, VCFHeaderLineType.Integer, "Number of events in this haplotype"));
addInfoLine(new VCFInfoHeaderLine(NORMAL_LOD_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Normal LOD score"));
addInfoLine(new VCFInfoHeaderLine(REALIGNMENT_COUNTS_VCF_ATTRIBUTE, 2, VCFHeaderLineType.Integer, "Number of reads passing and failing realignment."));
addInfoLine(new VCFInfoHeaderLine(TUMOR_LOD_KEY, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "Log odds ratio score for variant"));
addInfoLine(new VCFInfoHeaderLine(IN_PON_VCF_ATTRIBUTE, 0, VCFHeaderLineType.Flag, "site found in panel of normals"));
addInfoLine(new VCFInfoHeaderLine(POPULATION_AF_VCF_ATTRIBUTE, VCFHeaderLineCount.A, VCFHeaderLineType.Float, "population allele frequencies of alt alleles"));
Expand Down