Skip to content

Commit

Permalink
core: update family and individual QC parameters, then clients are up…
Browse files Browse the repository at this point in the history
…dated automatically, #TASK-6772, #TASK-6766
  • Loading branch information
jtarraga committed Sep 3, 2024
1 parent d10fd1f commit b349f10
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,8 @@ private RestResponse<Job> runFamilyQc() throws Exception {
putNestedIfNotEmpty(beanParams, "family",commandOptions.family, true);
putNestedIfNotEmpty(beanParams, "relatednessMethod",commandOptions.relatednessMethod, true);
putNestedIfNotEmpty(beanParams, "relatednessMaf",commandOptions.relatednessMaf, true);
putNestedIfNotNull(beanParams, "skipIndex",commandOptions.skipIndex, true);
putNestedIfNotNull(beanParams, "overwrite",commandOptions.overwrite, true);
putNestedIfNotEmpty(beanParams, "outdir",commandOptions.outdir, true);

familyQcAnalysisParams = JacksonUtils.getDefaultObjectMapper().copy()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -809,16 +809,22 @@ public class RunFamilyQcCommandOptions {
@Parameter(names = {"--job-dry-run"}, description = "Flag indicating that the job will be executed in dry-run mode. In this mode, OpenCGA will validate that all parameters and prerequisites are correctly set for successful execution, but the job will not actually run.", required = false, arity = 1)
public Boolean jobDryRun;

@Parameter(names = {"--family"}, description = "The body web service family parameter", required = false, arity = 1)
@Parameter(names = {"--family"}, description = "Family ID", required = false, arity = 1)
public String family;

@Parameter(names = {"--relatedness-method"}, description = "The body web service relatednessMethod parameter", required = false, arity = 1)
public String relatednessMethod;

@Parameter(names = {"--relatedness-maf"}, description = "The body web service relatednessMaf parameter", required = false, arity = 1)
@Parameter(names = {"--relatedness-maf"}, description = "Minor allele frequence (MAF) is used to filter variants before computing relatedness, e.g.: 1000G:CEU>0.35 or cohort:ALL>0.05", required = false, arity = 1)
public String relatednessMaf;

@Parameter(names = {"--outdir"}, description = "The body web service outdir parameter", required = false, arity = 1)
@Parameter(names = {"--skip-index"}, description = "Do not save the computed quality control in catalog", required = false, arity = 1)
public Boolean skipIndex;

@Parameter(names = {"--overwrite"}, description = "Overwrite quality control in catalog", required = false, arity = 1)
public Boolean overwrite;

@Parameter(names = {"--outdir"}, description = "Output dir for the job.", required = false, arity = 1)
public String outdir;

}
Expand Down
2 changes: 1 addition & 1 deletion opencga-client/src/main/R/R/Variant-methods.R
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ setMethod("variantClient", "OpencgaR", function(OpencgaR, endpointName, params=N
#' @param jobScheduledStartTime Time when the job is scheduled to start.
#' @param jobPriority Priority of the job.
#' @param jobDryRun Flag indicating that the job will be executed in dry-run mode. In this mode, OpenCGA will validate that all parameters and prerequisites are correctly set for successful execution, but the job will not actually run.
#' @param data Family QC analysis params. Family ID. Relatedness method, by default 'PLINK/IBD'. Minor allele frequence (MAF) is used to filter variants before computing relatedness, e.g.: 1000G:CEU>0.35 or cohort:ALL>0.05.
#' @param data Family QC analysis params.
runFamilyQc=fetchOpenCGA(object=OpencgaR, category="analysis", categoryId=NULL,
subcategory="variant/family/qc", subcategoryId=NULL, action="run", params=params, httpMethod="POST",
as.queryParam=NULL, ...),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ public RestResponse<ObjectMap> genotypesFamily(String modeOfInheritance, ObjectM

/**
* Run quality control (QC) for a given family. It computes the relatedness scores among the family members.
* @param data Family QC analysis params. Family ID. Relatedness method, by default 'PLINK/IBD'. Minor allele frequence (MAF) is used
* to filter variants before computing relatedness, e.g.: 1000G:CEU>0.35 or cohort:ALL>0.05.
* @param data Family QC analysis params.
* @param params Map containing any of the following optional parameters.
* study: Study [[organization@]project:]study where study and project can be either the ID or UUID.
* jobId: Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not provided.
Expand Down
3 changes: 1 addition & 2 deletions opencga-client/src/main/javascript/Variant.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ export default class Variant extends OpenCGAParentClass {
}

/** Run quality control (QC) for a given family. It computes the relatedness scores among the family members
* @param {Object} data - Family QC analysis params. Family ID. Relatedness method, by default 'PLINK/IBD'. Minor allele frequence (MAF)
* is used to filter variants before computing relatedness, e.g.: 1000G:CEU>0.35 or cohort:ALL>0.05.
* @param {Object} data - Family QC analysis params.
* @param {Object} [params] - The Object containing the following optional parameters:
* @param {String} [params.study] - Study [[organization@]project:]study where study and project can be either the ID or UUID.
* @param {String} [params.jobId] - Job ID. It must be a unique string within the study. An ID will be autogenerated automatically if not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,7 @@ def run_family_qc(self, data=None, **options):
relatedness scores among the family members.
PATH: /{apiVersion}/analysis/variant/family/qc/run
:param dict data: Family QC analysis params. Family ID. Relatedness
method, by default 'PLINK/IBD'. Minor allele frequence (MAF) is
used to filter variants before computing relatedness, e.g.:
1000G:CEU>0.35 or cohort:ALL>0.05. (REQUIRED)
:param dict data: Family QC analysis params. (REQUIRED)
:param str study: Study [[organization@]project:]study where study and
project can be either the ID or UUID.
:param str job_id: Job ID. It must be a unique string within the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import org.opencb.opencga.core.models.variant.MutationalSignatureAnalysisParams;
import org.opencb.opencga.core.models.variant.SampleQcAnalysisParams;
import org.opencb.opencga.core.tools.variant.IndividualQcAnalysisExecutor;
import org.opencb.opencga.core.tools.variant.InferredSexAnalysisExecutor;

public class FieldConstants {

Expand Down Expand Up @@ -45,7 +46,7 @@ public class FieldConstants {
public static final String ORGANIZATION_ADMINS_DESCRIPTION = "Administrative users of the organization.";
public static final String ORGANIZATION_PROJECTS_DESCRIPTION = "Projects the organization holds.";
public static final String ORGANIZATION_NOTES_DESCRIPTION = "Notes of organization scope.";
// public static final String ORGANIZATION_AUTHENTICATION_ORIGINS_DESCRIPTION = "Authentication origins used by the organization. This "
// public static final String ORGANIZATION_AUTHENTICATION_ORIGINS_DESCRIPTION = "Authentication origins used by the organization. This "
// + "contains all the configuration necessary to be able to communicate with the external authentication origins.";
public static final String ORGANIZATION_CONFIGURATION_DESCRIPTION = "Organization configuration information.";
public static final String ORGANIZATION_INTERNAL_DESCRIPTION = "Organization internal information.";
Expand Down Expand Up @@ -98,6 +99,7 @@ public class FieldConstants {
public static final String SAMPLE_COLLECTION_METHOD_DESCRIPTION = "Describes which method was used to collect the sample.";
public static final String SAMPLE_COLLECTION_FROM_DESCRIPTION = "OntologyTermAnnotation list.";
public static final String SAMPLE_COLLECTION_TYPE_DESCRIPTION = "Type of the sample collection.";

//SampleQualityControl
public static final String SAMPLE_QUALITY_CONTROL_FILES_DESCRIPTION = "Files used for the quality control of the sample.";
public static final String SAMPLE_QUALITY_CONTROL_COMMENTS_DESCRIPTION = "Comments for the quality control of the sample.";
Expand Down Expand Up @@ -180,23 +182,32 @@ public class FieldConstants {

public static final String DISORDER_ID = "Disorder ID.";

//FamilyQualityControl
public static final String FAMILY_QUALITY_CONTROL_RELATEDNESS_DESCRIPTION = "Reports of family relationship.";
// Quality control
public static final String QC_SKIP_INDEX_DESCRIPTION = "Do not save the computed quality control in catalog";
public static final String QC_OVERWRITE_DESCRIPTION = "Overwrite quality control in catalog";

// Family quality control
public static final String FAMILY_QC_FAMILY_ID_DESCRIPTION = "Family ID";
public static final String FAMILY_QC_RELATEDNESS_MAF_DESCRIPTION = "Minor allele frequence (MAF) is used to filter variants before"
+ " computing relatedness, e.g.: " + ParamConstants.POP_FREQ_1000G + ":CEU>0.35 or cohort:ALL>0.05";
public static final String FAMILY_QUALITY_CONTROL_RELATEDNESS_DESCRIPTION = "Reports of family relationship.";

// Individual quality control
public static final String INFERRED_SEX_ID = "inferred-sex";
public static final String MENDELIAN_ERRORS_ID = "mendelian-errors";
public static final String INDIVIDUAL_QC_INDIVIDUAL_ID_DESCRIPTION = "Individual ID";
public static final String INDIVIDUAL_QC_SAMPLE_ID_DESCRIPTION = "Sample ID (required when the individual has multiple samples)";
public static final String INFERRED_SEX_METHOD_DESCRIPTION = "Inferred sex method. Valid values: "
+ IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD;
public static final String INDIVIDUAL_QC_SKIP_DESCRIPTION = "Individual QC analysis to skip. Valid values are: " + INFERRED_SEX_ID
+ ", " + MENDELIAN_ERRORS_ID;
public static final String INDIVIDUAL_QUALITY_CONTROL_INFERRED_SEX_REPORT_DESCRIPTION = "List of inferred sex reports, it depends on"
+ " the method (currently by coverage ratio).";
public static final String INDIVIDUAL_QUALITY_CONTROL_SAMPLE_RELATEDNESS_REPORT_DESCRIPTION = "Reports of samples relatedness.";
public static final String INDIVIDUAL_QUALITY_CONTROL_MENDELIAN_ERRORS_DESCRIPTION = "Mendelian errors.";


//Status
public static final String STATUS_DATE_DESCRIPTION = "Date has setted the status.";
public static final String STATUS_DATE_DESCRIPTION = "Date has set the status.";
public static final String STATUS_MESSAGE_DESCRIPTION = "Deprecated: Message describing the status.";


Expand Down Expand Up @@ -504,7 +515,7 @@ public class FieldConstants {
public static final String HRDETECT_CNV_QUERY_DESCRIPTION = "CNV query";
public static final String HRDETECT_INDEL_QUERY_DESCRIPTION = "INDEL query";
public static final String HRDETECT_SNV3_CUSTOM_NAME_DESCRIPTION = "Custom signature name that will be considered as SNV3 input for"
+ " HRDetect.";
+ " HRDetect.";
public static final String HRDETECT_SNV8_CUSTOM_NAME_DESCRIPTION = "Custom signature name that will be considered as SNV8 input for"
+ " HRDetect.";
public static final String HRDETECT_SV3_CUSTOM_NAME_DESCRIPTION = "Custom signature name that will be considered as SV3 input for"
Expand All @@ -531,7 +542,7 @@ public class FieldConstants {
public static final String COVERAGE_INDEX_BAM_FILE_ID_DESCRIPTION = "BAM file ID.";
public static final String COVERAGE_INDEX_BAI_FILE_ID_DESCRIPTION = "BAI file ID.";
public static final String COVERAGE_INDEX_OVERWRITE_DESCRIPTION = "Window size (i.e., the size of the bins, in bases, for the output"
+ " of the BIGWIG file).";
+ " of the BIGWIG file).";

// Alignment QC analysis (asample-qc-run)
public static final String ALIGNMENT_QC_BAM_FILE_DESCRIPTION = "ID for the BAM file to process.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,61 @@

package org.opencb.opencga.core.models.variant;

import org.opencb.commons.annotations.DataField;
import org.opencb.opencga.core.api.FieldConstants;
import org.opencb.opencga.core.api.ParamConstants;
import org.opencb.opencga.core.tools.ToolParams;

import java.util.List;

public class FamilyQcAnalysisParams extends ToolParams {
public static final String DESCRIPTION = "Family QC analysis params. Family ID. Relatedness method, by default 'PLINK/IBD'. Minor "
+ " allele frequence (MAF) is used to filter variants before computing relatedness, e.g.: " + ParamConstants.POP_FREQ_1000G
+ ":CEU>0.35 or cohort:ALL>0.05";
public static final String DESCRIPTION = "Family QC analysis params.";

@DataField(id = "family", description = FieldConstants.FAMILY_QC_FAMILY_ID_DESCRIPTION)
private String family;

@Deprecated
private String relatednessMethod;

@DataField(id = "relatednessMaf", description = FieldConstants.FAMILY_QC_RELATEDNESS_MAF_DESCRIPTION)
private String relatednessMaf;

@DataField(id = "skipIndex", description = FieldConstants.QC_SKIP_INDEX_DESCRIPTION)
private Boolean skipIndex;

@DataField(id = "overwrite", description = FieldConstants.QC_OVERWRITE_DESCRIPTION)
private Boolean overwrite;

@DataField(id = "outdir", description = FieldConstants.JOB_OUT_DIR_DESCRIPTION)
private String outdir;

public FamilyQcAnalysisParams() {
}

@Deprecated
public FamilyQcAnalysisParams(String family, String relatednessMethod, String relatednessMaf, String outdir) {
this.family = family;
this.relatednessMethod = relatednessMethod;
this.relatednessMaf = relatednessMaf;
this.outdir = outdir;
}

public FamilyQcAnalysisParams(String family, String relatednessMaf, Boolean skipIndex, Boolean overwrite, String outdir) {
this.family = family;
this.relatednessMaf = relatednessMaf;
this.skipIndex = skipIndex;
this.overwrite = overwrite;
this.outdir = outdir;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("FamilyQcAnalysisParams{");
sb.append("family='").append(family).append('\'');
sb.append(", relatednessMethod='").append(relatednessMethod).append('\'');
sb.append(", relatednessMaf='").append(relatednessMaf).append('\'');
sb.append(", skipIndex=").append(skipIndex);
sb.append(", overwrite=").append(overwrite);
sb.append(", outdir='").append(outdir).append('\'');
sb.append('}');
return sb.toString();
Expand All @@ -59,10 +85,12 @@ public FamilyQcAnalysisParams setFamily(String family) {
return this;
}

@Deprecated
public String getRelatednessMethod() {
return relatednessMethod;
}

@Deprecated
public FamilyQcAnalysisParams setRelatednessMethod(String relatednessMethod) {
this.relatednessMethod = relatednessMethod;
return this;
Expand All @@ -77,6 +105,24 @@ public FamilyQcAnalysisParams setRelatednessMaf(String relatednessMaf) {
return this;
}

public Boolean getSkipIndex() {
return skipIndex;
}

public FamilyQcAnalysisParams setSkipIndex(Boolean skipIndex) {
this.skipIndex = skipIndex;
return this;
}

public Boolean getOverwrite() {
return overwrite;
}

public FamilyQcAnalysisParams setOverwrite(Boolean overwrite) {
this.overwrite = overwrite;
return this;
}

public String getOutdir() {
return outdir;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.opencb.opencga.core.tools.ToolParams;
import org.opencb.opencga.core.tools.variant.IndividualQcAnalysisExecutor;

import java.util.List;

public class IndividualQcAnalysisParams extends ToolParams {
public static final String DESCRIPTION = "Individual QC analysis params";

Expand All @@ -30,29 +32,53 @@ public class IndividualQcAnalysisParams extends ToolParams {
@DataField(id = "sample", description = FieldConstants.INDIVIDUAL_QC_SAMPLE_ID_DESCRIPTION)
private String sample;

@Deprecated
@DataField(id = "inferredSexMethod", description = FieldConstants.INFERRED_SEX_METHOD_DESCRIPTION,
defaultValue = IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD)
defaultValue = IndividualQcAnalysisExecutor.COVERAGE_RATIO_INFERRED_SEX_METHOD, deprecated = true)
private String inferredSexMethod;

@DataField(id = "skip", description = FieldConstants.INDIVIDUAL_QC_SKIP_DESCRIPTION)
private List<String> skip;

@DataField(id = "skipIndex", description = FieldConstants.QC_SKIP_INDEX_DESCRIPTION)
private Boolean skipIndex;

@DataField(id = "overwrite", description = FieldConstants.QC_OVERWRITE_DESCRIPTION)
private Boolean overwrite;

@DataField(id = "outdir", description = FieldConstants.JOB_OUT_DIR_DESCRIPTION)
private String outdir;

public IndividualQcAnalysisParams() {
}

@Deprecated
public IndividualQcAnalysisParams(String individual, String sample, String inferredSexMethod, String outdir) {
this.individual = individual;
this.sample = sample;
this.inferredSexMethod = inferredSexMethod;
this.outdir = outdir;
}

public IndividualQcAnalysisParams(String individual, String sample, List<String> skip, Boolean skipIndex, Boolean overwrite,
String outdir) {
this.individual = individual;
this.sample = sample;
this.skip = skip;
this.skipIndex = skipIndex;
this.overwrite = overwrite;
this.outdir = outdir;
}

@Override
public String toString() {
final StringBuilder sb = new StringBuilder("IndividualQcAnalysisParams{");
sb.append("individual='").append(individual).append('\'');
sb.append(", sample='").append(sample).append('\'');
sb.append(", inferredSexMethod='").append(inferredSexMethod).append('\'');
sb.append(", skip=").append(skip);
sb.append(", skipIndex=").append(skipIndex);
sb.append(", overwrite=").append(overwrite);
sb.append(", outdir='").append(outdir).append('\'');
sb.append('}');
return sb.toString();
Expand All @@ -76,10 +102,12 @@ public IndividualQcAnalysisParams setSample(String sample) {
return this;
}

@Deprecated
public String getInferredSexMethod() {
return inferredSexMethod;
}

@Deprecated
public IndividualQcAnalysisParams setInferredSexMethod(String inferredSexMethod) {
this.inferredSexMethod = inferredSexMethod;
return this;
Expand Down

0 comments on commit b349f10

Please sign in to comment.