Exemple #1
0
  /** Is 'fieldName' a per-allele annotation */
  boolean isVcfInfoPerAllele(String fieldName) {
    // Look up information and cache it
    if (vcfInfoPerAllele.get(fieldName) == null) {
      VcfHeaderInfo vcfInfo = dbVcf.getVcfHeader().getVcfInfo(fieldName);
      boolean isPerAllele =
          vcfInfo != null && (vcfInfo.isNumberOnePerAllele() || vcfInfo.isNumberAllAlleles());
      vcfInfoPerAllele.put(fieldName, isPerAllele);
    }

    return vcfInfoPerAllele.get(fieldName);
  }
Exemple #2
0
  /** Is this a "per-allele + REF" INFO field? */
  boolean isVcfInfoPerAlleleRef(String fieldName) {
    // Look up information and cache it
    if (vcfInfoPerAlleleRef.get(fieldName) == null) {
      VcfHeaderInfo vcfInfo = dbVcf.getVcfHeader().getVcfInfo(fieldName);
      boolean isPerAlleleRef = (vcfInfo != null && vcfInfo.isNumberAllAlleles());
      vcfInfoPerAlleleRef.put(fieldName, isPerAlleleRef);

      hasVcfInfoPerAlleleRef |=
          isPerAlleleRef; // Do we have any INFO field requiring 'REF' annotation?
    }

    return vcfInfoPerAlleleRef.get(fieldName);
  }
Exemple #3
0
  protected void discoverInfoFields() {
    if (infoFields == null) infoFields = new HashSet<String>();

    // Discover some INFO fields
    if (!useAllInfoFields) return;

    // Find INFO form VcfHeader
    if (dbVcf != null && dbVcf.getVcfHeader() != null) {
      for (VcfHeaderInfo vcfInfo : dbVcf.getVcfHeader().getVcfInfo()) {

        // Don't add implicit fields at this stage
        // Note: They are added if they are found in a VCF entry later
        if (!vcfInfo.isImplicit()) {
          String infoFieldName = vcfInfo.getId();
          infoFields.add(infoFieldName);

          // Cache values for future use
          isVcfInfoPerAllele(infoFieldName);
          isVcfInfoPerAlleleRef(infoFieldName);
        }
      }
    }
  }