private List<SnpEffEffect> parseSnpEffRecord(VariantContext snpEffRecord) { List<SnpEffEffect> parsedEffects = new ArrayList<SnpEffEffect>(); Object effectFieldValue = snpEffRecord.getAttribute(SNPEFF_INFO_FIELD_KEY); if (effectFieldValue == null) { return parsedEffects; } // The VCF codec stores multi-valued fields as a List<String>, and single-valued fields as a // String. // We can have either in the case of SnpEff, since there may be one or more than one effect in // this record. List<String> individualEffects; if (effectFieldValue instanceof List) { individualEffects = (List<String>) effectFieldValue; } else { individualEffects = Arrays.asList((String) effectFieldValue); } for (String effectString : individualEffects) { String[] effectNameAndMetadata = effectString.split(SNPEFF_EFFECT_METADATA_DELIMITER); if (effectNameAndMetadata.length != 2) { logger.warn( String.format( "Malformed SnpEff effect field at %s:%d, skipping: %s", snpEffRecord.getChr(), snpEffRecord.getStart(), effectString)); continue; } String effectName = effectNameAndMetadata[0]; String[] effectMetadata = effectNameAndMetadata[1].split(SNPEFF_EFFECT_METADATA_SUBFIELD_DELIMITER, -1); SnpEffEffect parsedEffect = new SnpEffEffect(effectName, effectMetadata); if (parsedEffect.isWellFormed()) { parsedEffects.add(parsedEffect); } else { logger.warn( String.format( "Skipping malformed SnpEff effect field at %s:%d. Error was: \"%s\". Field was: \"%s\"", snpEffRecord.getChr(), snpEffRecord.getStart(), parsedEffect.getParseError(), effectString)); } } return parsedEffects; }