Package VCF
Class Genotype
- java.lang.Object
-
- VCF.Genotype
-
public class Genotype extends java.lang.Object
Represents a single genotype in a VCF file
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addData(java.lang.String value)
Add data to the genotype.Genotype
copy()
Create a copy of the genotypejava.lang.String
getData()
Get all the data associated with this genotypejava.lang.String
getData(java.lang.String name)
Get a specified piece of data for this genotype.PositionMeta
getPositionMeta()
Get the position metadata for the position associated with this genotypejava.lang.String
getSampleName()
Get the sample name for the name associated with this genotypevoid
removeData(java.lang.String name)
Remove data for the given format.void
replaceData(java.lang.String name, java.lang.String value)
Change a particular piece of data associated with the genotypejava.lang.String
toString()
-
-
-
Method Detail
-
getPositionMeta
public PositionMeta getPositionMeta()
Get the position metadata for the position associated with this genotype- Returns:
- Position metadata
-
getSampleName
public java.lang.String getSampleName()
Get the sample name for the name associated with this genotype- Returns:
- The sample name
-
getData
public java.lang.String getData()
Get all the data associated with this genotype- Returns:
- The data as a string
-
getData
public java.lang.String getData(java.lang.String name) throws VCFNoDataException
Get a specified piece of data for this genotype. Returns "." if field is not present for this genotype.- Parameters:
name
- The format of the data to be retrieved (as a string)- Returns:
- The data
- Throws:
VCFNoDataException
- If there is a no data for the requested format
-
replaceData
public void replaceData(java.lang.String name, java.lang.String value) throws VCFNoDataException
Change a particular piece of data associated with the genotype- Parameters:
name
- The format of the data to be changed (as a string)value
- The new value- Throws:
VCFNoDataException
- If there is a no data for the requested format
-
addData
public void addData(java.lang.String value)
Add data to the genotype. It is up to the caller to ensure the appropriate format is also added to the position.- Parameters:
value
- The value to add
-
removeData
public void removeData(java.lang.String name) throws VCFNoDataException
Remove data for the given format. It is up to the caller to ensure the appropriate format is removed from the position.- Parameters:
name
- The name of the format data to remove- Throws:
VCFNoDataException
- If there is no data field with that name
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
copy
public Genotype copy()
Create a copy of the genotype- Returns:
- A copy of the genotype
-
-