Ejemplo n.º 1
0
  static boolean alleleSegregationIsKnown(Genotype gt1, Genotype gt2) {
    if (gt1.getPloidy() != gt2.getPloidy()) return false;

    /* If gt2 is phased or hom, then could even be MERGED with gt1 [This is standard].

      HOWEVER, EVEN if this is not the case, but gt1.isHom(),
      it is trivially known that each of gt2's alleles segregate with the single allele type present in gt1.
    */
    return (gt2.isPhased() || gt2.isHom() || gt1.isHom());
  }
  public static void assertEquals(final Genotype actual, final Genotype expected) {
    Assert.assertEquals(actual.getSampleName(), expected.getSampleName(), "Genotype names");
    Assert.assertEquals(actual.getAlleles(), expected.getAlleles(), "Genotype alleles");
    Assert.assertEquals(
        actual.getGenotypeString(), expected.getGenotypeString(), "Genotype string");
    Assert.assertEquals(actual.getType(), expected.getType(), "Genotype type");

    // filters are the same
    Assert.assertEquals(actual.getFilters(), expected.getFilters(), "Genotype fields");
    Assert.assertEquals(actual.isFiltered(), expected.isFiltered(), "Genotype isFiltered");

    // inline attributes
    Assert.assertEquals(actual.getDP(), expected.getDP(), "Genotype dp");
    Assert.assertTrue(Arrays.equals(actual.getAD(), expected.getAD()));
    Assert.assertEquals(actual.getGQ(), expected.getGQ(), "Genotype gq");
    Assert.assertEquals(actual.hasPL(), expected.hasPL(), "Genotype hasPL");
    Assert.assertEquals(actual.hasAD(), expected.hasAD(), "Genotype hasAD");
    Assert.assertEquals(actual.hasGQ(), expected.hasGQ(), "Genotype hasGQ");
    Assert.assertEquals(actual.hasDP(), expected.hasDP(), "Genotype hasDP");

    Assert.assertEquals(
        actual.hasLikelihoods(), expected.hasLikelihoods(), "Genotype haslikelihoods");
    Assert.assertEquals(
        actual.getLikelihoodsString(),
        expected.getLikelihoodsString(),
        "Genotype getlikelihoodsString");
    Assert.assertEquals(
        actual.getLikelihoods(), expected.getLikelihoods(), "Genotype getLikelihoods");
    Assert.assertTrue(Arrays.equals(actual.getPL(), expected.getPL()));

    Assert.assertEquals(
        actual.getPhredScaledQual(), expected.getPhredScaledQual(), "Genotype phredScaledQual");
    assertAttributesEquals(actual.getExtendedAttributes(), expected.getExtendedAttributes());
    Assert.assertEquals(actual.isPhased(), expected.isPhased(), "Genotype isPhased");
    Assert.assertEquals(actual.getPloidy(), expected.getPloidy(), "Genotype getPloidy");
  }