Example #1
0
 @Override
 public List<String> getKeyNames() {
   return Arrays.asList(
       InfoFieldKey.EFFECT_KEY.getKeyName(),
       InfoFieldKey.IMPACT_KEY.getKeyName(),
       InfoFieldKey.FUNCTIONAL_CLASS_KEY.getKeyName(),
       InfoFieldKey.CODON_CHANGE_KEY.getKeyName(),
       InfoFieldKey.AMINO_ACID_CHANGE_KEY.getKeyName(),
       InfoFieldKey.GENE_NAME_KEY.getKeyName(),
       InfoFieldKey.GENE_BIOTYPE_KEY.getKeyName(),
       InfoFieldKey.TRANSCRIPT_ID_KEY.getKeyName(),
       InfoFieldKey.EXON_ID_KEY.getKeyName());
 }
Example #2
0
 @Override
 public List<VCFInfoHeaderLine> getDescriptions() {
   return Arrays.asList(
       new VCFInfoHeaderLine(
           InfoFieldKey.EFFECT_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "The highest-impact effect resulting from the current variant (or one of the highest-impact effects, if there is a tie)"),
       new VCFInfoHeaderLine(
           InfoFieldKey.IMPACT_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Impact of the highest-impact effect resulting from the current variant "
               + Arrays.toString(EffectImpact.values())),
       new VCFInfoHeaderLine(
           InfoFieldKey.FUNCTIONAL_CLASS_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Functional class of the highest-impact effect resulting from the current variant: "
               + Arrays.toString(EffectFunctionalClass.values())),
       new VCFInfoHeaderLine(
           InfoFieldKey.CODON_CHANGE_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Old/New codon for the highest-impact effect resulting from the current variant"),
       new VCFInfoHeaderLine(
           InfoFieldKey.AMINO_ACID_CHANGE_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Old/New amino acid for the highest-impact effect resulting from the current variant (in HGVS style)"),
       new VCFInfoHeaderLine(
           InfoFieldKey.GENE_NAME_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Gene name for the highest-impact effect resulting from the current variant"),
       new VCFInfoHeaderLine(
           InfoFieldKey.GENE_BIOTYPE_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Gene biotype for the highest-impact effect resulting from the current variant"),
       new VCFInfoHeaderLine(
           InfoFieldKey.TRANSCRIPT_ID_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Transcript ID for the highest-impact effect resulting from the current variant"),
       new VCFInfoHeaderLine(
           InfoFieldKey.EXON_ID_KEY.getKeyName(),
           1,
           VCFHeaderLineType.String,
           "Exon ID for the highest-impact effect resulting from the current variant"));
 }
Example #3
0
    public Map<String, Object> getAnnotations() {
      Map<String, Object> annotations =
          new LinkedHashMap<String, Object>(Utils.optimumHashSize(InfoFieldKey.values().length));

      addAnnotation(annotations, InfoFieldKey.EFFECT_KEY.getKeyName(), effect.toString());
      addAnnotation(annotations, InfoFieldKey.IMPACT_KEY.getKeyName(), impact.toString());
      addAnnotation(
          annotations, InfoFieldKey.FUNCTIONAL_CLASS_KEY.getKeyName(), functionalClass.toString());
      addAnnotation(annotations, InfoFieldKey.CODON_CHANGE_KEY.getKeyName(), codonChange);
      addAnnotation(annotations, InfoFieldKey.AMINO_ACID_CHANGE_KEY.getKeyName(), aminoAcidChange);
      addAnnotation(annotations, InfoFieldKey.GENE_NAME_KEY.getKeyName(), geneName);
      addAnnotation(annotations, InfoFieldKey.GENE_BIOTYPE_KEY.getKeyName(), geneBiotype);
      addAnnotation(annotations, InfoFieldKey.TRANSCRIPT_ID_KEY.getKeyName(), transcriptID);
      addAnnotation(annotations, InfoFieldKey.EXON_ID_KEY.getKeyName(), exonID);

      return annotations;
    }
Example #4
0
    private void parseEffectMetadata(String[] effectMetadata) {
      if (effectMetadata.length != EXPECTED_NUMBER_OF_METADATA_FIELDS) {
        if (effectMetadata.length == NUMBER_OF_METADATA_FIELDS_UPON_EITHER_WARNING_OR_ERROR) {
          parseError(
              String.format(
                  "SnpEff issued the following warning or error: \"%s\"",
                  effectMetadata[SNPEFF_WARNING_OR_ERROR_FIELD_UPON_SINGLE_ERROR]));
        } else if (effectMetadata.length == NUMBER_OF_METADATA_FIELDS_UPON_BOTH_WARNING_AND_ERROR) {
          parseError(
              String.format(
                  "SnpEff issued the following warning: \"%s\", and the following error: \"%s\"",
                  effectMetadata[SNPEFF_WARNING_FIELD_UPON_BOTH_WARNING_AND_ERROR],
                  effectMetadata[SNPEFF_ERROR_FIELD_UPON_BOTH_WARNING_AND_ERROR]));
        } else {
          parseError(
              String.format(
                  "Wrong number of effect metadata fields. Expected %d but found %d",
                  EXPECTED_NUMBER_OF_METADATA_FIELDS, effectMetadata.length));
        }

        return;
      }

      // The impact field will never be empty, and should always contain one of the enumerated
      // values:
      try {
        impact = EffectImpact.valueOf(effectMetadata[InfoFieldKey.IMPACT_KEY.getFieldIndex()]);
      } catch (IllegalArgumentException e) {
        parseError(
            String.format(
                "Unrecognized value for effect impact: %s",
                effectMetadata[InfoFieldKey.IMPACT_KEY.getFieldIndex()]));
      }

      // The functional class field will be empty when the effect has no functional class associated
      // with it:
      if (effectMetadata[InfoFieldKey.FUNCTIONAL_CLASS_KEY.getFieldIndex()].trim().length() > 0) {
        try {
          functionalClass =
              EffectFunctionalClass.valueOf(
                  effectMetadata[InfoFieldKey.FUNCTIONAL_CLASS_KEY.getFieldIndex()]);
        } catch (IllegalArgumentException e) {
          parseError(
              String.format(
                  "Unrecognized value for effect functional class: %s",
                  effectMetadata[InfoFieldKey.FUNCTIONAL_CLASS_KEY.getFieldIndex()]));
        }
      } else {
        functionalClass = EffectFunctionalClass.NONE;
      }

      codonChange = effectMetadata[InfoFieldKey.CODON_CHANGE_KEY.getFieldIndex()];
      aminoAcidChange = effectMetadata[InfoFieldKey.AMINO_ACID_CHANGE_KEY.getFieldIndex()];
      geneName = effectMetadata[InfoFieldKey.GENE_NAME_KEY.getFieldIndex()];
      geneBiotype = effectMetadata[InfoFieldKey.GENE_BIOTYPE_KEY.getFieldIndex()];

      // The coding field will be empty when SnpEff has no coding info for the effect:
      if (effectMetadata[SNPEFF_CODING_FIELD_INDEX].trim().length() > 0) {
        try {
          coding = EffectCoding.valueOf(effectMetadata[SNPEFF_CODING_FIELD_INDEX]);
        } catch (IllegalArgumentException e) {
          parseError(
              String.format(
                  "Unrecognized value for effect coding: %s",
                  effectMetadata[SNPEFF_CODING_FIELD_INDEX]));
        }
      } else {
        coding = EffectCoding.UNKNOWN;
      }

      transcriptID = effectMetadata[InfoFieldKey.TRANSCRIPT_ID_KEY.getFieldIndex()];
      exonID = effectMetadata[InfoFieldKey.EXON_ID_KEY.getFieldIndex()];
    }