private Document convertScoreToStorage(Score score) { return convertScoreToStorage(score.getScore(), score.getSource(), score.getDescription()); }
private Score parseProteinSubstitutionScore(String predictorName, String scoreString) { String[] scoreFields = scoreString.split("[\\(\\)]"); return new Score(Double.valueOf(scoreFields[1]), predictorName, scoreFields[0]); }
public Document convertScoreToStorageNoSource(Score score) { return convertScoreToStorage(score.getScore(), null, score.getDescription()); }
private Score getScore(List<Score> scores, String source) { if (ListUtils.isNotEmpty(scores) && StringUtils.isNotEmpty(source)) { for (Score score: scores) { if (source.equals(score.getSource())) { return score; } } } return null; } }
Score score = new Score(); score.setSource("sift"); if (StringUtils.isNotEmpty(fields[6])) { try { score.setScore(Double.parseDouble(fields[6])); } catch (NumberFormatException e) { logger.warn("Parsing Sift score: " + e.getMessage()); score.setDescription(fields[7]); scores.add(score); Score score = new Score(); score.setSource("polyphen"); if (StringUtils.isNotEmpty(fields[8])) { try { score.setScore(Double.parseDouble(fields[8])); } catch (NumberFormatException e) { logger.warn("Parsing Polyphen score: " + e.getMessage()); score.setDescription(fields[9]); scores.add(score); scores.add(new Score(variantSearchModel.getPhylop(), "phylop", "")); scores.add(new Score(variantSearchModel.getPhastCons(), "phastCons", "")); scores.add(new Score(variantSearchModel.getGerp(), "gerp", "")); scores.add(new Score(variantSearchModel.getCaddRaw(), "cadd_raw", ""));
break; scores.add(Score.newBuilder() .setScore(value) .setSource(dbObject.getString("source")) break; scores.add(Score.newBuilder() .setScore(value) .setSource(dbObject.getString("source"))
private long countScore(String source, QueryResult<Variant> variantQueryResult, Predicate<Double> doublePredicate, Function<VariantAnnotation, List<Score>> mapper) { return countScore(variantQueryResult, scores -> scores.stream().anyMatch(score -> score.getSource().equalsIgnoreCase(source) && doublePredicate.test(score.getScore())), mapper); }
private Score getScore(List<Score> scores, String source) { if (ListUtils.isNotEmpty(scores) && org.apache.commons.lang3.StringUtils.isNotEmpty(source)) { for (Score score: scores) { if (source.equals(score.getSource())) { return score; } } } return null; }
private void checkScore(List<Score> inScores, List<Score> outScores, String source) { Score inScore = getScore(inScores, source); Score outScore = getScore(outScores, source); if (inScore != null && outScore != null) { double inValue = inScore.getScore() == null ? 0 : inScore.getScore(); double outValue = outScore.getScore() == null ? 0 : outScore.getScore(); String inDescription = inScore.getDescription() == null ? "" : inScore.getDescription(); String outDescription = outScore.getDescription() == null ? "" : outScore.getDescription(); System.out.println(source + ": " + inValue + " vs " + outValue + " ; " + inDescription + " vs " + outDescription); } else if (inScore != null || outScore != null) { fail("Mismatchtch " + source + " values"); } } }
break; scores.add(Score.newBuilder() .setScore(value) .setSource(dbObject.getString("source")) break; scores.add(Score.newBuilder() .setScore(value) .setSource(dbObject.getString("source"))
public static VariantAnnotationProto.Score createVariantAnnotationScore(Score score) { VariantAnnotationProto.Score.Builder builder = VariantAnnotationProto.Score.newBuilder() .setScore(score.getScore()) .setSource(score.getSource()) .setDescription(score.getDescription()); return builder.build(); } }
((Predicate<List<Score>>) scores -> scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("gerp") && s.getScore() <= 0.5)) .or(scores -> scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("phastCons") && s.getScore() < 0.5)), VariantAnnotation::getConservation); ((Predicate<List<Score>>) scores -> scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("gerp") && s.getScore() <= 0.5)) .and(scores -> scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("phastCons") && s.getScore() < 0.5)), VariantAnnotation::getConservation); scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("gerp") && s.getScore() < 0.5) || scores.stream().noneMatch(s -> s.getSource().equalsIgnoreCase("gerp")), VariantAnnotation::getConservation); scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("phastCons") && s.getScore() >= 0.5) || scores.stream().noneMatch(s -> s.getSource().equalsIgnoreCase("phastCons")), VariantAnnotation::getConservation); scores -> (scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("gerp") && s.getScore() <= 0.5) || scores.stream().noneMatch(s -> s.getSource().equalsIgnoreCase("gerp"))) && scores.stream().anyMatch(s -> s.getSource().equalsIgnoreCase("phastCons") && s.getScore() < 0.5), VariantAnnotation::getConservation);
if (consequenceType.getProteinVariantAnnotation().getSubstitutionScores() != null) { List<String> sift = consequenceType.getProteinVariantAnnotation().getSubstitutionScores().stream() .filter(t -> t.getSource().equalsIgnoreCase("sift")) .map(Score::getDescription) .collect(Collectors.toList()); .filter(t -> t.getSource().equalsIgnoreCase("polyphen")) .map(Score::getDescription) .collect(Collectors.toList());
private List<Score> getSubstitutionScores(TranscriptVariation transcriptVariation) { List<Score> substitionScores = null; if (transcriptVariation.getPolyphenScore() != null) { substitionScores = new ArrayList<>(); substitionScores.add(new Score((double) transcriptVariation.getPolyphenScore(), "Polyphen", null)); } if (transcriptVariation.getSiftScore() != null) { if (substitionScores == null) { substitionScores = new ArrayList<>(); } substitionScores.add(new Score((double) transcriptVariation.getSiftScore(), "Sift", null)); } return substitionScores; }
&& consequenceType.getProteinVariantAnnotation().getSubstitutionScores() != null) { for (Score score : consequenceType.getProteinVariantAnnotation().getSubstitutionScores()) { String source = score.getSource(); if (("sift").equals(source)) { if (score.getScore() < sift) { sift = score.getScore(); siftDesc = score.getDescription(); if (score.getScore() > polyphen) { polyphen = score.getScore(); polyphenDesc = score.getDescription();
double gerp = Double.MIN_VALUE; for (Score score: consequenceType.getProteinVariantAnnotation().getSubstitutionScores()) { switch (score.getSource()) { case "sift": sift = score.getScore(); break; case "polyphen": polyphen = score.getScore(); break; if ("cadd_scaled".equals(score.getSource())) { scaledCadd = score.getScore(); break; if ("gerp".equals(score.getSource())) { gerp = score.getScore(); break;
if (variant.getAnnotation().getConservation() != null) { List<Double> phastCons = variant.getAnnotation().getConservation().stream() .filter(t -> t.getSource().equalsIgnoreCase("phastCons")) .map(Score::getScore) .collect(Collectors.toList()); if (variant.getAnnotation().getConservation() != null) { List<Double> phylop = variant.getAnnotation().getConservation().stream() .filter(t -> t.getSource().equalsIgnoreCase("phylop")) .map(Score::getScore) .collect(Collectors.toList()); && consequenceType.getProteinVariantAnnotation().getSubstitutionScores() != null) { List<Double> sift = consequenceType.getProteinVariantAnnotation().getSubstitutionScores().stream() .filter(t -> t.getSource().equalsIgnoreCase("sift")) .map(Score::getScore) .collect(Collectors.toList()); && consequenceType.getProteinVariantAnnotation().getSubstitutionScores() != null) { List<Double> polyphen = consequenceType.getProteinVariantAnnotation().getSubstitutionScores().stream() .filter(t -> t.getSource().equalsIgnoreCase("polyphen")) .map(Score::getScore) .collect(Collectors.toList());
private Score buildScore(String source, Document document) { return new Score( getDefault(document, SCORE_SCORE_FIELD, 0.0), getDefault(document, SCORE_SOURCE_FIELD, source), getDefault(document, SCORE_DESCRIPTION_FIELD, (String) null) ); }
if (proteinVariantAnnotation.getSubstitutionScores() != null) { for (Score score : proteinVariantAnnotation.getSubstitutionScores()) { if (score.getSource().equalsIgnoreCase("sift")) { addNotNull(sift, score.getScore()); addNotNull(siftDesc, score.getDescription()); } else if (score.getSource().equalsIgnoreCase("polyphen")) { addNotNull(polyphen, score.getScore()); addNotNull(polyphenDesc, score.getDescription()); PhoenixHelper.Column column = VariantPhoenixHelper.getConservationScoreColumn(score.getSource()); map.put(column, score.getScore()); PhoenixHelper.Column column = VariantPhoenixHelper.getFunctionalScoreColumn(score.getSource()); map.put(column, score.getScore());