/** * Get the VCF header lines to include when emitting reference confidence values via calculateRefConfidence * @return a non-null set of VCFHeaderLines */ public Set<VCFHeaderLine> getVCFHeaderLines() { final Set<VCFHeaderLine> headerLines = new LinkedHashSet<>(); headerLines.add(new VCFSimpleHeaderLine(GATKVCFConstants.SYMBOLIC_ALLELE_DEFINITION_HEADER_TAG, GATKVCFConstants.NON_REF_SYMBOLIC_ALLELE_NAME, "Represents any possible alternative allele at this location")); return headerLines; }
private Set<VCFHeaderLine> getSampleHeaderLines(){ final Set<VCFHeaderLine> sampleLines = new HashSet<>(); if (printTCGAsampleHeader) { //NOTE: This will only list the first bam file for each tumor/normal sample if there is more than one final Map<String, String> normalSampleHeaderAttributes = new HashMap<>(); normalSampleHeaderAttributes.put("ID", "NORMAL"); normalSampleHeaderAttributes.put("SampleName", normalSampleName); if (normalSAMReaderIDs.iterator().hasNext() && !getToolkit().getArguments().disableCommandLineInVCF) normalSampleHeaderAttributes.put("File", normalSAMReaderIDs.iterator().next().getSamFilePath()); final VCFSimpleHeaderLine normalSampleHeader = new VCFSimpleHeaderLine("SAMPLE", normalSampleHeaderAttributes); final Map<String, String> tumorSampleHeaderAttributes = new HashMap<>(); tumorSampleHeaderAttributes.put("ID", "TUMOR"); tumorSampleHeaderAttributes.put("SampleName", tumorSampleName); if (tumorSAMReaderIDs.iterator().hasNext() && !getToolkit().getArguments().disableCommandLineInVCF) tumorSampleHeaderAttributes.put("File", tumorSAMReaderIDs.iterator().next().getSamFilePath()); final VCFSimpleHeaderLine tumorSampleHeader = new VCFSimpleHeaderLine("SAMPLE", tumorSampleHeaderAttributes); sampleLines.add(normalSampleHeader); sampleLines.add(tumorSampleHeader); } return sampleLines; }
/** * Gets the appropriately formatted header for a VCF file describing this GATK run * * @param header the existing VCFHeader that we will be adding this command line argument header line to. Existing * command line argument header lines will be used to generate a unique header line key. * @param engine the GATK engine that holds the walker name, GATK version, and other information * @param argumentSources contains information on the argument values provided to the GATK for converting to a * command line string. Should be provided from the data in the parsing engine. Can be * empty in which case the command line will be the empty string. * @return VCF header line describing this run of the GATK. */ public static VCFHeaderLine getCommandLineArgumentHeaderLine(final VCFHeader header, final GenomeAnalysisEngine engine, final Collection<Object> argumentSources) { if ( engine == null ) throw new IllegalArgumentException("engine cannot be null"); if ( argumentSources == null ) throw new IllegalArgumentException("argumentSources cannot be null"); final Map<String, String> attributes = new LinkedHashMap<>(); attributes.put("ID", engine.getWalkerName()); attributes.put("Version", CommandLineGATK.getVersionNumber()); final Date date = new Date(); attributes.put("Date", date.toString()); attributes.put("Epoch", Long.toString(date.getTime())); attributes.put("CommandLineOptions", engine.createApproximateCommandLineArgumentString(argumentSources.toArray())); // in case the walker name contains space, remove any spaces String key = getCommandLineKey(header, engine.getWalkerName().replaceAll("\\s", "")); return new VCFSimpleHeaderLine(key, attributes); }
metaData.add(contig); } else if ( str.startsWith(VCFConstants.ALT_HEADER_START) ) { final VCFSimpleHeaderLine alt = new VCFSimpleHeaderLine(str.substring(6), version, VCFConstants.ALT_HEADER_START.substring(2), Arrays.asList("ID", "Description")); metaData.add(alt); } else {
metaData.add(contig); } else if ( str.startsWith(VCFConstants.ALT_HEADER_START) ) { final VCFSimpleHeaderLine alt = new VCFSimpleHeaderLine(str.substring(6), version, VCFConstants.ALT_HEADER_START.substring(2), Arrays.asList("ID", "Description"), Collections.emptyList()); metaData.add(alt); } else {
metaData.add(contig); } else if ( str.startsWith(VCFConstants.ALT_HEADER_START) ) { final VCFSimpleHeaderLine alt = new VCFSimpleHeaderLine(str.substring(6), version, VCFConstants.ALT_HEADER_START.substring(2), Arrays.asList("ID", "Description")); metaData.add(alt); } else {
@Test public void testCreateDictionary() { final List<VCFHeaderLine> inputLines = new ArrayList<VCFHeaderLine>(); int counter = 0; inputLines.add(new VCFFilterHeaderLine(String.valueOf(counter++))); inputLines.add(new VCFFilterHeaderLine(String.valueOf(counter++))); inputLines.add(new VCFContigHeaderLine(Collections.singletonMap("ID", String.valueOf(counter++)), counter)); inputLines.add(new VCFContigHeaderLine(Collections.singletonMap("ID", String.valueOf(counter++)), counter)); inputLines.add(new VCFInfoHeaderLine(String.valueOf(counter++), VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "x")); inputLines.add(new VCFInfoHeaderLine(String.valueOf(counter++), VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "x")); inputLines.add(new VCFHeaderLine("x", "misc")); inputLines.add(new VCFHeaderLine("y", "misc")); inputLines.add(new VCFSimpleHeaderLine("GATKCommandLine","z","misc")); inputLines.add(new VCFFormatHeaderLine(String.valueOf(counter++), VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "x")); inputLines.add(new VCFFormatHeaderLine(String.valueOf(counter++), VCFHeaderLineCount.UNBOUNDED, VCFHeaderLineType.Integer, "x")); final int inputLineCounter = counter; final VCFHeader inputHeader = new VCFHeader(new LinkedHashSet<VCFHeaderLine>(inputLines)); final ArrayList<String> dict = BCF2Utils.makeDictionary(inputHeader); final int dict_size = dict.size(); Assert.assertEquals(7,dict_size); }
header.addMetaDataLine(VCFStandardHeaderLines.getInfoLine(VCFConstants.END_KEY)); header.addMetaDataLine(VcfStructuralVariantHeaderLines.CONFIDENCE_INTERVAL_END_POSITION); header.addMetaDataLine(new VCFSimpleHeaderLine("ALT", "INV", "Inversion")); header.addMetaDataLine(new VCFSimpleHeaderLine("ALT", "DUP", "Duplication")); header.addMetaDataLine(new VCFSimpleHeaderLine("ALT", "DEL", "Deletion")); header.addMetaDataLine(new VCFSimpleHeaderLine("ALT", "INS", "Insertion"));
private VariantContextWriter openOutputFile() { VariantContextWriterBuilder builder = new VariantContextWriterBuilder() .setReferenceDictionary(fasta.getSequenceDictionary()).setOutputFile(options.getPathOutputVCF()); if (options.getPathOutputVCF().endsWith(".gz") || options.getPathOutputVCF().endsWith(".bcf")) builder.setOption(Options.INDEX_ON_THE_FLY); else builder.unsetOption(Options.INDEX_ON_THE_FLY); VariantContextWriter writer = builder.build(); VCFHeader header = new VCFHeader(); int i = 0; for (SAMSequenceRecord record : fasta.getSequenceDictionary().getSequences()) { Map<String, String> mapping = new TreeMap<String, String>(); mapping.put("ID", record.getSequenceName()); mapping.put("length", Integer.toString(record.getSequenceLength())); header.addMetaDataLine(new VCFContigHeaderLine(mapping, i++)); } header.addMetaDataLine(new VCFSimpleHeaderLine("ALT", "ERROR", "Error in conversion")); header.addMetaDataLine(new VCFFilterHeaderLine("PARSE_ERROR", "Problem in parsing original HGVS variant string, written out as variant at 1:g.1N>N")); header.addMetaDataLine(new VCFInfoHeaderLine("ERROR_MESSAGE", 1, VCFHeaderLineType.String, "Error message")); header.addMetaDataLine(new VCFInfoHeaderLine("ORIG_VAR", 1, VCFHeaderLineType.String, "Original HGVS variant string from input file to hgvs-to-vcf")); writer.writeHeader(header); return writer; }
headerLine = new VCFContigHeaderLine(map, contigIndex++); } else { headerLine = new VCFSimpleHeaderLine(line.getKey(), map);
attributes.put("ID", "VariantFiltration"); attributes.put("CommandLineOptions", "filterName=[ANNOTATION] filterExpression=[ANNOTATION == \"NA\" || ANNOTATION <= 2.0]"); final VCFSimpleHeaderLine addedHeaderLine = new VCFSimpleHeaderLine("GATKCommandLine.Test", attributes); originalHeader.addMetaDataLine(addedHeaderLine);