Constructor and Description |
---|
BasicMarker(int chrom,
int pos,
java.lang.String[] ids,
java.lang.String[] alleles)
Constructs a new
BasicMarker instance from the specified data. |
BasicMarker(int chrom,
int pos,
java.lang.String[] ids,
java.lang.String[] alleles,
int end)
Constructs a new
BasicMarker instance from the specified data. |
BasicMarker(java.lang.String vcfRecord)
Constructs a new
BasicMarker instance from the specified
string VCF record. |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
allele(int index)
Returns the specified allele.
|
java.lang.String[] |
alleles()
Returns the alleles.
|
java.lang.String |
chrom()
Returns the chromosome.
|
int |
chromIndex()
Returns the chromosome index.
|
int |
compareTo(Marker other)
Compares this marker with the specified marker
for order, and returns a negative integer, 0, or a positive integer
depending on whether this marker is less than, equal to,
or greater than the specified marker.
|
int |
end()
Returns the INFO END field, or -1 if there is no INFO END field.
|
boolean |
equals(java.lang.Object obj)
Returns
true if the specified object is a
Marker with the same chromosome,
position, allele lists, and INFO END field, and
returns false otherwise. |
static Marker |
flipStrand(Marker marker)
Constructs and returns a new marker obtained from the specified marker
by changing the marker's non-symbolic alleles to the alleles on the
opposite chromosome strand.
|
int |
hashCode()
Returns the hash code value for this object.
|
java.lang.String |
id()
Returns the first marker identifier if there is at least
one identifier in the VCF record ID field, and returns
this.chr() + ":" + this.pos() otherwise. |
java.lang.String |
id(int index)
Returns the specified marker identifier.
|
int |
nAlleles()
Returns the number of alleles for the marker, including the REF
allele.
|
int |
nGenotypes()
Returns the number of distinct genotypes, which equals
this.nAlleles()*(1 + this.nAlleles())/2 . |
int |
nIds()
Returns the number of marker identifiers.
|
int |
pos()
Returns the chromosome position coordinate.
|
java.lang.String |
toString()
Returns a string equal to the first five tab-delimited fields
of a VCF record corresponding to this marker.
|
public BasicMarker(int chrom, int pos, java.lang.String[] ids, java.lang.String[] alleles)
BasicMarker
instance from the specified data.
The end()
method of the new instance will return -1
.
The JVM will exit with an error message if any marker identifier
in the specifiedids
array or if any allele identifier in the
specified alleles
array does not conform to the VCF
specification.chrom
- a chromosome indexpos
- the marker positionids
- a list of marker identifiersalleles
- a list of alleles beginning with the reference allelejava.lang.IllegalArgumentException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
java.lang.NullPointerException
- if ids == null
or if any element
of ids
is null
java.lang.NullPointerException
- if alleles == null
or if any element
of alleles
is null
public BasicMarker(int chrom, int pos, java.lang.String[] ids, java.lang.String[] alleles, int end)
BasicMarker
instance from the specified data.
The JVM will exit with an error message if any marker identifier
in the specified ids
array does not conform to the VCF
specification, if any allele identifier in the specified alleles
array does not conform to the VCF specification, or if
(end != -1 && end < pos)
.chrom
- a chromosome indexpos
- the marker positionids
- a list of marker identifiersalleles
- a list of alleles beginning with the reference alleleend
- the INFO END field, or -1 if there is no INFO END fieldjava.lang.IllegalArgumentException
- if
chrom < 0 || chrom >= ChromIds.instance().size()
java.lang.NullPointerException
- if ids == null
or if any element
of ids
is null
java.lang.NullPointerException
- if alleles == null
or if any element
of alleles
is null
public BasicMarker(java.lang.String vcfRecord)
BasicMarker
instance from the specified
string VCF record.vcfRecord
- a VCF recordjava.lang.IllegalArgumentException
- if the specified VCF
record has fewer than 8 tab-delimited fields, or if a format
error is detected in the specified VCF recordjava.lang.NullPointerException
- if vcfRecord == null
public static Marker flipStrand(Marker marker)
marker
- a markerjava.lang.NullPointerException
- if marker == null
public java.lang.String chrom()
Marker
public int chromIndex()
Marker
chromIndex
in interface Marker
public int pos()
Marker
public int nIds()
Marker
public java.lang.String id(int index)
Marker
public java.lang.String id()
Marker
this.chr() + ":" + this.pos()
otherwise.public int nAlleles()
Marker
public java.lang.String allele(int index)
Marker
public java.lang.String[] alleles()
Marker
k
-th element of the returned array
is equal to this.allele(k)
.public int nGenotypes()
Marker
this.nAlleles()*(1 + this.nAlleles())/2
.nGenotypes
in interface Marker
public int end()
Marker
public java.lang.String toString()
Marker
public int hashCode()
Marker
Returns the hash code value for this object. The hash code does not depend on value of the VCF record ID field. The hash code is defined by the following calculation:
int hash = 5; hash = 29 * hash + this.chromIndex(); hash = 29 * hash + this.pos(); for (int j=0, n=this.nAlleles(); j<n; ++j) { hash = 29 * hash + alleles[j].hashCode(); } hash = 29 * hash + end();
public boolean equals(java.lang.Object obj)
Marker
true
if the specified object is a
Marker
with the same chromosome,
position, allele lists, and INFO END field, and
returns false
otherwise. Equality does not
depend on value of the VCF record ID field.public int compareTo(Marker other)
Marker
String compareTo()
method.compareTo
in interface java.lang.Comparable<Marker>
compareTo
in interface Marker
other
- the Marker
to be compared