VcfFilter(String name, String description) { this.filterheader = new VCFFilterHeaderLine(name, description); } /**
/** * Name of the VCF filter * @return */ public String filter() { return filterheader.getID(); } /**
/** * get the "Description" field * @return the "Description" field */ public String getDescription() { return getGenericFieldValue("Description"); } }
@Test public void testVCFHeaderAddFilterLine() { final VCFHeader header = getHiSeqVCFHeader(); final String filterDesc = "TestFilterLine Description"; final VCFFilterHeaderLine filterLine = new VCFFilterHeaderLine("TestFilterLine",filterDesc); Assert.assertEquals(filterDesc,filterLine.getDescription()); header.addMetaDataLine(filterLine); Assert.assertTrue(header.getFilterLines().contains(filterLine), "TestFilterLine not found in filter header lines"); Assert.assertTrue(header.getMetaDataInInputOrder().contains(filterLine), "TestFilterLine not found in set of all header lines"); Assert.assertNotNull(header.getFilterHeaderLine("TestFilterLine"), "Lookup for TestFilterLine by key failed"); Assert.assertFalse(header.getInfoHeaderLines().contains(filterLine), "TestFilterLine present in info header lines"); Assert.assertFalse(header.getFormatHeaderLines().contains(filterLine), "TestFilterLine present in format header lines"); Assert.assertFalse(header.getContigLines().contains(filterLine), "TestFilterLine present in contig header lines"); Assert.assertFalse(header.getOtherHeaderLines().contains(filterLine), "TestFilterLine present in other header lines"); }
Assert.assertEquals(originalCopyAnnotationLine1.getGenericFieldValue("Description"), "ANNOTATION != \"NA\" || ANNOTATION <= 0.01", originalCopyAnnotationLine1.toString()); Assert.assertEquals(originalCopyAnnotationLine2.getGenericFieldValue("Description"), "ANNOTATION with quote \" that is unmatched but escaped"); Assert.assertEquals(firstCopyAnnotationLine1.getGenericFieldValue("Description"), "ANNOTATION != \"NA\" || ANNOTATION <= 0.01"); Assert.assertEquals(secondCopyAnnotationLine1.getGenericFieldValue("Description"), "ANNOTATION != \"NA\" || ANNOTATION <= 0.01"); Assert.assertEquals(firstCopyAnnotationLine2, secondCopyAnnotationLine2); Assert.assertEquals(secondCopyAnnotationLine2.getGenericFieldValue("Description"), "ANNOTATION with quote \" that is unmatched but escaped");
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList( new VCFFilterHeaderLine(this.filterName, "Variant Filtered by Javascript file " + this.scriptFile)); } }
private static void addFilterLine(final VCFFilterHeaderLine line) { filterLines.put(line.getID(), line); }
/** * get the "Description" field * @return the "Description" field */ public String getDescription() { return getGenericFieldValue("Description"); } }
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList(new VCFFilterHeaderLine(AB_FILTER, "Heterozygote allele balance below required threshold.")); }
/** * Check the filter declarations in the input VCF header to see if any ApplyRecalibration mode has been run * Here we assume that the tranches are named with a specific format: VQSRTranche[SNP|INDEL][lowerLimit]to[upperLimit] * @param inputHeaders */ private void checkForPreviousApplyRecalRun(final Set<VCFHeaderLine> inputHeaders) { for(final VCFHeaderLine header : inputHeaders) { if(header instanceof VCFFilterHeaderLine) { final String filterName = ((VCFFilterHeaderLine)header).getID(); if(filterName.length() < 12 || !filterName.substring(0, 11).equalsIgnoreCase(trancheFilterString)) { continue; } if(filterName.charAt(11) == 'S') { //for SNP tranches, get sensitivity limit final String sensitivityLimits = filterName.substring(14); if(trancheIntervalIsValid(sensitivityLimits)) foundSNPTranches = true; } else if(filterName.charAt(11) == 'I') { //for INDEL tranches, get sensitivity limit final String sensitivityLimits = filterName.substring(16); if(trancheIntervalIsValid(sensitivityLimits)) foundINDELTranches = true; } } } }
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList(new VCFFilterHeaderLine(FILTER_NAME, "Site exhibits QD value below a hard limit.")); } }
/** * load the format/info meta data maps (these are used for quick lookup by key name) */ private void loadMetaDataMaps() { for (final VCFHeaderLine line : mMetaData) { if ( line instanceof VCFInfoHeaderLine ) { final VCFInfoHeaderLine infoLine = (VCFInfoHeaderLine)line; addMetaDataMapBinding(mInfoMetaData, infoLine); } else if ( line instanceof VCFFormatHeaderLine ) { final VCFFormatHeaderLine formatLine = (VCFFormatHeaderLine)line; addMetaDataMapBinding(mFormatMetaData, formatLine); } else if ( line instanceof VCFFilterHeaderLine ) { final VCFFilterHeaderLine filterLine = (VCFFilterHeaderLine)line; mFilterMetaData.put(filterLine.getID(), filterLine); } else if ( line instanceof VCFContigHeaderLine ) { contigMetaData.add((VCFContigHeaderLine)line); } else { mOtherMetaData.put(line.getKey(), line); } } if ( hasFormatLine(VCFConstants.GENOTYPE_LIKELIHOODS_KEY) && ! hasFormatLine(VCFConstants.GENOTYPE_PL_KEY) ) { if ( GeneralUtils.DEBUG_MODE_ENABLED ) { System.err.println("Found " + VCFConstants.GENOTYPE_LIKELIHOODS_KEY + " format, but no " + VCFConstants.GENOTYPE_PL_KEY + " field. We now only manage PL fields internally" + " automatically adding a corresponding PL field to your VCF header"); } addMetaDataLine(new VCFFormatHeaderLine(VCFConstants.GENOTYPE_PL_KEY, VCFHeaderLineCount.G, VCFHeaderLineType.Integer, "Normalized, Phred-scaled likelihoods for genotypes as defined in the VCF specification")); } }
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList( new VCFFilterHeaderLine(this.filterName, "Variant Filtered by Javascript file " + this.scriptFile)); } }
throw new IllegalStateException("Incompatible header types: " + line + " " + other ); } else if ( line instanceof VCFFilterHeaderLine ) { String lineName = ((VCFFilterHeaderLine) line).getID(); String otherName = ((VCFFilterHeaderLine) other).getID(); if ( ! lineName.equals(otherName) ) throw new IllegalStateException("Incompatible header types: " + line + " " + other );
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList(new VCFFilterHeaderLine("StrandBias", "Site exhibits excessive allele/strand correlation.")); }
throw new IllegalStateException("Incompatible header types: " + line + " " + other); } else if (line instanceof VCFFilterHeaderLine) { final String lineName = ((VCFFilterHeaderLine) line).getID(); final String otherName = ((VCFFilterHeaderLine) other).getID(); if (!lineName.equals(otherName)) throw new IllegalStateException("Incompatible header types: " + line + " " + other);
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList(new VCFFilterHeaderLine(FILTER_NAME, "Site exhibits QD value below a hard limit.")); } }
throw new IllegalStateException("Incompatible header types: " + line + " " + other); } else if (line instanceof VCFFilterHeaderLine) { final String lineName = ((VCFFilterHeaderLine) line).getID(); final String otherName = ((VCFFilterHeaderLine) other).getID(); if (!lineName.equals(otherName)) throw new IllegalStateException("Incompatible header types: " + line + " " + other);
@Override public List<VCFFilterHeaderLine> headerLines() { return CollectionUtil.makeList(new VCFFilterHeaderLine("StrandBias", "Site exhibits excessive allele/strand correlation.")); }