htsjdk.variant.vcf.VCFHeaderVersion Java Examples
The following examples show how to use
htsjdk.variant.vcf.VCFHeaderVersion.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VcfToVariant.java From genomewarp with Apache License 2.0 | 6 votes |
private static boolean validVersion(File filepath) throws IOException { BufferedReader reader = Files.newBufferedReader(filepath.toPath(), UTF_8); // The first line must be the header String firstLine = reader.readLine(); reader.close(); try { VCFHeaderVersion version = VCFHeaderVersion.getHeaderVersion(firstLine); // If the version is greater than or equal to 4.2, we cannot handle it if (version.isAtLeastAsRecentAs(VCFHeaderVersion.VCF4_2)) { return false; } } catch (TribbleException.InvalidHeader msg) { throw new IOException(msg); } return true; }
Example #2
Source File: VariantContextCollectionTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(SAMPLE)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #3
Source File: SomaticVariantFactoryTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(SAMPLE)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #4
Source File: VariantContextFromString.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec(@NotNull String sample) { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(sample)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #5
Source File: StructuralVariantFactoryTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(SAMPLE)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #6
Source File: StrelkaAllelicDepthTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Lists.newArrayList(NORMAL, TUMOR)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #7
Source File: RecoveredVariantFactoryTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(SAMPLE)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #8
Source File: SageHotspotAnnotationTest.java From hmftools with GNU General Public License v3.0 | 5 votes |
@NotNull private static VCFCodec createTestCodec() { VCFCodec codec = new VCFCodec(); VCFHeader header = new VCFHeader(Sets.newHashSet(), Sets.newHashSet(SAMPLE)); codec.setVCFHeader(header, VCFHeaderVersion.VCF4_2); return codec; }
Example #9
Source File: LazyVCFGenotypesContext.java From Hadoop-BAM with MIT License | 5 votes |
@Override public void setHeader(VCFHeader header) { VCFHeaderVersion version = null; // Normally AbstractVCFCodec parses the header and thereby sets the // version field. It gets used later on so we need to set it. for (final VCFHeaderLine line : header.getMetaDataInInputOrder()) { if (VCFHeaderVersion.isFormatString(line.getKey())) { version = VCFHeaderVersion.toHeaderVersion(line.getValue()); break; } } codec.setHeaderAndVersion(header, version); }
Example #10
Source File: GenomeWarpSerial.java From genomewarp with Apache License 2.0 | 4 votes |
private static VCFHeader warpHeader(VCFHeader in, Map<String, Long> namesAndLength) throws IllegalArgumentException { Set<VCFHeaderLine> newLines = new HashSet<>(); boolean hasSource = false; VCFHeaderVersion version = DEFAULT_VCF_VERSION; for (VCFHeaderLine line : in.getMetaDataInInputOrder()) { if (line.getKey().equals("reference")) { newLines.add(new VCFHeaderLine(line.getKey(), ARGS.refTargetFASTA)); } else if (line.getKey().equals("source")) { newLines.add(new VCFHeaderLine(line.getKey(), line.getValue() + "_and_" + GENOME_WARP_VERSION)); hasSource = true; } else if (line.getKey().equals("fileformat")) { version = VCFHeaderVersion.toHeaderVersion(line.getValue()); if (version == null) { throw new IllegalArgumentException("malformed version: " + line.getValue()); } } else if (line.getKey().equals(VCFConstants.CONTIG_HEADER_KEY)) { continue; } else { newLines.add(line); } } if (!hasSource) { newLines.add(new VCFHeaderLine("source", GENOME_WARP_VERSION)); } // Add contigs int i = 0; for (Map.Entry<String, Long> entry : namesAndLength.entrySet()) { String currName = entry.getKey(); long chrSize = entry.getValue(); newLines.add(new VCFContigHeaderLine(VCFHeaderLine.toStringEncoding( createContigEntry(currName, chrSize, ARGS.targetAssembly, ARGS.species)), version, VCFConstants.CONTIG_HEADER_KEY, i++)); } return new VCFHeader(newLines, in.getSampleNamesInOrder()); }
Example #11
Source File: LazyVCFGenotypesContext.java From Hadoop-BAM with MIT License | 4 votes |
public void setHeaderAndVersion(VCFHeader header, VCFHeaderVersion ver) { this.header = header; this.version = ver; }