Skip to content

Commit

Permalink
Merge pull request #177 from tcezard/EVA3475_release_count_v2
Browse files Browse the repository at this point in the history
EVA-3475 - Release count endpoints v2
  • Loading branch information
tcezard authored Apr 9, 2024
2 parents 7f4d740 + 15c60e2 commit f384731
Show file tree
Hide file tree
Showing 22 changed files with 1,484 additions and 29 deletions.
4 changes: 4 additions & 0 deletions eva-release/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@
<artifactId>springfox-swagger2</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.hypersistence</groupId>
<artifactId>hypersistence-utils-hibernate-52</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import uk.ac.ebi.eva.release.models.ReleaseInfo;
import uk.ac.ebi.eva.release.repositories.ReleaseInfoRepository;

import javax.websocket.server.PathParam;
import java.util.Collections;

@RestController
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2020 EMBL - European Bioinformatics Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.ac.ebi.eva.release.controllers;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import uk.ac.ebi.eva.release.dto.ReleaseStatsPerAssemblyV2Dto;
import uk.ac.ebi.eva.release.dto.ReleaseStatsPerSpeciesV2Dto;
import uk.ac.ebi.eva.release.services.ReleaseStatsServiceV2;

@RestController
@RequestMapping(value = "/v2/stats", produces = "application/json")
@Api(tags = {"RS Release Statistics"})
public class ReleaseStatsV2Controller {

private final ReleaseStatsServiceV2 releaseStatsService;

public ReleaseStatsV2Controller(ReleaseStatsServiceV2 releaseStatsService) {
this.releaseStatsService = releaseStatsService;
}

@GetMapping("/per-species")
public Iterable<ReleaseStatsPerSpeciesV2Dto> getReleaseStatsPerSpecies(
@RequestParam(name = "releaseVersion", required = false) Integer releaseVersion,
@RequestParam(name = "excludeUnmappedOnly", required = false) boolean excludeUnmappedOnly) {
return releaseStatsService.getReleaseStatsPerSpecies(releaseVersion, excludeUnmappedOnly);
}

@GetMapping("/per-species/new")
public Iterable<ReleaseStatsPerSpeciesV2Dto> getSpeciesWithNewRsIds(
@RequestParam(name = "releaseVersion") Integer releaseVersion) {
return releaseStatsService.getSpeciesWithNewRsIds(releaseVersion);
}

@GetMapping("/per-assembly")
public Iterable<ReleaseStatsPerAssemblyV2Dto> getReleaseStatsPerAssemblies(
@RequestParam(name = "releaseVersion", required = false) Integer releaseVersion) {
return releaseStatsService.getReleaseStatsPerAssembly(releaseVersion);
}

@GetMapping("/per-assembly/new")
public Iterable<ReleaseStatsPerAssemblyV2Dto> getAssembliesWithNewRsIds(
@RequestParam(name = "releaseVersion") Integer releaseVersion) {
return releaseStatsService.getReleaseStatsPerAssemblyWithNewRsIds(releaseVersion);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
/*
* Copyright 2022 EMBL - European Bioinformatics Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.ac.ebi.eva.release.dto;

import java.util.Objects;

public class ReleaseStatsPerAssemblyV2Dto extends ReleaseStatsV2Dto {

private String assemblyAccession;

private int[] taxonomyIds;

private String[] taxonomyLinks;

public ReleaseStatsPerAssemblyV2Dto() {
}

public int[] getTaxonomyIds() {
return taxonomyIds;
}

public void setTaxonomyIds(int[] taxonomyIds) {
this.taxonomyIds = taxonomyIds;
}

public String getAssemblyAccession() {
return assemblyAccession;
}

public void setAssemblyAccession(String assemblyAccession) {
this.assemblyAccession = assemblyAccession;
}

public String[] getTaxonomyLinks() {
return taxonomyLinks;
}

public void setTaxonomyLinks(String[] taxonomyLinks) {
this.taxonomyLinks = taxonomyLinks;
}


@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReleaseStatsPerAssemblyV2Dto that = (ReleaseStatsPerAssemblyV2Dto) o;
return releaseVersion == that.releaseVersion &&
Objects.equals(assemblyAccession, that.assemblyAccession);
}

@Override
public int hashCode() {
return Objects.hash(assemblyAccession, releaseVersion);
}

@Override
public String toString() {
return "ReleaseStatsPerAssemblyDto{" +
"assemblyAccession='" + assemblyAccession + '\'' +
", releaseVersion=" + releaseVersion +
", taxonomyIds=" + taxonomyIds +
", releaseFolder='" + releaseFolder + '\'' +
", currentRs=" + getCurrentRs() +
", multiMappedRs=" + getMultiMappedRs() +
", mergedRs=" + getMergedRs() +
", deprecatedRs=" + getDeprecatedRs() +
", mergedDeprecatedRs=" + getMergedDeprecatedRs() +
", newCurrentRs=" + getNewCurrentRs() +
", newMultiMappedRs=" + getNewMultiMappedRs() +
", newMergedRs=" + getNewMergedRs() +
", newDeprecatedRs=" + getNewDeprecatedRs() +
", newMergedDeprecatedRs=" + getNewMergedDeprecatedRs() +
", releaseLink='" + releaseLink + '\'' +
", taxonomyLinks='" + taxonomyLinks + '\'' +
'}';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Copyright 2020 EMBL - European Bioinformatics Institute
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package uk.ac.ebi.eva.release.dto;

import java.util.Objects;

public class ReleaseStatsPerSpeciesV2Dto extends ReleaseStatsV2Dto {

private int taxonomyId;

private String[] assemblyAccessions;

private String taxonomyLink;

private String scientificName;

private String commonName;

public ReleaseStatsPerSpeciesV2Dto() {
}

public int getTaxonomyId() {
return taxonomyId;
}

public void setTaxonomyId(int taxonomyId) {
this.taxonomyId = taxonomyId;
}

public String getScientificName() {
return scientificName;
}

public void setScientificName(String scientificName) {
this.scientificName = scientificName;
}

public String getCommonName() {
return commonName;
}

public void setCommonName(String commonName) {
this.commonName = commonName;
}

public String getTaxonomyLink() {
return taxonomyLink;
}

public void setTaxonomyLink(String taxonomyLink) {
this.taxonomyLink = taxonomyLink;
}

public String[] getAssemblyAccessions() {
return assemblyAccessions;
}

public void setAssemblyAccessions(String[] assemblyAccessions) {
this.assemblyAccessions = assemblyAccessions;
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReleaseStatsPerSpeciesV2Dto that = (ReleaseStatsPerSpeciesV2Dto) o;
return taxonomyId == that.taxonomyId &&
releaseVersion == that.releaseVersion &&
Objects.equals(scientificName, that.scientificName) &&
Objects.equals(releaseFolder, that.releaseFolder) &&
Objects.equals(currentRs, that.currentRs) &&
Objects.equals(multiMappedRs, that.multiMappedRs) &&
Objects.equals(mergedRs, that.mergedRs) &&
Objects.equals(deprecatedRs, that.deprecatedRs) &&
Objects.equals(mergedDeprecatedRs, that.mergedDeprecatedRs) &&
Objects.equals(unmappedRs, that.unmappedRs) &&
Objects.equals(newCurrentRs, that.newCurrentRs) &&
Objects.equals(newMultiMappedRs, that.newMultiMappedRs) &&
Objects.equals(newMergedRs, that.newMergedRs) &&
Objects.equals(newDeprecatedRs, that.newDeprecatedRs) &&
Objects.equals(newMergedDeprecatedRs, that.newMergedDeprecatedRs) &&
Objects.equals(newUnmappedRs, that.newUnmappedRs) &&
Objects.equals(releaseLink, that.releaseLink) &&
Objects.equals(taxonomyLink, that.taxonomyLink);
}

@Override
public int hashCode() {
return Objects.hash(taxonomyId, releaseVersion, scientificName, releaseFolder, currentRs, multiMappedRs,
mergedRs, deprecatedRs, mergedDeprecatedRs, unmappedRs, newCurrentRs, newMultiMappedRs, newMergedRs,
newDeprecatedRs, newMergedDeprecatedRs, newUnmappedRs, releaseLink, taxonomyLink);
}

@Override
public String toString() {
return "ReleaseStatsPerSpeciesDto{" +
"taxonomyId=" + taxonomyId +
", releaseVersion=" + releaseVersion +
", scientificName='" + scientificName + '\'' +
", releaseFolder='" + releaseFolder + '\'' +
", currentRs=" + getCurrentRs() +
", multiMappedRs=" + getMultiMappedRs() +
", mergedRs=" + getMergedRs() +
", deprecatedRs=" + getDeprecatedRs() +
", mergedDeprecatedRs=" + getMergedDeprecatedRs() +
", unmappedRs=" + getUnmappedRs() +
", newCurrentRs=" + getNewCurrentRs() +
", newMultiMappedRs=" + getNewMultiMappedRs() +
", newMergedRs=" + getNewMergedRs() +
", newDeprecatedRs=" + getNewDeprecatedRs() +
", newMergedDeprecatedRs=" + getNewMergedDeprecatedRs() +
", newUnmappedRs=" + getNewUnmappedRs() +
", releaseLink='" + releaseLink + '\'' +
", taxonomyLink='" + taxonomyLink + '\'' +
'}';
}
}
Loading

0 comments on commit f384731

Please sign in to comment.