Package Methods
Class KnniLD
- java.lang.Object
-
- Methods.KnniLD
-
public class KnniLD extends java.lang.Object
Class to perform standard LD-kNNi imputation
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[][]
compute(byte[][] original)
Impute missing datadouble
fastAccuracy(byte[][] original, Mask mask)
Performs a fast accuracy calculation - only imputes those genotypes that were masked rather than all missing genotypes.static void
setAddConstant(double constant)
Sets the constant to add to avoid a distance of zero (since this causes problems later).static void
setSilent(boolean s)
Contols progress output to screen
-
-
-
Constructor Detail
-
KnniLD
public KnniLD(Similar sim, int k, int l)
Constructor- Parameters:
sim
- Similarity object to use to get similarity between snpsk
- The number of nearest neighbours to usel
- The number of most similar snps to use to calulate nearest neighbours
-
-
Method Detail
-
compute
public byte[][] compute(byte[][] original) throws NotEnoughGenotypesException, WrongNumberOfSNPsException
Impute missing data- Parameters:
original
- The original data set. Missing data is coded as -1- Returns:
- The imputed data set
- Throws:
NotEnoughGenotypesException
- If there is not enough known genotypes forWrongNumberOfSNPsException
- If the number of SNPs is not the same for every sample imputation
-
fastAccuracy
public double fastAccuracy(byte[][] original, Mask mask)
Performs a fast accuracy calculation - only imputes those genotypes that were masked rather than all missing genotypes.- Parameters:
original
- The original genotype valuesmask
- A mask- Returns:
- The percentage of genotypes imputed correctly
-
setAddConstant
public static void setAddConstant(double constant)
Sets the constant to add to avoid a distance of zero (since this causes problems later). Default value is 1.0 if this function is not called- Parameters:
constant
- Constant to use
-
setSilent
public static void setSilent(boolean s)
Contols progress output to screen- Parameters:
s
- Whether to output progress to screen
-
-