Skip to content

Commit

Permalink
Remove Resources from supplymentary info tab if… (#192)
Browse files Browse the repository at this point in the history
no external resources for experiments
  • Loading branch information
lingyun1010 authored Apr 29, 2024
1 parent 35bafb5 commit 81671de
Showing 1 changed file with 20 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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.ExpressionAtlasContentService;
import uk.ac.ebi.atlas.experimentpage.ExternallyAvailableContentService;
import uk.ac.ebi.atlas.experimentpage.json.JsonBaselineExperimentController;
import uk.ac.ebi.atlas.experimentpage.qc.MicroarrayQcFiles;
Expand All @@ -37,9 +38,11 @@ public class ExperimentPageContentService {
.create();

private final DataFileHub dataFileHub;
private final ExpressionAtlasContentService expressionAtlasContentService;

public ExperimentPageContentService(DataFileHub dataFileHub) {
public ExperimentPageContentService(DataFileHub dataFileHub, ExpressionAtlasContentService expressionAtlasContentService) {
this.dataFileHub = dataFileHub;
this.expressionAtlasContentService = expressionAtlasContentService;
}

@Cacheable(cacheNames = "experimentContent", key = "#experiment.getAccession()")
Expand Down Expand Up @@ -134,17 +137,22 @@ private JsonArray supplementaryInformationTabs(final Experiment experiment, fina
}
}

supplementaryInformationTabs.add(
customContentTab(
"resources",
"Resources",
"url",
new JsonPrimitive(
ExternallyAvailableContentService.listResourcesUrl(
experiment.getAccession(),
accessKey,
ExternallyAvailableContent.ContentType.SUPPLEMENTARY_INFORMATION)))
);
if(!expressionAtlasContentService.list(
experiment.getAccession(),
accessKey,
ExternallyAvailableContent.ContentType.SUPPLEMENTARY_INFORMATION).isEmpty()) {
supplementaryInformationTabs.add(
customContentTab(
"resources",
"Resources",
"url",
new JsonPrimitive(
ExternallyAvailableContentService.listResourcesUrl(
experiment.getAccession(),
accessKey,
ExternallyAvailableContent.ContentType.SUPPLEMENTARY_INFORMATION)))
);
}

if (experiment.getType().isMicroarray() &&
dataFileHub.getExperimentFiles(experiment.getAccession()).qcFolder.existsAndIsNonEmpty()) {
Expand Down

0 comments on commit 81671de

Please sign in to comment.