Skip to content

Commit

Permalink
Filter for distinct experiment information (#927)
Browse files Browse the repository at this point in the history
During the aggregation of the project summary information, this contribution now also filters for distinct ontology terms to avoid redundant information.
  • Loading branch information
sven1103 authored Nov 26, 2024
1 parent 83285bd commit f0aefd8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -137,47 +137,20 @@ public String formatted() {
}

@Override
public boolean equals(Object object) {
if (this == object) {
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (object == null || getClass() != object.getClass()) {
return false;
}

OntologyTerm that = (OntologyTerm) object;

if (!Objects.equals(ontologyAbbreviation, that.ontologyAbbreviation)) {
return false;
}
if (!Objects.equals(ontologyVersion, that.ontologyVersion)) {
return false;
}
if (!Objects.equals(ontologyIri, that.ontologyIri)) {
return false;
}
if (!Objects.equals(classLabel, that.classLabel)) {
return false;
}
if (!Objects.equals(oboId, that.oboId)) {
return false;
}
if (!Objects.equals(description, that.description)) {
if (other == null || getClass() != other.getClass()) {
return false;
}
OntologyTerm that = (OntologyTerm) other;
return Objects.equals(classIri, that.classIri);
}

@Override
public int hashCode() {
int result = ontologyAbbreviation != null ? ontologyAbbreviation.hashCode() : 0;
result = 31 * result + (ontologyVersion != null ? ontologyVersion.hashCode() : 0);
result = 31 * result + (ontologyIri != null ? ontologyIri.hashCode() : 0);
result = 31 * result + (classLabel != null ? classLabel.hashCode() : 0);
result = 31 * result + (oboId != null ? oboId.hashCode() : 0);
result = 31 * result + (description != null ? description.hashCode() : 0);
result = 31 * result + (classIri != null ? classIri.hashCode() : 0);
return result;
return Objects.hashCode(classIri);
}

@Override
Expand Down
Binary file modified user-interface/src/main/bundles/dev.bundle
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -452,15 +452,15 @@ private OntologyTermDisplay convert(OntologyTerm ontologyTerm) {
}

private List<OntologyTerm> extractSpecies(List<Experiment> experiments) {
return experiments.stream().flatMap(experiment -> experiment.getSpecies().stream()).toList();
return experiments.stream().flatMap(experiment -> experiment.getSpecies().stream()).distinct().toList();
}

private List<OntologyTerm> extractSpecimen(List<Experiment> experiments) {
return experiments.stream().flatMap(experiment -> experiment.getSpecimens().stream()).toList();
return experiments.stream().flatMap(experiment -> experiment.getSpecimens().stream()).distinct().toList();
}

private List<OntologyTerm> extractAnalyte(List<Experiment> experiments) {
return experiments.stream().flatMap(experiment -> experiment.getAnalytes().stream()).toList();
return experiments.stream().flatMap(experiment -> experiment.getAnalytes().stream()).distinct().toList();
}

private void buildDesignSection(ProjectOverview projectInformation, Project project) {
Expand Down

0 comments on commit f0aefd8

Please sign in to comment.