Skip to content

Commit

Permalink
Merge pull request #322 from VEuPathDB/add-correlation
Browse files Browse the repository at this point in the history
add empty correlation skeleton
  • Loading branch information
asizemore authored Oct 4, 2023
2 parents 277324e + e636e13 commit b74dc73
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 0 deletions.
15 changes: 15 additions & 0 deletions api.raml
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
6 changes: 6 additions & 0 deletions schema/library.raml
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,12 @@ types:
overlayVariable:
type: VariableSpec
required: false
CorrelationAssayMetadataBipartitenetworkPostRequest:
type: DataPluginRequestBase
properties:
computeConfig: EmptyDataPluginSpec
config: EmptyDataPluginSpec
CorrelationAssayMetadataStatsResponse: DifferentialAbundanceStatsResponse
DifferentialAbundanceVolcanoplotPostRequest:
type: DataPluginRequestBase
properties:
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
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<CorrelationAssayMetadataBipartitenetworkPostRequest, EmptyDataPluginSpec, EmptyDataPluginSpec> {

@Override
public String getDisplayName() {
return "Bipartite network";
}

@Override
public String getDescription() {
return "Visualize the correlation between two sets of data";
}

@Override
public List<String> 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<StreamSpec> 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<String, InputStream> dataStreams) throws IOException {
System.out.println("I'm writing results!");
// writeComputeStatsResponseToOutput(out);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b74dc73

Please sign in to comment.