Package vcf
Class LowMafGTRec
- java.lang.Object
-
- vcf.LowMafGTRec
-
- All Implemented Interfaces:
IntArray
,DuplicatesGTRec
,GTRec
,MarkerContainer
public final class LowMafGTRec extends java.lang.Object implements GTRec
Class
LowMafGTRc
stores genotypes for a list of samples at a marker. Instances of classLowMafGTRec
store lists of haplotypes carrying each non-major or missing allele. All genotypes are considered to be unphased if any sample has an unphased or missing genotype.Instances of class
LowMafGTRec
are immutable.
-
-
Constructor Summary
Constructors Constructor Description LowMafGTRec(VcfRecGTParser.HapListRep listRep)
Constructs a newLowMafGTRec
representing the specified VCF record's GT format field data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
allele1(int sample)
Returns the first allele for the specified sample or -1 if the allele is missing.int
allele2(int sample)
Returns the second allele for the specified sample or -1 if the allele is missing.int
alleleCount(int allele)
Returns the number of copies of the specified allele.int[]
alleles()
Returns an array of lengththis.size()
whosej
-th element is equal tothis.allele(j
}int
get(int hap)
Returns the specified allele for the specified haplotype or -1 if the allele is missing.boolean
isPhased()
Returnstrue
if every genotype for each sample is a phased, non-missing genotype, and returnsfalse
otherwise.boolean
isPhased(int sample)
Returnstrue
if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalse
otherwise.int
majorAllele()
Returns the major allele.Marker
marker()
Returns the marker.Samples
samples()
Returns the list of samples.int
size()
Returns the number of haplotypes.java.lang.String
toString()
Returns the data represented bythis
as a VCF record with a GT format field.
-
-
-
Constructor Detail
-
LowMafGTRec
public LowMafGTRec(VcfRecGTParser.HapListRep listRep)
Constructs a newLowMafGTRec
representing the specified VCF record's GT format field data.- Parameters:
listRep
- the VCF record genotype data- Throws:
java.lang.NullPointerException
- iflistRep == null
-
-
Method Detail
-
isPhased
public boolean isPhased(int sample)
Description copied from interface:DuplicatesGTRec
Returnstrue
if the genotype for the specified sample has non-missing alleles and is either haploid or diploid with a phased allele separator, and returnsfalse
otherwise.- Specified by:
isPhased
in interfaceDuplicatesGTRec
- Parameters:
sample
- a sample index- Returns:
true
if the genotype for the specified sample is a phased, nonmissing genotype
-
isPhased
public boolean isPhased()
Description copied from interface:DuplicatesGTRec
Returnstrue
if every genotype for each sample is a phased, non-missing genotype, and returnsfalse
otherwise.- Specified by:
isPhased
in interfaceDuplicatesGTRec
- Returns:
true
if the genotype for each sample is a phased, non-missing genotype
-
samples
public Samples samples()
Description copied from interface:GTRec
Returns the list of samples.
-
size
public int size()
Description copied from interface:DuplicatesGTRec
Returns the number of haplotypes.- Specified by:
size
in interfaceDuplicatesGTRec
- Specified by:
size
in interfaceIntArray
- Returns:
- the number of haplotypes
-
marker
public Marker marker()
Description copied from interface:MarkerContainer
Returns the marker.- Specified by:
marker
in interfaceMarkerContainer
- Returns:
- the marker
-
allele1
public int allele1(int sample)
Description copied from interface:DuplicatesGTRec
Returns the first allele for the specified sample or -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.- Specified by:
allele1
in interfaceDuplicatesGTRec
- Parameters:
sample
- a sample index- Returns:
- the first allele for the specified sample
-
allele2
public int allele2(int sample)
Description copied from interface:DuplicatesGTRec
Returns the second allele for the specified sample or -1 if the allele is missing. The two alleles for a sample are arbitrarily ordered ifthis.unphased(marker, sample) == false
.- Specified by:
allele2
in interfaceDuplicatesGTRec
- Parameters:
sample
- a sample index- Returns:
- the second allele for the specified sample
-
get
public int get(int hap)
Description copied from interface:DuplicatesGTRec
Returns the specified allele for the specified haplotype or -1 if the allele is missing. The two alleles for a sample at a marker are arbitrarily ordered ifthis.unphased(marker, hap/2) == false
.- Specified by:
get
in interfaceDuplicatesGTRec
- Specified by:
get
in interfaceIntArray
- Parameters:
hap
- a haplotype index- Returns:
- the specified allele for the specified sample
-
alleles
public int[] alleles()
Description copied from interface:DuplicatesGTRec
Returns an array of lengththis.size()
whosej
-th element is equal tothis.allele(j
}- Specified by:
alleles
in interfaceDuplicatesGTRec
- Returns:
- an array of length
this.size()
whosej
-th element is equal tothis.allele(j
}
-
majorAllele
public int majorAllele()
Returns the major allele. If there are two major alleles with the same allele count, the smaller allele is returned.- Returns:
- the major allele
-
alleleCount
public int alleleCount(int allele)
Returns the number of copies of the specified allele.- Parameters:
allele
- an allele- Returns:
- the number of copies of the specified allele
- Throws:
java.lang.IndexOutOfBoundsException
- ifallele < 0 || allele >= this.marker().nAlleles()
-
toString
public java.lang.String toString()
Returns the data represented bythis
as a VCF record with a GT format field. The returned VCF record will have missing QUAL and INFO fields, will have "PASS" in the filter field, and will have a GT format field.- Overrides:
toString
in classjava.lang.Object
- Returns:
- the data represented by
this
as a VCF record with a GT format field
-
-