Package Mask

Class Mask


  • public class Mask
    extends java.lang.Object
    Represents a mask for calculating imputation accuracy. Contains data on which genotypes should be masked.
    • Constructor Summary

      Constructors 
      Constructor Description
      Mask​(byte[][] orig, int number)
      Creates a mask for a dataset
      Mask​(java.io.File f)
      Creates a mask from file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double accuracy​(byte[][] orig, byte[][] imputed)
      Calculates imputation accuracy
      boolean[][] getArray()
      Returns an array of masked genotypes (true = masked, false = unmasked).
      java.util.Set<SampleSnp> getSet()
      Returns a list of masked genotypes.
      byte[][] mask​(byte[][] orig)
      Creates a masked array using this mask
      void saveToFile​(java.io.File f)
      Saves this mask to a file
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Mask

        public Mask​(java.io.File f)
             throws java.io.IOException
        Creates a mask from file.
        Parameters:
        f - The file to read the mask from
        Throws:
        java.io.IOException - If there are problems reading the file
      • Mask

        public Mask​(byte[][] orig,
                    int number)
        Creates a mask for a dataset
        Parameters:
        orig - The original dataset
        number - The number of genotypes to mask
    • Method Detail

      • getSet

        public java.util.Set<SampleSnp> getSet()
        Returns a list of masked genotypes. List is only created when this function is first called to save memory.
        Returns:
        A list of masked genotypes
      • accuracy

        public double accuracy​(byte[][] orig,
                               byte[][] imputed)
        Calculates imputation accuracy
        Parameters:
        orig - The original, unmasked dataset
        imputed - The imputed dataset (imputed on masked data)
        Returns:
        Imputation accuracy
      • getArray

        public boolean[][] getArray()
        Returns an array of masked genotypes (true = masked, false = unmasked).
        Returns:
        An array of masked genotypes.
      • mask

        public byte[][] mask​(byte[][] orig)
        Creates a masked array using this mask
        Parameters:
        orig - Array to be masked
        Returns:
        Masked array
      • saveToFile

        public void saveToFile​(java.io.File f)
                        throws java.io.IOException
        Saves this mask to a file
        Parameters:
        f - File to save to
        Throws:
        java.io.IOException - If there are problems writing the file