Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a2e405a
SCRUM-3995 start of phenotype annotation indexer
cmpich May 14, 2024
85df567
small refactor
cmpich May 14, 2024
cfdc86d
small refactor
cmpich May 14, 2024
933a968
small refactor
cmpich May 14, 2024
79e3f0b
SCRUM-3995 create PhenotypeAnnotationIndexer
cmpich May 17, 2024
656ece3
make phenotypeStatement sortable with case insensitive
cmpich May 21, 2024
95a88ee
create new field with sort directive for phenotype statement
cmpich May 21, 2024
cd290c5
remove unused code
cmpich May 22, 2024
f303c3e
SCRUM-4092 make all disease qualifier names be their original names i…
cmpich May 28, 2024
1483c9d
refactor implicated DAs
cmpich May 28, 2024
829678e
remove comments
cmpich May 28, 2024
6169f0c
add allele phenotype annotations and include inferred gene / asserted…
cmpich Jun 21, 2024
c4e60ec
remove debugging code
cmpich Jun 21, 2024
147b7db
rebased on stage, needed changes for the v0.36.1 version, fix downloa…
cmpich Feb 17, 2025
defbee0
add allele indexing to the phenotype annotation indexer
cmpich Feb 18, 2025
b4c1921
SCRUM-4869 populate associated gene to transcript object
cmpich Feb 18, 2025
30b4908
Add allele indexing
cmpich Feb 21, 2025
2ac5447
SCRUM-4724 convert phenotype table on allele page
cmpich Feb 24, 2025
8d42342
merge SCRUM-3995 int stage
cmpich Feb 24, 2025
4a0ac4c
fix checkstyle issues
cmpich Feb 24, 2025
e6889e7
merging stage code and optimize classes
cmpich Feb 26, 2025
c8a834e
Merge branch 'stage' into SCRUM-phenotypeAnnotations
cmpich Feb 26, 2025
bfadbee
fix code style recommendations
cmpich Feb 26, 2025
b150eac
Merge branch 'stage' into SCRUM-phenotypeAnnotations
cmpich Feb 26, 2025
f9fb637
Merge branch 'stage' into SCRUM-phenotypeAnnotations
cmpich Feb 27, 2025
a54cb84
Merge branch 'stage' into SCRUM-phenotypeAnnotations
cmpich Feb 27, 2025
524987e
refactor to remove unsued code
cmpich Feb 28, 2025
38f7558
remove unused imports
cmpich Feb 28, 2025
20bdb64
more refactoring aroudn ESService classes
cmpich Mar 1, 2025
2d7a852
more refactoring
cmpich Mar 1, 2025
5cd14c2
Merge branch 'stage' into SCRUM-phenotypeAnnotations
cmpich Mar 1, 2025
50ea9aa
fix merging issues
cmpich Mar 2, 2025
7744c96
fix merging issues
cmpich Mar 2, 2025
ec68508
remove unused method
cmpich Mar 2, 2025
670f8bb
clear out method from child class
cmpich Mar 2, 2025
96cd884
Removed tabs spaces issues
oblodgett Mar 3, 2025
c9808e3
Cleaned up indexer config
oblodgett Mar 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package org.alliancegenome.api.controller;

import java.time.LocalDateTime;

import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.alliancegenome.api.entity.AlleleDiseaseAnnotationDocument;
import org.alliancegenome.api.entity.AllelePhenotypeAnnotationDocument;
import org.alliancegenome.api.rest.interfaces.AlleleRESTInterface;
import org.alliancegenome.api.service.AlleleService;
import org.alliancegenome.api.service.DiseaseESService;
import org.alliancegenome.api.service.EntityType;
import org.alliancegenome.api.service.VariantService;
import org.alliancegenome.api.service.*;
import org.alliancegenome.api.service.helper.APIServiceHelper;
import org.alliancegenome.api.translators.tdf.DiseaseAnnotationToTdfTranslator;
import org.alliancegenome.cache.repository.helper.JsonResultResponse;
Expand All @@ -17,14 +17,10 @@
import org.alliancegenome.core.translators.tdf.PhenotypeAnnotationToTdfTranslator;
import org.alliancegenome.es.model.query.FieldFilter;
import org.alliancegenome.es.model.query.Pagination;
import org.alliancegenome.neo4j.entity.PhenotypeAnnotation;
import org.alliancegenome.neo4j.entity.node.Allele;
import org.alliancegenome.neo4j.entity.node.Variant;

import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import java.time.LocalDateTime;

@Slf4j
@RequestScoped
Expand All @@ -39,11 +35,13 @@ public class AlleleController implements AlleleRESTInterface {
@Inject
DiseaseESService diseaseESService;

@Inject
PhenotypeESService phenotypeESService;
//@Inject
//private HttpRequest request;

private AlleleToTdfTranslator translator = new AlleleToTdfTranslator();
private final PhenotypeAnnotationToTdfTranslator phenotypeAnnotationToTdfTranslator = new PhenotypeAnnotationToTdfTranslator();
private PhenotypeAnnotationToTdfTranslator phenotypeTranslator = new PhenotypeAnnotationToTdfTranslator();
Comment thread
oblodgett marked this conversation as resolved.
private final DiseaseAnnotationToTdfTranslator diseaseToTdfTranslator = new DiseaseAnnotationToTdfTranslator();

@Override
Expand Down Expand Up @@ -106,25 +104,25 @@ public JsonResultResponse<Allele> getAllelesPerSpecies(String species, Integer l
}

@Override
public JsonResultResponse<PhenotypeAnnotation> getPhenotypePerAllele(String id, Integer limit, Integer page, String phenotype, String source, String reference, String sortBy) {
public JsonResultResponse<AllelePhenotypeAnnotationDocument> getPhenotypePerAllele(
String id,
Integer limit,
Integer page,
String phenotype,
String source,
String reference,
String sortBy) {
long startTime = System.currentTimeMillis();
Pagination pagination = new Pagination(page, limit, sortBy, null);
pagination.addFieldFilter(FieldFilter.PHENOTYPE, phenotype);
pagination.addFieldFilter(FieldFilter.SOURCE, source);
pagination.addFieldFilter(FieldFilter.FREFERENCE, reference);
if (pagination.hasErrors()) {
RestErrorMessage message = new RestErrorMessage();
message.setErrors(pagination.getErrors());
throw new RestErrorException(message);
}

pagination.addFilterOption("phenotypeStatement", phenotype);
pagination.addFilterOption("pubmedPubModIDs", reference);
try {
JsonResultResponse<PhenotypeAnnotation> phenotypeAnnotation = alleleService.getPhenotype(id, pagination);
phenotypeAnnotation.setHttpServletRequest(null);
phenotypeAnnotation.calculateRequestDuration(startTime);
return phenotypeAnnotation;
JsonResultResponse<AllelePhenotypeAnnotationDocument> phenotypes = phenotypeESService.getAllelePhenotypeAnnotations(id, pagination, false);
phenotypes.setHttpServletRequest(null);
phenotypes.calculateRequestDuration(startTime);
return phenotypes;
} catch (Exception e) {
log.error("Error while retrieving phenotype info", e);
log.error("Error while retrieving phenotypes", e);
RestErrorMessage error = new RestErrorMessage();
error.addErrorMessage(e.getMessage());
throw new RestErrorException(error);
Expand All @@ -133,34 +131,37 @@ public JsonResultResponse<PhenotypeAnnotation> getPhenotypePerAllele(String id,

@Override
public Response getPhenotypesPerAlleleDownload(String id, String phenotype, String source, String reference, String sortBy) {
JsonResultResponse<PhenotypeAnnotation> response = getPhenotypePerAllele(id,
Integer.MAX_VALUE,
1,
phenotype,
source,
reference,
sortBy);
Response.ResponseBuilder responseBuilder = Response.ok(phenotypeAnnotationToTdfTranslator.getAllRowsForAlleles(response.getResults()));
// retrieve all records
JsonResultResponse<AllelePhenotypeAnnotationDocument> response =
getPhenotypePerAllele(id,
250000,
1,
phenotype,
source,
reference,
sortBy);
Response.ResponseBuilder responseBuilder = Response.ok(phenotypeTranslator.getAllRows(response.getResults()));
APIServiceHelper.setDownloadHeader(id, EntityType.ALLELE, EntityType.PHENOTYPE, responseBuilder);
return responseBuilder.build();
}

@Override
public JsonResultResponse<AlleleDiseaseAnnotationDocument> getDiseasePerAllele(String alleleID,
String filterOptions,
String filterReference,
String diseaseTerm,
String filterSource,
String geneticEntity,
String geneticEntityType,
String associationType,
String diseaseQualifier,
String evidenceCode,
Boolean debug,
Integer limit,
Integer page,
String sortBy,
String asc) {
public JsonResultResponse<AlleleDiseaseAnnotationDocument> getDiseasePerAllele(
String alleleID,
String filterOptions,
String filterReference,
String diseaseTerm,
String filterSource,
String geneticEntity,
String geneticEntityType,
String associationType,
String diseaseQualifier,
String evidenceCode,
Boolean debug,
Integer limit,
Integer page,
String sortBy,
String asc) {

LocalDateTime startDate = LocalDateTime.now();
Pagination pagination = new Pagination(page, limit, sortBy, asc);
Expand Down
Loading
Loading