diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java index 3427a69163c..8ae1103a0a4 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/executors/AnalysisVariantCommandExecutor.java @@ -622,6 +622,8 @@ private RestResponse 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() diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java index 1c83e822d82..ee3d678ce59 100644 --- a/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java +++ b/opencga-app/src/main/java/org/opencb/opencga/app/cli/main/options/AnalysisVariantCommandOptions.java @@ -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; } diff --git a/opencga-client/src/main/R/R/Variant-methods.R b/opencga-client/src/main/R/R/Variant-methods.R index 5413a7604b5..0d450625a53 100644 --- a/opencga-client/src/main/R/R/Variant-methods.R +++ b/opencga-client/src/main/R/R/Variant-methods.R @@ -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, ...), diff --git a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java index 6a68ae8ea82..6d10b276ef0 100644 --- a/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java +++ b/opencga-client/src/main/java/org/opencb/opencga/client/rest/clients/VariantClient.java @@ -298,8 +298,7 @@ public RestResponse 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. diff --git a/opencga-client/src/main/javascript/Variant.js b/opencga-client/src/main/javascript/Variant.js index 7d8b01966da..2f9b9b6d4cd 100644 --- a/opencga-client/src/main/javascript/Variant.js +++ b/opencga-client/src/main/javascript/Variant.js @@ -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 diff --git a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py index 3993f48ba22..be198a003f2 100644 --- a/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py +++ b/opencga-client/src/main/python/pyopencga/rest_clients/variant_client.py @@ -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 diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java index 835f89a61a6..a272e2e1708 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/api/FieldConstants.java @@ -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 { @@ -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."; @@ -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."; @@ -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."; @@ -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" @@ -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."; diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/FamilyQcAnalysisParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/FamilyQcAnalysisParams.java index 4dcbb52fbea..21cb44a8f19 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/FamilyQcAnalysisParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/FamilyQcAnalysisParams.java @@ -16,22 +16,38 @@ 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; @@ -39,12 +55,22 @@ public FamilyQcAnalysisParams(String family, String relatednessMethod, String re 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(); @@ -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; @@ -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; } diff --git a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java index e06fdf09b6e..48b5ce19764 100644 --- a/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java +++ b/opencga-core/src/main/java/org/opencb/opencga/core/models/variant/IndividualQcAnalysisParams.java @@ -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"; @@ -30,16 +32,27 @@ 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 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; @@ -47,12 +60,25 @@ public IndividualQcAnalysisParams(String individual, String sample, String infer this.outdir = outdir; } + public IndividualQcAnalysisParams(String individual, String sample, List 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(); @@ -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;