From 5632fb83c031ceed18ce4a487bed1a25b3d2f4d6 Mon Sep 17 00:00:00 2001 From: asizemore Date: Mon, 25 Sep 2023 14:37:59 -0400 Subject: [PATCH 1/2] add empty correlation skeleton --- api.raml | 15 +++++ schema/library.raml | 9 ++- ...elationassaymetadata-bipartitenetwork.raml | 13 ++++ .../service/eda/ds/metadata/AppsMetadata.java | 5 ++ ...onAssayMetadataBipartitenetworkPlugin.java | 62 +++++++++++++++++++ .../service/eda/ds/service/AppsService.java | 8 +++ 6 files changed, 110 insertions(+), 2 deletions(-) create mode 100644 schema/url/correlationassaymetadata/plugin-correlationassaymetadata-bipartitenetwork.raml create mode 100644 src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java diff --git a/api.raml b/api.raml index fffa57f1..76526c5f 100644 --- a/api.raml +++ b/api.raml @@ -527,6 +527,21 @@ securitySchemes: application/json: type: lib.DifferentialAbundanceStatsResponse + /correlationassaymetadata/visualizations: + displayName: Visualizations for discovering corrleations between assay data and sample metadata + + /bipartitenetwork: + post: + description: Returns data required to create a volcanoplot from a differential abundance analysis. + body: + application/json: + type: lib.CorrelationAssayMetadataBipartitenetworkPostRequest + responses: + 200: + body: + application/json: + type: lib.CorrelationAssayMetadataStatsResponse + /distributions/visualizations: displayName: Visualizations for exploring distributions of data. diff --git a/schema/library.raml b/schema/library.raml index c1cc0a9b..15adcaa8 100644 --- a/schema/library.raml +++ b/schema/library.raml @@ -70,7 +70,6 @@ types: displayRangeMax?: any vocabulary?: string[] imputeZero: boolean - hasStudyDependentVocabulary?: boolean isCollection: boolean members?: VariableSpec[] ComputedVariableMetadata: @@ -373,7 +372,7 @@ types: isMergeKey: boolean isMultiValued: boolean imputeZero: boolean - hasStudyDependentVocabulary?: boolean + hasStudySpecificVocabulary?: boolean variableSpecToImputeZeroesFor?: VariableSpec API_VariableType: type: string @@ -777,6 +776,12 @@ types: overlayVariable: type: VariableSpec required: false + CorrelationAssayMetadataBipartitenetworkPostRequest: + type: DataPluginRequestBase + properties: + computeConfig: EmptyDataPluginSpec + config: EmptyDataPluginSpec + CorrelationAssayMetadataStatsResponse: DifferentialAbundanceStatsResponse DifferentialAbundanceVolcanoplotPostRequest: type: DataPluginRequestBase properties: diff --git a/schema/url/correlationassaymetadata/plugin-correlationassaymetadata-bipartitenetwork.raml b/schema/url/correlationassaymetadata/plugin-correlationassaymetadata-bipartitenetwork.raml new file mode 100644 index 00000000..e08d2aa3 --- /dev/null +++ b/schema/url/correlationassaymetadata/plugin-correlationassaymetadata-bipartitenetwork.raml @@ -0,0 +1,13 @@ +#%RAML 1.0 Library + +types: + +# Temporary until the backend is really ready + CorrelationAssayMetadataBipartitenetworkPostRequest: + type: DataPluginRequestBase + properties: + computeConfig: EmptyDataPluginSpec + config: EmptyDataPluginSpec + + CorrelationAssayMetadataStatsResponse: + type: DifferentialAbundanceStatsResponse diff --git a/src/main/java/org/veupathdb/service/eda/ds/metadata/AppsMetadata.java b/src/main/java/org/veupathdb/service/eda/ds/metadata/AppsMetadata.java index f3afd219..0b0afad8 100644 --- a/src/main/java/org/veupathdb/service/eda/ds/metadata/AppsMetadata.java +++ b/src/main/java/org/veupathdb/service/eda/ds/metadata/AppsMetadata.java @@ -11,6 +11,7 @@ import org.veupathdb.service.eda.ds.plugin.alphadiv.AlphaDivScatterplotPlugin; import org.veupathdb.service.eda.ds.plugin.abundance.AbundanceBoxplotPlugin; import org.veupathdb.service.eda.ds.plugin.abundance.AbundanceScatterplotPlugin; +import org.veupathdb.service.eda.ds.plugin.correlationassaymetadata.CorrelationAssayMetadataBipartitenetworkPlugin; import org.veupathdb.service.eda.ds.plugin.pass.BarplotPlugin; import org.veupathdb.service.eda.ds.plugin.pass.BoxplotPlugin; import org.veupathdb.service.eda.ds.plugin.pass.ContTablePlugin; @@ -113,6 +114,10 @@ public class AppsMetadata { "Find taxa or genes that are differentially abundant between two groups.", List.of(MICROBIOME_PROJECT), viz("volcanoplot", new DifferentialAbundanceVolcanoplotPlugin())), + app("correlationassaymetadata", "Correlation", "correlationassaymetadata", + "Discover taxa or genes correlated with metadata.", + List.of(MICROBIOME_PROJECT), + viz("bipartitenetwork", new CorrelationAssayMetadataBipartitenetworkPlugin())), app("distributions", "Distributions", null, "Plot simple distributions for any continuous variable, including metadata (e.g. age, height, etc.) or microbial assay results.", List.of(MICROBIOME_PROJECT), diff --git a/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java b/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java new file mode 100644 index 00000000..07c4e421 --- /dev/null +++ b/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java @@ -0,0 +1,62 @@ +package org.veupathdb.service.eda.ds.plugin.correlationassaymetadata; + +import org.gusdb.fgputil.validation.ValidationException; +import org.veupathdb.service.eda.common.client.spec.StreamSpec; +import org.veupathdb.service.eda.ds.metadata.AppsMetadata; +import org.veupathdb.service.eda.ds.core.AbstractPlugin; +import org.veupathdb.service.eda.generated.model.BoxplotPostRequest; +import org.veupathdb.service.eda.generated.model.BoxplotSpec; +// import org.veupathdb.service.eda.generated.model.CorrelationAssayMetadataComputeConfig; +import org.veupathdb.service.eda.generated.model.CorrelationAssayMetadataBipartitenetworkPostRequest; +import org.veupathdb.service.eda.generated.model.EmptyDataPluginSpec; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class CorrelationAssayMetadataBipartitenetworkPlugin extends AbstractPlugin { + + @Override + public String getDisplayName() { + return "Bipartite network"; + } + + @Override + public String getDescription() { + return "Visualize the correlation between two sets of data"; + } + + @Override + public List getProjects() { + return List.of(AppsMetadata.MICROBIOME_PROJECT); + } + + @Override + protected ClassGroup getTypeParameterClasses() { + return new ClassGroup(CorrelationAssayMetadataBipartitenetworkPostRequest.class, EmptyDataPluginSpec.class, EmptyDataPluginSpec.class); + } + + @Override + protected boolean computeGeneratesVars() { + return false; + } + + @Override + protected void validateVisualizationSpec(EmptyDataPluginSpec pluginSpec) throws ValidationException { + // nothing to do here + } + + @Override + protected List getRequestedStreams(EmptyDataPluginSpec pluginSpec) { + // this plugin only uses the stats result of the compute; no tabular data streams needed + return Collections.emptyList(); + } + + @Override + protected void writeResults(OutputStream out, Map dataStreams) throws IOException { + writeComputeStatsResponseToOutput(out); + } +} diff --git a/src/main/java/org/veupathdb/service/eda/ds/service/AppsService.java b/src/main/java/org/veupathdb/service/eda/ds/service/AppsService.java index cea9e5bf..03143062 100644 --- a/src/main/java/org/veupathdb/service/eda/ds/service/AppsService.java +++ b/src/main/java/org/veupathdb/service/eda/ds/service/AppsService.java @@ -19,6 +19,7 @@ import org.veupathdb.service.eda.ds.metadata.AppsMetadata; import org.veupathdb.service.eda.ds.core.AbstractPlugin; import org.veupathdb.service.eda.ds.plugin.differentialabundance.DifferentialAbundanceVolcanoplotPlugin; +import org.veupathdb.service.eda.ds.plugin.correlationassaymetadata.CorrelationAssayMetadataBipartitenetworkPlugin; import org.veupathdb.service.eda.ds.plugin.betadiv.BetaDivScatterplotPlugin; import org.veupathdb.service.eda.ds.plugin.alphadiv.AlphaDivBoxplotPlugin; import org.veupathdb.service.eda.ds.plugin.alphadiv.AlphaDivScatterplotPlugin; @@ -342,6 +343,13 @@ public PostAppsDifferentialabundanceVisualizationsVolcanoplotResponse postAppsDi new DifferentialAbundanceStatsResponseStream(processRequest(new DifferentialAbundanceVolcanoplotPlugin(), entity)))); } + @DisableJackson + @Override + public PostAppsCorrelationassaymetadataVisualizationsBipartitenetworkResponse postAppsCorrelationassaymetadataVisualizationsBipartitenetwork(CorrelationAssayMetadataBipartitenetworkPostRequest entity) { + return wrapPlugin(() -> PostAppsCorrelationassaymetadataVisualizationsBipartitenetworkResponse.respond200WithApplicationJson( + new CorrelationAssayMetadataStatsResponseStream(processRequest(new CorrelationAssayMetadataBipartitenetworkPlugin(), entity)))); + } + @DisableJackson @Override public PostAppsAbundanceVisualizationsBoxplotResponse postAppsAbundanceVisualizationsBoxplot(AbundanceBoxplotPostRequest entity) { From 9079f6f31aebb5b03fa92dc71e3521bd7d23d523 Mon Sep 17 00:00:00 2001 From: asizemore Date: Mon, 2 Oct 2023 14:22:52 -0400 Subject: [PATCH 2/2] wip --- schema/library.raml | 3 ++- .../CorrelationAssayMetadataBipartitenetworkPlugin.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/schema/library.raml b/schema/library.raml index 15adcaa8..f4d74131 100644 --- a/schema/library.raml +++ b/schema/library.raml @@ -70,6 +70,7 @@ types: displayRangeMax?: any vocabulary?: string[] imputeZero: boolean + hasStudyDependentVocabulary?: boolean isCollection: boolean members?: VariableSpec[] ComputedVariableMetadata: @@ -372,7 +373,7 @@ types: isMergeKey: boolean isMultiValued: boolean imputeZero: boolean - hasStudySpecificVocabulary?: boolean + hasStudyDependentVocabulary?: boolean variableSpecToImputeZeroesFor?: VariableSpec API_VariableType: type: string diff --git a/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java b/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java index 07c4e421..fff8f63e 100644 --- a/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java +++ b/src/main/java/org/veupathdb/service/eda/ds/plugin/correlationassaymetadata/CorrelationAssayMetadataBipartitenetworkPlugin.java @@ -57,6 +57,7 @@ protected List getRequestedStreams(EmptyDataPluginSpec pluginSpec) { @Override protected void writeResults(OutputStream out, Map dataStreams) throws IOException { - writeComputeStatsResponseToOutput(out); + System.out.println("I'm writing results!"); + // writeComputeStatsResponseToOutput(out); } }