Skip to content

Commit

Permalink
Adding new vocabulary for GENO Terms
Browse files Browse the repository at this point in the history
  • Loading branch information
VarunReddy1111 committed Jan 16, 2025
1 parent 9023f89 commit bdee03a
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.setCount(associations.size());
updateHistory(bulkLoadFileHistory);

boolean success = runLoad(agmAlleleAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded);
String countType = "AGM Allele Associations";
boolean success = runLoad(agmAlleleAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded, countType);
if (success && cleanUp) {
runCleanup(agmAlleleAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "agm allele association");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) {
bulkLoadFileHistory.setCount(associations.size());
updateHistory(bulkLoadFileHistory);

boolean success = runLoad(agmStrAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded);
String countType = "AGM Sequence Targeting Reagent Associations";
boolean success = runLoad(agmStrAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded, countType);
if (success && cleanUp) {
runCleanup(agmStrAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "agm str association");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class AgmAlleleAssociation extends Association {
@IndexedEmbedded(includePaths = {
"curie", "alleleSymbol.displayText", "alleleSymbol.formatText", "alleleFullName.displayText", "alleleFullName.formatText",
"curie_keyword", "alleleSymbol.displayText_keyword", "alleleSymbol.formatText_keyword", "alleleFullName.displayText_keyword",
"alleleFullName.formatText_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword" })
"alleleFullName.formatText_keyword", "primaryExternalId", "primaryExternalId_keyword", "modInternalId", "modInternalId_keyword" })
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
@JsonView({ View.FieldsOnly.class })
Expand All @@ -60,7 +60,7 @@ public class AgmAlleleAssociation extends Association {

@IndexedEmbedded(includePaths = {
"curie", "name", "curie_keyword", "name_keyword",
"modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword" })
"primaryExternalId", "primaryExternalId_keyword", "modInternalId", "modInternalId_keyword" })
@ManyToOne
@JsonView({ View.FieldsOnly.class })
@JsonIgnoreProperties({"components", "constructGenomicEntityAssociations", "agmSequenceTargetingReagentAssociations"})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,12 @@
import org.alliancegenome.curation_api.services.base.BaseAssociationDTOCrudService;
import org.alliancegenome.curation_api.services.validation.dto.associations.agmAssociations.AgmAlleleAssociationDTOValidator;

import io.quarkus.logging.Log;
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.transaction.Transactional;
import lombok.extern.jbosslog.JBossLog;

@JBossLog
@RequestScoped
public class AgmAlleleAssociationService extends BaseAssociationDTOCrudService<AgmAlleleAssociation, AgmAlleleAssociationDTO, AgmAlleleAssociationDAO> implements BaseUpsertServiceInterface<AgmAlleleAssociation, AgmAlleleAssociationDTO> {

Expand Down Expand Up @@ -83,7 +82,7 @@ public AgmAlleleAssociation deprecateOrDelete(Long id, Boolean throwApiError, St
response.addErrorMessage("id", errorMessage);
throw new ApiErrorException(response);
}
log.error(errorMessage);
Log.error(errorMessage);
return null;
}
if (deprecate) {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
CREATE TABLE public.agmalleleassociation (
id bigint NOT NULL,
datecreated timestamp(6) with time zone,
dateupdated timestamp(6) with time zone,
dbdatecreated timestamp(6) with time zone,
dbdateupdated timestamp(6) with time zone,
internal boolean DEFAULT false NOT NULL,
obsolete boolean DEFAULT false NOT NULL,
zygosity character varying(255),
createdby_id bigint,
updatedby_id bigint,
agmalleleassociationobject_id bigint,
agmassociationsubject_id bigint,
relation_id bigint
);

CREATE SEQUENCE public.agmalleleassociation_seq
START WITH 1
INCREMENT BY 50
NO MINVALUE
NO MAXVALUE
CACHE 1;

ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_pkey PRIMARY KEY (id);

CREATE INDEX agmalleleassociation_agmalleleassociationobject_index ON public.agmalleleassociation USING btree (agmalleleassociationobject_id);
CREATE INDEX agmalleleassociation_agmassociationsubject_index ON public.agmalleleassociation USING btree (agmassociationsubject_id);
CREATE INDEX agmalleleassociation_createdby_index ON public.agmalleleassociation USING btree (createdby_id);
CREATE INDEX agmalleleassociation_internal_index ON public.agmalleleassociation USING btree (internal);
CREATE INDEX agmalleleassociation_obsolete_index ON public.agmalleleassociation USING btree (obsolete);
CREATE INDEX agmalleleassociation_relation_index ON public.agmalleleassociation USING btree (relation_id);
CREATE INDEX agmalleleassociation_updatedby_index ON public.agmalleleassociation USING btree (updatedby_id);

ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_agmalleleassociationobject_id FOREIGN KEY (agmalleleassociationobject_id) REFERENCES public.allele(id);
ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_agmassociationsubject_id FOREIGN KEY (agmassociationsubject_id) REFERENCES public.affectedgenomicmodel(id);
ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_createdby_id FOREIGN KEY (createdby_id) REFERENCES public.person(id);
ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_updatedby_id FOREIGN KEY (updatedby_id) REFERENCES public.person(id);
ALTER TABLE ONLY public.agmalleleassociation ADD CONSTRAINT agmalleleassociation_relation_id FOREIGN KEY (relation_id) REFERENCES public.vocabularyterm(id);


INSERT INTO vocabularytermset(id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'AGM Allele Association Relation', 'agm_allele_relation', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'agm_relation';

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association Relation'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'contains' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'agm_relation'
)
)
SELECT t1.id, t2.id FROM t1,t2;


INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Geno Terms', 'geno_terms');

INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000602', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000603', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000604', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000605', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000606', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000135', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000136', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000137', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';
INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'GENO:0000134', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';

INSERT INTO vocabularytermset(id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'AGM Allele Association GENO Terms', 'agm_allele_association_geno_terms', id FROM vocabulary WHERE vocabulary.vocabularylabel = 'geno_terms';

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000602' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000603' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000604' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000605' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000606' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000135' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000136' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000137' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id)
WITH
t1 AS (
SELECT id FROM vocabularytermset WHERE name = 'AGM Allele Association GENO Terms'
),
t2 AS (
SELECT id FROM vocabularyterm WHERE name = 'GENO:0000134' AND vocabulary_id = (
SELECT id FROM vocabulary WHERE vocabularylabel = 'geno_terms'
)
)
SELECT t1.id, t2.id FROM t1,t2;

0 comments on commit bdee03a

Please sign in to comment.