Skip to content

Commit

Permalink
Add back removed experiment design tab into our UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ke4 committed Apr 10, 2024
1 parent eea9358 commit 1064c89
Showing 1 changed file with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import uk.ac.ebi.atlas.commons.readers.TsvStreamer;
import uk.ac.ebi.atlas.experimentpage.ExperimentDesignFile;
import uk.ac.ebi.atlas.experimentpage.ExternallyAvailableContentService;
import uk.ac.ebi.atlas.experimentpage.json.JsonBaselineExperimentController;
import uk.ac.ebi.atlas.experimentpage.qc.MicroarrayQcFiles;
import uk.ac.ebi.atlas.experimentpage.qc.QcReportController;
import uk.ac.ebi.atlas.model.download.ExternallyAvailableContent;
import uk.ac.ebi.atlas.model.experiment.Experiment;
import uk.ac.ebi.atlas.model.experiment.ExperimentDesignTable;
import uk.ac.ebi.atlas.model.experiment.ExperimentType;
import uk.ac.ebi.atlas.model.experiment.sample.ReportsGeneExpression;
import uk.ac.ebi.atlas.resource.DataFileHub;
Expand Down Expand Up @@ -83,6 +85,12 @@ private JsonObject experimentPageContentForExperiment(final Experiment<? extends
ExternallyAvailableContent.ContentType.PLOTS))));
}

if (dataFileHub.getExperimentFiles(experiment.getAccession()).experimentDesign.exists()) {
availableTabs.add(
experimentDesignTab(new ExperimentDesignTable(experiment).asJson(),
ExperimentDesignFile.makeUrl(experiment.getAccession(), accessKey)));
}

availableTabs.add(
customContentTab(
"multipart",
Expand Down Expand Up @@ -146,8 +154,6 @@ private JsonArray supplementaryInformationTabs(final Experiment experiment, fina
"QC Report",
"reports",
pairsToArrayOfObjects(
"name",
"url",
new MicroarrayQcFiles(
dataFileHub.getExperimentFiles(experiment.getAccession()).qcFolder)
.getArrayDesignsThatHaveQcReports().stream()
Expand Down Expand Up @@ -176,12 +182,12 @@ private JsonArray formatTable(List<String[]> rows) {
return result;
}

private JsonArray pairsToArrayOfObjects(String leftName, String rightName, List<Pair<String, String>> pairs) {
private JsonArray pairsToArrayOfObjects(List<Pair<String, String>> pairs) {
JsonArray result = new JsonArray();
for (Pair<String, String> p : pairs) {
JsonObject o = new JsonObject();
o.addProperty(leftName, p.getLeft());
o.addProperty(rightName, p.getRight());
o.addProperty("name", p.getLeft());
o.addProperty("url", p.getRight());
result.add(o);
}
return result;
Expand Down Expand Up @@ -215,4 +221,11 @@ private JsonObject heatmapTab(JsonArray groups, String geneDistributionUrl, Json
props.add("availableDataUnits", availableDataUnits);
return customContentTab("heatmap", "Results", props);
}

private JsonObject experimentDesignTab(JsonObject table, String downloadUrl) {
JsonObject props = new JsonObject();
props.add("table", table);
props.addProperty("downloadUrl", downloadUrl);
return customContentTab("experiment-design", "Experiment Design", props);
}
}

0 comments on commit 1064c89

Please sign in to comment.