AlleleProtoAdaptor { private static ClinVarData parseClinVarData(ClinVar clinVar) { if (clinVar.equals(clinVar.getDefaultInstanceForType())) { return ClinVarData.empty(); } ClinVarData.Builder builder = ClinVarData.builder(); builder.alleleId(clinVar.getAlleleId()); builder.primaryInterpretation(toClinSig(clinVar.getPrimaryInterpretation())); builder.secondaryInterpretations(toClinSigSet(clinVar.getSecondaryInterpretationsList())); builder.includedAlleles(getToIncludedAlleles(clinVar.getIncludedAllelesMap())); builder.reviewStatus(clinVar.getReviewStatus()); return builder.build(); } private  AlleleProtoAdaptor(); static AlleleKey toAlleleKey(Variant variant); static FrequencyData toFrequencyData(AlleleProperties alleleProperties); static PathogenicityData toPathogenicityData(AlleleProperties alleleProperties);  }
@Test public void parseClinVarData() { ClinVar clinVar = ClinVar.newBuilder() .setAlleleId("12345") .setPrimaryInterpretation(ClinVar.ClinSig.CONFLICTING_PATHOGENICITY_INTERPRETATIONS) .addSecondaryInterpretations(ClinVar.ClinSig.PATHOGENIC_OR_LIKELY_PATHOGENIC) .addSecondaryInterpretations(ClinVar.ClinSig.UNCERTAIN_SIGNIFICANCE) .addSecondaryInterpretations(ClinVar.ClinSig.BENIGN_OR_LIKELY_BENIGN) .addSecondaryInterpretations(ClinVar.ClinSig.BENIGN) .putIncludedAlleles("54321", ClinVar.ClinSig.ASSOCIATION) .setReviewStatus("conflicting evidence") .build(); AlleleProperties alleleProperties = AlleleProperties.newBuilder().setClinVar(clinVar).build(); ClinVarData expected = ClinVarData.builder() .alleleId("12345") .primaryInterpretation(ClinVarData.ClinSig.CONFLICTING_PATHOGENICITY_INTERPRETATIONS) .secondaryInterpretations(EnumSet.of( ClinVarData.ClinSig.PATHOGENIC_OR_LIKELY_PATHOGENIC, ClinVarData.ClinSig.UNCERTAIN_SIGNIFICANCE, ClinVarData.ClinSig.BENIGN_OR_LIKELY_BENIGN, ClinVarData.ClinSig.BENIGN)) .includedAlleles(ImmutableMap.of("54321", ClinVarData.ClinSig.ASSOCIATION)) .reviewStatus("conflicting evidence") .build(); assertThat(AlleleProtoAdaptor.toPathogenicityData(alleleProperties), equalTo(PathogenicityData.of(expected))); }