Package vcf
Class MarkerUtils
java.lang.Object
vcf.MarkerUtils
Class MarkerUtils contains static helper methods for the
Marker class.
-
Method Summary
Modifier and TypeMethodDescriptionstatic String[]Returns the list of marker alleles in the VCF REF and ALT fields in order of their appearance in the VCF record.static voidappendFirst7Fields(Marker marker, StringBuilder sb) Appends the first seven tab-delimited VCF fields for the specified marker to the specifiedStringBuilder.static Stringcoordinate(Marker marker) Returns(marker.chrom() + ':' + marker.pos()).static StringcoordinateAndAlleles(Marker marker) Returns(marker.chrom() + ':' + marker.pos() + ':' + marker.alleles().replace(Const.tab, Const.colon)).static String[]Returns the list of identifiers in the VCF ID field.static intnGenotypes(int nAlleles) Returns the number of distinct genotypes, which equalsnAlleles*(1 + nAlleles())/2.static voidprintFirst7Fields(Marker marker, PrintWriter out) Prints the first seven tab-delimited VCF fields for the specified marker to the specifiedPrintWriter.
-
Method Details
-
nGenotypes
public static int nGenotypes(int nAlleles) Returns the number of distinct genotypes, which equalsnAlleles*(1 + nAlleles())/2.- Parameters:
nAlleles- the number of distinct alleles- Returns:
- the number of distinct genotypes
-
coordinate
Returns(marker.chrom() + ':' + marker.pos()).- Parameters:
marker- a marker- Returns:
(marker.chrom() + ':' + marker.pos())- Throws:
NullPointerException- ifmarker == null
-
coordinateAndAlleles
Returns(marker.chrom() + ':' + marker.pos() + ':' + marker.alleles().replace(Const.tab, Const.colon)).- Parameters:
marker- a marker- Returns:
- {
(marker.chrom() + ':' + marker.pos() + ':' + marker.alleles().replace(Const.tab, Const.colon)) - Throws:
NullPointerException- ifmarker == null
-
ids
Returns the list of identifiers in the VCF ID field. An array of length 0 is returned if(marker.hasIdData() == false).- Parameters:
marker- a marker- Returns:
- the list of identifiers in the VCF ID field
- Throws:
NullPointerException- ifmarker == null
-
alleles
Returns the list of marker alleles in the VCF REF and ALT fields in order of their appearance in the VCF record.- Parameters:
marker- a marker- Returns:
- the list of marker alleles
- Throws:
NullPointerException- ifmarker == null
-
printFirst7Fields
Prints the first seven tab-delimited VCF fields for the specified marker to the specifiedPrintWriter. The delimiter preceding the 8-th VCF field (the INFO field) is not appended.- Parameters:
marker- a markerout- thePrintWriterthat will receive output- Throws:
NullPointerException- if(marker == null) || (out == null)
-
appendFirst7Fields
Appends the first seven tab-delimited VCF fields for the specified marker to the specifiedStringBuilder. The delimiter preceding the 8-th field (the INFO field) is not appended.- Parameters:
marker- a markersb- theStringBuilderthat will be appended- Throws:
NullPointerException- if(marker == null) || (sb == null)
-