Package Correlation

Class Correlation

  • Direct Known Subclasses:
    EM, Pearson

    public abstract class Correlation
    extends java.lang.Object
    Abstract class for calculating LD. Calculating the LD between two SNPs is left for implementing classes while this class deals with the all-against-all mechanisms.
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      double[][] calculate​(byte[][] data)
      Calculates all-against-all LD
      abstract double calculate​(byte[] d1, byte[] d2)
      Calculates LD between two SNPs
      static void setSilent​(boolean s)
      Contols progress output to screen
      java.util.Map<java.lang.Integer,​java.util.List<java.lang.Integer>> topn​(byte[][] data, int n)
      Calculates all-against-all LD and returns the top n sites most in LD with each site.
      java.util.List<java.lang.Integer> topn​(byte[][] data, int n, int p)
      Calculates the top n sites most in LD with a single site.
      • Methods inherited from class java.lang.Object

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

      • calculate

        public double[][] calculate​(byte[][] data)
        Calculates all-against-all LD
        Parameters:
        data - The data to calculate LD for. SNPs are indexed by the first position of the array, samples by the second. For example data[1][2] would be SNP 1 and sample 2.
        Returns:
        A LD matrix
      • topn

        public java.util.Map<java.lang.Integer,​java.util.List<java.lang.Integer>> topn​(byte[][] data,
                                                                                             int n)
        Calculates all-against-all LD and returns the top n sites most in LD with each site.
        Parameters:
        data - The data to calculate LD for. SNPs are indexed by the first position of the array, samples by the second. For example data[1][2] would be SNP 1 and sample 2.
        n - number of top hits to return per site
        Returns:
        A map from site to ordered list of sites most in LD
      • topn

        public java.util.List<java.lang.Integer> topn​(byte[][] data,
                                                      int n,
                                                      int p)
        Calculates the top n sites most in LD with a single site.
        Parameters:
        data - The data to calculate LD for. SNPs are indexed by the first position of the array, samples by the second. For example data[1][2] would be SNP 1 and sample 2.
        n - Number of top hits to return
        p - Index of site to calculate other sites most in LD with it
        Returns:
        Ordered list of sites most in LD
      • calculate

        public abstract double calculate​(byte[] d1,
                                         byte[] d2)
        Calculates LD between two SNPs
        Parameters:
        d1 - SNP 1 genotype
        d2 - SNP 2 genotype
        Returns:
        LD between the two SNPs
      • setSilent

        public static void setSilent​(boolean s)
        Contols progress output to screen
        Parameters:
        s - Whether to output progress to screen