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-2242 Improve mutational signature analysis #236

Merged
merged 7 commits into from
Jan 5, 2023
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,19 @@ public class Signature {
description = FieldConstants.SIGNATURE_FILES_DESCRIPTION)
private List<String> 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<SignatureFitting> fittings;

public Signature() {
}

@Deprecated
public Signature(String id, String description, ObjectMap query, String type, List<GenomeContextCount> counts, List<String> files,
SignatureFitting fitting) {
this.id = id;
Expand All @@ -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<GenomeContextCount> counts, List<String> files,
List<SignatureFitting> 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{");
Expand All @@ -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();
}
Expand Down Expand Up @@ -137,15 +154,26 @@ public Signature setFiles(List<String> files) {
return this;
}

@Deprecated
public SignatureFitting getFitting() {
return fitting;
}

@Deprecated
public Signature setFitting(SignatureFitting fitting) {
this.fitting = fitting;
return this;
}

public List<SignatureFitting> getFittings() {
return fittings;
}

public Signature setFittings(List<SignatureFitting> fittings) {
this.fittings = fittings;
return this;
}

public static class GenomeContextCount {

@DataField(id = "context", indexed = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -42,7 +45,7 @@ public class SignatureFitting {

@DataField(id = "scores", indexed = true, uncommentedClasses = {"Score"},
description = FieldConstants.SIGNATURE_FITTING_SCORES_DESCRIPTION)
private List<Score> scores;
private List<SignatureFittingScore> scores;

@Deprecated
@DataField(id = "coeff", indexed = true,
Expand All @@ -66,7 +69,8 @@ public SignatureFitting() {
}

@Deprecated
public SignatureFitting(String method, String signatureSource, String signatureVersion, List<Score> scores, double coeff, String file) {
public SignatureFitting(String method, String signatureSource, String signatureVersion, List<SignatureFittingScore> scores,
double coeff, String file) {
this.method = method;
this.signatureSource = signatureSource;
this.signatureVersion = signatureVersion;
Expand All @@ -75,8 +79,21 @@ public SignatureFitting(String method, String signatureSource, String signatureV
this.file = file;
}

public SignatureFitting(String method, String signatureSource, String signatureVersion, List<Score> scores, double coeff, String file,
List<String> files, ObjectMap params) {
@Deprecated
public SignatureFitting(String method, String signatureSource, String signatureVersion, List<SignatureFittingScore> scores,
double coeff, String file, List<String> 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<SignatureFittingScore> scores,
double coeff, String file, List<String> files, ObjectMap params) {
this.method = method;
this.signatureSource = signatureSource;
this.signatureVersion = signatureVersion;
Expand All @@ -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('\'');
Expand All @@ -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;
}
Expand Down Expand Up @@ -129,11 +156,11 @@ public SignatureFitting setSignatureVersion(String signatureVersion) {
return this;
}

public List<Score> getScores() {
public List<SignatureFittingScore> getScores() {
return scores;
}

public SignatureFitting setScores(List<Score> scores) {
public SignatureFitting setScores(List<SignatureFittingScore> scores) {
this.scores = scores;
return this;
}
Expand Down Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down