diff --git a/src/main/cliapp/src/containers/layout/SiteLayout.js b/src/main/cliapp/src/containers/layout/SiteLayout.js
index 7c8838a6b..2bce1553c 100644
--- a/src/main/cliapp/src/containers/layout/SiteLayout.js
+++ b/src/main/cliapp/src/containers/layout/SiteLayout.js
@@ -375,7 +375,7 @@ export const SiteLayout = (props) => {
{
label: 'Search index UI (cerebro)',
icon: 'pi pi-fw pi-home',
- url: `http://cerebro.alliancegenome.org:9000/#!/overview?host=https://${siteContext?.apiVersion?.esHost}`,
+ url: `http://cerebro.alliancegenome.org:9000/#!/overview?host=http://${siteContext?.apiVersion?.esHost}`,
target: '_blank',
},
{
@@ -384,6 +384,12 @@ export const SiteLayout = (props) => {
url: `http://logs.alliancegenome.org:5601/app/logtrail#/?q=*&h=agr.curation.${siteContext?.apiVersion?.env}.api.server&t=Now&i=logstash*&_g=()`,
target: '_blank',
},
+ {
+ label: 'MaTI Swagger UI',
+ icon: 'pi pi-fw pi-home',
+ url: siteContext?.apiVersion?.matiHost + '/q/swagger-ui/',
+ target: '_blank',
+ },
{ label: 'Site Health', icon: 'pi pi-fw pi-plus', to: '/healthpage' },
],
},
diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js
index dc60d520d..d150ad6d6 100644
--- a/src/main/cliapp/src/service/DataLoadService.js
+++ b/src/main/cliapp/src/service/DataLoadService.js
@@ -81,10 +81,11 @@ export class DataLoadService extends BaseAuthService {
getBackendBulkLoadTypes(loadType) {
const bulkLoadTypes = {
BulkFMSLoad: [
+ 'BIOGRID-ORCS',
'GFF', // This needs to be removed at some point
-
- 'GFF_EXON',
'GFF_CDS',
+ 'GFF_EXON',
+ 'GFF_GENE',
'GFF_TRANSCRIPT',
'HTPDATASET',
'HTPDATASAMPLE',
@@ -95,8 +96,9 @@ export class DataLoadService extends BaseAuthService {
'PHENOTYPE',
'PARALOGY',
'SEQUENCE_TARGETING_REAGENT',
- // 'VARIATION',
- 'BIOGRID-ORCS',
+ 'VARIATION',
+ 'VEPGENE',
+ 'VEPTRANSCRIPT',
],
BulkURLLoad: [
'ONTOLOGY',
@@ -106,6 +108,7 @@ export class DataLoadService extends BaseAuthService {
'DISEASE_ANNOTATION',
'RESOURCE_DESCRIPTOR',
'EXPRESSION_ATLAS',
+ 'GAF',
],
BulkManualLoad: [
'FULL_INGEST',
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
index 7eb0a89cd..557a17593 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java
@@ -11,44 +11,52 @@ private EntityFieldConstants() {
public static final String SOURCE_ORGANIZATION = "sourceOrganization.abbreviation";
public static final String DATA_PROVIDER = "dataProvider." + SOURCE_ORGANIZATION;
public static final String SECONDARY_DATA_PROVIDER = "secondaryDataProvider." + SOURCE_ORGANIZATION;
-
+
public static final String DA_SUBJECT = "diseaseAnnotationSubject";
public static final String EA_SUBJECT = "expressionAnnotationSubject";
public static final String PA_SUBJECT = "phenotypeAnnotationSubject";
+ public static final String EXP_EXPERIMENT_SUBJECT = "entityAssayed";
public static final String ALLELE_ASSOCIATION_SUBJECT = "alleleAssociationSubject";
public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT = "codingSequenceAssociationSubject";
public static final String CONSTRUCT_ASSOCIATION_SUBJECT = "constructAssociationSubject";
public static final String EXON_ASSOCIATION_SUBJECT = "exonAssociationSubject";
+ public static final String GENE_ASSOCIATION_SUBJECT = "geneAssociationSubject";
public static final String VARIANT_ASSOCIATION_SUBJECT = "variantAssociationSubject";
public static final String SQTR_ASSOCIATION_SUBJECT = "sequenceTargetingReagentAssociationSubject";
public static final String TRANSCRIPT_ASSOCIATION_SUBJECT = "transcriptAssociationSubject";
-
+
+
public static final String DA_SUBJECT_TAXON = DA_SUBJECT + "." + TAXON;
public static final String EA_SUBJECT_TAXON = EA_SUBJECT + "." + TAXON;
public static final String PA_SUBJECT_TAXON = PA_SUBJECT + "." + TAXON;
-
+ public static final String EXP_EXPERIMENT_TAXON = EXP_EXPERIMENT_SUBJECT + "." + TAXON;
+
public static final String ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = ALLELE_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER = CODING_SEQUENCE_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = CONSTRUCT_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER = EXON_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
+ public static final String GENE_ASSOCIATION_SUBJECT_DATA_PROVIDER = GENE_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String VARIANT_ASSOCIATION_SUBJECT_DATA_PROVIDER = VARIANT_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String SQTR_ASSOCIATION_SUBJECT_DATA_PROVIDER = SQTR_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
public static final String TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER = TRANSCRIPT_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER;
-
+
public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT_TAXON = CODING_SEQUENCE_ASSOCIATION_SUBJECT + "." + TAXON;
public static final String EXON_ASSOCIATION_SUBJECT_TAXON = EXON_ASSOCIATION_SUBJECT + "." + TAXON;
+ public static final String GENE_ASSOCIATION_SUBJECT_TAXON = GENE_ASSOCIATION_SUBJECT + "." + TAXON;
public static final String TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON = TRANSCRIPT_ASSOCIATION_SUBJECT + "." + TAXON;
public static final String VARIANT_ASSOCIATION_SUBJECT_TAXON = VARIANT_ASSOCIATION_SUBJECT + "." + TAXON;
-
+
public static final String GENOMIC_LOCATION_ASSOCIATION_OBJECT = "GenomicLocationAssociationObject";
public static final String CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "codingSequence" + GENOMIC_LOCATION_ASSOCIATION_OBJECT;
public static final String EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "exon" + GENOMIC_LOCATION_ASSOCIATION_OBJECT;
+ public static final String GENE_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "gene" + GENOMIC_LOCATION_ASSOCIATION_OBJECT;
public static final String TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "transcript" + GENOMIC_LOCATION_ASSOCIATION_OBJECT;
public static final String VARIANT_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "variant" + GENOMIC_LOCATION_ASSOCIATION_OBJECT;
public static final String CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY = "codingSequence" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + "." + ASSEMBLY;
public static final String EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY = "exon" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + "." + ASSEMBLY;
public static final String TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY = "transcript" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + "." + ASSEMBLY;
-
+ public static final String GENE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY = "gene" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + "." + ASSEMBLY;
+
public static final String SUBJECT_GENE_DATA_PROVIDER = "subjectGene." + DATA_PROVIDER;
public static final String SUBJECT_GENE_TAXON = "subjectGene." + TAXON;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java
index 9ecf6976c..06acbcd48 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java
@@ -8,11 +8,16 @@ private Gff3Constants() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
+ public static final List
GENE_TYPES = List.of(
+ "gene", "pseudogene", "lincRNA_gene", "lncRNA_gene", "ncRNA_gene", "rRNA_gene",
+ "snRNA_gene", "snoRNA_gene", "tRNA_gene", "telomerase_RNA_gene", "transposable_element_gene"
+ );
+
public static final List TRANSCRIPT_TYPES = List.of(
"mRNA", "ncRNA", "piRNA", "lincRNA", "miRNA", "pre_miRNA", "snoRNA", "lncRNA",
"tRNA", "snRNA", "rRNA", "antisense_RNA", "C_gene_segment", "V_gene_segment",
"pseudogene_attribute", "pseudogenic_transcript", "lnc_RNA", "nc_primary_transcript",
- "circular_ncRNA"
+ "circular_ncRNA", "transcript"
);
public static final List STRANDS = List.of("+", "-");
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
index 4c54350c0..92cb9891d 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java
@@ -5,7 +5,7 @@ public class LinkMLSchemaConstants {
private LinkMLSchemaConstants() {
// Hidden from view, as it is a utility class
}
- public static final String LATEST_RELEASE = "2.8.0";
+ public static final String LATEST_RELEASE = "2.8.1";
public static final String MIN_ONTOLOGY_RELEASE = "1.2.4";
public static final String MAX_ONTOLOGY_RELEASE = LATEST_RELEASE;
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
index 0e879c431..2ca7244d2 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java
@@ -15,5 +15,6 @@ private ValidationConstants() {
public static final String DUPLICATE_MESSAGE = "Duplicate entries found";
public static final String DUPLICATE_RELATION_PREFIX = "Entries found with same relation field - ";
public static final String UNRECOGNIZED_MESSAGE = "Unrecognized entry"; // To be used instead of INVALID_MESSAGE when entry to be skipped instead of failed
+ public static final String AMBIGUOUS_MESSAGE = "Could not be unambiguously resolved";
}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
index db0a0d007..d7a3f03b8 100644
--- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
+++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java
@@ -84,7 +84,14 @@ private VocabularyConstants() {
public static final String ANATOMICAL_SUBSTRUCTURE_QUALIFIER = "anatomical_subtructure_qualifier";
public static final String CELLULAR_COMPONENT_QUALIFIER = "cellular_component_qualifier";
- public static final String HTP_DATASET_CATEGORY_TAGS = "data_set_category_tags";
+ public static final String HTP_DATASET_CATEGORY_TAGS_VOCABULARY = "data_set_category_tags";
public static final String HTP_DATASET_NOTE_TYPE_VOCABULARY_TERM_SET = "htp_expression_dataset_note_type";
public static final String HTP_DATASET_SAMPLE_NOTE_TYPE_VOCABULARY_TERM_SET = "htp_expression_dataset_sample_note_type";
+
+ public static final String VEP_IMPACT_VOCABULARY = "vep_impact";
+ public static final String VEP_CONSEQUENCE_VOCABULARY = "vep_consequence";
+ public static final String SIFT_PREDICTION_VOCABULARY = "sift_prediction";
+ public static final String POLYPHEN_PREDICTION_VOCABULARY = "polyphen_prediction";
+
+ public static final String HTP_DATASET_SAMPLE_SEQUENCE_FORMAT_VOCABULARY = "htp_data_sample_sequencing_format";
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java b/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
index 3f2d12494..2a5f88b1f 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/APIVersionInfoController.java
@@ -1,10 +1,7 @@
package org.alliancegenome.curation_api.controllers;
-import static org.reflections.scanners.Scanners.TypesAnnotated;
-
-import java.util.Set;
-import java.util.TreeMap;
-
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.interfaces.APIVersionInterface;
import org.alliancegenome.curation_api.model.output.APIVersionInfo;
@@ -12,8 +9,10 @@
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.reflections.Reflections;
-import jakarta.enterprise.context.RequestScoped;
-import jakarta.inject.Inject;
+import java.util.Set;
+import java.util.TreeMap;
+
+import static org.reflections.scanners.Scanners.TypesAnnotated;
@RequestScoped
public class APIVersionInfoController implements APIVersionInterface {
@@ -33,6 +32,9 @@ public class APIVersionInfoController implements APIVersionInterface {
@ConfigProperty(name = "NET")
String env;
+ @ConfigProperty(name = "mati.url")
+ String matiURL;
+
@Override
public APIVersionInfo get() {
@@ -59,9 +61,14 @@ public APIVersionInfo get() {
info.setName(name);
info.setAgrCurationSchemaVersions(linkMLClassVersions);
info.setSubmittedClassSchemaVersions(submittedClassVersions);
- info.setEsHost(esHost);
+ String[] array = esHost.split(",");
+ if (array.length > 0) {
+ info.setEsHost(array[0]);
+ } else {
+ info.setEsHost(esHost);
+ }
+ info.setMatiHost(matiURL);
info.setEnv(env);
return info;
}
-
}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/BiogridOrcCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/BiogridOrcCrudController.java
new file mode 100644
index 000000000..c7011821c
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/BiogridOrcCrudController.java
@@ -0,0 +1,35 @@
+package org.alliancegenome.curation_api.controllers.crud;
+
+import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
+import org.alliancegenome.curation_api.dao.CrossReferenceDAO;
+import org.alliancegenome.curation_api.interfaces.crud.BiogridOrcCrudInterface;
+import org.alliancegenome.curation_api.jobs.executors.BiogridOrcExecutor;
+import org.alliancegenome.curation_api.model.entities.CrossReference;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.BiogridOrcIngestFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.services.CrossReferenceService;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+
+@RequestScoped
+public class BiogridOrcCrudController extends BaseEntityCrudController implements BiogridOrcCrudInterface {
+
+ @Inject
+ CrossReferenceService crossReferenceService;
+
+ @Inject
+ BiogridOrcExecutor biogridOrcExecutor;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setService(crossReferenceService);
+ }
+
+ @Override
+ public APIResponse updateBiogridOrc(String dataProvider, BiogridOrcIngestFmsDTO biogridOrcData) {
+ return biogridOrcExecutor.runLoadApi(dataProvider, biogridOrcData.getData());
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionAnnotationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionAnnotationCrudController.java
index c86c11831..42322337b 100644
--- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionAnnotationCrudController.java
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionAnnotationCrudController.java
@@ -32,7 +32,7 @@ public ObjectResponse getByIdentifier(String identifie
}
public APIResponse updateExpressionAnnotations(String dataProvider, List annotations) {
- return geneExpressionExecutor.runLoadApi(geneExpressionAnnotationService, dataProvider, annotations);
+ APIResponse response = geneExpressionExecutor.runLoadAPI(geneExpressionAnnotationService, dataProvider, annotations);
+ return response;
}
}
-
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionExperimentCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionExperimentCrudController.java
new file mode 100644
index 000000000..b44393683
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GeneExpressionExperimentCrudController.java
@@ -0,0 +1,34 @@
+package org.alliancegenome.curation_api.controllers.crud;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
+import org.alliancegenome.curation_api.dao.GeneExpressionExperimentDAO;
+import org.alliancegenome.curation_api.interfaces.crud.GeneExpressionExperimentCrudInterface;
+import org.alliancegenome.curation_api.jobs.executors.GeneExpressionExecutor;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionExperiment;
+import org.alliancegenome.curation_api.response.ObjectResponse;
+import org.alliancegenome.curation_api.services.GeneExpressionExperimentService;
+
+
+@RequestScoped
+public class GeneExpressionExperimentCrudController extends BaseEntityCrudController implements GeneExpressionExperimentCrudInterface {
+
+ @Inject
+ GeneExpressionExperimentService geneExpressionExperimentService;
+ @Inject
+ GeneExpressionExecutor geneExpressionExecutor;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setService(geneExpressionExperimentService);
+ }
+
+ public ObjectResponse getByIdentifier(String identifierString) {
+ return geneExpressionExperimentService.getByIdentifier(identifierString);
+ }
+
+}
+
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/HTPExpressionDatasetSampleAnnotationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/HTPExpressionDatasetSampleAnnotationCrudController.java
new file mode 100644
index 000000000..a75bdefba
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/HTPExpressionDatasetSampleAnnotationCrudController.java
@@ -0,0 +1,35 @@
+package org.alliancegenome.curation_api.controllers.crud;
+
+import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
+import org.alliancegenome.curation_api.dao.HTPExpressionDatasetSampleAnnotationDAO;
+import org.alliancegenome.curation_api.interfaces.crud.HTPExpressionDatasetSampleAnnotationCrudInterface;
+import org.alliancegenome.curation_api.jobs.executors.HTPExpressionDatasetSampleAnnotationExecutor;
+import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetSampleAnnotation;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetSampleAnnotationIngestFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.services.HTPExpressionDatasetSampleAnnotationService;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+
+@RequestScoped
+public class HTPExpressionDatasetSampleAnnotationCrudController extends BaseEntityCrudController implements HTPExpressionDatasetSampleAnnotationCrudInterface {
+
+ @Inject
+ HTPExpressionDatasetSampleAnnotationService htpExpressionDatasetSampleAnnotationService;
+ @Inject
+ HTPExpressionDatasetSampleAnnotationExecutor htpExpressionDatasetSampleAnnotationExecutor;
+
+ @Override
+ @PostConstruct
+ public void init() {
+ setService(htpExpressionDatasetSampleAnnotationService);
+ }
+
+ @Override
+ public APIResponse updateHTPExpressionDatasetSampleAnnotation(String dataProvider, HTPExpressionDatasetSampleAnnotationIngestFmsDTO htpDatasetSampleData) {
+ return htpExpressionDatasetSampleAnnotationExecutor.runLoadApi(htpExpressionDatasetSampleAnnotationService, dataProvider, htpDatasetSampleData.getData());
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/PredictedVariantConsequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/PredictedVariantConsequenceCrudController.java
new file mode 100644
index 000000000..1a709cce6
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/PredictedVariantConsequenceCrudController.java
@@ -0,0 +1,40 @@
+package org.alliancegenome.curation_api.controllers.crud;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
+import org.alliancegenome.curation_api.dao.PredictedVariantConsequenceDAO;
+import org.alliancegenome.curation_api.interfaces.crud.PredictedVariantConsequenceCrudInterface;
+import org.alliancegenome.curation_api.jobs.executors.VepGeneExecutor;
+import org.alliancegenome.curation_api.jobs.executors.VepTranscriptExecutor;
+import org.alliancegenome.curation_api.model.entities.PredictedVariantConsequence;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.VepTxtDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.services.PredictedVariantConsequenceService;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+
+@RequestScoped
+public class PredictedVariantConsequenceCrudController extends BaseEntityCrudController
+ implements PredictedVariantConsequenceCrudInterface {
+
+ @Inject PredictedVariantConsequenceService predictedVariantConsequenceService;
+ @Inject VepTranscriptExecutor vepTranscriptExecutor;
+ @Inject VepGeneExecutor vepGeneExecutor;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setService(predictedVariantConsequenceService);
+ }
+
+ public APIResponse updateTranscriptLevelConsequences(String dataProvider, List consequenceData) {
+ return vepTranscriptExecutor.runLoadApi(predictedVariantConsequenceService, dataProvider, consequenceData);
+ }
+
+ public APIResponse updateGeneLevelConsequences(String dataProvider, List consequenceData) {
+ return vepGeneExecutor.runLoadApi(dataProvider, consequenceData);
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/geneAssociations/GeneGenomicLocationAssociationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/geneAssociations/GeneGenomicLocationAssociationCrudController.java
new file mode 100644
index 000000000..92c175e7f
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/geneAssociations/GeneGenomicLocationAssociationCrudController.java
@@ -0,0 +1,36 @@
+package org.alliancegenome.curation_api.controllers.crud.geneAssociations;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController;
+import org.alliancegenome.curation_api.dao.associations.geneAssociations.GeneGenomicLocationAssociationDAO;
+import org.alliancegenome.curation_api.interfaces.crud.geneAssociations.GeneGenomicLocationAssociationCrudInterface;
+import org.alliancegenome.curation_api.jobs.executors.gff.Gff3GeneExecutor;
+import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGenomicLocationAssociation;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.response.LoadHistoryResponce;
+import org.alliancegenome.curation_api.services.associations.geneAssociations.GeneGenomicLocationAssociationService;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+
+@RequestScoped
+public class GeneGenomicLocationAssociationCrudController extends BaseEntityCrudController implements GeneGenomicLocationAssociationCrudInterface {
+
+ @Inject GeneGenomicLocationAssociationService geneGenomicLocationService;
+
+ @Inject Gff3GeneExecutor gff3GeneExecutor;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setService(geneGenomicLocationService);
+ }
+
+ public APIResponse updateGeneLocations(String dataProvider, String assembly, List gffData) {
+ LoadHistoryResponce resp = (LoadHistoryResponce) gff3GeneExecutor.runLoadApi(dataProvider, assembly, gffData);
+ return new LoadHistoryResponce(resp.getHistory());
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/AnatomicalSiteDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/AnatomicalSiteDAO.java
new file mode 100644
index 000000000..1147a7532
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/AnatomicalSiteDAO.java
@@ -0,0 +1,13 @@
+package org.alliancegenome.curation_api.dao;
+
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.AnatomicalSite;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class AnatomicalSiteDAO extends BaseSQLDAO {
+ protected AnatomicalSiteDAO() {
+ super(AnatomicalSite.class);
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java
index 162d95391..5908c9952 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java
@@ -5,10 +5,13 @@
import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
import org.alliancegenome.curation_api.model.entities.CrossReference;
import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage;
+import org.alliancegenome.curation_api.model.input.Pagination;
+import org.alliancegenome.curation_api.response.SearchResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
@ApplicationScoped
public class CrossReferenceDAO extends BaseSQLDAO {
@@ -32,6 +35,31 @@ public Map getGenesWithCrossRefs(ResourceDescriptorPage page) {
return ensemblGeneMap;
}
+ public Map getGenesWithCrossRefs(Set referencedCuries) {
+ String sql = """
+ select gc.genomicentity_id, cr.referencedcurie from genomicentity_crossreference as gc, crossreference as cr
+ where gc.crossreferences_id = cr.id AND cr.referencedCurie IN (:referencedCuries)
+ """;
+ Query query = entityManager.createNativeQuery(sql);
+ query.setParameter("referencedCuries", referencedCuries);
+ List objects = query.getResultList();
+ Map idCurieMap = new HashMap<>();
+ objects.forEach(object -> {
+ idCurieMap.put((String) object[1], (Long) object[0]);
+ });
+ return idCurieMap;
+
+ }
+
+ public List getAllCrossRefsByPage(ResourceDescriptorPage page) {
+ HashMap params = new HashMap<>();
+ params.put("resourceDescriptorPage.name", page.getName());
+ Pagination pagination = new Pagination();
+ pagination.setLimit(10_000_000);
+ SearchResponse crossReferenceResponse = findByParams(pagination, params);
+ return crossReferenceResponse.getResults();
+ }
+
public Integer persistAccessionGeneAssociated(Long crossReferenceID, Long geneID) {
String sql = """
insert into genomicentity_crossreference (crossreferences_id,genomicentity_id)
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GeneExpressionExperimentDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GeneExpressionExperimentDAO.java
new file mode 100644
index 000000000..ab3b8604a
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/GeneExpressionExperimentDAO.java
@@ -0,0 +1,13 @@
+package org.alliancegenome.curation_api.dao;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionExperiment;
+
+@ApplicationScoped
+public class GeneExpressionExperimentDAO extends BaseSQLDAO {
+
+ protected GeneExpressionExperimentDAO() {
+ super(GeneExpressionExperiment.class);
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GeneOntologyAnnotationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GeneOntologyAnnotationDAO.java
new file mode 100644
index 000000000..455352f1b
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/GeneOntologyAnnotationDAO.java
@@ -0,0 +1,59 @@
+package org.alliancegenome.curation_api.dao;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.persistence.Query;
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.GeneOntologyAnnotation;
+import org.alliancegenome.curation_api.model.entities.Organization;
+import org.alliancegenome.curation_api.model.ingest.dto.GeneOntologyAnnotationDTO;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@ApplicationScoped
+public class GeneOntologyAnnotationDAO extends BaseSQLDAO {
+
+ protected GeneOntologyAnnotationDAO() {
+ super(GeneOntologyAnnotation.class);
+ }
+
+ public GeneOntologyAnnotation persistGeneGoAssociation(GeneOntologyAnnotation gaf) {
+ String sql = """
+ insert into GeneOntologyAnnotation (id, singlegene_id,goterm_id)
+ VALUES (nextval('GeneOntologyAnnotation_SEQ'), :geneID, :goID)
+ """;
+ Query query = entityManager.createNativeQuery(sql);
+ query.setParameter("goID", gaf.getGoTerm().getId());
+ query.setParameter("geneID", gaf.getSingleGene().getId());
+ query.executeUpdate();
+
+ sql = "select currval('GeneOntologyAnnotation_SEQ')";
+ Object object = entityManager.createNativeQuery(sql).getSingleResult();
+ gaf.setId((Long) object);
+ return gaf;
+ }
+
+ public Map getAllGafIdsPerProvider(Organization sourceOrganization) {
+ Query query = entityManager.createNativeQuery("""
+ select gga.id, be.modentityid, ot.curie
+ from GeneOntologyAnnotation as gga , BiologicalEntity as be, ontologyterm as ot,
+ species as spec
+ where gga.singlegene_id = be.id
+ and be.taxon_id = spec.taxon_id
+ and spec.displayname = :speciesName
+ and gga.goterm_id = ot.id
+ """);
+ query.setParameter("speciesName", sourceOrganization.getAbbreviation());
+ List result = query.getResultList();
+ Map map = new HashMap<>();
+ result.forEach(object -> {
+ GeneOntologyAnnotationDTO dto = new GeneOntologyAnnotationDTO();
+ dto.setGeneIdentifier((String) object[1]);
+ dto.setGoTermCurie((String) object[2]);
+ map.put((Long) object[0], dto);
+ });
+ return map;
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetSampleAnnotationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetSampleAnnotationDAO.java
new file mode 100644
index 000000000..910d492f8
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetSampleAnnotationDAO.java
@@ -0,0 +1,14 @@
+package org.alliancegenome.curation_api.dao;
+
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetSampleAnnotation;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class HTPExpressionDatasetSampleAnnotationDAO extends BaseSQLDAO {
+
+ protected HTPExpressionDatasetSampleAnnotationDAO() {
+ super(HTPExpressionDatasetSampleAnnotation.class);
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/PredictedVariantConsequenceDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/PredictedVariantConsequenceDAO.java
new file mode 100644
index 000000000..e602925cf
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/PredictedVariantConsequenceDAO.java
@@ -0,0 +1,15 @@
+package org.alliancegenome.curation_api.dao;
+
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.PredictedVariantConsequence;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class PredictedVariantConsequenceDAO extends BaseSQLDAO {
+
+ protected PredictedVariantConsequenceDAO() {
+ super(PredictedVariantConsequence.class);
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ReferenceDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ReferenceDAO.java
index 3edde99bb..994971505 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/ReferenceDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/ReferenceDAO.java
@@ -1,11 +1,13 @@
package org.alliancegenome.curation_api.dao;
-import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
-import org.alliancegenome.curation_api.model.entities.Reference;
-
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.persistence.Query;
import jakarta.transaction.Transactional;
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.Reference;
+
+import java.util.*;
+import java.util.stream.Collectors;
@ApplicationScoped
public class ReferenceDAO extends BaseSQLDAO {
@@ -35,4 +37,55 @@ protected void deleteReferenceForeignKey(String table, String column, String ori
jpqlQuery.executeUpdate();
}
+ public HashMap getReferenceMap() {
+ HashMap referenceIdMap = new HashMap<>();
+ Query q = entityManager.createNativeQuery("""
+ SELECT ref.id, cr.referencedcurie
+ FROM Reference as ref, reference_crossreference as assoc, Crossreference as cr
+ where assoc.reference_id = ref.id
+ and assoc.crossreferences_id = cr.id
+ """);
+ List ids = q.getResultList();
+ Set refIDs = ids.stream().map(object -> (Long) object[0]).collect(Collectors.toSet());
+ Map> idMap = ids.stream().collect(Collectors.groupingBy(o -> (Long) o[0]));
+ List refs = new ArrayList<>();
+ refIDs.forEach(id -> {
+ Reference reference = entityManager.getReference(Reference.class, id);
+ // populate cross references
+ reference.getCrossReferences().size();
+ refs.add(reference);
+ referenceIdMap.put(String.valueOf(id), reference);
+ if (idMap.get(id) != null) {
+ idMap.get(id).forEach(objects -> {
+ referenceIdMap.put((String) objects[1], reference);
+ });
+ }
+ });
+ return referenceIdMap;
+ }
+
+ public HashMap getShallowReferenceMap() {
+ HashMap referenceIdMap = new HashMap<>();
+ Query q = entityManager.createNativeQuery("""
+ SELECT ref.id, cr.referencedcurie
+ FROM Reference as ref, reference_crossreference as assoc, Crossreference as cr
+ where assoc.reference_id = ref.id
+ and assoc.crossreferences_id = cr.id
+ """);
+ List ids = q.getResultList();
+ Set refIDs = ids.stream().map(object -> (Long) object[0]).collect(Collectors.toSet());
+ Map> idMap = ids.stream().collect(Collectors.groupingBy(o -> (Long) o[0]));
+ List refs = new ArrayList<>();
+ refIDs.forEach(id -> {
+ Reference reference = getShallowEntity(Reference.class, id);
+ refs.add(reference);
+ referenceIdMap.put(String.valueOf(id), reference);
+ if (idMap.get(id) != null) {
+ idMap.get(id).forEach(objects -> {
+ referenceIdMap.put((String) objects[1], reference);
+ });
+ }
+ });
+ return referenceIdMap;
+ }
}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/geneAssociations/GeneGenomicLocationAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/geneAssociations/GeneGenomicLocationAssociationDAO.java
new file mode 100644
index 000000000..53c731649
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/geneAssociations/GeneGenomicLocationAssociationDAO.java
@@ -0,0 +1,15 @@
+package org.alliancegenome.curation_api.dao.associations.geneAssociations;
+
+import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
+import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGenomicLocationAssociation;
+
+import jakarta.enterprise.context.ApplicationScoped;
+
+@ApplicationScoped
+public class GeneGenomicLocationAssociationDAO extends BaseSQLDAO {
+
+ protected GeneGenomicLocationAssociationDAO() {
+ super(GeneGenomicLocationAssociation.class);
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ontology/GoTermDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ontology/GoTermDAO.java
index 2dc7e19ec..9b8d9ab98 100644
--- a/src/main/java/org/alliancegenome/curation_api/dao/ontology/GoTermDAO.java
+++ b/src/main/java/org/alliancegenome/curation_api/dao/ontology/GoTermDAO.java
@@ -1,9 +1,13 @@
package org.alliancegenome.curation_api.dao.ontology;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.persistence.Query;
import org.alliancegenome.curation_api.dao.base.BaseSQLDAO;
import org.alliancegenome.curation_api.model.entities.ontology.GOTerm;
-import jakarta.enterprise.context.ApplicationScoped;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
@ApplicationScoped
public class GoTermDAO extends BaseSQLDAO {
@@ -12,4 +16,19 @@ protected GoTermDAO() {
super(GOTerm.class);
}
+ public Map getAllGOIds() {
+ String sql = """
+ select id, curie
+ from ontologyterm
+ where ontologytermtype = :type
+ """;
+ Query query = entityManager.createNativeQuery(sql);
+ query.setParameter("type", "GOTerm");
+ List objects = query.getResultList();
+ Map ensemblGeneMap = new HashMap<>();
+ objects.forEach(object -> {
+ ensemblGeneMap.put((String) object[1], (Long) object[0]);
+ });
+ return ensemblGeneMap;
+ }
}
diff --git a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java
index 11b17cb8a..76d49d794 100644
--- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java
+++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java
@@ -19,6 +19,8 @@ public enum BackendBulkLoadType {
CONSTRUCT_ASSOCIATION("json"),
VARIANT("json"),
VARIATION("json"), // FMS variants as opposed to direct submission for VARIANT
+ VEPTRANSCRIPT("tsv"),
+ VEPGENE("tsv"),
// GFF all from the same file but split out
GFF("gff"), // For Database entries
@@ -26,9 +28,11 @@ public enum BackendBulkLoadType {
GFF_EXON("gff"),
GFF_CDS("gff"),
GFF_TRANSCRIPT("gff"),
+ GFF_GENE("gff"),
INTERACTION_MOL("tsv"),
EXPRESSION_ATLAS("tsv"),
+ GAF("tsv"),
INTERACTION_GEN("tsv"),
BIOGRID_ORCS("tsv"),
PARALOGY("json"),
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BiogridOrcCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BiogridOrcCrudInterface.java
new file mode 100644
index 000000000..52c5ed605
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BiogridOrcCrudInterface.java
@@ -0,0 +1,26 @@
+package org.alliancegenome.curation_api.interfaces.crud;
+
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.ws.rs.*;
+import jakarta.ws.rs.core.MediaType;
+import org.alliancegenome.curation_api.interfaces.base.crud.BaseCreateControllerInterface;
+import org.alliancegenome.curation_api.model.entities.CrossReference;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.BiogridOrcIngestFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+
+@Path("/biogrid-orc")
+@Tag(name = "CRUD - Biogrid Orc")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface BiogridOrcCrudInterface extends BaseCreateControllerInterface {
+
+
+ @POST
+ @Path("/bulk/{dataProvider}/biogridfile")
+ @JsonView(View.FieldsAndLists.class)
+ APIResponse updateBiogridOrc(@PathParam("dataProvider") String dataProvider, BiogridOrcIngestFmsDTO biogridOrcData);
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneExpressionExperimentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneExpressionExperimentCrudInterface.java
new file mode 100644
index 000000000..4e868b9ed
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneExpressionExperimentCrudInterface.java
@@ -0,0 +1,22 @@
+package org.alliancegenome.curation_api.interfaces.crud;
+
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.ws.rs.*;
+import jakarta.ws.rs.core.MediaType;
+import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionExperiment;
+import org.alliancegenome.curation_api.response.ObjectResponse;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+
+@Path("/gene-expression-experiment")
+@Tag(name = "CRUD - Gene Expression Experiments")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface GeneExpressionExperimentCrudInterface extends BaseIdCrudInterface {
+ @GET
+ @Path("/findBy/{identifier}")
+ @JsonView(View.FieldsAndLists.class)
+ ObjectResponse getByIdentifier(@PathParam("identifier") String identifier);
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneOntologyAnnotationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneOntologyAnnotationCrudInterface.java
new file mode 100644
index 000000000..53d81e7e4
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GeneOntologyAnnotationCrudInterface.java
@@ -0,0 +1,17 @@
+package org.alliancegenome.curation_api.interfaces.crud;
+
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+import org.alliancegenome.curation_api.interfaces.base.crud.BaseCreateControllerInterface;
+import org.alliancegenome.curation_api.model.entities.CrossReference;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+@Path("/gaf")
+@Tag(name = "CRUD - GAF")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface GeneOntologyAnnotationCrudInterface extends BaseCreateControllerInterface {
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/HTPExpressionDatasetSampleAnnotationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/HTPExpressionDatasetSampleAnnotationCrudInterface.java
new file mode 100644
index 000000000..1b4187ec1
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/HTPExpressionDatasetSampleAnnotationCrudInterface.java
@@ -0,0 +1,29 @@
+package org.alliancegenome.curation_api.interfaces.crud;
+
+import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface;
+import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetSampleAnnotation;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetSampleAnnotationIngestFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+import com.fasterxml.jackson.annotation.JsonView;
+
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+
+@Path("/htpexpressiondatasetsampleannotation")
+@Tag(name = "CRUD - HTP Expression Dataset Sample Annotation")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface HTPExpressionDatasetSampleAnnotationCrudInterface extends BaseIdCrudInterface {
+
+ @POST
+ @Path("/bulk/{dataProvider}/htpexpressiondatasetsampleannotationfile")
+ @JsonView(View.FieldsAndLists.class)
+ APIResponse updateHTPExpressionDatasetSampleAnnotation(@PathParam("dataProvider") String dataProvider, HTPExpressionDatasetSampleAnnotationIngestFmsDTO htpDatasetSampleData);
+}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/PredictedVariantConsequenceCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/PredictedVariantConsequenceCrudInterface.java
new file mode 100644
index 000000000..25139fde7
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/PredictedVariantConsequenceCrudInterface.java
@@ -0,0 +1,37 @@
+package org.alliancegenome.curation_api.interfaces.crud;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface;
+import org.alliancegenome.curation_api.model.entities.PredictedVariantConsequence;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.VepTxtDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+import com.fasterxml.jackson.annotation.JsonView;
+
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+
+@Path("predictedvariantconsequence")
+@Tag(name = "CRUD - Predicted Variant Consequence")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface PredictedVariantConsequenceCrudInterface extends BaseIdCrudInterface {
+
+ @POST
+ @Path("/bulk/{dataProvider}/transcriptConsequenceFile")
+ @JsonView(View.FieldsAndLists.class)
+ APIResponse updateTranscriptLevelConsequences(@PathParam("dataProvider") String dataProvider, List consequenceData);
+
+ @POST
+ @Path("/bulk/{dataProvider}/geneConsequenceFile")
+ @JsonView(View.FieldsAndLists.class)
+ APIResponse updateGeneLevelConsequences(@PathParam("dataProvider") String dataProvider, List consequenceData);
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/geneAssociations/GeneGenomicLocationAssociationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/geneAssociations/GeneGenomicLocationAssociationCrudInterface.java
new file mode 100644
index 000000000..6b8a65d5e
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/geneAssociations/GeneGenomicLocationAssociationCrudInterface.java
@@ -0,0 +1,32 @@
+package org.alliancegenome.curation_api.interfaces.crud.geneAssociations;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface;
+import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGenomicLocationAssociation;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.tags.Tag;
+
+import com.fasterxml.jackson.annotation.JsonView;
+
+import jakarta.ws.rs.Consumes;
+import jakarta.ws.rs.POST;
+import jakarta.ws.rs.Path;
+import jakarta.ws.rs.PathParam;
+import jakarta.ws.rs.Produces;
+import jakarta.ws.rs.core.MediaType;
+
+@Path("/genegenomiclocation")
+@Tag(name = "CRUD - GeneGenomicLocationAssociation")
+@Produces(MediaType.APPLICATION_JSON)
+@Consumes(MediaType.APPLICATION_JSON)
+public interface GeneGenomicLocationAssociationCrudInterface extends BaseIdCrudInterface {
+
+ @POST
+ @Path("/bulk/{dataProvider}_{assemblyName}/geneLocations")
+ @JsonView(View.FieldsAndLists.class)
+ APIResponse updateGeneLocations(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List gff3Data);
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmDiseaseAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmDiseaseAnnotationExecutor.java
index 3e3cf0656..de4318c49 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmDiseaseAnnotationExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmDiseaseAnnotationExecutor.java
@@ -51,12 +51,10 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount());
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
- bulkLoadFileHistory.setCount(annotations.size());
- updateHistory(bulkLoadFileHistory);
-
- boolean success = runLoad(agmDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded);
+ String countType = "AGM Disease Annotations";
+ boolean success = runLoad(agmDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded, countType);
if (success && cleanUp) {
- runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "AGM disease annotation");
+ runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, countType);
}
bulkLoadFileHistory.finishLoad();
updateHistory(bulkLoadFileHistory);
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleDiseaseAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleDiseaseAnnotationExecutor.java
index 324f1e17e..eb3c6bc5a 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleDiseaseAnnotationExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleDiseaseAnnotationExecutor.java
@@ -50,14 +50,11 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount());
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
-
- bulkLoadFileHistory.setCount(annotations.size());
-
- updateHistory(bulkLoadFileHistory);
- boolean success = runLoad(alleleDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded);
+ String countType = "Allele Disease Annotations";
+ boolean success = runLoad(alleleDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded, countType);
if (success && cleanUp) {
- runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "allele disease annotation");
+ runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, countType);
}
bulkLoadFileHistory.finishLoad();
updateHistory(bulkLoadFileHistory);
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java
index b90f3f015..f47f472bd 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java
@@ -1,17 +1,30 @@
package org.alliancegenome.curation_api.jobs.executors;
import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
-import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData;
+import org.alliancegenome.curation_api.dao.CrossReferenceDAO;
+import org.alliancegenome.curation_api.dao.GeneDAO;
+import org.alliancegenome.curation_api.dao.ResourceDescriptorPageDAO;
import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
+import org.alliancegenome.curation_api.model.entities.CrossReference;
+import org.alliancegenome.curation_api.model.entities.Organization;
+import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
import org.alliancegenome.curation_api.model.ingest.dto.fms.BiogridOrcFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.response.LoadHistoryResponce;
+import org.alliancegenome.curation_api.services.CrossReferenceService;
+import org.alliancegenome.curation_api.services.DataProviderService;
+import org.alliancegenome.curation_api.services.OrganizationService;
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -23,16 +36,44 @@
import com.fasterxml.jackson.dataformat.csv.CsvSchema;
import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
@ApplicationScoped
public class BiogridOrcExecutor extends LoadFileExecutor {
+ @Inject
+ ResourceDescriptorPageDAO resourceDescriptorPageDAO;
+
+ @Inject
+ GeneDAO geneDAO;
+
+ @Inject
+ CrossReferenceDAO crossRefDAO;
+
+ @Inject
+ CrossReferenceService crossReferenceService;
+
+ @Inject
+ OrganizationService organizationService;
+
+ @Inject
+ DataProviderService dataProviderService;
+
public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
try (TarArchiveInputStream tarInputStream = new TarArchiveInputStream(
- new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())))) {
+ new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())))) {
TarArchiveEntry tarEntry;
- Set biogridIds = new HashSet<>();
+ List biogridData = new ArrayList<>();
+ String name = bulkLoadFileHistory.getBulkLoad().getName();
+ String dataProviderName = name.substring(0, name.indexOf(" "));
+
+ Organization organization = organizationService.getByAbbr(dataProviderName).getEntity();
+
+ HashMap rdpParams = new HashMap<>();
+ rdpParams.put("name", "biogrid/orcs");
+ ResourceDescriptorPage resourceDescriptorPage = resourceDescriptorPageDAO.findByParams(rdpParams)
+ .getSingleResult();
while ((tarEntry = tarInputStream.getNextEntry()) != null) {
@@ -53,40 +94,53 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
.with(biogridOrcFmsSchema)
.readValues(tarInputStream.readAllBytes());
- List biogridData = it.readAll();
- runLoad(bulkLoadFileHistory, biogridData, biogridIds);
+ biogridData.addAll(it.readAll());
}
+ runLoad(bulkLoadFileHistory, biogridData, resourceDescriptorPage, organization, dataProviderService);
+
} catch (Exception e) {
failLoad(bulkLoadFileHistory, e);
e.printStackTrace();
}
}
- private boolean runLoad(BulkLoadFileHistory history, List biogridList, Set biogridIds) {
+ private boolean runLoad(BulkLoadFileHistory history, List biogridList,
+ ResourceDescriptorPage resourceDescriptorPage, Organization organization,
+ DataProviderService dataProviderService) {
ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(biogridList)) {
- String loadMessage = biogridList.get(0).getClass().getSimpleName() + " update";
- ph.startProcess(loadMessage, biogridList.size());
+ try {
+ String loadMessage = "BioGrid update";
+ Set referencedCuries = populateEntrezIdsFromFiles(biogridList, history);
+ ph.startProcess(loadMessage, referencedCuries.size());
+ updateHistory(history);
- updateHistory(history);
- for (BiogridOrcFmsDTO biogridOrcFmsDTO : biogridList) {
- try {
- if (biogridOrcFmsDTO.getIdentifierType().equals("ENTREZ_GENE")) {
- String identifier = "NCBI_Gene:" + biogridOrcFmsDTO.getIdentifierId();
- biogridIds.add(identifier);
+ Map genomicEntityCrossRefMap = crossReferenceService
+ .getGenomicEntityCrossRefMap(referencedCuries);
+
+ for (String referencedCurie : referencedCuries) {
+
+ CrossReference newCrossRef = new CrossReference();
+ newCrossRef.setReferencedCurie(referencedCurie);
+ newCrossRef.setDisplayName("BioGRID CRISPR Screen Cell Line Phenotypes");
+ newCrossRef.setResourceDescriptorPage(resourceDescriptorPage);
+
+ CrossReference entity = crossReferenceService
+ .insertBioGridOrcCrossReference(newCrossRef, genomicEntityCrossRefMap.get(referencedCurie))
+ .getEntity();
+
+ if (entity != null) {
history.incrementCompleted();
} else {
history.incrementSkipped();
-
}
- } catch (Exception e) {
- e.printStackTrace();
- history.incrementFailed();
- addException(history,
- new ObjectUpdateExceptionData(biogridOrcFmsDTO, e.getMessage(), e.getStackTrace()));
+
}
+ } catch (Exception e) {
+ e.printStackTrace();
+ history.incrementFailed();
ph.progressProcess();
}
updateHistory(history);
@@ -96,4 +150,42 @@ private boolean runLoad(BulkLoadFileHistory history, List biog
return true;
}
+
+ public APIResponse runLoadApi(String dataProviderName, List biogridDTOs) {
+ Organization organization = organizationService.getByAbbr(dataProviderName).getEntity();
+
+ HashMap rdpParams = new HashMap<>();
+ rdpParams.put("name", "biogrid/orcs");
+ ResourceDescriptorPage resourceDescriptorPage = resourceDescriptorPageDAO.findByParams(rdpParams)
+ .getSingleResult();
+
+ BulkLoadFileHistory history = new BulkLoadFileHistory(biogridDTOs.size());
+ history = bulkLoadFileHistoryDAO.persist(history);
+ runLoad(history, biogridDTOs, resourceDescriptorPage, organization, dataProviderService);
+ history.finishLoad();
+
+ return new LoadHistoryResponce(history);
+ }
+
+ private Set populateEntrezIdsFromFiles(List biogridList, BulkLoadFileHistory history) {
+ Set biogridIds = new HashSet<>();
+
+ for (BiogridOrcFmsDTO biogridOrcFmsDTO : biogridList) {
+ try {
+ if (!biogridOrcFmsDTO.getIdentifierType().equals("ENTREZ_GENE")) {
+ history.incrementSkipped();
+ continue;
+ }
+
+ String identifier = "NCBI_Gene:" + biogridOrcFmsDTO.getIdentifierId();
+ biogridIds.add(identifier);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ return biogridIds;
+
+ }
}
\ No newline at end of file
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/BulkLoadJobExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/BulkLoadJobExecutor.java
index 9fe7ab0b3..fe45f99d5 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/BulkLoadJobExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/BulkLoadJobExecutor.java
@@ -21,6 +21,7 @@
import org.alliancegenome.curation_api.jobs.executors.associations.constructAssociations.ConstructGenomicEntityAssociationExecutor;
import org.alliancegenome.curation_api.jobs.executors.gff.Gff3CDSExecutor;
import org.alliancegenome.curation_api.jobs.executors.gff.Gff3ExonExecutor;
+import org.alliancegenome.curation_api.jobs.executors.gff.Gff3GeneExecutor;
import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExecutor;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
@@ -55,12 +56,19 @@ public class BulkLoadJobExecutor {
@Inject GeneExpressionExecutor geneExpressionExecutor;
@Inject SequenceTargetingReagentExecutor sqtrExecutor;
@Inject VariantFmsExecutor variantFmsExecutor;
+ @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor;
+ @Inject HTPExpressionDatasetSampleAnnotationExecutor htpExpressionDatasetSampleAnnotationExecutor;
+
@Inject Gff3ExonExecutor gff3ExonExecutor;
@Inject Gff3CDSExecutor gff3CDSExecutor;
+ @Inject Gff3GeneExecutor gff3GeneExecutor;
@Inject Gff3TranscriptExecutor gff3TranscriptExecutor;
+ @Inject VepTranscriptExecutor vepTranscriptExecutor;
+ @Inject VepGeneExecutor vepGeneExecutor;
- @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor;
@Inject ExpressionAtlasExecutor expressionAtlasExecutor;
+ @Inject
+ GeneOntologyAnnotationExecutor gafExecutor;
@Inject BiogridOrcExecutor biogridOrcExecutor;
@@ -132,12 +140,22 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th
gff3CDSExecutor.execLoad(bulkLoadFileHistory);
} else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT) {
gff3TranscriptExecutor.execLoad(bulkLoadFileHistory);
+ } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_GENE) {
+ gff3GeneExecutor.execLoad(bulkLoadFileHistory);
} else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) {
htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFileHistory);
} else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION_ATLAS) {
expressionAtlasExecutor.execLoad(bulkLoadFileHistory);
} else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.BIOGRID_ORCS) {
biogridOrcExecutor.execLoad(bulkLoadFileHistory);
+ } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.VEPTRANSCRIPT) {
+ vepTranscriptExecutor.execLoad(bulkLoadFileHistory);
+ } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.VEPGENE) {
+ vepGeneExecutor.execLoad(bulkLoadFileHistory);
+ } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASAMPLE) {
+ htpExpressionDatasetSampleAnnotationExecutor.execLoad(bulkLoadFileHistory);
+ } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GAF) {
+ gafExecutor.execLoad(bulkLoadFileHistory);
} else {
log.info("Load: " + bulkLoadFileHistory.getBulkLoad().getName() + " for type " + bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() + " not implemented");
throw new Exception("Load: " + bulkLoadFileHistory.getBulkLoad().getName() + " for type " + bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() + " not implemented");
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java
index b8bbb4e25..d5e36f8e9 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java
@@ -1,10 +1,13 @@
package org.alliancegenome.curation_api.jobs.executors;
-import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
-import lombok.extern.jbosslog.JBossLog;
+import static org.alliancegenome.curation_api.services.DataProviderService.RESOURCE_DESCRIPTOR_PREFIX;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
import org.alliancegenome.curation_api.model.entities.CrossReference;
import org.alliancegenome.curation_api.model.entities.DataProvider;
import org.alliancegenome.curation_api.model.entities.Organization;
@@ -17,15 +20,12 @@
import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.jetbrains.annotations.NotNull;
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
-import static org.alliancegenome.curation_api.services.DataProviderService.RESOURCE_DESCRIPTOR_PREFIX;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
-@JBossLog
@ApplicationScoped
public class ExpressionAtlasExecutor extends LoadFileExecutor {
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneDiseaseAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneDiseaseAnnotationExecutor.java
index 07a68d88e..2e0c8c5a1 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneDiseaseAnnotationExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneDiseaseAnnotationExecutor.java
@@ -51,12 +51,10 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount());
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
- bulkLoadFileHistory.setCount(annotations.size());
- updateHistory(bulkLoadFileHistory);
-
- boolean success = runLoad(geneDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded);
+ String countType = "Gene Disease Annotations";
+ boolean success = runLoad(geneDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded, countType);
if (success && cleanUp) {
- runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene disease annotation");
+ runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, countType);
}
bulkLoadFileHistory.finishLoad();
updateHistory(bulkLoadFileHistory);
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExpressionExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExpressionExecutor.java
index a3898eca6..57150355b 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExpressionExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExpressionExecutor.java
@@ -1,26 +1,37 @@
package org.alliancegenome.curation_api.jobs.executors;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionExperiment;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionFmsDTO;
import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionIngestFmsDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.response.LoadHistoryResponce;
import org.alliancegenome.curation_api.services.GeneExpressionAnnotationService;
+import org.alliancegenome.curation_api.services.GeneExpressionExperimentService;
+import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
import org.apache.commons.lang3.StringUtils;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.GZIPInputStream;
@ApplicationScoped
public class GeneExpressionExecutor extends LoadFileExecutor {
- @Inject
- GeneExpressionAnnotationService geneExpressionAnnotationService;
+ @Inject GeneExpressionAnnotationService geneExpressionAnnotationService;
+ @Inject GeneExpressionExperimentService geneExpressionExperimentService;
+ static final String ANNOTATIONS = "Annotations";
+ static final String EXPERIMENTS = "Experiments";
+
public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
try {
@@ -37,23 +48,69 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
}
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
- bulkLoadFileHistory.setCount(geneExpressionIngestFmsDTO.getData().size());
- updateHistory(bulkLoadFileHistory);
-
List annotationIdsLoaded = new ArrayList<>();
List annotationIdsBefore = geneExpressionAnnotationService.getAnnotationIdsByDataProvider(dataProvider);
- boolean success = runLoad(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider, geneExpressionIngestFmsDTO.getData(), annotationIdsLoaded);
+ List experimentIdsLoaded = new ArrayList<>();
+ List experimentIdsBefore = geneExpressionExperimentService.getExperimentIdsByDataProvider(dataProvider);
+
+ boolean success = runLoad(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider, geneExpressionIngestFmsDTO.getData(), annotationIdsLoaded, ANNOTATIONS);
+
if (success) {
- runCleanup(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene expression annotation");
+ runCleanup(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, ANNOTATIONS);
+ loadExperiments(bulkLoadFileHistory, dataProvider, experimentIdsLoaded);
+ runCleanup(geneExpressionExperimentService, bulkLoadFileHistory, dataProvider.name(), experimentIdsBefore, experimentIdsLoaded, EXPERIMENTS);
}
bulkLoadFileHistory.finishLoad();
updateHistory(bulkLoadFileHistory);
updateExceptions(bulkLoadFileHistory);
+
} catch (Exception e) {
failLoad(bulkLoadFileHistory, e);
e.printStackTrace();
}
}
+
+ public APIResponse runLoadAPI(GeneExpressionAnnotationService service, String dataProviderName, List objectList) {
+ List idsLoaded = new ArrayList<>();
+ BulkLoadFileHistory history = new BulkLoadFileHistory(objectList.size());
+ history = bulkLoadFileHistoryDAO.persist(history);
+ BackendBulkDataProvider dataProvider = null;
+ if (dataProviderName != null) {
+ dataProvider = BackendBulkDataProvider.valueOf(dataProviderName);
+ }
+ boolean success = runLoad(service, history, dataProvider, objectList, idsLoaded, true, ANNOTATIONS);
+ if (success) {
+ loadExperiments(history, dataProvider, new ArrayList<>());
+ }
+ history.finishLoad();
+ return new LoadHistoryResponce(history);
+ }
+
+ private void loadExperiments(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List experimentIdsLoaded) {
+ ProcessDisplayHelper ph = new ProcessDisplayHelper();
+ Map> experiments = geneExpressionAnnotationService.getExperiments();
+ ph.startProcess("Saving gene expression experiments: ", experiments.size());
+ history.setCount(EXPERIMENTS, geneExpressionAnnotationService.getExperiments().size());
+ for (String experimentId: experiments.keySet()) {
+ try {
+ GeneExpressionExperiment experiment = geneExpressionExperimentService.upsert(experimentId, experiments.get(experimentId), dataProvider);
+ if (experiment != null) {
+ experimentIdsLoaded.add(experiment.getId());
+ history.incrementCompleted(EXPERIMENTS);
+ }
+ } catch (ObjectUpdateException e) {
+ history.incrementFailed(EXPERIMENTS);
+ addException(history, e.getData());
+ } catch (Exception e) {
+ e.printStackTrace();
+ history.incrementFailed(EXPERIMENTS);
+ addException(history, new ObjectUpdateException.ObjectUpdateExceptionData(experimentId, e.getMessage(), e.getStackTrace()));
+ }
+ ph.progressProcess();
+ }
+ updateHistory(history);
+ ph.finishProcess();
+ }
}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneGeneticInteractionExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneGeneticInteractionExecutor.java
index 74e9c0259..4d6a5084e 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneGeneticInteractionExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneGeneticInteractionExecutor.java
@@ -1,10 +1,11 @@
package org.alliancegenome.curation_api.jobs.executors;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-
+import com.fasterxml.jackson.databind.MappingIterator;
+import com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import com.fasterxml.jackson.dataformat.csv.CsvParser;
+import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.dao.GeneGeneticInteractionDAO;
import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
@@ -12,13 +13,10 @@
import org.alliancegenome.curation_api.services.GeneGeneticInteractionService;
import org.alliancegenome.curation_api.services.GeneInteractionService;
-import com.fasterxml.jackson.databind.MappingIterator;
-import com.fasterxml.jackson.dataformat.csv.CsvMapper;
-import com.fasterxml.jackson.dataformat.csv.CsvParser;
-import com.fasterxml.jackson.dataformat.csv.CsvSchema;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
@ApplicationScoped
public class GeneGeneticInteractionExecutor extends LoadFileExecutor {
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneMolecularInteractionExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneMolecularInteractionExecutor.java
index 482ee00be..1714fd19d 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneMolecularInteractionExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneMolecularInteractionExecutor.java
@@ -1,10 +1,11 @@
package org.alliancegenome.curation_api.jobs.executors;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-
+import com.fasterxml.jackson.databind.MappingIterator;
+import com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import com.fasterxml.jackson.dataformat.csv.CsvParser;
+import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.dao.GeneMolecularInteractionDAO;
import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
@@ -12,13 +13,10 @@
import org.alliancegenome.curation_api.services.GeneInteractionService;
import org.alliancegenome.curation_api.services.GeneMolecularInteractionService;
-import com.fasterxml.jackson.databind.MappingIterator;
-import com.fasterxml.jackson.dataformat.csv.CsvMapper;
-import com.fasterxml.jackson.dataformat.csv.CsvParser;
-import com.fasterxml.jackson.dataformat.csv.CsvSchema;
-
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
@ApplicationScoped
public class GeneMolecularInteractionExecutor extends LoadFileExecutor {
@@ -37,10 +35,10 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
List interactionIdsLoaded = new ArrayList<>();
List interactionIdsBefore = geneMolecularInteractionDAO.findAllIds().getResults();
-
+
bulkLoadFileHistory.setCount(interactionData.size());
updateHistory(bulkLoadFileHistory);
-
+
boolean success = runLoad(geneMolecularInteractionService, bulkLoadFileHistory, null, interactionData, interactionIdsLoaded, false);
if (success) {
runCleanup(geneInteractionService, bulkLoadFileHistory, "COMBINED", interactionIdsBefore, interactionIdsLoaded, "gene molecular interaction");
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneOntologyAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneOntologyAnnotationExecutor.java
new file mode 100644
index 000000000..9df7d1b29
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneOntologyAnnotationExecutor.java
@@ -0,0 +1,115 @@
+package org.alliancegenome.curation_api.jobs.executors;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+import lombok.extern.jbosslog.JBossLog;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException;
+import org.alliancegenome.curation_api.model.entities.GeneOntologyAnnotation;
+import org.alliancegenome.curation_api.model.entities.Organization;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.GeneOntologyAnnotationDTO;
+import org.alliancegenome.curation_api.services.GeneOntologyAnnotationService;
+import org.alliancegenome.curation_api.services.OrganizationService;
+import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
+import org.apache.commons.lang3.StringUtils;
+
+import java.io.BufferedReader;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import java.util.zip.GZIPInputStream;
+
+@JBossLog
+@ApplicationScoped
+public class GeneOntologyAnnotationExecutor extends LoadFileExecutor {
+
+ @Inject
+ GeneOntologyAnnotationService service;
+ @Inject
+ OrganizationService organizationService;
+
+ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException {
+
+ String abbr = ((BulkFMSLoad) bulkLoadFileHistory.getBulkLoad()).getFmsDataSubType();
+ Organization organization = organizationService.getByAbbr(abbr).getEntity();
+
+ // curie, List
+ Map> uiMap = new HashMap<>();
+ GZIPInputStream stream = new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()));
+ try (BufferedReader br = new BufferedReader(new InputStreamReader(stream))) {
+ Stream lines = br.lines();
+
+ // Process each line
+ lines.filter(s -> !s.startsWith("!") && StringUtils.isNotEmpty(s)).forEach(s -> {
+ String[] token = s.split("\t");
+ String orgID = token[0];
+ String modID = token[1];
+ String goID = token[4];
+ if (abbr.equalsIgnoreCase(orgID) || orgID.equalsIgnoreCase("Xenbase") || abbr.equals("HUMAN") && orgID.equals("RGD")) {
+ List goIDs = uiMap.computeIfAbsent(modID, list -> new ArrayList<>());
+ goIDs.add(goID);
+ }
+ });
+
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ String name = bulkLoadFileHistory.getBulkLoad().getName();
+
+ Map gafMap = service.getGafMap(organization);
+ List gafIdsBefore = new ArrayList<>(gafMap.keySet().stream().toList());
+ gafIdsBefore.removeIf(Objects::isNull);
+
+ List geneGoIdsLoaded = new ArrayList<>();
+ ProcessDisplayHelper ph = new ProcessDisplayHelper();
+ ph.addDisplayHandler(loadProcessDisplayService);
+ Set dtos = uiMap.entrySet()
+ .stream()
+ .map(entry -> entry.getValue().stream().map(goID -> {
+ GeneOntologyAnnotationDTO dto = new GeneOntologyAnnotationDTO();
+ String prefix = abbr;
+ if (abbr.equalsIgnoreCase("XB")) {
+ prefix = "Xenbase";
+ }
+ if (abbr.equalsIgnoreCase("HUMAN")) {
+ prefix = null;
+ }
+ String geneIdentifier = prefix != null ? prefix + ":" + entry.getKey() : entry.getKey();
+ dto.setGeneIdentifier(geneIdentifier);
+ dto.setGoTermCurie(goID);
+ return dto;
+ }).toList()).flatMap(Collection::stream).collect(Collectors.toSet());
+
+ ph.startProcess(name, dtos.size());
+ for (GeneOntologyAnnotationDTO modID : dtos) {
+ Long geneID = service.getGeneID(modID, abbr);
+ if (geneID != null) {
+ GeneOntologyAnnotation newGaf = service.insert(modID, abbr).getEntity();
+ if (newGaf != null) {
+ geneGoIdsLoaded.add(newGaf.getId());
+ bulkLoadFileHistory.incrementCompleted();
+ } else {
+ bulkLoadFileHistory.incrementSkipped();
+ }
+ } else {
+ addException(bulkLoadFileHistory, new ObjectUpdateException.ObjectUpdateExceptionData(modID, "Could not find gene " + modID.getGeneIdentifier(), null));
+ bulkLoadFileHistory.incrementFailed();
+ }
+ ph.progressProcess();
+ }
+ bulkLoadFileHistory.setTotalCount(dtos.size());
+ runCleanup(service, bulkLoadFileHistory, abbr, gafIdsBefore, geneGoIdsLoaded, "GAF Load");
+ ph.finishProcess();
+ updateHistory(bulkLoadFileHistory);
+
+ bulkLoadFileHistory.finishLoad();
+ updateHistory(bulkLoadFileHistory);
+ updateExceptions(bulkLoadFileHistory);
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetSampleAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetSampleAnnotationExecutor.java
new file mode 100644
index 000000000..f2c12bf3d
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetSampleAnnotationExecutor.java
@@ -0,0 +1,68 @@
+package org.alliancegenome.curation_api.jobs.executors;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
+
+import org.alliancegenome.curation_api.dao.ExternalDataBaseEntityDAO;
+import org.alliancegenome.curation_api.dao.HTPExpressionDatasetSampleAnnotationDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetSampleAnnotation;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetSampleAnnotationIngestFmsDTO;
+import org.alliancegenome.curation_api.services.ExternalDataBaseEntityService;
+import org.alliancegenome.curation_api.services.HTPExpressionDatasetSampleAnnotationService;
+import org.apache.commons.lang3.StringUtils;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@ApplicationScoped
+public class HTPExpressionDatasetSampleAnnotationExecutor extends LoadFileExecutor {
+
+ @Inject ExternalDataBaseEntityService externalDataBaseEntityService;
+ @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO;
+ @Inject HTPExpressionDatasetSampleAnnotationService htpExpressionDatasetSampleAnnotationService;
+ @Inject HTPExpressionDatasetSampleAnnotationDAO htpExpressionDatasetSampleAnnotationDAO;
+
+ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
+ try {
+ BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad();
+
+ HTPExpressionDatasetSampleAnnotationIngestFmsDTO htpExpressionDatasetSampleData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), HTPExpressionDatasetSampleAnnotationIngestFmsDTO.class);
+ bulkLoadFileHistory.getBulkLoadFile().setRecordCount(htpExpressionDatasetSampleData.getData().size());
+
+ AGRCurationSchemaVersion version = HTPExpressionDatasetSampleAnnotation.class.getAnnotation(AGRCurationSchemaVersion.class);
+ bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max());
+ if (htpExpressionDatasetSampleData.getMetaData() != null && StringUtils.isNotBlank(htpExpressionDatasetSampleData.getMetaData().getRelease())) {
+ bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(htpExpressionDatasetSampleData.getMetaData().getRelease());
+ }
+
+ BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType());
+ List htpAnnotationsIdsLoaded = new ArrayList<>();
+ List previousIds = htpExpressionDatasetSampleAnnotationService.getAnnotationIdsByDataProvider(dataProvider.name());
+
+ bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
+
+ bulkLoadFileHistory.setCount((long) htpExpressionDatasetSampleData.getData().size());
+ updateHistory(bulkLoadFileHistory);
+
+ boolean success = runLoad(htpExpressionDatasetSampleAnnotationService, bulkLoadFileHistory, dataProvider, htpExpressionDatasetSampleData.getData(), htpAnnotationsIdsLoaded);
+
+ if (success) {
+ runCleanup(htpExpressionDatasetSampleAnnotationService, bulkLoadFileHistory, dataProvider.name(), previousIds, htpAnnotationsIdsLoaded, fms.getFmsDataType());
+ }
+ bulkLoadFileHistory.finishLoad();
+
+ updateHistory(bulkLoadFileHistory);
+ updateExceptions(bulkLoadFileHistory);
+
+ } catch (Exception e) {
+ failLoad(bulkLoadFileHistory, e);
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/LoadFileExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/LoadFileExecutor.java
index d7b6b8b52..ef1034f1d 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/LoadFileExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/LoadFileExecutor.java
@@ -1,14 +1,8 @@
package org.alliancegenome.curation_api.jobs.executors;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-import java.util.zip.GZIPInputStream;
-
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.quarkus.logging.Log;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO;
import org.alliancegenome.curation_api.dao.loads.BulkLoadFileExceptionDAO;
import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO;
@@ -35,10 +29,10 @@
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.StringUtils;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import io.quarkus.logging.Log;
-import jakarta.inject.Inject;
+import java.io.FileInputStream;
+import java.util.*;
+import java.util.stream.Collectors;
+import java.util.zip.GZIPInputStream;
public class LoadFileExecutor {
@@ -124,9 +118,9 @@ protected IngestDTO readIngestFile(BulkLoadFileHistory bulkLoadFileHistory, Clas
if (StringUtils.isNotBlank(ingestDto.getAllianceMemberReleaseVersion())) {
bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(ingestDto.getAllianceMemberReleaseVersion());
}
-
+
bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile());
-
+
if (!checkSchemaVersion(bulkLoadFileHistory, dtoClass)) {
return null;
}
@@ -190,16 +184,24 @@ public APIResponse runLoadApi(BaseU
if (dataProviderName != null) {
dataProvider = BackendBulkDataProvider.valueOf(dataProviderName);
}
- runLoad(service, history, dataProvider, objectList, idsLoaded, true);
+ runLoad(service, history, dataProvider, objectList, idsLoaded, true, "Records");
history.finishLoad();
return new LoadHistoryResponce(history);
}
-
+
protected boolean runLoad(BaseUpsertServiceInterface service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List objectList, List idsAdded) {
- return runLoad(service, history, dataProvider, objectList, idsAdded, true);
+ return runLoad(service, history, dataProvider, objectList, idsAdded, true, "Records");
}
protected boolean runLoad(BaseUpsertServiceInterface service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List objectList, List idsAdded, Boolean terminateFailing) {
+ return runLoad(service, history, dataProvider, objectList, idsAdded, terminateFailing, "Records");
+ }
+
+ protected boolean runLoad(BaseUpsertServiceInterface service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List objectList, List idsAdded, String countType) {
+ return runLoad(service, history, dataProvider, objectList, idsAdded, true, countType);
+ }
+
+ protected boolean runLoad(BaseUpsertServiceInterface service, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List objectList, List idsAdded, Boolean terminateFailing, String countType) {
ProcessDisplayHelper ph = new ProcessDisplayHelper();
ph.addDisplayHandler(loadProcessDisplayService);
if (CollectionUtils.isNotEmpty(objectList)) {
@@ -208,28 +210,28 @@ protected boolean runLoad(BaseUpser
loadMessage = loadMessage + " for " + dataProvider.name();
}
ph.startProcess(loadMessage, objectList.size());
-
+
+ history.setCount(countType, objectList.size());
updateHistory(history);
for (T dtoObject : objectList) {
try {
E dbObject = service.upsert(dtoObject, dataProvider);
- history.incrementCompleted();
+ history.incrementCompleted(countType);
if (idsAdded != null) {
idsAdded.add(dbObject.getId());
}
} catch (ObjectUpdateException e) {
- // e.printStackTrace();
- history.incrementFailed();
+ history.incrementFailed(countType);
addException(history, e.getData());
} catch (KnownIssueValidationException e) {
Log.debug(e.getMessage());
- history.incrementSkipped();
+ history.incrementSkipped(countType);
} catch (Exception e) {
- // e.printStackTrace();
- history.incrementFailed();
+ e.printStackTrace();
+ history.incrementFailed(countType);
addException(history, new ObjectUpdateExceptionData(dtoObject, e.getMessage(), e.getStackTrace()));
}
- if (terminateFailing && history.getErrorRate() > 0.25) {
+ if (terminateFailing && history.getErrorRate(countType) > 0.25) {
Log.error("Failure Rate > 25% aborting load");
updateHistory(history);
updateExceptions(history);
@@ -260,12 +262,12 @@ protected boolean runLoad(BaseUpser
Log.debug("runLoad: Remove: " + dataProviderName + " " + idsToRemove.size());
String countType = loadTypeString + " Deleted";
-
+
long existingDeletes = history.getCount(countType).getTotal() == null ? 0 : history.getCount(countType).getTotal();
history.setCount(countType, idsToRemove.size() + existingDeletes);
String loadDescription = dataProviderName + " " + loadTypeString + " bulk load (" + history.getBulkLoadFile().getMd5Sum() + ")";
-
+
ProcessDisplayHelper ph = new ProcessDisplayHelper(10000);
ph.startProcess("Deletion/deprecation of: " + dataProviderName + " " + loadTypeString, idsToRemove.size());
//updateHistory(history);
@@ -303,7 +305,7 @@ protected void failLoad(BulkLoadFileHistory bulkLoadFileHistory, Exception e) {
slackNotifier.slackalert(bulkLoadFileHistory);
updateHistory(bulkLoadFileHistory);
}
-
+
protected void failLoadAboveErrorRateCutoff(BulkLoadFileHistory bulkLoadFileHistory) {
bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED);
bulkLoadFileHistory.setErrorMessage("Failure rate exceeded cutoff");
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ParalogyExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ParalogyExecutor.java
index a4f5ff276..113871b64 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ParalogyExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ParalogyExecutor.java
@@ -1,10 +1,8 @@
package org.alliancegenome.curation_api.jobs.executors;
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.GZIPInputStream;
-
+import io.quarkus.logging.Log;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.dao.GeneToGeneParalogyDAO;
import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
@@ -15,9 +13,10 @@
import org.alliancegenome.curation_api.services.GeneToGeneParalogyService;
import org.apache.commons.lang3.StringUtils;
-import io.quarkus.logging.Log;
-import jakarta.enterprise.context.ApplicationScoped;
-import jakarta.inject.Inject;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
@ApplicationScoped
public class ParalogyExecutor extends LoadFileExecutor {
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepGeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepGeneExecutor.java
new file mode 100644
index 000000000..ac4659bc3
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepGeneExecutor.java
@@ -0,0 +1,169 @@
+package org.alliancegenome.curation_api.jobs.executors;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.zip.GZIPInputStream;
+
+import org.alliancegenome.curation_api.dao.PredictedVariantConsequenceDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData;
+import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.VepTxtDTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.response.LoadHistoryResponce;
+import org.alliancegenome.curation_api.services.PredictedVariantConsequenceService;
+import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.collections4.ListUtils;
+
+import com.fasterxml.jackson.databind.MappingIterator;
+import com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import com.fasterxml.jackson.dataformat.csv.CsvParser;
+import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+
+import io.quarkus.logging.Log;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@ApplicationScoped
+public class VepGeneExecutor extends LoadFileExecutor {
+
+ @Inject PredictedVariantConsequenceDAO predictedVariantConsequenceDAO;
+ @Inject PredictedVariantConsequenceService predictedVariantConsequenceService;
+
+ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
+ try {
+
+ CsvSchema vepTxtSchema = CsvSchemaBuilder.vepTxtSchema();
+ CsvMapper csvMapper = new CsvMapper();
+ MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(VepTxtDTO.class).with(vepTxtSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())));
+ List vepData = it.readAll();
+
+
+ BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad();
+ BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType());
+
+ List consequenceIdsLoaded = new ArrayList<>();
+ List consequenceIdsBefore = predictedVariantConsequenceService.getGeneLevelIdsByDataProvider(dataProvider);
+
+ bulkLoadFileHistory.setCount(vepData.size());
+ updateHistory(bulkLoadFileHistory);
+
+ boolean success = runLoad(bulkLoadFileHistory, dataProvider, vepData, consequenceIdsLoaded);
+ if (success) {
+ runCleanup(predictedVariantConsequenceService, bulkLoadFileHistory, dataProvider.name(), consequenceIdsBefore, consequenceIdsLoaded, "gene-level predicted variant consequences");
+ }
+ bulkLoadFileHistory.finishLoad();
+ updateHistory(bulkLoadFileHistory);
+ updateExceptions(bulkLoadFileHistory);
+
+ } catch (Exception e) {
+ failLoad(bulkLoadFileHistory, e);
+ e.printStackTrace();
+ }
+ }
+
+ protected boolean runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List objectList, List idsUpdated) {
+ ProcessDisplayHelper ph = new ProcessDisplayHelper();
+ ph.addDisplayHandler(loadProcessDisplayService);
+ if (CollectionUtils.isNotEmpty(objectList)) {
+ String loadMessage = objectList.get(0).getClass().getSimpleName() + " update";
+ if (dataProvider != null) {
+ loadMessage = loadMessage + " for " + dataProvider.name();
+ }
+ ph.startProcess(loadMessage, objectList.size());
+
+ updateHistory(history);
+ for (VepTxtDTO dtoObject : objectList) {
+ try {
+ Long idUpdated = predictedVariantConsequenceService.updateGeneLevelConsequence(dtoObject);
+ history.incrementCompleted();
+ if (idsUpdated != null) {
+ idsUpdated.add(idUpdated);
+ }
+ } catch (ObjectUpdateException e) {
+ history.incrementFailed();
+ addException(history, e.getData());
+ } catch (KnownIssueValidationException e) {
+ Log.debug(e.getMessage());
+ history.incrementSkipped();
+ } catch (Exception e) {
+ e.printStackTrace();
+ history.incrementFailed();
+ addException(history, new ObjectUpdateExceptionData(dtoObject, e.getMessage(), e.getStackTrace()));
+ }
+ if (history.getErrorRate() > 0.25) {
+ Log.error("Failure Rate > 25% aborting load");
+ updateHistory(history);
+ updateExceptions(history);
+ failLoadAboveErrorRateCutoff(history);
+ return false;
+ }
+ ph.progressProcess();
+ }
+ updateHistory(history);
+ updateExceptions(history);
+ ph.finishProcess();
+ }
+ return true;
+ }
+
+ protected void runCleanup(BulkLoadFileHistory history, String dataProviderName, List annotationIdsBefore, List annotationIdsAfter, String loadTypeString, Boolean deprecate) {
+ Log.debug("runLoad: After: " + dataProviderName + " " + annotationIdsAfter.size());
+
+ List distinctAfter = annotationIdsAfter.stream().distinct().collect(Collectors.toList());
+ Log.debug("runLoad: Distinct: " + dataProviderName + " " + distinctAfter.size());
+
+ List idsToReset = ListUtils.subtract(annotationIdsBefore, distinctAfter);
+ Log.debug("runLoad: Reset: " + dataProviderName + " " + idsToReset.size());
+
+ String countType = loadTypeString + " reset";
+
+ long existingResets = history.getCount(countType).getTotal() == null ? 0 : history.getCount(countType).getTotal();
+ history.setCount(countType, idsToReset.size() + existingResets);
+
+ String loadDescription = dataProviderName + " " + loadTypeString + " bulk load (" + history.getBulkLoadFile().getMd5Sum() + ")";
+
+ ProcessDisplayHelper ph = new ProcessDisplayHelper(10000);
+ ph.startProcess("Deletion/deprecation of: " + dataProviderName + " " + loadTypeString, idsToReset.size());
+
+ for (Long id : idsToReset) {
+ try {
+ predictedVariantConsequenceService.resetGeneLevelConsequence(id, loadDescription);
+ history.incrementCompleted(countType);
+ } catch (Exception e) {
+ history.incrementFailed(countType);
+ addException(history, new ObjectUpdateExceptionData("{ \"id\": " + id + "}", e.getMessage(), e.getStackTrace()));
+ }
+ if (history.getErrorRate(countType) > 0.25) {
+ Log.error(countType + " failure rate > 25% aborting load");
+ failLoadAboveErrorRateCutoff(history);
+ break;
+ }
+ ph.progressProcess();
+ }
+ updateHistory(history);
+ updateExceptions(history);
+ ph.finishProcess();
+ }
+
+ public APIResponse runLoadApi(String dataProviderName, List consequenceData) {
+ List idsLoaded = new ArrayList<>();
+ BulkLoadFileHistory history = new BulkLoadFileHistory(consequenceData.size());
+ history = bulkLoadFileHistoryDAO.persist(history);
+ BackendBulkDataProvider dataProvider = null;
+ if (dataProviderName != null) {
+ dataProvider = BackendBulkDataProvider.valueOf(dataProviderName);
+ }
+ runLoad(history, dataProvider, consequenceData, idsLoaded);
+ history.finishLoad();
+ return new LoadHistoryResponce(history);
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepTranscriptExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepTranscriptExecutor.java
new file mode 100644
index 000000000..dfa877ad4
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VepTranscriptExecutor.java
@@ -0,0 +1,62 @@
+package org.alliancegenome.curation_api.jobs.executors;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.zip.GZIPInputStream;
+
+import org.alliancegenome.curation_api.dao.PredictedVariantConsequenceDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.VepTxtDTO;
+import org.alliancegenome.curation_api.services.PredictedVariantConsequenceService;
+
+import com.fasterxml.jackson.databind.MappingIterator;
+import com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import com.fasterxml.jackson.dataformat.csv.CsvParser;
+import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@ApplicationScoped
+public class VepTranscriptExecutor extends LoadFileExecutor {
+
+ @Inject PredictedVariantConsequenceDAO predictedVariantConsequenceDAO;
+ @Inject PredictedVariantConsequenceService predictedVariantConsequenceService;
+
+ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
+ try {
+
+ CsvSchema vepTxtSchema = CsvSchemaBuilder.vepTxtSchema();
+ CsvMapper csvMapper = new CsvMapper();
+ MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(VepTxtDTO.class).with(vepTxtSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())));
+ List vepData = it.readAll();
+
+
+ BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad();
+ BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType());
+
+ List consequenceIdsLoaded = new ArrayList<>();
+ List consequenceIdsBefore = predictedVariantConsequenceService.getIdsByDataProvider(dataProvider);
+
+ bulkLoadFileHistory.setCount(vepData.size());
+ updateHistory(bulkLoadFileHistory);
+
+ boolean success = runLoad(predictedVariantConsequenceService, bulkLoadFileHistory, dataProvider, vepData, consequenceIdsLoaded);
+ if (success) {
+ runCleanup(predictedVariantConsequenceService, bulkLoadFileHistory, dataProvider.name(), consequenceIdsBefore, consequenceIdsLoaded, "predicted variant consequences");
+ }
+ bulkLoadFileHistory.finishLoad();
+ updateHistory(bulkLoadFileHistory);
+ updateExceptions(bulkLoadFileHistory);
+
+ } catch (Exception e) {
+ failLoad(bulkLoadFileHistory, e);
+ e.printStackTrace();
+ }
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/constructAssociations/ConstructGenomicEntityAssociationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/constructAssociations/ConstructGenomicEntityAssociationExecutor.java
index 5e94cadaf..3e0ee50e9 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/constructAssociations/ConstructGenomicEntityAssociationExecutor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/constructAssociations/ConstructGenomicEntityAssociationExecutor.java
@@ -53,8 +53,8 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.setCount(associations.size());
updateHistory(bulkLoadFileHistory);
- runLoad(constructGenomicEntityAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded);
- if (cleanUp) {
+ boolean success = runLoad(constructGenomicEntityAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded);
+ if (cleanUp && success) {
runCleanup(constructGenomicEntityAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "construct genomic entity association");
}
bulkLoadFileHistory.finishLoad();
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3GeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3GeneExecutor.java
new file mode 100644
index 000000000..f4834db0f
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3GeneExecutor.java
@@ -0,0 +1,135 @@
+package org.alliancegenome.curation_api.jobs.executors.gff;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.zip.GZIPInputStream;
+
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException;
+import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData;
+import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad;
+import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO;
+import org.alliancegenome.curation_api.response.APIResponse;
+import org.alliancegenome.curation_api.response.LoadHistoryResponce;
+import org.alliancegenome.curation_api.services.associations.geneAssociations.GeneGenomicLocationAssociationService;
+import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper;
+import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator;
+import org.alliancegenome.curation_api.util.ProcessDisplayHelper;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+
+import com.fasterxml.jackson.databind.MappingIterator;
+import com.fasterxml.jackson.dataformat.csv.CsvMapper;
+import com.fasterxml.jackson.dataformat.csv.CsvParser;
+import com.fasterxml.jackson.dataformat.csv.CsvSchema;
+
+import io.quarkus.logging.Log;
+import jakarta.enterprise.context.ApplicationScoped;
+import jakarta.inject.Inject;
+
+@ApplicationScoped
+public class Gff3GeneExecutor extends Gff3Executor {
+
+ @Inject GeneGenomicLocationAssociationService geneLocationService;
+ @Inject Gff3DtoValidator gff3DtoValidator;
+
+ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) {
+ try {
+
+ CsvSchema gff3Schema = CsvSchemaBuilder.gff3Schema();
+ CsvMapper csvMapper = new CsvMapper();
+ MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(Gff3DTO.class).with(gff3Schema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())));
+ List gffData = it.readAll();
+ List gffHeaderData = new ArrayList<>();
+ for (Gff3DTO gffLine : gffData) {
+ if (gffLine.getSeqId().startsWith("#")) {
+ gffHeaderData.add(gffLine.getSeqId());
+ } else {
+ break;
+ }
+ }
+ gffData.subList(0, gffHeaderData.size()).clear();
+
+ BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad();
+ BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType());
+
+ List>> preProcessedGeneGffData = Gff3AttributesHelper.getGeneGffData(gffData, dataProvider);
+
+ gffData.clear();
+
+ List locationIdsAdded = new ArrayList<>();
+ String assemblyId = loadGenomeAssemblyFromGFF(gffHeaderData);
+
+ boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGeneGffData, locationIdsAdded, dataProvider, assemblyId);
+
+ if (success) {
+ runCleanup(geneLocationService, bulkLoadFileHistory, dataProvider.name(), geneLocationService.getIdsByDataProvider(dataProvider), locationIdsAdded, "GFF gene genomic location association");
+ }
+ bulkLoadFileHistory.finishLoad();
+ updateHistory(bulkLoadFileHistory);
+ updateExceptions(bulkLoadFileHistory);
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private boolean runLoad(
+ BulkLoadFileHistory history,
+ List gffHeaderData,
+ List>> gffData,
+ List locationIdsAdded,
+ BackendBulkDataProvider dataProvider,
+ String assemblyId) {
+
+ ProcessDisplayHelper ph = new ProcessDisplayHelper();
+ ph.addDisplayHandler(loadProcessDisplayService);
+ ph.startProcess("GFF Gene update for " + dataProvider.name(), gffData.size());
+
+ String countType = "Locations";
+ history.setCount(countType, gffData.size());
+ updateHistory(history);
+
+ for (ImmutablePair> gff3EntryPair : gffData) {
+ if (assemblyId != null) {
+ countType = "Locations";
+ try {
+ gff3Service.loadGeneLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId);
+ history.incrementCompleted(countType);
+ } catch (ObjectUpdateException e) {
+ history.incrementFailed(countType);
+ addException(history, e.getData());
+ } catch (KnownIssueValidationException e) {
+ Log.debug(e.getMessage());
+ history.incrementSkipped(countType);
+ } catch (Exception e) {
+ e.printStackTrace();
+ history.incrementFailed(countType);
+ addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace()));
+ }
+ }
+ ph.progressProcess();
+ }
+ updateHistory(history);
+ ph.finishProcess();
+ return true;
+ }
+
+ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) {
+ List idsAdded = new ArrayList<>();
+ BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName);
+ List>> preProcessedGeneGffData = Gff3AttributesHelper.getGeneGffData(gffData, dataProvider);
+ BulkLoadFileHistory history = new BulkLoadFileHistory();
+ history = bulkLoadFileHistoryDAO.persist(history);
+ runLoad(history, null, preProcessedGeneGffData, idsAdded, dataProvider, assemblyName);
+ history.finishLoad();
+
+ return new LoadHistoryResponce(history);
+ }
+
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadProcessor.java
index 86c18ec11..e61b1a910 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadProcessor.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadProcessor.java
@@ -131,6 +131,12 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean
bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
}
bulkLoadFileDAO.persist(bulkLoadFile);
+ history.setBulkLoad(bulkLoad);
+ history.setBulkLoadFile(bulkLoadFile);
+ bulkLoadFileHistoryDAO.persist(history);
+
+ Log.info("Firing Pending Bulk File History Event: " + history.getId());
+ pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
} else if (load.getBulkloadStatus().isForced()) {
bulkLoadFile = bulkLoadFiles.getResults().get(0);
if (history.getBulkloadStatus().isNotRunning()) {
@@ -142,25 +148,26 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean
Log.info("Cleaning up downloaded file: " + localFilePath);
new File(localFilePath).delete();
}
+ if (cleanUp) {
+ bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
+ }
+ bulkLoadFileDAO.merge(bulkLoadFile);
+ history.setBulkLoad(bulkLoad);
+ history.setBulkLoadFile(bulkLoadFile);
+ bulkLoadFileHistoryDAO.persist(history);
+
+ Log.info("Firing Pending Bulk File History Event: " + history.getId());
+ pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
} else {
Log.info("Bulk File already exists not creating it");
bulkLoadFile = bulkLoadFiles.getResults().get(0);
Log.info("Cleaning up downloaded file: " + localFilePath);
new File(localFilePath).delete();
bulkLoadFile.setLocalFilePath(null);
+ bulkLoadFileDAO.merge(bulkLoadFile);
+ Log.info("File already exists not running load");
}
-
- history.setBulkLoad(bulkLoad);
- history.setBulkLoadFile(bulkLoadFile);
- bulkLoadFileHistoryDAO.persist(history);
- if (cleanUp) {
- bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES);
- }
- bulkLoadFileDAO.merge(bulkLoadFile);
- bulkLoadDAO.merge(load);
- Log.info("Firing Pending Bulk File History Event: " + history.getId());
- pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId()));
}
protected void startLoad(BulkLoad load) {
diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/util/CsvSchemaBuilder.java b/src/main/java/org/alliancegenome/curation_api/jobs/util/CsvSchemaBuilder.java
index 28c4bfca0..8320586b8 100644
--- a/src/main/java/org/alliancegenome/curation_api/jobs/util/CsvSchemaBuilder.java
+++ b/src/main/java/org/alliancegenome/curation_api/jobs/util/CsvSchemaBuilder.java
@@ -105,4 +105,30 @@ public static CsvSchema gff3Schema() {
return schema;
}
+
+ public static CsvSchema vepTxtSchema() {
+ CsvSchema schema = CsvSchema.builder()
+ .setColumnSeparator('\t')
+ .setArrayElementSeparator(";")
+ .setAllowComments(true)
+ .setNullValue("-")
+ .disableQuoteChar()
+ .addColumn("uploadedVariation")
+ .addColumn("location")
+ .addColumn("allele")
+ .addColumn("gene")
+ .addColumn("feature")
+ .addColumn("featureType")
+ .addColumn("consequence")
+ .addColumn("cdnaPosition")
+ .addColumn("cdsPosition")
+ .addColumn("proteinPosition")
+ .addColumn("aminoAcids")
+ .addColumn("codons")
+ .addColumn("existingVariation")
+ .addColumn("extra")
+ .build();
+
+ return schema;
+ }
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AffectedGenomicModel.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AffectedGenomicModel.java
index bf2b61b71..c9611c9a3 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/AffectedGenomicModel.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AffectedGenomicModel.java
@@ -4,6 +4,7 @@
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
import org.alliancegenome.curation_api.view.View;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
@@ -26,7 +27,7 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
-@ToString(exclude = { "agmDiseaseAnnotations" }, callSuper = true)
+@ToString(exclude = { "agmDiseaseAnnotations", "constructGenomicEntityAssociations" }, callSuper = true)
@Schema(name = "AffectedGenomicModel", description = "POJO that represents the AGM")
@AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }, partial = true)
public class AffectedGenomicModel extends GenomicEntity {
@@ -43,4 +44,15 @@ public class AffectedGenomicModel extends GenomicEntity {
@ManyToOne
@JsonView({ View.FieldsOnly.class, View.ForPublic.class })
private VocabularyTerm subtype;
+
+ @IndexedEmbedded(includePaths = {
+ "constructAssociationSubject.curie", "constructAssociationSubject.constructSymbol.displayText", "constructAssociationSubject.constructSymbol.formatText",
+ "constructAssociationSubject.constructFullName.displayText", "constructAssociationSubject.constructFullName.formatText", "constructAssociationSubject.modEntityId",
+ "constructAssociationSubject.curie_keyword", "constructAssociationSubject.constructSymbol.displayText_keyword", "constructAssociationSubject.constructSymbol.formatText_keyword",
+ "constructAssociationSubject.constructFullName.displayText_keyword", "constructAssociationSubject.constructFullName.formatText_keyword", "constructAssociationSubject.modEntityId_keyword"
+ })
+ @OneToMany(mappedBy = "constructGenomicEntityAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
+ private List constructGenomicEntityAssociations;
+
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Allele.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Allele.java
index d5d9a1bbc..18bd7a5e1 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/Allele.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Allele.java
@@ -2,11 +2,13 @@
import java.util.List;
+import jakarta.persistence.*;
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.bridges.BooleanAndNullValueBridge;
import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation;
import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation;
+import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleDatabaseStatusSlotAnnotation;
import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleFullNameSlotAnnotation;
import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleFunctionalImpactSlotAnnotation;
@@ -34,15 +36,6 @@
import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.fasterxml.jackson.annotation.JsonView;
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Index;
-import jakarta.persistence.JoinTable;
-import jakarta.persistence.ManyToMany;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.OneToOne;
-import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@@ -55,7 +48,7 @@
exclude = {
"alleleGeneAssociations", "alleleVariantAssociations", "alleleDiseaseAnnotations", "alleleMutationTypes", "alleleSymbol", "alleleFullName", "alleleSynonyms",
"alleleSecondaryIds", "alleleInheritanceModes", "alleleFunctionalImpacts", "alleleGermlineTransmissionStatus", "alleleDatabaseStatus",
- "alleleNomenclatureEvents"
+ "alleleNomenclatureEvents", "constructGenomicEntityAssociations"
},
callSuper = true
)
@@ -212,4 +205,15 @@ public class Allele extends GenomicEntity {
@Index(name = "allele_note_relatednotes_index", columnList = "relatedNotes_id")})
private List relatedNotes;
+
+ @IndexedEmbedded(includePaths = {
+ "constructAssociationSubject.curie", "constructAssociationSubject.constructSymbol.displayText", "constructAssociationSubject.constructSymbol.formatText",
+ "constructAssociationSubject.constructFullName.displayText", "constructAssociationSubject.constructFullName.formatText", "constructAssociationSubject.modEntityId",
+ "constructAssociationSubject.curie_keyword", "constructAssociationSubject.constructSymbol.displayText_keyword", "constructAssociationSubject.constructSymbol.formatText_keyword",
+ "constructAssociationSubject.constructFullName.displayText_keyword", "constructAssociationSubject.constructFullName.formatText_keyword", "constructAssociationSubject.modEntityId_keyword"
+ })
+ @OneToMany(mappedBy = "constructGenomicEntityAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
+ private List constructGenomicEntityAssociations;
+
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java
index d359e8e83..ff37f7e7e 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java
@@ -34,7 +34,7 @@ public class BioSampleAge extends AuditedObject {
@IndexedEmbedded(includePaths = {"age", "age_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
- @ManyToOne
+ @ManyToOne(cascade = CascadeType.ALL)
@JsonView({ View.FieldsOnly.class })
private TemporalContext stage;
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/DiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/DiseaseAnnotation.java
index 96b84b062..d295c7e0d 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/DiseaseAnnotation.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/DiseaseAnnotation.java
@@ -1,13 +1,20 @@
package org.alliancegenome.curation_api.model.entities;
-import java.util.List;
-
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.bridges.BooleanValueBridge;
import org.alliancegenome.curation_api.model.entities.ontology.DOTerm;
import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm;
import org.alliancegenome.curation_api.view.View;
+import org.apache.commons.collections4.CollectionUtils;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.hibernate.search.engine.backend.types.Aggregable;
import org.hibernate.search.engine.backend.types.Searchable;
@@ -19,25 +26,9 @@
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.fasterxml.jackson.annotation.JsonView;
-
-import jakarta.persistence.Column;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Index;
-import jakarta.persistence.Inheritance;
-import jakarta.persistence.InheritanceType;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.JoinTable;
-import jakarta.persistence.ManyToMany;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.Table;
-import jakarta.persistence.Transient;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
@Inheritance(strategy = InheritanceType.JOINED)
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
@@ -49,7 +40,7 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
-@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class })
+@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = {Annotation.class})
@Schema(name = "Disease_Annotation", description = "Annotation class representing a disease annotation")
@Table(indexes = {
@Index(name = "DiseaseAnnotation_internal_index", columnList = "internal"),
@@ -73,29 +64,29 @@
public abstract class DiseaseAnnotation extends Annotation {
@IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace",
- "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" })
+ "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private DOTerm diseaseAnnotationObject;
@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer", valueBridge = @ValueBridgeRef(type = BooleanValueBridge.class))
@KeywordField(name = "negated_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, valueBridge = @ValueBridgeRef(type = BooleanValueBridge.class))
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
@Column(columnDefinition = "boolean default false", nullable = false)
private Boolean negated = false;
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private VocabularyTerm relation;
@IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation",
- "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" })
+ "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
inverseJoinColumns = @JoinColumn(name = "evidencecodes_id"),
@@ -107,16 +98,16 @@ public abstract class DiseaseAnnotation extends Annotation {
private List evidenceCodes;
@IndexedEmbedded(includePaths = {
- "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
- "geneSymbol.formatText", "geneSymbol.displayText", "geneSymbol.formatText_keyword", "geneSymbol.displayText_keyword",
- "geneFullName.formatText", "geneFullName.displayText", "geneFullName.formatText_keyword", "geneFullName.displayText_keyword",
- "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSystematicName.formatText_keyword", "geneSystematicName.displayText_keyword",
- "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSynonyms.formatText_keyword", "geneSynonyms.displayText_keyword",
- "geneSecondaryIds.secondaryId", "geneSecondaryIds.secondaryId_keyword", "name", "name_keyword", "symbol", "symbol_keyword"
+ "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
+ "geneSymbol.formatText", "geneSymbol.displayText", "geneSymbol.formatText_keyword", "geneSymbol.displayText_keyword",
+ "geneFullName.formatText", "geneFullName.displayText", "geneFullName.formatText_keyword", "geneFullName.displayText_keyword",
+ "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSystematicName.formatText_keyword", "geneSystematicName.displayText_keyword",
+ "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSynonyms.formatText_keyword", "geneSynonyms.displayText_keyword",
+ "geneSecondaryIds.secondaryId", "geneSecondaryIds.secondaryId_keyword", "name", "name_keyword", "symbol", "symbol_keyword"
})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
inverseJoinColumns = @JoinColumn(name = "with_id"),
@@ -130,13 +121,13 @@ public abstract class DiseaseAnnotation extends Annotation {
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private VocabularyTerm annotationType;
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
inverseJoinColumns = @JoinColumn(name = "diseasequalifiers_id"),
@@ -150,27 +141,27 @@ public abstract class DiseaseAnnotation extends Annotation {
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private VocabularyTerm geneticSex;
@IndexedEmbedded(includePaths = {"sourceOrganization.abbreviation", "sourceOrganization.fullName", "sourceOrganization.shortName", "crossReference.displayName", "crossReference.referencedCurie",
- "sourceOrganization.abbreviation_keyword", "sourceOrganization.fullName_keyword", "sourceOrganization.shortName_keyword", "crossReference.displayName_keyword", "crossReference.referencedCurie_keyword"})
+ "sourceOrganization.abbreviation_keyword", "sourceOrganization.fullName_keyword", "sourceOrganization.shortName_keyword", "crossReference.displayName_keyword", "crossReference.referencedCurie_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private DataProvider secondaryDataProvider;
@IndexedEmbedded(includePaths = {
- "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
- "geneSymbol.formatText", "geneSymbol.displayText", "geneSymbol.formatText_keyword", "geneSymbol.displayText_keyword",
- "geneFullName.formatText", "geneFullName.displayText", "geneFullName.formatText_keyword", "geneFullName.displayText_keyword",
- "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSystematicName.formatText_keyword", "geneSystematicName.displayText_keyword",
- "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSynonyms.formatText_keyword", "geneSynonyms.displayText_keyword",
- "geneSecondaryIds.secondaryId", "geneSecondaryIds.secondaryId_keyword", "name", "name_keyword", "symbol", "symbol_keyword"
+ "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
+ "geneSymbol.formatText", "geneSymbol.displayText", "geneSymbol.formatText_keyword", "geneSymbol.displayText_keyword",
+ "geneFullName.formatText", "geneFullName.displayText", "geneFullName.formatText_keyword", "geneFullName.displayText_keyword",
+ "geneSystematicName.formatText", "geneSystematicName.displayText", "geneSystematicName.formatText_keyword", "geneSystematicName.displayText_keyword",
+ "geneSynonyms.formatText", "geneSynonyms.displayText", "geneSynonyms.formatText_keyword", "geneSynonyms.displayText_keyword",
+ "geneSecondaryIds.secondaryId", "geneSecondaryIds.secondaryId_keyword", "name", "name_keyword", "symbol", "symbol_keyword"
})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
name = "diseaseannotation_modifiergene",
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
@@ -183,15 +174,15 @@ public abstract class DiseaseAnnotation extends Annotation {
private List diseaseGeneticModifierGenes;
@IndexedEmbedded(includePaths = {
- "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
- "alleleSymbol.formatText", "alleleSymbol.displayText", "alleleSymbol.formatText_keyword", "alleleSymbol.displayText_keyword",
- "alleleFullName.formatText", "alleleFullName.displayText", "alleleFullName.formatText_keyword", "alleleFullName.displayText_keyword",
- "alleleSynonyms.formatText", "alleleSynonyms.displayText", "alleleSynonyms.formatText_keyword", "alleleSynonyms.displayText_keyword",
- "alleleSecondaryIds.secondaryId", "alleleSecondaryIds.secondaryId_keyword"
+ "curie", "modEntityId", "modInternalId", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword",
+ "alleleSymbol.formatText", "alleleSymbol.displayText", "alleleSymbol.formatText_keyword", "alleleSymbol.displayText_keyword",
+ "alleleFullName.formatText", "alleleFullName.displayText", "alleleFullName.formatText_keyword", "alleleFullName.displayText_keyword",
+ "alleleSynonyms.formatText", "alleleSynonyms.displayText", "alleleSynonyms.formatText_keyword", "alleleSynonyms.displayText_keyword",
+ "alleleSecondaryIds.secondaryId", "alleleSecondaryIds.secondaryId_keyword"
})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
name = "diseaseannotation_modifierallele",
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
@@ -206,7 +197,7 @@ public abstract class DiseaseAnnotation extends Annotation {
@IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToMany
- @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class })
+ @JsonView({View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class})
@JoinTable(
name = "diseaseannotation_modifieragm",
joinColumns = @JoinColumn(name = "diseaseannotation_id"),
@@ -218,10 +209,24 @@ public abstract class DiseaseAnnotation extends Annotation {
)
private List diseaseGeneticModifierAgms;
+ public List getDiseaseGeneticModifiers() {
+ List geneticModifiers = new ArrayList<>();
+ if (CollectionUtils.isNotEmpty(getDiseaseGeneticModifierAlleles())) {
+ geneticModifiers.addAll(getDiseaseGeneticModifierAlleles().stream().filter(Objects::nonNull).toList());
+ }
+ if (CollectionUtils.isNotEmpty(getDiseaseGeneticModifierGenes())) {
+ geneticModifiers.addAll(getDiseaseGeneticModifierGenes().stream().filter(Objects::nonNull).toList());
+ }
+ if (CollectionUtils.isNotEmpty(getDiseaseGeneticModifierAgms())) {
+ geneticModifiers.addAll(getDiseaseGeneticModifierAgms().stream().filter(Objects::nonNull).toList());
+ }
+ return geneticModifiers;
+ }
+
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ @JsonView({View.FieldsOnly.class, View.ForPublic.class})
private VocabularyTerm diseaseGeneticModifierRelation;
@Transient
@@ -232,7 +237,7 @@ public abstract class DiseaseAnnotation extends Annotation {
@Transient
public abstract String getSubjectSpeciesName();
-
+
@Transient
public abstract String getSubjectIdentifier();
@@ -246,4 +251,21 @@ public String getDataProviderString() {
}
return builder.toString();
}
+
+ @Transient
+ public String getFullRelationString() {
+ if (relation == null) {
+ return null;
+ }
+ if (!negated) {
+ return relation.getName();
+ }
+
+ if (relation.getName().equals("is_model_of")) {
+ return "does_not_model";
+ }
+ return relation.getName().replaceFirst("_", "_not_");
+ }
+
+
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionExperiment.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionExperiment.java
new file mode 100644
index 000000000..9ee6bbd92
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionExperiment.java
@@ -0,0 +1,66 @@
+package org.alliancegenome.curation_api.model.entities;
+
+import com.fasterxml.jackson.annotation.JsonSubTypes;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.base.SubmittedObject;
+import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm;
+import org.alliancegenome.curation_api.view.View;
+import org.hibernate.search.engine.backend.types.Aggregable;
+import org.hibernate.search.engine.backend.types.Searchable;
+import org.hibernate.search.engine.backend.types.Sortable;
+import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.*;
+
+import java.util.List;
+import java.util.Set;
+
+@MappedSuperclass
+@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type")
+@JsonSubTypes({ @JsonSubTypes.Type(value = GeneExpressionExperiment.class, name = "GeneExpressionExperiment") })
+@Indexed
+@Data
+@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
+@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SubmittedObject.class }, partial = true)
+public abstract class ExpressionExperiment extends SubmittedObject {
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "uniqueId_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @Column(length = 3500)
+ @JsonView({ View.FieldsOnly.class })
+ @EqualsAndHashCode.Include
+ private String uniqueId;
+
+ @IndexedEmbedded(includePaths = {"geneSymbol.displayText", "geneSymbol.formatText", "geneSymbol.displayText_keyword", "geneSymbol.formatText_keyword", "curie", "curie_keyword", "taxon.curie", "taxon.name", "taxon.curie_keyword", "taxon.name_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({View.FieldsOnly.class })
+ private Gene entityAssayed;
+
+ @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class, View.ForPublic.class })
+ private Reference singleReference;
+
+ @IndexedEmbedded(includePaths = {"name", "name_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({View.FieldsOnly.class})
+ private MMOTerm expressionAssayUsed;
+
+ @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonView({View.FieldsAndLists.class})
+ private Set expressionAnnotations;
+
+ @Transient private Allele specimenGenomicModel;
+ @Transient private List detectionReagents;
+ @Transient private List specimenAlleles;
+ @Transient private List relatedNotes;
+ @Transient private List conditionRelations;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Gene.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Gene.java
index a2ed18954..c84a39d07 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/Gene.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Gene.java
@@ -5,6 +5,8 @@
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation;
+import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
+import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGenomicLocationAssociation;
import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation;
import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation;
import org.alliancegenome.curation_api.model.entities.ontology.SOTerm;
@@ -38,7 +40,8 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
-@ToString(exclude = { "geneDiseaseAnnotations", "geneGeneAssociations", "geneSymbol", "geneFullName", "geneSystematicName", "geneSynonyms", "geneSecondaryIds", "alleleGeneAssociations", "sequenceTargetingReagentGeneAssociations", "transcriptGeneAssociations" }, callSuper = true)
+@ToString(exclude = { "geneDiseaseAnnotations", "geneGeneAssociations", "geneSymbol", "geneFullName", "geneSystematicName", "geneSynonyms", "geneSecondaryIds",
+ "geneGenomicLocationAssociations", "alleleGeneAssociations", "sequenceTargetingReagentGeneAssociations", "transcriptGeneAssociations", "constructGenomicEntityAssociations" }, callSuper = true)
@Schema(name = "Gene", description = "POJO that represents the Gene")
@AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }, partial = true)
@Table(indexes = { @Index(name = "gene_genetype_index", columnList = "geneType_id") })
@@ -105,4 +108,28 @@ public class Gene extends GenomicEntity {
@OneToMany(mappedBy = "transcriptGeneAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
private List transcriptGeneAssociations;
+
+ @IndexedEmbedded(
+ includePaths = {
+ "geneGenomicLocationAssociationObject.curie", "geneGenomicLocationAssociationObject.curie_keyword",
+ "geneGenomicLocationAssociationObject.modEntityId", "geneGenomicLocationAssociationObject.modEntityId_keyword",
+ "geneGenomicLocationAssociationObject.modInternalId", "geneGenomicLocationAssociationObject.modInternalId_keyword",
+ "start", "end"
+ }
+ )
+ @OneToMany(mappedBy = "geneAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
+ private List geneGenomicLocationAssociations;
+
+
+ @IndexedEmbedded(includePaths = {
+ "constructAssociationSubject.curie", "constructAssociationSubject.constructSymbol.displayText", "constructAssociationSubject.constructSymbol.formatText",
+ "constructAssociationSubject.constructFullName.displayText", "constructAssociationSubject.constructFullName.formatText", "constructAssociationSubject.modEntityId",
+ "constructAssociationSubject.curie_keyword", "constructAssociationSubject.constructSymbol.displayText_keyword", "constructAssociationSubject.constructSymbol.formatText_keyword",
+ "constructAssociationSubject.constructFullName.displayText_keyword", "constructAssociationSubject.constructFullName.formatText_keyword", "constructAssociationSubject.modEntityId_keyword"
+ })
+ @OneToMany(mappedBy = "constructGenomicEntityAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
+ private List constructGenomicEntityAssociations;
+
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionExperiment.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionExperiment.java
new file mode 100644
index 000000000..d9d587f5f
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionExperiment.java
@@ -0,0 +1,32 @@
+package org.alliancegenome.curation_api.model.entities;
+
+import jakarta.persistence.Entity;
+import jakarta.persistence.Index;
+import jakarta.persistence.Table;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed;
+
+@Indexed
+@Entity
+@Data
+@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
+@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { ExpressionExperiment.class }, partial = true)
+@Table(indexes = {
+ @Index(name = "geneexpressionexperiment_uniqueid_index", columnList = "uniqueid"),
+ @Index(name = "geneexpressionexperiment_curie_index", columnList = "curie"),
+ @Index(name = "geneexpressionexperiment_modentityid_index", columnList = "modinternalid"),
+ @Index(name = "geneexpressionexperiment_modinternalid_index", columnList = "modinternalid"),
+ @Index(name = "geneexpressionexperiment_singlereference_index", columnList = "singlereference_id"),
+ @Index(name = "geneexpressionexperiment_entityassayedused_index", columnList = "entityassayed_id"),
+ @Index(name = "geneexpressionexperiment_expressionassayused_index", columnList = "expressionassayused_id"),
+ @Index(name = "geneexpressionexperiment_dataprovider_index", columnList = "dataprovider_id"),
+ @Index(name = "geneexpressionexperiment_internal_index", columnList = "internal"),
+ @Index(name = "geneexpressionexperiment_obsolete_index", columnList = "obsolete"),
+ @Index(name = "geneexpressionexperiment_createdby_index", columnList = "createdby_id"),
+ @Index(name = "geneexpressionexperiment_updatedby_index", columnList = "updatedby_id")
+})
+public class GeneExpressionExperiment extends ExpressionExperiment {
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneOntologyAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneOntologyAnnotation.java
new file mode 100644
index 000000000..2751d1bbd
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneOntologyAnnotation.java
@@ -0,0 +1,27 @@
+package org.alliancegenome.curation_api.model.entities;
+
+import com.fasterxml.jackson.annotation.JsonTypeName;
+import jakarta.persistence.Entity;
+import jakarta.persistence.ManyToOne;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.base.AuditedObject;
+import org.alliancegenome.curation_api.model.entities.ontology.GOTerm;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+
+@Entity
+@Data
+@EqualsAndHashCode
+@Schema(name = "Gene_Disease_Annotation", description = "Annotation class representing a gene disease annotation")
+@JsonTypeName("GeneOntologyAnnotation")
+@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE)
+public class GeneOntologyAnnotation extends AuditedObject {
+
+ @ManyToOne
+ private GOTerm goTerm;
+ @ManyToOne
+ private Gene singleGene;
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomicEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomicEntity.java
index 3bc9a17c8..1ff242104 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomicEntity.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomicEntity.java
@@ -1,31 +1,24 @@
package org.alliancegenome.curation_api.model.entities;
-import java.util.List;
-
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
-import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
import org.alliancegenome.curation_api.view.View;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
-import com.fasterxml.jackson.annotation.JsonView;
-
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Index;
-import jakarta.persistence.JoinTable;
-import jakarta.persistence.OneToMany;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
+import java.util.List;
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
-@ToString(exclude = { "constructGenomicEntityAssociations" }, callSuper = true)
-@AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { BiologicalEntity.class })
+@ToString(callSuper = true)
+@AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = {BiologicalEntity.class})
public class GenomicEntity extends BiologicalEntity {
@IndexedEmbedded(includePaths = {"referencedCurie", "displayName", "resourceDescriptorPage.name", "referencedCurie_keyword", "displayName_keyword", "resourceDescriptorPage.name_keyword"})
@@ -37,18 +30,8 @@ public class GenomicEntity extends BiologicalEntity {
@Index(columnList = "crossreferences_id", name = "genomicentity_crossreference_crossreferences_index")
})
@EqualsAndHashCode.Include
- @JsonView({ View.FieldsAndLists.class, View.AlleleView.class, View.GeneView.class, View.AffectedGenomicModelView.class, View.VariantView.class })
+ @JsonView({View.FieldsAndLists.class, View.AlleleView.class, View.GeneView.class, View.AffectedGenomicModelView.class, View.VariantView.class})
private List crossReferences;
-
- @IndexedEmbedded(includePaths = {
- "constructAssociationSubject.curie", "constructAssociationSubject.constructSymbol.displayText", "constructAssociationSubject.constructSymbol.formatText",
- "constructAssociationSubject.constructFullName.displayText", "constructAssociationSubject.constructFullName.formatText", "constructAssociationSubject.modEntityId",
- "constructAssociationSubject.curie_keyword", "constructAssociationSubject.constructSymbol.displayText_keyword", "constructAssociationSubject.constructSymbol.formatText_keyword",
- "constructAssociationSubject.constructFullName.displayText_keyword", "constructAssociationSubject.constructFullName.formatText_keyword", "constructAssociationSubject.modEntityId_keyword"
- })
- @OneToMany(mappedBy = "constructGenomicEntityAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true)
- @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class })
- private List constructGenomicEntityAssociations;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java
index 4941d6d84..49cab988a 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java
@@ -115,7 +115,7 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject {
private VocabularyTerm sequencingFormat;
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
- @ManyToMany
+ @ManyToMany(cascade = CascadeType.ALL)
@JoinTable(indexes = {
@Index(name = "htpdatasample_anatomicalsite_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id"),
@Index(name = "htpdatasample_anatomicalsite_samplelocations_index", columnList = "htpexpressionsamplelocations_id")
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/PredictedVariantConsequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/PredictedVariantConsequence.java
new file mode 100644
index 000000000..7920ede56
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/PredictedVariantConsequence.java
@@ -0,0 +1,170 @@
+package org.alliancegenome.curation_api.model.entities;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.bridges.BooleanValueBridge;
+import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation;
+import org.alliancegenome.curation_api.model.entities.base.AuditedObject;
+import org.alliancegenome.curation_api.model.entities.ontology.SOTerm;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.hibernate.search.engine.backend.types.Aggregable;
+import org.hibernate.search.engine.backend.types.Projectable;
+import org.hibernate.search.engine.backend.types.Searchable;
+import org.hibernate.search.engine.backend.types.Sortable;
+import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
+import org.hibernate.search.mapper.pojo.bridge.mapping.annotation.ValueBridgeRef;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField;
+
+import com.fasterxml.jackson.annotation.JsonBackReference;
+import com.fasterxml.jackson.annotation.JsonView;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Index;
+import jakarta.persistence.JoinTable;
+import jakarta.persistence.ManyToMany;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Entity
+@Data
+@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
+@ToString(callSuper = true)
+@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class })
+@Schema(name = "PredictedVariantConsequence", description = "POJO representing VEP predicted variant consequence results")
+@Table(indexes = {
+ @Index(name = "predictedvariantconsequence_varianttranscript_index", columnList = "varianttranscript_id"),
+ @Index(name = "predictedvariantconsequence_vepimpact_index", columnList = "vepimpact_id"),
+ @Index(name = "predictedvariantconsequence_polyphenprediction_index", columnList = "polyphenprediction_id"),
+ @Index(name = "predictedvariantconsequence_siftprediction_index", columnList = "siftprediction_id"),
+ @Index(name = "predictedvariantconsequence_createdby_index", columnList = "createdby_id"),
+ @Index(name = "predictedvariantconsequence_updatedby_index", columnList = "updatedby_id"),
+ @Index(name = "predictedvariantconsequence_hgvsproteinnomenclature_index", columnList = "hgvsProteinNomenclature"),
+ @Index(name = "predictedvariantconsequence_hgvscodingnomenclature_index", columnList = "hgvsCodingNomenclature"),
+ @Index(name = "predictedvariantconsequence_variantgenomiclocation_index", columnList = "variantGenomicLocation_id")
+})
+public class PredictedVariantConsequence extends AuditedObject {
+
+ @ManyToOne
+ @JsonBackReference
+ private CuratedVariantGenomicLocationAssociation variantGenomicLocation;
+
+ @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class })
+ private Transcript variantTranscript;
+
+ @IndexedEmbedded(includePaths = {"name", "name_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class })
+ private VocabularyTerm vepImpact;
+
+ @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace",
+ "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" })
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToMany
+ @JoinTable(indexes = {
+ @Index(name = "predictedvariantconsequence_ontologyterm_pvc_index", columnList = "predictedvariantconsequence_id"),
+ @Index(name = "predictedvariantconsequence_ontologyterm_vc_index", columnList = "vepconsequences_id")
+ })
+ @JsonView({ View.FieldsAndLists.class, View.VariantView.class })
+ private List vepConsequences;
+
+ @IndexedEmbedded(includePaths = {"name", "name_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class })
+ private VocabularyTerm polyphenPrediction;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Float polyphenScore;
+
+ @IndexedEmbedded(includePaths = {"name", "name_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class })
+ private VocabularyTerm siftPrediction;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Float siftScore;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "aminoAcidReference_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String aminoAcidReference;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "aminoAcidVariant_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String aminoAcidVariant;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "codonReference_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String codonReference;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "codonVariant_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String codonVariant;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedCdnaStart;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedCdnaEnd;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedCdsStart;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedCdsEnd;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedProteinStart;
+
+ @GenericField(projectable = Projectable.YES, sortable = Sortable.YES)
+ @JsonView({ View.FieldsOnly.class })
+ private Integer calculatedProteinEnd;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "hgvsProteinNomenclature_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String hgvsProteinNomenclature;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "hgvsCodingNomenclature_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "TEXT")
+ private String hgvsCodingNomenclature;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer", valueBridge = @ValueBridgeRef(type = BooleanValueBridge.class))
+ @KeywordField(name = "geneLevelConsequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, valueBridge = @ValueBridgeRef(type = BooleanValueBridge.class))
+ @JsonView({ View.FieldsOnly.class })
+ @Column(columnDefinition = "boolean default false", nullable = false)
+ private Boolean geneLevelConsequence = false;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java
index 46254b04e..0617af6f8 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java
@@ -11,9 +11,14 @@
import org.alliancegenome.curation_api.model.entities.ontology.SOTerm;
import org.alliancegenome.curation_api.view.View;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.hibernate.search.engine.backend.types.Aggregable;
+import org.hibernate.search.engine.backend.types.Searchable;
+import org.hibernate.search.engine.backend.types.Sortable;
import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField;
import com.fasterxml.jackson.annotation.JsonView;
@@ -33,12 +38,18 @@
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@ToString(exclude = { "transcriptGenomicLocationAssociations", "transcriptGeneAssociations", "transcriptCodingSequenceAssociations", "transcriptExonAssociations" }, callSuper = true)
@Schema(name = "Transcript", description = "POJO that represents the Transcript")
-@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class })
+@AGRCurationSchemaVersion(min = "2.8.1", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class })
@Table(indexes = {
+ @Index(name = "transcript_transcriptId_index", columnList = "transcriptId"),
@Index(name = "transcript_transcriptType_index", columnList = "transcriptType_id")
})
public class Transcript extends GenomicEntity {
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "transcriptId_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ private String transcriptId;
+
@JsonView({ View.FieldsOnly.class })
private String name;
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/constructAssociations/ConstructGenomicEntityAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/constructAssociations/ConstructGenomicEntityAssociation.java
index b848b3b0c..67b208014 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/constructAssociations/ConstructGenomicEntityAssociation.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/constructAssociations/ConstructGenomicEntityAssociation.java
@@ -1,14 +1,14 @@
package org.alliancegenome.curation_api.model.entities.associations.constructAssociations;
-import java.util.List;
-
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.persistence.*;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
-import org.alliancegenome.curation_api.model.entities.Construct;
-import org.alliancegenome.curation_api.model.entities.EvidenceAssociation;
-import org.alliancegenome.curation_api.model.entities.GenomicEntity;
-import org.alliancegenome.curation_api.model.entities.Note;
-import org.alliancegenome.curation_api.model.entities.VocabularyTerm;
+import org.alliancegenome.curation_api.model.entities.*;
import org.alliancegenome.curation_api.view.View;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
import org.hibernate.annotations.Fetch;
@@ -17,26 +17,13 @@
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonView;
-
-import jakarta.persistence.CascadeType;
-import jakarta.persistence.Entity;
-import jakarta.persistence.Index;
-import jakarta.persistence.JoinColumn;
-import jakarta.persistence.JoinTable;
-import jakarta.persistence.ManyToOne;
-import jakarta.persistence.OneToMany;
-import jakarta.persistence.Table;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.ToString;
+import java.util.List;
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
@ToString(callSuper = true)
-@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class })
+@AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = {EvidenceAssociation.class})
@Schema(name = "ConstructGenomicEntityAssociation", description = "POJO representing an association between a construct and a genomic entity")
@Table(indexes = {
@@ -57,24 +44,25 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation {
"curie_keyword", "constructSymbol.displayText_keyword", "constructSymbol.formatText_keyword",
"constructFullName.displayText_keyword", "constructFullName.formatText_keyword", "modEntityId_keyword", "modInternalId_keyword"})
@ManyToOne
- @JsonView({ View.FieldsOnly.class })
+ @JsonView({View.FieldsOnly.class})
@JsonIgnoreProperties("constructGenomicEntityAssociations")
@Fetch(FetchMode.JOIN)
private Construct constructAssociationSubject;
-
+
@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class })
+ @JsonView({View.FieldsOnly.class})
private VocabularyTerm relation;
-
+
@IndexedEmbedded(includeDepth = 1)
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
- @JsonView({ View.FieldsOnly.class })
+ @JsonView({View.FieldsOnly.class})
@JsonIgnoreProperties({
"alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations",
- "transcriptGenomicLocationAssociations", "exonGenomicLocationAssociations", "codingSequenceGenomicLocationAssociations"
+ "transcriptGenomicLocationAssociations", "exonGenomicLocationAssociations", "codingSequenceGenomicLocationAssociations",
+ "transcriptGeneAssociations", "geneGenomicLocationAssociations", "transcriptExonAssociations", "transcriptCodingSequenceAssociations"
})
private GenomicEntity constructGenomicEntityAssociationObject;
@@ -84,7 +72,7 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation {
})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
- @JsonView({ View.FieldsAndLists.class, View.ConstructView.class })
+ @JsonView({View.FieldsAndLists.class, View.ConstructView.class})
@JoinTable(
joinColumns = @JoinColumn(name = "constructgenomicentityassociation_id"),
inverseJoinColumns = @JoinColumn(name = "relatedNotes_id"),
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGenomicLocationAssociation.java
new file mode 100644
index 000000000..c829b5059
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGenomicLocationAssociation.java
@@ -0,0 +1,82 @@
+package org.alliancegenome.curation_api.model.entities.associations.geneAssociations;
+
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.AssemblyComponent;
+import org.alliancegenome.curation_api.model.entities.Gene;
+import org.alliancegenome.curation_api.model.entities.LocationAssociation;
+import org.alliancegenome.curation_api.view.View;
+import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
+import org.hibernate.search.engine.backend.types.Aggregable;
+import org.hibernate.search.engine.backend.types.Searchable;
+import org.hibernate.search.engine.backend.types.Sortable;
+import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField;
+
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonView;
+
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Index;
+import jakarta.persistence.ManyToOne;
+import jakarta.persistence.Table;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.ToString;
+
+@Entity
+@Data
+@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
+@ToString(callSuper = true)
+@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { LocationAssociation.class })
+@Schema(name = "GeneGenomicLocationAssociation", description = "POJO representing an association between a gene and a genomic location")
+
+@Table(indexes = {
+ @Index(name = "geneGenomicLocationAssociation_internal_index", columnList = "internal"),
+ @Index(name = "geneGenomicLocationAssociation_obsolete_index", columnList = "obsolete"),
+ @Index(name = "geneGenomicLocationAssociation_strand_index", columnList = "strand"),
+ @Index(name = "geneGenomicLocationAssociation_createdBy_index", columnList = "createdBy_id"),
+ @Index(name = "geneGenomicLocationAssociation_updatedBy_index", columnList = "updatedBy_id"),
+ @Index(name = "geneGenomicLocationAssociation_relation_index", columnList = "relation_id"),
+ @Index(name = "geneGenomicLocationAssociation_subject_index", columnList = "geneassociationsubject_id"),
+ @Index(name = "geneGenomicLocationAssociation_object_index", columnList = "genegenomiclocationassociationobject_id")
+})
+
+public class GeneGenomicLocationAssociation extends LocationAssociation {
+
+ @IndexedEmbedded(includePaths = {"curie", "geneSymbol.displayText", "geneSymbol.formatText", "geneFullName.displayText", "geneFullName.formatText",
+ "curie_keyword", "geneSymbol.displayText_keyword", "geneSymbol.formatText_keyword", "geneFullName.displayText_keyword", "geneFullName.formatText_keyword",
+ "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"})
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @ManyToOne
+ @JsonIgnoreProperties({
+ "geneGenomicLocationAssociations",
+ "sequenceTargetingReagentGeneAssociations",
+ "transcriptGeneAssociations",
+ "alleleGeneAssociations"
+ })
+ @JsonView({ View.FieldsOnly.class })
+ private Gene geneAssociationSubject;
+
+ @IndexedEmbedded(includePaths = {
+ "curie", "curie_keyword", "modEntityId", "modEntityId_keyword",
+ "modInternalId", "modInternalId_keyword", "name", "name_keyword"
+ })
+ @ManyToOne
+ @JsonView({ View.FieldsOnly.class })
+ @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
+ @Fetch(FetchMode.JOIN)
+ private AssemblyComponent geneGenomicLocationAssociationObject;
+
+ @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
+ @KeywordField(name = "strand_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
+ @JsonView({ View.FieldsOnly.class })
+ @Column(length = 1)
+ private String strand;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java
index 82508a178..f62005b21 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java
@@ -1,11 +1,22 @@
package org.alliancegenome.curation_api.model.entities.associations.variantAssociations;
+import java.util.List;
+
import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.PredictedVariantConsequence;
+import org.alliancegenome.curation_api.view.View;
+import org.alliancegenome.curation_api.view.View.VariantView;
import org.eclipse.microprofile.openapi.annotations.media.Schema;
+import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded;
+
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+import com.fasterxml.jackson.annotation.JsonView;
+import jakarta.persistence.CascadeType;
import jakarta.persistence.Entity;
import jakarta.persistence.Index;
+import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -14,7 +25,7 @@
@Entity
@Data
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
-@ToString(callSuper = true)
+@ToString(exclude = "predictedVariantConsequences", callSuper = true)
@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { VariantGenomicLocationAssociation.class })
@Schema(name = "CuratedVariantGenomicLocationAssociation", description = "POJO representing an association between a variant and a curated genomic location")
@@ -35,5 +46,19 @@
)
public class CuratedVariantGenomicLocationAssociation extends VariantGenomicLocationAssociation {
-
+
+ @IndexedEmbedded(
+ includePaths = {
+ "variantTranscript.name", "variantTranscript.modEntityId",
+ "variantTranscript.modInternalId", "variantTranscript.curie",
+ "vepConsequence.name", "variantTranscript.name_keyword",
+ "variantTranscript.modEntityId_keyword", "variantTranscript.modInternalId_keyword",
+ "variantTranscript.curie_keyword", "vepConsequence.name_keyword",
+ "variantTranscript.transcriptId", "variantTranscript.transcriptId_keyword"
+ }
+ )
+ @OneToMany(mappedBy = "variantGenomicLocation", cascade = CascadeType.ALL, orphanRemoval = true)
+ @JsonManagedReference
+ @JsonView({ View.FieldsAndLists.class, VariantView.class })
+ private List predictedVariantConsequences;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneOntologyAnnotationDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneOntologyAnnotationDTO.java
new file mode 100644
index 000000000..56c21d54d
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneOntologyAnnotationDTO.java
@@ -0,0 +1,19 @@
+package org.alliancegenome.curation_api.model.ingest.dto;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants;
+import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion;
+import org.alliancegenome.curation_api.model.entities.Annotation;
+
+@Data
+@EqualsAndHashCode(callSuper = false)
+@AGRCurationSchemaVersion(min = "2.8.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = {Annotation.class})
+public class GeneOntologyAnnotationDTO {
+
+ private String geneIdentifier;
+
+ private String goTermCurie;
+
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleAgeFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleAgeFmsDTO.java
new file mode 100644
index 000000000..c2e54bb03
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleAgeFmsDTO.java
@@ -0,0 +1,13 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BioSampleAgeFmsDTO extends BaseDTO {
+ private WhenExpressedFmsDTO stage;
+ private String age;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleGenomicInformationFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleGenomicInformationFmsDTO.java
new file mode 100644
index 000000000..47e6e4f51
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BioSampleGenomicInformationFmsDTO.java
@@ -0,0 +1,13 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BioSampleGenomicInformationFmsDTO extends BaseDTO {
+ private String biosampleId;
+ private String idType;
+ private String bioSampleText;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.java
index 6742ac634..10ef0c806 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.java
@@ -1,8 +1,5 @@
package org.alliancegenome.curation_api.model.ingest.dto.fms;
-import java.util.List;
-
-import org.alliancegenome.curation_api.model.ingest.dto.CrossReferenceDTO;
import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
import lombok.Data;
@@ -25,5 +22,4 @@ public class BiogridOrcFmsDTO extends BaseDTO {
private Double score5;
private String hit;
private String source;
- private List crossReferenceDtos;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcIngestFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcIngestFmsDTO.java
new file mode 100644
index 000000000..45b40347d
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcIngestFmsDTO.java
@@ -0,0 +1,16 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class BiogridOrcIngestFmsDTO extends BaseDTO {
+
+ private MetaDataFmsDTO metaData;
+ private List data;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/GeneExpressionFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/GeneExpressionFmsDTO.java
index 73e5da75f..07ed8a065 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/GeneExpressionFmsDTO.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/GeneExpressionFmsDTO.java
@@ -13,7 +13,7 @@ public class GeneExpressionFmsDTO extends BaseDTO {
private String assay;
private String dateAssigned;
private PublicationFmsDTO evidence;
- private WhenExpressedDTO whenExpressed;
- private WhereExpressedDTO whereExpressed;
+ private WhenExpressedFmsDTO whenExpressed;
+ private WhereExpressedFmsDTO whereExpressed;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationFmsDTO.java
new file mode 100644
index 000000000..9fe958615
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationFmsDTO.java
@@ -0,0 +1,29 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HTPExpressionDatasetSampleAnnotationFmsDTO extends BaseDTO {
+ private HTPIdFmsDTO sampleId;
+ private String sampleTitle;
+ private String sampleType;
+ private BioSampleAgeFmsDTO sampleAge;
+ private List sampleLocations;
+ private String abundance;
+ private BioSampleGenomicInformationFmsDTO genomicInformation;
+ private String taxonId;
+ private String sex;
+ private String assayType;
+ private String sequencingFormat;
+ private List assemblyVersions;
+ private String notes;
+ private List datasetIds;
+ private MicroarraySampleDetailsFmsDTO microarraySampleDetails;
+ private String dateAssigned;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationIngestFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationIngestFmsDTO.java
new file mode 100644
index 000000000..b72b7927c
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetSampleAnnotationIngestFmsDTO.java
@@ -0,0 +1,15 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class HTPExpressionDatasetSampleAnnotationIngestFmsDTO extends BaseDTO {
+ private MetaDataFmsDTO metaData;
+ private List data;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/MicroarraySampleDetailsFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/MicroarraySampleDetailsFmsDTO.java
new file mode 100644
index 000000000..29219fb0e
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/MicroarraySampleDetailsFmsDTO.java
@@ -0,0 +1,13 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class MicroarraySampleDetailsFmsDTO extends BaseDTO {
+ private String channelId;
+ private Integer channelNum;
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VepTxtDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VepTxtDTO.java
new file mode 100644
index 000000000..a25fe8eac
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VepTxtDTO.java
@@ -0,0 +1,29 @@
+package org.alliancegenome.curation_api.model.ingest.dto.fms;
+
+import java.util.List;
+
+import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class VepTxtDTO extends BaseDTO {
+
+ private String uploadedVariation;
+ private String location;
+ private String allele;
+ private String gene;
+ private String feature;
+ private String featureType;
+ private String consequence;
+ private String cdnaPosition;
+ private String cdsPosition;
+ private String proteinPosition;
+ private String aminoAcids;
+ private String codons;
+ private String existingVariation;
+ private List extra;
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedFmsDTO.java
similarity index 86%
rename from src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedDTO.java
rename to src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedFmsDTO.java
index 341945676..e5e7fc37f 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedDTO.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhenExpressedFmsDTO.java
@@ -6,7 +6,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
-public class WhenExpressedDTO extends BaseDTO {
+public class WhenExpressedFmsDTO extends BaseDTO {
private String stageTermId;
private String stageName;
private UberonSlimTermDTO stageUberonSlimTerm;
diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedFmsDTO.java
similarity index 93%
rename from src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedDTO.java
rename to src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedFmsDTO.java
index 92268423a..90c19fdc3 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedDTO.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/WhereExpressedFmsDTO.java
@@ -9,7 +9,7 @@
@Data
@EqualsAndHashCode(callSuper = true)
-public class WhereExpressedDTO extends BaseDTO {
+public class WhereExpressedFmsDTO extends BaseDTO {
private String whereExpressedStatement;
private String cellularComponentTermId;
private String cellularComponentQualifierTermId;
diff --git a/src/main/java/org/alliancegenome/curation_api/model/output/APIVersionInfo.java b/src/main/java/org/alliancegenome/curation_api/model/output/APIVersionInfo.java
index f2c342205..aa3d241d3 100644
--- a/src/main/java/org/alliancegenome/curation_api/model/output/APIVersionInfo.java
+++ b/src/main/java/org/alliancegenome/curation_api/model/output/APIVersionInfo.java
@@ -1,12 +1,10 @@
package org.alliancegenome.curation_api.model.output;
-import java.util.TreeMap;
-
-import org.alliancegenome.curation_api.view.View;
-
import com.fasterxml.jackson.annotation.JsonView;
-
import lombok.Data;
+import org.alliancegenome.curation_api.view.View;
+
+import java.util.TreeMap;
@Data
public class APIVersionInfo {
@@ -23,5 +21,6 @@ public class APIVersionInfo {
private String esHost;
@JsonView(View.FieldsOnly.class)
private String env;
-
+ @JsonView(View.FieldsOnly.class)
+ private String matiHost;
}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java
index badc7798b..62fcfdcd3 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java
@@ -34,7 +34,7 @@ protected void init() {
public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) {
Map params = new HashMap<>();
params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
- if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD") || StringUtils.equals(dataProvider.sourceOrganization, "XB")) {
params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie);
}
List ids = codingSequenceDAO.findIdsByParams(params);
diff --git a/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java b/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java
index eff5ba8d7..670bddd20 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java
@@ -8,6 +8,7 @@
import org.alliancegenome.curation_api.model.entities.CrossReference;
import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage;
import org.alliancegenome.curation_api.model.ingest.dto.fms.CrossReferenceFmsDTO;
+import org.alliancegenome.curation_api.response.ObjectResponse;
import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -16,9 +17,12 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
@RequestScoped
public class CrossReferenceService extends BaseEntityCrudService {
+ HashMap crossReferenceCache = new HashMap<>();
@Inject
CrossReferenceDAO crossReferenceDAO;
@@ -109,4 +113,40 @@ public String getCrossReferenceUniqueId(CrossReference xref) {
public Map getGenomicEntityCrossRefMap(ResourceDescriptorPage page) {
return crossReferenceDAO.getGenesWithCrossRefs(page);
}
+
+ public Map getGenomicEntityCrossRefMap(Set referencedCuries) {
+ return crossReferenceDAO.getGenesWithCrossRefs(referencedCuries);
+ }
+
+ @Transactional
+ public ObjectResponse insertBioGridOrcCrossReference(CrossReference crossReference, Long geneticEntityId) {
+ String referencedCurie = crossReference.getReferencedCurie();
+
+ CrossReference dbEntity = getCrossReference(referencedCurie, crossReference.getResourceDescriptorPage());
+
+ // we only create new records, no updates
+ if (dbEntity == null) {
+ crossReferenceDAO.persist(crossReference);
+ crossReferenceDAO.persistAccessionGeneAssociated(crossReference.getId(), geneticEntityId);
+ return new ObjectResponse<>(crossReference);
+ }
+ return new ObjectResponse<>(dbEntity);
+ }
+
+ private CrossReference getCrossReference(String crossReferenceCurie, ResourceDescriptorPage page) {
+ if (crossReferenceCache.size() > 0) {
+ return crossReferenceCache.get(crossReferenceCurie);
+ }
+ populateCrossReferenceCache(page);
+ return crossReferenceCache.get(crossReferenceCurie);
+ }
+
+ private void populateCrossReferenceCache(ResourceDescriptorPage page) {
+ List allCrossRefs = crossReferenceDAO.getAllCrossRefsByPage(page);
+ allCrossRefs.stream()
+ .filter(crossRef -> Objects.equals(crossRef.getResourceDescriptorPage().getId(), page.getId()))
+ .forEach(crossRef -> {
+ crossReferenceCache.put(crossRef.getReferencedCurie(), crossRef);
+ });
+ }
}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java
index d5cbfddda..09710dfb4 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java
@@ -32,7 +32,7 @@ protected void init() {
public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) {
Map params = new HashMap<>();
params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
- if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD") || StringUtils.equals(dataProvider.sourceOrganization, "XB")) {
params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie);
}
List ids = exonDAO.findIdsByParams(params);
diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java
index 1ffe515ac..2d1229ed8 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java
@@ -4,6 +4,7 @@
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
+import lombok.Getter;
import org.alliancegenome.curation_api.constants.EntityFieldConstants;
import org.alliancegenome.curation_api.dao.GeneExpressionAnnotationDAO;
import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
@@ -18,17 +19,21 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
@RequestScoped
public class GeneExpressionAnnotationService extends BaseAnnotationCrudService implements BaseUpsertServiceInterface {
@Inject GeneExpressionAnnotationDAO geneExpressionAnnotationDAO;
@Inject GeneExpressionAnnotationFmsDTOValidator geneExpressionAnnotationFmsDTOValidator;
+ @Getter
+ private Map> experiments;
@Override
@PostConstruct
protected void init() {
setSQLDao(geneExpressionAnnotationDAO);
+ experiments = new HashMap<>();
}
public List getAnnotationIdsByDataProvider(BackendBulkDataProvider dataProvider) {
@@ -44,7 +49,7 @@ public List getAnnotationIdsByDataProvider(BackendBulkDataProvider dataPro
@Transactional
@Override
public GeneExpressionAnnotation upsert(GeneExpressionFmsDTO geneExpressionFmsDTO, BackendBulkDataProvider dataProvider) throws ValidationException {
- GeneExpressionAnnotation geneExpressionAnnotation = geneExpressionAnnotationFmsDTOValidator.validateAnnotation(geneExpressionFmsDTO, dataProvider);
+ GeneExpressionAnnotation geneExpressionAnnotation = geneExpressionAnnotationFmsDTOValidator.validateAnnotation(geneExpressionFmsDTO, dataProvider, experiments);
return geneExpressionAnnotationDAO.persist(geneExpressionAnnotation);
}
}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionExperimentService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionExperimentService.java
new file mode 100644
index 000000000..4d1a8514f
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionExperimentService.java
@@ -0,0 +1,83 @@
+package org.alliancegenome.curation_api.services;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
+import lombok.extern.jbosslog.JBossLog;
+import org.alliancegenome.curation_api.constants.EntityFieldConstants;
+import org.alliancegenome.curation_api.dao.GeneExpressionAnnotationDAO;
+import org.alliancegenome.curation_api.dao.GeneExpressionExperimentDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.ValidationException;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation;
+import org.alliancegenome.curation_api.model.entities.GeneExpressionExperiment;
+import org.alliancegenome.curation_api.response.SearchResponse;
+import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
+import org.alliancegenome.curation_api.services.ontology.MmoTermService;
+import org.apache.commons.lang.StringUtils;
+
+import java.util.*;
+
+@JBossLog
+@RequestScoped
+public class GeneExpressionExperimentService extends BaseEntityCrudService {
+
+ @Inject GeneExpressionExperimentDAO geneExpressionExperimentDAO;
+ @Inject GeneExpressionAnnotationDAO geneExpressionAnnotationDAO;
+ @Inject GeneService geneService;
+ @Inject MmoTermService mmoTermService;
+ @Inject ReferenceService referenceService;
+ @Inject DataProviderService dataProviderService;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setSQLDao(geneExpressionExperimentDAO);
+ }
+
+ public List getExperimentIdsByDataProvider(BackendBulkDataProvider dataProvider) {
+ Map params = new HashMap<>();
+ params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD") || StringUtils.equals(dataProvider.sourceOrganization, "XB")) {
+ params.put(EntityFieldConstants.EXP_EXPERIMENT_TAXON, dataProvider.canonicalTaxonCurie);
+ }
+ return geneExpressionExperimentDAO.findIdsByParams(params);
+ }
+
+ @Transactional
+ public GeneExpressionExperiment upsert(String experimentId, Set geneExpressionAnnotationIds, BackendBulkDataProvider dataProvider) throws ValidationException {
+ GeneExpressionExperiment geneExpressionExperiment;
+ Set annotations;
+
+ // example of experimentId: Xenbase:XB-GENE-972235|AGRKB:101000000874667|MMO:0000658
+ String[] definingFields = experimentId.split("\\|", 3);
+ String geneId = definingFields[0];
+ String referenceId = definingFields[1];
+ String assayId = definingFields[2];
+ SearchResponse response = geneExpressionExperimentDAO.findByField("uniqueId", experimentId);
+ if (response != null && response.getSingleResult() != null) {
+ geneExpressionExperiment = response.getSingleResult();
+ } else {
+ geneExpressionExperiment = new GeneExpressionExperiment();
+ geneExpressionExperiment.setUniqueId(experimentId);
+ }
+ geneExpressionExperiment.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization));
+ geneExpressionExperiment.setEntityAssayed(geneService.findByIdentifierString(geneId));
+ geneExpressionExperiment.setSingleReference(referenceService.getByCurie(referenceId).getEntity());
+ geneExpressionExperiment.setExpressionAssayUsed(mmoTermService.findByCurie(assayId));
+ geneExpressionExperiment.setInternal(false);
+ geneExpressionExperiment.setObsolete(false);
+
+ annotations = geneExpressionExperiment.getExpressionAnnotations();
+ if (annotations == null) {
+ annotations = new HashSet<>();
+ }
+ for (String geneExpressionAnnotationId: geneExpressionAnnotationIds) {
+ annotations.add(geneExpressionAnnotationDAO.findByField("uniqueId", geneExpressionAnnotationId).getSingleResult());
+ }
+ geneExpressionExperiment.setExpressionAnnotations(annotations);
+
+ return geneExpressionExperimentDAO.persist(geneExpressionExperiment);
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneOntologyAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneOntologyAnnotationService.java
new file mode 100644
index 000000000..2c7575e7f
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/services/GeneOntologyAnnotationService.java
@@ -0,0 +1,148 @@
+package org.alliancegenome.curation_api.services;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
+import org.alliancegenome.curation_api.auth.AuthenticatedUser;
+import org.alliancegenome.curation_api.dao.GeneDAO;
+import org.alliancegenome.curation_api.dao.GeneOntologyAnnotationDAO;
+import org.alliancegenome.curation_api.dao.SpeciesDAO;
+import org.alliancegenome.curation_api.dao.ontology.GoTermDAO;
+import org.alliancegenome.curation_api.model.entities.*;
+import org.alliancegenome.curation_api.model.entities.ontology.GOTerm;
+import org.alliancegenome.curation_api.model.ingest.dto.GeneOntologyAnnotationDTO;
+import org.alliancegenome.curation_api.response.ObjectResponse;
+import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
+import org.alliancegenome.curation_api.services.validation.DataProviderValidator;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RequestScoped
+public class GeneOntologyAnnotationService extends BaseEntityCrudService {
+
+ private List species;
+ public static final String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL";
+ public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default";
+ //
+ Map accessionGeneMap = new HashMap<>();
+ Map goTermMap = new HashMap<>();
+ HashMap dataProviderMap = new HashMap<>();
+ private Map gafMap = new HashMap<>();
+
+
+ @Inject
+ @AuthenticatedUser
+ protected Person authenticatedPerson;
+ @Inject
+ GeneOntologyAnnotationDAO gafDAO;
+ @Inject
+ GeneDAO geneDAO;
+ @Inject
+ SpeciesDAO speciesDAO;
+ @Inject
+ GoTermDAO goTermDAO;
+ @Inject
+ DataProviderValidator dataProviderValidator;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setSQLDao(gafDAO);
+ }
+
+ @Transactional
+ public ObjectResponse insert(GeneOntologyAnnotationDTO uiEntity, String orgAbbreviation) {
+ // if record exists skip over it
+ if (gafMap.values().stream().anyMatch(gafDTO -> gafDTO.equals(uiEntity))) {
+ for (Map.Entry entry : gafMap.entrySet()) {
+ if (entry.getValue().equals(uiEntity)) {
+ GeneOntologyAnnotation gaf = new GeneOntologyAnnotation();
+ gaf.setId(entry.getKey());
+ ObjectResponse objectObjectResponse = new ObjectResponse<>();
+ objectObjectResponse.setEntity(gaf);
+ return objectObjectResponse;
+ }
+ }
+ }
+ // convert curies into IDs
+
+ Long geneID = getGeneID(uiEntity, orgAbbreviation);
+ GeneOntologyAnnotation gaf = new GeneOntologyAnnotation();
+ Gene gene = new Gene();
+ gene.setId(geneID);
+ gaf.setSingleGene(gene);
+ Long goID = getGOID(uiEntity);
+ GOTerm term = new GOTerm();
+ term.setId(goID);
+ gaf.setGoTerm(term);
+ GeneOntologyAnnotation gafNew = gafDAO.persistGeneGoAssociation(gaf);
+ addNewRecordToMap(gafNew, uiEntity);
+ return new ObjectResponse<>(gafNew);
+ }
+
+ private void addNewRecordToMap(GeneOntologyAnnotation gafNew, GeneOntologyAnnotationDTO uiEntity) {
+ GeneOntologyAnnotationDTO dto = new GeneOntologyAnnotationDTO();
+ dto.setGeneIdentifier(uiEntity.getGeneIdentifier());
+ dto.setGoTermCurie(uiEntity.getGoTermCurie());
+ gafMap.put(gafNew.getId(), dto);
+ }
+
+ public Long getGeneID(GeneOntologyAnnotationDTO uiEntity, String orgAbbreviation) {
+ if (accessionGeneMap.isEmpty()) {
+ List speciesList = getSpecies(orgAbbreviation);
+ speciesList.forEach(species -> accessionGeneMap.putAll(geneDAO.getAllGeneIdsPerSpecies(species)));
+ }
+ Long geneID = accessionGeneMap.get(uiEntity.getGeneIdentifier());
+ return geneID;
+ }
+
+ private Long getGOID(GeneOntologyAnnotationDTO uiEntity) {
+ if (goTermMap.isEmpty()) {
+ goTermMap = goTermDAO.getAllGOIds();
+ }
+ Long goID = goTermMap.get(uiEntity.getGoTermCurie());
+ return goID;
+ }
+
+ private List getSpecies(String orgAbbreviation) {
+ if (CollectionUtils.isNotEmpty(species)) {
+ return species;
+ }
+ if (orgAbbreviation.equalsIgnoreCase("XB")) {
+ species = new ArrayList<>();
+ species.add(getSingleSpecies("XBXL"));
+ species.add(getSingleSpecies("XBXT"));
+ } else {
+ species = List.of(getSingleSpecies(orgAbbreviation));
+ }
+ return species;
+ }
+
+ private Species getSingleSpecies(String orgAbbreviation) {
+ return speciesDAO.findByField("displayName", orgAbbreviation).getSingleResult();
+ }
+
+ public ObjectResponse validate(DataProvider uiEntity) {
+ return dataProviderValidator.validateDataProvider(uiEntity, null, true);
+ }
+
+
+ public Map getGafMap(Organization organization) {
+ if (gafMap.size() > 0) {
+ return gafMap;
+ }
+ gafMap = gafDAO.getAllGafIdsPerProvider(organization);
+ return gafMap;
+ }
+
+ @Transactional
+ public GeneOntologyAnnotation deprecateOrDelete(Long id, Boolean throwApiError, String requestSource, Boolean deprecate) {
+ return gafDAO.remove(id);
+ }
+
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java
index 4b41cfec2..53992dc80 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java
@@ -11,13 +11,16 @@
import org.alliancegenome.curation_api.dao.GenomeAssemblyDAO;
import org.alliancegenome.curation_api.dao.TranscriptDAO;
import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
-import org.alliancegenome.curation_api.exceptions.ValidationException;
+import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException;
import org.alliancegenome.curation_api.exceptions.ObjectValidationException;
+import org.alliancegenome.curation_api.exceptions.ValidationException;
import org.alliancegenome.curation_api.model.entities.CodingSequence;
import org.alliancegenome.curation_api.model.entities.Exon;
+import org.alliancegenome.curation_api.model.entities.Gene;
import org.alliancegenome.curation_api.model.entities.Transcript;
import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation;
import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation;
+import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGenomicLocationAssociation;
import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptCodingSequenceAssociation;
import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation;
import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation;
@@ -26,6 +29,7 @@
import org.alliancegenome.curation_api.response.SearchResponse;
import org.alliancegenome.curation_api.services.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationService;
import org.alliancegenome.curation_api.services.associations.exonAssociations.ExonGenomicLocationAssociationService;
+import org.alliancegenome.curation_api.services.associations.geneAssociations.GeneGenomicLocationAssociationService;
import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptCodingSequenceAssociationService;
import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService;
import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService;
@@ -51,12 +55,14 @@ public class Gff3Service {
@Inject ExonGenomicLocationAssociationService exonLocationService;
@Inject CodingSequenceGenomicLocationAssociationService cdsLocationService;
@Inject TranscriptGenomicLocationAssociationService transcriptLocationService;
+ @Inject GeneGenomicLocationAssociationService geneLocationService;
@Inject TranscriptGeneAssociationService transcriptGeneService;
@Inject TranscriptCodingSequenceAssociationService transcriptCdsService;
@Inject TranscriptExonAssociationService transcriptExonService;
@Inject DataProviderService dataProviderService;
@Inject NcbiTaxonTermService ncbiTaxonTermService;
@Inject Gff3DtoValidator gff3DtoValidator;
+ @Inject GeneService geneService;
@Transactional
public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ValidationException {
@@ -140,6 +146,42 @@ public void loadTranscriptLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ValidationException {
+ Gff3DTO gffEntry = gffEntryPair.getKey();
+ Map attributes = gffEntryPair.getValue();
+ if (StringUtils.isBlank(assemblyId)) {
+ throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly");
+ }
+
+ if (!Gff3Constants.GENE_TYPES.contains(gffEntry.getType())) {
+ throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Gene Location");
+ }
+
+ String geneCurie;
+ String identifyingAttribute;
+ if (attributes.containsKey("gene_id")) {
+ geneCurie = attributes.get("gene_id");
+ identifyingAttribute = "gene_id";
+ } else if (attributes.containsKey("ID")) {
+ geneCurie = attributes.get("ID");
+ identifyingAttribute = "ID";
+ } else {
+ throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE);
+ }
+
+ Gene gene = geneService.findByIdentifierString(geneCurie);
+ if (gene == null) {
+ throw new KnownIssueValidationException(ValidationConstants.UNRECOGNIZED_MESSAGE + " (" + attributes.get(identifyingAttribute) + ")");
+ }
+
+ GeneGenomicLocationAssociation geneLocation = gff3DtoValidator.validateGeneLocation(gffEntry, gene, assemblyId, dataProvider);
+ if (geneLocation != null) {
+ idsAdded.add(geneLocation.getId());
+ geneLocationService.addAssociationToSubject(geneLocation);
+ }
+ }
+
@Transactional
public void loadExonParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException {
Gff3DTO gffEntry = gffEntryPair.getKey();
@@ -216,7 +258,7 @@ public Map getGeneIdCurieMap(List gffData, BackendBulkD
Map geneIdCurieMap = new HashMap<>();
for (Gff3DTO gffEntry : gffData) {
- if (gffEntry.getType().contains("gene")) {
+ if (Gff3Constants.GENE_TYPES.contains(gffEntry.getType())) {
Map attributes = Gff3AttributesHelper.getAttributes(gffEntry, dataProvider);
if (attributes.containsKey("gene_id") && attributes.containsKey("ID")) {
geneIdCurieMap.put(attributes.get("ID"), attributes.get("gene_id"));
diff --git a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetSampleAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetSampleAnnotationService.java
new file mode 100644
index 000000000..6b0097203
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetSampleAnnotationService.java
@@ -0,0 +1,46 @@
+package org.alliancegenome.curation_api.services;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import org.alliancegenome.curation_api.constants.EntityFieldConstants;
+import org.alliancegenome.curation_api.dao.HTPExpressionDatasetSampleAnnotationDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.ValidationException;
+import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface;
+import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetSampleAnnotation;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetSampleAnnotationFmsDTO;
+import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
+import org.alliancegenome.curation_api.services.validation.dto.fms.HTPExpressionDatasetSampleAnnotationFmsDTOValidator;
+
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
+
+@RequestScoped
+public class HTPExpressionDatasetSampleAnnotationService extends BaseEntityCrudService implements BaseUpsertServiceInterface {
+
+ @Inject HTPExpressionDatasetSampleAnnotationDAO htpExpressionDatasetSampleAnnotationDAO;
+ @Inject HTPExpressionDatasetSampleAnnotationFmsDTOValidator htpExpressionDatasetSampleAnnotationFmsDtoValidator;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setSQLDao(htpExpressionDatasetSampleAnnotationDAO);
+ }
+ @Transactional
+ public HTPExpressionDatasetSampleAnnotation upsert(HTPExpressionDatasetSampleAnnotationFmsDTO htpExpressionDatasetSampleAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException {
+ return htpExpressionDatasetSampleAnnotationFmsDtoValidator.validateHTPExpressionDatasetSampleAnnotationFmsDTO(htpExpressionDatasetSampleAnnotationData, backendBulkDataProvider);
+ }
+
+ public List getAnnotationIdsByDataProvider(String dataProvider) {
+ Map params = new HashMap<>();
+ params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider);
+ List ids = htpExpressionDatasetSampleAnnotationDAO.findIdsByParams(params);
+ ids.removeIf(Objects::isNull);
+ return ids;
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/InformationContentEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/InformationContentEntityService.java
index 645bdacb0..2f74097e0 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/InformationContentEntityService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/InformationContentEntityService.java
@@ -28,4 +28,5 @@ public InformationContentEntity retrieveFromDbOrLiteratureService(String curieOr
return ice;
}
+
}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/OrganizationService.java b/src/main/java/org/alliancegenome/curation_api/services/OrganizationService.java
index 3b4d20b4b..672c720e9 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/OrganizationService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/OrganizationService.java
@@ -1,23 +1,23 @@
package org.alliancegenome.curation_api.services;
-import java.util.Date;
-import java.util.HashMap;
-
+import io.quarkus.logging.Log;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
import org.alliancegenome.curation_api.dao.OrganizationDAO;
import org.alliancegenome.curation_api.model.entities.Organization;
import org.alliancegenome.curation_api.response.ObjectResponse;
import org.alliancegenome.curation_api.response.SearchResponse;
import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
-import io.quarkus.logging.Log;
-import jakarta.annotation.PostConstruct;
-import jakarta.enterprise.context.RequestScoped;
-import jakarta.inject.Inject;
+import java.util.Date;
+import java.util.HashMap;
@RequestScoped
public class OrganizationService extends BaseEntityCrudService {
- @Inject OrganizationDAO organizationDAO;
+ @Inject
+ OrganizationDAO organizationDAO;
Date orgRequest;
HashMap orgIdCacheMap = new HashMap<>();
@@ -54,7 +54,7 @@ public ObjectResponse getById(Long id) {
public ObjectResponse getByAbbr(String abbr) {
Organization org = null;
- SearchResponse orgResponse = null;
+ SearchResponse orgResponse;
if (orgRequest != null) {
if (orgAbbrCacheMap.containsKey(abbr)) {
diff --git a/src/main/java/org/alliancegenome/curation_api/services/PredictedVariantConsequenceService.java b/src/main/java/org/alliancegenome/curation_api/services/PredictedVariantConsequenceService.java
new file mode 100644
index 000000000..e1b241bb6
--- /dev/null
+++ b/src/main/java/org/alliancegenome/curation_api/services/PredictedVariantConsequenceService.java
@@ -0,0 +1,100 @@
+package org.alliancegenome.curation_api.services;
+
+import java.time.OffsetDateTime;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+import org.alliancegenome.curation_api.constants.EntityFieldConstants;
+import org.alliancegenome.curation_api.dao.PredictedVariantConsequenceDAO;
+import org.alliancegenome.curation_api.enums.BackendBulkDataProvider;
+import org.alliancegenome.curation_api.exceptions.ValidationException;
+import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface;
+import org.alliancegenome.curation_api.model.entities.Person;
+import org.alliancegenome.curation_api.model.entities.PredictedVariantConsequence;
+import org.alliancegenome.curation_api.model.ingest.dto.fms.VepTxtDTO;
+import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
+import org.alliancegenome.curation_api.services.validation.dto.fms.VepGeneFmsDTOValidator;
+import org.alliancegenome.curation_api.services.validation.dto.fms.VepTranscriptFmsDTOValidator;
+import org.apache.commons.lang.StringUtils;
+
+import io.quarkus.logging.Log;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
+
+@RequestScoped
+public class PredictedVariantConsequenceService extends BaseEntityCrudService implements BaseUpsertServiceInterface {
+
+ @Inject PredictedVariantConsequenceDAO predictedVariantConsequenceDAO;
+ @Inject VepTranscriptFmsDTOValidator vepTranscriptFmsDtoValidator;
+ @Inject VepGeneFmsDTOValidator vepGeneFmsDtoValidator;
+ @Inject PersonService personService;
+
+ @Override
+ @PostConstruct
+ protected void init() {
+ setSQLDao(predictedVariantConsequenceDAO);
+ }
+
+ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) {
+ Map params = new HashMap<>();
+ params.put("variantTranscript." + EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ params.put("variantTranscript." + EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie);
+ }
+ List ids = predictedVariantConsequenceDAO.findIdsByParams(params);
+ ids.removeIf(Objects::isNull);
+ return ids;
+ }
+
+ public List getGeneLevelIdsByDataProvider(BackendBulkDataProvider dataProvider) {
+ Map params = new HashMap<>();
+ params.put("variantTranscript." + EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ params.put("variantTranscript." + EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie);
+ }
+ params.put("geneLevelConsequence", true);
+ List ids = predictedVariantConsequenceDAO.findIdsByParams(params);
+ ids.removeIf(Objects::isNull);
+ return ids;
+ }
+
+ @Override
+ @Transactional
+ public PredictedVariantConsequence upsert(VepTxtDTO dto, BackendBulkDataProvider dataProvider)
+ throws ValidationException {
+ return vepTranscriptFmsDtoValidator.validateTranscriptLevelConsequence(dto, dataProvider);
+ }
+
+ @Transactional
+ public Long updateGeneLevelConsequence(VepTxtDTO dto) throws ValidationException {
+ return vepGeneFmsDtoValidator.validateGeneLevelConsequence(dto);
+ }
+
+ @Transactional
+ public PredictedVariantConsequence resetGeneLevelConsequence(Long id, String requestSource) {
+ PredictedVariantConsequence pvc = predictedVariantConsequenceDAO.find(id);
+
+ if (pvc == null) {
+ String errorMessage = "Could not find PredictedVariantConsequence with id: " + id;
+ Log.error(errorMessage);
+ return null;
+ }
+
+ if (pvc.getGeneLevelConsequence()) {
+ pvc.setGeneLevelConsequence(true);
+ if (authenticatedPerson.getUniqueId() != null) {
+ requestSource = authenticatedPerson.getUniqueId();
+ }
+ Person updatedBy = personService.fetchByUniqueIdOrCreate(requestSource);
+ pvc.setUpdatedBy(updatedBy);
+ pvc.setDateUpdated(OffsetDateTime.now());
+ return predictedVariantConsequenceDAO.persist(pvc);
+ }
+
+ return pvc;
+ }
+}
diff --git a/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java b/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java
index 4d8d97576..daa706d9f 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java
@@ -1,10 +1,10 @@
package org.alliancegenome.curation_api.services;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-
+import io.quarkus.logging.Log;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
import org.alliancegenome.curation_api.dao.ReferenceDAO;
import org.alliancegenome.curation_api.model.entities.Reference;
import org.alliancegenome.curation_api.response.ObjectResponse;
@@ -12,20 +12,23 @@
import org.alliancegenome.curation_api.services.base.BaseEntityCrudService;
import org.alliancegenome.curation_api.services.helpers.references.ReferenceSynchronisationHelper;
-import io.quarkus.logging.Log;
-import jakarta.annotation.PostConstruct;
-import jakarta.enterprise.context.RequestScoped;
-import jakarta.inject.Inject;
-import jakarta.transaction.Transactional;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
@RequestScoped
public class ReferenceService extends BaseEntityCrudService {
- @Inject ReferenceDAO referenceDAO;
- @Inject ReferenceSynchronisationHelper refSyncHelper;
-
+ @Inject
+ ReferenceDAO referenceDAO;
+ @Inject
+ ReferenceSynchronisationHelper refSyncHelper;
+
Date referenceRequest;
+ Date referenceRequestShallow;
HashMap referenceCacheMap = new HashMap<>();
+ HashMap shallowReferenceCacheMap = new HashMap<>();
@Override
@PostConstruct
@@ -52,6 +55,9 @@ public ObjectResponse getByCurie(String curie) {
public Reference retrieveFromDbOrLiteratureService(String curieOrXref) {
Reference reference = null;
if (referenceRequest != null) {
+ if (referenceCacheMap.isEmpty()) {
+ referenceCacheMap = referenceDAO.getReferenceMap();
+ }
if (referenceCacheMap.containsKey(curieOrXref)) {
reference = referenceCacheMap.get(curieOrXref);
} else {
@@ -65,7 +71,25 @@ public Reference retrieveFromDbOrLiteratureService(String curieOrXref) {
}
return reference;
}
-
+
+ @Transactional
+ public Reference retrieveShallowReferenceFromDbOrLiteratureService(String curieOrXref) {
+ Reference reference = null;
+ if (shallowReferenceCacheMap.containsKey(curieOrXref)) {
+ reference = shallowReferenceCacheMap.get(curieOrXref);
+ } else {
+ Log.debug("Reference not cached, caching reference: (" + curieOrXref + ")");
+ if (shallowReferenceCacheMap.isEmpty()) {
+ shallowReferenceCacheMap = referenceDAO.getShallowReferenceMap();
+ reference = shallowReferenceCacheMap.get(curieOrXref);
+ } else {
+ reference = findOrCreateReference(curieOrXref);
+ referenceCacheMap.put(curieOrXref, reference);
+ }
+ }
+ return reference;
+ }
+
private Reference findOrCreateReference(String curieOrXref) {
Reference reference = null;
diff --git a/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java b/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java
index abc9f8fbf..4c8816b8e 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java
@@ -34,7 +34,7 @@ protected void init() {
public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) {
Map params = new HashMap<>();
params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization);
- if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD") || StringUtils.equals(dataProvider.sourceOrganization, "XB")) {
params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie);
}
List ids = transcriptDAO.findIdsByParams(params);
diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java
index 0ca58b1fb..2af2decd9 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java
@@ -45,7 +45,7 @@ protected void init() {
public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) {
Map params = new HashMap<>();
params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization);
- if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) {
+ if (StringUtils.equals(dataProvider.sourceOrganization, "RGD") || StringUtils.equals(dataProvider.sourceOrganization, "XB")) {
params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie);
}
List associationIds = codingSequenceGenomicLocationAssociationDAO.findIdsByParams(params);
diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/constructAssociations/ConstructGenomicEntityAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/constructAssociations/ConstructGenomicEntityAssociationService.java
index 7a0098d77..258396355 100644
--- a/src/main/java/org/alliancegenome/curation_api/services/associations/constructAssociations/ConstructGenomicEntityAssociationService.java
+++ b/src/main/java/org/alliancegenome/curation_api/services/associations/constructAssociations/ConstructGenomicEntityAssociationService.java
@@ -1,13 +1,10 @@
package org.alliancegenome.curation_api.services.associations.constructAssociations;
-import java.time.OffsetDateTime;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
+import io.quarkus.logging.Log;
+import jakarta.annotation.PostConstruct;
+import jakarta.enterprise.context.RequestScoped;
+import jakarta.inject.Inject;
+import jakarta.transaction.Transactional;
import org.alliancegenome.curation_api.constants.EntityFieldConstants;
import org.alliancegenome.curation_api.dao.ConstructDAO;
import org.alliancegenome.curation_api.dao.GenomicEntityDAO;
@@ -18,7 +15,6 @@
import org.alliancegenome.curation_api.exceptions.ValidationException;
import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface;
import org.alliancegenome.curation_api.model.entities.Construct;
-import org.alliancegenome.curation_api.model.entities.GenomicEntity;
import org.alliancegenome.curation_api.model.entities.associations.constructAssociations.ConstructGenomicEntityAssociation;
import org.alliancegenome.curation_api.model.ingest.dto.associations.constructAssociations.ConstructGenomicEntityAssociationDTO;
import org.alliancegenome.curation_api.response.ObjectResponse;
@@ -28,23 +24,27 @@
import org.alliancegenome.curation_api.services.validation.associations.constructAssociations.ConstructGenomicEntityAssociationValidator;
import org.alliancegenome.curation_api.services.validation.dto.associations.constructAssociations.ConstructGenomicEntityAssociationDTOValidator;
-import io.quarkus.logging.Log;
-import jakarta.annotation.PostConstruct;
-import jakarta.enterprise.context.RequestScoped;
-import jakarta.inject.Inject;
-import jakarta.transaction.Transactional;
+import java.util.*;
+import java.util.stream.Collectors;
@RequestScoped
public class ConstructGenomicEntityAssociationService extends BaseAssociationDTOCrudService
implements BaseUpsertServiceInterface