Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK-2017 #219

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class ClinicalVariant extends Variant {
private List<ClinicalComment> comments;
private Map<String, Object> filters;
private ClinicalDiscussion discussion;
private ClinicalVariantConfidence confidence;
private List<String> tags;

private Status status;
Expand All @@ -56,10 +57,11 @@ public ClinicalVariant() {
}

public ClinicalVariant(VariantAvro avro) {
this(avro, new ArrayList<>(), new ArrayList<>(), new HashMap<>(), new ClinicalDiscussion(), Status.NOT_REVIEWED,
new ArrayList<>(), new HashMap<>());
this(avro, new ArrayList<>(), new ArrayList<>(), new HashMap<>(), new ClinicalDiscussion(), null,
Status.NOT_REVIEWED, new ArrayList<>(), new HashMap<>());
}

@Deprecated
public ClinicalVariant(VariantAvro avro, List<ClinicalVariantEvidence> evidences, List<ClinicalComment> comments,
Map<String, Object> filters, ClinicalDiscussion discussion, Status status, List<String> tags,
Map<String, Object> attributes) {
Expand All @@ -74,13 +76,30 @@ public ClinicalVariant(VariantAvro avro, List<ClinicalVariantEvidence> evidences
this.attributes = attributes;
}

public ClinicalVariant(VariantAvro avro, List<ClinicalVariantEvidence> evidences, List<ClinicalComment> comments,
Map<String, Object> filters, ClinicalDiscussion discussion,
ClinicalVariantConfidence confidence, Status status, List<String> tags,
Map<String, Object> attributes) {
super(avro);

this.evidences = evidences;
this.comments = comments;
this.filters = filters;
this.discussion = discussion;
this.status = status;
this.tags = tags;
this.confidence = confidence;
this.attributes = attributes;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ClinicalVariant{");
sb.append("evidences=").append(evidences);
sb.append(", comments=").append(comments);
sb.append(", filters=").append(filters);
sb.append(", discussion=").append(discussion);
sb.append(", confidence=").append(confidence);
sb.append(", tags=").append(tags);
sb.append(", status=").append(status);
sb.append(", attributes=").append(attributes);
Expand Down Expand Up @@ -124,6 +143,15 @@ public ClinicalVariant setDiscussion(ClinicalDiscussion discussion) {
return this;
}

public ClinicalVariantConfidence getConfidence() {
return confidence;
}

public ClinicalVariant setConfidence(ClinicalVariantConfidence confidence) {
this.confidence = confidence;
return this;
}

public Status getStatus() {
return status;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.opencb.biodata.models.clinical.interpretation;

import org.opencb.biodata.models.constants.FieldConstants;
import org.opencb.commons.annotations.DataField;

public class ClinicalVariantConfidence {

@DataField(id = "value", description = FieldConstants.CLINICAL_CONFIDENCE_VALUE_DESCRIPTION)
private Confidence value;

@DataField(id = "author", description = FieldConstants.CLINICAL_CONFIDENCE_AUTHOR_DESCRIPTION)
private String author;

@DataField(id = "date", description = FieldConstants.CLINICAL_CONFIDENCE_DATE_DESCRIPTION)
private String date;

public enum Confidence {
HIGH,
MEDIUM,
LOW
}

public ClinicalVariantConfidence() {
}

public ClinicalVariantConfidence(Confidence value, String author, String date) {
this.value = value;
this.author = author;
this.date = date;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ClinicalVariantConfidence{");
sb.append("value=").append(value);
sb.append(", author='").append(author).append('\'');
sb.append(", date='").append(date).append('\'');
sb.append('}');
return sb.toString();
}

public Confidence getValue() {
return value;
}

public ClinicalVariantConfidence setValue(Confidence value) {
this.value = value;
return this;
}

public String getAuthor() {
return author;
}

public ClinicalVariantConfidence setAuthor(String author) {
this.author = author;
return this;
}

public String getDate() {
return date;
}

public ClinicalVariantConfidence setDate(String date) {
this.date = date;
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class FieldConstants {
public static final String CLINICAL_COMMENT_TAGS_DESCRIPTION = "List of tags for the clinical comment";
public static final String CLINICAL_COMMENT_DATE_DESCRIPTION = "Date of the clinical comment";
public static final String RELATEDNESS_REPORT_METHOD_DESCRIPTION = "Method of the relatedness report";
public static final String CLINICAL_CONFIDENCE_AUTHOR_DESCRIPTION = "Clinical confidence author";
public static final String CLINICAL_CONFIDENCE_DATE_DESCRIPTION = "Date of the clinical confidence";
public static final String CLINICAL_CONFIDENCE_VALUE_DESCRIPTION = "Date of the clinical confidence";

public static final String RELATEDNESS_REPORT_MAF_DESCRIPTION = "Minor allele frequency to filter variants, e.g.: 1kg_phase3:CEU>0.35, cohort:ALL>0.05";
public static final String RELATEDNESS_REPORT_SCORES_DESCRIPTION = "Relatedness scores for pair of samples";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public List<ClinicalVariant> createSecondaryFindings(List<Variant> variants) {
// If we have clinical variant evidences, then we have to create the clinical variant
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyMap(), new ClinicalDiscussion(), ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyMap(), new ClinicalDiscussion(), null, ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyList(), Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public List<ClinicalVariant> create(List<Variant> variants) {
// Create a clinical variant only if we have evidences
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyMap(), new ClinicalDiscussion(), ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyMap(), new ClinicalDiscussion(), null, ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyList(), Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public List<ClinicalVariant> create(List<Variant> variants) throws Interpretatio
// If we have clinical variant evidences, then we have to create the clinical variant
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyMap(), new ClinicalDiscussion(), ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyMap(), new ClinicalDiscussion(), null, ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyList(), Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public List<ClinicalVariant> create(List<Variant> variants, Map<String, List<Mod
if (CollectionUtils.isNotEmpty(clinicalVariantEvidences)) {
logger.debug(variant.toStringSimple() + ": reported, num. evidences: " + clinicalVariantEvidences.size());
ClinicalVariant clinicalVariant = new ClinicalVariant(variant.getImpl(), Collections.emptyList(), Collections.emptyList(),
Collections.emptyMap(), new ClinicalDiscussion(), ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyMap(), new ClinicalDiscussion(), null, ClinicalVariant.Status.NOT_REVIEWED,
Collections.emptyList(), Collections.emptyMap());
clinicalVariant.setEvidences(clinicalVariantEvidences);

Expand Down