Skip to content

Commit

Permalink
Merge pull request #343 from VEuPathDB/explicit-network-thresholds
Browse files Browse the repository at this point in the history
return explicit network thresholds
  • Loading branch information
d-callan authored Jan 16, 2024
2 parents ee958e1 + f300f4c commit 0bacde8
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 20 deletions.
4 changes: 2 additions & 2 deletions api.raml
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ securitySchemes:
200:
body:
application/json:
type: lib.BipartiteNetworkPostResponse
type: lib.CorrelationBipartiteNetworkPostResponse

/correlationassaymetadata/visualizations:
displayName: Visualizations for discovering corrleations between assay data and sample metadata
Expand All @@ -555,7 +555,7 @@ securitySchemes:
200:
body:
application/json:
type: lib.BipartiteNetworkPostResponse
type: lib.CorrelationBipartiteNetworkPostResponse

/distributions/visualizations:
displayName: Visualizations for exploring distributions of data.
Expand Down
8 changes: 4 additions & 4 deletions docs/api.html

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion schema/library.raml
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,12 @@ types:
correlationCoefThreshold:
type: number
required: false
CorrelationBipartiteNetworkPostResponse:
type: BipartiteNetworkPostResponse
additionalProperties: false
properties:
significanceThreshold: number
correlationCoefThreshold: number
CorrelationAssayAssayBipartitenetworkPostRequest:
type: DataPluginRequestBase
properties:
Expand Down Expand Up @@ -920,7 +926,7 @@ types:
properties:
source: NodeData
target: NodeData
strokeWidth: string
weight: string
color: string
NetworkData:
type: object
Expand Down
9 changes: 8 additions & 1 deletion schema/url/correlation/correlation.raml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ types:
required: false
correlationCoefThreshold:
type: number
required: false
required: false

CorrelationBipartiteNetworkPostResponse:
additionalProperties: false
type: BipartiteNetworkPostResponse
properties:
significanceThreshold: number
correlationCoefThreshold: number
2 changes: 1 addition & 1 deletion schema/url/networks.raml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ types:
properties:
source: NodeData
target: NodeData
strokeWidth: string
weight: string
color: string

NetworkData:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,9 +724,6 @@ public boolean validateImputeZeroesRequest(Map<String, DynamicDataSpec> dataSpec

List<DynamicDataSpec> dataSpecsWithStudyDependentVocabs = dataSpecs.entrySet().stream().filter(entry -> hasStudyDependentVocabulary(entry.getValue())).map(Map.Entry::getValue).toList();
List<String> entities = dataSpecsWithStudyDependentVocabs.stream().map(data -> getDynamicDataSpecEntityId(data)).toList();
//if (entities.size() == 0) {
// return false;
//}

boolean allEqualEntities = entities.isEmpty() || Collections.frequency(entities, entities.get(0)) == entities.size();
if (!allEqualEntities) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void writeResults(OutputStream out, Map<String, InputStream> dataStrea
LinkData link = new LinkDataImpl();
link.setSource(sourceNode);
link.setTarget(targetNode);
link.setStrokeWidth(String.valueOf(Math.abs(Float.parseFloat(correlationRow.getCorrelationCoef()))));
link.setWeight(String.valueOf(Math.abs(Float.parseFloat(correlationRow.getCorrelationCoef()))));
// Link color is the sign of the correlation
String color = Float.parseFloat(correlationRow.getCorrelationCoef()) < 0 ? "-1" : "1";
link.setColor(color);
Expand Down Expand Up @@ -131,8 +131,10 @@ protected void writeResults(OutputStream out, Map<String, InputStream> dataStrea
bipartiteNetwork.setData(bipartiteNetworkData);
bipartiteNetwork.setConfig(bipartiteNetworkConfig);

BipartiteNetworkPostResponse response = new BipartiteNetworkPostResponseImpl();
CorrelationBipartiteNetworkPostResponse response = new CorrelationBipartiteNetworkPostResponseImpl();
response.setBipartitenetwork(bipartiteNetwork);
response.setSignificanceThreshold(pValueThreshold);
response.setCorrelationCoefThreshold(correlationCoefThreshold);

JsonUtil.Jackson.writeValue(out, response);
out.flush();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,14 @@ public PostAppsDifferentialabundanceVisualizationsVolcanoplotResponse postAppsDi
@Override
public PostAppsCorrelationassaymetadataVisualizationsBipartitenetworkResponse postAppsCorrelationassaymetadataVisualizationsBipartitenetwork(CorrelationAssayMetadataBipartitenetworkPostRequest entity) {
return wrapPlugin(() -> PostAppsCorrelationassaymetadataVisualizationsBipartitenetworkResponse.respond200WithApplicationJson(
new BipartiteNetworkPostResponseStream(processRequest(new CorrelationAssayMetadataBipartitenetworkPlugin(), entity))));
new CorrelationBipartiteNetworkPostResponseStream(processRequest(new CorrelationAssayMetadataBipartitenetworkPlugin(), entity))));
}

@DisableJackson
@Override
public PostAppsCorrelationassayassayVisualizationsBipartitenetworkResponse postAppsCorrelationassayassayVisualizationsBipartitenetwork(CorrelationAssayAssayBipartitenetworkPostRequest entity) {
return wrapPlugin(() -> PostAppsCorrelationassayassayVisualizationsBipartitenetworkResponse.respond200WithApplicationJson(
new BipartiteNetworkPostResponseStream(processRequest(new CorrelationAssayAssayBipartitenetworkPlugin(), entity))));
new CorrelationBipartiteNetworkPostResponseStream(processRequest(new CorrelationAssayAssayBipartitenetworkPlugin(), entity))));
}

@DisableJackson
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/api.html

Large diffs are not rendered by default.

0 comments on commit 0bacde8

Please sign in to comment.