Package main

Class Pedigree

java.lang.Object
main.Pedigree

public class Pedigree extends Object

Class Pedigree stores parent-offspring relationships in a list of samples. In particular, class Pedigree stores a list of the single individuals in the list of samples, a list of the parent-offspring duos in the list of samples, and a list of the parent-offspring trios in the list of samples. A single individual is an individuals without a parent or offspring in the list of samples.

Instances of class Pedigree are immutable.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Pedigree(Samples samples, File pedFile)
    Constructs a new NuclearFamilies instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    duoOffspring(int index)
    Returns the sample index of the offspring of the specified parent-offspring duo.
    int
    duoParent(int index)
    Returns the sample index of the parent of the specified parent-offspring duo.
    int
    father(int sample)
    Returns the sample index of the father of the specified sample, or returns -1 if the father is unknown or is not present in the list of samples.
    int
    mother(int sample)
    Returns the sample index of the mother of the specified sample, or returns -1 if the mother is unknown or is not present in the list of samples.
    int
    Returns the number of parent-offspring duos in the list of samples.
    int
    nOffspring(int sample)
    Returns the number of offspring of the specified sample.
    int
    Returns the number of samples.
    int
    Returns the number of single individuals in the list of samples.
    int
    Returns the number of parent-offspring trios in the list of samples.
    int
    offspring(int sample, int index)
    Returns the sample index of the offspring of the specified sample.
    int[]
    Returns an array of indices of samples with at least one parent or child in the list or samples.
    Returns the list of samples.
    int
    single(int index)
    Returns the sample index of the specified single individual.
    int[]
    Returns an array of indices of samples with no parents or children in the list of samples.
    Returns a string representation of this.
    int
    trioFather(int index)
    Returns the sample index of the father of the specified parent-offspring trio.
    int
    trioMother(int index)
    Returns the sample index of the mother of the specified parent-offspring trio.
    int
    trioOffspring(int index)
    Returns the sample index of the offspring of the specified parent-offspring trio.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Pedigree

      public Pedigree(Samples samples, File pedFile)
      Constructs a new NuclearFamilies instance.
      Parameters:
      samples - the list of samples.
      pedFile - a linkage-format pedigree file, or null if no pedigree relationships are known. A pedigree file must have at least 4 white-space delimited columns. The first column of the pedigree file (family ID) is ignored. The second, third, and fourth columns are the individual's ID, the individual's father's ID, and the individual's mother's ID respectively.
      Throws:
      IllegalArgumentException - if a pedigree file is specified, and if the file has a non-blank line with less than 4 white-space delimited fields
      IllegalArgumentException - if a pedigree file is specified, and if the file has duplicate individual identifiers in the second white-space delimited column
      NullPointerException - if samples == null
  • Method Details

    • samples

      public Samples samples()
      Returns the list of samples.
      Returns:
      the list of samples
    • nSamples

      public int nSamples()
      Returns the number of samples.
      Returns:
      the number of samples
    • nSingles

      public int nSingles()
      Returns the number of single individuals in the list of samples. A single individual has no parent or offspring in the list of samples.
      Returns:
      the number of single individuals in the sample
    • nDuos

      public int nDuos()
      Returns the number of parent-offspring duos in the list of samples. The offspring of a parent-offspring duo has only one parent in the sample.
      Returns:
      the number of parent-offspring duos in the list of samples
    • nTrios

      public int nTrios()
      Returns the number of parent-offspring trios in the list of samples. The offspring of a parent-offspring trio has two parents in the sample.
      Returns:
      the number of parent-offspring trios in the list of samples
    • singles

      public int[] singles()
      Returns an array of indices of samples with no parents or children in the list of samples.
      Returns:
      an array of indices of samples with no parents or children in the list of samples
    • relateds

      public int[] relateds()
      Returns an array of indices of samples with at least one parent or child in the list or samples.
      Returns:
      an array of indices of samples with at least one parent or child in the list or samples
    • single

      public int single(int index)
      Returns the sample index of the specified single individual. A single individual has no first-degree relative in the list of samples.
      Parameters:
      index - the index of a single individual
      Returns:
      the sample index of the specified single individual
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nSingles()
    • duoParent

      public int duoParent(int index)
      Returns the sample index of the parent of the specified parent-offspring duo.
      Parameters:
      index - the index of a parent-offspring duo
      Returns:
      the sample index of the parent of the specified parent-offspring duo
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nDuos()
    • duoOffspring

      public int duoOffspring(int index)
      Returns the sample index of the offspring of the specified parent-offspring duo.
      Parameters:
      index - the index of a parent-offspring duo
      Returns:
      the sample index of the offspring of the specified parent-offspring duo
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nDuos()
    • trioFather

      public int trioFather(int index)
      Returns the sample index of the father of the specified parent-offspring trio.
      Parameters:
      index - the index of a parent-offspring trio
      Returns:
      the sample index of the father of the specified parent-offspring trio
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nTrios()
    • trioMother

      public int trioMother(int index)
      Returns the sample index of the mother of the specified parent-offspring trio.
      Parameters:
      index - the index of a parent-offspring trio
      Returns:
      the sample index of the mother of the specified parent-offspring trio
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nTrios()
    • trioOffspring

      public int trioOffspring(int index)
      Returns the sample index of the offspring of the specified parent-offspring trio.
      Parameters:
      index - the index of a parent-offspring trio
      Returns:
      the sample index of the offspring of the specified parent-offspring trio
      Throws:
      IndexOutOfBoundsException - if index < 0 || index >= this.nTrios()
    • father

      public int father(int sample)
      Returns the sample index of the father of the specified sample, or returns -1 if the father is unknown or is not present in the list of samples.
      Parameters:
      sample - a sample index
      Returns:
      the sample index of the father of the specified sample, or -1 if the father is unknown or is not present in the list of samples
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.size()()
    • mother

      public int mother(int sample)
      Returns the sample index of the mother of the specified sample, or returns -1 if the mother is unknown or is not present in the list of samples.
      Parameters:
      sample - a sample index
      Returns:
      the sample index of the mother of the specified sample, or -1 if the mother is unknown or is not present in the list of samples
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.size()()
    • nOffspring

      public int nOffspring(int sample)
      Returns the number of offspring of the specified sample.
      Parameters:
      sample - a sample index
      Returns:
      the number of offspring of the specified sample
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.size()()
    • offspring

      public int offspring(int sample, int index)
      Returns the sample index of the offspring of the specified sample.
      Parameters:
      sample - a sample index
      index - the offspring index
      Returns:
      the sample index of the offspring of the specified sample.
      Throws:
      IndexOutOfBoundsException - if sample < 0 || sample >= this.size()()
      IndexOutOfBoundsException - if index < 0 || index >= this.nOffspring(sample)
    • toString

      public String toString()
      Returns a string representation of this. The exact details of the representation are unspecified and subject to change.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this