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; } }
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 Document convertScoreToStorage(Score score) { return convertScoreToStorage(score.getScore(), score.getSource(), score.getDescription()); }
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); }
public void checkScore(Query query, Predicate<Double> doublePredicate, String source, Function<VariantAnnotation, List<Score>> mapper) { checkScore(query, scores -> scores.stream().anyMatch(score -> score.getSource().equalsIgnoreCase(source) && doublePredicate.test(score.getScore())), mapper); }
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());
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());
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());
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);
@Override protected Iterable<T> featureValueOf(VariantAnnotation actual) { if (actual.getConsequenceTypes() != null) { Set<T> set = new HashSet<>(); for (ConsequenceType ct : actual.getConsequenceTypes()) { if (ct != null && ct.getProteinVariantAnnotation() != null && ct.getProteinVariantAnnotation().getSubstitutionScores() != null) { for (Score score : ct.getProteinVariantAnnotation().getSubstitutionScores()) { if (score != null && source.equals(score.getSource())) { set.add(mapper.apply(score)); } } } } return set; } return Collections.emptyList(); } };
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());
double gerp = Double.MIN_VALUE; for (Score score: consequenceType.getProteinVariantAnnotation().getSubstitutionScores()) { switch (score.getSource()) { case "sift": sift = score.getScore(); if ("cadd_scaled".equals(score.getSource())) { scaledCadd = score.getScore(); break; if ("gerp".equals(score.getSource())) { gerp = score.getScore(); break;
switch (score.getSource()) { case "phastCons": variantSearchModel.setPhastCons(score.getScore()); break; default: logger.warn("Unknown 'conservation' source: score.getSource() = " + score.getSource()); break; switch (score.getSource()) { case "cadd_raw": case "caddRaw": break; default: logger.warn("Unknown 'functional score' source: score.getSource() = " + score.getSource()); break;
.anyMatch(s -> s.getSource().equalsIgnoreCase("cadd_scaled") && s.getScore() < 0.5)) .or(List::isEmpty), VariantAnnotation::getFunctionalScore); .anyMatch(s -> s.getSource().equalsIgnoreCase("cadd_scaled") && s.getScore() <= 0.5)) .or(List::isEmpty), VariantAnnotation::getFunctionalScore); .anyMatch(s -> s.getSource().equalsIgnoreCase("cadd_raw") && s.getScore() > 0.5)) .or(List::isEmpty), VariantAnnotation::getFunctionalScore); .anyMatch(s -> s.getSource().equalsIgnoreCase("cadd_raw") && s.getScore() >= 0.5)) .or(List::isEmpty), VariantAnnotation::getFunctionalScore);
&& consequenceType.getProteinVariantAnnotation().getSubstitutionScores() != null) { for (Score score : consequenceType.getProteinVariantAnnotation().getSubstitutionScores()) { String source = score.getSource(); if (("sift").equals(source)) { if (score.getScore() < sift) {
for (Score score : proteinVariantAnnotation.getSubstitutionScores()) { if (score != null) { if (score.getSource().equals(POLYPHEN)) { putNotNull(ct, CT_PROTEIN_POLYPHEN_FIELD, convertScoreToStorageNoSource(score)); } else if (score.getSource().equals(SIFT)) { putNotNull(ct, CT_PROTEIN_SIFT_FIELD, convertScoreToStorageNoSource(score)); } else { for (Score score : variantAnnotation.getConservation()) { if (score != null) { if (score.getSource().equals(PHYLOP)) { putNotNull(document, CONSERVED_REGION_PHYLOP_FIELD, convertScoreToStorageNoSource(score)); } else if (score.getSource().equals(PHAST_CONS)) { putNotNull(document, CONSERVED_REGION_PHASTCONS_FIELD, convertScoreToStorageNoSource(score)); } else if (score.getSource().equals(GERP)) { putNotNull(document, CONSERVED_REGION_GERP_FIELD, convertScoreToStorageNoSource(score)); } else { for (Score score : variantAnnotation.getFunctionalScore()) { if (score != null) { if (score.getSource().equals(CADD_RAW)) { putNotNull(document, FUNCTIONAL_CADD_RAW_FIELD, convertScoreToStorageNoSource(score)); } else if (score.getSource().equals(CADD_SCALED)) { putNotNull(document, FUNCTIONAL_CADD_SCALED_FIELD, convertScoreToStorageNoSource(score)); } else {