Skip to content

Commit

Permalink
models: update QC data models, #TASK-6722, #TASK-6766
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarraga committed Sep 17, 2024
1 parent 429d6a0 commit 18f322f
Show file tree
Hide file tree
Showing 10 changed files with 386 additions and 242 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.opencb.biodata.models.constants.FieldConstants;
import org.opencb.commons.annotations.DataField;

import java.util.HashMap;
import java.util.Map;

public class Software {
Expand Down Expand Up @@ -51,15 +52,7 @@ public class Software {
private Map<String, String> params;

public Software() {
}

@Deprecated
public Software(String name, String version, String commit, String website, Map<String, String> params) {
this.name = name;
this.version = version;
this.commit = commit;
this.website = website;
this.params = params;
this("", "", "", "", "", new HashMap<>());
}

public Software(String name, String version, String repository, String commit, String website, Map<String, String> params) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/*
* <!--
* ~ Copyright 2015-2017 OpenCB
* ~
* ~ Licensed under the Apache License, Version 2.0 (the "License");
* ~ you may not use this file except in compliance with the License.
* ~ You may obtain a copy of the License at
* ~
* ~ http://www.apache.org/licenses/LICENSE-2.0
* ~
* ~ Unless required by applicable law or agreed to in writing, software
* ~ distributed under the License is distributed on an "AS IS" BASIS,
* ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* ~ See the License for the specific language governing permissions and
* ~ limitations under the License.
* -->
*
*/

package org.opencb.biodata.models.clinical.qc;

import org.opencb.biodata.models.clinical.interpretation.Software;
import org.opencb.biodata.models.common.Image;
import org.opencb.biodata.models.constants.FieldConstants;
import org.opencb.commons.annotations.DataField;
import org.opencb.commons.datastore.core.ObjectMap;

import java.util.ArrayList;
import java.util.List;

public class InferredSex {

@DataField(id = "method", description = FieldConstants.INFERRED_SEX_METHOD_DESCRIPTION)
private String method;

@DataField(id = "sampleId", description = FieldConstants.INFERRED_SEX_SAMPLE_DESCRIPTION)
private String sampleId;

@DataField(id = "software", description = FieldConstants.INFERRED_SEX_SOFTWARE_DESCRIPTION)
private Software software;

@DataField(id = "inferredKaryotypicSex", description = FieldConstants.INFERRED_SEX_INFERRED_KARYOTYPIC_SEX_DESCRIPTION)
private String inferredKaryotypicSex;

@DataField(id = "values", description = FieldConstants.INFERRED_SEX_VALUES_DESCRIPTION)
private ObjectMap values;

@DataField(id = "images", description = FieldConstants.INFERRED_SEX_IMAGES_DESCRIPTION)
private List<Image> images;

@DataField(id = "attributes", description = FieldConstants.INFERRED_SEX_ATTRIBUTES_DESCRIPTION)
private ObjectMap attributes;

public InferredSex() {
this("","", new Software(), "", new ObjectMap(), new ArrayList<>(), new ObjectMap());
}

public InferredSex(String method, String sampleId, Software software, String inferredKaryotypicSex, ObjectMap values,
List<Image> images, ObjectMap attributes) {
this.method = method;
this.sampleId = sampleId;
this.software = software;
this.inferredKaryotypicSex = inferredKaryotypicSex;
this.values = values;
this.images = images;
this.attributes = attributes;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("InferredSex{");
sb.append("method='").append(method).append('\'');
sb.append(", sampleId='").append(sampleId).append('\'');
sb.append(", software=").append(software);
sb.append(", inferredKaryotypicSex='").append(inferredKaryotypicSex).append('\'');
sb.append(", values=").append(values);
sb.append(", images=").append(images);
sb.append(", attributes=").append(attributes);
sb.append('}');
return sb.toString();
}

public String getMethod() {
return method;
}

public InferredSex setMethod(String method) {
this.method = method;
return this;
}

public String getSampleId() {
return sampleId;
}

public InferredSex setSampleId(String sampleId) {
this.sampleId = sampleId;
return this;
}

public Software getSoftware() {
return software;
}

public InferredSex setSoftware(Software software) {
this.software = software;
return this;
}

public String getInferredKaryotypicSex() {
return inferredKaryotypicSex;
}

public InferredSex setInferredKaryotypicSex(String inferredKaryotypicSex) {
this.inferredKaryotypicSex = inferredKaryotypicSex;
return this;
}

public ObjectMap getValues() {
return values;
}

public InferredSex setValues(ObjectMap values) {
this.values = values;
return this;
}

public List<Image> getImages() {
return images;
}

public InferredSex setImages(List<Image> images) {
this.images = images;
return this;
}

public ObjectMap getAttributes() {
return attributes;
}

public InferredSex setAttributes(ObjectMap attributes) {
this.attributes = attributes;
return this;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@

package org.opencb.biodata.models.clinical.qc;

import org.opencb.biodata.models.common.Image;
import org.opencb.biodata.models.constants.FieldConstants;
import org.opencb.commons.annotations.DataField;
import org.opencb.commons.datastore.core.ObjectMap;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -27,13 +32,21 @@
// M E N D E L I A N E R R O R S R E P O R T
//-------------------------------------------------------------------------

public class MendelianErrorReport {
public class MendelianError {

// Number total of errors for that family
@DataField(id = "numErrors", description = FieldConstants.MENDELIAN_ERROR_NUM_ERRORS_DESCRIPTION)
private int numErrors;

@DataField(id = "sampleAggregation", description = FieldConstants.MENDELIAN_ERROR_SAMPLE_AGGREGATION_DESCRIPTION)
private List<SampleAggregation> sampleAggregation;

@DataField(id = "images", description = FieldConstants.MENDELIAN_ERROR_IMAGES_DESCRIPTION)
private List<Image> images;

@DataField(id = "attributes", description = FieldConstants.MENDELIAN_ERROR_ATTRIBUTES_DESCRIPTION)
private ObjectMap attributes;


//-------------------------------------------------------------------------
// S A M P L E A G G R E G A T I O N
//-------------------------------------------------------------------------
Expand Down Expand Up @@ -153,21 +166,33 @@ public ChromosomeAggregation setErrorCodeAggregation(Map<String, Integer> errorC
}
}

public MendelianErrorReport() {
this.numErrors = 0;
this.sampleAggregation = new ArrayList<>();
public MendelianError() {
this(0, new ArrayList<>(), new ArrayList<>(), new ObjectMap());
}

public MendelianErrorReport(int numErrors, List<SampleAggregation> sampleAggregation) {
public MendelianError(int numErrors, List<SampleAggregation> sampleAggregation, List<Image> images, ObjectMap attributes) {
this.numErrors = numErrors;
this.sampleAggregation = sampleAggregation;
this.images = images;
this.attributes = attributes;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("MendelianError{");
sb.append("numErrors=").append(numErrors);
sb.append(", sampleAggregation=").append(sampleAggregation);
sb.append(", images=").append(images);
sb.append(", attributes=").append(attributes);
sb.append('}');
return sb.toString();
}

public int getNumErrors() {
return numErrors;
}

public MendelianErrorReport setNumErrors(int numErrors) {
public MendelianError setNumErrors(int numErrors) {
this.numErrors = numErrors;
return this;
}
Expand All @@ -176,8 +201,26 @@ public List<SampleAggregation> getSampleAggregation() {
return sampleAggregation;
}

public MendelianErrorReport setSampleAggregation(List<SampleAggregation> sampleAggregation) {
public MendelianError setSampleAggregation(List<SampleAggregation> sampleAggregation) {
this.sampleAggregation = sampleAggregation;
return this;
}

public List<Image> getImages() {
return images;
}

public MendelianError setImages(List<Image> images) {
this.images = images;
return this;
}

public ObjectMap getAttributes() {
return attributes;
}

public MendelianError setAttributes(ObjectMap attributes) {
this.attributes = attributes;
return this;
}
}
Loading

0 comments on commit 18f322f

Please sign in to comment.