Package phase

Class Stage2Haps


  • public class Stage2Haps
    extends java.lang.Object

    Class Stage2Haps stores phased genotypes.

    Instances of Stage2Haps are thread-safe.

    • Constructor Summary

      Constructors 
      Constructor Description
      Stage2Haps​(PhaseData phaseData)
      Constructs a new Stage2Haps instance from the specified data.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      FixedPhaseData fpd()
      Returns the input data for phasing that is the same in each iteration.
      void setPhasedGT​(int marker, int sample, int a1, int a2)
      Sets the phased genotype if the specified marker was not phased in the first stage.
      BasicGT toBasicGT​(int start, int end)
      Returns a BasicGT instance containing phased genotypes for the specified markers.
      GTRec[] toGTRecs​(int start, int end)
      Returns a GTRec[] instance containing phased genotypes for the specified markers.
      • Methods inherited from class java.lang.Object

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

      • Stage2Haps

        public Stage2Haps​(PhaseData phaseData)
        Constructs a new Stage2Haps instance from the specified data.
        Parameters:
        phaseData - the current genotype phase estimates and parameter values
        Throws:
        java.lang.NullPointerException - if phaseData == null
    • Method Detail

      • fpd

        public FixedPhaseData fpd()
        Returns the input data for phasing that is the same in each iteration.
        Returns:
        the input data for phasing that is the same in each iteration
      • setPhasedGT

        public void setPhasedGT​(int marker,
                                int sample,
                                int a1,
                                int a2)
        Sets the phased genotype if the specified marker was not phased in the first stage. The contract for this method is unspecified if the specified alleles are inconsistent with this.fpd().targGT().
        Parameters:
        sample - a sample index
        marker - a marker index
        a1 - the first allele index
        a2 - the second allele index
        Throws:
        java.lang.IndexOutOfBoundsException - if marker < 0 || marker >= this.fpd().targGT().markers().size()
        java.lang.IndexOutOfBoundsException - if sample < 0 || sample >= this.fpd().targGT().samples().size()
        java.lang.IndexOutOfBoundsException - if a1 < 0 || a1 >= this.fpd().targGT().markers().marker(marker).nAlleles()
        java.lang.IndexOutOfBoundsException - if a2 < 0 || a2 >= this.fpd().targGT().markers().marker(marker).nAlleles()
      • toBasicGT

        public BasicGT toBasicGT​(int start,
                                 int end)
        Returns a BasicGT instance containing phased genotypes for the specified markers.
        Parameters:
        start - the starting marker index (inclusive)
        end - the ending marker index (exclusive)
        Returns:
        a BasicGT instance containing phased genotypes for the specified range of marker indices
        Throws:
        java.lang.IndexOutOfBoundsException - if start < 0 || end > this.nMarkers()
        java.lang.IllegalArgumentException - if start >= end
      • toGTRecs

        public GTRec[] toGTRecs​(int start,
                                int end)
        Returns a GTRec[] instance containing phased genotypes for the specified markers.
        Parameters:
        start - the starting marker index (inclusive)
        end - the ending marker index (exclusive)
        Returns:
        a GTRec[] instance containing phased genotypes for the specified range of marker indices
        Throws:
        java.lang.IndexOutOfBoundsException - if start < 0 || end > this.nMarkers()
        java.lang.IllegalArgumentException - if start >= end