/** Annotate a VCF entry */ public boolean annotate(Variant variant, Map<String, String> info) { if (verbose) Gpr.showMark(++countVariants, SHOW_EVERY); // Find in database Collection<DbNsfpEntry> dbEntries = dbNsfp.query(variant); if (dbEntries == null || dbEntries.isEmpty()) return false; // Add all INFO fields that refer to this allele boolean annotated = false; for (String fieldKey : fieldsToAdd.keySet()) { // Are there any values to annotate? String infoValue = getVcfInfo(dbEntries, fieldKey); // Missing or empty? if (annotateEmpty) { if (infoValue.isEmpty()) infoValue = "."; } else if (isDbNsfpValueEmpty(infoValue)) { infoValue = null; } // Add annotations if (infoValue != null) { String oldInfo = info.get(fieldKey); if (oldInfo == null) oldInfo = ""; info.put(fieldKey, oldInfo + (oldInfo.isEmpty() ? "" : ",") + infoValue); annotated = true; } } // Show progress if (annotated) { countAnnotated++; if (debug) Gpr.debug("Annotated: " + variant.toStr()); } return annotated; }