All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.charite.compbio.jannovar.pedigree.Disease Maven / Gradle / Ivy

There is a newer version: 0.41
Show newest version
package de.charite.compbio.jannovar.pedigree;

/**
 * Codes used to denote affection status of a person in a pedigree.
 *
 * @author Peter N Robinson
 * @author Manuel Holtgrewe
 */
public enum Disease {
	/** corresponds to 0 = unknown disease status in the PED file. */
	UNKNOWN,
	/** corresponds to 1 = unaffected in the PED file. */
	UNAFFECTED,
	/** corresponds to 2 = affected in the PED file. */
	AFFECTED;

	/**
	 * @return int value representation for PED file.
	 */
	public int toInt() {
		switch (this) {
		case AFFECTED:
			return 2;
		case UNAFFECTED:
			return 1;
		default:
			return 0;
		}
	}

	/**
	 * Parse {@link String} into a Disease value.
	 *
	 * @param s
	 *            String to parse
	 * @return resulting Disease object
	 * @throws PedParseException
	 *             if s was not equal to "0", "1", or "2".
	 */
	public static Disease toDisease(String s) throws PedParseException {
		if (s.equals("0"))
			return UNKNOWN;
		else if (s.equals("1"))
			return UNAFFECTED;
		else if (s.equals("2"))
			return AFFECTED;
		else
			throw new PedParseException("Invalid PED disease status value: " + s);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy