de.charite.compbio.jannovar.pedigree.Sex Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jannovar-core Show documentation
Show all versions of jannovar-core Show documentation
jannovar-core is a library for the functional annotation of genomic variants
package de.charite.compbio.jannovar.pedigree;
/**
* Representation of an individual's sex.
*
* @author Peter N Robinson
* @author Manuel Holtgrewe
*/
public enum Sex {
/** sex is unknown */
UNKNOWN,
/** individual is male */
MALE,
/** individual is female */
FEMALE;
/**
* @return int
representation for the pedigree file.
*/
public int toInt() {
if (this == UNKNOWN)
return 0;
else if (this == MALE)
return 1;
else
// if (this == FEMALE)
return 2;
}
/**
* Parse {@link String} into a Sex
value.
*
* @param s
* String to parse
* @return resulting Sex
object
* @throws PedParseException
* if s
was not equal to "0"
, "1"
, or "2"
.
*/
public static Sex toSex(String s) throws PedParseException {
if (s.equals("0"))
return UNKNOWN;
else if (s.equals("1"))
return MALE;
else if (s.equals("2"))
return FEMALE;
else
throw new PedParseException("Invalid PED sex value: " + s);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy