コード例 #1
0
  /** Add some lines to header before showing it */
  @Override
  public boolean addHeaders(VcfFileIterator vcfFile) {
    super.addHeaders(vcfFile);
    for (String key : fieldsToAdd.keySet()) {
      // Get type
      String type = fieldsType.get(key);
      if (type == null) {
        System.err.println("WARNING: Cannot find type for field '" + key + "', using 'String'.");
        type = VcfInfoType.String.toString();
      }

      String infoKey = VcfEntry.vcfInfoKeySafe(DBNSFP_VCF_INFO_PREFIX + key);
      vcfFile
          .getVcfHeader()
          .addLine(
              "##INFO=<ID="
                  + infoKey
                  + ",Number=A,Type="
                  + type
                  + ",Description=\""
                  + fieldsToAdd.get(key)
                  + "\">");
    }

    return false;
  }
コード例 #2
0
  @Override
  public boolean annotate(VcfEntry vcfEntry) {
    boolean annotated = false;
    Map<String, String> info = new HashMap<>();

    // Find annotations for each variant in this VcfEntry
    for (Variant var : vcfEntry.variants()) annotated |= annotate(var, info);

    // Add annotations to VcfEntry
    if (annotated) {
      // Sort keys and add them to VcfEntry
      ArrayList<String> keys = new ArrayList<>();
      keys.addAll(info.keySet());
      Collections.sort(keys);

      // Add INFO fields
      for (String key : keys) {
        String infoKey = VcfEntry.vcfInfoKeySafe(DBNSFP_VCF_INFO_PREFIX + key);
        vcfEntry.addInfo(infoKey, info.get(key));
      }
    }

    return annotated;
  }