예제 #1
0
  /**
   * Is this entry heterozygous?
   *
   * <p>Infer Hom/Her if there is only one sample in the file. Ohtherwise the field is null.
   */
  public Boolean calcHetero() {
    // No genotyping information? => Use number of ALT field
    if (genotypeFieldsStr == null) return isMultiallelic();

    Boolean isHetero = null;

    // No genotype fields => Parse fields (we only parse them if there is only one GT field)
    if (genotypeFields == null) {

      // Are there more than two tabs? (i.e. more than one format field + one genotype field)
      int countFields, fromIndex;
      for (countFields = 0, fromIndex = 0;
          (fromIndex >= 0) && (countFields < 1);
          countFields++, fromIndex++) fromIndex = genotypeFieldsStr.indexOf('\t', fromIndex);

      // OK only one genotype field => Parse it in order to extract h**o info.
      if (countFields == 1) parseGenotypes();
    }

    // OK only one genotype field => calculate if it is heterozygous
    if ((genotypeFields != null) && (genotypeFields.length == 1))
      isHetero = getVcfGenotype(0).isHeterozygous();

    return isHetero;
  }
예제 #2
0
 public List<VcfGenotype> getVcfGenotypes() {
   if (vcfGenotypes == null) parseGenotypes();
   return vcfGenotypes;
 }