Example #1
0
  void checkVarTypeField(String file, String varTypeExpected) {
    SnpSiftCmdVarType varType = new SnpSiftCmdVarType(null);

    VcfFileIterator vcf = new VcfFileIterator(file);
    for (VcfEntry ve : vcf) {
      // Annotate
      varType.annotate(ve);

      // Check that all variants are the ones expected
      String varTypeAnnotated = ve.getInfo(SnpSiftCmdVarType.VARTYPE);
      Assert.assertEquals(varTypeExpected, varTypeAnnotated);
    }
  }
Example #2
0
  /** Fill values for INFO fields requiring 'REF' value */
  protected void findDbInfoRef(Map<String, String> info, Set<VcfEntry> uniqueVcfEntries) {
    if (!useInfoFields || !hasVcfInfoPerAlleleRef) return; // Nothing to do

    for (String infoFieldName : infoFields) {
      // Does this field require 'REF' annotation?
      if (!isVcfInfoPerAlleleRef(infoFieldName)) continue;

      // Try to find 'REF' information in any entry
      String val = null;
      for (VcfEntry dbVcfEntry : uniqueVcfEntries) {
        val = dbVcfEntry.getInfo(infoFieldName, dbVcfEntry.getRef());

        if (VcfEntry.isEmpty(val)) val = null; // Only add non-empty
        else break; // We need only one value
      }

      // Nothing found? Use 'MISSING' value
      if (val == null) val = VcfFileIterator.MISSING;

      // Store value
      info.put(infoFieldName, val);
    }
  }