Skip to content

Commit

Permalink
Read json from config
Browse files Browse the repository at this point in the history
  • Loading branch information
leexgh committed Jul 20, 2023
1 parent ce3698f commit 165bce0
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import org.cbioportal.genome_nexus.service.remote.RevueDataFetcher;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.io.IOException;
Expand Down Expand Up @@ -48,6 +49,7 @@ public class VariantAnnotationSummaryServiceImpl implements VariantAnnotationSum
private final VariantTypeResolver variantTypeResolver;
private final ExonResolver exonResolver;
private final Map<String, Vues> vuesMap;
private final Boolean overwriteByConfirmedRevueOnly;

@Autowired
public VariantAnnotationSummaryServiceImpl(
Expand All @@ -67,7 +69,9 @@ public VariantAnnotationSummaryServiceImpl(
TranscriptIdResolver transcriptIdResolver,
VariantClassificationResolver variantClassificationResolver,
VariantTypeResolver variantTypeResolver,
ExonResolver exonResolver
ExonResolver exonResolver,
@Value("${revue.url}") String vuesUrl,
@Value("${overwrite_by_confirmed_revue_only}") String overwriteByConfirmedRevueOnlyValue
) throws IOException {
this.variantAnnotationService = verifiedHgvsVariantAnnotationService;
this.ensemblService = ensemblService;
Expand All @@ -86,7 +90,8 @@ public VariantAnnotationSummaryServiceImpl(
this.variantClassificationResolver = variantClassificationResolver;
this.variantTypeResolver = variantTypeResolver;
this.exonResolver = exonResolver;
this.vuesMap = this.buildVuesMap(RevueDataFetcher.getRevueData());
this.vuesMap = this.buildVuesMap(RevueDataFetcher.getRevueData(vuesUrl));
this.overwriteByConfirmedRevueOnly = Boolean.parseBoolean(overwriteByConfirmedRevueOnlyValue);
}

@Override
Expand Down Expand Up @@ -285,16 +290,17 @@ private TranscriptConsequenceSummary getTranscriptSummary(VariantAnnotation anno
summary.setSiftPrediction(transcriptConsequence.getSiftPrediction());
summary.setSiftScore(transcriptConsequence.getSiftScore());

// If transcript id and variant id match one of the record in vuesMap
// AND it's confirmed VUE
// replace variantClassification, hgvspShort and proteinPosition to the value from vuesMap, set isVue to true
// Check if transcript id and variant id match one of the record in vuesMap
// If overwriteByConfirmedRevueOnly is true, replace variantClassification, hgvspShort and proteinPosition to the value from vuesMap for confirmed VUE
// If overwriteByConfirmedRevueOnly is false, replace variantClassification, hgvspShort and proteinPosition to the value from vuesMap for both confirmed and unconfirmed VUE
Vues vue = vuesMap.get(transcriptConsequence.getTranscriptId() + "-" + annotation.getVariant());
if (vue != null && vue.getConfirmed() == true)
{
summary.setVariantClassification(vue.getRevisedVariantClassification());
summary.setHgvspShort(vue.getRevisedProteinEffect());
summary.setProteinPosition(this.proteinPositionResolver.extractProteinPos(vue.getRevisedProteinEffect()));
summary.setIsVue(true);
if (vue != null) {
if ((overwriteByConfirmedRevueOnly == true && vue.getConfirmed()== true) || overwriteByConfirmedRevueOnly == false) {
summary.setVariantClassification(vue.getRevisedVariantClassification());
summary.setHgvspShort(vue.getRevisedProteinEffect());
summary.setProteinPosition(this.proteinPositionResolver.extractProteinPos(vue.getRevisedProteinEffect()));
summary.setIsVue(true);
}
}

if (transcriptConsequence.getTranscriptId() != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package org.cbioportal.genome_nexus.service.remote;

import org.cbioportal.genome_nexus.model.VuesJsonRecord;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
Expand All @@ -9,9 +10,7 @@
@Component
public class RevueDataFetcher {

private static final String revueUrl = "https://raw.githubusercontent.com/knowledgesystems/reVUE-data/main/VUEs.json";

public static VuesJsonRecord[] getRevueData() {
public static VuesJsonRecord[] getRevueData(String revueUrl) {
RestTemplate restTemplate = new RestTemplate();
// Fetch the JSON data
ResponseEntity<String> response = restTemplate.getForEntity(revueUrl, String.class);
Expand Down
4 changes: 4 additions & 0 deletions web/src/main/resources/application.properties.EXAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,7 @@ oncokb.url=https://www.oncokb.org/api/v1/annotate/mutations/byProteinChange?PROT
# For testing use same embeded mongo version as genome-nexus-importer
# https://github.com/genome-nexus/genome-nexus-importer/blob/master/Dockerfile#L1
spring.mongodb.embedded.version=3.6.2

# reVUE data version and setting
revue.url=https://raw.githubusercontent.com/knowledgesystems/reVUE-data/main/VUEs.json
overwrite_by_confirmed_revue_only=true

0 comments on commit 165bce0

Please sign in to comment.