Package org.snpeff.vcf
Class VcfHeader
- java.lang.Object
-
- org.snpeff.vcf.VcfHeader
-
public class VcfHeader extends java.lang.Object
Represents the header of a vcf file. References: http://www.1000genomes.org/wiki/Analysis/Variant%20Call%20Format/vcf-variant-call-format-version-41- Author:
- pablocingolani
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CHROM_PREFIX
static java.lang.String
FORMAT_PREFIX
static java.lang.String
INFO_PREFIX
static java.lang.String
PEDIGREE_PREFIX
-
Constructor Summary
Constructors Constructor Description VcfHeader()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(VcfHeader newVcfHeader)
Add all missing lines from 'vcfHeader'void
add(VcfHeaderEntry vcfHeader)
Add header linevoid
addFormat(VcfHeaderFormat vcfFormat)
Add a 'FORMAT' meta infovoid
addInfo(VcfHeaderInfo vcfInfo)
Add a VCF INFO header definitionvoid
addLine(java.lang.String newHeaderLine)
Add line to header (can add many lines)java.lang.String[]
getLines()
int
getNumberOfSamples()
Number of samplesjava.util.List<PedigreeEnrty>
getPedigree()
Get pedigree (if any)java.util.List<java.lang.String>
getSampleNames()
Get sample namesint
getSampleNum(java.lang.String sameplName)
Sample number (position in "#CHROM" line)java.util.Collection<VcfHeaderFormat>
getVcfHeaderFormat()
VcfHeaderFormat
getVcfHeaderFormat(java.lang.String id)
java.util.Collection<VcfHeaderInfo>
getVcfHeaderInfo()
Get all VcfInfo entriesVcfHeaderInfo
getVcfHeaderInfo(java.lang.String id)
Get Info type for a given IDboolean
hasFormat(VcfHeaderFormat vcfFormat)
Do we already have this 'format' entry?boolean
hasInfo(VcfHeaderInfo vcfInfo)
Do we already have this 'info' header?static boolean
isFormatLine(java.lang.String line)
static boolean
isInfoLine(java.lang.String line)
void
parse()
Parse header linesprotected java.util.List<java.lang.String>
parseSampleNames()
protected void
parseSampleNum()
void
remove(java.lang.String linePrefix)
Remove header line starting with a prefixvoid
removeInfo(java.lang.String infoId)
Remove header line matching an INFO fieldjava.lang.String
toString()
Get header information
-
-
-
Field Detail
-
INFO_PREFIX
public static final java.lang.String INFO_PREFIX
- See Also:
- Constant Field Values
-
FORMAT_PREFIX
public static final java.lang.String FORMAT_PREFIX
- See Also:
- Constant Field Values
-
PEDIGREE_PREFIX
public static final java.lang.String PEDIGREE_PREFIX
- See Also:
- Constant Field Values
-
CHROM_PREFIX
public static final java.lang.String CHROM_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
isFormatLine
public static boolean isFormatLine(java.lang.String line)
-
isInfoLine
public static boolean isInfoLine(java.lang.String line)
-
add
public void add(VcfHeader newVcfHeader)
Add all missing lines from 'vcfHeader'
-
add
public void add(VcfHeaderEntry vcfHeader)
Add header line
-
addFormat
public void addFormat(VcfHeaderFormat vcfFormat)
Add a 'FORMAT' meta info
-
addInfo
public void addInfo(VcfHeaderInfo vcfInfo)
Add a VCF INFO header definition
-
addLine
public void addLine(java.lang.String newHeaderLine)
Add line to header (can add many lines)
-
getLines
public java.lang.String[] getLines()
-
getNumberOfSamples
public int getNumberOfSamples()
Number of samples
-
getPedigree
public java.util.List<PedigreeEnrty> getPedigree()
Get pedigree (if any)
-
getSampleNames
public java.util.List<java.lang.String> getSampleNames()
Get sample names
-
getSampleNum
public int getSampleNum(java.lang.String sameplName)
Sample number (position in "#CHROM" line)- Returns:
- -1 if not found
-
getVcfHeaderFormat
public java.util.Collection<VcfHeaderFormat> getVcfHeaderFormat()
-
getVcfHeaderFormat
public VcfHeaderFormat getVcfHeaderFormat(java.lang.String id)
-
getVcfHeaderInfo
public java.util.Collection<VcfHeaderInfo> getVcfHeaderInfo()
Get all VcfInfo entries
-
getVcfHeaderInfo
public VcfHeaderInfo getVcfHeaderInfo(java.lang.String id)
Get Info type for a given ID
-
hasFormat
public boolean hasFormat(VcfHeaderFormat vcfFormat)
Do we already have this 'format' entry?
-
hasInfo
public boolean hasInfo(VcfHeaderInfo vcfInfo)
Do we already have this 'info' header?
-
parse
public void parse()
Parse header lines
-
parseSampleNames
protected java.util.List<java.lang.String> parseSampleNames()
-
parseSampleNum
protected void parseSampleNum()
-
remove
public void remove(java.lang.String linePrefix)
Remove header line starting with a prefix
-
removeInfo
public void removeInfo(java.lang.String infoId)
Remove header line matching an INFO field
-
toString
public java.lang.String toString()
Get header information- Overrides:
toString
in classjava.lang.Object
-
-