diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/Signature.java b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/Signature.java index 1005094e..bcb90cca 100644 --- a/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/Signature.java +++ b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/Signature.java @@ -51,13 +51,19 @@ public class Signature { description = FieldConstants.SIGNATURE_FILES_DESCRIPTION) private List files; + @Deprecated @DataField(id = "fitting", indexed = true, - description = FieldConstants.SIGNATURE_SIGNATURE_FITTING_DESCRIPTION) + description = FieldConstants.SIGNATURE_SIGNATURE_FITTING_SCORE_DESCRIPTION) private SignatureFitting fitting; + @DataField(id = "fittings", indexed = true, + description = FieldConstants.SIGNATURE_SIGNATURE_FITTING_SCORES_DESCRIPTION) + private List fittings; + public Signature() { } + @Deprecated public Signature(String id, String description, ObjectMap query, String type, List counts, List files, SignatureFitting fitting) { this.id = id; @@ -69,6 +75,17 @@ public Signature(String id, String description, ObjectMap query, String type, Li this.fitting = fitting; } + public Signature(String id, String description, ObjectMap query, String type, List counts, List files, + List fittings) { + this.id = id; + this.description = description; + this.query = query; + this.type = type; + this.counts = counts; + this.files = files; + this.fittings = fittings; + } + @Override public String toString() { final StringBuilder sb = new StringBuilder("Signature{"); @@ -78,7 +95,7 @@ public String toString() { sb.append(", type='").append(type).append('\''); sb.append(", counts=").append(counts); sb.append(", files=").append(files); - sb.append(", fitting=").append(fitting); + sb.append(", fittings=").append(fittings); sb.append('}'); return sb.toString(); } @@ -137,15 +154,26 @@ public Signature setFiles(List files) { return this; } + @Deprecated public SignatureFitting getFitting() { return fitting; } + @Deprecated public Signature setFitting(SignatureFitting fitting) { this.fitting = fitting; return this; } + public List getFittings() { + return fittings; + } + + public Signature setFittings(List fittings) { + this.fittings = fittings; + return this; + } + public static class GenomeContextCount { @DataField(id = "context", indexed = true, diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFitting.java b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFitting.java index d1730844..6fe9f399 100644 --- a/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFitting.java +++ b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFitting.java @@ -27,6 +27,9 @@ public class SignatureFitting { + @DataField(id = "id", indexed = true, + description = FieldConstants.SIGNATURE_FITTING_ID_DESCRIPTION) + private String id; @DataField(id = "method", indexed = true, description = FieldConstants.SIGNATURE_FITTING_METHOD_DESCRIPTION) @@ -42,7 +45,7 @@ public class SignatureFitting { @DataField(id = "scores", indexed = true, uncommentedClasses = {"Score"}, description = FieldConstants.SIGNATURE_FITTING_SCORES_DESCRIPTION) - private List scores; + private List scores; @Deprecated @DataField(id = "coeff", indexed = true, @@ -66,7 +69,8 @@ public SignatureFitting() { } @Deprecated - public SignatureFitting(String method, String signatureSource, String signatureVersion, List scores, double coeff, String file) { + public SignatureFitting(String method, String signatureSource, String signatureVersion, List scores, + double coeff, String file) { this.method = method; this.signatureSource = signatureSource; this.signatureVersion = signatureVersion; @@ -75,8 +79,21 @@ public SignatureFitting(String method, String signatureSource, String signatureV this.file = file; } - public SignatureFitting(String method, String signatureSource, String signatureVersion, List scores, double coeff, String file, - List files, ObjectMap params) { + @Deprecated + public SignatureFitting(String method, String signatureSource, String signatureVersion, List scores, + double coeff, String file, List files, ObjectMap params) { + this.method = method; + this.signatureSource = signatureSource; + this.signatureVersion = signatureVersion; + this.scores = scores; + this.coeff = coeff; + this.file = file; + this.files = files; + this.params = params; + } + + public SignatureFitting(String id, String method, String signatureSource, String signatureVersion, List scores, + double coeff, String file, List files, ObjectMap params) { this.method = method; this.signatureSource = signatureSource; this.signatureVersion = signatureVersion; @@ -89,7 +106,8 @@ public SignatureFitting(String method, String signatureSource, String signatureV @Override public String toString() { - final StringBuilder sb = new StringBuilder("SignatureFitting{"); + final StringBuilder sb = new StringBuilder("SignatureFittingScore{"); + sb.append("id='").append(id).append('\''); sb.append("method='").append(method).append('\''); sb.append(", signatureSource='").append(signatureSource).append('\''); sb.append(", signatureVersion='").append(signatureVersion).append('\''); @@ -102,6 +120,15 @@ public String toString() { return sb.toString(); } + public String getId() { + return id; + } + + public SignatureFitting setId(String id) { + this.id = id; + return this; + } + public String getMethod() { return method; } @@ -129,11 +156,11 @@ public SignatureFitting setSignatureVersion(String signatureVersion) { return this; } - public List getScores() { + public List getScores() { return scores; } - public SignatureFitting setScores(List scores) { + public SignatureFitting setScores(List scores) { this.scores = scores; return this; } @@ -173,45 +200,4 @@ public SignatureFitting setParams(ObjectMap params) { this.params = params; return this; } - - public static class Score { - - private String signatureId; - private double value; - - public Score() { - } - - public Score(String signatureId, double value) { - this.signatureId = signatureId; - this.value = value; - } - - @Override - public String toString() { - final StringBuilder sb = new StringBuilder("Score{"); - sb.append("signatureId='").append(signatureId).append('\''); - sb.append(", value=").append(value); - sb.append('}'); - return sb.toString(); - } - - public String getSignatureId() { - return signatureId; - } - - public Score setSignatureId(String signatureId) { - this.signatureId = signatureId; - return this; - } - - public double getValue() { - return value; - } - - public Score setValue(double value) { - this.value = value; - return this; - } - } } diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFittingScore.java b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFittingScore.java new file mode 100644 index 00000000..aef16726 --- /dev/null +++ b/biodata-models/src/main/java/org/opencb/biodata/models/clinical/qc/SignatureFittingScore.java @@ -0,0 +1,42 @@ +package org.opencb.biodata.models.clinical.qc; + +public class SignatureFittingScore { + + private String signatureId; + private double value; + + public SignatureFittingScore() { + } + + public SignatureFittingScore(String signatureId, double value) { + this.signatureId = signatureId; + this.value = value; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder("SignatureFittingScore{"); + sb.append("signatureId='").append(signatureId).append('\''); + sb.append(", value=").append(value); + sb.append('}'); + return sb.toString(); + } + + public String getSignatureId() { + return signatureId; + } + + public SignatureFittingScore setSignatureId(String signatureId) { + this.signatureId = signatureId; + return this; + } + + public double getValue() { + return value; + } + + public SignatureFittingScore setValue(double value) { + this.value = value; + return this; + } +} diff --git a/biodata-models/src/main/java/org/opencb/biodata/models/constants/FieldConstants.java b/biodata-models/src/main/java/org/opencb/biodata/models/constants/FieldConstants.java index ccff0fde..c11af5ad 100644 --- a/biodata-models/src/main/java/org/opencb/biodata/models/constants/FieldConstants.java +++ b/biodata-models/src/main/java/org/opencb/biodata/models/constants/FieldConstants.java @@ -8,9 +8,12 @@ public class FieldConstants { public static final String SIGNATURE_TYPE_DESCRIPTION = "Signature type SNV, INDEL..."; public static final String SIGNATURE_COUNTS_DESCRIPTION = "List of GenomeContextCount"; public static final String SIGNATURE_FILES_DESCRIPTION = "List of files of signature"; - public static final String SIGNATURE_SIGNATURE_FITTING_DESCRIPTION = "Signature fitting"; + @Deprecated + public static final String SIGNATURE_SIGNATURE_FITTING_SCORE_DESCRIPTION = "Signature fitting"; + public static final String SIGNATURE_SIGNATURE_FITTING_SCORES_DESCRIPTION = "List of signature fitting scores"; public static final String GENOME_CONTEXT_COUNT_CONTEXT_DESCRIPTION = "Genome context to count"; public static final String GENOME_CONTEXT_COUNT_TOTAL_DESCRIPTION = "Counted integer"; + public static final String SIGNATURE_FITTING_ID_DESCRIPTION = "Signature fitting ID"; public static final String SIGNATURE_FITTING_METHOD_DESCRIPTION = "Method used to fit the signature"; public static final String SIGNATURE_FITTING_SOURCE_DESCRIPTION = "Source of the fitting signature"; public static final String SIGNATURE_FITTING_SIGNATURE_VERSION_DESCRIPTION = "Signature version of the fitting signature";