/** 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); }
/** 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); }
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); } } } }
/** Query database and find results matching 'variant' */ protected Collection<VariantVcfEntry> query(Variant variant) { // Query database Collection<VariantVcfEntry> results = dbVcf.query(variant); // Filter results to match 'variant' List<VariantVcfEntry> list = new LinkedList<>(); for (VariantVcfEntry dbEntry : results) { if (match(variant, dbEntry)) { if (debug) Gpr.debug("dbEntry matches query\tvariant: " + variant + "\tdbEntry: " + dbEntry); list.add(dbEntry); } else { if (debug) Gpr.debug("dbEntry does NOT match query\tvariant: " + variant + "\tdbEntry: " + dbEntry); } } if (debug) Gpr.debug("Match query results: " + list.size()); return list; }
public void setVerbose(boolean verbose) { this.verbose = verbose; dbVcf.setVerbose(verbose); }
public void setDebug(boolean debug) { this.debug = debug; dbVcf.setDebug(debug); }
public void open() { dbVcf.open(); discoverInfoFields(); }
public void close() { dbVcf.close(); }