From c71eb39298670aff8d3cba105be692df7e9b106b Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 26 Jun 2024 23:37:59 +0100 Subject: [PATCH 001/342] Initial GFF loading code --- .../curation_api/constants/Gff3Constants.java | 14 ++ .../constants/LinkMLSchemaConstants.java | 2 +- .../curation_api/dao/CodingSequenceDAO.java | 15 ++ .../curation_api/dao/ExonDAO.java | 15 ++ .../curation_api/dao/GenomeAssemblyDAO.java | 15 ++ .../curation_api/dao/TranscriptDAO.java | 15 ++ .../jobs/executors/Gff3Executor.java | 146 ++++++++++++++++++ .../jobs/util/CsvSchemaBuilder.java | 20 +++ .../model/entities/CodingSequence.java | 46 ++++++ .../curation_api/model/entities/Exon.java | 46 ++++++ .../model/entities/GenomeAssembly.java | 52 +++++++ .../model/entities/Transcript.java | 46 ++++++ .../model/ingest/dto/fms/Gff3DTO.java | 24 +++ .../curation_api/services/ExonService.java | 44 ++++++ .../curation_api/services/Gff3Service.java | 91 +++++++++++ .../validation/dto/Gff3DtoValidator.java | 88 +++++++++++ 16 files changed, 678 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/CodingSequenceDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/ExonDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/GenomeAssemblyDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/TranscriptDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/Gff3DTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/ExonService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java diff --git a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java new file mode 100644 index 000000000..b2681db8c --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -0,0 +1,14 @@ +package org.alliancegenome.curation_api.constants; + +import java.util.List; + +public final class Gff3Constants { + private Gff3Constants() { + // Hidden from view, as it is a utility class + } + 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA"); + +} \ No newline at end of file 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 c2126f426..65fdf41c8 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.2.3"; + public static final String LATEST_RELEASE = "2.4.0"; 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/dao/CodingSequenceDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/CodingSequenceDAO.java new file mode 100644 index 000000000..12903065f --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/CodingSequenceDAO.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.CodingSequence; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class CodingSequenceDAO extends BaseSQLDAO { + + protected CodingSequenceDAO() { + super(CodingSequence.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ExonDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ExonDAO.java new file mode 100644 index 000000000..95c7a71a5 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/ExonDAO.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.Exon; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class ExonDAO extends BaseSQLDAO { + + protected ExonDAO() { + super(Exon.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GenomeAssemblyDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GenomeAssemblyDAO.java new file mode 100644 index 000000000..5b3dba8d5 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/GenomeAssemblyDAO.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.GenomeAssembly; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class GenomeAssemblyDAO extends BaseSQLDAO { + + protected GenomeAssemblyDAO() { + super(GenomeAssembly.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/TranscriptDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/TranscriptDAO.java new file mode 100644 index 000000000..1052c3e36 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/TranscriptDAO.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.Transcript; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class TranscriptDAO extends BaseSQLDAO { + + protected TranscriptDAO() { + super(Transcript.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java new file mode 100644 index 000000000..f4a98997e --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -0,0 +1,146 @@ +package org.alliancegenome.curation_api.jobs.executors; + +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.HashMap; +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.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; +import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; +import org.alliancegenome.curation_api.services.Gff3Service; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; +import org.apache.commons.lang3.ObjectUtils; + +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 Gff3Executor extends LoadFileExecutor { + + @Inject Gff3Service gff3Service; + + public void execLoad(BulkLoadFile bulkLoadFile) { + try { + + CsvSchema psiMiTabSchema = CsvSchemaBuilder.gff3Schema(); + CsvMapper csvMapper = new CsvMapper(); + MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFile.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() - 1).clear(); + + + BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); + + Map> idsAdded = new HashMap>(); + + // TODO: get ids of previously loaded entities + + BulkLoadFileHistory history = new BulkLoadFileHistory(gffData.size()); + createHistory(history, bulkLoadFile); + runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider); + + // TODO: run cleanup + + history.finishLoad(); + finalSaveHistory(history); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, + Map> idsAdded, BackendBulkDataProvider dataProvider) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 2) + 1); + + GenomeAssembly assembly = loadGenomeAssembly(history, gffHeaderData, dataProvider, ph); + loadEntities(history, gffData, idsAdded, dataProvider, ph); + if (ObjectUtils.isNotEmpty(assembly)) { + loadAssociations(history, gffData, idsAdded, dataProvider, assembly, ph); + } + } + + private GenomeAssembly loadGenomeAssembly(BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + GenomeAssembly assembly = null; + try { + assembly = gff3Service.loadGenomeAssembly(gffHeaderData, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + return assembly; + } + + private void loadEntities(BulkLoadFileHistory history, List gffData, Map> idsAdded, + BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + for (Gff3DTO gff3Entry : gffData) { + try { + idsAdded = gff3Service.loadEntities(history, gff3Entry, idsAdded, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3Entry, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + } + } + + private void loadAssociations(BulkLoadFileHistory history, List gffData, Map> idsAdded, + BackendBulkDataProvider dataProvider, GenomeAssembly assembly, ProcessDisplayHelper ph) { + for (Gff3DTO gff3Entry : gffData) { + try { + idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assembly); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3Entry, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + history.incrementCompleted(); + } + } +} 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 87778e0a4..677f4579c 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 @@ -59,4 +59,24 @@ public static CsvSchema psiMiTabSchema() { return schema; } + + public static CsvSchema gff3Schema() { + CsvSchema schema = CsvSchema.builder() + .setColumnSeparator('\t') + .setArrayElementSeparator(";") + .setNullValue(".") + .disableQuoteChar() + .addColumn("seqId") + .addColumn("source") + .addColumn("type") + .addColumn("start") + .addColumn("end") + .addColumn("score") + .addColumn("strand") + .addColumn("phase") + .addColumn("attributes") + .build(); + + return schema; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java new file mode 100644 index 000000000..89edeeabf --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -0,0 +1,46 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +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.Indexed; +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; + +import jakarta.persistence.Entity; +import jakarta.persistence.ManyToOne; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "CodingSequence", description = "POJO that represents the CodingSequence (CDS)") +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +public class CodingSequence extends GenomicEntity { + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"curie", "name", "curie_keyword", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm cdsType; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java new file mode 100644 index 000000000..b1b583c87 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -0,0 +1,46 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +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.Indexed; +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; + +import jakarta.persistence.Entity; +import jakarta.persistence.ManyToOne; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "Exon", description = "POJO that represents the Exon") +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +public class Exon extends GenomicEntity { + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"curie", "name", "curie_keyword", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm exonType; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java new file mode 100644 index 000000000..944443cdf --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java @@ -0,0 +1,52 @@ +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.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; +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.ManyToOne; +import jakarta.persistence.OneToMany; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "GenomeAssembly", description = "POJO that represents a GenomeAssembly") +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { BiologicalEntity.class }) +public class GenomeAssembly extends BiologicalEntity { + + @IndexedEmbedded(includePaths = {"referencedCurie", "displayName", "resourceDescriptorPage.name", "referencedCurie_keyword", "displayName_keyword", "resourceDescriptorPage.name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) + @JoinTable(indexes = { + @Index(columnList = "genomeassembly_id, crossreferences_id", name = "genomeassembly_crossreference_genomeassembly_xref_index"), + @Index(columnList = "genomeassembly_id", name = "genomeassembly_crossreference_genomeassembly_index"), + @Index(columnList = "crossreferences_id", name = "genomeassembly_crossreference_crossreferences_index") + }) + @EqualsAndHashCode.Include + @JsonView({ View.FieldsAndLists.class }) + private List crossReferences; + + @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private AffectedGenomicModel specimenGenomicModel; + +} 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 new file mode 100644 index 000000000..01a850532 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Transcript.java @@ -0,0 +1,46 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +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.Indexed; +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; + +import jakarta.persistence.Entity; +import jakarta.persistence.ManyToOne; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "Transcript", description = "POJO that represents the Transcript") +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +public class Transcript extends GenomicEntity { + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"curie", "name", "curie_keyword", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm transcriptType; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/Gff3DTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/Gff3DTO.java new file mode 100644 index 000000000..c5dddaeca --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/Gff3DTO.java @@ -0,0 +1,24 @@ +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 Gff3DTO extends BaseDTO { + + private String seqId; + private String source; + private String type; + private Integer start; + private Integer end; + private Float score; + private String strand; + private Integer phase; + private List attributes; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java new file mode 100644 index 000000000..7eea708d8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java @@ -0,0 +1,44 @@ +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.ExonDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.apache.commons.lang.StringUtils; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class ExonService extends BaseEntityCrudService { + + @Inject ExonDAO exonDAO; + @Inject PersonService personService; + @Inject Gff3DtoValidator gff3DtoValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(exonDAO); + } + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); + } + List ids = exonDAO.findIdsByParams(params); + ids.removeIf(Objects::isNull); + return ids; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java new file mode 100644 index 000000000..128e96939 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -0,0 +1,91 @@ +package org.alliancegenome.curation_api.services; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.constants.Gff3Constants; +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.dao.GenomeAssemblyDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +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.SearchResponse; +import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; +import org.apache.commons.codec.binary.StringUtils; +import org.apache.commons.collections.CollectionUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@RequestScoped +public class Gff3Service { + + @Inject GenomeAssemblyDAO genomeAssemblyDAO; + @Inject DataProviderService dataProviderService; + @Inject NcbiTaxonTermService ncbiTaxonTermService; + + @Transactional + public GenomeAssembly loadGenomeAssembly(List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + + for (String header : gffHeaderData) { + if (header.startsWith("#!assembly")) { + String assemblyName = header.split(" ")[1]; + Map params = new HashMap<>(); + params.put("modEntityId", assemblyName); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); + params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); + + SearchResponse resp = genomeAssemblyDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + return resp.getSingleResult(); + } + + GenomeAssembly assembly = new GenomeAssembly(); + assembly.setModEntityId(assemblyName); + assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + + return genomeAssemblyDAO.persist(assembly); + } + } + throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); + } + + public Map> loadEntities(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + Map attributes = getAttributes(gffEntry); + if (StringUtils.equals(gffEntry.getType(), "exon")) { + + } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { + + } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { + gffEntry.setType("lncRNA"); + } + } + return idsAdded; + } + + public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { + // TODO: implement association loading + return idsAdded; + } + + private Map getAttributes (Gff3DTO gffEntry) { + Map attributes = new HashMap(); + if (CollectionUtils.isNotEmpty(gffEntry.getAttributes())) { + for (String keyValue : gffEntry.getAttributes()) { + String[] parts = keyValue.split("="); + if (parts.length == 2) { + attributes.put(parts[0], parts[1]); + } + } + } + return attributes; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java new file mode 100644 index 000000000..550765199 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -0,0 +1,88 @@ +package org.alliancegenome.curation_api.services.validation.dto; + +import java.util.HashMap; +import java.util.Map; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.dao.CodingSequenceDAO; +import org.alliancegenome.curation_api.dao.ExonDAO; +import org.alliancegenome.curation_api.dao.TranscriptDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.GenomicEntity; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; +import org.alliancegenome.curation_api.services.validation.dto.base.BaseDTOValidator; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@RequestScoped +public class Gff3DtoValidator extends BaseDTOValidator { + + @Inject ExonDAO exonDAO; + @Inject TranscriptDAO transcriptDAO; + @Inject CodingSequenceDAO codingSequenceDAO; + @Inject DataProviderService dataProviderService; + @Inject NcbiTaxonTermService ncbiTaxonTermService; + + private ObjectResponse exonResponse; + + @Transactional + public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + + exonResponse = new ObjectResponse<>(); + + Exon exon = new Exon(); + if (StringUtils.isNotBlank(dto.getSeqId())) { + SearchResponse exonResponse = exonDAO.findByField("modEntityId", dto.getSeqId()); + if (exonResponse != null && exonResponse.getSingleResult() != null) { + exon = exonResponse.getSingleResult(); + } + } + + ObjectResponse geResponse = validateGffEntry(exon, dto, dataProvider); + + + + return exonDAO.persist(exon); + } + + private ObjectResponse validateGffEntry(E entity, Gff3DTO dto, BackendBulkDataProvider dataProvider) { + ObjectResponse geResponse = new ObjectResponse(); + + if (StringUtils.isBlank(dto.getSeqId())) { + geResponse.addErrorMessage("seqId", ValidationConstants.REQUIRED_MESSAGE); + } + entity.setModEntityId(dto.getSeqId()); + + entity.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + entity.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + + + Map attributes = getAttributes(dto); + + return geResponse; + } + + private Map getAttributes (Gff3DTO dto) { + Map attributes = new HashMap(); + if (CollectionUtils.isNotEmpty(dto.getAttributes())) { + for (String keyValue : dto.getAttributes()) { + String[] parts = keyValue.split("="); + if (parts.length == 2) { + attributes.put(parts[0], parts[1]); + } + } + } + return attributes; + } + +} From 5fa2e7c2a742d4d629a3bba64349565d08b713da Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 2 Jul 2024 13:46:55 +0100 Subject: [PATCH 002/342] GFF entity loading --- .../cliapp/src/service/DataLoadService.js | 1 + .../crud/CodingSequenceCrudController.java | 47 +++++++ .../controllers/crud/ExonCrudController.java | 48 +++++++ .../crud/TranscriptCrudController.java | 47 +++++++ .../enums/BackendBulkLoadType.java | 1 + .../crud/CodingSequenceCrudInterface.java | 32 +++++ .../interfaces/crud/ExonCrudInterface.java | 32 +++++ .../crud/TranscriptCrudInterface.java | 33 +++++ .../jobs/executors/Gff3Executor.java | 82 +++++++++--- .../bridges/BiologicalEntityTypeBridge.java | 15 +++ .../model/entities/CodingSequence.java | 9 +- .../curation_api/model/entities/Exon.java | 9 +- .../model/entities/GenomeAssembly.java | 2 +- .../model/entities/Transcript.java | 2 - .../services/CodingSequenceService.java | 54 ++++++++ .../curation_api/services/ExonService.java | 11 +- .../curation_api/services/Gff3Service.java | 79 ++++++----- .../services/TranscriptService.java | 61 +++++++++ .../helpers/UniqueIdGeneratorHelper.java | 6 + .../helpers/gff3/Gff3UniqueIdHelper.java | 46 +++++++ .../validation/dto/Gff3DtoValidator.java | 126 +++++++++++++++--- .../v0.35.0.9__gff_entity_tables.sql | 101 ++++++++++++++ .../curation_api/AlleleITCase.java | 2 +- .../curation_api/GeneITCase.java | 6 +- .../curation_api/Gff3BulkUploadFmsITCase.java | 107 +++++++++++++++ .../curation_api/base/BaseITCase.java | 64 +++++++-- .../fms/08_gff_data/GFF01_transcript.json | 14 ++ .../bulk/fms/08_gff_data/GFF02_exon.json | 14 ++ .../bulk/fms/08_gff_data/GFF03_CDS.json | 14 ++ 29 files changed, 968 insertions(+), 97 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/CodingSequenceCrudInterface.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExonCrudInterface.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java create mode 100644 src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql create mode 100644 src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java create mode 100644 src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index a77432c81..90612fe46 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -80,6 +80,7 @@ export class DataLoadService extends BaseAuthService { getBackendBulkLoadTypes(loadType) { const bulkLoadTypes = { BulkFMSLoad: [ + 'GFF', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java new file mode 100644 index 000000000..5585ab971 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java @@ -0,0 +1,47 @@ +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.CodingSequenceDAO; +import org.alliancegenome.curation_api.interfaces.crud.CodingSequenceCrudInterface; +import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.CodingSequenceService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class CodingSequenceCrudController extends BaseEntityCrudController implements CodingSequenceCrudInterface { + + @Inject + CodingSequenceService codingSequenceService; + @Inject + Gff3Executor gff3Executor; + + @Override + @PostConstruct + protected void init() { + setService(codingSequenceService); + } + + public APIResponse updateCodingSequences(String dataProvider, String assembly, List gffData) { + return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return codingSequenceService.getByIdentifier(identifierString); + } + + @Override + public ObjectResponse deleteByIdentifier(String identifierString) { + return codingSequenceService.deleteByIdentifier(identifierString); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java new file mode 100644 index 000000000..bf4c105dd --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java @@ -0,0 +1,48 @@ +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.ExonDAO; +import org.alliancegenome.curation_api.interfaces.crud.ExonCrudInterface; +import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.ExonService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class ExonCrudController extends BaseEntityCrudController implements ExonCrudInterface { + + @Inject + ExonService exonService; + @Inject + Gff3Executor gff3Executor; + + @Override + @PostConstruct + protected void init() { + setService(exonService); + } + + @Override + public APIResponse updateExons(String dataProvider, String assembly, List gffData) { + return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return exonService.getByIdentifier(identifierString); + } + + @Override + public ObjectResponse deleteByIdentifier(String identifierString) { + return exonService.deleteByIdentifier(identifierString); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java new file mode 100644 index 000000000..a2b5e6c2a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -0,0 +1,47 @@ +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.TranscriptDAO; +import org.alliancegenome.curation_api.interfaces.crud.TranscriptCrudInterface; +import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.TranscriptService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class TranscriptCrudController extends BaseEntityCrudController implements TranscriptCrudInterface { + + @Inject + TranscriptService transcriptService; + @Inject + Gff3Executor gff3Executor; + + @Override + @PostConstruct + protected void init() { + setService(transcriptService); + } + + public APIResponse updateTranscripts(String dataProvider, String assembly, List gffData) { + return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return transcriptService.getByIdentifier(identifierString); + } + + @Override + public ObjectResponse deleteByIdentifier(String identifierString) { + return transcriptService.deleteByIdentifier(identifierString); + } + +} 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 1569bc30d..9172530be 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -18,6 +18,7 @@ public enum BackendBulkLoadType { ALLELE_ASSOCIATION("json"), CONSTRUCT_ASSOCIATION("json"), VARIANT("json"), + GFF("gff"), INTERACTION_MOL("tsv"), INTERACTION_GEN("tsv"), PARALOGY("json"), diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/CodingSequenceCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/CodingSequenceCrudInterface.java new file mode 100644 index 000000000..fff9b2b44 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/CodingSequenceCrudInterface.java @@ -0,0 +1,32 @@ +package org.alliancegenome.curation_api.interfaces.crud; + +import java.util.List; + +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +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("/cds") +@Tag(name = "CRUD - Coding Sequence") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface CodingSequenceCrudInterface extends BaseSubmittedObjectCrudInterface { + + @POST + @Path("/bulk/{dataProvider}_{assemblyName}/codingSequences") + @JsonView(View.FieldsAndLists.class) + APIResponse updateCodingSequences(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List gff3Data); + +} diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExonCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExonCrudInterface.java new file mode 100644 index 000000000..bee4338c1 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExonCrudInterface.java @@ -0,0 +1,32 @@ +package org.alliancegenome.curation_api.interfaces.crud; + +import java.util.List; + +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.model.entities.Exon; +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("/exon") +@Tag(name = "CRUD - Exon") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface ExonCrudInterface extends BaseSubmittedObjectCrudInterface { + + @POST + @Path("/bulk/{dataProvider}_{assemblyName}/exons") + @JsonView(View.FieldsAndLists.class) + APIResponse updateExons(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List gff3Data); + +} diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java new file mode 100644 index 000000000..ac1b81a3a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java @@ -0,0 +1,33 @@ +package org.alliancegenome.curation_api.interfaces.crud; + +import java.util.List; + +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.interfaces.base.crud.BaseReadIdentifierControllerInterface; +import org.alliancegenome.curation_api.model.entities.Transcript; +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("/transcript") +@Tag(name = "CRUD - Transcript") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface TranscriptCrudInterface extends BaseSubmittedObjectCrudInterface { + + @POST + @Path("/bulk/{dataProvider}_{assemblyName}/transcripts") + @JsonView(View.FieldsAndLists.class) + APIResponse updateTranscripts(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List gff3Data); + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index f4a98997e..06db63852 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -10,14 +10,22 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; +import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.LoadHistoryResponce; +import org.alliancegenome.curation_api.services.CodingSequenceService; +import org.alliancegenome.curation_api.services.ExonService; import org.alliancegenome.curation_api.services.Gff3Service; +import org.alliancegenome.curation_api.services.TranscriptService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.ObjectUtils; @@ -33,6 +41,9 @@ public class Gff3Executor extends LoadFileExecutor { @Inject Gff3Service gff3Service; + @Inject ExonService exonService; + @Inject CodingSequenceService cdsService; + @Inject TranscriptService transcriptService; public void execLoad(BulkLoadFile bulkLoadFile) { try { @@ -56,14 +67,18 @@ public void execLoad(BulkLoadFile bulkLoadFile) { BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); Map> idsAdded = new HashMap>(); + idsAdded.put("Transcript", new ArrayList()); + idsAdded.put("Exon", new ArrayList()); + idsAdded.put("CodingSequence", new ArrayList()); - // TODO: get ids of previously loaded entities + Map> previousIds = getPreviouslyLoadedIds(dataProvider); BulkLoadFileHistory history = new BulkLoadFileHistory(gffData.size()); createHistory(history, bulkLoadFile); - runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider); - - // TODO: run cleanup + idsAdded = runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider); + runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); + runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); + runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); history.finishLoad(); finalSaveHistory(history); @@ -72,25 +87,55 @@ public void execLoad(BulkLoadFile bulkLoadFile) { e.printStackTrace(); } } - - private void runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, + + private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { + Map> previousIds = new HashMap<>(); + + previousIds.put("Transcript", transcriptService.getIdsByDataProvider(dataProvider)); + previousIds.put("Exon", exonService.getIdsByDataProvider(dataProvider)); + previousIds.put("CodingSequence", cdsService.getIdsByDataProvider(dataProvider)); + + return previousIds; + } + + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, Map> idsAdded, BackendBulkDataProvider dataProvider) { + return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); + } + + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, + Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyName) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 2) + 1); - GenomeAssembly assembly = loadGenomeAssembly(history, gffHeaderData, dataProvider, ph); - loadEntities(history, gffData, idsAdded, dataProvider, ph); + GenomeAssembly assembly = loadGenomeAssembly(assemblyName, history, gffHeaderData, dataProvider, ph); + idsAdded = loadEntities(history, gffData, idsAdded, dataProvider, ph); if (ObjectUtils.isNotEmpty(assembly)) { - loadAssociations(history, gffData, idsAdded, dataProvider, assembly, ph); + idsAdded = loadAssociations(history, gffData, idsAdded, dataProvider, assembly, ph); } + + return idsAdded; } - - private GenomeAssembly loadGenomeAssembly(BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + Map> idsAdded = new HashMap>(); + idsAdded.put("Transcript", new ArrayList()); + idsAdded.put("Exon", new ArrayList()); + idsAdded.put("CodingSequence", new ArrayList()); + BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + runLoad(history, null, gffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private GenomeAssembly loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { GenomeAssembly assembly = null; try { - assembly = gff3Service.loadGenomeAssembly(gffHeaderData, dataProvider); + assembly = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -105,11 +150,11 @@ private GenomeAssembly loadGenomeAssembly(BulkLoadFileHistory history, List gffData, Map> idsAdded, + private Map> loadEntities(BulkLoadFileHistory history, List gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { for (Gff3DTO gff3Entry : gffData) { try { - idsAdded = gff3Service.loadEntities(history, gff3Entry, idsAdded, dataProvider); + idsAdded = gff3Service.loadEntity(history, gff3Entry, idsAdded, dataProvider); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -122,13 +167,15 @@ private void loadEntities(BulkLoadFileHistory history, List gffData, Ma updateHistory(history); ph.progressProcess(); } + + return idsAdded; } - private void loadAssociations(BulkLoadFileHistory history, List gffData, Map> idsAdded, + private Map> loadAssociations(BulkLoadFileHistory history, List gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly, ProcessDisplayHelper ph) { for (Gff3DTO gff3Entry : gffData) { try { - idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assembly); + idsAdded = gff3Service.loadAssociation(history, gff3Entry, idsAdded, dataProvider, assembly); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -140,7 +187,8 @@ private void loadAssociations(BulkLoadFileHistory history, List gffData } updateHistory(history); ph.progressProcess(); - history.incrementCompleted(); } + + return idsAdded; } } diff --git a/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java b/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java index a0a7d0d9a..efa253b36 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java +++ b/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java @@ -3,8 +3,11 @@ import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.BiologicalEntity; +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.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.Transcript; import org.hibernate.search.engine.backend.document.DocumentElement; import org.hibernate.search.engine.backend.document.IndexFieldReference; import org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement; @@ -78,6 +81,18 @@ public void write(DocumentElement target, BiologicalEntity bridgedElement, TypeB SequenceTargetingReagent sqtr = (SequenceTargetingReagent) bridgedElement; name = sqtr.getName(); symbol = null; + } else if (bridgedElement instanceof Transcript) { + Transcript transcript = (Transcript) bridgedElement; + name = transcript.getName(); + symbol = null; + } else if (bridgedElement instanceof Exon) { + Exon exon = (Exon) bridgedElement; + name = exon.getName(); + symbol = null; + } else if (bridgedElement instanceof CodingSequence) { + CodingSequence cds = (CodingSequence) bridgedElement; + name = cds.getName(); + symbol = null; } else { name = null; symbol = null; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java index 89edeeabf..efde35219 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -18,7 +18,9 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -30,10 +32,15 @@ @ToString(callSuper = true) @Schema(name = "CodingSequence", description = "POJO that represents the CodingSequence (CDS)") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +@Table(indexes = {@Index(name = "codingsequence_uniqueid_index", columnList = "uniqueid")}) public class CodingSequence extends GenomicEntity { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @KeywordField(name = "uniqueId_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @EqualsAndHashCode.Include + protected String uniqueId; + @JsonView({ View.FieldsOnly.class }) private String name; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java index b1b583c87..b3120d196 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -18,7 +18,9 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -30,10 +32,15 @@ @ToString(callSuper = true) @Schema(name = "Exon", description = "POJO that represents the Exon") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +@Table(indexes = {@Index(name = "exon_uniqueid_index", columnList = "uniqueid")}) public class Exon extends GenomicEntity { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @KeywordField(name = "uniqueId_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @EqualsAndHashCode.Include + protected String uniqueId; + @JsonView({ View.FieldsOnly.class }) private String name; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java index 944443cdf..715057abb 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java @@ -37,7 +37,7 @@ public class GenomeAssembly extends BiologicalEntity { @JoinTable(indexes = { @Index(columnList = "genomeassembly_id, crossreferences_id", name = "genomeassembly_crossreference_genomeassembly_xref_index"), @Index(columnList = "genomeassembly_id", name = "genomeassembly_crossreference_genomeassembly_index"), - @Index(columnList = "crossreferences_id", name = "genomeassembly_crossreference_crossreferences_index") + @Index(columnList = "crossreferences_id", name = "genomeassembly_crossreference_crossreference_index") }) @EqualsAndHashCode.Include @JsonView({ View.FieldsAndLists.class }) 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 01a850532..8dc40e0d3 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 @@ -32,8 +32,6 @@ @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) public class Transcript extends GenomicEntity { - @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) private String name; diff --git a/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java new file mode 100644 index 000000000..879737409 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java @@ -0,0 +1,54 @@ +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.CodingSequenceDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.apache.commons.lang.StringUtils; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class CodingSequenceService extends BaseEntityCrudService { + + @Inject CodingSequenceDAO codingSequenceDAO; + @Inject PersonService personService; + @Inject Gff3DtoValidator gff3DtoValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(codingSequenceDAO); + } + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); + } + List ids = codingSequenceDAO.findIdsByParams(params); + ids.removeIf(Objects::isNull); + return ids; + } + + public ObjectResponse deleteByIdentifier(String identifierString) { + CodingSequence codingSequence = findByAlternativeFields(List.of("modEntityId", "modInternalId", "uniqueId"), identifierString); + if (codingSequence != null) { + codingSequenceDAO.remove(codingSequence.getId()); + } + ObjectResponse ret = new ObjectResponse<>(codingSequence); + return ret; + } + +} 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 7eea708d8..f65601743 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java @@ -9,8 +9,8 @@ import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; -import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; import org.apache.commons.lang.StringUtils; import jakarta.annotation.PostConstruct; @@ -22,7 +22,6 @@ public class ExonService extends BaseEntityCrudService { @Inject ExonDAO exonDAO; @Inject PersonService personService; - @Inject Gff3DtoValidator gff3DtoValidator; @Override @PostConstruct @@ -41,4 +40,12 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { return ids; } + public ObjectResponse deleteByIdentifier(String identifierString) { + Exon exon = findByAlternativeFields(List.of("modEntityId", "modInternalId", "uniqueId"), identifierString); + if (exon != null) { + exonDAO.remove(exon.getId()); + } + ObjectResponse ret = new ObjectResponse<>(exon); + return ret; + } } 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 128e96939..239018516 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.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.model.entities.Transcript; 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.SearchResponse; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; -import org.apache.commons.codec.binary.StringUtils; -import org.apache.commons.collections.CollectionUtils; +import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -29,63 +32,65 @@ public class Gff3Service { @Inject GenomeAssemblyDAO genomeAssemblyDAO; @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; + @Inject Gff3DtoValidator gff3DtoValidator; @Transactional - public GenomeAssembly loadGenomeAssembly(List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public GenomeAssembly loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - for (String header : gffHeaderData) { - if (header.startsWith("#!assembly")) { - String assemblyName = header.split(" ")[1]; - Map params = new HashMap<>(); - params.put("modEntityId", assemblyName); - params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); - params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); - - SearchResponse resp = genomeAssemblyDAO.findByParams(params); - if (resp != null && resp.getSingleResult() != null) { - return resp.getSingleResult(); + if (StringUtils.isBlank(assemblyName)) { + for (String header : gffHeaderData) { + if (header.startsWith("#!assembly")) { + assemblyName = header.split(" ")[1]; } + } + } + if (StringUtils.isNotBlank(assemblyName)) { + Map params = new HashMap<>(); + params.put("modEntityId", assemblyName); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); + params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); + + SearchResponse resp = genomeAssemblyDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + return resp.getSingleResult(); + } - GenomeAssembly assembly = new GenomeAssembly(); - assembly.setModEntityId(assemblyName); - assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); - assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + GenomeAssembly assembly = new GenomeAssembly(); + assembly.setModEntityId(assemblyName); + assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); - return genomeAssemblyDAO.persist(assembly); - } + return genomeAssemblyDAO.persist(assembly); } throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); } - public Map> loadEntities(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - Map attributes = getAttributes(gffEntry); + public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { if (StringUtils.equals(gffEntry.getType(), "exon")) { - + Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, dataProvider); + if (exon != null) { + idsAdded.get("Exon").add(exon.getId()); + } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { - + CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, dataProvider); + if (cds != null) { + idsAdded.get("CodingSequence").add(cds.getId()); + } } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); } + Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, dataProvider); + if (transcript != null) { + idsAdded.get("Transcript").add(transcript.getId()); + } } return idsAdded; } - public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { + public Map> loadAssociation(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { // TODO: implement association loading return idsAdded; } - private Map getAttributes (Gff3DTO gffEntry) { - Map attributes = new HashMap(); - if (CollectionUtils.isNotEmpty(gffEntry.getAttributes())) { - for (String keyValue : gffEntry.getAttributes()) { - String[] parts = keyValue.split("="); - if (parts.length == 2) { - attributes.put(parts[0], parts[1]); - } - } - } - return attributes; - } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java b/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java new file mode 100644 index 000000000..9cf7b422b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java @@ -0,0 +1,61 @@ +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.TranscriptDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.apache.commons.lang.StringUtils; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class TranscriptService extends BaseEntityCrudService { + + @Inject TranscriptDAO transcriptDAO; + @Inject PersonService personService; + @Inject Gff3DtoValidator gff3DtoValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(transcriptDAO); + } + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); + } + List ids = transcriptDAO.findIdsByParams(params); + ids.removeIf(Objects::isNull); + return ids; + } + + @Override + public ObjectResponse getByIdentifier(String identifier) { + Transcript object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId"), identifier); + ObjectResponse ret = new ObjectResponse(object); + return ret; + } + + public ObjectResponse deleteByIdentifier(String identifierString) { + Transcript transcript = findByAlternativeFields(List.of("modEntityId", "modInternalId"), identifierString); + if (transcript != null) { + transcriptDAO.remove(transcript.getId()); + } + ObjectResponse ret = new ObjectResponse<>(transcript); + return ret; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdGeneratorHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdGeneratorHelper.java index 750ea1cc1..e560038b0 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdGeneratorHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdGeneratorHelper.java @@ -26,6 +26,12 @@ public boolean add(String s) { } return false; } + + public void add(Integer i) { + if (i != null) { + add(Integer.toString(i)); + } + } public void addList(List list) { if (CollectionUtils.isNotEmpty(list)) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java new file mode 100644 index 000000000..bd250dcc0 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java @@ -0,0 +1,46 @@ +package org.alliancegenome.curation_api.services.helpers.gff3; + +import java.util.Map; + +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.services.helpers.UniqueIdGeneratorHelper; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; + +@RequestScoped +public class Gff3UniqueIdHelper { + + public static String getExonOrCodingSequenceUniqueId(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { + UniqueIdGeneratorHelper uniqueId = new UniqueIdGeneratorHelper(); + + if (attributes.containsKey("ID")) { + uniqueId.add(removeWormBasePrefix(attributes.get("ID"), dataProvider)); + } else if (attributes.containsKey("Name")) { + uniqueId.add(attributes.get("Name")); + } + + if (attributes.containsKey("Parent")) { + uniqueId.add(removeWormBasePrefix(attributes.get("Parent"), dataProvider)); + } + + uniqueId.add(dto.getSeqId()); + uniqueId.add(dto.getStart()); + uniqueId.add(dto.getEnd()); + uniqueId.add(dto.getStrand()); + + return uniqueId.getUniqueId(); + } + + private static String removeWormBasePrefix(String id, BackendBulkDataProvider dataProvider) { + if (StringUtils.equals("WB", dataProvider.sourceOrganization)) { + String[] idParts = id.split(":"); + if (idParts.length > 1) { + id = idParts[1]; + } + } + return id; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 550765199..dd68f8cc3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -7,16 +7,20 @@ import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.dao.TranscriptDAO; +import org.alliancegenome.curation_api.dao.ontology.SoTermDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.GenomicEntity; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; -import org.alliancegenome.curation_api.services.validation.dto.base.BaseDTOValidator; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -25,49 +29,133 @@ import jakarta.transaction.Transactional; @RequestScoped -public class Gff3DtoValidator extends BaseDTOValidator { +public class Gff3DtoValidator { @Inject ExonDAO exonDAO; @Inject TranscriptDAO transcriptDAO; @Inject CodingSequenceDAO codingSequenceDAO; @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; + @Inject SoTermDAO soTermDAO; - private ObjectResponse exonResponse; - @Transactional public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { - exonResponse = new ObjectResponse<>(); + Exon exon = null; + + Map attributes = getAttributes(dto); + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); + SearchResponse searchResponse = exonDAO.findByField("uniqueId", uniqueId); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + exon = searchResponse.getSingleResult(); + } else { + exon = new Exon(); + exon.setUniqueId(uniqueId); + } + + if (attributes.containsKey("Name")) { + exon.setName(attributes.get("Name")); + } + + ObjectResponse exonResponse = validateGffEntity(exon, dto, attributes, dataProvider); + + if (exonResponse.hasErrors()) { + throw new ObjectValidationException(dto, exonResponse.errorMessagesString()); + } + + return exonDAO.persist(exonResponse.getEntity()); + } + + @Transactional + public CodingSequence validateCdsEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { - Exon exon = new Exon(); - if (StringUtils.isNotBlank(dto.getSeqId())) { - SearchResponse exonResponse = exonDAO.findByField("modEntityId", dto.getSeqId()); - if (exonResponse != null && exonResponse.getSingleResult() != null) { - exon = exonResponse.getSingleResult(); - } + CodingSequence cds = null; + + Map attributes = getAttributes(dto); + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); + SearchResponse searchResponse = codingSequenceDAO.findByField("uniqueId", uniqueId); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + cds = searchResponse.getSingleResult(); + } else { + cds = new CodingSequence(); + cds.setUniqueId(uniqueId); + } + + if (attributes.containsKey("Name")) { + cds.setName(attributes.get("Name")); } - ObjectResponse geResponse = validateGffEntry(exon, dto, dataProvider); + ObjectResponse cdsResponse = validateGffEntity(cds, dto, attributes, dataProvider); + + if (cdsResponse.hasErrors()) { + throw new ObjectValidationException(dto, cdsResponse.errorMessagesString()); + } + return codingSequenceDAO.persist(cdsResponse.getEntity()); + } + + @Transactional + public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + Transcript transcript = null; + + Map attributes = getAttributes(dto); + if (attributes.containsKey("ID")) { + SearchResponse searchResponse = transcriptDAO.findByField("modInternalId", attributes.get("ID")); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + transcript = searchResponse.getSingleResult(); + } else { + transcript = new Transcript(); + } + } + + SearchResponse soResponse = soTermDAO.findByField("name", dto.getType()); + if (soResponse != null) { + transcript.setTranscriptType(soResponse.getSingleResult()); + } + + if (attributes.containsKey("Name")) { + transcript.setName(attributes.get("Name")); + } - return exonDAO.persist(exon); + ObjectResponse transcriptResponse = validateGffEntity(transcript, dto, attributes, dataProvider); + if (!attributes.containsKey("ID")) { + transcriptResponse.addErrorMessage("attributes - ID", ValidationConstants.REQUIRED_MESSAGE); + } + + if (transcriptResponse.hasErrors()) { + throw new ObjectValidationException(dto, transcriptResponse.errorMessagesString()); + } + + return transcriptDAO.persist(transcriptResponse.getEntity()); } - private ObjectResponse validateGffEntry(E entity, Gff3DTO dto, BackendBulkDataProvider dataProvider) { + private ObjectResponse validateGffEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { ObjectResponse geResponse = new ObjectResponse(); - if (StringUtils.isBlank(dto.getSeqId())) { - geResponse.addErrorMessage("seqId", ValidationConstants.REQUIRED_MESSAGE); + if (attributes.containsKey("ID")) { + String id = attributes.get("ID"); + if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { + String[] idParts = id.split(":"); + if (idParts.length > 1) { + id = idParts[1]; + } + } + entity.setModInternalId(id); + } else if (attributes.containsKey("exon_id")) { + entity.setModInternalId(attributes.get("exon_id")); + } else if (attributes.containsKey("transcript_id")) { + entity.setModInternalId(attributes.get("transcript_id")); + } + + if (attributes.containsKey("curie")) { + entity.setModEntityId(attributes.get("curie")); } - entity.setModEntityId(dto.getSeqId()); entity.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); entity.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); - - Map attributes = getAttributes(dto); + geResponse.setEntity(entity); return geResponse; } diff --git a/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql b/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql new file mode 100644 index 000000000..84aad7534 --- /dev/null +++ b/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql @@ -0,0 +1,101 @@ +CREATE TABLE transcript ( + id bigint NOT NULL, + transcripttype_id bigint, + name varchar(255) +); +ALTER TABLE transcript ADD CONSTRAINT transcript_pkey PRIMARY KEY (id); +ALTER TABLE transcript + ADD CONSTRAINT transcript_id_fk FOREIGN KEY (id) REFERENCES genomicentity(id); +ALTER TABLE transcript + ADD CONSTRAINT transcript_transcripttype_id_fk FOREIGN KEY (transcripttype_id) REFERENCES ontologyterm(id); + +CREATE TABLE exon ( + id bigint NOT NULL, + exontype_id bigint, + name varchar(255), + uniqueid varchar(255) +); +ALTER TABLE exon ADD CONSTRAINT exon_pkey PRIMARY KEY (id); +ALTER TABLE exon + ADD CONSTRAINT exon_id_fk FOREIGN KEY (id) REFERENCES genomicentity(id); +ALTER TABLE exon + ADD CONSTRAINT exon_exontype_id_fk FOREIGN KEY (exontype_id) REFERENCES ontologyterm(id); +CREATE INDEX exon_uniqueid_index ON exon USING btree (uniqueid); + +CREATE TABLE codingsequence ( + id bigint NOT NULL, + cdstype_id bigint, + name varchar(255), + uniqueid varchar(255) +); +ALTER TABLE codingsequence ADD CONSTRAINT codingsequence_pkey PRIMARY KEY (id); +ALTER TABLE codingsequence + ADD CONSTRAINT codingsequence_id_fk FOREIGN KEY (id) REFERENCES genomicentity(id); +ALTER TABLE codingsequence + ADD CONSTRAINT codingsequence_cdstype_id_fk FOREIGN KEY (cdstype_id) REFERENCES ontologyterm(id); +CREATE INDEX codingsequence_uniqueid_index ON codingsequence USING btree (uniqueid); + +CREATE TABLE genomeassembly ( + id bigint NOT NULL, + specimengenomicmodel_id bigint +); +ALTER TABLE genomeassembly ADD CONSTRAINT genomeassembly_pkey PRIMARY KEY (id); +ALTER TABLE genomeassembly + ADD CONSTRAINT genomeassembly_id_fk FOREIGN KEY (id) REFERENCES biologicalentity(id); +ALTER TABLE genomeassembly + ADD CONSTRAINT genomeassembly_specimengenomicmodel_id_fk FOREIGN KEY (specimengenomicmodel_id) REFERENCES affectedgenomicmodel(id); + +CREATE TABLE genomeassembly_crossreference ( + genomeassembly_id bigint NOT NULL, + crossreferences_id bigint NOT NULL +); +ALTER TABLE genomeassembly_crossreference + ADD CONSTRAINT genomeassembly_crossreference_genomeassembly_id_fk FOREIGN KEY (genomeassembly_id) REFERENCES genomeassembly(id); +ALTER TABLE genomeassembly_crossreference + ADD CONSTRAINT genomeassembly_crossreference_crossreferences_id_fk FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); +CREATE INDEX genomeassembly_crossreference_genomeassembly_xref_index ON genomeassembly_crossreference USING btree(genomeassembly_id, crossreferences_id); +CREATE INDEX genomeassembly_crossreference_genomeassembly_index ON genomeassembly_crossreference USING btree(genomeassembly_id); +CREATE INDEX genomeassembly_crossreference_crossreference_index ON genomeassembly_crossreference USING btree(crossreferences_id); + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'GFF Loads'); + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'FB GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'Human GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'MGI GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'RGD GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'WGD GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'WB GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'XBXL GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'XBXT GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'ZFIN GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) + SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'GFF'; + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'FB' FROM bulkload WHERE name = 'FB GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'HUMAN' FROM bulkload WHERE name = 'HUMAN GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'MGI' FROM bulkload WHERE name = 'MGI GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'RGD' FROM bulkload WHERE name = 'RGD GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'SGD' FROM bulkload WHERE name = 'SGD GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'WB' FROM bulkload WHERE name = 'WB GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'XBXL' FROM bulkload WHERE name = 'XBXL GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'XBXT' FROM bulkload WHERE name = 'XBXT GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name = 'ZFIN GFF Load'; \ No newline at end of file diff --git a/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java b/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java index 79c7b126f..0eefb703a 100644 --- a/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java @@ -182,7 +182,7 @@ private void loadRequiredEntities() { datetime2 = OffsetDateTime.parse("2022-04-10T22:10:11+00:00"); soTerm = getSoTerm("SO:00001"); soTerm2 = getSoTerm("SO:00002"); - obsoleteSoTerm = createSoTerm("SO:00000", true); + obsoleteSoTerm = createSoTerm("SO:00000", "obsoleteTest", true); mpTerm = getMpTerm("MP:00001"); mpTerm2 = getMpTerm("MP:00002"); obsoleteMpTerm = createMpTerm("MP:00000", true); diff --git a/src/test/java/org/alliancegenome/curation_api/GeneITCase.java b/src/test/java/org/alliancegenome/curation_api/GeneITCase.java index f13fabd51..dbda64419 100644 --- a/src/test/java/org/alliancegenome/curation_api/GeneITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/GeneITCase.java @@ -84,9 +84,9 @@ public class GeneITCase extends BaseITCase { private void loadRequiredEntities() { - soTerm = createSoTerm("SO:0001", false); - soTerm2 = createSoTerm("SO:0002", false); - obsoleteSoTerm = createSoTerm("SO:0000", true); + soTerm = createSoTerm("SO:0001", "test1", false); + soTerm2 = createSoTerm("SO:0002", "test2", false); + obsoleteSoTerm = createSoTerm("SO:0000", "testObsolete", true); nameType = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); synonymScope = getVocabulary(VocabularyConstants.SYNONYM_SCOPE_VOCABULARY); symbolNameType = getVocabularyTerm(nameType, "nomenclature_symbol"); diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java new file mode 100644 index 000000000..0e543e776 --- /dev/null +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java @@ -0,0 +1,107 @@ +package org.alliancegenome.curation_api; + +import static org.hamcrest.Matchers.is; + +import org.alliancegenome.curation_api.base.BaseITCase; +import org.alliancegenome.curation_api.resources.TestContainerResource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.config.HttpClientConfig; +import io.restassured.config.RestAssuredConfig; + +@QuarkusIntegrationTest +@QuarkusTestResource(TestContainerResource.Initializer.class) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@DisplayName("608 - GFF data bulk upload - FMS") +@Order(608) +public class Gff3BulkUploadFmsITCase extends BaseITCase { + + @BeforeEach + public void init() { + RestAssured.config = RestAssuredConfig.config() + .httpClient(HttpClientConfig.httpClientConfig() + .setParam("http.socket.timeout", 100000) + .setParam("http.connection.timeout", 100000)); + } + + private final String transcriptBulkPostEndpoint = "/api/transcript/bulk/WB_WBcel235/transcripts"; + private final String exonBulkPostEndpoint = "/api/exon/bulk/WB_WBcel235/exons"; + private final String cdsBulkPostEndpoint = "/api/cds/bulk/WB_WBcel235/codingSequences"; + private final String gffDataTestFilePath = "src/test/resources/bulk/fms/08_gff_data/"; + private final String transcriptGetEndpoint = "/api/transcript/"; + private final String exonGetEndpoint = "/api/exon/"; + private final String cdsGetEndpoint = "/api/cds/"; + private final String transcriptId = "Y74C9A.2a.1"; + private final String exonId = "Y74C9A.2a_exon"; + private final String cdsId = "Y74C9A.2a"; + + private void loadRequiredEntities() throws Exception { + createSoTerm("SO:0000234", "mRNA", false); + createSoTerm("SO:0000147", "exon", false); + createSoTerm("SO:0000316", "CDS", false); + } + + @Test + @Order(1) + public void gff3DataBulkUploadTranscriptEntity() throws Exception { + loadRequiredEntities(); + + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF01_transcript.json", 3); + + RestAssured.given(). + when(). + get(transcriptGetEndpoint + transcriptId). + then(). + statusCode(200). + body("entity.modInternalId", is(transcriptId)). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). + body("entity.transcriptType.curie", is("SO:0000234")); + + } + + @Test + @Order(2) + public void gff3DataBulkUploadExonEntity() throws Exception { + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF02_exon.json", 3); + + RestAssured.given(). + when(). + get(exonGetEndpoint + exonId). + then(). + statusCode(200). + body("entity.modInternalId", is(exonId)). + body("entity.uniqueId", is("Y74C9A.2a_exon|Y74C9A.2a.1|I|1|100|+")). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")); + + } + + @Test + @Order(2) + public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF03_CDS.json", 3); + + RestAssured.given(). + when(). + get(cdsGetEndpoint + cdsId). + then(). + statusCode(200). + body("entity.modInternalId", is(cdsId)). + body("entity.uniqueId", is("Y74C9A.2a|Y74C9A.2a.1|I|10|100|+")). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")); + + } + +} diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index f6ea383bf..f03086b3b 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -1,13 +1,56 @@ package org.alliancegenome.curation_api.base; -import io.restassured.RestAssured; -import io.restassured.common.mapper.TypeRef; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.model.entities.*; +import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; +import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; +import org.alliancegenome.curation_api.model.entities.BiologicalEntity; +import org.alliancegenome.curation_api.model.entities.ConditionRelation; +import org.alliancegenome.curation_api.model.entities.Construct; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.DataProvider; +import org.alliancegenome.curation_api.model.entities.ExperimentalCondition; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.Note; +import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.model.entities.Person; +import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.Vocabulary; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.VocabularyTermSet; 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.ontology.*; +import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.CHEBITerm; +import org.alliancegenome.curation_api.model.entities.ontology.ChemicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ExperimentalConditionOntologyTerm; +import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.MITerm; +import org.alliancegenome.curation_api.model.entities.ontology.MPTerm; +import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; +import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.WBPhenotypeTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ZECOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ZFATerm; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.constructSlotAnnotations.ConstructSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSymbolSlotAnnotation; @@ -16,14 +59,8 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.apache.commons.lang3.StringUtils; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - -import static io.restassured.RestAssured.given; -import static org.hamcrest.Matchers.is; +import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; public class BaseITCase { @@ -485,9 +522,10 @@ public ResourceDescriptorPage createResourceDescriptorPage(String name, String u return response.getEntity(); } - public SOTerm createSoTerm(String curie, Boolean obsolete) { + public SOTerm createSoTerm(String curie, String name, Boolean obsolete) { SOTerm term = new SOTerm(); term.setCurie(curie); + term.setName(name); term.setObsolete(obsolete); term.setSecondaryIdentifiers(List.of(curie + "secondary")); diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json b/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json new file mode 100644 index 000000000..bd1d4ecfc --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json b/src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json new file mode 100644 index 000000000..06b8abf5c --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "exon", + "start": 1, + "end": 100, + "strand": "+", + "attributes": [ + "ID=Exon:Y74C9A.2a_exon", + "Parent=Transcript:Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json b/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json new file mode 100644 index 000000000..75fbd719f --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "CDS", + "start": 10, + "end": 100, + "strand": "+", + "attributes": [ + "ID=CDS:Y74C9A.2a", + "Parent=Transcript:Y74C9A.2a.1" + ] + } +] From 90efffbf1e1ff81b8e8f2af2e1cc803835bc23e2 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 09:13:29 +0100 Subject: [PATCH 003/342] Executor fixes --- .../curation_api/jobs/executors/BulkLoadJobExecutor.java | 3 +++ .../curation_api/jobs/executors/Gff3Executor.java | 4 ++-- .../resources/db/migration/v0.35.0.9__gff_entity_tables.sql | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) 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 64766dd12..2c1728e20 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 @@ -51,6 +51,7 @@ public class BulkLoadJobExecutor { @Inject ParalogyExecutor paralogyExecutor; @Inject GeneExpressionExecutor geneExpressionExecutor; @Inject SequenceTargetingReagentExecutor sqtrExecutor; + @Inject Gff3Executor gff3Executor; public void process(BulkLoadFile bulkLoadFile, Boolean cleanUp) throws Exception { @@ -114,6 +115,8 @@ public void process(BulkLoadFile bulkLoadFile, Boolean cleanUp) throws Exception resourceDescriptorExecutor.execLoad(bulkLoadFile); } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION) { geneExpressionExecutor.execLoad(bulkLoadFile); + } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF) { + gff3Executor.execLoad(bulkLoadFile); } else { log.info("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); throw new Exception("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 06db63852..f0a33a8e5 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -48,9 +48,9 @@ public class Gff3Executor extends LoadFileExecutor { public void execLoad(BulkLoadFile bulkLoadFile) { try { - CsvSchema psiMiTabSchema = CsvSchemaBuilder.gff3Schema(); + CsvSchema gff3Schema = CsvSchemaBuilder.gff3Schema(); CsvMapper csvMapper = new CsvMapper(); - MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath()))); + MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(Gff3DTO.class).with(gff3Schema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath()))); List gffData = it.readAll(); List gffHeaderData = new ArrayList<>(); for (Gff3DTO gffLine : gffData) { diff --git a/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql b/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql index 84aad7534..7347d43ec 100644 --- a/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql +++ b/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql @@ -57,6 +57,8 @@ CREATE INDEX genomeassembly_crossreference_genomeassembly_xref_index ON genomeas CREATE INDEX genomeassembly_crossreference_genomeassembly_index ON genomeassembly_crossreference USING btree(genomeassembly_id); CREATE INDEX genomeassembly_crossreference_crossreference_index ON genomeassembly_crossreference USING btree(crossreferences_id); + +/* INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'GFF Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) @@ -98,4 +100,5 @@ INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'XBXT' FROM bulkload WHERE name = 'XBXT GFF Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) - SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name = 'ZFIN GFF Load'; \ No newline at end of file + SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name = 'ZFIN GFF Load'; +*/ \ No newline at end of file From e6415fc2e1ee847c8e8d971f76d9f256c8b5a9f7 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 09:27:16 +0100 Subject: [PATCH 004/342] Bump migration version no. --- ...9__gff_entity_tables.sql => v0.35.0.10__gff_entity_tables.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.35.0.9__gff_entity_tables.sql => v0.35.0.10__gff_entity_tables.sql} (100%) diff --git a/src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql b/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.35.0.9__gff_entity_tables.sql rename to src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql From 1ad8669914888b2c587a7b7cbdea334d8fe3da0f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 11:33:48 +0100 Subject: [PATCH 005/342] Change ID handling --- .../jobs/executors/Gff3Executor.java | 2 +- .../helpers/gff3/Gff3UniqueIdHelper.java | 21 ++++------ .../validation/dto/Gff3DtoValidator.java | 39 ++++++++++--------- ...sITCase.java => Gff3BulkUploadITCase.java} | 16 ++++---- 4 files changed, 35 insertions(+), 43 deletions(-) rename src/test/java/org/alliancegenome/curation_api/{Gff3BulkUploadFmsITCase.java => Gff3BulkUploadITCase.java} (88%) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index f0a33a8e5..134eba67f 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -60,7 +60,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { break; } } - gffData.subList(0, gffHeaderData.size() - 1).clear(); + gffData.subList(0, gffHeaderData.size()).clear(); BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java index bd250dcc0..9a8b8f1f9 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3UniqueIdHelper.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.services.helpers.UniqueIdGeneratorHelper; -import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; @@ -15,14 +14,18 @@ public class Gff3UniqueIdHelper { public static String getExonOrCodingSequenceUniqueId(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { UniqueIdGeneratorHelper uniqueId = new UniqueIdGeneratorHelper(); - if (attributes.containsKey("ID")) { - uniqueId.add(removeWormBasePrefix(attributes.get("ID"), dataProvider)); + if (attributes.containsKey("curie")) { + uniqueId.add(attributes.get("curie")); + } else if (attributes.containsKey("ID")) { + uniqueId.add(attributes.get("ID")); } else if (attributes.containsKey("Name")) { uniqueId.add(attributes.get("Name")); + } else if (attributes.containsKey("exon_id")) { + uniqueId.add(attributes.get("exon_id")); } if (attributes.containsKey("Parent")) { - uniqueId.add(removeWormBasePrefix(attributes.get("Parent"), dataProvider)); + uniqueId.add(attributes.get("Parent")); } uniqueId.add(dto.getSeqId()); @@ -33,14 +36,4 @@ public static String getExonOrCodingSequenceUniqueId(Gff3DTO dto, Map 1) { - id = idParts[1]; - } - } - return id; - } - } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index dd68f8cc3..2dca95631 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -1,6 +1,7 @@ package org.alliancegenome.curation_api.services.validation.dto; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.alliancegenome.curation_api.constants.ValidationConstants; @@ -43,7 +44,7 @@ public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) Exon exon = null; - Map attributes = getAttributes(dto); + Map attributes = getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = exonDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -71,7 +72,7 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, BackendBulkDataProvider data CodingSequence cds = null; - Map attributes = getAttributes(dto); + Map attributes = getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = codingSequenceDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -99,13 +100,14 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider d Transcript transcript = null; - Map attributes = getAttributes(dto); + Map attributes = getAttributes(dto, dataProvider); if (attributes.containsKey("ID")) { SearchResponse searchResponse = transcriptDAO.findByField("modInternalId", attributes.get("ID")); if (searchResponse != null && searchResponse.getSingleResult() != null) { transcript = searchResponse.getSingleResult(); } else { transcript = new Transcript(); + transcript.setModInternalId(attributes.get("ID")); } } @@ -133,21 +135,6 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider d private ObjectResponse validateGffEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { ObjectResponse geResponse = new ObjectResponse(); - if (attributes.containsKey("ID")) { - String id = attributes.get("ID"); - if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { - String[] idParts = id.split(":"); - if (idParts.length > 1) { - id = idParts[1]; - } - } - entity.setModInternalId(id); - } else if (attributes.containsKey("exon_id")) { - entity.setModInternalId(attributes.get("exon_id")); - } else if (attributes.containsKey("transcript_id")) { - entity.setModInternalId(attributes.get("transcript_id")); - } - if (attributes.containsKey("curie")) { entity.setModEntityId(attributes.get("curie")); } @@ -160,7 +147,7 @@ private ObjectResponse validateGffEntity(E entity, return geResponse; } - private Map getAttributes (Gff3DTO dto) { + private Map getAttributes (Gff3DTO dto, BackendBulkDataProvider dataProvider) { Map attributes = new HashMap(); if (CollectionUtils.isNotEmpty(dto.getAttributes())) { for (String keyValue : dto.getAttributes()) { @@ -170,6 +157,20 @@ private Map getAttributes (Gff3DTO dto) { } } } + + if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { + for (String key : List.of("ID", "Parent")) { + if (attributes.containsKey(key)) { + String id = attributes.get(key); + String[] idParts = id.split(":"); + if (idParts.length > 1) { + id = idParts[1]; + } + attributes.put(key, id); + } + } + } + return attributes; } diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java similarity index 88% rename from src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java rename to src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 0e543e776..ec9e06414 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -24,7 +24,7 @@ @TestInstance(TestInstance.Lifecycle.PER_CLASS) @DisplayName("608 - GFF data bulk upload - FMS") @Order(608) -public class Gff3BulkUploadFmsITCase extends BaseITCase { +public class Gff3BulkUploadITCase extends BaseITCase { @BeforeEach public void init() { @@ -42,8 +42,8 @@ public void init() { private final String exonGetEndpoint = "/api/exon/"; private final String cdsGetEndpoint = "/api/cds/"; private final String transcriptId = "Y74C9A.2a.1"; - private final String exonId = "Y74C9A.2a_exon"; - private final String cdsId = "Y74C9A.2a"; + private final String exonUniqueId = "Y74C9A.2a_exon|Y74C9A.2a.1|I|1|100|+"; + private final String cdsUniqueId = "Y74C9A.2a|Y74C9A.2a.1|I|10|100|+"; private void loadRequiredEntities() throws Exception { createSoTerm("SO:0000234", "mRNA", false); @@ -77,11 +77,10 @@ public void gff3DataBulkUploadExonEntity() throws Exception { RestAssured.given(). when(). - get(exonGetEndpoint + exonId). + get(exonGetEndpoint + exonUniqueId). then(). statusCode(200). - body("entity.modInternalId", is(exonId)). - body("entity.uniqueId", is("Y74C9A.2a_exon|Y74C9A.2a.1|I|1|100|+")). + body("entity.uniqueId", is(exonUniqueId)). body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")); @@ -94,11 +93,10 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { RestAssured.given(). when(). - get(cdsGetEndpoint + cdsId). + get(cdsGetEndpoint + cdsUniqueId). then(). statusCode(200). - body("entity.modInternalId", is(cdsId)). - body("entity.uniqueId", is("Y74C9A.2a|Y74C9A.2a.1|I|10|100|+")). + body("entity.uniqueId", is(cdsUniqueId)). body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")); From c3e0e10a21e2bbcca1baf877bdb029bebc9b0cb6 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 16:32:33 +0100 Subject: [PATCH 006/342] Update migration --- .../db/migration/v0.35.0.10__gff_entity_tables.sql | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql b/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql index 7347d43ec..754623b31 100644 --- a/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql +++ b/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql @@ -57,8 +57,6 @@ CREATE INDEX genomeassembly_crossreference_genomeassembly_xref_index ON genomeas CREATE INDEX genomeassembly_crossreference_genomeassembly_index ON genomeassembly_crossreference USING btree(genomeassembly_id); CREATE INDEX genomeassembly_crossreference_crossreference_index ON genomeassembly_crossreference USING btree(crossreferences_id); - -/* INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'GFF Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) @@ -81,7 +79,7 @@ INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF', 'ZFIN GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) - SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'GFF'; + SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'GFF'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'FB' FROM bulkload WHERE name = 'FB GFF Load'; @@ -100,5 +98,4 @@ INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'XBXT' FROM bulkload WHERE name = 'XBXT GFF Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) - SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name = 'ZFIN GFF Load'; -*/ \ No newline at end of file + SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name = 'ZFIN GFF Load'; \ No newline at end of file From a6fcacfae60b5563bc7c53c82c2477b690da6d64 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 16:43:00 +0100 Subject: [PATCH 007/342] Checkstyle fixes --- .../curation_api/constants/Gff3Constants.java | 15 ++++++++------- .../interfaces/crud/TranscriptCrudInterface.java | 1 - .../curation_api/jobs/executors/Gff3Executor.java | 4 ---- .../curation_api/model/entities/Transcript.java | 5 ----- .../curation_api/services/Gff3Service.java | 2 +- .../services/validation/dto/Gff3DtoValidator.java | 4 ++-- 6 files changed, 11 insertions(+), 20 deletions(-) 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 b2681db8c..fe4c914f6 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -2,13 +2,14 @@ import java.util.List; -public final class Gff3Constants { - private Gff3Constants() { - // Hidden from view, as it is a utility class - } +import lombok.experimental.UtilityClass; + +@UtilityClass +public class Gff3Constants { 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA"); + "mRNA", "ncRNA", "piRNA", "lincRNA", "miRNA", "pre_miRNA", "snoRNA", "lncRNA", + "tRNA", "snRNA", "rRNA", "antisense_RNA", "C_gene_segment", "V_gene_segment", + "pseudogene_attribute", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA" + ); } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java index ac1b81a3a..6e6c2ee23 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/TranscriptCrudInterface.java @@ -3,7 +3,6 @@ import java.util.List; import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; -import org.alliancegenome.curation_api.interfaces.base.crud.BaseReadIdentifierControllerInterface; import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 134eba67f..f4839f59c 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -10,16 +10,12 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; -import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; -import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; -import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; -import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.CodingSequenceService; 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 8dc40e0d3..403322155 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 @@ -5,15 +5,10 @@ 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.Indexed; 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; 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 239018516..311d7e895 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -27,7 +27,7 @@ import jakarta.transaction.Transactional; @RequestScoped -public class Gff3Service { +public class Gff3Service { @Inject GenomeAssemblyDAO genomeAssemblyDAO; @Inject DataProviderService dataProviderService; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 2dca95631..f53ac4a7c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -108,7 +108,7 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider d } else { transcript = new Transcript(); transcript.setModInternalId(attributes.get("ID")); - } + } } SearchResponse soResponse = soTermDAO.findByField("name", dto.getType()); @@ -147,7 +147,7 @@ private ObjectResponse validateGffEntity(E entity, return geResponse; } - private Map getAttributes (Gff3DTO dto, BackendBulkDataProvider dataProvider) { + private Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { Map attributes = new HashMap(); if (CollectionUtils.isNotEmpty(dto.getAttributes())) { for (String keyValue : dto.getAttributes()) { From 0a7b14d85d5b5819e464dd93af585b4404d6f0f8 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 16:47:58 +0100 Subject: [PATCH 008/342] 2nd attempt at checkstyle fixes --- .../curation_api/constants/Gff3Constants.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 fe4c914f6..c03ff3e22 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -2,10 +2,10 @@ import java.util.List; -import lombok.experimental.UtilityClass; - -@UtilityClass -public class Gff3Constants { +public final class Gff3Constants { + private Gff3Constants() { + throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); + } 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", From dcd8a00b2f5559f1eb8378f0b187148b3e38d947 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 16:51:26 +0100 Subject: [PATCH 009/342] 3rd attempt at checkstyle fixes --- .../alliancegenome/curation_api/constants/Gff3Constants.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 c03ff3e22..576a4692d 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -2,11 +2,11 @@ import java.util.List; -public final class Gff3Constants { +public class Gff3Constants { private Gff3Constants() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } - public static final List TRANSCRIPT_TYPES = List.of( + public static 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA" From c3f88d712471054805820cc23bc9cff3acf7037f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 16:54:47 +0100 Subject: [PATCH 010/342] Maybe this time --- .../alliancegenome/curation_api/constants/Gff3Constants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 576a4692d..e27ec3547 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -6,7 +6,7 @@ public class Gff3Constants { private Gff3Constants() { throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } - public static List TRANSCRIPT_TYPES = List.of( + 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA" From 3988dc531a45b68b7fa8f14588b2362deede4d68 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 17:38:46 +0100 Subject: [PATCH 011/342] Suppress warning --- .../alliancegenome/curation_api/constants/Gff3Constants.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 e27ec3547..49f6ba6d4 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -2,8 +2,10 @@ import java.util.List; -public class Gff3Constants { +@SuppressWarnings("checkstyle:hideutilityclassconstructor") +public final class Gff3Constants { private Gff3Constants() { + // Hidden from view, as it is a utility class throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } public static final List TRANSCRIPT_TYPES = List.of( From 78421ad96f00c44e2862bf498ee622ddc5f25e1e Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 17:41:27 +0100 Subject: [PATCH 012/342] Remove HideUtilityClassConstructor check --- checkstyle.xml | 2 +- .../alliancegenome/curation_api/constants/Gff3Constants.java | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/checkstyle.xml b/checkstyle.xml index 4881979be..bd600114a 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -27,7 +27,7 @@ - + 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 49f6ba6d4..55b9ed3c2 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -2,7 +2,6 @@ import java.util.List; -@SuppressWarnings("checkstyle:hideutilityclassconstructor") public final class Gff3Constants { private Gff3Constants() { // Hidden from view, as it is a utility class From 6bad602c8dbcaec0c7215d81b83039e5f968eb00 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 17:47:30 +0100 Subject: [PATCH 013/342] Rename migration as this will go out with next release --- ...10__gff_entity_tables.sql => v0.36.0.1__gff_entity_tables.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.35.0.10__gff_entity_tables.sql => v0.36.0.1__gff_entity_tables.sql} (100%) diff --git a/src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql b/src/main/resources/db/migration/v0.36.0.1__gff_entity_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.35.0.10__gff_entity_tables.sql rename to src/main/resources/db/migration/v0.36.0.1__gff_entity_tables.sql From edf7d9e37fbe6666b9f55a02cccb7669d535d0ea Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 3 Jul 2024 12:13:58 -0500 Subject: [PATCH 014/342] Change to use stringlist template for synonyms in controlled vocabulary --- .../ControlledVocabularyTable.js | 30 ++----------------- 1 file changed, 2 insertions(+), 28 deletions(-) diff --git a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js index 4a8cbb65f..6ce57cdf0 100644 --- a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js +++ b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js @@ -21,6 +21,7 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; import { setNewEntity } from '../../utils/utils'; +import { StringListTemplate } from '../../components/Templates/StringListTemplate'; export const ControlledVocabularyTable = () => { const newTermReducer = (state, action) => { @@ -216,33 +217,6 @@ export const ControlledVocabularyTable = () => { } }; - const synonymsBodyTemplate = (rowData) => { - if (rowData?.synonyms && rowData.synonyms.length > 0) { - const sortedSynonyms = rowData.synonyms.sort(); - const listTemplate = (synonym) => { - return ( - -
- - ); - }; - return ( - <> -
- -
- - - - - ); - } - }; - const columns = [ { field: 'id', @@ -270,7 +244,7 @@ export const ControlledVocabularyTable = () => { header: 'Synonyms', sortable: true, filterConfig: FILTER_CONFIGS.synonymsFilterConfig, - body: synonymsBodyTemplate, + body: (rowData) => , }, { field: 'vocabulary.name', From c8daf779a85c68a034294bc6954acc0718ee6139 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 3 Jul 2024 12:16:21 -0500 Subject: [PATCH 015/342] Removed unused import --- .../controlledVocabularyPage/ControlledVocabularyTable.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js index 6ce57cdf0..aa5955cf2 100644 --- a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js +++ b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js @@ -3,9 +3,6 @@ import { GenericDataTable } from '../../components/GenericDataTable/GenericDataT import { useMutation, useQuery } from '@tanstack/react-query'; import { Toast } from 'primereact/toast'; -import { Tooltip } from 'primereact/tooltip'; -import { EllipsisTableCell } from '../../components/EllipsisTableCell'; -import { ListTableCell } from '../../components/ListTableCell'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { VocabularyService } from '../../service/VocabularyService'; import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; From d183482943d2a5036de68000dc378a62f3e0d9ec Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 19:00:51 +0100 Subject: [PATCH 016/342] Fix previous migration errors --- .../migration/v0.36.0.2__fix_migration_error.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql diff --git a/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql b/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql new file mode 100644 index 000000000..6d267395d --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql @@ -0,0 +1,14 @@ +DELETE FROM bulkscheduledload WHERE id = (SELECT id FROM bulkload WHERE name = 'WGD GFF Load'); + +DELETE FROM bulkload WHERE name = 'WGD GFF Load' OR name = 'HUMAN GFF Load'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'GFF', 'SGD GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) + SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'SGD GFF Load'; + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'SGD' FROM bulkload WHERE name = 'SGD GFF Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'GFF', 'HUMAN' FROM bulkload WHERE name = 'Human GFF Load'; \ No newline at end of file From 975cc2b5bdecb64ad71e22b7b0d92f4d44d69bca Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 19:02:42 +0100 Subject: [PATCH 017/342] Remove unnecessary clause --- .../resources/db/migration/v0.36.0.2__fix_migration_error.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql b/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql index 6d267395d..dfc3c4634 100644 --- a/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql +++ b/src/main/resources/db/migration/v0.36.0.2__fix_migration_error.sql @@ -1,6 +1,6 @@ DELETE FROM bulkscheduledload WHERE id = (SELECT id FROM bulkload WHERE name = 'WGD GFF Load'); -DELETE FROM bulkload WHERE name = 'WGD GFF Load' OR name = 'HUMAN GFF Load'; +DELETE FROM bulkload WHERE name = 'WGD GFF Load'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF', 'SGD GFF Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'GFF Loads'; From 99ae13f1ea218d73b35f50de3484232ea76f0513 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 3 Jul 2024 23:38:24 +0100 Subject: [PATCH 018/342] Fix total record count --- .../curation_api/jobs/executors/Gff3Executor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index f4839f59c..34705544d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -69,7 +69,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { Map> previousIds = getPreviouslyLoadedIds(dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(gffData.size()); + BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); createHistory(history, bulkLoadFile); idsAdded = runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider); runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); From 9b88a4ab78fc077aefce3fd6ee4b696f279f1552 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 4 Jul 2024 10:48:36 +0100 Subject: [PATCH 019/342] Don't store curie as modEntityId as not unique --- .../services/validation/dto/Gff3DtoValidator.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index f53ac4a7c..1e31a1c27 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -135,10 +135,6 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider d private ObjectResponse validateGffEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { ObjectResponse geResponse = new ObjectResponse(); - if (attributes.containsKey("curie")) { - entity.setModEntityId(attributes.get("curie")); - } - entity.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); entity.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); From c5fc8807ca5e61525122208edf968b45824ed94c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 4 Jul 2024 11:01:04 +0100 Subject: [PATCH 020/342] Include non-coding exons --- .../org/alliancegenome/curation_api/services/Gff3Service.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 311d7e895..3910b5045 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -66,7 +66,7 @@ public GenomeAssembly loadGenomeAssembly(String assemblyName, List gffHe } public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - if (StringUtils.equals(gffEntry.getType(), "exon")) { + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, dataProvider); if (exon != null) { idsAdded.get("Exon").add(exon.getId()); From 49a1457ef40e5a1a82be2aa1c65b77da344bded6 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 4 Jul 2024 16:23:49 +0100 Subject: [PATCH 021/342] Fully implement geneType --- src/main/cliapp/src/constants/FilterFields.js | 5 + src/main/cliapp/src/constants/SortFields.js | 1 + .../src/containers/genesPage/GenesTable.js | 8 ++ .../genesPage/__tests__/GenesTable.test.js | 2 + .../containers/genesPage/mockData/mockData.js | 7 ++ .../curation_api/model/entities/Gene.java | 5 + .../model/ingest/dto/GeneDTO.java | 4 + .../services/validation/GeneValidator.java | 1 + .../validation/dto/GeneDTOValidator.java | 13 ++ .../curation_api/GeneBulkUploadITCase.java | 13 +- .../curation_api/GeneITCase.java | 18 ++- .../curation_api/base/BaseITCase.java | 6 + .../bulk/01_gene/AF_01_all_fields.json | 3 +- .../bulk/01_gene/DX_01_duplicate_xref.json | 3 +- .../EN_01_empty_non_required_fields.json | 3 +- .../bulk/01_gene/ER_01_empty_mod_ids.json | 3 +- .../bulk/01_gene/ER_02_empty_taxon.json | 3 +- .../ER_03_empty_gene_symbol_display_text.json | 3 +- ..._04_empty_gene_full_name_display_text.json | 3 +- ...pty_gene_systematic_name_display_text.json | 3 +- ...ER_06_empty_gene_synonym_display_text.json | 3 +- .../ER_07_empty_gene_symbol_format_text.json | 3 +- ...R_08_empty_gene_full_name_format_text.json | 3 +- ...mpty_gene_systematic_name_format_text.json | 3 +- .../ER_10_empty_gene_synonym_format_text.json | 3 +- .../ER_11_empty_gene_symbol_name_type.json | 3 +- .../ER_12_empty_gene_full_name_name_type.json | 3 +- ..._empty_gene_systematic_name_name_type.json | 3 +- .../ER_14_empty_gene_synonym_name_type.json | 3 +- ...ider_source_organization_abbreviation.json | 3 +- ...ider_cross_reference_referenced_curie.json | 3 +- ...provider_cross_reference_display_name.json | 3 +- ..._data_provider_cross_reference_prefix.json | 3 +- ...ta_provider_cross_reference_page_area.json | 3 +- ..._empty_gene_secondary_id_secondary_id.json | 3 +- .../bulk/01_gene/ER_21_empty_gene_type.json | 114 ++++++++++++++++++ .../01_gene/IV_01_invalid_date_created.json | 3 +- .../01_gene/IV_02_invalid_date_updated.json | 3 +- .../bulk/01_gene/IV_03_invalid_taxon.json | 3 +- .../IV_04_invalid_gene_symbol_name_type.json | 3 +- ...V_05_invalid_gene_full_name_name_type.json | 3 +- ...nvalid_gene_systematic_name_name_type.json | 3 +- .../IV_07_invalid_gene_synonym_name_type.json | 3 +- ..._08_invalid_gene_symbol_synonym_scope.json | 3 +- ..._invalid_gene_full_name_synonym_scope.json | 3 +- ...id_gene_systematic_name_synonym_scope.json | 3 +- ...11_invalid_gene_synonym_synonym_scope.json | 3 +- .../IV_12_invalid_gene_symbol_evidence.json | 3 +- ...IV_13_invalid_gene_full_name_evidence.json | 3 +- ...invalid_gene_systematic_name_evidence.json | 3 +- .../IV_15_invalid_gene_synonym_evidence.json | 3 +- ...ider_source_organization_abbreviation.json | 3 +- ..._data_provider_cross_reference_prefix.json | 3 +- ...ta_provider_cross_reference_page_area.json | 3 +- ...19_invalid_gene_secondary_id_evidence.json | 3 +- .../bulk/01_gene/IV_20_invalid_gene_type.json | 114 ++++++++++++++++++ .../MN_01_no_non_required_fields_level_1.json | 3 +- .../MN_02_no_non_required_fields_level_2.json | 3 +- .../bulk/01_gene/MR_01_no_mod_ids.json | 3 +- .../bulk/01_gene/MR_02_no_taxon.json | 3 +- .../bulk/01_gene/MR_03_no_gene_symbol.json | 3 +- .../MR_04_no_gene_symbol_display_text.json | 3 +- .../MR_05_no_gene_full_name_display_text.json | 3 +- ..._no_gene_systematic_name_display_text.json | 3 +- .../MR_07_no_gene_synonym_display_text.json | 3 +- .../MR_08_no_gene_symbol_format_text.json | 3 +- .../MR_09_no_gene_full_name_format_text.json | 3 +- ...0_no_gene_systematic_name_format_text.json | 3 +- .../MR_11_no_gene_synonym_format_text.json | 3 +- .../MR_12_no_gene_symbol_name_type.json | 3 +- .../MR_13_no_gene_full_name_name_type.json | 3 +- ..._14_no_gene_systematic_name_name_type.json | 3 +- .../MR_15_no_gene_synonym_name_type.json | 3 +- .../bulk/01_gene/MR_16_no_data_provider.json | 3 +- ...ider_source_organization_abbreviation.json | 3 +- ...ider_cross_reference_referenced_curie.json | 3 +- ...provider_cross_reference_display_name.json | 3 +- ..._data_provider_cross_reference_prefix.json | 3 +- ...ta_provider_cross_reference_page_area.json | 3 +- ..._22_no_gene_secondary_id_secondary_id.json | 3 +- .../bulk/01_gene/MR_23_no_gene_type.json | 113 +++++++++++++++++ ...D_01_update_all_except_default_fields.json | 3 +- ...E_01_update_empty_non_required_fields.json | 3 +- ...update_no_non_required_fields_level_1.json | 3 +- ...update_no_non_required_fields_level_2.json | 3 +- .../01_gene/VT_01_valid_taxon_for_HUMAN.json | 3 +- .../01_gene/VT_02_valid_taxon_for_RGD.json | 3 +- 87 files changed, 560 insertions(+), 80 deletions(-) create mode 100644 src/test/resources/bulk/01_gene/ER_21_empty_gene_type.json create mode 100644 src/test/resources/bulk/01_gene/IV_20_invalid_gene_type.json create mode 100644 src/test/resources/bulk/01_gene/MR_23_no_gene_type.json diff --git a/src/main/cliapp/src/constants/FilterFields.js b/src/main/cliapp/src/constants/FilterFields.js index 43f2021f1..b75e08beb 100644 --- a/src/main/cliapp/src/constants/FilterFields.js +++ b/src/main/cliapp/src/constants/FilterFields.js @@ -344,6 +344,10 @@ export const FIELD_SETS = Object.freeze({ filterName: 'geneticSexFilter', fields: ['geneticSex.name'], }, + geneTypeFieldSet: { + filterName: 'geneTypeFilter', + fields: ['geneType.curie', 'geneType.name'], + }, gmiAggregationFieldSet: { filterName: 'gmiAggregationFilter', fields: ['relation.name'], @@ -788,6 +792,7 @@ export const FILTER_CONFIGS = Object.freeze({ geneSymbolFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSymbolFieldSet] }, geneSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSynonymsFieldSet] }, geneSystematicNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSystematicNameFieldSet] }, + geneTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneTypeFieldSet] }, geneticModifiersFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifiersFieldSet] }, idExampleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idExampleFieldSet] }, idPatternFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idPatternFieldSet] }, diff --git a/src/main/cliapp/src/constants/SortFields.js b/src/main/cliapp/src/constants/SortFields.js index 487b4f062..8c0471a92 100644 --- a/src/main/cliapp/src/constants/SortFields.js +++ b/src/main/cliapp/src/constants/SortFields.js @@ -73,6 +73,7 @@ export const SORT_FIELDS = Object.freeze([ 'geneSymbol.displayText', 'geneSecondaryIds.secondaryId', 'geneSystematicName.displayText', + "geneType.name", 'inchi', 'inchiKey', 'iupac', diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index db05c530c..e6054770e 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -16,6 +16,7 @@ import { TextDialogTemplate } from '../../components/Templates/dialog/TextDialog import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialogTemplate'; import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; +import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; import { SearchService } from '../../service/SearchService'; @@ -191,6 +192,13 @@ export const GenesTable = () => { filter: true, filterConfig: FILTER_CONFIGS.geneSystematicNameFilterConfig, }, + { + field: 'geneType.name', + header: 'Gene Type', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.geneTypeFilterConfig, + }, { field: 'taxon.name', header: 'Taxon', diff --git a/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js b/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js index 68ff012e2..dc369c34e 100644 --- a/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js +++ b/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js @@ -46,6 +46,7 @@ describe('', () => { const systematicNameTd = await result.findByText('C35C5.5'); const taxonTd = await result.findByText(/Caenorhabditis elegans/i); const xrefsTd = await result.findByText(/WBGene00003771Xref \(gene\)/); + const geneTypeTd = await result.findByText(/tRNA_gene \(SO:0001271\)/i); await waitFor(() => { expect(modEntityIdTd).toBeInTheDocument(); @@ -56,6 +57,7 @@ describe('', () => { expect(systematicNameTd).toBeInTheDocument(); expect(taxonTd).toBeInTheDocument(); expect(xrefsTd).toBeInTheDocument(); + expect(geneTypeTd).toBeInTheDocument(); }); }); }); diff --git a/src/main/cliapp/src/containers/genesPage/mockData/mockData.js b/src/main/cliapp/src/containers/genesPage/mockData/mockData.js index 56b1376a3..15cd71d69 100644 --- a/src/main/cliapp/src/containers/genesPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/genesPage/mockData/mockData.js @@ -28,6 +28,13 @@ export const data = { curie: 'NCBITaxon:6239', name: 'Caenorhabditis elegans', }, + geneType: { + internal: false, + obsolete: false, + curie: "SO:0001272", + name: "tRNA_gene", + id: 25665 + }, dataProvider: { internal: false, obsolete: false, 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 14431b18a..fbb6dff68 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 @@ -15,8 +15,10 @@ import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSystematicNameSlotAnnotation; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; 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.JsonManagedReference; import com.fasterxml.jackson.annotation.JsonView; @@ -42,6 +44,9 @@ @Table(indexes = { @Index(name = "gene_genetype_index", columnList = "geneType_id") }) public class Gene extends GenomicEntity { + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) private SOTerm geneType; diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneDTO.java index b1ace4eec..6565589e9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/GeneDTO.java @@ -38,4 +38,8 @@ public class GeneDTO extends GenomicEntityDTO { @JsonView({ View.FieldsAndLists.class }) @JsonProperty("gene_secondary_id_dtos") private List geneSecondaryIdDtos; + + @JsonView({ View.FieldsOnly.class }) + @JsonProperty("gene_type_curie") + private String geneTypeCurie; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java index 9752a3632..e10a219a7 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java @@ -136,6 +136,7 @@ private Gene validateGene(Gene uiEntity, Gene dbEntity) { private SOTerm validateGeneType(Gene uiEntity, Gene dbEntity) { if (ObjectUtils.isEmpty(uiEntity.getGeneType())) { + addMessageResponse("geneType", ValidationConstants.REQUIRED_MESSAGE); return null; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java index a61ab55ce..fb7fedd13 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java @@ -10,6 +10,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneFullNameSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSecondaryIdSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSymbolSlotAnnotation; @@ -21,6 +22,7 @@ import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.helpers.slotAnnotations.SlotAnnotationIdentityHelper; +import org.alliancegenome.curation_api.services.ontology.SoTermService; import org.alliancegenome.curation_api.services.validation.dto.base.BaseDTOValidator; import org.alliancegenome.curation_api.services.validation.dto.slotAnnotations.geneSlotAnnotations.GeneFullNameSlotAnnotationDTOValidator; import org.alliancegenome.curation_api.services.validation.dto.slotAnnotations.geneSlotAnnotations.GeneSecondaryIdSlotAnnotationDTOValidator; @@ -44,6 +46,7 @@ public class GeneDTOValidator extends BaseDTOValidator { @Inject GeneSynonymSlotAnnotationDTOValidator geneSynonymDtoValidator; @Inject GeneSecondaryIdSlotAnnotationDTOValidator geneSecondaryIdDtoValidator; @Inject SlotAnnotationIdentityHelper identityHelper; + @Inject SoTermService soTermService; private ObjectResponse geneResponse; @@ -103,6 +106,16 @@ public Gene validateGeneDTO(GeneDTO dto, BackendBulkDataProvider dataProvider) t } gene.getGeneSecondaryIds().addAll(secondaryIds); } + + if (StringUtils.isBlank(dto.getGeneTypeCurie())) { + geneResponse.addErrorMessage("gene_type_curie", ValidationConstants.REQUIRED_MESSAGE); + } else { + SOTerm geneType = soTermService.findByCurieOrSecondaryId(dto.getGeneTypeCurie()); + if (geneType == null) { + geneResponse.addErrorMessage("gene_type_curie", ValidationConstants.INVALID_MESSAGE + " (" + dto.getGeneTypeCurie() + ")"); + } + gene.setGeneType(geneType); + } geneResponse.convertErrorMessagesToMap(); diff --git a/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java index c6208e9d6..f42adcd72 100644 --- a/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java @@ -46,6 +46,8 @@ public void init() { private String requiredReferenceXref2 = "PMID:25920551"; private String requiredDataProvider = "WB"; private String requiredDataProvider2 = "RGD"; + private String soTerm = "SO:0001217"; + private String soTerm2 = "SO:0000336"; private final String geneBulkPostEndpoint = "/api/gene/bulk/WB/genes"; private final String geneBulkPostEndpointRGD = "/api/gene/bulk/RGD/genes"; @@ -60,6 +62,8 @@ private void loadRequiredEntities() throws Exception { createResourceDescriptorPage("homepage", "http://test.org", rd); ResourceDescriptor rd2 = createResourceDescriptor("TEST2"); createResourceDescriptorPage("homepage2", "http://test2.org", rd2); + createSoTerm(soTerm, "protein_coding_gene", false); + createSoTerm(soTerm2, "pseudogene", false); } @Test @@ -147,7 +151,8 @@ public void geneBulkUploadCheckFields() throws Exception { body("entity.crossReferences", hasSize(1)). body("entity.crossReferences[0].referencedCurie", is("TEST:Xref01")). body("entity.crossReferences[0].displayName", is("TEST:Xref01Display")). - body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage")); + body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage")). + body("entity.geneType.curie", is(soTerm)); } @Test @@ -233,7 +238,8 @@ public void geneBulkUploadUpdateFields() throws Exception { body("entity.crossReferences", hasSize(1)). body("entity.crossReferences[0].referencedCurie", is("TEST2:Xref02")). body("entity.crossReferences[0].displayName", is("TEST2:Xref02Display")). - body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage2")); + body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage2")). + body("entity.geneType.curie", is(soTerm2)); } @Test @@ -261,6 +267,7 @@ public void geneBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "MR_20_no_data_provider_cross_reference_prefix.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "MR_21_no_data_provider_cross_reference_page_area.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "MR_22_no_gene_secondary_id_secondary_id.json"); + checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "MR_23_no_gene_type.json"); } @Test @@ -286,6 +293,7 @@ public void geneBulkUploadEmptyRequiredFields() throws Exception { checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "ER_18_empty_data_provider_cross_reference_prefix.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "ER_19_empty_data_provider_cross_reference_page_area.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "ER_20_empty_gene_secondary_id_secondary_id.json"); + checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "ER_21_empty_gene_type.json"); } @Test @@ -310,6 +318,7 @@ public void geneBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "IV_17_invalid_data_provider_cross_reference_prefix.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "IV_18_invalid_data_provider_cross_reference_page_area.json"); checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "IV_19_invalid_gene_secondary_id_evidence.json"); + checkFailedBulkLoad(geneBulkPostEndpoint, geneTestFilePath + "IV_20_invalid_gene_type.json"); } @Test diff --git a/src/test/java/org/alliancegenome/curation_api/GeneITCase.java b/src/test/java/org/alliancegenome/curation_api/GeneITCase.java index dbda64419..95167bfcf 100644 --- a/src/test/java/org/alliancegenome/curation_api/GeneITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/GeneITCase.java @@ -301,10 +301,11 @@ public void createGeneWithMissingRequiredFieldsLevel1() { post("/api/gene"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(3))). + body("errorMessages", is(aMapWithSize(4))). body("errorMessages.modInternalId", is(ValidationConstants.REQUIRED_UNLESS_OTHER_FIELD_POPULATED_MESSAGE + "modEntityId")). body("errorMessages.taxon", is(ValidationConstants.REQUIRED_MESSAGE)). - body("errorMessages.geneSymbol", is(ValidationConstants.REQUIRED_MESSAGE)); + body("errorMessages.geneSymbol", is(ValidationConstants.REQUIRED_MESSAGE)). + body("errorMessages.geneType", is(ValidationConstants.REQUIRED_MESSAGE)); } @Test @@ -331,6 +332,7 @@ public void editGeneWithMissingRequiredFieldsLevel1() { gene.setTaxon(null); gene.setGeneSymbol(null); gene.setDataProvider(null); + gene.setGeneType(null); RestAssured.given(). contentType("application/json"). @@ -339,10 +341,11 @@ public void editGeneWithMissingRequiredFieldsLevel1() { put("/api/gene"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(3))). + body("errorMessages", is(aMapWithSize(4))). body("errorMessages.taxon", is(ValidationConstants.REQUIRED_MESSAGE)). body("errorMessages.geneSymbol", is(ValidationConstants.REQUIRED_MESSAGE)). - body("errorMessages.dataProvider", is(ValidationConstants.REQUIRED_MESSAGE)); + body("errorMessages.dataProvider", is(ValidationConstants.REQUIRED_MESSAGE)). + body("errorMessages.geneType", is(ValidationConstants.REQUIRED_MESSAGE)); } @Test @@ -353,6 +356,7 @@ public void createGeneWithEmptyRequiredFieldsLevel1() { gene.setModEntityId(""); gene.setTaxon(taxon); gene.setGeneSymbol(geneSymbol); + gene.setGeneType(soTerm); RestAssured.given(). contentType("application/json"). @@ -389,6 +393,7 @@ public void createGeneWithMissingRequiredFieldsLevel2() { Gene gene = new Gene(); gene.setModEntityId("GENE:0008"); gene.setTaxon(taxon); + gene.setGeneType(soTerm); GeneSymbolSlotAnnotation invalidSymbol = new GeneSymbolSlotAnnotation(); GeneFullNameSlotAnnotation invalidFullName = new GeneFullNameSlotAnnotation(); @@ -494,6 +499,7 @@ public void createGeneWithEmptyRequiredFieldsLevel2() { Gene gene = new Gene(); gene.setModEntityId("GENE:0010"); gene.setTaxon(taxon); + gene.setGeneType(soTerm); GeneSymbolSlotAnnotation invalidSymbol = createGeneSymbolSlotAnnotation(null, "", symbolNameType, null, null); GeneFullNameSlotAnnotation invalidFullName = createGeneFullNameSlotAnnotation(null, "", fullNameType, null, null); @@ -898,7 +904,6 @@ public void editGeneWithNullNonRequiredFieldsLevel2() { public void editGeneWithNullNonRequiredFieldsLevel1() { Gene gene = getGene(GENE); - gene.setGeneType(null); gene.setGeneFullName(null); gene.setGeneSynonyms(null); gene.setGeneSystematicName(null); @@ -917,7 +922,6 @@ public void editGeneWithNullNonRequiredFieldsLevel1() { get("/api/gene/" + GENE). then(). statusCode(200). - body("entity", not(hasKey("geneType"))). body("entity", not(hasKey("geneFullName"))). body("entity", not(hasKey("geneSynonyms"))). body("entity", not(hasKey("geneSystematicName"))). @@ -931,6 +935,7 @@ public void createGeneWithOnlyRequiredFields() { gene.setModEntityId("GENE:0020"); gene.setTaxon(taxon); gene.setGeneSymbol(geneSymbol); + gene.setGeneType(soTerm); RestAssured.given(). contentType("application/json"). @@ -947,6 +952,7 @@ public void createGeneWithOnlyRequiredFieldsLevel2() { Gene gene = new Gene(); gene.setModEntityId("GENE:0021"); gene.setTaxon(taxon); + gene.setGeneType(soTerm); GeneSymbolSlotAnnotation minimalGeneSymbol = createGeneSymbolSlotAnnotation(null, "Test symbol", symbolNameType, null, null); GeneFullNameSlotAnnotation minimalGeneFullName = createGeneFullNameSlotAnnotation(null, "Test name", fullNameType, null, null); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index f03086b3b..1ef4c4cb1 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -344,6 +344,9 @@ public Gene createGene(String modEntityId, String taxonCurie, Boolean obsolete, symbol.setFormatText(modEntityId); gene.setGeneSymbol(symbol); + + SOTerm geneType = getSoTerm("SO:0001217"); + gene.setGeneType(geneType); ObjectResponse response = given(). contentType("application/json"). @@ -1211,6 +1214,9 @@ public void loadGeneWithXref(String modEntityId, String taxonCurie, VocabularyTe symbol.setFormatText(modEntityId); gene.setGeneSymbol(symbol); + + SOTerm geneType = getSoTerm("SO:0001217"); + gene.setGeneType(geneType); if (StringUtils.isNotBlank(xrefCurie)) { CrossReference xref = new CrossReference(); diff --git a/src/test/resources/bulk/01_gene/AF_01_all_fields.json b/src/test/resources/bulk/01_gene/AF_01_all_fields.json index cdcbae3d5..5e8304cbf 100644 --- a/src/test/resources/bulk/01_gene/AF_01_all_fields.json +++ b/src/test/resources/bulk/01_gene/AF_01_all_fields.json @@ -108,6 +108,7 @@ "display_name": "TEST:Xref01Display", "prefix": "TEST" } - ] + ], + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/DX_01_duplicate_xref.json b/src/test/resources/bulk/01_gene/DX_01_duplicate_xref.json index 7aa718cb4..87cecd236 100644 --- a/src/test/resources/bulk/01_gene/DX_01_duplicate_xref.json +++ b/src/test/resources/bulk/01_gene/DX_01_duplicate_xref.json @@ -116,6 +116,7 @@ "display_name": "TEST:Xref01Display", "prefix": "TEST" } - ] + ], + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/EN_01_empty_non_required_fields.json b/src/test/resources/bulk/01_gene/EN_01_empty_non_required_fields.json index 9e4b3d71f..a0d76b3c0 100644 --- a/src/test/resources/bulk/01_gene/EN_01_empty_non_required_fields.json +++ b/src/test/resources/bulk/01_gene/EN_01_empty_non_required_fields.json @@ -86,6 +86,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_01_empty_mod_ids.json b/src/test/resources/bulk/01_gene/ER_01_empty_mod_ids.json index 8046374f7..893e850d7 100644 --- a/src/test/resources/bulk/01_gene/ER_01_empty_mod_ids.json +++ b/src/test/resources/bulk/01_gene/ER_01_empty_mod_ids.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_02_empty_taxon.json b/src/test/resources/bulk/01_gene/ER_02_empty_taxon.json index 322d2117c..888924a64 100644 --- a/src/test/resources/bulk/01_gene/ER_02_empty_taxon.json +++ b/src/test/resources/bulk/01_gene/ER_02_empty_taxon.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_03_empty_gene_symbol_display_text.json b/src/test/resources/bulk/01_gene/ER_03_empty_gene_symbol_display_text.json index bce150f7f..07c532d66 100644 --- a/src/test/resources/bulk/01_gene/ER_03_empty_gene_symbol_display_text.json +++ b/src/test/resources/bulk/01_gene/ER_03_empty_gene_symbol_display_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_04_empty_gene_full_name_display_text.json b/src/test/resources/bulk/01_gene/ER_04_empty_gene_full_name_display_text.json index a677f1bfe..d01582336 100644 --- a/src/test/resources/bulk/01_gene/ER_04_empty_gene_full_name_display_text.json +++ b/src/test/resources/bulk/01_gene/ER_04_empty_gene_full_name_display_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_05_empty_gene_systematic_name_display_text.json b/src/test/resources/bulk/01_gene/ER_05_empty_gene_systematic_name_display_text.json index b61665665..4b9e29ac8 100644 --- a/src/test/resources/bulk/01_gene/ER_05_empty_gene_systematic_name_display_text.json +++ b/src/test/resources/bulk/01_gene/ER_05_empty_gene_systematic_name_display_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_06_empty_gene_synonym_display_text.json b/src/test/resources/bulk/01_gene/ER_06_empty_gene_synonym_display_text.json index d73378769..4f6eb9c7f 100644 --- a/src/test/resources/bulk/01_gene/ER_06_empty_gene_synonym_display_text.json +++ b/src/test/resources/bulk/01_gene/ER_06_empty_gene_synonym_display_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_07_empty_gene_symbol_format_text.json b/src/test/resources/bulk/01_gene/ER_07_empty_gene_symbol_format_text.json index b6b969d1a..c672ce616 100644 --- a/src/test/resources/bulk/01_gene/ER_07_empty_gene_symbol_format_text.json +++ b/src/test/resources/bulk/01_gene/ER_07_empty_gene_symbol_format_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_08_empty_gene_full_name_format_text.json b/src/test/resources/bulk/01_gene/ER_08_empty_gene_full_name_format_text.json index b13598137..f00a8f79c 100644 --- a/src/test/resources/bulk/01_gene/ER_08_empty_gene_full_name_format_text.json +++ b/src/test/resources/bulk/01_gene/ER_08_empty_gene_full_name_format_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_09_empty_gene_systematic_name_format_text.json b/src/test/resources/bulk/01_gene/ER_09_empty_gene_systematic_name_format_text.json index 245ddc047..98bfe1d08 100644 --- a/src/test/resources/bulk/01_gene/ER_09_empty_gene_systematic_name_format_text.json +++ b/src/test/resources/bulk/01_gene/ER_09_empty_gene_systematic_name_format_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_10_empty_gene_synonym_format_text.json b/src/test/resources/bulk/01_gene/ER_10_empty_gene_synonym_format_text.json index 8adf992ed..e5163011e 100644 --- a/src/test/resources/bulk/01_gene/ER_10_empty_gene_synonym_format_text.json +++ b/src/test/resources/bulk/01_gene/ER_10_empty_gene_synonym_format_text.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_11_empty_gene_symbol_name_type.json b/src/test/resources/bulk/01_gene/ER_11_empty_gene_symbol_name_type.json index ed74c0725..0b5462d86 100644 --- a/src/test/resources/bulk/01_gene/ER_11_empty_gene_symbol_name_type.json +++ b/src/test/resources/bulk/01_gene/ER_11_empty_gene_symbol_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_12_empty_gene_full_name_name_type.json b/src/test/resources/bulk/01_gene/ER_12_empty_gene_full_name_name_type.json index dc9d88a34..47241c9e7 100644 --- a/src/test/resources/bulk/01_gene/ER_12_empty_gene_full_name_name_type.json +++ b/src/test/resources/bulk/01_gene/ER_12_empty_gene_full_name_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_13_empty_gene_systematic_name_name_type.json b/src/test/resources/bulk/01_gene/ER_13_empty_gene_systematic_name_name_type.json index 3bba1ce01..77db95829 100644 --- a/src/test/resources/bulk/01_gene/ER_13_empty_gene_systematic_name_name_type.json +++ b/src/test/resources/bulk/01_gene/ER_13_empty_gene_systematic_name_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_14_empty_gene_synonym_name_type.json b/src/test/resources/bulk/01_gene/ER_14_empty_gene_synonym_name_type.json index bc3f864d5..b688a3169 100644 --- a/src/test/resources/bulk/01_gene/ER_14_empty_gene_synonym_name_type.json +++ b/src/test/resources/bulk/01_gene/ER_14_empty_gene_synonym_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_15_empty_data_provider_source_organization_abbreviation.json b/src/test/resources/bulk/01_gene/ER_15_empty_data_provider_source_organization_abbreviation.json index 1ef038787..091629de4 100644 --- a/src/test/resources/bulk/01_gene/ER_15_empty_data_provider_source_organization_abbreviation.json +++ b/src/test/resources/bulk/01_gene/ER_15_empty_data_provider_source_organization_abbreviation.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_16_empty_data_provider_cross_reference_referenced_curie.json b/src/test/resources/bulk/01_gene/ER_16_empty_data_provider_cross_reference_referenced_curie.json index 81b5ef619..a688293eb 100644 --- a/src/test/resources/bulk/01_gene/ER_16_empty_data_provider_cross_reference_referenced_curie.json +++ b/src/test/resources/bulk/01_gene/ER_16_empty_data_provider_cross_reference_referenced_curie.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_17_empty_data_provider_cross_reference_display_name.json b/src/test/resources/bulk/01_gene/ER_17_empty_data_provider_cross_reference_display_name.json index d9b5da22c..071e4734e 100644 --- a/src/test/resources/bulk/01_gene/ER_17_empty_data_provider_cross_reference_display_name.json +++ b/src/test/resources/bulk/01_gene/ER_17_empty_data_provider_cross_reference_display_name.json @@ -98,6 +98,7 @@ "page_area": "homepage", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_18_empty_data_provider_cross_reference_prefix.json b/src/test/resources/bulk/01_gene/ER_18_empty_data_provider_cross_reference_prefix.json index 7f99cc953..1b06cc814 100644 --- a/src/test/resources/bulk/01_gene/ER_18_empty_data_provider_cross_reference_prefix.json +++ b/src/test/resources/bulk/01_gene/ER_18_empty_data_provider_cross_reference_prefix.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_19_empty_data_provider_cross_reference_page_area.json b/src/test/resources/bulk/01_gene/ER_19_empty_data_provider_cross_reference_page_area.json index b18cfde30..21ec4146f 100644 --- a/src/test/resources/bulk/01_gene/ER_19_empty_data_provider_cross_reference_page_area.json +++ b/src/test/resources/bulk/01_gene/ER_19_empty_data_provider_cross_reference_page_area.json @@ -98,6 +98,7 @@ "page_area": "", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_20_empty_gene_secondary_id_secondary_id.json b/src/test/resources/bulk/01_gene/ER_20_empty_gene_secondary_id_secondary_id.json index c0b971f31..8b392c9a8 100644 --- a/src/test/resources/bulk/01_gene/ER_20_empty_gene_secondary_id_secondary_id.json +++ b/src/test/resources/bulk/01_gene/ER_20_empty_gene_secondary_id_secondary_id.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/ER_21_empty_gene_type.json b/src/test/resources/bulk/01_gene/ER_21_empty_gene_type.json new file mode 100644 index 000000000..84a28e1a8 --- /dev/null +++ b/src/test/resources/bulk/01_gene/ER_21_empty_gene_type.json @@ -0,0 +1,114 @@ +[ + { + "mod_entity_id": "GENETEST:ER21", + "taxon_curie": "NCBITaxon:6239", + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00", + "gene_symbol_dto": { + "display_text": "Tg1", + "format_text": "Tg1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "nomenclature_symbol", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_full_name_dto": { + "display_text": "Test gene 1", + "format_text": "Test gene1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "full_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_systematic_name_dto": { + "display_text": "Tg1.1", + "format_text": "Tg1.1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "systematic_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_synonym_dtos": [ + { + "display_text": "Test gene synonym 1", + "format_text": "Test gene synonym 1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "unspecified", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "gene_secondary_id_dtos": [ + { + "secondary_id": "TEST:Secondary", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "data_provider_dto": { + "internal": false, + "obsolete": false, + "source_organization_abbreviation": "WB", + "cross_reference_dto": { + "referenced_curie": "TEST:0001", + "page_area": "homepage", + "display_name": "TEST:0001", + "prefix": "TEST" + } + }, + "cross_reference_dtos": [ + { + "internal": false, + "obsolete": false, + "referenced_curie": "TEST:Xref01", + "page_area": "homepage", + "display_name": "TEST:Xref01Display", + "prefix": "TEST" + } + ], + "gene_type_curie": "" + } +] diff --git a/src/test/resources/bulk/01_gene/IV_01_invalid_date_created.json b/src/test/resources/bulk/01_gene/IV_01_invalid_date_created.json index 6790bdcfa..a9b14b566 100644 --- a/src/test/resources/bulk/01_gene/IV_01_invalid_date_created.json +++ b/src/test/resources/bulk/01_gene/IV_01_invalid_date_created.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_02_invalid_date_updated.json b/src/test/resources/bulk/01_gene/IV_02_invalid_date_updated.json index a98c2819c..2d2c71be7 100644 --- a/src/test/resources/bulk/01_gene/IV_02_invalid_date_updated.json +++ b/src/test/resources/bulk/01_gene/IV_02_invalid_date_updated.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_03_invalid_taxon.json b/src/test/resources/bulk/01_gene/IV_03_invalid_taxon.json index 5e5b55f0b..bef77931c 100644 --- a/src/test/resources/bulk/01_gene/IV_03_invalid_taxon.json +++ b/src/test/resources/bulk/01_gene/IV_03_invalid_taxon.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_04_invalid_gene_symbol_name_type.json b/src/test/resources/bulk/01_gene/IV_04_invalid_gene_symbol_name_type.json index 9def50c3d..92b609db8 100644 --- a/src/test/resources/bulk/01_gene/IV_04_invalid_gene_symbol_name_type.json +++ b/src/test/resources/bulk/01_gene/IV_04_invalid_gene_symbol_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_05_invalid_gene_full_name_name_type.json b/src/test/resources/bulk/01_gene/IV_05_invalid_gene_full_name_name_type.json index d1c6b37a4..c1ad84955 100644 --- a/src/test/resources/bulk/01_gene/IV_05_invalid_gene_full_name_name_type.json +++ b/src/test/resources/bulk/01_gene/IV_05_invalid_gene_full_name_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_06_invalid_gene_systematic_name_name_type.json b/src/test/resources/bulk/01_gene/IV_06_invalid_gene_systematic_name_name_type.json index f8a85a8b2..a7dba910a 100644 --- a/src/test/resources/bulk/01_gene/IV_06_invalid_gene_systematic_name_name_type.json +++ b/src/test/resources/bulk/01_gene/IV_06_invalid_gene_systematic_name_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_07_invalid_gene_synonym_name_type.json b/src/test/resources/bulk/01_gene/IV_07_invalid_gene_synonym_name_type.json index 8c61f47ab..a7d85d4d7 100644 --- a/src/test/resources/bulk/01_gene/IV_07_invalid_gene_synonym_name_type.json +++ b/src/test/resources/bulk/01_gene/IV_07_invalid_gene_synonym_name_type.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_08_invalid_gene_symbol_synonym_scope.json b/src/test/resources/bulk/01_gene/IV_08_invalid_gene_symbol_synonym_scope.json index b696e0b3a..1505c46f4 100644 --- a/src/test/resources/bulk/01_gene/IV_08_invalid_gene_symbol_synonym_scope.json +++ b/src/test/resources/bulk/01_gene/IV_08_invalid_gene_symbol_synonym_scope.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_09_invalid_gene_full_name_synonym_scope.json b/src/test/resources/bulk/01_gene/IV_09_invalid_gene_full_name_synonym_scope.json index fbf328751..81e5be8d9 100644 --- a/src/test/resources/bulk/01_gene/IV_09_invalid_gene_full_name_synonym_scope.json +++ b/src/test/resources/bulk/01_gene/IV_09_invalid_gene_full_name_synonym_scope.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_10_invalid_gene_systematic_name_synonym_scope.json b/src/test/resources/bulk/01_gene/IV_10_invalid_gene_systematic_name_synonym_scope.json index 1f7b5a658..3781edcf5 100644 --- a/src/test/resources/bulk/01_gene/IV_10_invalid_gene_systematic_name_synonym_scope.json +++ b/src/test/resources/bulk/01_gene/IV_10_invalid_gene_systematic_name_synonym_scope.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_11_invalid_gene_synonym_synonym_scope.json b/src/test/resources/bulk/01_gene/IV_11_invalid_gene_synonym_synonym_scope.json index cacf4f6d6..3e96424f2 100644 --- a/src/test/resources/bulk/01_gene/IV_11_invalid_gene_synonym_synonym_scope.json +++ b/src/test/resources/bulk/01_gene/IV_11_invalid_gene_synonym_synonym_scope.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_12_invalid_gene_symbol_evidence.json b/src/test/resources/bulk/01_gene/IV_12_invalid_gene_symbol_evidence.json index d368562b6..1cf8558ae 100644 --- a/src/test/resources/bulk/01_gene/IV_12_invalid_gene_symbol_evidence.json +++ b/src/test/resources/bulk/01_gene/IV_12_invalid_gene_symbol_evidence.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_13_invalid_gene_full_name_evidence.json b/src/test/resources/bulk/01_gene/IV_13_invalid_gene_full_name_evidence.json index c08bcab4f..ad9055667 100644 --- a/src/test/resources/bulk/01_gene/IV_13_invalid_gene_full_name_evidence.json +++ b/src/test/resources/bulk/01_gene/IV_13_invalid_gene_full_name_evidence.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_14_invalid_gene_systematic_name_evidence.json b/src/test/resources/bulk/01_gene/IV_14_invalid_gene_systematic_name_evidence.json index d1bea9873..dba40ca74 100644 --- a/src/test/resources/bulk/01_gene/IV_14_invalid_gene_systematic_name_evidence.json +++ b/src/test/resources/bulk/01_gene/IV_14_invalid_gene_systematic_name_evidence.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_15_invalid_gene_synonym_evidence.json b/src/test/resources/bulk/01_gene/IV_15_invalid_gene_synonym_evidence.json index 0b93b444b..48b02ef70 100644 --- a/src/test/resources/bulk/01_gene/IV_15_invalid_gene_synonym_evidence.json +++ b/src/test/resources/bulk/01_gene/IV_15_invalid_gene_synonym_evidence.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_16_invalid_data_provider_source_organization_abbreviation.json b/src/test/resources/bulk/01_gene/IV_16_invalid_data_provider_source_organization_abbreviation.json index 025906d64..b721b0683 100644 --- a/src/test/resources/bulk/01_gene/IV_16_invalid_data_provider_source_organization_abbreviation.json +++ b/src/test/resources/bulk/01_gene/IV_16_invalid_data_provider_source_organization_abbreviation.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_17_invalid_data_provider_cross_reference_prefix.json b/src/test/resources/bulk/01_gene/IV_17_invalid_data_provider_cross_reference_prefix.json index 63e7fab44..1b243a094 100644 --- a/src/test/resources/bulk/01_gene/IV_17_invalid_data_provider_cross_reference_prefix.json +++ b/src/test/resources/bulk/01_gene/IV_17_invalid_data_provider_cross_reference_prefix.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "INVALID" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_18_invalid_data_provider_cross_reference_page_area.json b/src/test/resources/bulk/01_gene/IV_18_invalid_data_provider_cross_reference_page_area.json index b5b60c080..836618ff7 100644 --- a/src/test/resources/bulk/01_gene/IV_18_invalid_data_provider_cross_reference_page_area.json +++ b/src/test/resources/bulk/01_gene/IV_18_invalid_data_provider_cross_reference_page_area.json @@ -74,6 +74,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_19_invalid_gene_secondary_id_evidence.json b/src/test/resources/bulk/01_gene/IV_19_invalid_gene_secondary_id_evidence.json index 68469c5ea..817a30d26 100644 --- a/src/test/resources/bulk/01_gene/IV_19_invalid_gene_secondary_id_evidence.json +++ b/src/test/resources/bulk/01_gene/IV_19_invalid_gene_secondary_id_evidence.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/IV_20_invalid_gene_type.json b/src/test/resources/bulk/01_gene/IV_20_invalid_gene_type.json new file mode 100644 index 000000000..0380ddd42 --- /dev/null +++ b/src/test/resources/bulk/01_gene/IV_20_invalid_gene_type.json @@ -0,0 +1,114 @@ +[ + { + "mod_entity_id": "GENETEST:IV20", + "taxon_curie": "NCBITaxon:6239", + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00", + "gene_symbol_dto": { + "display_text": "Tg1", + "format_text": "Tg1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "nomenclature_symbol", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_full_name_dto": { + "display_text": "Test gene 1", + "format_text": "Test gene1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "full_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_systematic_name_dto": { + "display_text": "Tg1.1", + "format_text": "Tg1.1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "systematic_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_synonym_dtos": [ + { + "display_text": "Test gene synonym 1", + "format_text": "Test gene synonym 1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "unspecified", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "gene_secondary_id_dtos": [ + { + "secondary_id": "TEST:Secondary", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "data_provider_dto": { + "internal": false, + "obsolete": false, + "source_organization_abbreviation": "WB", + "cross_reference_dto": { + "referenced_curie": "TEST:0001", + "page_area": "homepage", + "display_name": "TEST:0001", + "prefix": "TEST" + } + }, + "cross_reference_dtos": [ + { + "internal": false, + "obsolete": false, + "referenced_curie": "TEST:Xref01", + "page_area": "homepage", + "display_name": "TEST:Xref01Display", + "prefix": "TEST" + } + ], + "gene_type_curie": "SO:Invalid" + } +] diff --git a/src/test/resources/bulk/01_gene/MN_01_no_non_required_fields_level_1.json b/src/test/resources/bulk/01_gene/MN_01_no_non_required_fields_level_1.json index 26fa33dd6..12c44bf1f 100644 --- a/src/test/resources/bulk/01_gene/MN_01_no_non_required_fields_level_1.json +++ b/src/test/resources/bulk/01_gene/MN_01_no_non_required_fields_level_1.json @@ -28,6 +28,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MN_02_no_non_required_fields_level_2.json b/src/test/resources/bulk/01_gene/MN_02_no_non_required_fields_level_2.json index 03c4cc582..700d8903b 100644 --- a/src/test/resources/bulk/01_gene/MN_02_no_non_required_fields_level_2.json +++ b/src/test/resources/bulk/01_gene/MN_02_no_non_required_fields_level_2.json @@ -45,6 +45,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_01_no_mod_ids.json b/src/test/resources/bulk/01_gene/MR_01_no_mod_ids.json index 005c6fbae..58d4ba5cf 100644 --- a/src/test/resources/bulk/01_gene/MR_01_no_mod_ids.json +++ b/src/test/resources/bulk/01_gene/MR_01_no_mod_ids.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_02_no_taxon.json b/src/test/resources/bulk/01_gene/MR_02_no_taxon.json index 1ddf2c697..53257323d 100644 --- a/src/test/resources/bulk/01_gene/MR_02_no_taxon.json +++ b/src/test/resources/bulk/01_gene/MR_02_no_taxon.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_03_no_gene_symbol.json b/src/test/resources/bulk/01_gene/MR_03_no_gene_symbol.json index ef2ac4272..dfe024261 100644 --- a/src/test/resources/bulk/01_gene/MR_03_no_gene_symbol.json +++ b/src/test/resources/bulk/01_gene/MR_03_no_gene_symbol.json @@ -64,6 +64,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_04_no_gene_symbol_display_text.json b/src/test/resources/bulk/01_gene/MR_04_no_gene_symbol_display_text.json index cb3c917b0..fff9ac49c 100644 --- a/src/test/resources/bulk/01_gene/MR_04_no_gene_symbol_display_text.json +++ b/src/test/resources/bulk/01_gene/MR_04_no_gene_symbol_display_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_05_no_gene_full_name_display_text.json b/src/test/resources/bulk/01_gene/MR_05_no_gene_full_name_display_text.json index 4439345a8..2bc4bf601 100644 --- a/src/test/resources/bulk/01_gene/MR_05_no_gene_full_name_display_text.json +++ b/src/test/resources/bulk/01_gene/MR_05_no_gene_full_name_display_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_06_no_gene_systematic_name_display_text.json b/src/test/resources/bulk/01_gene/MR_06_no_gene_systematic_name_display_text.json index f926be018..0213b8ac3 100644 --- a/src/test/resources/bulk/01_gene/MR_06_no_gene_systematic_name_display_text.json +++ b/src/test/resources/bulk/01_gene/MR_06_no_gene_systematic_name_display_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_07_no_gene_synonym_display_text.json b/src/test/resources/bulk/01_gene/MR_07_no_gene_synonym_display_text.json index 8be375cf7..b99063361 100644 --- a/src/test/resources/bulk/01_gene/MR_07_no_gene_synonym_display_text.json +++ b/src/test/resources/bulk/01_gene/MR_07_no_gene_synonym_display_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_08_no_gene_symbol_format_text.json b/src/test/resources/bulk/01_gene/MR_08_no_gene_symbol_format_text.json index 7a1bbac7e..320cb8664 100644 --- a/src/test/resources/bulk/01_gene/MR_08_no_gene_symbol_format_text.json +++ b/src/test/resources/bulk/01_gene/MR_08_no_gene_symbol_format_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_09_no_gene_full_name_format_text.json b/src/test/resources/bulk/01_gene/MR_09_no_gene_full_name_format_text.json index 82981897c..52e04193e 100644 --- a/src/test/resources/bulk/01_gene/MR_09_no_gene_full_name_format_text.json +++ b/src/test/resources/bulk/01_gene/MR_09_no_gene_full_name_format_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_10_no_gene_systematic_name_format_text.json b/src/test/resources/bulk/01_gene/MR_10_no_gene_systematic_name_format_text.json index e0ebfe171..b148257cc 100644 --- a/src/test/resources/bulk/01_gene/MR_10_no_gene_systematic_name_format_text.json +++ b/src/test/resources/bulk/01_gene/MR_10_no_gene_systematic_name_format_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_11_no_gene_synonym_format_text.json b/src/test/resources/bulk/01_gene/MR_11_no_gene_synonym_format_text.json index 39fda4f39..11104998d 100644 --- a/src/test/resources/bulk/01_gene/MR_11_no_gene_synonym_format_text.json +++ b/src/test/resources/bulk/01_gene/MR_11_no_gene_synonym_format_text.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_12_no_gene_symbol_name_type.json b/src/test/resources/bulk/01_gene/MR_12_no_gene_symbol_name_type.json index de01c6279..d6ae4616d 100644 --- a/src/test/resources/bulk/01_gene/MR_12_no_gene_symbol_name_type.json +++ b/src/test/resources/bulk/01_gene/MR_12_no_gene_symbol_name_type.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_13_no_gene_full_name_name_type.json b/src/test/resources/bulk/01_gene/MR_13_no_gene_full_name_name_type.json index 42ab3d545..dcc2cb915 100644 --- a/src/test/resources/bulk/01_gene/MR_13_no_gene_full_name_name_type.json +++ b/src/test/resources/bulk/01_gene/MR_13_no_gene_full_name_name_type.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_14_no_gene_systematic_name_name_type.json b/src/test/resources/bulk/01_gene/MR_14_no_gene_systematic_name_name_type.json index 4da1983b0..e52147494 100644 --- a/src/test/resources/bulk/01_gene/MR_14_no_gene_systematic_name_name_type.json +++ b/src/test/resources/bulk/01_gene/MR_14_no_gene_systematic_name_name_type.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_15_no_gene_synonym_name_type.json b/src/test/resources/bulk/01_gene/MR_15_no_gene_synonym_name_type.json index 5a43833dc..b90da4e15 100644 --- a/src/test/resources/bulk/01_gene/MR_15_no_gene_synonym_name_type.json +++ b/src/test/resources/bulk/01_gene/MR_15_no_gene_synonym_name_type.json @@ -73,6 +73,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_16_no_data_provider.json b/src/test/resources/bulk/01_gene/MR_16_no_data_provider.json index e11ca8af1..190d123d6 100644 --- a/src/test/resources/bulk/01_gene/MR_16_no_data_provider.json +++ b/src/test/resources/bulk/01_gene/MR_16_no_data_provider.json @@ -87,6 +87,7 @@ "date_created": "2022-03-09T22:10:12+00:00", "date_updated": "2022-03-10T22:10:12+00:00" } - ] + ], + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_17_no_data_provider_source_organization_abbreviation.json b/src/test/resources/bulk/01_gene/MR_17_no_data_provider_source_organization_abbreviation.json index e9fb337b2..e0181c302 100644 --- a/src/test/resources/bulk/01_gene/MR_17_no_data_provider_source_organization_abbreviation.json +++ b/src/test/resources/bulk/01_gene/MR_17_no_data_provider_source_organization_abbreviation.json @@ -97,6 +97,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_18_no_data_provider_cross_reference_referenced_curie.json b/src/test/resources/bulk/01_gene/MR_18_no_data_provider_cross_reference_referenced_curie.json index a10b9fd6c..984655b9a 100644 --- a/src/test/resources/bulk/01_gene/MR_18_no_data_provider_cross_reference_referenced_curie.json +++ b/src/test/resources/bulk/01_gene/MR_18_no_data_provider_cross_reference_referenced_curie.json @@ -97,6 +97,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_19_no_data_provider_cross_reference_display_name.json b/src/test/resources/bulk/01_gene/MR_19_no_data_provider_cross_reference_display_name.json index 9668dfab0..d9ca75371 100644 --- a/src/test/resources/bulk/01_gene/MR_19_no_data_provider_cross_reference_display_name.json +++ b/src/test/resources/bulk/01_gene/MR_19_no_data_provider_cross_reference_display_name.json @@ -97,6 +97,7 @@ "page_area": "homepage", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_20_no_data_provider_cross_reference_prefix.json b/src/test/resources/bulk/01_gene/MR_20_no_data_provider_cross_reference_prefix.json index 34c91a9a3..310a526f9 100644 --- a/src/test/resources/bulk/01_gene/MR_20_no_data_provider_cross_reference_prefix.json +++ b/src/test/resources/bulk/01_gene/MR_20_no_data_provider_cross_reference_prefix.json @@ -97,6 +97,7 @@ "page_area": "homepage", "display_name": "TEST:0001" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_21_no_data_provider_cross_reference_page_area.json b/src/test/resources/bulk/01_gene/MR_21_no_data_provider_cross_reference_page_area.json index 79ec357c4..20d35e158 100644 --- a/src/test/resources/bulk/01_gene/MR_21_no_data_provider_cross_reference_page_area.json +++ b/src/test/resources/bulk/01_gene/MR_21_no_data_provider_cross_reference_page_area.json @@ -97,6 +97,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_22_no_gene_secondary_id_secondary_id.json b/src/test/resources/bulk/01_gene/MR_22_no_gene_secondary_id_secondary_id.json index 7574129c8..08815a027 100644 --- a/src/test/resources/bulk/01_gene/MR_22_no_gene_secondary_id_secondary_id.json +++ b/src/test/resources/bulk/01_gene/MR_22_no_gene_secondary_id_secondary_id.json @@ -97,6 +97,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/MR_23_no_gene_type.json b/src/test/resources/bulk/01_gene/MR_23_no_gene_type.json new file mode 100644 index 000000000..6ea437290 --- /dev/null +++ b/src/test/resources/bulk/01_gene/MR_23_no_gene_type.json @@ -0,0 +1,113 @@ +[ + { + "mod_entity_id": "GENETEST:MR23", + "taxon_curie": "NCBITaxon:6239", + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00", + "gene_symbol_dto": { + "display_text": "Tg1", + "format_text": "Tg1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "nomenclature_symbol", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_full_name_dto": { + "display_text": "Test gene 1", + "format_text": "Test gene1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "full_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_systematic_name_dto": { + "display_text": "Tg1.1", + "format_text": "Tg1.1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "systematic_name", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + }, + "gene_synonym_dtos": [ + { + "display_text": "Test gene synonym 1", + "format_text": "Test gene synonym 1", + "synonym_scope_name": "exact", + "synonym_url": "https://alliancegenome.org/test", + "name_type_name": "unspecified", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "gene_secondary_id_dtos": [ + { + "secondary_id": "TEST:Secondary", + "evidence_curies": [ + "PMID:25920550" + ], + "internal": true, + "obsolete": true, + "created_by_curie": "GENETEST:Person0001", + "updated_by_curie": "GENETEST:Person0002", + "date_created": "2022-03-09T22:10:12+00:00", + "date_updated": "2022-03-10T22:10:12+00:00" + } + ], + "data_provider_dto": { + "internal": false, + "obsolete": false, + "source_organization_abbreviation": "WB", + "cross_reference_dto": { + "referenced_curie": "TEST:0001", + "page_area": "homepage", + "display_name": "TEST:0001", + "prefix": "TEST" + } + }, + "cross_reference_dtos": [ + { + "internal": false, + "obsolete": false, + "referenced_curie": "TEST:Xref01", + "page_area": "homepage", + "display_name": "TEST:Xref01Display", + "prefix": "TEST" + } + ] + } +] diff --git a/src/test/resources/bulk/01_gene/UD_01_update_all_except_default_fields.json b/src/test/resources/bulk/01_gene/UD_01_update_all_except_default_fields.json index 602bd2553..a545e0d26 100644 --- a/src/test/resources/bulk/01_gene/UD_01_update_all_except_default_fields.json +++ b/src/test/resources/bulk/01_gene/UD_01_update_all_except_default_fields.json @@ -98,6 +98,7 @@ "display_name": "TEST2:Xref02Display", "prefix": "TEST2" } - ] + ], + "gene_type_curie": "SO:0000336" } ] diff --git a/src/test/resources/bulk/01_gene/UE_01_update_empty_non_required_fields.json b/src/test/resources/bulk/01_gene/UE_01_update_empty_non_required_fields.json index f3c43c1a4..ee6325874 100644 --- a/src/test/resources/bulk/01_gene/UE_01_update_empty_non_required_fields.json +++ b/src/test/resources/bulk/01_gene/UE_01_update_empty_non_required_fields.json @@ -87,6 +87,7 @@ "prefix": "TEST" } }, - "cross_reference_dtos": [] + "cross_reference_dtos": [], + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/UM_01_update_no_non_required_fields_level_1.json b/src/test/resources/bulk/01_gene/UM_01_update_no_non_required_fields_level_1.json index c22bf5575..908fb29df 100644 --- a/src/test/resources/bulk/01_gene/UM_01_update_no_non_required_fields_level_1.json +++ b/src/test/resources/bulk/01_gene/UM_01_update_no_non_required_fields_level_1.json @@ -28,6 +28,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/UM_02_update_no_non_required_fields_level_2.json b/src/test/resources/bulk/01_gene/UM_02_update_no_non_required_fields_level_2.json index e4df9b57c..8b73ec4ae 100644 --- a/src/test/resources/bulk/01_gene/UM_02_update_no_non_required_fields_level_2.json +++ b/src/test/resources/bulk/01_gene/UM_02_update_no_non_required_fields_level_2.json @@ -39,6 +39,7 @@ "internal": false, "obsolete": false, "source_organization_abbreviation": "WB" - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/VT_01_valid_taxon_for_HUMAN.json b/src/test/resources/bulk/01_gene/VT_01_valid_taxon_for_HUMAN.json index 6e1f2ac08..e750a3391 100644 --- a/src/test/resources/bulk/01_gene/VT_01_valid_taxon_for_HUMAN.json +++ b/src/test/resources/bulk/01_gene/VT_01_valid_taxon_for_HUMAN.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] diff --git a/src/test/resources/bulk/01_gene/VT_02_valid_taxon_for_RGD.json b/src/test/resources/bulk/01_gene/VT_02_valid_taxon_for_RGD.json index 3bd4816ad..ad676a5a0 100644 --- a/src/test/resources/bulk/01_gene/VT_02_valid_taxon_for_RGD.json +++ b/src/test/resources/bulk/01_gene/VT_02_valid_taxon_for_RGD.json @@ -98,6 +98,7 @@ "display_name": "TEST:0001", "prefix": "TEST" } - } + }, + "gene_type_curie": "SO:0001217" } ] From ed38d452d8109a439a114ef295c3aeeb67b4f28a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 4 Jul 2024 16:29:32 +0100 Subject: [PATCH 022/342] Prettify --- src/main/cliapp/src/constants/SortFields.js | 2 +- .../cliapp/src/containers/genesPage/mockData/mockData.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/cliapp/src/constants/SortFields.js b/src/main/cliapp/src/constants/SortFields.js index 8c0471a92..4e7f7ed92 100644 --- a/src/main/cliapp/src/constants/SortFields.js +++ b/src/main/cliapp/src/constants/SortFields.js @@ -73,7 +73,7 @@ export const SORT_FIELDS = Object.freeze([ 'geneSymbol.displayText', 'geneSecondaryIds.secondaryId', 'geneSystematicName.displayText', - "geneType.name", + 'geneType.name', 'inchi', 'inchiKey', 'iupac', diff --git a/src/main/cliapp/src/containers/genesPage/mockData/mockData.js b/src/main/cliapp/src/containers/genesPage/mockData/mockData.js index 15cd71d69..d09b3efe9 100644 --- a/src/main/cliapp/src/containers/genesPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/genesPage/mockData/mockData.js @@ -31,9 +31,9 @@ export const data = { geneType: { internal: false, obsolete: false, - curie: "SO:0001272", - name: "tRNA_gene", - id: 25665 + curie: 'SO:0001272', + name: 'tRNA_gene', + id: 25665, }, dataProvider: { internal: false, From 4ed7a986ec9939af0f0082ff251c515ec4180ddf Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 4 Jul 2024 16:36:22 +0100 Subject: [PATCH 023/342] Fix UI test --- .../src/containers/genesPage/__tests__/GenesTable.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js b/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js index dc369c34e..2b586bd35 100644 --- a/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js +++ b/src/main/cliapp/src/containers/genesPage/__tests__/GenesTable.test.js @@ -46,7 +46,7 @@ describe('', () => { const systematicNameTd = await result.findByText('C35C5.5'); const taxonTd = await result.findByText(/Caenorhabditis elegans/i); const xrefsTd = await result.findByText(/WBGene00003771Xref \(gene\)/); - const geneTypeTd = await result.findByText(/tRNA_gene \(SO:0001271\)/i); + const geneTypeTd = await result.findByText(/protein_coding_gene/i); await waitFor(() => { expect(modEntityIdTd).toBeInTheDocument(); From 3fd08cd03db8c05b41c85666019adcf33abfe883 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 8 Jul 2024 22:56:21 +0100 Subject: [PATCH 024/342] Replace DPO ontology with full FlyBase controlled vocabulary --- .../src/containers/layout/SiteLayout.js | 2 +- src/main/cliapp/src/routes.js | 4 +-- .../cliapp/src/service/DataLoadService.js | 2 +- ...oller.java => FbcvTermCrudController.java} | 16 ++++++------ .../{DpoTermDAO.java => FbcvTermDAO.java} | 8 +++--- .../enums/OntologyBulkLoadType.java | 4 +-- ...erface.java => FbcvTermCrudInterface.java} | 6 ++--- .../jobs/executors/OntologyExecutor.java | 10 ++++---- .../ontology/{DPOTerm.java => FBCVTerm.java} | 4 +-- ...oTermService.java => FbcvTermService.java} | 10 ++++---- .../v0.36.0.3__fbcv_ontology_load.sql | 25 +++++++++++++++++++ 11 files changed, 58 insertions(+), 33 deletions(-) rename src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/{DpoTermCrudController.java => FbcvTermCrudController.java} (52%) rename src/main/java/org/alliancegenome/curation_api/dao/ontology/{DpoTermDAO.java => FbcvTermDAO.java} (51%) rename src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/{DpoTermCrudInterface.java => FbcvTermCrudInterface.java} (71%) rename src/main/java/org/alliancegenome/curation_api/model/entities/ontology/{DPOTerm.java => FBCVTerm.java} (88%) rename src/main/java/org/alliancegenome/curation_api/services/ontology/{DpoTermService.java => FbcvTermService.java} (55%) create mode 100644 src/main/resources/db/migration/v0.36.0.3__fbcv_ontology_load.sql diff --git a/src/main/cliapp/src/containers/layout/SiteLayout.js b/src/main/cliapp/src/containers/layout/SiteLayout.js index 5651a92d1..7c8838a6b 100644 --- a/src/main/cliapp/src/containers/layout/SiteLayout.js +++ b/src/main/cliapp/src/containers/layout/SiteLayout.js @@ -282,6 +282,7 @@ export const SiteLayout = (props) => { }, ], }, + { label: 'Flybase Controlled Vocabulary (FBcv)', icon: 'pi pi-fw pi-home', to: '/ontology/fbcv' }, { label: 'Gene Ontology (GO)', icon: 'pi pi-fw pi-home', to: '/ontology/go' }, { label: 'Genotype Ontology (GENO)', icon: 'pi pi-fw pi-home', to: '/ontology/geno' }, { label: 'Measurement Method Ontology (MMO)', icon: 'pi pi-fw pi-home', to: '/ontology/mmo' }, @@ -304,7 +305,6 @@ export const SiteLayout = (props) => { icon: 'pi pi-fw pi-home', to: '/ontology/wbpheno', }, - { label: 'Drosophila Phenotype Ontology (DPO)', icon: 'pi pi-fw pi-home', to: '/ontology/dpo' }, { label: 'Human Phenotype Ontology (HP)', icon: 'pi pi-fw pi-home', to: '/ontology/hp' }, { label: 'Mammalian Phenotype Ontology (MP)', icon: 'pi pi-fw pi-home', to: '/ontology/mp' }, { label: 'Xenopus Phenotype Ontology (XPO)', icon: 'pi pi-fw pi-home', to: '/ontology/xpo' }, diff --git a/src/main/cliapp/src/routes.js b/src/main/cliapp/src/routes.js index 740db89a3..e771b5c63 100644 --- a/src/main/cliapp/src/routes.js +++ b/src/main/cliapp/src/routes.js @@ -472,10 +472,10 @@ export default ( )} /> ( - + )} /> diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 90612fe46..5e5b729fc 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -122,9 +122,9 @@ export class DataLoadService extends BaseAuthService { 'CMO', 'DAO', 'DO', - 'DPO', 'ECO', 'EMAPA', + 'FBCV', 'FBDV', 'GENO', 'GO', diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/DpoTermCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/FbcvTermCrudController.java similarity index 52% rename from src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/DpoTermCrudController.java rename to src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/FbcvTermCrudController.java index 228eb9190..d15a221be 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/DpoTermCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ontology/FbcvTermCrudController.java @@ -1,28 +1,28 @@ package org.alliancegenome.curation_api.controllers.crud.ontology; import org.alliancegenome.curation_api.controllers.base.BaseOntologyTermController; -import org.alliancegenome.curation_api.dao.ontology.DpoTermDAO; -import org.alliancegenome.curation_api.interfaces.crud.ontology.DpoTermCrudInterface; -import org.alliancegenome.curation_api.model.entities.ontology.DPOTerm; +import org.alliancegenome.curation_api.dao.ontology.FbcvTermDAO; +import org.alliancegenome.curation_api.interfaces.crud.ontology.FbcvTermCrudInterface; +import org.alliancegenome.curation_api.model.entities.ontology.FBCVTerm; import org.alliancegenome.curation_api.services.helpers.GenericOntologyLoadConfig; -import org.alliancegenome.curation_api.services.ontology.DpoTermService; +import org.alliancegenome.curation_api.services.ontology.FbcvTermService; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @RequestScoped -public class DpoTermCrudController extends BaseOntologyTermController implements DpoTermCrudInterface { +public class FbcvTermCrudController extends BaseOntologyTermController implements FbcvTermCrudInterface { @Inject - DpoTermService dpoTermService; + FbcvTermService fbcvTermService; @Override @PostConstruct public void init() { GenericOntologyLoadConfig config = new GenericOntologyLoadConfig(); - config.getAltNameSpaces().add("phenotypic_class"); - setService(dpoTermService, DPOTerm.class, config); + config.setLoadOnlyIRIPrefix("FBcv"); + setService(fbcvTermService, FBCVTerm.class, config); } } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ontology/DpoTermDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ontology/FbcvTermDAO.java similarity index 51% rename from src/main/java/org/alliancegenome/curation_api/dao/ontology/DpoTermDAO.java rename to src/main/java/org/alliancegenome/curation_api/dao/ontology/FbcvTermDAO.java index e50a341a1..7047be3ac 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/ontology/DpoTermDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/ontology/FbcvTermDAO.java @@ -1,15 +1,15 @@ package org.alliancegenome.curation_api.dao.ontology; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; -import org.alliancegenome.curation_api.model.entities.ontology.DPOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.FBCVTerm; import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped -public class DpoTermDAO extends BaseSQLDAO { +public class FbcvTermDAO extends BaseSQLDAO { - protected DpoTermDAO() { - super(DPOTerm.class); + protected FbcvTermDAO() { + super(FBCVTerm.class); } } diff --git a/src/main/java/org/alliancegenome/curation_api/enums/OntologyBulkLoadType.java b/src/main/java/org/alliancegenome/curation_api/enums/OntologyBulkLoadType.java index 683108e9a..666919be6 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/OntologyBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/OntologyBulkLoadType.java @@ -8,7 +8,7 @@ import org.alliancegenome.curation_api.model.entities.ontology.CMOTerm; import org.alliancegenome.curation_api.model.entities.ontology.DAOTerm; import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.DPOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.FBCVTerm; import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; import org.alliancegenome.curation_api.model.entities.ontology.EMAPATerm; import org.alliancegenome.curation_api.model.entities.ontology.FBDVTerm; @@ -75,7 +75,7 @@ public enum OntologyBulkLoadType { WBPheno(WBPhenotypeTerm.class), VT(VTTerm.class), HP(HPTerm.class), - DPO(DPOTerm.class), + FBCV(FBCVTerm.class), MMO(MMOTerm.class), APO(APOTerm.class), MI(MITerm.class), diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/DpoTermCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/FbcvTermCrudInterface.java similarity index 71% rename from src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/DpoTermCrudInterface.java rename to src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/FbcvTermCrudInterface.java index a393a22c9..ca2f17636 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/DpoTermCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ontology/FbcvTermCrudInterface.java @@ -1,7 +1,7 @@ package org.alliancegenome.curation_api.interfaces.crud.ontology; import org.alliancegenome.curation_api.interfaces.base.BaseOntologyTermCrudInterface; -import org.alliancegenome.curation_api.model.entities.ontology.DPOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.FBCVTerm; import org.eclipse.microprofile.openapi.annotations.tags.Tag; import jakarta.ws.rs.Consumes; @@ -9,10 +9,10 @@ import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; -@Path("/dpoterm") +@Path("/fbcvterm") @Tag(name = "CRUD - Ontology") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public interface DpoTermCrudInterface extends BaseOntologyTermCrudInterface { +public interface FbcvTermCrudInterface extends BaseOntologyTermCrudInterface { } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java index f6cc9d2b3..cbd396d53 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java @@ -21,7 +21,7 @@ import org.alliancegenome.curation_api.services.ontology.CmoTermService; import org.alliancegenome.curation_api.services.ontology.DaoTermService; import org.alliancegenome.curation_api.services.ontology.DoTermService; -import org.alliancegenome.curation_api.services.ontology.DpoTermService; +import org.alliancegenome.curation_api.services.ontology.FbcvTermService; import org.alliancegenome.curation_api.services.ontology.EcoTermService; import org.alliancegenome.curation_api.services.ontology.EmapaTermService; import org.alliancegenome.curation_api.services.ontology.FbdvTermService; @@ -95,7 +95,7 @@ public class OntologyExecutor { @Inject ObiTermService obiTermService; @Inject PatoTermService patoTermService; @Inject WbPhenotypeTermService wbPhenotypeTermService; - @Inject DpoTermService dpoTermService; + @Inject FbcvTermService fbcvTermService; @Inject MmoTermService mmoTermService; @Inject ApoTermService apoTermService; @Inject MiTermService miTermService; @@ -202,9 +202,9 @@ public void execLoad(BulkLoadFile bulkLoadFile) throws Exception { config.setLoadOnlyIRIPrefix("HP"); processTerms(bulkLoadFile, hpTermService, config); } - case DPO -> { - config.getAltNameSpaces().add("phenotypic_class"); - processTerms(bulkLoadFile, dpoTermService, config); + case FBCV -> { + config.setLoadOnlyIRIPrefix("FBcv"); + processTerms(bulkLoadFile, fbcvTermService, config); } case MMO -> processTerms(bulkLoadFile, mmoTermService, config); case APO -> { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/DPOTerm.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/FBCVTerm.java similarity index 88% rename from src/main/java/org/alliancegenome/curation_api/model/entities/ontology/DPOTerm.java rename to src/main/java/org/alliancegenome/curation_api/model/entities/ontology/FBCVTerm.java index ab512be7f..0e4d4fa4d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/DPOTerm.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/FBCVTerm.java @@ -14,7 +14,7 @@ @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) -@AGRCurationSchemaVersion(min = LinkMLSchemaConstants.MIN_ONTOLOGY_RELEASE, max = LinkMLSchemaConstants.MAX_ONTOLOGY_RELEASE, dependencies = { PhenotypeTerm.class }) -public class DPOTerm extends PhenotypeTerm { +@AGRCurationSchemaVersion(min = LinkMLSchemaConstants.MIN_ONTOLOGY_RELEASE, max = LinkMLSchemaConstants.MAX_ONTOLOGY_RELEASE, dependencies = { OntologyTerm.class }) +public class FBCVTerm extends OntologyTerm { } diff --git a/src/main/java/org/alliancegenome/curation_api/services/ontology/DpoTermService.java b/src/main/java/org/alliancegenome/curation_api/services/ontology/FbcvTermService.java similarity index 55% rename from src/main/java/org/alliancegenome/curation_api/services/ontology/DpoTermService.java rename to src/main/java/org/alliancegenome/curation_api/services/ontology/FbcvTermService.java index b1ed0326e..92b1de910 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ontology/DpoTermService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ontology/FbcvTermService.java @@ -1,7 +1,7 @@ package org.alliancegenome.curation_api.services.ontology; -import org.alliancegenome.curation_api.dao.ontology.DpoTermDAO; -import org.alliancegenome.curation_api.model.entities.ontology.DPOTerm; +import org.alliancegenome.curation_api.dao.ontology.FbcvTermDAO; +import org.alliancegenome.curation_api.model.entities.ontology.FBCVTerm; import org.alliancegenome.curation_api.services.base.BaseOntologyTermService; import jakarta.annotation.PostConstruct; @@ -9,15 +9,15 @@ import jakarta.inject.Inject; @RequestScoped -public class DpoTermService extends BaseOntologyTermService { +public class FbcvTermService extends BaseOntologyTermService { @Inject - DpoTermDAO dpoTermDAO; + FbcvTermDAO fbcvTermDAO; @Override @PostConstruct protected void init() { - setSQLDao(dpoTermDAO); + setSQLDao(fbcvTermDAO); } } diff --git a/src/main/resources/db/migration/v0.36.0.3__fbcv_ontology_load.sql b/src/main/resources/db/migration/v0.36.0.3__fbcv_ontology_load.sql new file mode 100644 index 000000000..bd39d30c7 --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.3__fbcv_ontology_load.sql @@ -0,0 +1,25 @@ +UPDATE ontologyterm SET ontologytermtype = 'FBCVTerm' WHERE ontologytermtype = 'DPOTerm'; + +DELETE FROM bulkloadfileexception WHERE bulkloadfilehistory_id IN ( + SELECT id FROM bulkloadfilehistory WHERE bulkloadfile_id IN ( + SELECT id FROM bulkloadfile WHERE bulkload_id = ( + SELECT id FROM bulkload WHERE ontologytype = 'DPO' + ) + ) +); + +DELETE FROM bulkloadfilehistory WHERE bulkloadfile_id IN ( + SELECT id FROM bulkloadfile WHERE bulkload_id = ( + SELECT id FROM bulkload WHERE ontologytype = 'DPO' + ) +); + +DELETE FROM bulkloadfile WHERE bulkload_id = ( + SELECT id FROM bulkload WHERE ontologytype = 'DPO' +); + +UPDATE bulkurlload SET bulkloadurl = 'http://purl.obolibrary.org/obo/fbcv.owl' WHERE id = ( + SELECT id FROM bulkload WHERE ontologytype = 'DPO' +); + +UPDATE bulkload SET name = 'FBcv Ontology Load', ontologytype = 'FBCV', bulkloadstatus = 'STOPPED' WHERE ontologytype = 'DPO'; From c2534bc3caf5a468475a79fad873a8245b515713 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 2 Jul 2024 14:24:55 -0500 Subject: [PATCH 025/342] SCRUM-4185 updated executor, service, and validator --- ...equenceTargetingReagentCrudController.java | 2 +- .../SequenceTargetingReagentExecutor.java | 95 +++++++++++++++++-- .../SequenceTargetingReagentService.java | 70 ++++++++++++++ ...quenceTargetingReagentFmsDTOValidator.java | 69 +++++++++++++- 4 files changed, 221 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java index e3d52bf3c..61afd749a 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java @@ -30,7 +30,7 @@ protected void init() { @Override public APIResponse updateSequenceTargetingReagent(String dataProvider, SequenceTargetingReagentIngestFmsDTO sqtrFmsDTO) { - return sqtrExecutor.runLoadApi(sqtrService, dataProvider, sqtrFmsDTO.getData()); + return sqtrExecutor.runLoadApi(dataProvider, sqtrFmsDTO.getData()); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index 3e48a6edd..69e538733 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -6,13 +6,19 @@ import java.util.zip.GZIPInputStream; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.SequenceTargetingReagentService; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.ApplicationScoped; @@ -29,33 +35,38 @@ public void execLoad(BulkLoadFile bulkLoadFile) { BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); SequenceTargetingReagentIngestFmsDTO sqtrIngestFmsDTO = mapper.readValue( - new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), SequenceTargetingReagentIngestFmsDTO.class); + new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), + SequenceTargetingReagentIngestFmsDTO.class); bulkLoadFile.setRecordCount(sqtrIngestFmsDTO.getData().size()); - AGRCurationSchemaVersion version = SequenceTargetingReagent.class.getAnnotation(AGRCurationSchemaVersion.class); + AGRCurationSchemaVersion version = SequenceTargetingReagent.class + .getAnnotation(AGRCurationSchemaVersion.class); bulkLoadFile.setLinkMLSchemaVersion(version.max()); - if (sqtrIngestFmsDTO.getMetaData() != null && StringUtils.isNotBlank(sqtrIngestFmsDTO.getMetaData().getRelease())) { + if (sqtrIngestFmsDTO.getMetaData() != null + && StringUtils.isNotBlank(sqtrIngestFmsDTO.getMetaData().getRelease())) { bulkLoadFile.setAllianceMemberReleaseVersion(sqtrIngestFmsDTO.getMetaData().getRelease()); } BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); List sqtrIdsLoaded = new ArrayList<>(); - List sqtrIdsBefore = new ArrayList<>(); + List sqtrIdsBefore = sqtrService.getIdsByDataProvider(dataProvider.name()); + List sqtrGeneAssociationIdsLoaded = new ArrayList<>(); + List sqtrGeneAssociationIdsBefore = sqtrService.getIdsByDataProvider(dataProvider.name()); + bulkLoadFileDAO.merge(bulkLoadFile); BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrIngestFmsDTO.getData().size()); - boolean success = runLoad(sqtrService, history, dataProvider, sqtrIngestFmsDTO.getData(), sqtrIdsLoaded); + runLoad(history, dataProvider, sqtrIngestFmsDTO.getData(), sqtrIdsLoaded, sqtrGeneAssociationIdsLoaded); + + runCleanup(sqtrService, history, dataProvider.name(), sqtrIdsBefore, sqtrIdsLoaded, "SQTR", bulkLoadFile.getMd5Sum()); + runCleanup(sqtrService, history, dataProvider.name(), sqtrGeneAssociationIdsBefore, sqtrGeneAssociationIdsLoaded, "SQTR Gene Associations", bulkLoadFile.getMd5Sum()); - if (success) { - runCleanup(sqtrService, history, dataProvider.name(), sqtrIdsBefore, sqtrIdsLoaded, "SQTR", bulkLoadFile.getMd5Sum()); - } - history.finishLoad(); - + updateHistory(history); } catch (Exception e) { failLoad(bulkLoadFile, e); @@ -63,4 +74,68 @@ public void execLoad(BulkLoadFile bulkLoadFile) { } } + public APIResponse runLoadApi(String dataProviderName, List sqtrDTOs) { + List sqtrIdsLoaded = new ArrayList<>(); + List sqtrGeneAssociationIdsLoaded = new ArrayList<>(); + + BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrDTOs.size()); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + runLoad(history, dataProvider, sqtrDTOs, sqtrIdsLoaded, sqtrGeneAssociationIdsLoaded); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List sqtrs, List sqtrIdsLoaded, List sqtrGeneAssociationIdsLoaded) { + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("Sequence Targeting Reagent DTO Update for " + dataProvider.name(), sqtrs.size() * 2); + + loadSequenceTargetingReagents(history, sqtrs, sqtrIdsLoaded, dataProvider, ph); + loadSequenceTargetingReagentGeneAssociations(history, sqtrs, sqtrGeneAssociationIdsLoaded, dataProvider, ph); + + ph.finishProcess(); + + } + + private void loadSequenceTargetingReagents(BulkLoadFileHistory history, List sqtrs, List idsLoaded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + for (SequenceTargetingReagentFmsDTO dto : sqtrs) { + try { + SequenceTargetingReagent dbObject = sqtrService.upsert(dto, dataProvider); + history.incrementCompleted(); + if (idsLoaded != null) { + idsLoaded.add(dbObject.getId()); + } + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + } + } + + private void loadSequenceTargetingReagentGeneAssociations(BulkLoadFileHistory history, List sqtrs, List idsLoaded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + + for (SequenceTargetingReagentFmsDTO dto : sqtrs) { + try { + List associationIds = sqtrService.addGeneAssociations(dto, dataProvider); + history.incrementCompleted(); + if (idsLoaded != null) { + idsLoaded.addAll(associationIds); + } + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + } + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index f5bc01489..66bd201a1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -1,10 +1,20 @@ package org.alliancegenome.curation_api.services; +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; +import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.dto.fms.SequenceTargetingReagentFmsDTOValidator; @@ -25,10 +35,70 @@ public class SequenceTargetingReagentService extends BaseEntityCrudService addGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + + List associations = sqtrDtoValidator.validateSQTRGeneAssociationFmsDTO(dto, dataProvider); + + for (SequenceTargetingReagentGeneAssociation association : associations) { + if (association != null) { + addAssociationToSQTR(association); + addAssociationToGene(association); + } + } + + return associations.stream().map(SequenceTargetingReagentGeneAssociation::getId).collect(Collectors.toList()); + } + + private void addAssociationToSQTR(SequenceTargetingReagentGeneAssociation association) { + SequenceTargetingReagent sqtr = association.getSequenceTargetingReagentAssociationSubject(); + List currentAssociations = sqtr.getSequenceTargetingReagentGeneAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + sqtr.setSequenceTargetingReagentGeneAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { + currentAssociationIds.add(sqtrga.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + } + + private void addAssociationToGene(SequenceTargetingReagentGeneAssociation association) { + Gene gene = association.getSequenceTargetingReagentGeneAssociationObject(); + List currentAssociations = gene.getSequenceTargetingReagentGeneAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + gene.setSequenceTargetingReagentGeneAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { + currentAssociationIds.add(sqtrga.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + + } + public List getIdsByDataProvider(String dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider); + List ids = sqtrDAO.findIdsByParams(params); + ids.removeIf(Objects::isNull); + return ids; } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java index 6cd17f9cd..a8e28b493 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java @@ -1,15 +1,24 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; +import java.util.ArrayList; +import java.util.List; + import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.GeneService; +import org.alliancegenome.curation_api.services.SequenceTargetingReagentService; +import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -19,14 +28,19 @@ @RequestScoped public class SequenceTargetingReagentFmsDTOValidator { - @Inject - DataProviderService dataProviderService; + @Inject DataProviderService dataProviderService; + + @Inject GeneService geneService; - @Inject - SequenceTargetingReagentDAO sqtrDAO; + @Inject SequenceTargetingReagentDAO sqtrDAO; @Inject NcbiTaxonTermService ncbiTaxonTermService; + @Inject SequenceTargetingReagentService sqtrService; + + @Inject VocabularyTermService vocabularyTermService; + + public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { ObjectResponse sqtrResponse = new ObjectResponse<>(); @@ -87,4 +101,51 @@ public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDT return sqtr; } + + public List validateSQTRGeneAssociationFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + + List strGeneAssociations = new ArrayList<>(); + ObjectResponse sqtrResponse = new ObjectResponse<>(); + + SequenceTargetingReagent sqtr; + SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", dto.getPrimaryId()); + + if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("modEntityId", ValidationConstants.INVALID_MESSAGE + " (" + dto.getPrimaryId() + ")"); + sqtr = new SequenceTargetingReagent(); + } else { + sqtr = sqtrSearchResponse.getSingleResult(); + } + + + VocabularyTerm relation; + SearchResponse relationSearchResponse = vocabularyTermService.findByField("name", "targets"); + if (relationSearchResponse == null || relationSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("relation", ValidationConstants.INVALID_MESSAGE + " (" + "targets" + ")"); + relation = new VocabularyTerm(); + } else { + relation = relationSearchResponse.getSingleResult(); + } + + for (String geneId : dto.getTargetGeneIds()) { + Gene gene = geneService.findByIdentifierString(geneId); + + if (gene == null) { + sqtrResponse.addErrorMessage("targetGeneIds", ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); + } else { + SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); + strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); + strGeneAssociation.setRelation(relation); + strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); + + strGeneAssociations.add(strGeneAssociation); + } + + } + if (sqtrResponse.hasErrors()) { + throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); + } + + return strGeneAssociations; + } } From 452982b05cdf3f95e7e8d03a3a4295a1e11702d4 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 8 Jul 2024 10:25:39 -0500 Subject: [PATCH 026/342] SCRUM-4185 added service, validator, and dao for sqtrGeneAssociations --- ...nceTargetingReagentGeneAssociationDAO.java | 15 +++ .../SequenceTargetingReagentExecutor.java | 5 +- .../SequenceTargetingReagentService.java | 52 --------- ...argetingReagentGeneAssociationService.java | 105 ++++++++++++++++++ ...ReagentGeneAssociationFmsDTOValidator.java | 76 +++++++++++++ ...quenceTargetingReagentFmsDTOValidator.java | 46 -------- 6 files changed, 200 insertions(+), 99 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/SequenceTargetingReagentGeneAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/SequenceTargetingReagentGeneAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/SequenceTargetingReagentGeneAssociationDAO.java new file mode 100644 index 000000000..bc512d663 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/SequenceTargetingReagentGeneAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class SequenceTargetingReagentGeneAssociationDAO extends BaseSQLDAO { + + protected SequenceTargetingReagentGeneAssociationDAO() { + super(SequenceTargetingReagentGeneAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index 69e538733..708b12cfe 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -10,6 +10,7 @@ import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; @@ -18,6 +19,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.SequenceTargetingReagentService; +import org.alliancegenome.curation_api.services.associations.SequenceTargetingReagentGeneAssociationService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.StringUtils; @@ -27,6 +29,7 @@ @ApplicationScoped public class SequenceTargetingReagentExecutor extends LoadFileExecutor { @Inject SequenceTargetingReagentService sqtrService; + @Inject SequenceTargetingReagentGeneAssociationService sqtrGeneAssociationService; public void execLoad(BulkLoadFile bulkLoadFile) { @@ -122,7 +125,7 @@ private void loadSequenceTargetingReagentGeneAssociations(BulkLoadFileHistory hi for (SequenceTargetingReagentFmsDTO dto : sqtrs) { try { - List associationIds = sqtrService.addGeneAssociations(dto, dataProvider); + List associationIds = sqtrGeneAssociationService.addGeneAssociations(dto, dataProvider); history.incrementCompleted(); if (idsLoaded != null) { idsLoaded.addAll(associationIds); diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index 66bd201a1..a11689115 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -42,58 +42,6 @@ public SequenceTargetingReagent upsert(SequenceTargetingReagentFmsDTO dto, Backe return sqtrDAO.persist(sqtr); } - @Transactional - public List addGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - - List associations = sqtrDtoValidator.validateSQTRGeneAssociationFmsDTO(dto, dataProvider); - - for (SequenceTargetingReagentGeneAssociation association : associations) { - if (association != null) { - addAssociationToSQTR(association); - addAssociationToGene(association); - } - } - - return associations.stream().map(SequenceTargetingReagentGeneAssociation::getId).collect(Collectors.toList()); - } - - private void addAssociationToSQTR(SequenceTargetingReagentGeneAssociation association) { - SequenceTargetingReagent sqtr = association.getSequenceTargetingReagentAssociationSubject(); - List currentAssociations = sqtr.getSequenceTargetingReagentGeneAssociations(); - if (currentAssociations == null) { - currentAssociations = new ArrayList<>(); - sqtr.setSequenceTargetingReagentGeneAssociations(currentAssociations); - } - - List currentAssociationIds = new ArrayList<>(); - for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { - currentAssociationIds.add(sqtrga.getId()); - } - - if (!currentAssociationIds.contains(association.getId())) { - currentAssociations.add(association); - } - } - - private void addAssociationToGene(SequenceTargetingReagentGeneAssociation association) { - Gene gene = association.getSequenceTargetingReagentGeneAssociationObject(); - List currentAssociations = gene.getSequenceTargetingReagentGeneAssociations(); - if (currentAssociations == null) { - currentAssociations = new ArrayList<>(); - gene.setSequenceTargetingReagentGeneAssociations(currentAssociations); - } - - List currentAssociationIds = new ArrayList<>(); - for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { - currentAssociationIds.add(sqtrga.getId()); - } - - if (!currentAssociationIds.contains(association.getId())) { - currentAssociations.add(association); - } - - } - public List getIdsByDataProvider(String dataProvider) { Map params = new HashMap<>(); params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider); diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java new file mode 100644 index 000000000..8a920fa87 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -0,0 +1,105 @@ +package org.alliancegenome.curation_api.services.associations; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleGeneAssociationDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; +import org.alliancegenome.curation_api.services.base.BaseAssociationDTOCrudService; +import org.alliancegenome.curation_api.services.validation.associations.SequenceTargetingReagentGeneAssociationFmsDTOValidator; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@RequestScoped +public class SequenceTargetingReagentGeneAssociationService extends + BaseAssociationDTOCrudService { + @Inject + SequenceTargetingReagentGeneAssociationDAO sequenceTargetingReagentGeneAssociationDAO; + @Inject + SequenceTargetingReagentGeneAssociationFmsDTOValidator sequenceTargetingReagentGeneAssociationFmsDTOValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(sequenceTargetingReagentGeneAssociationDAO); + } + + @Transactional + public SequenceTargetingReagentGeneAssociation upsert(SequenceTargetingReagentFmsDTO dto, + BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + // TODO: fix this placeholder code + SequenceTargetingReagentGeneAssociation sequenceTargetingReagentGeneAssociation = new SequenceTargetingReagentGeneAssociation(); + return sequenceTargetingReagentGeneAssociation; + } + + // TODO: rename? + @Transactional + public List addGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) + throws ObjectUpdateException { + + List associations = sequenceTargetingReagentGeneAssociationFmsDTOValidator + .validateSQTRGeneAssociationFmsDTO(dto, dataProvider); + + for (SequenceTargetingReagentGeneAssociation association : associations) { + if (association != null) { + addAssociationToSQTR(association); + addAssociationToGene(association); + } + } + + return associations.stream().map(SequenceTargetingReagentGeneAssociation::getId) + .collect(Collectors.toList()); + } + + private void addAssociationToSQTR(SequenceTargetingReagentGeneAssociation association) { + SequenceTargetingReagent sqtr = association.getSequenceTargetingReagentAssociationSubject(); + List currentAssociations = sqtr + .getSequenceTargetingReagentGeneAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + sqtr.setSequenceTargetingReagentGeneAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { + currentAssociationIds.add(sqtrga.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + } + + private void addAssociationToGene(SequenceTargetingReagentGeneAssociation association) { + Gene gene = association.getSequenceTargetingReagentGeneAssociationObject(); + List currentAssociations = gene + .getSequenceTargetingReagentGeneAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + gene.setSequenceTargetingReagentGeneAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (SequenceTargetingReagentGeneAssociation sqtrga : currentAssociations) { + currentAssociationIds.add(sqtrga.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java new file mode 100644 index 000000000..74ff2f979 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java @@ -0,0 +1,76 @@ +package org.alliancegenome.curation_api.services.validation.associations; + +import java.util.ArrayList; +import java.util.List; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.GeneService; +import org.alliancegenome.curation_api.services.VocabularyTermService; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class SequenceTargetingReagentGeneAssociationFmsDTOValidator { + @Inject SequenceTargetingReagentDAO sqtrDAO; + @Inject VocabularyTermService vocabularyTermService; + @Inject GeneService geneService; + + public List validateSQTRGeneAssociationFmsDTO( SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + List strGeneAssociations = new ArrayList<>(); + ObjectResponse sqtrResponse = new ObjectResponse<>(); + + SequenceTargetingReagent sqtr; + SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", + dto.getPrimaryId()); + + if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("modEntityId", + ValidationConstants.INVALID_MESSAGE + " (" + dto.getPrimaryId() + ")"); + sqtr = new SequenceTargetingReagent(); + } else { + sqtr = sqtrSearchResponse.getSingleResult(); + } + + VocabularyTerm relation; + SearchResponse relationSearchResponse = vocabularyTermService.findByField("name", "targets"); + if (relationSearchResponse == null || relationSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("relation", ValidationConstants.INVALID_MESSAGE + " (" + "targets" + ")"); + relation = new VocabularyTerm(); + } else { + relation = relationSearchResponse.getSingleResult(); + } + + for (String geneId : dto.getTargetGeneIds()) { + Gene gene = geneService.findByIdentifierString(geneId); + + if (gene == null) { + sqtrResponse.addErrorMessage("targetGeneIds", + ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); + } else { + SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); + strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); + strGeneAssociation.setRelation(relation); + strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); + + strGeneAssociations.add(strGeneAssociation); + } + + } + if (sqtrResponse.hasErrors()) { + throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); + } + + return strGeneAssociations; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java index a8e28b493..37684191e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java @@ -102,50 +102,4 @@ public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDT return sqtr; } - public List validateSQTRGeneAssociationFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { - - List strGeneAssociations = new ArrayList<>(); - ObjectResponse sqtrResponse = new ObjectResponse<>(); - - SequenceTargetingReagent sqtr; - SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", dto.getPrimaryId()); - - if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { - sqtrResponse.addErrorMessage("modEntityId", ValidationConstants.INVALID_MESSAGE + " (" + dto.getPrimaryId() + ")"); - sqtr = new SequenceTargetingReagent(); - } else { - sqtr = sqtrSearchResponse.getSingleResult(); - } - - - VocabularyTerm relation; - SearchResponse relationSearchResponse = vocabularyTermService.findByField("name", "targets"); - if (relationSearchResponse == null || relationSearchResponse.getSingleResult() == null) { - sqtrResponse.addErrorMessage("relation", ValidationConstants.INVALID_MESSAGE + " (" + "targets" + ")"); - relation = new VocabularyTerm(); - } else { - relation = relationSearchResponse.getSingleResult(); - } - - for (String geneId : dto.getTargetGeneIds()) { - Gene gene = geneService.findByIdentifierString(geneId); - - if (gene == null) { - sqtrResponse.addErrorMessage("targetGeneIds", ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); - } else { - SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); - strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); - strGeneAssociation.setRelation(relation); - strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); - - strGeneAssociations.add(strGeneAssociation); - } - - } - if (sqtrResponse.hasErrors()) { - throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); - } - - return strGeneAssociations; - } } From dcb3aac1856154c0d40b67a84705a861784956db Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 9 Jul 2024 11:54:29 -0500 Subject: [PATCH 027/342] SCRUM-4185 update executor to use sqtr gene association service --- .../SequenceTargetingReagentExecutor.java | 44 +++++++++++++------ ...argetingReagentGeneAssociationService.java | 34 +++++++------- ...ReagentGeneAssociationFmsDTOValidator.java | 34 +++++++------- ...quenceTargetingReagentFmsDTOValidator.java | 6 --- 4 files changed, 63 insertions(+), 55 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index 708b12cfe..3c7b0b3d8 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -2,7 +2,9 @@ import java.io.FileInputStream; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.zip.GZIPInputStream; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; @@ -28,8 +30,10 @@ @ApplicationScoped public class SequenceTargetingReagentExecutor extends LoadFileExecutor { - @Inject SequenceTargetingReagentService sqtrService; - @Inject SequenceTargetingReagentGeneAssociationService sqtrGeneAssociationService; + @Inject + SequenceTargetingReagentService sqtrService; + @Inject + SequenceTargetingReagentGeneAssociationService sqtrGeneAssociationService; public void execLoad(BulkLoadFile bulkLoadFile) { @@ -53,20 +57,20 @@ public void execLoad(BulkLoadFile bulkLoadFile) { BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); - List sqtrIdsLoaded = new ArrayList<>(); - List sqtrIdsBefore = sqtrService.getIdsByDataProvider(dataProvider.name()); - List sqtrGeneAssociationIdsLoaded = new ArrayList<>(); - List sqtrGeneAssociationIdsBefore = sqtrService.getIdsByDataProvider(dataProvider.name()); + Map> idsAdded = new HashMap>(); + idsAdded.put("SQTR", new ArrayList()); + idsAdded.put("SQTRGeneAssociation", new ArrayList()); + Map> previousIds = getPreviouslyLoadedIds(dataProvider); bulkLoadFileDAO.merge(bulkLoadFile); - BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrIngestFmsDTO.getData().size()); + BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrIngestFmsDTO.getData().size() * 2); - runLoad(history, dataProvider, sqtrIngestFmsDTO.getData(), sqtrIdsLoaded, sqtrGeneAssociationIdsLoaded); + runLoad(history, dataProvider, sqtrIngestFmsDTO.getData(), idsAdded.get("SQTR"), idsAdded.get("SQTRGeneAssociation")); - runCleanup(sqtrService, history, dataProvider.name(), sqtrIdsBefore, sqtrIdsLoaded, "SQTR", bulkLoadFile.getMd5Sum()); - runCleanup(sqtrService, history, dataProvider.name(), sqtrGeneAssociationIdsBefore, sqtrGeneAssociationIdsLoaded, "SQTR Gene Associations", bulkLoadFile.getMd5Sum()); + runCleanup(sqtrService, history, dataProvider.name(), previousIds.get("SQTR"), idsAdded.get("SQTR"), "SQTR", bulkLoadFile.getMd5Sum()); + runCleanup(sqtrService, history, dataProvider.name(), previousIds.get("SQTRGeneAssociation"), idsAdded.get("SQTRGeneAssociation"), "SQTR Gene Associations", bulkLoadFile.getMd5Sum()); history.finishLoad(); @@ -77,11 +81,20 @@ public void execLoad(BulkLoadFile bulkLoadFile) { } } + private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { + Map> previousIds = new HashMap<>(); + + previousIds.put("SQTR", sqtrService.getIdsByDataProvider(dataProvider.name())); + previousIds.put("SQTRGeneAssociation", sqtrGeneAssociationService.getIdsByDataProvider(dataProvider.name())); + + return previousIds; + } + public APIResponse runLoadApi(String dataProviderName, List sqtrDTOs) { List sqtrIdsLoaded = new ArrayList<>(); List sqtrGeneAssociationIdsLoaded = new ArrayList<>(); - BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrDTOs.size()); + BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrDTOs.size() * 2); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); runLoad(history, dataProvider, sqtrDTOs, sqtrIdsLoaded, sqtrGeneAssociationIdsLoaded); history.finishLoad(); @@ -101,7 +114,8 @@ private void runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dataPr } - private void loadSequenceTargetingReagents(BulkLoadFileHistory history, List sqtrs, List idsLoaded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + private void loadSequenceTargetingReagents(BulkLoadFileHistory history, List sqtrs, + List idsLoaded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { for (SequenceTargetingReagentFmsDTO dto : sqtrs) { try { SequenceTargetingReagent dbObject = sqtrService.upsert(dto, dataProvider); @@ -121,11 +135,13 @@ private void loadSequenceTargetingReagents(BulkLoadFileHistory history, List sqtrs, List idsLoaded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + private void loadSequenceTargetingReagentGeneAssociations(BulkLoadFileHistory history, + List sqtrs, List idsLoaded, BackendBulkDataProvider dataProvider, + ProcessDisplayHelper ph) { for (SequenceTargetingReagentFmsDTO dto : sqtrs) { try { - List associationIds = sqtrGeneAssociationService.addGeneAssociations(dto, dataProvider); + List associationIds = sqtrGeneAssociationService.loadGeneAssociations(dto, dataProvider); history.incrementCompleted(); if (idsLoaded != null) { idsLoaded.addAll(associationIds); diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index 8a920fa87..4c00833a2 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -1,9 +1,13 @@ package org.alliancegenome.curation_api.services.associations; 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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; @@ -24,31 +28,15 @@ import jakarta.transaction.Transactional; @RequestScoped -public class SequenceTargetingReagentGeneAssociationService extends - BaseAssociationDTOCrudService { +public class SequenceTargetingReagentGeneAssociationService { + @Inject SequenceTargetingReagentGeneAssociationDAO sequenceTargetingReagentGeneAssociationDAO; @Inject SequenceTargetingReagentGeneAssociationFmsDTOValidator sequenceTargetingReagentGeneAssociationFmsDTOValidator; - @Override - @PostConstruct - protected void init() { - setSQLDao(sequenceTargetingReagentGeneAssociationDAO); - } - @Transactional - public SequenceTargetingReagentGeneAssociation upsert(SequenceTargetingReagentFmsDTO dto, - BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - // TODO: fix this placeholder code - SequenceTargetingReagentGeneAssociation sequenceTargetingReagentGeneAssociation = new SequenceTargetingReagentGeneAssociation(); - return sequenceTargetingReagentGeneAssociation; - } - - // TODO: rename? - @Transactional - public List addGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) - throws ObjectUpdateException { + public List loadGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { List associations = sequenceTargetingReagentGeneAssociationFmsDTOValidator .validateSQTRGeneAssociationFmsDTO(dto, dataProvider); @@ -102,4 +90,12 @@ private void addAssociationToGene(SequenceTargetingReagentGeneAssociation associ } } + + public List getIdsByDataProvider(String dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider); + List ids = sequenceTargetingReagentGeneAssociationDAO.findIdsByParams(params); + ids.removeIf(Objects::isNull); + return ids; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java index 74ff2f979..1997b6f97 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java @@ -31,8 +31,7 @@ public List validateSQTRGeneAssociation ObjectResponse sqtrResponse = new ObjectResponse<>(); SequenceTargetingReagent sqtr; - SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", - dto.getPrimaryId()); + SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", dto.getPrimaryId()); if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { sqtrResponse.addErrorMessage("modEntityId", @@ -51,22 +50,25 @@ public List validateSQTRGeneAssociation relation = relationSearchResponse.getSingleResult(); } - for (String geneId : dto.getTargetGeneIds()) { - Gene gene = geneService.findByIdentifierString(geneId); - - if (gene == null) { - sqtrResponse.addErrorMessage("targetGeneIds", - ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); - } else { - SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); - strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); - strGeneAssociation.setRelation(relation); - strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); - - strGeneAssociations.add(strGeneAssociation); + if(dto.getTargetGeneIds() != null){ + for (String geneId : dto.getTargetGeneIds()) { + Gene gene = geneService.findByIdentifierString(geneId); + + if (gene == null) { + sqtrResponse.addErrorMessage("targetGeneIds", + ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); + } else { + SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); + strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); + strGeneAssociation.setRelation(relation); + strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); + + strGeneAssociations.add(strGeneAssociation); + } + } - } + if (sqtrResponse.hasErrors()) { throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java index 37684191e..55cdec3ba 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java @@ -1,16 +1,10 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; -import java.util.ArrayList; -import java.util.List; - import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; -import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; From 644e2cb28e290835d1ab153d1f771801a457d387 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 9 Jul 2024 11:55:25 -0500 Subject: [PATCH 028/342] SCRUM-4185 update tests --- ...ceTargetingReagentBulkUploadFmsITCase.java | 41 +++++++++++++++---- .../curation_api/base/BaseITCase.java | 10 +++-- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java index b3bade7ef..8939c04a8 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java @@ -45,7 +45,7 @@ public void init() { @Order(1) public void sqtrBulkUploadCheckFields() throws Exception { - checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "AF_01_all_fields.json"); + checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "AF_01_all_fields.json", 2); RestAssured.given(). when(). @@ -67,16 +67,41 @@ public void sqtrBulkUploadCheckFields() throws Exception { @Order(2) public void sqtrBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_01_no_name.json"); - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_02_no_taxon.json"); + checkFailedBulkLoad( + sqtrBulkPostEndpoint, + sqtrTestFilePath + "MR_01_no_name.json", + 2, + 1, + 1 + ); + checkFailedBulkLoad( + sqtrBulkPostEndpoint, + sqtrTestFilePath + "MR_02_no_taxon.json", + 2, + 1, + 1 + ); } @Test @Order(3) public void sqtrBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_01_empty_name.json"); - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_02_empty_taxon.json"); + checkFailedBulkLoad( + sqtrBulkPostEndpoint, + sqtrTestFilePath + "ER_01_empty_name.json", + 2, + 1, + 1 + ); + + checkFailedBulkLoad( + sqtrBulkPostEndpoint, + sqtrTestFilePath + "ER_02_empty_taxon.json", + 2, + 1, + 1 + ); } @@ -84,7 +109,7 @@ public void sqtrBulkUploadEmptyRequiredFields() throws Exception { @Order(4) public void sqtrBulkUploadUpdateMissingNonRequiredFields() throws Exception { - checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "UM_01_update_no_non_required_fields.json"); + checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "UM_01_update_no_non_required_fields.json", 2); RestAssured.given(). when(). @@ -104,7 +129,7 @@ public void sqtrBulkUploadUpdateMissingNonRequiredFields() throws Exception { @Order(5) public void sqtrBulkUploadUpdateEmptyNonRequiredFields() throws Exception { - checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "AF_01_all_fields.json"); + checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "AF_01_all_fields.json", 2); RestAssured.given(). when(). @@ -122,7 +147,7 @@ public void sqtrBulkUploadUpdateEmptyNonRequiredFields() throws Exception { body("results[0]" , hasKey("synonyms")). body("results[0]" , hasKey("secondaryIdentifiers")); - checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "UE_01_update_empty_non_required_fields.json"); + checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "UE_01_update_empty_non_required_fields.json", 2); RestAssured.given(). when(). diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 1ef4c4cb1..42c239537 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -97,6 +97,10 @@ public VocabularyTerm addVocabularyTermToSet(String setName, String termName, Vo } public void checkFailedBulkLoad(String endpoint, String filePath) throws Exception { + checkFailedBulkLoad(endpoint, filePath, 1, 1, 0); + } + + public void checkFailedBulkLoad(String endpoint, String filePath, int expectedTotalRecords, int expectedFailedRecords, int expectedCompletedRecords) throws Exception { String content = Files.readString(Path.of(filePath)); RestAssured.given(). @@ -106,9 +110,9 @@ public void checkFailedBulkLoad(String endpoint, String filePath) throws Excepti post(endpoint). then(). statusCode(200). - body("history.totalRecords", is(1)). - body("history.failedRecords", is(1)). - body("history.completedRecords", is(0)); + body("history.totalRecords", is(expectedTotalRecords)). + body("history.failedRecords", is(expectedFailedRecords)). + body("history.completedRecords", is(expectedCompletedRecords)); } public void checkSuccessfulBulkLoad(String endpoint, String filePath) throws Exception { From 2df4c73a4f2dd088215e8c4bbea6d7bf4ab9ed15 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 9 Jul 2024 12:04:56 -0500 Subject: [PATCH 029/342] SCRUM-4185 update formatting --- .../SequenceTargetingReagentExecutor.java | 1 - .../SequenceTargetingReagentService.java | 4 - ...argetingReagentGeneAssociationService.java | 6 -- ...ReagentGeneAssociationFmsDTOValidator.java | 98 ++++++++++--------- ...ceTargetingReagentBulkUploadFmsITCase.java | 34 +------ 5 files changed, 56 insertions(+), 87 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index 3c7b0b3d8..9c96eec15 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -12,7 +12,6 @@ import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index a11689115..14d3fa63b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -1,20 +1,16 @@ package org.alliancegenome.curation_api.services; -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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; -import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.dto.fms.SequenceTargetingReagentFmsDTOValidator; diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index 4c00833a2..bf19881cf 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -9,20 +9,14 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; -import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; -import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; -import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleGeneAssociationDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; -import org.alliancegenome.curation_api.services.base.BaseAssociationDTOCrudService; import org.alliancegenome.curation_api.services.validation.associations.SequenceTargetingReagentGeneAssociationFmsDTOValidator; -import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.transaction.Transactional; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java index 1997b6f97..ca24216f8 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/SequenceTargetingReagentGeneAssociationFmsDTOValidator.java @@ -22,57 +22,61 @@ @RequestScoped public class SequenceTargetingReagentGeneAssociationFmsDTOValidator { - @Inject SequenceTargetingReagentDAO sqtrDAO; - @Inject VocabularyTermService vocabularyTermService; - @Inject GeneService geneService; + @Inject + SequenceTargetingReagentDAO sqtrDAO; + @Inject + VocabularyTermService vocabularyTermService; + @Inject + GeneService geneService; - public List validateSQTRGeneAssociationFmsDTO( SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { - List strGeneAssociations = new ArrayList<>(); - ObjectResponse sqtrResponse = new ObjectResponse<>(); + public List validateSQTRGeneAssociationFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + List strGeneAssociations = new ArrayList<>(); + ObjectResponse sqtrResponse = new ObjectResponse<>(); - SequenceTargetingReagent sqtr; - SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", dto.getPrimaryId()); + SequenceTargetingReagent sqtr; + SearchResponse sqtrSearchResponse = sqtrDAO.findByField("modEntityId", + dto.getPrimaryId()); - if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { - sqtrResponse.addErrorMessage("modEntityId", - ValidationConstants.INVALID_MESSAGE + " (" + dto.getPrimaryId() + ")"); - sqtr = new SequenceTargetingReagent(); - } else { - sqtr = sqtrSearchResponse.getSingleResult(); - } + if (sqtrSearchResponse == null || sqtrSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("modEntityId", + ValidationConstants.INVALID_MESSAGE + " (" + dto.getPrimaryId() + ")"); + sqtr = new SequenceTargetingReagent(); + } else { + sqtr = sqtrSearchResponse.getSingleResult(); + } - VocabularyTerm relation; - SearchResponse relationSearchResponse = vocabularyTermService.findByField("name", "targets"); - if (relationSearchResponse == null || relationSearchResponse.getSingleResult() == null) { - sqtrResponse.addErrorMessage("relation", ValidationConstants.INVALID_MESSAGE + " (" + "targets" + ")"); - relation = new VocabularyTerm(); - } else { - relation = relationSearchResponse.getSingleResult(); - } + VocabularyTerm relation; + SearchResponse relationSearchResponse = vocabularyTermService.findByField("name", "targets"); + if (relationSearchResponse == null || relationSearchResponse.getSingleResult() == null) { + sqtrResponse.addErrorMessage("relation", ValidationConstants.INVALID_MESSAGE + " (" + "targets" + ")"); + relation = new VocabularyTerm(); + } else { + relation = relationSearchResponse.getSingleResult(); + } - if(dto.getTargetGeneIds() != null){ - for (String geneId : dto.getTargetGeneIds()) { - Gene gene = geneService.findByIdentifierString(geneId); - - if (gene == null) { - sqtrResponse.addErrorMessage("targetGeneIds", - ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); - } else { - SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); - strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); - strGeneAssociation.setRelation(relation); - strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); - - strGeneAssociations.add(strGeneAssociation); - } - - } - } - - if (sqtrResponse.hasErrors()) { - throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); - } + if (dto.getTargetGeneIds() != null) { + for (String geneId : dto.getTargetGeneIds()) { + Gene gene = geneService.findByIdentifierString(geneId); - return strGeneAssociations; - } + if (gene == null) { + sqtrResponse.addErrorMessage("targetGeneIds", + ValidationConstants.INVALID_MESSAGE + " (" + geneId + ")"); + } else { + SequenceTargetingReagentGeneAssociation strGeneAssociation = new SequenceTargetingReagentGeneAssociation(); + strGeneAssociation.setSequenceTargetingReagentAssociationSubject(sqtr); + strGeneAssociation.setRelation(relation); + strGeneAssociation.setSequenceTargetingReagentGeneAssociationObject(gene); + + strGeneAssociations.add(strGeneAssociation); + } + + } + } + + if (sqtrResponse.hasErrors()) { + throw new ObjectValidationException(dto, sqtrResponse.errorMessagesString()); + } + + return strGeneAssociations; + } } diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java index 8939c04a8..03a2df0a4 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java @@ -67,41 +67,17 @@ public void sqtrBulkUploadCheckFields() throws Exception { @Order(2) public void sqtrBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad( - sqtrBulkPostEndpoint, - sqtrTestFilePath + "MR_01_no_name.json", - 2, - 1, - 1 - ); - checkFailedBulkLoad( - sqtrBulkPostEndpoint, - sqtrTestFilePath + "MR_02_no_taxon.json", - 2, - 1, - 1 - ); + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_01_no_name.json", 2, 1, 1); + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_02_no_taxon.json", 2, 1, 1); } @Test @Order(3) public void sqtrBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad( - sqtrBulkPostEndpoint, - sqtrTestFilePath + "ER_01_empty_name.json", - 2, - 1, - 1 - ); - - checkFailedBulkLoad( - sqtrBulkPostEndpoint, - sqtrTestFilePath + "ER_02_empty_taxon.json", - 2, - 1, - 1 - ); + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_01_empty_name.json", 2, 1, 1); + + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_02_empty_taxon.json", 2, 1, 1); } From 3b5b94afdaef0ed9c502c7dfd29c1050e2c0d02f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 10 Jul 2024 13:44:54 +0100 Subject: [PATCH 030/342] Switch DPO for FBCV on dashboard --- src/main/cliapp/src/constants/Classes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cliapp/src/constants/Classes.js b/src/main/cliapp/src/constants/Classes.js index af5b2a903..278e71e7e 100644 --- a/src/main/cliapp/src/constants/Classes.js +++ b/src/main/cliapp/src/constants/Classes.js @@ -54,7 +54,7 @@ export const CLASSES = Object.freeze({ WBPhenotypeTerm: { name: 'WBPheno', link: '/#/ontology/wbpheno', type: 'ontology' }, PATOTerm: { name: 'PATO', link: '/#/ontology/pato', type: 'ontology' }, HPTerm: { name: 'HP', link: '/#/ontology/hp', type: 'ontology' }, - DPOTerm: { name: 'DPO', link: '/#/ontology/dpo', type: 'ontology' }, + FBCVTerm: { name: 'FBCV', link: '/#/ontology/fbcv', type: 'ontology' }, MMOTerm: { name: 'MMO', link: '/#/ontology/mmo', type: 'ontology' }, APOTerm: { name: 'APO', link: '/#/ontology/apo', type: 'ontology' }, MITerm: { name: 'MI', link: '/#/ontology/mi', type: 'ontology' }, From 3c2f2f732c68e676551d2c115121b1a4348a5491 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 10 Jul 2024 10:10:02 -0500 Subject: [PATCH 031/342] SCRUM-4236 add CSS for rowEdit column min width --- .../GenericDataTable/GenericDataTable.js | 21 ++++++++++--------- .../GenericDataTable/styles.module.scss | 3 +++ 2 files changed, 14 insertions(+), 10 deletions(-) create mode 100644 src/main/cliapp/src/components/GenericDataTable/styles.module.scss diff --git a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js index d93c1b4db..db13153ed 100644 --- a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js @@ -16,6 +16,7 @@ import { EntityDetailsAction } from '../Actions/EntityDetailsAction'; import { filterColumns, orderColumns, getIdentifier } from '../../utils/utils'; import { useGenericDataTable } from './useGenericDataTable'; +import style from './styles.module.scss'; export const GenericDataTable = (props) => { const { tableName, @@ -160,8 +161,8 @@ export const GenericDataTable = (props) => { const rowEditorFilterNameHeader = (options) => { return ( -
- Filters +
+ Filters
); }; @@ -325,13 +326,13 @@ export const GenericDataTable = (props) => { )} {deletionEnabled && ( @@ -341,10 +342,10 @@ export const GenericDataTable = (props) => { body={(props) => deleteAction(props, isInEditMode)} filterElement={rowEditorFilterNameHeader} showFilterMenu={false} - className={`p-text-center p-0 min-w-3rem max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 w-3rem sticky" + headerClassName="surface-0 max-w-3rem sticky" /> )} {duplicationEnabled && ( @@ -357,10 +358,10 @@ export const GenericDataTable = (props) => { )} showFilterMenu={false} - className={`p-text-center p-0 min-w-3rem max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 w-3rem sticky" + headerClassName="surface-0 max-w-3rem sticky" /> )} {hasDetails && ( @@ -369,10 +370,10 @@ export const GenericDataTable = (props) => { editor={(props) => } body={(props) => } showFilterMenu={false} - className={`p-text-center p-0 min-w-3rem max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 w-3rem sticky" + headerClassName="surface-0 max-w-3rem sticky" /> )} {columnList} diff --git a/src/main/cliapp/src/components/GenericDataTable/styles.module.scss b/src/main/cliapp/src/components/GenericDataTable/styles.module.scss new file mode 100644 index 000000000..7b574f220 --- /dev/null +++ b/src/main/cliapp/src/components/GenericDataTable/styles.module.scss @@ -0,0 +1,3 @@ +.rowEditorColumn{ + min-width : 6rem !important; +} \ No newline at end of file From 1cbdef8a7360434761fce18fc12dc12ed612c288 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 10 Jul 2024 14:30:15 -0500 Subject: [PATCH 032/342] SCRUM-4185 fix dataProvider loading error --- .../curation_api/constants/EntityFieldConstants.java | 1 + .../jobs/executors/SequenceTargetingReagentExecutor.java | 2 +- .../SequenceTargetingReagentGeneAssociationService.java | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) 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 a86abe168..4fe9f1347 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -14,6 +14,7 @@ private EntityFieldConstants() { public static final String PA_SUBJECT = "phenotypeAnnotationSubject"; public static final String PA_SUBJECT_TAXON = PA_SUBJECT + "." + TAXON; public static final String ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "alleleAssociationSubject." + DATA_PROVIDER; + public static final String SQTR_ASSOCIATION_SUBJECT_DATA_PROVIDER = "sequenceTargetingReagentAssociationSubject." + DATA_PROVIDER; public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "constructAssociationSubject." + DATA_PROVIDER; 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/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index 9c96eec15..fc16b5cab 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -84,7 +84,7 @@ private Map> getPreviouslyLoadedIds(BackendBulkDataProvider d Map> previousIds = new HashMap<>(); previousIds.put("SQTR", sqtrService.getIdsByDataProvider(dataProvider.name())); - previousIds.put("SQTRGeneAssociation", sqtrGeneAssociationService.getIdsByDataProvider(dataProvider.name())); + previousIds.put("SQTRGeneAssociation", sqtrGeneAssociationService.getIdsByDataProvider(dataProvider)); return previousIds; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index bf19881cf..7cce13c41 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -85,11 +85,12 @@ private void addAssociationToGene(SequenceTargetingReagentGeneAssociation associ } - public List getIdsByDataProvider(String dataProvider) { + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { Map params = new HashMap<>(); - params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider); + params.put(EntityFieldConstants.SQTR_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); List ids = sequenceTargetingReagentGeneAssociationDAO.findIdsByParams(params); ids.removeIf(Objects::isNull); return ids; } + } From db85c1e211391d43bf25868a00c74ba1fe4afdb3 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 11 Jul 2024 12:59:18 +0100 Subject: [PATCH 033/342] Entities, DAOs and migration --- .../dao/AssemblyComponentDAO.java | 51 +++++++ .../curation_api/dao/ChromosomeDAO.java | 32 +++++ ...SequenceGenomicLocationAssociationDAO.java | 15 +++ .../ExonGenomicLocationAssociationDAO.java | 15 +++ ...anscriptGenomicLocationAssociationDAO.java | 15 +++ .../bridges/BiologicalEntityTypeBridge.java | 5 + .../model/entities/AssemblyComponent.java | 70 ++++++++++ .../model/entities/BiologicalEntity.java | 4 + .../model/entities/Chromosome.java | 70 ++++++++++ .../model/entities/CodingSequence.java | 19 ++- .../curation_api/model/entities/Exon.java | 19 ++- .../model/entities/LocationAssociation.java | 41 ++++++ .../model/entities/Transcript.java | 19 ++- ...ingSequenceGenomicLocationAssociation.java | 59 +++++++++ .../ExonGenomicLocationAssociation.java | 59 +++++++++ .../TranscriptGenomicLocationAssociation.java | 59 +++++++++ .../v0.36.0.4__gff_association_tables.sql | 125 ++++++++++++++++++ 17 files changed, 674 insertions(+), 3 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/AssemblyComponentDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/ChromosomeDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/exonAssociations/ExonGenomicLocationAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGenomicLocationAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/Chromosome.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java create mode 100644 src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql diff --git a/src/main/java/org/alliancegenome/curation_api/dao/AssemblyComponentDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/AssemblyComponentDAO.java new file mode 100644 index 000000000..09b93576e --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/AssemblyComponentDAO.java @@ -0,0 +1,51 @@ +package org.alliancegenome.curation_api.dao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.apache.commons.collections.CollectionUtils; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class AssemblyComponentDAO extends BaseSQLDAO { + + @Inject CodingSequenceGenomicLocationAssociationDAO cdsGenomicLocationAssociationDAO; + @Inject ExonGenomicLocationAssociationDAO exonGenomicLocationAssociationDAO; + @Inject TranscriptGenomicLocationAssociationDAO transcriptGenomicLocationAssociationDAO; + + protected AssemblyComponentDAO() { + super(AssemblyComponent.class); + } + + public Boolean hasReferencingGenomicLocationAssociations(Long acId) { + + Map transcriptParams = new HashMap<>(); + transcriptParams.put("transcriptGenomicLocationAssociationObject.id", acId); + List results = transcriptGenomicLocationAssociationDAO.findIdsByParams(transcriptParams); + if (CollectionUtils.isNotEmpty(results)) { + return true; + } + + Map exonParams = new HashMap<>(); + exonParams.put("exonGenomicLocationAssociationObject.id", acId); + results = exonGenomicLocationAssociationDAO.findIdsByParams(exonParams); + if (CollectionUtils.isNotEmpty(results)) { + return true; + } + + Map cdsParams = new HashMap<>(); + cdsParams.put("codingSequenceGenomicLocationAssociationObject.id", acId); + results = cdsGenomicLocationAssociationDAO.findIdsByParams(cdsParams); + + return CollectionUtils.isNotEmpty(results); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ChromosomeDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ChromosomeDAO.java new file mode 100644 index 000000000..3f27acf70 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/ChromosomeDAO.java @@ -0,0 +1,32 @@ +package org.alliancegenome.curation_api.dao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.Chromosome; +import org.apache.commons.collections.CollectionUtils; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class ChromosomeDAO extends BaseSQLDAO { + + @Inject AssemblyComponentDAO assemblyComponentDAO; + + protected ChromosomeDAO() { + super(Chromosome.class); + } + + public Boolean hasReferencingAssemblyComponents(Long chromosomeId) { + + Map params = new HashMap<>(); + params.put("mapsToChromosome.id", chromosomeId); + List results = assemblyComponentDAO.findIdsByParams(params); + + return CollectionUtils.isNotEmpty(results); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationDAO.java new file mode 100644 index 000000000..e80741712 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class CodingSequenceGenomicLocationAssociationDAO extends BaseSQLDAO { + + protected CodingSequenceGenomicLocationAssociationDAO() { + super(CodingSequenceGenomicLocationAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/exonAssociations/ExonGenomicLocationAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/exonAssociations/ExonGenomicLocationAssociationDAO.java new file mode 100644 index 000000000..aac6d220d --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/exonAssociations/ExonGenomicLocationAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.exonAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class ExonGenomicLocationAssociationDAO extends BaseSQLDAO { + + protected ExonGenomicLocationAssociationDAO() { + super(ExonGenomicLocationAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGenomicLocationAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGenomicLocationAssociationDAO.java new file mode 100644 index 000000000..b55d7939a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGenomicLocationAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class TranscriptGenomicLocationAssociationDAO extends BaseSQLDAO { + + protected TranscriptGenomicLocationAssociationDAO() { + super(TranscriptGenomicLocationAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java b/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java index efa253b36..b6eb59cf7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java +++ b/src/main/java/org/alliancegenome/curation_api/model/bridges/BiologicalEntityTypeBridge.java @@ -2,6 +2,7 @@ import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.BiologicalEntity; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; @@ -93,6 +94,10 @@ public void write(DocumentElement target, BiologicalEntity bridgedElement, TypeB CodingSequence cds = (CodingSequence) bridgedElement; name = cds.getName(); symbol = null; + } else if (bridgedElement instanceof AssemblyComponent) { + AssemblyComponent ac = (AssemblyComponent) bridgedElement; + name = ac.getName(); + symbol = null; } else { name = null; symbol = null; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java new file mode 100644 index 000000000..fa6ca8506 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -0,0 +1,70 @@ +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.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; +import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; +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.ManyToOne; +import jakarta.persistence.OneToMany; +import jakarta.persistence.Table; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "AssemblyComponent", description = "POJO that represents the AssemblyComponent") +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) +@Table( + indexes = { + @Index(name = "assemblycomponent_genomeassembly_index", columnList = "genomeassembly_id") + } +) +public class AssemblyComponent extends GenomicEntity { + + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private GenomeAssembly genomeAssembly; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private Chromosome mapsToChromosome; + + @OneToMany(mappedBy = "transcriptGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptGenomicLocationAssociations; + + @OneToMany(mappedBy = "exonGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List exonGenomicLocationAssociations; + + @OneToMany(mappedBy = "codingSequenceGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List codingSequenceGenomicLocationAssociations; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BiologicalEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BiologicalEntity.java index de9e627f9..fa56b9f46 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/BiologicalEntity.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BiologicalEntity.java @@ -32,7 +32,11 @@ @JsonSubTypes({ @JsonSubTypes.Type(value = AffectedGenomicModel.class, name = "AffectedGenomicModel"), @JsonSubTypes.Type(value = Allele.class, name = "Allele"), + @JsonSubTypes.Type(value = AssemblyComponent.class, name = "AssemblyComponent"), + @JsonSubTypes.Type(value = CodingSequence.class, name = "CodingSequence"), + @JsonSubTypes.Type(value = Exon.class, name = "Exon"), @JsonSubTypes.Type(value = Gene.class, name = "Gene"), + @JsonSubTypes.Type(value = Transcript.class, name = "Transcript"), @JsonSubTypes.Type(value = Variant.class, name = "Variant"), @JsonSubTypes.Type(value = SequenceTargetingReagent.class, name = "SequenceTargetingReagent") }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Chromosome.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Chromosome.java new file mode 100644 index 000000000..721165d9f --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Chromosome.java @@ -0,0 +1,70 @@ +package org.alliancegenome.curation_api.model.entities; + +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.NCBITaxonTerm; +import org.alliancegenome.curation_api.view.View; +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.JsonView; + +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import jakarta.persistence.UniqueConstraint; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Entity +@Data +@EqualsAndHashCode(callSuper = true, onlyExplicitlyIncluded = true) +@ToString(callSuper = true) +@AGRCurationSchemaVersion(min = "2.0.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@Table( + indexes = { + @Index(name = "chromosome_taxon_index", columnList = "taxon_id"), + @Index(name = "chromosome_name_index", columnList = "name"), + @Index(name = "chromosome_dataprovider_index", columnList = "dataprovider_id"), + @Index(name = "chromosome_createdby_index", columnList = "createdby_id"), + @Index(name = "chromosome_updatedby_index", columnList = "updatedby_id") + }, + uniqueConstraints = { + @UniqueConstraint(name = "chromosome_name_taxon_uk", columnNames = {"name", "taxon_id"}) + } +) +public class Chromosome extends AuditedObject { + + @IndexedEmbedded(includePaths = {"name", "curie", "name_keyword", "curie_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private NCBITaxonTerm taxon; + + @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" + }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @Fetch(FetchMode.SELECT) + @JsonView({ View.FieldsOnly.class }) + private DataProvider dataProvider; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String name; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java index efde35219..f72677f3b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -1,7 +1,10 @@ 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.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -17,9 +20,11 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,7 +34,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(callSuper = true) +@ToString(exclude = "codingSequenceGenomicLocationAssociations", callSuper = true) @Schema(name = "CodingSequence", description = "POJO that represents the CodingSequence (CDS)") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table(indexes = {@Index(name = "codingsequence_uniqueid_index", columnList = "uniqueid")}) @@ -50,4 +55,16 @@ public class CodingSequence extends GenomicEntity { @JsonView({ View.FieldsOnly.class }) private SOTerm cdsType; + @IndexedEmbedded( + includePaths = { + "codingSequenceGenomicLocationAssociationObject.curie", "codingSequenceGenomicLocationAssociationObject.curie_keyword", + "codingSequenceGenomicLocationAssociationObject.modEntityId", "codingSequenceGenomicLocationAssociationObject.modEntityId_keyword", + "codingSequenceGenomicLocationAssociationObject.modInternalId", "codingSequenceGenomicLocationAssociationObject.modInternalId_keyword", + "start", "end" + } + ) + @OneToMany(mappedBy = "codingSequenceAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List codingSequenceGenomicLocationAssociations; + } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java index b3120d196..8a55175ba 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -1,7 +1,10 @@ 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.entities.associations.exonAssociations.ExonGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -17,9 +20,11 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,7 +34,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(callSuper = true) +@ToString(exclude = "exonGenomicLocationAssociations", callSuper = true) @Schema(name = "Exon", description = "POJO that represents the Exon") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table(indexes = {@Index(name = "exon_uniqueid_index", columnList = "uniqueid")}) @@ -50,4 +55,16 @@ public class Exon extends GenomicEntity { @JsonView({ View.FieldsOnly.class }) private SOTerm exonType; + @IndexedEmbedded( + includePaths = { + "exonGenomicLocationAssociationObject.curie", "exonGenomicLocationAssociationObject.curie_keyword", + "exonGenomicLocationAssociationObject.modEntityId", "exonGenomicLocationAssociationObject.modEntityId_keyword", + "exonGenomicLocationAssociationObject.modInternalId", "exonGenomicLocationAssociationObject.modInternalId_keyword", + "start", "end" + } + ) + @OneToMany(mappedBy = "exonAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List exonGenomicLocationAssociations; + } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java new file mode 100644 index 000000000..7378fd39a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java @@ -0,0 +1,41 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.search.engine.backend.types.Projectable; +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.GenericField; +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.ManyToOne; +import jakarta.persistence.MappedSuperclass; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@MappedSuperclass +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@Schema(name = "locationAssociation", description = "POJO that represents a location association") +@AGRCurationSchemaVersion(min = "2.0.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) +public abstract class LocationAssociation extends EvidenceAssociation { + + @IndexedEmbedded(includePaths = { "name", "name_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm relation; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer start; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer end; + +} + 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 403322155..8c8f5efe2 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 @@ -1,7 +1,10 @@ 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.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -12,8 +15,10 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToMany; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +27,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(callSuper = true) +@ToString(exclude = "transcriptGenomicLocationAssociations", callSuper = true) @Schema(name = "Transcript", description = "POJO that represents the Transcript") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) public class Transcript extends GenomicEntity { @@ -36,4 +41,16 @@ public class Transcript extends GenomicEntity { @JsonView({ View.FieldsOnly.class }) private SOTerm transcriptType; + @IndexedEmbedded( + includePaths = { + "transcriptGenomicLocationAssociationObject.curie", "transcriptGenomicLocationAssociationObject.curie_keyword", + "transcriptGenomicLocationAssociationObject.modEntityId", "transcriptGenomicLocationAssociationObject.modEntityId_keyword", + "transcriptGenomicLocationAssociationObject.modInternalId", "transcriptGenomicLocationAssociationObject.modInternalId_keyword", + "start", "end" + } + ) + @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptGenomicLocationAssociations; + } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java new file mode 100644 index 000000000..15b75ce87 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -0,0 +1,59 @@ +package org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations; + +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.CodingSequence; +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.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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 = "CodingSequenceGenomicLocationAssociation", description = "POJO representing an association between a CDS and a genomic location") +@Table( + indexes = { + @Index(name = "codingsequencelocationassociation_relation_index", columnList = "relation_id"), + @Index(name = "codingsequencelocationassociation_subject_index", columnList = "codingsequenceassociationsubject_id"), + @Index(name = "codingsequencelocationassociation_object_index", columnList = "codingsequencegenomiclocationassociationobject_id") + } +) +public class CodingSequenceGenomicLocationAssociation extends LocationAssociation { + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("codingSequenceGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private CodingSequence codingSequenceAssociationSubject; + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("codingSequenceGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private AssemblyComponent codingSequenceGenomicLocationAssociationObject; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java new file mode 100644 index 000000000..35a11b125 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -0,0 +1,59 @@ +package org.alliancegenome.curation_api.model.entities.associations.exonAssociations; + +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.Exon; +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.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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 = "ExonGenomicLocationAssociation", description = "POJO representing an association between an exon and a genomic location") +@Table( + indexes = { + @Index(name = "exonlocationassociation_relation_index", columnList = "relation_id"), + @Index(name = "exonlocationassociation_subject_index", columnList = "exonassociationsubject_id"), + @Index(name = "exonlocationassociation_object_index", columnList = "exongenomiclocationassociationobject_id") + } +) +public class ExonGenomicLocationAssociation extends LocationAssociation { + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("exonGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private Exon exonAssociationSubject; + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("exonGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private AssemblyComponent exonGenomicLocationAssociationObject; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java new file mode 100644 index 000000000..1f7488541 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -0,0 +1,59 @@ +package org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations; + +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.LocationAssociation; +import org.alliancegenome.curation_api.model.entities.Transcript; +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.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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 = "TranscriptGenomicLocationAssociation", description = "POJO representing an association between a transcript and a genomic location") +@Table( + indexes = { + @Index(name = "transcriptlocationassociation_relation_index", columnList = "relation_id"), + @Index(name = "transcriptlocationassociation_subject_index", columnList = "transcriptassociationsubject_id"), + @Index(name = "transcriptlocationassociation_object_index", columnList = "transcriptgenomiclocationassociationobject_id") + } +) +public class TranscriptGenomicLocationAssociation extends LocationAssociation { + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("transcriptGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private Transcript transcriptAssociationSubject; + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("transcriptGenomicLocationAssociations") + @Fetch(FetchMode.JOIN) + private AssemblyComponent transcriptGenomicLocationAssociationObject; +} diff --git a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql new file mode 100644 index 000000000..198b89d94 --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql @@ -0,0 +1,125 @@ +CREATE SEQUENCE public.chromosome_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; + +CREATE TABLE chromosome ( + id bigint CONSTRAINT chromosome_pkey PRIMARY KEY, + dataprovider_id bigint, + taxon_id bigint, + name varchar(255), + datecreated timestamp without time zone, + dateupdated timestamp without time zone, + dbdatecreated timestamp without time zone, + dbdateupdated timestamp without time zone, + internal boolean DEFAULT false, + obsolete boolean DEFAULT false, + createdby_id bigint, + updatedby_id bigint +); + +ALTER TABLE chromosome ADD CONSTRAINT chromosome_dataprovider_id_fk + FOREIGN KEY (dataprovider_id) REFERENCES dataprovider (id); +ALTER TABLE chromosome ADD CONSTRAINT chromosome_taxon_id_fk + FOREIGN KEY (taxon_id) REFERENCES ontologyterm (id); +ALTER TABLE chromosome ADD CONSTRAINT chromosome_createdby_id_fk + FOREIGN KEY (createdby_id) REFERENCES person (id); +ALTER TABLE chromosome ADD CONSTRAINT chromosome_updatedby_id_fk + FOREIGN KEY (updatedby_id) REFERENCES person (id); + +ALTER TABLE chromosome ADD CONSTRAINT chromosome_name_taxon_uk UNIQUE (name, taxon_id); + +CREATE INDEX chromosome_name_index ON chromosome USING btree (name); +CREATE INDEX chromosome_dataprovider_index ON chromosome USING btree (dataprovider_id); +CREATE INDEX chromosome_taxon_index ON chromosome USING btree (taxon_id); +CREATE INDEX chromosome_createdby_index ON chromosome USING btree (createdby_id); +CREATE INDEX chromosome_updatedby_index ON chromosome USING btree (updatedby_id); + + +CREATE TABLE assemblycomponent ( + id bigint CONSTRAINT assemblycomponent_pkey PRIMARY KEY, + genomeassembly_id bigint, + mapstochromosome_id bigint, + name varchar(255) +); + +ALTER TABLE assemblycomponent ADD CONSTRAINT assemblycomponent_id_fk + FOREIGN KEY (id) REFERENCES genomicentity(id); +ALTER TABLE assemblycomponent ADD CONSTRAINT assemblycomponent_genomeassembly_id_fk + FOREIGN KEY (genomeassembly_id) REFERENCES genomeassembly(id); +ALTER TABLE assemblycomponent ADD CONSTRAINT assemblycomponent_mapstochromosome_id_fk + FOREIGN KEY (mapstochromosome_id) REFERENCES chromosome(id); + +CREATE INDEX assemblycomponent_genomeassembly_index ON assemblycomponent USING btree (genomeassembly_id); + +CREATE TABLE codingsequencegenomiclocationassociation ( + id bigint CONSTRAINT codingsequencegenomiclocationassociation_pkey PRIMARY KEY, + "start" integer, + "end" integer, + relation_id bigint, + codingsequenceassociationsubject_id bigint, + codingsequencegenomiclocationassociationobject_id bigint +); + +ALTER TABLE codingsequencegenomiclocationassociation ADD CONSTRAINT codingsequencegenomiclocationassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE codingsequencegenomiclocationassociation ADD CONSTRAINT codingsequencegenomiclocationassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE codingsequencegenomiclocationassociation ADD CONSTRAINT codingsequencegenomiclocationassociation_cdsasubject_id_fk + FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); +ALTER TABLE codingsequencegenomiclocationassociation ADD CONSTRAINT codingsequencegenomiclocationassociation_cdsglaobject_id_fk + FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +CREATE INDEX codingsequencelocationassociation_relation_index ON codingsequencegenomiclocationassociation + USING btree (relation_id); +CREATE INDEX codingsequencelocationassociation_subject_index ON codingsequencegenomiclocationassociation + USING btree (codingsequenceassociationsubject_id); +CREATE INDEX codingsequencelocationassociation_object_index ON codingsequencegenomiclocationassociation + USING btree (codingsequencegenomiclocationassociationobject_id); + +CREATE TABLE exongenomiclocationassociation ( + id bigint CONSTRAINT exongenomiclocationassociation_pkey PRIMARY KEY, + "start" integer, + "end" integer, + relation_id bigint, + exonassociationsubject_id bigint, + exongenomiclocationassociationobject_id bigint +); + +ALTER TABLE exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_easubject_id_fk + FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); +ALTER TABLE exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_eglaobject_id_fk + FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +CREATE INDEX exonlocationassociation_relation_index ON exongenomiclocationassociation + USING btree (relation_id); +CREATE INDEX exonlocationassociation_subject_index ON exongenomiclocationassociation + USING btree (exonassociationsubject_id); +CREATE INDEX exonlocationassociation_object_index ON exongenomiclocationassociation + USING btree (exongenomiclocationassociationobject_id); + +CREATE TABLE transcriptgenomiclocationassociation ( + id bigint CONSTRAINT transcriptgenomiclocationassociation_pkey PRIMARY KEY, + "start" integer, + "end" integer, + relation_id bigint, + transcriptassociationsubject_id bigint, + transcriptgenomiclocationassociationobject_id bigint +); + +ALTER TABLE transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgenomiclocationassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgenomiclocationassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgenomiclocationassociation_tasubject_id_fk + FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgenomiclocationassociation_tglaobject_id_fk + FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +CREATE INDEX transcriptlocationassociation_relation_index ON transcriptgenomiclocationassociation + USING btree (relation_id); +CREATE INDEX transcriptlocationassociation_subject_index ON transcriptgenomiclocationassociation + USING btree (transcriptassociationsubject_id); +CREATE INDEX transcriptlocationassociation_object_index ON transcriptgenomiclocationassociation + USING btree (transcriptgenomiclocationassociationobject_id); \ No newline at end of file From bf735fc133f86282960f9cd272550d90d7e76a75 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 11 Jul 2024 15:43:22 +0100 Subject: [PATCH 034/342] Association services --- .../constants/EntityFieldConstants.java | 3 + .../jobs/executors/Gff3Executor.java | 26 ++++- .../curation_api/services/Gff3Service.java | 31 +++++- ...enceGenomicLocationAssociationService.java | 101 ++++++++++++++++++ ...ExonGenomicLocationAssociationService.java | 101 ++++++++++++++++++ ...riptGenomicLocationAssociationService.java | 101 ++++++++++++++++++ .../validation/dto/Gff3DtoValidator.java | 22 ++++ 7 files changed, 378 insertions(+), 7 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java 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 a86abe168..a79114e6f 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -14,7 +14,10 @@ private EntityFieldConstants() { public static final String PA_SUBJECT = "phenotypeAnnotationSubject"; public static final String PA_SUBJECT_TAXON = PA_SUBJECT + "." + TAXON; public static final String ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "alleleAssociationSubject." + DATA_PROVIDER; + public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "codingSequenceAssociationSubject." + DATA_PROVIDER; public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "constructAssociationSubject." + DATA_PROVIDER; + public static final String EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER = "exonAssociationSubject." + DATA_PROVIDER; + public static final String TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "transcriptAssociationSubject." + DATA_PROVIDER; public static final String SUBJECT_GENE_DATA_PROVIDER = "subjectGene." + DATA_PROVIDER; public static final String SUBJECT_GENE_TAXON = "subjectGene." + TAXON; public static final String EA_SUBJECT_TAXON = "expressionAnnotationSubject.taxon.curie"; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 34705544d..abf01caf2 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -22,8 +22,10 @@ import org.alliancegenome.curation_api.services.ExonService; import org.alliancegenome.curation_api.services.Gff3Service; import org.alliancegenome.curation_api.services.TranscriptService; +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.transcriptAssociations.TranscriptGenomicLocationAssociationService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; -import org.apache.commons.lang3.ObjectUtils; import com.fasterxml.jackson.databind.MappingIterator; import com.fasterxml.jackson.dataformat.csv.CsvMapper; @@ -40,6 +42,9 @@ public class Gff3Executor extends LoadFileExecutor { @Inject ExonService exonService; @Inject CodingSequenceService cdsService; @Inject TranscriptService transcriptService; + @Inject ExonGenomicLocationAssociationService exonLocationService; + @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; + @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; public void execLoad(BulkLoadFile bulkLoadFile) { try { @@ -66,6 +71,9 @@ public void execLoad(BulkLoadFile bulkLoadFile) { idsAdded.put("Transcript", new ArrayList()); idsAdded.put("Exon", new ArrayList()); idsAdded.put("CodingSequence", new ArrayList()); + idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); + idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); + idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); Map> previousIds = getPreviouslyLoadedIds(dataProvider); @@ -75,6 +83,9 @@ public void execLoad(BulkLoadFile bulkLoadFile) { runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); + runCleanup(transcriptLocationService, history, dataProvider.name(), previousIds.get("TranscriptGenomicLocationAssociation"), idsAdded.get("TranscriptGenomicLocationAssociation"), "GFF transcript genomic location association", bulkLoadFile.getMd5Sum()); + runCleanup(exonLocationService, history, dataProvider.name(), previousIds.get("ExonGenomicLocationAssociation"), idsAdded.get("ExonGenomicLocationAssociation"), "GFF exon genomic location association", bulkLoadFile.getMd5Sum()); + runCleanup(cdsLocationService, history, dataProvider.name(), previousIds.get("CodingSequenceGenomicLocationAssociation"), idsAdded.get("CodingSequenceGenomicLocationAssociation"), "GFF coding sequence genomic location association", bulkLoadFile.getMd5Sum()); history.finishLoad(); finalSaveHistory(history); @@ -90,6 +101,10 @@ private Map> getPreviouslyLoadedIds(BackendBulkDataProvider d previousIds.put("Transcript", transcriptService.getIdsByDataProvider(dataProvider)); previousIds.put("Exon", exonService.getIdsByDataProvider(dataProvider)); previousIds.put("CodingSequence", cdsService.getIdsByDataProvider(dataProvider)); + previousIds.put("TranscriptGenomicLocationAssociation", transcriptLocationService.getIdsByDataProvider(dataProvider)); + previousIds.put("ExonGenomicLocationAssociation", exonLocationService.getIdsByDataProvider(dataProvider)); + previousIds.put("CodingSequenceGenomicLocationAssociation", cdsLocationService.getIdsByDataProvider(dataProvider)); + return previousIds; } @@ -108,9 +123,7 @@ private Map> runLoad(BulkLoadFileHistory history, List()); idsAdded.put("Exon", new ArrayList()); idsAdded.put("CodingSequence", new ArrayList()); + idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); + idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); + idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); runLoad(history, null, gffData, idsAdded, dataProvider, assemblyName); @@ -171,7 +187,7 @@ private Map> loadAssociations(BulkLoadFileHistory history, Li BackendBulkDataProvider dataProvider, GenomeAssembly assembly, ProcessDisplayHelper ph) { for (Gff3DTO gff3Entry : gffData) { try { - idsAdded = gff3Service.loadAssociation(history, gff3Entry, idsAdded, dataProvider, assembly); + idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assembly); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); 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 3910b5045..07eaa030e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -15,11 +15,15 @@ import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; 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.transcriptAssociations.TranscriptGenomicLocationAssociation; 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.SearchResponse; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; @@ -88,8 +92,31 @@ public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO g return idsAdded; } - public Map> loadAssociation(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { - // TODO: implement association loading + public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { + if (ObjectUtils.isEmpty(assembly)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { + ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, assembly, dataProvider); + if (exonLocation != null) { + idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); + } + } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, assembly, dataProvider); + if (cdsLocation != null) { + idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); + } + } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { + gffEntry.setType("lncRNA"); + } + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, assembly, dataProvider); + if (transcriptLocation != null) { + idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); + } + } + return idsAdded; } 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 new file mode 100644 index 000000000..b611e5549 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociationService.java @@ -0,0 +1,101 @@ +package org.alliancegenome.curation_api.services.associations.codingSequenceAssociations; + +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.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; + +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 CodingSequenceGenomicLocationAssociationService extends BaseEntityCrudService { + + @Inject CodingSequenceGenomicLocationAssociationDAO codingSequenceGenomicLocationAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(codingSequenceGenomicLocationAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + List associationIds = codingSequenceGenomicLocationAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public CodingSequenceGenomicLocationAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + CodingSequenceGenomicLocationAssociation association = codingSequenceGenomicLocationAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find CodingSequenceGenomicLocationAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return codingSequenceGenomicLocationAssociationDAO.persist(association); + } + return association; + } + + codingSequenceGenomicLocationAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long codingSequenceId, Long assemblyComponentId) { + CodingSequenceGenomicLocationAssociation association = null; + + Map params = new HashMap<>(); + params.put("codingSequenceAssociationSubject.id", codingSequenceId); + params.put("codingSequenceGenomicLocationAssociationObject.id", assemblyComponentId); + + SearchResponse resp = codingSequenceGenomicLocationAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java new file mode 100644 index 000000000..c2c767616 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java @@ -0,0 +1,101 @@ +package org.alliancegenome.curation_api.services.associations.exonAssociations; + +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.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; + +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 ExonGenomicLocationAssociationService extends BaseEntityCrudService { + + @Inject ExonGenomicLocationAssociationDAO exonGenomicLocationAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(exonGenomicLocationAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + List associationIds = exonGenomicLocationAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public ExonGenomicLocationAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + ExonGenomicLocationAssociation association = exonGenomicLocationAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find ExonGenomicLocationAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return exonGenomicLocationAssociationDAO.persist(association); + } + return association; + } + + exonGenomicLocationAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long exonId, Long assemblyComponentId) { + ExonGenomicLocationAssociation association = null; + + Map params = new HashMap<>(); + params.put("exonAssociationSubject.id", exonId); + params.put("exonGenomicLocationAssociationObject.id", assemblyComponentId); + + SearchResponse resp = exonGenomicLocationAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java new file mode 100644 index 000000000..893a425c1 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java @@ -0,0 +1,101 @@ +package org.alliancegenome.curation_api.services.associations.transcriptAssociations; + +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.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; + +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 TranscriptGenomicLocationAssociationService extends BaseEntityCrudService { + + @Inject TranscriptGenomicLocationAssociationDAO transcriptGenomicLocationAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(transcriptGenomicLocationAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + List associationIds = transcriptGenomicLocationAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public TranscriptGenomicLocationAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + TranscriptGenomicLocationAssociation association = transcriptGenomicLocationAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find TranscriptGenomicLocationAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return transcriptGenomicLocationAssociationDAO.persist(association); + } + return association; + } + + transcriptGenomicLocationAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long transcriptId, Long assemblyComponentId) { + TranscriptGenomicLocationAssociation association = null; + + Map params = new HashMap<>(); + params.put("transcriptAssociationSubject.id", transcriptId); + params.put("transcriptGenomicLocationAssociationObject.id", assemblyComponentId); + + SearchResponse resp = transcriptGenomicLocationAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 1e31a1c27..3d0e51665 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -13,8 +13,12 @@ import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.GenomicEntity; 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.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -170,4 +174,22 @@ private Map getAttributes(Gff3DTO dto, BackendBulkDataProvider d return attributes; } + public CodingSequenceGenomicLocationAssociation validateCdsSequenceLocation(Gff3DTO gffEntry, GenomeAssembly assembly, + BackendBulkDataProvider dataProvider) { + // TODO Auto-generated method stub + return null; + } + + public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, GenomeAssembly assembly, + BackendBulkDataProvider dataProvider) { + // TODO Auto-generated method stub + return null; + } + + public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO gffEntry, GenomeAssembly assembly, + BackendBulkDataProvider dataProvider) { + // TODO Auto-generated method stub + return null; + } + } From cb6ed28110ae6f5eae19edf7054bef3f5996e58e Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 11 Jul 2024 10:17:41 -0500 Subject: [PATCH 035/342] SCRUM-4259 fix construct table error --- .../ConstructGenomicEntityAssociation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 352218bbb..20373fcfd 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 @@ -66,7 +66,7 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({"alleleGeneAssociations", "constructGenomicEntityAssociations"}) + @JsonIgnoreProperties({"alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations"}) private GenomicEntity constructGenomicEntityAssociationObject; @IndexedEmbedded(includePaths = {"freeText", "noteType.name", "references.curie", From 437c5ffb5424c4d50db5d55e46d508986070e47a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 11 Jul 2024 16:48:42 +0100 Subject: [PATCH 036/342] Prevent serialisation of associations --- .../SequenceTargetingReagentGeneAssociation.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java index 61769cdde..836ed15cc 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java @@ -44,6 +44,7 @@ public class SequenceTargetingReagentGeneAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"name", "synonyms", "secondaryIdentifiers"}) + @JsonIgnoreProperties("sequenceTargetingReagentGeneAssociations") @ManyToOne @JsonView({ View.FieldsOnly.class }) @Fetch(FetchMode.JOIN) @@ -62,6 +63,6 @@ public class SequenceTargetingReagentGeneAssociation extends EvidenceAssociation @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations" }) + @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations" }) private Gene sequenceTargetingReagentGeneAssociationObject; } From 46e383f744c5d3c4652f06d391d7ec144f26697d Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 11 Jul 2024 17:23:02 +0100 Subject: [PATCH 037/342] Add prefix to ID attribute --- .../services/validation/dto/Gff3DtoValidator.java | 11 +++++++++++ .../curation_api/Gff3BulkUploadITCase.java | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 1e31a1c27..d4516f702 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -167,6 +167,17 @@ private Map getAttributes(Gff3DTO dto, BackendBulkDataProvider d } } + for (String key : List.of("ID", "Parent")) { + if (attributes.containsKey(key)) { + String id = attributes.get(key); + String[] idParts = id.split(":"); + if (idParts.length == 1) { + id = dataProvider.name() + ':' + idParts[0]; + } + attributes.put(key, id); + } + } + return attributes; } diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index ec9e06414..247fc8f4a 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -41,9 +41,9 @@ public void init() { private final String transcriptGetEndpoint = "/api/transcript/"; private final String exonGetEndpoint = "/api/exon/"; private final String cdsGetEndpoint = "/api/cds/"; - private final String transcriptId = "Y74C9A.2a.1"; - private final String exonUniqueId = "Y74C9A.2a_exon|Y74C9A.2a.1|I|1|100|+"; - private final String cdsUniqueId = "Y74C9A.2a|Y74C9A.2a.1|I|10|100|+"; + private final String transcriptId = "WB:Y74C9A.2a.1"; + private final String exonUniqueId = "WB:Y74C9A.2a_exon|WB:Y74C9A.2a.1|I|1|100|+"; + private final String cdsUniqueId = "WB:Y74C9A.2a|WB:Y74C9A.2a.1|I|10|100|+"; private void loadRequiredEntities() throws Exception { createSoTerm("SO:0000234", "mRNA", false); From af9a2bf00b9b3d73971a087f8a818efcb616c18f Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 11 Jul 2024 09:01:21 -0500 Subject: [PATCH 038/342] SCRUM-4187 update SQTR endpoints to exclude gene associations --- ...SequenceTargetingReagentCrudInterface.java | 21 +++++++++++++++++++ .../entities/SequenceTargetingReagent.java | 8 +++---- .../curation_api/view/View.java | 6 ++++++ 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java index 274e4415d..29571072c 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java @@ -1,19 +1,26 @@ package org.alliancegenome.curation_api.interfaces.crud; +import java.util.HashMap; + import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; +import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; import org.eclipse.microprofile.openapi.annotations.tags.Tag; import com.fasterxml.jackson.annotation.JsonView; import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.DefaultValue; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; @Path("/sqtr") @@ -26,4 +33,18 @@ public interface SequenceTargetingReagentCrudInterface extends BaseIdCrudInterfa @Path("/bulk/{dataProvider}/sqtrfile") @JsonView(View.FieldsAndLists.class) APIResponse updateSequenceTargetingReagent(@PathParam("dataProvider") String dataProvider, SequenceTargetingReagentIngestFmsDTO sqtrData); + + @Override + @POST + @Path("/find") + @Tag(name = "Relational Database Browsing Endpoints") + @JsonView(View.SequenceTargetingReagentView.class) + SearchResponse find(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); + + @Override + @POST + @Path("/search") + @Tag(name = "Elastic Search Browsing Endpoints") + @JsonView({ View.SequenceTargetingReagentView.class }) + SearchResponse search(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java index 8ab8aadbb..6fb8a4510 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java @@ -53,24 +53,24 @@ public class SequenceTargetingReagent extends GenomicEntity { @Index(name = "sequencetargetingreagent_reference_sqtr_index", columnList = "sequencetargetingreagent_id"), @Index(name = "sequencetargetingreagent_reference_references_index", columnList = "references_id") }) - @JsonView({ View.FieldsAndLists.class }) + @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentView.class }) private List references; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "synonyms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ElementCollection @JoinTable(indexes = @Index(name = "sequencetargetingreagent_synonyms_sequencetargetingreagent_index", columnList = "sequencetargetingreagent_id")) - @JsonView({ View.FieldsAndLists.class }) + @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentView.class }) private List synonyms; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "secondaryIdentifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ElementCollection @JoinTable(indexes = @Index(name = "sequencetargetingreagent_secondaryIdentifiers_sequencetargetingreagent_index", columnList = "sequencetargetingreagent_id")) - @JsonView({ View.FieldsAndLists.class }) + @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentView.class }) private List secondaryIdentifiers; @OneToMany(mappedBy = "sequenceTargetingReagentAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class }) + @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentDetailView.class }) private List sequenceTargetingReagentGeneAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/view/View.java b/src/main/java/org/alliancegenome/curation_api/view/View.java index 03c1ea2ab..24dc2fbc4 100644 --- a/src/main/java/org/alliancegenome/curation_api/view/View.java +++ b/src/main/java/org/alliancegenome/curation_api/view/View.java @@ -73,6 +73,12 @@ public static class AlleleView extends FieldsOnly { public static class AlleleDetailView extends AlleleView { } + public static class SequenceTargetingReagentView extends FieldsOnly { + } + + public static class SequenceTargetingReagentDetailView extends SequenceTargetingReagentView { + } + public static class AlleleUpdate extends AlleleView { } From 4d6196de8f8f5d4f9c78b7cccd032e3791c5f675 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 11 Jul 2024 11:35:15 -0500 Subject: [PATCH 039/342] SCRUM-4187 add SQTR Gene Association controller and interface --- ...gReagentGeneAssociationCrudController.java | 35 +++++++++++++++++++ ...SequenceTargetingReagentCrudInterface.java | 1 - ...ngReagentGeneAssociationCrudInterface.java | 26 ++++++++++++++ ...argetingReagentGeneAssociationService.java | 10 +++++- 4 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java new file mode 100644 index 000000000..4b4cdaee3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java @@ -0,0 +1,35 @@ +package org.alliancegenome.curation_api.controllers.crud.associations; + +import java.util.List; + +import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; +import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; +import org.alliancegenome.curation_api.interfaces.crud.associations.SequenceTargetingReagentGeneAssociationCrudInterface; +import org.alliancegenome.curation_api.interfaces.crud.associations.alleleAssociations.AlleleGeneAssociationCrudInterface; +import org.alliancegenome.curation_api.jobs.executors.SequenceTargetingReagentExecutor; +import org.alliancegenome.curation_api.jobs.executors.associations.alleleAssociations.AlleleGeneAssociationExecutor; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleGeneAssociationDTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.associations.SequenceTargetingReagentGeneAssociationService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class SequenceTargetingReagentGeneAssociationCrudController extends + BaseEntityCrudController implements SequenceTargetingReagentGeneAssociationCrudInterface { + + @Inject SequenceTargetingReagentExecutor sqtrExecutor; + @Inject SequenceTargetingReagentGeneAssociationService sequenceTargetingReagentGeneAssociationService; + + @Override + @PostConstruct + protected void init() { + setService(sequenceTargetingReagentGeneAssociationService); + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java index 29571072c..db9f22b12 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java @@ -3,7 +3,6 @@ import java.util.HashMap; import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; -import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java new file mode 100644 index 000000000..da0c3a7bf --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java @@ -0,0 +1,26 @@ +package org.alliancegenome.curation_api.interfaces.crud.associations; + +import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; +import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +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.GET; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; +import jakarta.ws.rs.core.MediaType; + +@Path("/sqtrgeneassociation") +@Tag(name = "CRUD - SQTR Gene Associations") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { + + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index 7cce13c41..b8843e966 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -15,20 +15,28 @@ import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.associations.SequenceTargetingReagentGeneAssociationFmsDTOValidator; +import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.transaction.Transactional; @RequestScoped -public class SequenceTargetingReagentGeneAssociationService { +public class SequenceTargetingReagentGeneAssociationService extends BaseEntityCrudService{ @Inject SequenceTargetingReagentGeneAssociationDAO sequenceTargetingReagentGeneAssociationDAO; @Inject SequenceTargetingReagentGeneAssociationFmsDTOValidator sequenceTargetingReagentGeneAssociationFmsDTOValidator; + @Override + @PostConstruct + protected void init() { + setSQLDao(sequenceTargetingReagentGeneAssociationDAO); + } + @Transactional public List loadGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { From 6079543388fd3f556ef3add278ff2fa1acc44467 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 11 Jul 2024 13:00:04 -0500 Subject: [PATCH 040/342] SCRUM-4187 update whitespace --- ...TargetingReagentGeneAssociationCrudController.java | 9 --------- ...eTargetingReagentGeneAssociationCrudInterface.java | 11 +---------- ...equenceTargetingReagentGeneAssociationService.java | 2 +- 3 files changed, 2 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java index 4b4cdaee3..9823f666f 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java @@ -1,19 +1,10 @@ package org.alliancegenome.curation_api.controllers.crud.associations; -import java.util.List; - import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; -import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; import org.alliancegenome.curation_api.interfaces.crud.associations.SequenceTargetingReagentGeneAssociationCrudInterface; -import org.alliancegenome.curation_api.interfaces.crud.associations.alleleAssociations.AlleleGeneAssociationCrudInterface; import org.alliancegenome.curation_api.jobs.executors.SequenceTargetingReagentExecutor; -import org.alliancegenome.curation_api.jobs.executors.associations.alleleAssociations.AlleleGeneAssociationExecutor; -import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; -import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleGeneAssociationDTO; -import org.alliancegenome.curation_api.response.APIResponse; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.associations.SequenceTargetingReagentGeneAssociationService; import jakarta.annotation.PostConstruct; diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java index da0c3a7bf..918543e49 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java @@ -2,25 +2,16 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; -import org.alliancegenome.curation_api.response.ObjectResponse; -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.GET; -import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; @Path("/sqtrgeneassociation") @Tag(name = "CRUD - SQTR Gene Associations") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { - - -} +public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index b8843e966..5e9e002dd 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -24,7 +24,7 @@ import jakarta.transaction.Transactional; @RequestScoped -public class SequenceTargetingReagentGeneAssociationService extends BaseEntityCrudService{ +public class SequenceTargetingReagentGeneAssociationService extends BaseEntityCrudService { @Inject SequenceTargetingReagentGeneAssociationDAO sequenceTargetingReagentGeneAssociationDAO; From 0270da3669a662c3a2086e40c93b10b8b279ff35 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 11 Jul 2024 22:30:19 -0500 Subject: [PATCH 041/342] Adding HTPexpressiondataset entities --- .../cliapp/src/service/DataLoadService.js | 1 + .../enums/BackendBulkLoadType.java | 3 +- ...ThroughputExpressionDatasetAnnotation.java | 60 ++++++++++ ...6.0.4__highthroughputexpressiondataset.sql | 103 ++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java create mode 100644 src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 5e5b729fc..c361e810e 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,6 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', + 'HTP EXPRESSION DATASET ANNOTATION', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 9172530be..119aef824 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -23,7 +23,8 @@ public enum BackendBulkLoadType { INTERACTION_GEN("tsv"), PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), - EXPRESSION("json"); + EXPRESSION("json"), + HTP_EXPRESSION_DATASET_ANNOTATION("json"); public String fileExtension; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java new file mode 100644 index 000000000..f16dbd1a8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -0,0 +1,60 @@ +package org.alliancegenome.curation_api.model.entities; + +import java.util.List; + +import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; +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.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; +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.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") +public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ + + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @Fetch(FetchMode.JOIN) + @JoinTable(indexes = { + @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_reference_references_index", columnList = "references_id") + }) + @JsonView({ View.FieldsAndLists.class }) + private List references; + + @JsonView({ View.FieldsOnly.class }) + private String realtedNote; + + @JsonView({ View.FieldsOnly.class }) + private Integer numberOfChannels; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @JsonView({ View.FieldsAndLists.class }) + @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) + List categoryTags; + +} diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql new file mode 100644 index 000000000..605d58caa --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -0,0 +1,103 @@ +-- To create bulk loads + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Annotation Bulk Loads'); + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; + + +--Adding 3 extra vocabulary terms for HTPTags + +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; + +-- Adding highthroughputexpressiondatasetannotation + +CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; + +CREATE TABLE highthroughputexpressiondatasetannotation ( + 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, + curie character varying(255), + modentityid character varying(255), + modinternalid character varying(255), + name character varying(255), + numberofchannels integer, + realtednote character varying(255), + createdby_id bigint, + updatedby_id bigint, + dataprovider_id bigint +); + +CREATE TABLE highthroughputexpressiondatasetannotation_categorytags ( + highthroughputexpressiondatasetannotation_id bigint NOT NULL, + categorytags_id bigint NOT NULL + ); + +CREATE TABLE highthroughputexpressiondatasetannotation_reference ( + highthroughputexpressiondatasetannotation_id bigint NOT NULL, + references_id bigint NOT NULL + ); + +ALTER TABLE highthroughputexpressiondatasetannotation ADD CONSTRAINT highthroughputexpressiondatasetannotation_pkey PRIMARY KEY (id); + +CREATE INDEX htpdatasetannotation_reference_htpdataset_index ON highthroughputexpressiondatasetannotation_reference USING btree (highthroughputexpressiondatasetannotation_id); + +CREATE INDEX htpdatasetannotation_reference_references_index ON highthroughputexpressiondatasetannotation_reference USING btree (references_id); + +CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (categorytags_id); + +CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); + +ALTER TABLE highthroughputexpressiondatasetannotation_categorytags + ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT highthroughputexpressiondatasetannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_categorytags + ADD CONSTRAINT htpdatasetannotation_categorytags_categorytags_id_fk FOREIGN KEY (categorytags_id) REFERENCES vocabularyterm(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_reference + ADD CONSTRAINT htpdatasetannotation_reference_htpdatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_reference + ADD CONSTRAINT htpdatasetannotation_reference_references_id_fk FOREIGN KEY (references_id) REFERENCES reference(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT htpdatasetannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT htpdatasetannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); \ No newline at end of file From 5908c6c43a1bd93589bc4618c0466fe446b302e9 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 11 Jul 2024 22:39:46 -0500 Subject: [PATCH 042/342] Formatting --- ...ThroughputExpressionDatasetAnnotation.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index f16dbd1a8..fd40d6e52 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -28,12 +28,12 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") -public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ +public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsOnly.class }) - private String name; + private String name; - @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) + @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.JOIN) @@ -44,17 +44,17 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ @JsonView({ View.FieldsAndLists.class }) private List references; - @JsonView({ View.FieldsOnly.class }) - private String realtedNote; + @JsonView({ View.FieldsOnly.class }) + private String realtedNote; - @JsonView({ View.FieldsOnly.class }) - private Integer numberOfChannels; + @JsonView({ View.FieldsOnly.class }) + private Integer numberOfChannels; - @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) - @ManyToMany - @JsonView({ View.FieldsAndLists.class }) + @ManyToMany + @JsonView({ View.FieldsAndLists.class }) @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) - List categoryTags; + List categoryTags; } From 4c4772b74d251f00bb877d4e519fbe0860135403 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 12 Jul 2024 10:24:18 +0100 Subject: [PATCH 043/342] More GFF association loading code --- .../constants/EntityFieldConstants.java | 38 +++- .../curation_api/constants/Gff3Constants.java | 4 +- .../jobs/executors/LoadFileExecutor.java | 3 +- .../model/entities/AssemblyComponent.java | 2 +- .../model/entities/LocationAssociation.java | 3 + ...ingSequenceGenomicLocationAssociation.java | 19 +- .../ExonGenomicLocationAssociation.java | 12 ++ .../TranscriptGenomicLocationAssociation.java | 17 ++ .../services/AssemblyComponentService.java | 81 +++++++++ .../curation_api/services/Gff3Service.java | 46 ++++- ...enceGenomicLocationAssociationService.java | 34 ++++ ...ExonGenomicLocationAssociationService.java | 34 ++++ ...riptGenomicLocationAssociationService.java | 34 ++++ .../helpers/gff3/Gff3AttributesHelper.java | 44 +++++ .../validation/dto/Gff3DtoValidator.java | 163 +++++++++++++----- .../v0.36.0.4__gff_association_tables.sql | 5 + .../curation_api/Gff3BulkUploadITCase.java | 9 +- .../fms/08_gff_data/GFF01_transcript.json | 4 +- .../bulk/fms/08_gff_data/GFF03_CDS.json | 1 + 19 files changed, 495 insertions(+), 58 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java 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 a79114e6f..ce370dae3 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -6,19 +6,39 @@ private EntityFieldConstants() { // Hidden from view, as it is a utility class } + public static final String ASSEMBLY = "genomeAssembly.modEntityId"; public static final String TAXON = "taxon.curie"; - public static final String DATA_PROVIDER = "dataProvider.sourceOrganization.abbreviation"; - public static final String SECONDARY_DATA_PROVIDER = "secondaryDataProvider.sourceOrganization.abbreviation"; + 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 DA_SUBJECT_TAXON = DA_SUBJECT + "." + TAXON; + public static final String EA_SUBJECT = "expressionAnnotationSubject"; public static final String PA_SUBJECT = "phenotypeAnnotationSubject"; + 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 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 ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "alleleAssociationSubject." + DATA_PROVIDER; - public static final String CODING_SEQUENCE_ASSOCIATION_SUBJECT_DATA_PROVIDER = "codingSequenceAssociationSubject." + DATA_PROVIDER; - public static final String CONSTRUCT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "constructAssociationSubject." + DATA_PROVIDER; - public static final String EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER = "exonAssociationSubject." + DATA_PROVIDER; - public static final String TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER = "transcriptAssociationSubject." + DATA_PROVIDER; + + 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 TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER = TRANSCRIPT_ASSOCIATION_SUBJECT + "." + DATA_PROVIDER; + + public static final String GENOMIC_LOCATION_ASSOCIATION_OBJECT = "GenomicLocationAssociationObject"; + public static final String CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "codingSequence" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; + public static final String EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "exon" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; + public static final String TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "transcript" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; + 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 SUBJECT_GENE_DATA_PROVIDER = "subjectGene." + DATA_PROVIDER; public static final String SUBJECT_GENE_TAXON = "subjectGene." + TAXON; - public static final String EA_SUBJECT_TAXON = "expressionAnnotationSubject.taxon.curie"; } 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 55b9ed3c2..1c7a78891 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -7,10 +7,12 @@ private Gff3Constants() { // Hidden from view, as it is a utility class throw new UnsupportedOperationException("This is a utility class and cannot be instantiated"); } + 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA" ); - + + public static final List STRANDS = List.of("+", "-"); } \ No newline at end of file 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 951e380b4..827693c81 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 @@ -259,7 +259,8 @@ protected boolean runLoad(BaseUpser List idsToRemove = ListUtils.subtract(annotationIdsBefore, distinctAfter); Log.debug("runLoad: Remove: " + dataProviderName + " " + idsToRemove.size()); - history.setTotalDeleteRecords((long) idsToRemove.size()); + long existingDeletes = history.getTotalDeleteRecords() == null ? 0 : history.getTotalDeleteRecords(); + history.setTotalDeleteRecords((long) idsToRemove.size() + existingDeletes); ProcessDisplayHelper ph = new ProcessDisplayHelper(10000); ph.startProcess("Deletion/deprecation of entities linked to unloaded " + dataProviderName, idsToRemove.size()); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index fa6ca8506..018cc8c9e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -30,7 +30,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(callSuper = true) +@ToString(exclude = {"transcriptGenomicLocationAssociations", "exonGenomicLocationAssociations", "codingSequenceGenomicLocationAssociations"}, callSuper = true) @Schema(name = "AssemblyComponent", description = "POJO that represents the AssemblyComponent") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table( diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java index 7378fd39a..8749bfcd4 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java @@ -13,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.Column; import jakarta.persistence.ManyToOne; import jakarta.persistence.MappedSuperclass; import lombok.Data; @@ -32,9 +33,11 @@ public abstract class LocationAssociation extends EvidenceAssociation { private VocabularyTerm relation; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @Column(name="`start`") private Integer start; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @Column(name="`end`") private Integer end; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index 15b75ce87..d431aad3a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -9,11 +9,19 @@ 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.Projectable; +import org.hibernate.search.engine.backend.types.Searchable; +import org.hibernate.search.engine.backend.types.Sortable; +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.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; @@ -55,5 +63,14 @@ public class CodingSequenceGenomicLocationAssociation extends LocationAssociatio @JsonView({ View.FieldsOnly.class }) @JsonIgnoreProperties("codingSequenceGenomicLocationAssociations") @Fetch(FetchMode.JOIN) - private AssemblyComponent codingSequenceGenomicLocationAssociationObject; + private AssemblyComponent codingSequenceGenomicLocationAssociationObject; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer phase; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "phenotypeAnnotationObject_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/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 35a11b125..112da96c6 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -9,11 +9,17 @@ 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.mapping.definition.annotation.FullTextField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; +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; @@ -56,4 +62,10 @@ public class ExonGenomicLocationAssociation extends LocationAssociation { @JsonIgnoreProperties("exonGenomicLocationAssociations") @Fetch(FetchMode.JOIN) private AssemblyComponent exonGenomicLocationAssociationObject; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "phenotypeAnnotationObject_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/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index 1f7488541..91f1e4a79 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -9,11 +9,19 @@ 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.Projectable; +import org.hibernate.search.engine.backend.types.Searchable; +import org.hibernate.search.engine.backend.types.Sortable; +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.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; @@ -56,4 +64,13 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { @JsonIgnoreProperties("transcriptGenomicLocationAssociations") @Fetch(FetchMode.JOIN) private AssemblyComponent transcriptGenomicLocationAssociationObject; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer phase; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "phenotypeAnnotationObject_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/services/AssemblyComponentService.java b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java new file mode 100644 index 000000000..49aeca977 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java @@ -0,0 +1,81 @@ +package org.alliancegenome.curation_api.services; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +import org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.AssemblyComponentDAO; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.helpers.UniqueIdGeneratorHelper; +import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; + +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 AssemblyComponentService extends BaseEntityCrudService { + + @Inject AssemblyComponentDAO assemblyComponentDAO; + @Inject NcbiTaxonTermService ncbiTaxonTermService; + @Inject DataProviderService dataProviderService; + + Date assemblyComponentRequest; + HashMap assemblyComponentCacheMap = new HashMap<>(); + + @Override + @PostConstruct + protected void init() { + setSQLDao(assemblyComponentDAO); + } + + @Transactional + public AssemblyComponent fetchOrCreate(String name, GenomeAssembly assembly, String taxonCurie, String dataProviderAbbreviation) { + AssemblyComponent assemblyComponent = null; + if (assemblyComponentRequest != null) { + UniqueIdGeneratorHelper uniqueIdGen = new UniqueIdGeneratorHelper(); + uniqueIdGen.add(name); + uniqueIdGen.add(assembly.getModEntityId()); + uniqueIdGen.add(taxonCurie); + uniqueIdGen.add(dataProviderAbbreviation); + String uniqueId = uniqueIdGen.getUniqueId(); + if (assemblyComponentCacheMap.containsKey(uniqueId)) { + assemblyComponent = assemblyComponentCacheMap.get(uniqueId); + } else { + Log.debug("AssemblyComponent not cached, caching name|assembly: (" + uniqueId + ")"); + assemblyComponent = findAssemblyComponentOrCreateDB(name, assembly, taxonCurie, dataProviderAbbreviation); + assemblyComponentCacheMap.put(uniqueId, assemblyComponent); + } + } else { + assemblyComponent = findAssemblyComponentOrCreateDB(name, assembly, taxonCurie, dataProviderAbbreviation); + assemblyComponentRequest = new Date(); + } + return assemblyComponent; + } + + private AssemblyComponent findAssemblyComponentOrCreateDB(String name, GenomeAssembly assembly, String taxonCurie, String dataProviderAbbreviation) { + Map params = new HashMap<>(); + params.put("name", name); + params.put(EntityFieldConstants.ASSEMBLY, assembly.getModEntityId()); + params.put(EntityFieldConstants.TAXON, taxonCurie); + params.put(EntityFieldConstants.DATA_PROVIDER, dataProviderAbbreviation); + SearchResponse assemblyComponentResponse = assemblyComponentDAO.findByParams(params); + if (assemblyComponentResponse != null && assemblyComponentResponse.getResults().size() > 0) { + return assemblyComponentResponse.getSingleResult(); + } + AssemblyComponent assemblyComponent = new AssemblyComponent(); + assemblyComponent.setName(name); + assemblyComponent.setGenomeAssembly(assembly); + assemblyComponent.setTaxon(ncbiTaxonTermService.getByCurie(taxonCurie).getEntity()); + assemblyComponent.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProviderAbbreviation)); + + return assemblyComponentDAO.persist(assemblyComponent); + } + +} 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 07eaa030e..4e3afe373 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -7,7 +7,10 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.constants.Gff3Constants; import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.dao.CodingSequenceDAO; +import org.alliancegenome.curation_api.dao.ExonDAO; 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.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; @@ -21,6 +24,11 @@ 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.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.transcriptAssociations.TranscriptGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; import org.apache.commons.lang3.ObjectUtils; @@ -34,6 +42,12 @@ public class Gff3Service { @Inject GenomeAssemblyDAO genomeAssemblyDAO; + @Inject ExonDAO exonDAO; + @Inject CodingSequenceDAO cdsDAO; + @Inject TranscriptDAO transcriptDAO; + @Inject ExonGenomicLocationAssociationService exonLocationService; + @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; + @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject Gff3DtoValidator gff3DtoValidator; @@ -92,28 +106,54 @@ public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO g return idsAdded; } + @Transactional public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { if (ObjectUtils.isEmpty(assembly)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } + Map attributes = Gff3AttributesHelper.getAttributes(gffEntry, dataProvider); if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, assembly, dataProvider); + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + Exon exon = response.getSingleResult(); + + ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assembly, dataProvider); if (exonLocation != null) { idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); + exonLocationService.addAssociationToSubjectAndObject(exonLocation); } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { - CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, assembly, dataProvider); + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + CodingSequence cds = response.getSingleResult(); + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assembly, dataProvider); if (cdsLocation != null) { idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); + cdsLocationService.addAssociationToSubjectAndObject(cdsLocation); } } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); } - TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, assembly, dataProvider); + if (!attributes.containsKey("ID")) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); + } + SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); + } + Transcript transcript = response.getSingleResult(); + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assembly, dataProvider); if (transcriptLocation != null) { idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); + transcriptLocationService.addAssociationToSubjectAndObject(transcriptLocation); } } 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 b611e5549..4eb4ac33d 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 @@ -1,16 +1,20 @@ package org.alliancegenome.curation_api.services.associations.codingSequenceAssociations; 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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.PersonDAO; import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -98,4 +102,34 @@ public ObjectResponse getLocationAssoc return response; } + + public void addAssociationToSubjectAndObject(CodingSequenceGenomicLocationAssociation association) { + CodingSequence cds = association.getCodingSequenceAssociationSubject(); + + List currentSubjectAssociations = cds.getCodingSequenceGenomicLocationAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(CodingSequenceGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + AssemblyComponent assemblyComponent = association.getCodingSequenceGenomicLocationAssociationObject(); + + List currentObjectAssociations = assemblyComponent.getCodingSequenceGenomicLocationAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(CodingSequenceGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java index c2c767616..c41861926 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java @@ -1,16 +1,20 @@ package org.alliancegenome.curation_api.services.associations.exonAssociations; 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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.PersonDAO; import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -98,4 +102,34 @@ public ObjectResponse getLocationAssociation(Lon return response; } + + public void addAssociationToSubjectAndObject(ExonGenomicLocationAssociation association) { + Exon exon = association.getExonAssociationSubject(); + + List currentSubjectAssociations = exon.getExonGenomicLocationAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(ExonGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + AssemblyComponent assemblyComponent = association.getExonGenomicLocationAssociationObject(); + + List currentObjectAssociations = assemblyComponent.getExonGenomicLocationAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(ExonGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java index 893a425c1..d4f06e2fe 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java @@ -1,16 +1,20 @@ package org.alliancegenome.curation_api.services.associations.transcriptAssociations; 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 org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.PersonDAO; import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -98,4 +102,34 @@ public ObjectResponse getLocationAssociati return response; } + + public void addAssociationToSubjectAndObject(TranscriptGenomicLocationAssociation association) { + Transcript transcript = association.getTranscriptAssociationSubject(); + + List currentSubjectAssociations = transcript.getTranscriptGenomicLocationAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(TranscriptGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + AssemblyComponent assemblyComponent = association.getTranscriptGenomicLocationAssociationObject(); + + List currentObjectAssociations = assemblyComponent.getTranscriptGenomicLocationAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(TranscriptGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java new file mode 100644 index 000000000..32e430424 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -0,0 +1,44 @@ +package org.alliancegenome.curation_api.services.helpers.gff3; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; + +@RequestScoped +public class Gff3AttributesHelper { + + public static Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { + Map attributes = new HashMap(); + if (CollectionUtils.isNotEmpty(dto.getAttributes())) { + for (String keyValue : dto.getAttributes()) { + String[] parts = keyValue.split("="); + if (parts.length == 2) { + attributes.put(parts[0], parts[1]); + } + } + } + + if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { + for (String key : List.of("ID", "Parent")) { + if (attributes.containsKey(key)) { + String id = attributes.get(key); + String[] idParts = id.split(":"); + if (idParts.length > 1) { + id = idParts[1]; + } + attributes.put(key, id); + } + } + } + + return attributes; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 3d0e51665..e7f4126ae 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -1,20 +1,26 @@ package org.alliancegenome.curation_api.services.validation.dto; import java.util.HashMap; -import java.util.List; import java.util.Map; +import org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.constants.Gff3Constants; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.dao.TranscriptDAO; +import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.dao.ontology.SoTermDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.GenomicEntity; +import org.alliancegenome.curation_api.model.entities.LocationAssociation; 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; @@ -23,10 +29,12 @@ import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.AssemblyComponentService; import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.Gff3Service; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; -import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; @@ -39,16 +47,21 @@ public class Gff3DtoValidator { @Inject ExonDAO exonDAO; @Inject TranscriptDAO transcriptDAO; @Inject CodingSequenceDAO codingSequenceDAO; + @Inject ExonGenomicLocationAssociationDAO exonLocationDAO; + @Inject TranscriptGenomicLocationAssociationDAO transcriptLocationDAO; + @Inject CodingSequenceGenomicLocationAssociationDAO cdsLocationDAO; + @Inject AssemblyComponentService assemblyComponentService; @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject SoTermDAO soTermDAO; + @Inject Gff3Service gff3Service; @Transactional public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { Exon exon = null; - Map attributes = getAttributes(dto, dataProvider); + Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = exonDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -76,7 +89,7 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, BackendBulkDataProvider data CodingSequence cds = null; - Map attributes = getAttributes(dto, dataProvider); + Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = codingSequenceDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -104,7 +117,7 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider d Transcript transcript = null; - Map attributes = getAttributes(dto, dataProvider); + Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); if (attributes.containsKey("ID")) { SearchResponse searchResponse = transcriptDAO.findByField("modInternalId", attributes.get("ID")); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -146,50 +159,120 @@ private ObjectResponse validateGffEntity(E entity, return geResponse; } - - private Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { - Map attributes = new HashMap(); - if (CollectionUtils.isNotEmpty(dto.getAttributes())) { - for (String keyValue : dto.getAttributes()) { - String[] parts = keyValue.split("="); - if (parts.length == 2) { - attributes.put(parts[0], parts[1]); - } - } - } - if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { - for (String key : List.of("ID", "Parent")) { - if (attributes.containsKey(key)) { - String id = attributes.get(key); - String[] idParts = id.split(":"); - if (idParts.length > 1) { - id = idParts[1]; - } - attributes.put(key, id); - } + @Transactional + public CodingSequenceGenomicLocationAssociation validateCdsLocation(Gff3DTO gffEntry, CodingSequence cds, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + AssemblyComponent assemblyComponent = null; + CodingSequenceGenomicLocationAssociation locationAssociation = new CodingSequenceGenomicLocationAssociation(); + if (StringUtils.isNotBlank(gffEntry.getSeqId())) { + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + Map params = new HashMap<>(); + params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT + ".id", cds.getId()); + params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); + params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + SearchResponse locationSearchResponse = cdsLocationDAO.findByParams(params); + if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { + locationAssociation = locationSearchResponse.getSingleResult(); } + locationAssociation.setCodingSequenceGenomicLocationAssociationObject(assemblyComponent); } + locationAssociation.setCodingSequenceAssociationSubject(cds); + locationAssociation.setStrand(gffEntry.getStrand()); + locationAssociation.setPhase(gffEntry.getPhase()); - return attributes; + ObjectResponse locationResponse = validateLocationAssociation(locationAssociation, gffEntry, assemblyComponent); + if (locationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, locationResponse.errorMessagesString()); + } + + return cdsLocationDAO.persist(locationResponse.getEntity()); } - public CodingSequenceGenomicLocationAssociation validateCdsSequenceLocation(Gff3DTO gffEntry, GenomeAssembly assembly, - BackendBulkDataProvider dataProvider) { - // TODO Auto-generated method stub - return null; + @Transactional + public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, Exon exon, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + AssemblyComponent assemblyComponent = null; + ExonGenomicLocationAssociation locationAssociation = new ExonGenomicLocationAssociation(); + if (StringUtils.isNotBlank(gffEntry.getSeqId())) { + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + Map params = new HashMap<>(); + params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT + ".id", exon.getId()); + params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); + params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + SearchResponse locationSearchResponse = exonLocationDAO.findByParams(params); + if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { + locationAssociation = locationSearchResponse.getSingleResult(); + } + locationAssociation.setExonGenomicLocationAssociationObject(assemblyComponent); + } + locationAssociation.setExonAssociationSubject(exon); + locationAssociation.setStrand(gffEntry.getStrand()); + + ObjectResponse locationResponse = validateLocationAssociation(locationAssociation, gffEntry, assemblyComponent); + if (locationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, locationResponse.errorMessagesString()); + } + + return exonLocationDAO.persist(locationResponse.getEntity()); } - public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, GenomeAssembly assembly, - BackendBulkDataProvider dataProvider) { - // TODO Auto-generated method stub - return null; + @Transactional + public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO gffEntry, Transcript transcript, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + AssemblyComponent assemblyComponent = null; + TranscriptGenomicLocationAssociation locationAssociation = new TranscriptGenomicLocationAssociation(); + if (StringUtils.isNotBlank(gffEntry.getSeqId())) { + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcript.getId()); + params.put(EntityFieldConstants.TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); + params.put(EntityFieldConstants.TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + SearchResponse locationSearchResponse = transcriptLocationDAO.findByParams(params); + if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { + locationAssociation = locationSearchResponse.getSingleResult(); + } + locationAssociation.setTranscriptGenomicLocationAssociationObject(assemblyComponent); + } + locationAssociation.setTranscriptAssociationSubject(transcript); + locationAssociation.setStrand(gffEntry.getStrand()); + locationAssociation.setPhase(gffEntry.getPhase()); + + ObjectResponse locationResponse = validateLocationAssociation(locationAssociation, gffEntry, assemblyComponent); + if (locationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, locationResponse.errorMessagesString()); + } + + return transcriptLocationDAO.persist(locationResponse.getEntity()); } - - public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO gffEntry, GenomeAssembly assembly, - BackendBulkDataProvider dataProvider) { - // TODO Auto-generated method stub - return null; + + private ObjectResponse validateLocationAssociation(E association, Gff3DTO dto, AssemblyComponent assemblyComponent) { + ObjectResponse associationResponse = new ObjectResponse(); + + if (assemblyComponent == null) { + associationResponse.addErrorMessage("SeqId", ValidationConstants.REQUIRED_MESSAGE); + } + + if (dto.getStart() == null) { + associationResponse.addErrorMessage("Start", ValidationConstants.REQUIRED_MESSAGE); + } + association.setStart(dto.getStart()); + + if (dto.getEnd() == null) { + associationResponse.addErrorMessage("End", ValidationConstants.REQUIRED_MESSAGE); + } + association.setEnd(dto.getEnd()); + + if (StringUtils.isBlank(dto.getStrand())) { + associationResponse.addErrorMessage("Strand", ValidationConstants.REQUIRED_MESSAGE); + } else if (!Gff3Constants.STRANDS.contains(dto.getStrand())) { + associationResponse.addErrorMessage("Strand", ValidationConstants.INVALID_MESSAGE + " (" + dto.getStrand() + ")"); + } + + if (dto.getPhase() != null && (dto.getPhase() > 2 || dto.getPhase() < 0)) { + associationResponse.addErrorMessage("Phase", ValidationConstants.INVALID_MESSAGE + " (" + dto.getPhase() + ")"); + } + + associationResponse.setEntity(association); + + return associationResponse; } } diff --git a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql index 198b89d94..27c13e338 100644 --- a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql +++ b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql @@ -53,6 +53,8 @@ CREATE TABLE codingsequencegenomiclocationassociation ( id bigint CONSTRAINT codingsequencegenomiclocationassociation_pkey PRIMARY KEY, "start" integer, "end" integer, + phase integer, + strand varchar(1), relation_id bigint, codingsequenceassociationsubject_id bigint, codingsequencegenomiclocationassociationobject_id bigint @@ -78,6 +80,7 @@ CREATE TABLE exongenomiclocationassociation ( id bigint CONSTRAINT exongenomiclocationassociation_pkey PRIMARY KEY, "start" integer, "end" integer, + strand varchar(1), relation_id bigint, exonassociationsubject_id bigint, exongenomiclocationassociationobject_id bigint @@ -103,6 +106,8 @@ CREATE TABLE transcriptgenomiclocationassociation ( id bigint CONSTRAINT transcriptgenomiclocationassociation_pkey PRIMARY KEY, "start" integer, "end" integer, + phase integer, + strand varchar(1), relation_id bigint, transcriptassociationsubject_id bigint, transcriptgenomiclocationassociationobject_id bigint diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index ec9e06414..5b2e3e896 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -1,6 +1,7 @@ package org.alliancegenome.curation_api; import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.hasSize; import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.resources.TestContainerResource; @@ -66,7 +67,13 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { body("entity.modInternalId", is(transcriptId)). body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). - body("entity.transcriptType.curie", is("SO:0000234")); + body("entity.transcriptType.curie", is("SO:0000234")). + body("entity.transcriptGenomicLocationAssociations", hasSize(1)). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("I")). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxonCurie", is("NCBITaxon:6239")). + body("entity.transcriptGenomicLocationAssociations[0].start", is(1)). + body("entity.transcriptGenomicLocationAssociations[0].end", is(100)). + body("entity.transcriptGenomicLocationAssociations[0].strand", is("+")); } diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json b/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json index bd1d4ecfc..ef30adafe 100644 --- a/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json +++ b/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json @@ -6,9 +6,11 @@ "start": 1, "end": 1000, "strand": "+", + "phase": 0, "attributes": [ "ID=Transcript:Y74C9A.2a.1", - "Parent=Gene:WBGene00022276" + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" ] } ] diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json b/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json index 75fbd719f..bacb150fa 100644 --- a/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json +++ b/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json @@ -6,6 +6,7 @@ "start": 10, "end": 100, "strand": "+", + "phase": 1, "attributes": [ "ID=CDS:Y74C9A.2a", "Parent=Transcript:Y74C9A.2a.1" From c8f0463a6d9f140e23a04db27c7d1e55f1744823 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 12 Jul 2024 11:50:57 -0500 Subject: [PATCH 044/342] Note class used instead of string for related note --- .../cliapp/src/service/DataLoadService.js | 2 +- ...ThroughputExpressionDatasetAnnotation.java | 19 +++++++++++++++++-- ...6.0.4__highthroughputexpressiondataset.sql | 7 +++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index c361e810e..8eaf6fb4a 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,7 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', - 'HTP EXPRESSION DATASET ANNOTATION', + 'HTP_EXPRESSION_DATASET_ANNOTATION', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index fd40d6e52..7af5d1721 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -7,17 +7,26 @@ 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.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.mapping.definition.annotation.FullTextField; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; 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; +import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToOne; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -31,6 +40,8 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") private String name; @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) @@ -44,17 +55,21 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsAndLists.class }) private List references; + @IndexedEmbedded(includePaths = { "freeText", "noteType.name", "references.curie", "references.primaryCrossReferenceCurie", "freeText_keyword", "noteType.name_keyword", "references.curie_keyword", "references.primaryCrossReferenceCurie_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) - private String realtedNote; + private Note relatedNote; @JsonView({ View.FieldsOnly.class }) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) private Integer numberOfChannels; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JsonView({ View.FieldsAndLists.class }) - @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) + @JoinTable(name = "highthroughputexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) List categoryTags; } diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index 605d58caa..62108110c 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -16,7 +16,7 @@ INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) -SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; @@ -55,7 +55,7 @@ CREATE TABLE highthroughputexpressiondatasetannotation ( modinternalid character varying(255), name character varying(255), numberofchannels integer, - realtednote character varying(255), + relatednote_id bigint, createdby_id bigint, updatedby_id bigint, dataprovider_id bigint @@ -81,6 +81,9 @@ CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpression CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT highthroughputexpressiondatasetannotation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note (id); + ALTER TABLE highthroughputexpressiondatasetannotation_categorytags ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); From c53bc8b107af3668cf6dfd12b8777918b974f252 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 12 Jul 2024 11:53:20 -0500 Subject: [PATCH 045/342] formatting --- .../entities/HighThroughputExpressionDatasetAnnotation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index 7af5d1721..9e3431fb3 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -62,7 +62,7 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { private Note relatedNote; @JsonView({ View.FieldsOnly.class }) - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) private Integer numberOfChannels; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) From ca69d9df39489cf7038d1debe7fc0983ba26a9a9 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Sun, 14 Jul 2024 08:26:19 +0100 Subject: [PATCH 046/342] Fix lazy initialization error --- ...BaseReadIdentifierControllerInterface.java | 2 +- .../jobs/executors/Gff3Executor.java | 17 +++--- .../model/entities/GenomeAssembly.java | 2 +- .../model/entities/LocationAssociation.java | 2 + ...ingSequenceGenomicLocationAssociation.java | 7 ++- .../ConstructGenomicEntityAssociation.java | 9 ++- .../ExonGenomicLocationAssociation.java | 6 +- .../TranscriptGenomicLocationAssociation.java | 7 ++- .../model/entities/ontology/OntologyTerm.java | 2 + .../services/AssemblyComponentService.java | 19 +++--- .../services/GenomeAssemblyService.java | 23 +++++++ .../curation_api/services/Gff3Service.java | 32 +++++----- .../ontology/NcbiTaxonTermService.java | 4 +- .../ExperimentalConditionValidator.java | 2 +- .../validation/dto/Gff3DtoValidator.java | 19 +++--- .../curation_api/Gff3BulkUploadITCase.java | 61 +++++++++++++++++-- .../fms/08_gff_data/ER_01_empty_seq_id.json | 16 +++++ .../fms/08_gff_data/ER_02_empty_strand.json | 16 +++++ ...transcript.json => GFF_01_transcript.json} | 0 .../{GFF02_exon.json => GFF_02_exon.json} | 0 .../{GFF03_CDS.json => GFF_03_CDS.json} | 0 .../fms/08_gff_data/IV_01_invalid_strand.json | 16 +++++ .../fms/08_gff_data/IV_02_invalid_phase.json | 16 +++++ .../bulk/fms/08_gff_data/MR_01_no_seq_id.json | 15 +++++ .../bulk/fms/08_gff_data/MR_02_no_start.json | 15 +++++ .../bulk/fms/08_gff_data/MR_03_no_end.json | 15 +++++ .../bulk/fms/08_gff_data/MR_04_no_strand.json | 15 +++++ .../08_gff_data/UD_01_update_transcript.json | 16 +++++ 28 files changed, 293 insertions(+), 61 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java create mode 100644 src/test/resources/bulk/fms/08_gff_data/ER_01_empty_seq_id.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/ER_02_empty_strand.json rename src/test/resources/bulk/fms/08_gff_data/{GFF01_transcript.json => GFF_01_transcript.json} (100%) rename src/test/resources/bulk/fms/08_gff_data/{GFF02_exon.json => GFF_02_exon.json} (100%) rename src/test/resources/bulk/fms/08_gff_data/{GFF03_CDS.json => GFF_03_CDS.json} (100%) create mode 100644 src/test/resources/bulk/fms/08_gff_data/IV_01_invalid_strand.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/IV_02_invalid_phase.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_01_no_seq_id.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_02_no_start.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_03_no_end.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_04_no_strand.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/UD_01_update_transcript.json diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/base/crud/BaseReadIdentifierControllerInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/base/crud/BaseReadIdentifierControllerInterface.java index 5bea803ed..ebac335b7 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/base/crud/BaseReadIdentifierControllerInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/base/crud/BaseReadIdentifierControllerInterface.java @@ -24,7 +24,7 @@ public interface BaseReadIdentifierControllerInterface @GET @Path("/{identifierString}") - @JsonView(View.FieldsOnly.class) + @JsonView(View.FieldsAndLists.class) @APIResponses( @APIResponse( description = "Get the Entity by Identifier String", diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index abf01caf2..aa7fa7938 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -11,7 +11,6 @@ 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.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; @@ -115,15 +114,15 @@ private Map> runLoad(BulkLoadFileHistory history, List> runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, - Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyName) { + Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 2) + 1); - GenomeAssembly assembly = loadGenomeAssembly(assemblyName, history, gffHeaderData, dataProvider, ph); + loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); idsAdded = loadEntities(history, gffData, idsAdded, dataProvider, ph); - idsAdded = loadAssociations(history, gffData, idsAdded, dataProvider, assembly, ph); + idsAdded = loadAssociations(history, gffData, idsAdded, dataProvider, assemblyId, ph); return idsAdded; } @@ -144,10 +143,9 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List return new LoadHistoryResponce(history); } - private GenomeAssembly loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - GenomeAssembly assembly = null; + private void loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { try { - assembly = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); + gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -159,7 +157,6 @@ private GenomeAssembly loadGenomeAssembly(String assemblyName, BulkLoadFileHisto } updateHistory(history); ph.progressProcess(); - return assembly; } private Map> loadEntities(BulkLoadFileHistory history, List gffData, Map> idsAdded, @@ -184,10 +181,10 @@ private Map> loadEntities(BulkLoadFileHistory history, List> loadAssociations(BulkLoadFileHistory history, List gffData, Map> idsAdded, - BackendBulkDataProvider dataProvider, GenomeAssembly assembly, ProcessDisplayHelper ph) { + BackendBulkDataProvider dataProvider, String assemblyId, ProcessDisplayHelper ph) { for (Gff3DTO gff3Entry : gffData) { try { - idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assembly); + idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assemblyId); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java index 715057abb..deff41f04 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenomeAssembly.java @@ -39,13 +39,13 @@ public class GenomeAssembly extends BiologicalEntity { @Index(columnList = "genomeassembly_id", name = "genomeassembly_crossreference_genomeassembly_index"), @Index(columnList = "crossreferences_id", name = "genomeassembly_crossreference_crossreference_index") }) - @EqualsAndHashCode.Include @JsonView({ View.FieldsAndLists.class }) private List crossReferences; @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne + @EqualsAndHashCode.Include @JsonView({ View.FieldsOnly.class }) private AffectedGenomicModel specimenGenomicModel; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java index 8749bfcd4..20eade1bc 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java @@ -34,10 +34,12 @@ public abstract class LocationAssociation extends EvidenceAssociation { @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) @Column(name="`start`") + @JsonView({ View.FieldsOnly.class }) private Integer start; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) @Column(name="`end`") + @JsonView({ View.FieldsOnly.class }) private Integer end; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index d431aad3a..1dc03bec4 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -61,11 +61,16 @@ public class CodingSequenceGenomicLocationAssociation extends LocationAssociatio }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("codingSequenceGenomicLocationAssociations") + @JsonIgnoreProperties({ + "codingSequenceGenomicLocationAssociations", + "exonGenomicLocationAssociations", + "transcriptGenomicLocationAssociations" + }) @Fetch(FetchMode.JOIN) private AssemblyComponent codingSequenceGenomicLocationAssociationObject; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @JsonView({ View.FieldsOnly.class }) private Integer phase; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") 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 20373fcfd..5ed1f0721 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 @@ -66,12 +66,15 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({"alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations"}) + @JsonIgnoreProperties({ + "alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations", + "transcriptGenomicLocationAssociations", "exonGenomicLocationAssociations", "codingSequenceGenomicLocationAssociations" + }) private GenomicEntity constructGenomicEntityAssociationObject; @IndexedEmbedded(includePaths = {"freeText", "noteType.name", "references.curie", - "references.primaryCrossReferenceCurie", "freeText_keyword", "noteType.name_keyword", "references.curie_keyword", - "references.primaryCrossReferenceCurie_keyword" + "references.primaryCrossReferenceCurie", "freeText_keyword", "noteType.name_keyword", "references.curie_keyword", + "references.primaryCrossReferenceCurie_keyword" }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 112da96c6..8b0e94ba2 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -59,7 +59,11 @@ public class ExonGenomicLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("exonGenomicLocationAssociations") + @JsonIgnoreProperties({ + "codingSequenceGenomicLocationAssociations", + "exonGenomicLocationAssociations", + "transcriptGenomicLocationAssociations" + }) @Fetch(FetchMode.JOIN) private AssemblyComponent exonGenomicLocationAssociationObject; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index 91f1e4a79..fd492c504 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -61,11 +61,16 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("transcriptGenomicLocationAssociations") + @JsonIgnoreProperties({ + "codingSequenceGenomicLocationAssociations", + "exonGenomicLocationAssociations", + "transcriptGenomicLocationAssociations" + }) @Fetch(FetchMode.JOIN) private AssemblyComponent transcriptGenomicLocationAssociationObject; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @JsonView({ View.FieldsOnly.class }) private Integer phase; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java index 134613a09..9050efe31 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java @@ -10,6 +10,8 @@ import org.alliancegenome.curation_api.model.entities.Synonym; import org.alliancegenome.curation_api.model.entities.base.CurieObject; import org.alliancegenome.curation_api.view.View; +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; diff --git a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java index 49aeca977..50d797d3c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java @@ -23,6 +23,7 @@ public class AssemblyComponentService extends BaseEntityCrudService { @Inject AssemblyComponentDAO assemblyComponentDAO; + @Inject GenomeAssemblyService genomeAssemblyService; @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject DataProviderService dataProviderService; @@ -36,12 +37,12 @@ protected void init() { } @Transactional - public AssemblyComponent fetchOrCreate(String name, GenomeAssembly assembly, String taxonCurie, String dataProviderAbbreviation) { + public AssemblyComponent fetchOrCreate(String name, String assemblyId, String taxonCurie, String dataProviderAbbreviation) { AssemblyComponent assemblyComponent = null; if (assemblyComponentRequest != null) { UniqueIdGeneratorHelper uniqueIdGen = new UniqueIdGeneratorHelper(); uniqueIdGen.add(name); - uniqueIdGen.add(assembly.getModEntityId()); + uniqueIdGen.add(assemblyId); uniqueIdGen.add(taxonCurie); uniqueIdGen.add(dataProviderAbbreviation); String uniqueId = uniqueIdGen.getUniqueId(); @@ -49,20 +50,20 @@ public AssemblyComponent fetchOrCreate(String name, GenomeAssembly assembly, Str assemblyComponent = assemblyComponentCacheMap.get(uniqueId); } else { Log.debug("AssemblyComponent not cached, caching name|assembly: (" + uniqueId + ")"); - assemblyComponent = findAssemblyComponentOrCreateDB(name, assembly, taxonCurie, dataProviderAbbreviation); + assemblyComponent = findAssemblyComponentOrCreateDB(name, assemblyId, taxonCurie, dataProviderAbbreviation); assemblyComponentCacheMap.put(uniqueId, assemblyComponent); } } else { - assemblyComponent = findAssemblyComponentOrCreateDB(name, assembly, taxonCurie, dataProviderAbbreviation); + assemblyComponent = findAssemblyComponentOrCreateDB(name, assemblyId, taxonCurie, dataProviderAbbreviation); assemblyComponentRequest = new Date(); } return assemblyComponent; } - private AssemblyComponent findAssemblyComponentOrCreateDB(String name, GenomeAssembly assembly, String taxonCurie, String dataProviderAbbreviation) { + private AssemblyComponent findAssemblyComponentOrCreateDB(String name, String assemblyId, String taxonCurie, String dataProviderAbbreviation) { Map params = new HashMap<>(); params.put("name", name); - params.put(EntityFieldConstants.ASSEMBLY, assembly.getModEntityId()); + params.put(EntityFieldConstants.ASSEMBLY, assemblyId); params.put(EntityFieldConstants.TAXON, taxonCurie); params.put(EntityFieldConstants.DATA_PROVIDER, dataProviderAbbreviation); SearchResponse assemblyComponentResponse = assemblyComponentDAO.findByParams(params); @@ -71,10 +72,12 @@ private AssemblyComponent findAssemblyComponentOrCreateDB(String name, GenomeAss } AssemblyComponent assemblyComponent = new AssemblyComponent(); assemblyComponent.setName(name); - assemblyComponent.setGenomeAssembly(assembly); + SearchResponse assemblyResponse = genomeAssemblyService.findByField("modEntityId", assemblyId); + if (assemblyResponse != null && assemblyResponse.getSingleResult() != null) { + assemblyComponent.setGenomeAssembly(assemblyResponse.getSingleResult()); + } assemblyComponent.setTaxon(ncbiTaxonTermService.getByCurie(taxonCurie).getEntity()); assemblyComponent.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProviderAbbreviation)); - return assemblyComponentDAO.persist(assemblyComponent); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java b/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java new file mode 100644 index 000000000..8c826d5ac --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java @@ -0,0 +1,23 @@ +package org.alliancegenome.curation_api.services; + +import org.alliancegenome.curation_api.dao.GenomeAssemblyDAO; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class GenomeAssemblyService extends BaseEntityCrudService { + + @Inject GenomeAssemblyDAO genomeAssemblyDAO; + + @Override + @PostConstruct + protected void init() { + setSQLDao(genomeAssemblyDAO); + } + + +} 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 4e3afe373..6256b6613 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -31,7 +31,6 @@ import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; -import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; @@ -53,7 +52,7 @@ public class Gff3Service { @Inject Gff3DtoValidator gff3DtoValidator; @Transactional - public GenomeAssembly loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public void loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { if (StringUtils.isBlank(assemblyName)) { for (String header : gffHeaderData) { @@ -69,18 +68,17 @@ public GenomeAssembly loadGenomeAssembly(String assemblyName, List gffHe params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); SearchResponse resp = genomeAssemblyDAO.findByParams(params); - if (resp != null && resp.getSingleResult() != null) { - return resp.getSingleResult(); - } - - GenomeAssembly assembly = new GenomeAssembly(); - assembly.setModEntityId(assemblyName); - assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); - assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + if (resp == null || resp.getSingleResult() == null) { + GenomeAssembly assembly = new GenomeAssembly(); + assembly.setModEntityId(assemblyName); + assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); - return genomeAssemblyDAO.persist(assembly); + genomeAssemblyDAO.persist(assembly); + } + } else { + throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); } - throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); } public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { @@ -107,8 +105,8 @@ public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO g } @Transactional - public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, GenomeAssembly assembly) throws ObjectUpdateException { - if (ObjectUtils.isEmpty(assembly)) { + public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ObjectUpdateException { + if (StringUtils.isEmpty(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } @@ -121,7 +119,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff } Exon exon = response.getSingleResult(); - ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assembly, dataProvider); + ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assemblyId, dataProvider); if (exonLocation != null) { idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); exonLocationService.addAssociationToSubjectAndObject(exonLocation); @@ -133,7 +131,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } CodingSequence cds = response.getSingleResult(); - CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assembly, dataProvider); + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); if (cdsLocation != null) { idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); cdsLocationService.addAssociationToSubjectAndObject(cdsLocation); @@ -150,7 +148,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); } Transcript transcript = response.getSingleResult(); - TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assembly, dataProvider); + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); if (transcriptLocation != null) { idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); transcriptLocationService.addAssociationToSubjectAndObject(transcriptLocation); diff --git a/src/main/java/org/alliancegenome/curation_api/services/ontology/NcbiTaxonTermService.java b/src/main/java/org/alliancegenome/curation_api/services/ontology/NcbiTaxonTermService.java index 6ca8f7868..f3636138d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ontology/NcbiTaxonTermService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ontology/NcbiTaxonTermService.java @@ -16,6 +16,7 @@ import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; +import jakarta.transaction.Transactional; import si.mazi.rescu.RestProxyFactory; @RequestScoped @@ -58,6 +59,7 @@ public ObjectResponse getByCurie(String taxonCurie) { return response; } + @Transactional public NCBITaxonTerm getTaxonFromDB(String taxonCurie) { NCBITaxonTerm taxon = findByCurie(taxonCurie); if (taxon == null) { @@ -69,7 +71,7 @@ public NCBITaxonTerm getTaxonFromDB(String taxonCurie) { return taxon; } - public NCBITaxonTerm downloadAndSave(String taxonCurie) { + private NCBITaxonTerm downloadAndSave(String taxonCurie) { Pattern taxonIdPattern = Pattern.compile("^NCBITaxon:(\\d+)$"); Matcher taxonIdMatcher = taxonIdPattern.matcher(taxonCurie); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/ExperimentalConditionValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/ExperimentalConditionValidator.java index e4ed7a78e..aed176046 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/ExperimentalConditionValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/ExperimentalConditionValidator.java @@ -219,7 +219,7 @@ public NCBITaxonTerm validateConditionTaxon(ExperimentalCondition uiEntity, Expe if (StringUtils.isNotBlank(uiEntity.getConditionTaxon().getCurie())) { taxonTerm = ncbiTaxonTermService.findByCurie(uiEntity.getConditionTaxon().getCurie()); if (taxonTerm == null) { - taxonTerm = ncbiTaxonTermService.downloadAndSave(uiEntity.getConditionTaxon().getCurie()); + taxonTerm = ncbiTaxonTermService.getTaxonFromDB(uiEntity.getConditionTaxon().getCurie()); } if (taxonTerm == null) { addMessageResponse(field, ValidationConstants.INVALID_MESSAGE); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index e7f4126ae..934ff490b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -161,15 +161,15 @@ private ObjectResponse validateGffEntity(E entity, } @Transactional - public CodingSequenceGenomicLocationAssociation validateCdsLocation(Gff3DTO gffEntry, CodingSequence cds, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public CodingSequenceGenomicLocationAssociation validateCdsLocation(Gff3DTO gffEntry, CodingSequence cds, String assemblyId, BackendBulkDataProvider dataProvider) throws ObjectValidationException { AssemblyComponent assemblyComponent = null; CodingSequenceGenomicLocationAssociation locationAssociation = new CodingSequenceGenomicLocationAssociation(); if (StringUtils.isNotBlank(gffEntry.getSeqId())) { - assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assemblyId, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); Map params = new HashMap<>(); params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT + ".id", cds.getId()); params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); - params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assemblyId); SearchResponse locationSearchResponse = cdsLocationDAO.findByParams(params); if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { locationAssociation = locationSearchResponse.getSingleResult(); @@ -189,15 +189,15 @@ public CodingSequenceGenomicLocationAssociation validateCdsLocation(Gff3DTO gffE } @Transactional - public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, Exon exon, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, Exon exon, String assemblyId, BackendBulkDataProvider dataProvider) throws ObjectValidationException { AssemblyComponent assemblyComponent = null; ExonGenomicLocationAssociation locationAssociation = new ExonGenomicLocationAssociation(); if (StringUtils.isNotBlank(gffEntry.getSeqId())) { - assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assemblyId, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); Map params = new HashMap<>(); params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT + ".id", exon.getId()); params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); - params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assemblyId); SearchResponse locationSearchResponse = exonLocationDAO.findByParams(params); if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { locationAssociation = locationSearchResponse.getSingleResult(); @@ -216,15 +216,14 @@ public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, Exo } @Transactional - public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO gffEntry, Transcript transcript, GenomeAssembly assembly, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO gffEntry, Transcript transcript, String assemblyId, BackendBulkDataProvider dataProvider) throws ObjectValidationException { AssemblyComponent assemblyComponent = null; TranscriptGenomicLocationAssociation locationAssociation = new TranscriptGenomicLocationAssociation(); if (StringUtils.isNotBlank(gffEntry.getSeqId())) { - assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assembly, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); + assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assemblyId, dataProvider.canonicalTaxonCurie, dataProvider.sourceOrganization); Map params = new HashMap<>(); params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcript.getId()); - params.put(EntityFieldConstants.TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); - params.put(EntityFieldConstants.TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assembly.getModEntityId()); + params.put(EntityFieldConstants.TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assemblyId); SearchResponse locationSearchResponse = transcriptLocationDAO.findByParams(params); if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { locationAssociation = locationSearchResponse.getSingleResult(); diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 4344a0230..038ce6e0f 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -48,6 +48,7 @@ public void init() { private void loadRequiredEntities() throws Exception { createSoTerm("SO:0000234", "mRNA", false); + createSoTerm("SO:0001035", "piRNA", false); createSoTerm("SO:0000147", "exon", false); createSoTerm("SO:0000316", "CDS", false); } @@ -57,7 +58,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF01_transcript.json", 3); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 3); RestAssured.given(). when(). @@ -71,7 +72,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { body("entity.transcriptType.curie", is("SO:0000234")). body("entity.transcriptGenomicLocationAssociations", hasSize(1)). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("I")). - body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxonCurie", is("NCBITaxon:6239")). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.transcriptGenomicLocationAssociations[0].start", is(1)). body("entity.transcriptGenomicLocationAssociations[0].end", is(1000)). body("entity.transcriptGenomicLocationAssociations[0].phase", is(0)). @@ -82,7 +83,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF02_exon.json", 3); + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 3); RestAssured.given(). when(). @@ -94,7 +95,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.exonGenomicLocationAssociations", hasSize(1)). body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.name", is("I")). - body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.taxonCurie", is("NCBITaxon:6239")). + body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.exonGenomicLocationAssociations[0].start", is(1)). body("entity.exonGenomicLocationAssociations[0].end", is(100)). body("entity.exonGenomicLocationAssociations[0].strand", is("+")); @@ -104,7 +105,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF03_CDS.json", 3); + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 3); RestAssured.given(). when(). @@ -116,12 +117,60 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.codingSequenceGenomicLocationAssociations", hasSize(1)). body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.name", is("I")). - body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.taxonCurie", is("NCBITaxon:6239")). + body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.codingSequenceGenomicLocationAssociations[0].start", is(10)). body("entity.codingSequenceGenomicLocationAssociations[0].end", is(100)). body("entity.codingSequenceGenomicLocationAssociations[0].phase", is(1)). body("entity.codingSequenceGenomicLocationAssociations[0].strand", is("+")); } + + @Test + @Order(4) + public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 3); + + RestAssured.given(). + when(). + get(transcriptGetEndpoint + transcriptId). + then(). + statusCode(200). + body("entity.modInternalId", is(transcriptId)). + body("entity.name", is("Y74C9A.2a.1")). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). + body("entity.transcriptType.curie", is("SO:0001035")). + body("entity.transcriptGenomicLocationAssociations", hasSize(1)). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("II")). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). + body("entity.transcriptGenomicLocationAssociations[0].start", is(2)). + body("entity.transcriptGenomicLocationAssociations[0].end", is(2000)). + body("entity.transcriptGenomicLocationAssociations[0].phase", is(1)). + body("entity.transcriptGenomicLocationAssociations[0].strand", is("-")); + + } + + @Test + @Order(5) + public void gff3DataBulkUploadMissingRequiredFields() throws Exception { + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 3, 1, 2); + } + + @Test + @Order(6) + public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 3, 1, 2); + } + + @Test + @Order(7) + public void gff3DataBulkUploadInvalidFields() throws Exception { + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 3, 1, 2); + } } diff --git a/src/test/resources/bulk/fms/08_gff_data/ER_01_empty_seq_id.json b/src/test/resources/bulk/fms/08_gff_data/ER_01_empty_seq_id.json new file mode 100644 index 000000000..a691479e6 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/ER_01_empty_seq_id.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/ER_02_empty_strand.json b/src/test/resources/bulk/fms/08_gff_data/ER_02_empty_strand.json new file mode 100644 index 000000000..32a9ac0ec --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/ER_02_empty_strand.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json b/src/test/resources/bulk/fms/08_gff_data/GFF_01_transcript.json similarity index 100% rename from src/test/resources/bulk/fms/08_gff_data/GFF01_transcript.json rename to src/test/resources/bulk/fms/08_gff_data/GFF_01_transcript.json diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json b/src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json similarity index 100% rename from src/test/resources/bulk/fms/08_gff_data/GFF02_exon.json rename to src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json b/src/test/resources/bulk/fms/08_gff_data/GFF_03_CDS.json similarity index 100% rename from src/test/resources/bulk/fms/08_gff_data/GFF03_CDS.json rename to src/test/resources/bulk/fms/08_gff_data/GFF_03_CDS.json diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_01_invalid_strand.json b/src/test/resources/bulk/fms/08_gff_data/IV_01_invalid_strand.json new file mode 100644 index 000000000..920bde5f5 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/IV_01_invalid_strand.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "X", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_02_invalid_phase.json b/src/test/resources/bulk/fms/08_gff_data/IV_02_invalid_phase.json new file mode 100644 index 000000000..e6f751326 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/IV_02_invalid_phase.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 3, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_01_no_seq_id.json b/src/test/resources/bulk/fms/08_gff_data/MR_01_no_seq_id.json new file mode 100644 index 000000000..e9651e61e --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_01_no_seq_id.json @@ -0,0 +1,15 @@ +[ + { + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_02_no_start.json b/src/test/resources/bulk/fms/08_gff_data/MR_02_no_start.json new file mode 100644 index 000000000..0997e4e33 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_02_no_start.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_03_no_end.json b/src/test/resources/bulk/fms/08_gff_data/MR_03_no_end.json new file mode 100644 index 000000000..7284de1d8 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_03_no_end.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_04_no_strand.json b/src/test/resources/bulk/fms/08_gff_data/MR_04_no_strand.json new file mode 100644 index 000000000..3a6cdcbd6 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_04_no_strand.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/UD_01_update_transcript.json b/src/test/resources/bulk/fms/08_gff_data/UD_01_update_transcript.json new file mode 100644 index 000000000..ed9d9e98e --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/UD_01_update_transcript.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "II", + "source": "WormBase", + "type": "piRNA", + "start": 2, + "end": 2000, + "strand": "-", + "phase": 1, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:WBGene00022276", + "Name=Y74C9A.2a.1" + ] + } +] From ce2f45707c8b99afdd4df30b483e9b93799dbcc9 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 15 Jul 2024 07:41:53 +0100 Subject: [PATCH 047/342] Add relation --- .../services/validation/dto/Gff3DtoValidator.java | 5 ++++- .../db/migration/v0.36.0.4__gff_association_tables.sql | 6 +++++- .../alliancegenome/curation_api/Gff3BulkUploadITCase.java | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 934ff490b..a89ff1654 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -18,7 +18,6 @@ import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; -import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.GenomicEntity; import org.alliancegenome.curation_api.model.entities.LocationAssociation; import org.alliancegenome.curation_api.model.entities.Transcript; @@ -32,6 +31,7 @@ import org.alliancegenome.curation_api.services.AssemblyComponentService; import org.alliancegenome.curation_api.services.DataProviderService; import org.alliancegenome.curation_api.services.Gff3Service; +import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; @@ -55,6 +55,7 @@ public class Gff3DtoValidator { @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject SoTermDAO soTermDAO; @Inject Gff3Service gff3Service; + @Inject VocabularyTermService vocabularyTermService; @Transactional public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { @@ -245,6 +246,8 @@ public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO g private ObjectResponse validateLocationAssociation(E association, Gff3DTO dto, AssemblyComponent assemblyComponent) { ObjectResponse associationResponse = new ObjectResponse(); + association.setRelation(vocabularyTermService.getTermInVocabulary("location_association_relation", "located_on").getEntity()); + if (assemblyComponent == null) { associationResponse.addErrorMessage("SeqId", ValidationConstants.REQUIRED_MESSAGE); } diff --git a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql index 27c13e338..afa406dc2 100644 --- a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql +++ b/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql @@ -127,4 +127,8 @@ CREATE INDEX transcriptlocationassociation_relation_index ON transcriptgenomiclo CREATE INDEX transcriptlocationassociation_subject_index ON transcriptgenomiclocationassociation USING btree (transcriptassociationsubject_id); CREATE INDEX transcriptlocationassociation_object_index ON transcriptgenomiclocationassociation - USING btree (transcriptgenomiclocationassociationobject_id); \ No newline at end of file + USING btree (transcriptgenomiclocationassociationobject_id); + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Location Association Relation', 'location_association_relation'); +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'located_on', id FROM vocabulary WHERE vocabularylabel = 'location_association_relation'; + \ No newline at end of file diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 038ce6e0f..5ea4d9709 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -71,6 +71,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.transcriptType.curie", is("SO:0000234")). body("entity.transcriptGenomicLocationAssociations", hasSize(1)). + body("entity.transcriptGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("I")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.transcriptGenomicLocationAssociations[0].start", is(1)). @@ -94,6 +95,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.exonGenomicLocationAssociations", hasSize(1)). + body("entity.exonGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.name", is("I")). body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.exonGenomicLocationAssociations[0].start", is(1)). @@ -116,6 +118,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.codingSequenceGenomicLocationAssociations", hasSize(1)). + body("entity.codingSequenceGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.name", is("I")). body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.codingSequenceGenomicLocationAssociations[0].start", is(10)). @@ -141,6 +144,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.transcriptType.curie", is("SO:0001035")). body("entity.transcriptGenomicLocationAssociations", hasSize(1)). + body("entity.transcriptGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("II")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.transcriptGenomicLocationAssociations[0].start", is(2)). From 72c4679b7ac3dcc67b1d4fa8bff394a5b6a4b676 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 15 Jul 2024 11:30:22 +0100 Subject: [PATCH 048/342] Checkstyle fixes --- .../curation_api/model/entities/LocationAssociation.java | 6 +++--- .../CodingSequenceGenomicLocationAssociation.java | 2 +- .../exonAssociations/ExonGenomicLocationAssociation.java | 2 +- .../TranscriptGenomicLocationAssociation.java | 4 ++-- .../curation_api/model/entities/ontology/OntologyTerm.java | 2 -- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java index 20eade1bc..ce3000a70 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java @@ -33,12 +33,12 @@ public abstract class LocationAssociation extends EvidenceAssociation { private VocabularyTerm relation; @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) - @Column(name="`start`") + @Column(name = "`start`") @JsonView({ View.FieldsOnly.class }) private Integer start; - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) - @Column(name="`end`") + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @Column(name = "`end`") @JsonView({ View.FieldsOnly.class }) private Integer end; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index 1dc03bec4..0d15a045b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -69,7 +69,7 @@ public class CodingSequenceGenomicLocationAssociation extends LocationAssociatio @Fetch(FetchMode.JOIN) private AssemblyComponent codingSequenceGenomicLocationAssociationObject; - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) @JsonView({ View.FieldsOnly.class }) private Integer phase; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 8b0e94ba2..3cc57e566 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -65,7 +65,7 @@ public class ExonGenomicLocationAssociation extends LocationAssociation { "transcriptGenomicLocationAssociations" }) @Fetch(FetchMode.JOIN) - private AssemblyComponent exonGenomicLocationAssociationObject; + private AssemblyComponent exonGenomicLocationAssociationObject; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "phenotypeAnnotationObject_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index fd492c504..8f4558793 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -67,9 +67,9 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { "transcriptGenomicLocationAssociations" }) @Fetch(FetchMode.JOIN) - private AssemblyComponent transcriptGenomicLocationAssociationObject; + private AssemblyComponent transcriptGenomicLocationAssociationObject; - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) @JsonView({ View.FieldsOnly.class }) private Integer phase; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java index 9050efe31..134613a09 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java @@ -10,8 +10,6 @@ import org.alliancegenome.curation_api.model.entities.Synonym; import org.alliancegenome.curation_api.model.entities.base.CurieObject; import org.alliancegenome.curation_api.view.View; -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; From 882813a2083969fad78a4042acfa3a764156ce1e Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 15 Jul 2024 11:38:09 +0100 Subject: [PATCH 049/342] Another checkstyle fix --- .../curation_api/model/entities/LocationAssociation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java index ce3000a70..09baf468a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/LocationAssociation.java @@ -32,7 +32,7 @@ public abstract class LocationAssociation extends EvidenceAssociation { @JsonView({ View.FieldsOnly.class }) private VocabularyTerm relation; - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) @Column(name = "`start`") @JsonView({ View.FieldsOnly.class }) private Integer start; From 2a423d0c0a58791970febad8a53761b685c8419a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 15 Jul 2024 12:50:24 +0100 Subject: [PATCH 050/342] Remove FBCV terms attached to phenotypeannotations --- .../v0.36.0.4__remove_fbcv_terms_loaded_as_phenotype_terms.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/resources/db/migration/v0.36.0.4__remove_fbcv_terms_loaded_as_phenotype_terms.sql diff --git a/src/main/resources/db/migration/v0.36.0.4__remove_fbcv_terms_loaded_as_phenotype_terms.sql b/src/main/resources/db/migration/v0.36.0.4__remove_fbcv_terms_loaded_as_phenotype_terms.sql new file mode 100644 index 000000000..c7f020214 --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.4__remove_fbcv_terms_loaded_as_phenotype_terms.sql @@ -0,0 +1,3 @@ +DELETE FROM phenotypeannotation_ontologyterm WHERE phenotypeterms_id IN ( + SELECT id FROM ontologyterm WHERE ontologytermtype = 'FBCVTerm' +); \ No newline at end of file From 3add3f0738664b0706c287b1a95fff17335acfb9 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 15 Jul 2024 14:20:48 +0100 Subject: [PATCH 051/342] Bump migration version --- ...sociation_tables.sql => v0.36.0.5__gff_association_tables.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.36.0.4__gff_association_tables.sql => v0.36.0.5__gff_association_tables.sql} (100%) diff --git a/src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql b/src/main/resources/db/migration/v0.36.0.5__gff_association_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.4__gff_association_tables.sql rename to src/main/resources/db/migration/v0.36.0.5__gff_association_tables.sql From 37beb3cfc7110290e94e920eeee0a163136e360d Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:27:20 -0500 Subject: [PATCH 052/342] Added vocabulary terms for HTP Dataset and HTP Dataset Sample --- .../cliapp/src/service/DataLoadService.js | 2 +- .../enums/BackendBulkLoadType.java | 2 +- ...6.0.4__highthroughputexpressiondataset.sql | 61 ++++++++++++++----- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 8eaf6fb4a..28b2eaa66 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,7 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', - 'HTP_EXPRESSION_DATASET_ANNOTATION', + 'HTPDATASET', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 119aef824..2c3ae805d 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -24,7 +24,7 @@ public enum BackendBulkLoadType { PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), EXPRESSION("json"), - HTP_EXPRESSION_DATASET_ANNOTATION("json"); + HTPDATASET("json"); public String fileExtension; diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index 62108110c..da1345447 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -3,41 +3,74 @@ INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Annotation Bulk Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) -SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTPDATASET'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; ---Adding 3 extra vocabulary terms for HTPTags +--Adding vocabulary terms INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Sample Note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) + SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH + t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_note_type' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Summary' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' + ) + ) + SELECT t1.id, t2.id FROM t1,t2; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) + SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Sample Note Type', 'htp_expression_dataset_sample_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH + t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_sample_note_type' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Sample Note' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' + ) + ) + SELECT t1.id, t2.id FROM t1,t2; + -- Adding highthroughputexpressiondatasetannotation CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; From e1a5d54d43ba566acfbf4a66d26f31b5b76e953f Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:29:40 -0500 Subject: [PATCH 053/342] changes vocabulary terms name into snake case --- .../v0.36.0.4__highthroughputexpressiondataset.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index da1345447..a2fd4fef3 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -38,8 +38,8 @@ INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyt INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Sample Note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_sample_note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; @@ -50,7 +50,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_note_type' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Summary' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_summary' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' ) ) @@ -65,7 +65,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_sample_note_type' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Sample Note' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_sample_note' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' ) ) From bc408ff7b4004d1220d9e0e21fcc0578fafd75dd Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:37:00 -0500 Subject: [PATCH 054/342] Changed the version of the migration file --- ...dataset.sql => v0.36.0.5__highthroughputexpressiondataset.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.36.0.4__highthroughputexpressiondataset.sql => v0.36.0.5__highthroughputexpressiondataset.sql} (100%) diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql rename to src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql From 58475774833a6d554e8a12922d60dfc0dc06bb93 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:46:05 -0500 Subject: [PATCH 055/342] Changed the naming convention of vocabulary terms --- .../v0.36.0.5__highthroughputexpressiondataset.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql index a2fd4fef3..5ba060867 100644 --- a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql @@ -35,13 +35,13 @@ SELECT id, 'HTPDATASET', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression --Adding vocabulary terms INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional_genomics_and_proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_sample_note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) @@ -56,7 +56,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ) SELECT t1.id, t2.id FROM t1,t2; -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Sample Note Type', 'htp_expression_dataset_sample_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) From 198d959087e8d9be732b9c3d295fb84ab8446d69 Mon Sep 17 00:00:00 2001 From: Varun Reddy <90427085+VarunReddy1111@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:01:37 -0500 Subject: [PATCH 056/342] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b825ef545..fb72a41d5 100644 --- a/README.md +++ b/README.md @@ -481,6 +481,7 @@ As the code goes through the different stages, it becomes more and more stable a * Incrementing the `MAJOR` or `MINOR` release numbers as appropriate when the previous release candidate was (or will be) promoted to a full release and reset to rc1 for the next release. + * When choosing an alpha release make sure to include the Pull Requests that may have fixed bugs shortly after the sprint review, if they needed to be included in beta release. 4. Create a release/v`x`.`y`.`z`-rc`a` branch from the commit on the alpha branch that was chosen earlier to be promoted. ```bash From 7f0051a8c959d77cedde90ff1839f4cc0ccc7656 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 16 Jul 2024 15:36:52 -0500 Subject: [PATCH 057/342] SCRUM-4188 add sqtr gene association tests --- ...gReagentGeneAssociationCrudController.java | 6 + ...SequenceTargetingReagentCrudInterface.java | 9 ++ ...ngReagentGeneAssociationCrudInterface.java | 14 ++- ...argetingReagentGeneAssociationService.java | 22 ++++ ...entGeneAssociationBulkUploadFmsITCase.java | 105 ++++++++++++++++++ .../curation_api/base/BaseITCase.java | 17 +++ .../AF_01_all_fields.json | 31 ++++++ .../IV_01_invalid_gene_ids.json | 31 ++++++ .../UE_01_update_empty_gene_ids.json | 29 +++++ 9 files changed, 263 insertions(+), 1 deletion(-) create mode 100644 src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java create mode 100644 src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/AF_01_all_fields.json create mode 100644 src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/IV_01_invalid_gene_ids.json create mode 100644 src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/UE_01_update_empty_gene_ids.json diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java index 9823f666f..a6ad9b86a 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/associations/SequenceTargetingReagentGeneAssociationCrudController.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.interfaces.crud.associations.SequenceTargetingReagentGeneAssociationCrudInterface; import org.alliancegenome.curation_api.jobs.executors.SequenceTargetingReagentExecutor; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.associations.SequenceTargetingReagentGeneAssociationService; import jakarta.annotation.PostConstruct; @@ -23,4 +24,9 @@ public class SequenceTargetingReagentGeneAssociationCrudController extends protected void init() { setService(sequenceTargetingReagentGeneAssociationService); } + + @Override + public ObjectResponse getAssociation(Long sqtrId, String relationName, Long geneId) { + return sequenceTargetingReagentGeneAssociationService.getAssociation(sqtrId, relationName, geneId); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java index db9f22b12..da513eca4 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java @@ -6,6 +6,7 @@ import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.parameters.RequestBody; @@ -15,6 +16,7 @@ import jakarta.ws.rs.Consumes; import jakarta.ws.rs.DefaultValue; +import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.PathParam; @@ -46,4 +48,11 @@ public interface SequenceTargetingReagentCrudInterface extends BaseIdCrudInterfa @Tag(name = "Elastic Search Browsing Endpoints") @JsonView({ View.SequenceTargetingReagentView.class }) SearchResponse search(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); + + + @Override + @GET + @Path("/{id}") + @JsonView(View.SequenceTargetingReagentDetailView.class) + ObjectResponse getById(@PathParam("id") Long id); } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java index 918543e49..38711f98a 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java @@ -1,17 +1,29 @@ package org.alliancegenome.curation_api.interfaces.crud.associations; import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +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.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; +import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.core.MediaType; @Path("/sqtrgeneassociation") @Tag(name = "CRUD - SQTR Gene Associations") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { } +public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { + + @GET + @Path("/findBy") + @JsonView(View.FieldsAndLists.class) + ObjectResponse getAssociation(@QueryParam("sqtrId") Long alleleId, @QueryParam("relationName") String relationName, @QueryParam("geneId") Long geneId); +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index 5e9e002dd..5114bec77 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -13,8 +13,11 @@ import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.associations.SequenceTargetingReagentGeneAssociationFmsDTOValidator; @@ -101,4 +104,23 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { return ids; } + public ObjectResponse getAssociation(Long sqtrId, String relationName, Long geneId) { + SequenceTargetingReagentGeneAssociation association = null; + + Map params = new HashMap<>(); + params.put("sequenceTargetingReagentAssociationSubject.id", sqtrId); + params.put("relation.name", relationName); + params.put("sequenceTargetingReagentGeneAssociationObject.id", geneId); + + SearchResponse resp = sequenceTargetingReagentGeneAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + } diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java new file mode 100644 index 000000000..6d9bbeb7b --- /dev/null +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -0,0 +1,105 @@ +package org.alliancegenome.curation_api; + +import static org.hamcrest.Matchers.hasKey; +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; + +import org.alliancegenome.curation_api.base.BaseITCase; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.Vocabulary; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.resources.TestContainerResource; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; + +@QuarkusIntegrationTest +@QuarkusTestResource(TestContainerResource.Initializer.class) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@DisplayName("609 - Sequence Targeting Reagent Gene Associations bulk upload") +@Order(609) +public class SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase extends BaseITCase { + + private Gene gene; + private SequenceTargetingReagent sqtr; + VocabularyTerm relation; + private String relationName = "targets"; + private String geneCurie = "GENETEST:Gene0001"; + private String sqtrId = "83"; + private String sqtrModEntityId = "ZFIN:ZDB-TALEN-180503-1"; + + private final String sqtrGeneAssociationGetEndpoint = "/api/sqtrgeneassociation/findBy"; + private final String sqtrGeneAssociationTestFilePath = "src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/"; + private final String geneGetEndpoint = "/api/gene/"; + private final String sqtrGetEndpoint = "/api/sqtr/"; + + private final String sqtrBulkPostEndpoint = "/api/sqtr/bulk/ZFIN/sqtrfile"; + + private void loadRequiredEntities() throws Exception { + Vocabulary noteTypeVocab = getVocabulary("construct_relation"); + relation = getVocabularyTerm(noteTypeVocab, relationName); + gene = getGene(geneCurie); + sqtr = getSequenceTargetingReagent(sqtrId); + } + + @Test + @Order(1) + public void sqtrGeneAssociationBulkUploadCheckFields() throws Exception { + loadRequiredEntities(); + + checkSuccessfulBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "AF_01_all_fields.json", 2); + + RestAssured.given(). + when(). + get(sqtrGeneAssociationGetEndpoint + "?sqtrId=" + sqtr.getId() + "&relationName=" + relationName + "&geneId=" + gene.getId()). + then(). + statusCode(200). + body("entity.relation.name", is(relationName)). + body("entity.sequenceTargetingReagentGeneAssociationObject.modEntityId", is(geneCurie)). + body("entity.sequenceTargetingReagentAssociationSubject.modEntityId", is(sqtrModEntityId)); + + RestAssured.given(). + when(). + get(sqtrGetEndpoint + sqtrId). + then(). + statusCode(200). + body("entity.sequenceTargetingReagentGeneAssociations", hasSize(1)). + body("entity.sequenceTargetingReagentGeneAssociations[0].relation.name", is(relationName)). + body("entity.sequenceTargetingReagentGeneAssociations[0].sequenceTargetingReagentGeneAssociationObject.modEntityId", is(geneCurie)). + body("entity.sequenceTargetingReagentGeneAssociations[0].sequenceTargetingReagentAssociationSubject", not(hasKey("sequenceTargetingReagentGeneAssociations"))); + + RestAssured.given(). + when(). + get(geneGetEndpoint + geneCurie). + then(). + statusCode(200). + body("entity.sequenceTargetingReagentGeneAssociations", hasSize(1)). + body("entity.sequenceTargetingReagentGeneAssociations[0].relation.name", is(relationName)). + body("entity.sequenceTargetingReagentGeneAssociations[0].sequenceTargetingReagentGeneAssociationObject.modEntityId", is(geneCurie)). + body("entity.sequenceTargetingReagentGeneAssociations[0].sequenceTargetingReagentGeneAssociationObject", not(hasKey("sequenceTargetingReagentGeneAssociations"))); + } + + @Test + @Order(2) + public void sqtrGeneAssociationBulkUploadInvalidGenes() throws Exception { + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "IV_01_invalid_gene_ids.json", 2, 1, 1); + } + + @Test + @Order(3) + public void sqtrGeneAssociationBulkUploadMissingGenes() throws Exception { + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "UE_01_update_empty_gene_ids.json", 2, 0, 1); + } + + +} diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 42c239537..b32949a87 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -31,6 +31,7 @@ import org.alliancegenome.curation_api.model.entities.Reference; import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; +import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; @@ -760,6 +761,17 @@ public Gene getGene(String identifier) { return res.getEntity(); } + public SequenceTargetingReagent getSequenceTargetingReagent(String identifier) { + ObjectResponse res = RestAssured.given(). + when(). + get("/api/sqtr/" + identifier). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefSequenceTargetingReagent()); + + return res.getEntity(); + } + public GeneDiseaseAnnotation getGeneDiseaseAnnotation(String uniqueId) { ObjectResponse res = RestAssured.given(). when(). @@ -893,6 +905,11 @@ private TypeRef> getObjectResponseTypeRefGene() { }; } + private TypeRef> getObjectResponseTypeRefSequenceTargetingReagent() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefGeneDiseaseAnnotation() { return new TypeRef>() { }; diff --git a/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/AF_01_all_fields.json b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/AF_01_all_fields.json new file mode 100644 index 000000000..0cb3a1365 --- /dev/null +++ b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/AF_01_all_fields.json @@ -0,0 +1,31 @@ +{ + "data": [ + { + "primaryId": "ZFIN:ZDB-TALEN-180503-1", + "name": "TALEN-inhbaa", + "soTermId": "SO:0000059", + "taxonId": "NCBITaxon:7955", + "synonyms": [ + "#4" + ], + "secondaryIds": [ + "ZFIN:ZDB-MRKRSEQ-100429-7" + ], + "targetGeneIds": [ + "GENETEST:Gene0001" + ] + } + ], + "metaData": { + "dateProduced": "2024-04-18T20:10:35-07:00", + "dataProvider": { + "crossReference": { + "id": "ZFIN", + "pages": [ + "homepage" + ] + }, + "type": "curated" + } + } +} \ No newline at end of file diff --git a/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/IV_01_invalid_gene_ids.json b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/IV_01_invalid_gene_ids.json new file mode 100644 index 000000000..4b088b391 --- /dev/null +++ b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/IV_01_invalid_gene_ids.json @@ -0,0 +1,31 @@ +{ + "data": [ + { + "primaryId": "ZFIN:ZDB-TALEN-180503-1", + "name": "TALEN-inhbaa", + "soTermId": "SO:0000059", + "taxonId": "NCBITaxon:7955", + "synonyms": [ + "#4" + ], + "secondaryIds": [ + "ZFIN:ZDB-MRKRSEQ-100429-7" + ], + "targetGeneIds": [ + "GENETEST:GeneInvalid0001" + ] + } + ], + "metaData": { + "dateProduced": "2024-04-18T20:10:35-07:00", + "dataProvider": { + "crossReference": { + "id": "ZFIN", + "pages": [ + "homepage" + ] + }, + "type": "curated" + } + } +} \ No newline at end of file diff --git a/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/UE_01_update_empty_gene_ids.json b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/UE_01_update_empty_gene_ids.json new file mode 100644 index 000000000..4acb0a2ba --- /dev/null +++ b/src/test/resources/bulk/fms/SA01_sequencetargetingreagent_gene_association/UE_01_update_empty_gene_ids.json @@ -0,0 +1,29 @@ +{ + "data": [ + { + "primaryId": "ZFIN:ZDB-TALEN-180503-1", + "name": "TALEN-inhbaa", + "soTermId": "SO:0000059", + "taxonId": "NCBITaxon:7955", + "synonyms": [ + "#4" + ], + "secondaryIds": [ + "ZFIN:ZDB-MRKRSEQ-100429-7" + ], + "targetGeneIds": [] + } + ], + "metaData": { + "dateProduced": "2024-04-18T20:10:35-07:00", + "dataProvider": { + "crossReference": { + "id": "ZFIN", + "pages": [ + "homepage" + ] + }, + "type": "curated" + } + } +} \ No newline at end of file From 3cc30106249561c0a7545f984cc1ae4639391741 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 16 Jul 2024 15:39:25 -0500 Subject: [PATCH 058/342] SCRUM-4188 checkstyle formatting --- ...enceTargetingReagentGeneAssociationCrudInterface.java | 9 ++++----- .../SequenceTargetingReagentGeneAssociationService.java | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java index 38711f98a..2f6964dad 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/associations/SequenceTargetingReagentGeneAssociationCrudInterface.java @@ -1,7 +1,6 @@ package org.alliancegenome.curation_api.interfaces.crud.associations; import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; -import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.view.View; @@ -22,8 +21,8 @@ @Consumes(MediaType.APPLICATION_JSON) public interface SequenceTargetingReagentGeneAssociationCrudInterface extends BaseIdCrudInterface { - @GET - @Path("/findBy") - @JsonView(View.FieldsAndLists.class) - ObjectResponse getAssociation(@QueryParam("sqtrId") Long alleleId, @QueryParam("relationName") String relationName, @QueryParam("geneId") Long geneId); + @GET + @Path("/findBy") + @JsonView(View.FieldsAndLists.class) + ObjectResponse getAssociation(@QueryParam("sqtrId") Long alleleId, @QueryParam("relationName") String relationName, @QueryParam("geneId") Long geneId); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index 5114bec77..feeef193a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; From e42c3079cc42bc4fe7752ff85d4cdd56357f0511 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 16 Jul 2024 22:05:58 +0100 Subject: [PATCH 059/342] Remove unnecessary @RequestScoped --- .../services/helpers/gff3/Gff3AttributesHelper.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index ee5765a29..50239d962 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -9,9 +9,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import jakarta.enterprise.context.RequestScoped; - -@RequestScoped public class Gff3AttributesHelper { public static Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { From ba2c92a6427bad966bc8743742cd8ba4dc78857a Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 17 Jul 2024 08:05:19 -0500 Subject: [PATCH 060/342] SCRUM-4188 update completed records exepected count --- ...nceTargetingReagentGeneAssociationBulkUploadFmsITCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index 6d9bbeb7b..ed5460ac0 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -32,7 +32,7 @@ public class SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase extends private Gene gene; private SequenceTargetingReagent sqtr; - VocabularyTerm relation; + private VocabularyTerm relation; private String relationName = "targets"; private String geneCurie = "GENETEST:Gene0001"; private String sqtrId = "83"; @@ -98,7 +98,7 @@ public void sqtrGeneAssociationBulkUploadInvalidGenes() throws Exception { @Test @Order(3) public void sqtrGeneAssociationBulkUploadMissingGenes() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "UE_01_update_empty_gene_ids.json", 2, 0, 1); + checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "UE_01_update_empty_gene_ids.json", 2, 0, 2); } From a7e06cc1bf6390c35900f8a81f42eba73613d9cc Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 18 Jul 2024 12:55:02 +0100 Subject: [PATCH 061/342] Entities, DAOs and migration --- ...ranscriptCodingSequenceAssociationDAO.java | 15 +++ .../TranscriptExonAssociationDAO.java | 15 +++ .../TranscriptGeneAssociationDAO.java | 15 +++ .../model/entities/CodingSequence.java | 5 + .../curation_api/model/entities/Exon.java | 5 + .../curation_api/model/entities/Gene.java | 5 + .../model/entities/Transcript.java | 38 ++++++ .../TranscriptCodingSequenceAssociation.java | 68 ++++++++++ .../TranscriptExonAssociation.java | 68 ++++++++++ .../TranscriptGeneAssociation.java | 70 +++++++++++ .../TranscriptGenomicLocationAssociation.java | 7 +- ....36.0.6__transcript_association_tables.sql | 117 ++++++++++++++++++ 12 files changed, 427 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptCodingSequenceAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptExonAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGeneAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java create mode 100644 src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptCodingSequenceAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptCodingSequenceAssociationDAO.java new file mode 100644 index 000000000..6a1024ed6 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptCodingSequenceAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptCodingSequenceAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class TranscriptCodingSequenceAssociationDAO extends BaseSQLDAO { + + protected TranscriptCodingSequenceAssociationDAO() { + super(TranscriptCodingSequenceAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptExonAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptExonAssociationDAO.java new file mode 100644 index 000000000..a1bdefae4 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptExonAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class TranscriptExonAssociationDAO extends BaseSQLDAO { + + protected TranscriptExonAssociationDAO() { + super(TranscriptExonAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGeneAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGeneAssociationDAO.java new file mode 100644 index 000000000..32950fe4a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/transcriptAssociations/TranscriptGeneAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class TranscriptGeneAssociationDAO extends BaseSQLDAO { + + protected TranscriptGeneAssociationDAO() { + super(TranscriptGeneAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java index f72677f3b..5c3395cf9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptCodingSequenceAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -66,5 +67,9 @@ public class CodingSequence extends GenomicEntity { @OneToMany(mappedBy = "codingSequenceAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class }) private List codingSequenceGenomicLocationAssociations; + + @OneToMany(mappedBy = "transcriptCodingSequenceAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptCodingSequenceAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java index 8a55175ba..9edbc3622 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -66,5 +67,9 @@ public class Exon extends GenomicEntity { @OneToMany(mappedBy = "exonAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class }) private List exonGenomicLocationAssociations; + + @OneToMany(mappedBy = "transcriptExonAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptExonAssociations; } 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 fbb6dff68..6282721d6 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 @@ -7,6 +7,7 @@ import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.geneAssociations.GeneGeneAssociation; 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; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneFullNameSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSecondaryIdSlotAnnotation; @@ -101,4 +102,8 @@ public class Gene extends GenomicEntity { @OneToMany(mappedBy = "sequenceTargetingReagentGeneAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class }) private List sequenceTargetingReagentGeneAssociations; + + @OneToMany(mappedBy = "transcriptGeneAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class }) + private List transcriptGeneAssociations; } 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 8c8f5efe2..6e82c4bc5 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 @@ -4,6 +4,9 @@ import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +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; import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; @@ -53,4 +56,39 @@ public class Transcript extends GenomicEntity { @JsonView({ View.FieldsAndLists.class }) private List transcriptGenomicLocationAssociations; + @IndexedEmbedded( + includePaths = { + "transcriptCodingSequenceAssociationObject.curie", "transcriptCodingSequenceAssociationObject.name", "transcriptCodingSequenceAssociationObject.modEntityId", + "transcriptCodingSequenceAssociationObject.modInternalId", "transcriptCodingSequenceAssociationObject.uniqueId", + "transcriptCodingSequenceAssociationObject.curie_keyword", "transcriptCodingSequenceAssociationObject.name_keyword", "transcriptCodingSequenceAssociationObject.modEntityId_keyword", + "transcriptCodingSequenceAssociationObject.modInternalId_keyword", "transcriptCodingSequenceAssociationObject.uniqueId_keyword", + } + ) + @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptCodingSequenceAssociations; + + @IndexedEmbedded( + includePaths = { + "transcriptExonAssociationObject.curie", "transcriptExonAssociationObject.name", "transcriptExonAssociationObject.modEntityId", + "transcriptExonAssociationObject.modInternalId", "transcriptExonAssociationObject.uniqueId", + "transcriptExonAssociationObject.curie_keyword", "transcriptExonAssociationObject.name_keyword", "transcriptExonAssociationObject.modEntityId_keyword", + "transcriptExonAssociationObject.modInternalId_keyword", "transcriptExonAssociationObject.uniqueId_keyword", + } + ) + @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptExonAssociations; + + @IndexedEmbedded( + includePaths = { + "transcriptGeneAssociationObject.curie", "transcriptGeneAssociationObject.geneSymbol.displayText", "transcriptGeneAssociationObject.geneSymbol.formatText", "transcriptGeneAssociationObject.geneFullName.displayText", + "transcriptGeneAssociationObject.geneFullName.formatText", "transcriptGeneAssociationObject.curie_keyword", "transcriptGeneAssociationObject.geneSymbol.displayText_keyword", + "transcriptGeneAssociationObject.geneSymbol.formatText_keyword", "transcriptGeneAssociationObject.geneFullName.displayText_keyword", "transcriptGeneAssociationObject.geneFullName.formatText_keyword", + "transcriptGeneAssociationObject.modEntityId", "transcriptGeneAssociationObject.modInternalId", "transcriptGeneAssociationObject.modEntityId_keyword", "transcriptGeneAssociationObject.modInternalId_keyword" + } + ) + @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List transcriptGeneAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java new file mode 100644 index 000000000..1e231ea5c --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java @@ -0,0 +1,68 @@ +package org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) +@Schema(name = "TranscriptCodingSequenceAssociation", description = "POJO representing an association between a transcript and a CDS") +@Table(indexes = { + @Index(name = "transcriptcdsassociation_subject_index", columnList = "transcriptassociationsubject_id"), + @Index(name = "transcriptcdsassociation_relation_index", columnList = "relation_id"), + @Index(name = "transcriptcdsassociation_object_index", columnList = "transcriptcodingsequenceassociationobject_id") +}) +public class TranscriptCodingSequenceAssociation extends EvidenceAssociation { + + @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", + "curie_keyword", "name_keyword", "modEntityId_keyword", "modInternalId_keyword"}) + @ManyToOne + @JsonIgnoreProperties({ + "transcriptCodingSequenceAssociations", + "transcriptExonAssociations", + "transcriptGeneAssociations", + "transcriptGenomicLocationAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private Transcript transcriptAssociationSubject; + + @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", "uniqueId", + "curie_keyword", "name_keyword", "modEntityId_keyword", "modInternalId_keyword", "uniqueId_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonIgnoreProperties({ + "transcriptCodingSequenceAssociations", + "codingSequenceGenomicLocationAssociations", + "constructGenomicEntityAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private CodingSequence transcriptCodingSequenceAssociationObject; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm relation; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java new file mode 100644 index 000000000..0960baeaf --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java @@ -0,0 +1,68 @@ +package org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; +import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) +@Schema(name = "TranscriptExonAssociation", description = "POJO representing an association between a transcript and an exon") +@Table(indexes = { + @Index(name = "transcriptexonassociation_subject_index", columnList = "transcriptassociationsubject_id"), + @Index(name = "transcriptexonassociation_relation_index", columnList = "relation_id"), + @Index(name = "transcriptexonassociation_object_index", columnList = "transcriptexonassociationobject_id") +}) +public class TranscriptExonAssociation extends EvidenceAssociation { + + @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", + "curie_keyword", "name_keyword", "modEntityId_keyword", "modInternalId_keyword"}) + @ManyToOne + @JsonIgnoreProperties({ + "transcriptCodingSequenceAssociations", + "transcriptExonAssociations", + "transcriptGeneAssociations", + "transcriptGenomicLocationAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private Transcript transcriptAssociationSubject; + + @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", "uniqueId", + "curie_keyword", "name_keyword", "modEntityId_keyword", "modInternalId_keyword", "uniqueId_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonIgnoreProperties({ + "transcriptExonAssociations", + "constructGenomicEntityAssociations", + "exonGenomicLocationAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private Exon transcriptExonAssociationObject; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm relation; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java new file mode 100644 index 000000000..8658c7ab1 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java @@ -0,0 +1,70 @@ +package org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) +@Schema(name = "TranscriptGeneAssociation", description = "POJO representing an association between a transcript and a gene") +@Table(indexes = { + @Index(name = "transcriptgeneassociation_subject_index", columnList = "transcriptassociationsubject_id"), + @Index(name = "transcriptgeneassociation_relation_index", columnList = "relation_id"), + @Index(name = "transcriptgeneassociation_object_index", columnList = "transcriptgeneassociationobject_id") +}) +public class TranscriptGeneAssociation extends EvidenceAssociation { + + @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", + "curie_keyword", "name_keyword", "modEntityId_keyword", "modInternalId_keyword"}) + @ManyToOne + @JsonIgnoreProperties({ + "transcriptCodingSequenceAssociations", + "transcriptExonAssociations", + "transcriptGeneAssociations", + "transcriptGenomicLocationAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private Transcript transcriptAssociationSubject; + + @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({ + "alleleGeneAssociations", + "constructGenomicEntityAssociations", + "sequenceTargetingReagentGeneAssociations", + "transcriptGeneAssociations" + }) + @JsonView({ View.FieldsOnly.class }) + private Gene transcriptGeneAssociationObject; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm relation; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index 8f4558793..1a53b96a5 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -51,7 +51,12 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("transcriptGenomicLocationAssociations") + @JsonIgnoreProperties({ + "transcriptCodingSequenceAssociations", + "transcriptExonAssociations", + "transcriptGeneAssociations", + "transcriptGenomicLocationAssociations" + }) @Fetch(FetchMode.JOIN) private Transcript transcriptAssociationSubject; diff --git a/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql b/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql new file mode 100644 index 000000000..f584fffce --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql @@ -0,0 +1,117 @@ +CREATE TABLE transcriptcodingsequenceassociation ( + id bigint CONSTRAINT transcriptcodingsequenceassociation_pkey PRIMARY KEY, + relation_id bigint, + transcriptassociationsubject_id bigint, + transcriptcodingsequenceassociationobject_id bigint +); + +ALTER TABLE transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_tasubject_id_fk + FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_tcdsaobject_id_fk + FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); + +CREATE INDEX transcriptcdsassociation_relation_index ON transcriptcodingsequenceassociation + USING btree (relation_id); +CREATE INDEX transcriptcdsassociation_subject_index ON transcriptcodingsequenceassociation + USING btree (transcriptassociationsubject_id); +CREATE INDEX transcriptcdsassociation_object_index ON transcriptcodingsequenceassociation + USING btree (transcriptcodingsequenceassociationobject_id); + +CREATE TABLE transcriptexonassociation ( + id bigint CONSTRAINT transcriptexonassociation_pkey PRIMARY KEY, + relation_id bigint, + transcriptassociationsubject_id bigint, + transcriptexonassociationobject_id bigint +); + +ALTER TABLE transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_tasubject_id_fk + FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_teaobject_id_fk + FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); + +CREATE INDEX transcriptexonassociation_relation_index ON transcriptexonassociation + USING btree (relation_id); +CREATE INDEX transcriptcodingsequenceassociation_subject_index ON transcriptexonassociation + USING btree (transcriptassociationsubject_id); +CREATE INDEX transcriptexonassociation_object_index ON transcriptexonassociation + USING btree (transcriptexonassociationobject_id); + +CREATE TABLE transcriptgeneassociation ( + id bigint CONSTRAINT transcriptgeneassociation_pkey PRIMARY KEY, + relation_id bigint, + transcriptassociationsubject_id bigint, + transcriptgeneassociationobject_id bigint +); + +ALTER TABLE transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_id_fk + FOREIGN KEY (id) REFERENCES evidenceassociation(id); +ALTER TABLE transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_relation_id_fk + FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_tasubject_id_fk + FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_tgaobject_id_fk + FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); + +CREATE INDEX transcriptgeneassociation_relation_index ON transcriptgeneassociation + USING btree (relation_id); +CREATE INDEX transcriptgeneassociation_subject_index ON transcriptgeneassociation + USING btree (transcriptassociationsubject_id); +CREATE INDEX transcriptgeneassociation_object_index ON transcriptgeneassociation + USING btree (transcriptgeneassociationobject_id); + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Transcript Relation', 'transcript_relation'); + +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'parent_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'child_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Transcript CodingSequence Association Relation', 'transcript_coding_sequence_relation', id FROM vocabulary + WHERE vocabularylabel = 'transcript_relation'; +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Transcript Exon Association Relation', 'transcript_exon_relation', id FROM vocabulary + WHERE vocabularylabel = 'transcript_relation'; +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Transcript Gene Association Relation', 'transcript_gene_relation', id FROM vocabulary + WHERE vocabularylabel = 'transcript_relation'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_coding_sequence_relation' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + ) + ) + SELECT t2.id, t2.id FROM t1, t2; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_exon_relation' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + ) + ) + SELECT t2.id, t2.id FROM t1, t2; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_gene_relation' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'child_of' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + ) + ) + SELECT t2.id, t2.id FROM t1, t2; + \ No newline at end of file From 18490061a5b66a5096cb6745f346ea6116beca14 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 18 Jul 2024 13:51:25 +0100 Subject: [PATCH 062/342] Return assembly name so available for association loads --- .../curation_api/jobs/executors/Gff3Executor.java | 8 +++++--- .../alliancegenome/curation_api/services/Gff3Service.java | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index aa7fa7938..794ef80ea 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -120,7 +120,7 @@ private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { try { - gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); + assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -157,6 +157,8 @@ private void loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history } updateHistory(history); ph.progressProcess(); + + return assemblyName; } private Map> loadEntities(BulkLoadFileHistory history, List gffData, Map> idsAdded, 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 6256b6613..69d86ef4d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -52,7 +52,7 @@ public class Gff3Service { @Inject Gff3DtoValidator gff3DtoValidator; @Transactional - public void loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public String loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { if (StringUtils.isBlank(assemblyName)) { for (String header : gffHeaderData) { @@ -76,6 +76,8 @@ public void loadGenomeAssembly(String assemblyName, List gffHeaderData, genomeAssemblyDAO.persist(assembly); } + + return assemblyName; } else { throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); } @@ -106,7 +108,7 @@ public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO g @Transactional public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ObjectUpdateException { - if (StringUtils.isEmpty(assemblyId)) { + if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } From a602435f28f8f45d742d7e52a5264f7c995c773d Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 18 Jul 2024 14:13:50 +0100 Subject: [PATCH 063/342] Fix migration --- .../v0.36.0.6__transcript_association_tables.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql b/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql index f584fffce..b1cdc7024 100644 --- a/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql +++ b/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql @@ -88,10 +88,10 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ), t2 AS ( SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( - SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) - SELECT t2.id, t2.id FROM t1, t2; + SELECT t1.id, t2.id FROM t1, t2; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) WITH t1 AS ( @@ -99,10 +99,10 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ), t2 AS ( SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( - SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) - SELECT t2.id, t2.id FROM t1, t2; + SELECT t1.id, t2.id FROM t1, t2; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) WITH t1 AS ( @@ -110,8 +110,8 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ), t2 AS ( SELECT id FROM vocabularyterm WHERE name = 'child_of' AND vocabulary_id = ( - SELECT id FROM vocabulary WHERE vocabulary_label = 'transcript_relation' + SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) - SELECT t2.id, t2.id FROM t1, t2; + SELECT t1.id, t2.id FROM t1, t2; \ No newline at end of file From be7abe73718dd14683cf248f8b916462a2ae3eb2 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 18 Jul 2024 23:38:33 +0100 Subject: [PATCH 064/342] Update services --- .../constants/EntityFieldConstants.java | 4 + ...enceGenomicLocationAssociationService.java | 4 + ...ExonGenomicLocationAssociationService.java | 4 + ...criptCodingSequenceAssociationService.java | 139 ++++++++++++++++++ .../TranscriptExonAssociationService.java | 139 ++++++++++++++++++ .../TranscriptGeneAssociationService.java | 139 ++++++++++++++++++ ...riptGenomicLocationAssociationService.java | 7 +- 7 files changed, 435 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptCodingSequenceAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptExonAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGeneAssociationService.java 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 1f22b716f..46a0e2c44 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -33,6 +33,10 @@ private EntityFieldConstants() { 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 TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON = TRANSCRIPT_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 + ".name"; public static final String EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "exon" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; 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 4eb4ac33d..99cd1aeab 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 @@ -20,6 +20,7 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.PersonService; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; @@ -45,6 +46,9 @@ 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")) { + params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } List associationIds = codingSequenceGenomicLocationAssociationDAO.findIdsByParams(params); associationIds.removeIf(Objects::isNull); diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java index c41861926..4ea5c2dfb 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java @@ -20,6 +20,7 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.PersonService; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; @@ -45,6 +46,9 @@ protected void init() { public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { Map params = new HashMap<>(); params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } List associationIds = exonGenomicLocationAssociationDAO.findIdsByParams(params); associationIds.removeIf(Objects::isNull); diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptCodingSequenceAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptCodingSequenceAssociationService.java new file mode 100644 index 000000000..ca9bc103e --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptCodingSequenceAssociationService.java @@ -0,0 +1,139 @@ +package org.alliancegenome.curation_api.services.associations.transcriptAssociations; + +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptCodingSequenceAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptCodingSequenceAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; + +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 TranscriptCodingSequenceAssociationService extends BaseEntityCrudService { + + @Inject TranscriptCodingSequenceAssociationDAO transcriptCodingSequenceAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(transcriptCodingSequenceAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } + List associationIds = transcriptCodingSequenceAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public TranscriptCodingSequenceAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + TranscriptCodingSequenceAssociation association = transcriptCodingSequenceAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find TranscriptCodingSequenceAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return transcriptCodingSequenceAssociationDAO.persist(association); + } + return association; + } + + transcriptCodingSequenceAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long transcriptId, Long assemblyComponentId) { + TranscriptCodingSequenceAssociation association = null; + + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcriptId); + params.put("transcriptCodingSequenceAssociationObject.id", assemblyComponentId); + + SearchResponse resp = transcriptCodingSequenceAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + + public void addAssociationToSubjectAndObject(TranscriptCodingSequenceAssociation association) { + Transcript transcript = association.getTranscriptAssociationSubject(); + + List currentSubjectAssociations = transcript.getTranscriptCodingSequenceAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(TranscriptCodingSequenceAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + CodingSequence codingSequence = association.getTranscriptCodingSequenceAssociationObject(); + + List currentObjectAssociations = codingSequence.getTranscriptCodingSequenceAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(TranscriptCodingSequenceAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptExonAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptExonAssociationService.java new file mode 100644 index 000000000..57602635c --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptExonAssociationService.java @@ -0,0 +1,139 @@ +package org.alliancegenome.curation_api.services.associations.transcriptAssociations; + +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptExonAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; + +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 TranscriptExonAssociationService extends BaseEntityCrudService { + + @Inject TranscriptExonAssociationDAO transcriptExonAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(transcriptExonAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } + List associationIds = transcriptExonAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public TranscriptExonAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + TranscriptExonAssociation association = transcriptExonAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find TranscriptExonAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return transcriptExonAssociationDAO.persist(association); + } + return association; + } + + transcriptExonAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long transcriptId, Long assemblyComponentId) { + TranscriptExonAssociation association = null; + + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcriptId); + params.put("transcriptExonAssociationObject.id", assemblyComponentId); + + SearchResponse resp = transcriptExonAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + + public void addAssociationToSubjectAndObject(TranscriptExonAssociation association) { + Transcript transcript = association.getTranscriptAssociationSubject(); + + List currentSubjectAssociations = transcript.getTranscriptExonAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(TranscriptExonAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + Exon exon = association.getTranscriptExonAssociationObject(); + + List currentObjectAssociations = exon.getTranscriptExonAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(TranscriptExonAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGeneAssociationService.java new file mode 100644 index 000000000..256d9a003 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGeneAssociationService.java @@ -0,0 +1,139 @@ +package org.alliancegenome.curation_api.services.associations.transcriptAssociations; + +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGeneAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; + +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 TranscriptGeneAssociationService extends BaseEntityCrudService { + + @Inject TranscriptGeneAssociationDAO transcriptGeneAssociationDAO; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(transcriptGeneAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } + List associationIds = transcriptGeneAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public TranscriptGeneAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + TranscriptGeneAssociation association = transcriptGeneAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find TranscriptGeneAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return transcriptGeneAssociationDAO.persist(association); + } + return association; + } + + transcriptGeneAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long transcriptId, Long assemblyComponentId) { + TranscriptGeneAssociation association = null; + + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcriptId); + params.put("transcriptGeneAssociationObject.id", assemblyComponentId); + + SearchResponse resp = transcriptGeneAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + + public void addAssociationToSubjectAndObject(TranscriptGeneAssociation association) { + Transcript transcript = association.getTranscriptAssociationSubject(); + + List currentSubjectAssociations = transcript.getTranscriptGeneAssociations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(TranscriptGeneAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + + Gene gene = association.getTranscriptGeneAssociationObject(); + + List currentObjectAssociations = gene.getTranscriptGeneAssociations(); + if (currentObjectAssociations == null) { + currentObjectAssociations = new ArrayList<>(); + } + + List currentObjectAssociationIds = currentObjectAssociations.stream() + .map(TranscriptGeneAssociation::getId).collect(Collectors.toList()); + + if (!currentObjectAssociationIds.contains(association.getId())) { + currentObjectAssociations.add(association); + } + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java index d4f06e2fe..60bd1ce63 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java @@ -20,6 +20,7 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.PersonService; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.apache.commons.lang.StringUtils; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; @@ -45,6 +46,9 @@ protected void init() { public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { Map params = new HashMap<>(); params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } List associationIds = transcriptGenomicLocationAssociationDAO.findIdsByParams(params); associationIds.removeIf(Objects::isNull); @@ -89,7 +93,7 @@ public ObjectResponse getLocationAssociati TranscriptGenomicLocationAssociation association = null; Map params = new HashMap<>(); - params.put("transcriptAssociationSubject.id", transcriptId); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcriptId); params.put("transcriptGenomicLocationAssociationObject.id", assemblyComponentId); SearchResponse resp = transcriptGenomicLocationAssociationDAO.findByParams(params); @@ -119,6 +123,7 @@ public void addAssociationToSubjectAndObject(TranscriptGenomicLocationAssociatio } AssemblyComponent assemblyComponent = association.getTranscriptGenomicLocationAssociationObject(); + assemblyComponent.getTranscriptGenomicLocationAssociations().size(); List currentObjectAssociations = assemblyComponent.getTranscriptGenomicLocationAssociations(); if (currentObjectAssociations == null) { From 944c076d5211fc20939e0991211b4023f0bc2d5a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 19 Jul 2024 09:42:10 +0100 Subject: [PATCH 065/342] Remove reverse associations --- .../model/entities/AssemblyComponent.java | 21 +------------------ ...ingSequenceGenomicLocationAssociation.java | 8 +++---- .../ExonGenomicLocationAssociation.java | 8 +++---- .../TranscriptGenomicLocationAssociation.java | 8 +++---- .../curation_api/services/Gff3Service.java | 6 +++--- ...enceGenomicLocationAssociationService.java | 16 +------------- ...ExonGenomicLocationAssociationService.java | 16 +------------- ...riptGenomicLocationAssociationService.java | 16 +------------- 8 files changed, 16 insertions(+), 83 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index 018cc8c9e..862c73da6 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -1,12 +1,7 @@ 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.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; -import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; -import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; @@ -16,11 +11,9 @@ import com.fasterxml.jackson.annotation.JsonView; -import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; -import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -30,7 +23,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = {"transcriptGenomicLocationAssociations", "exonGenomicLocationAssociations", "codingSequenceGenomicLocationAssociations"}, callSuper = true) +@ToString(callSuper = true) @Schema(name = "AssemblyComponent", description = "POJO that represents the AssemblyComponent") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table( @@ -54,17 +47,5 @@ public class AssemblyComponent extends GenomicEntity { @ManyToOne @JsonView({ View.FieldsOnly.class }) private Chromosome mapsToChromosome; - - @OneToMany(mappedBy = "transcriptGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class }) - private List transcriptGenomicLocationAssociations; - - @OneToMany(mappedBy = "exonGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class }) - private List exonGenomicLocationAssociations; - - @OneToMany(mappedBy = "codingSequenceGenomicLocationAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class }) - private List codingSequenceGenomicLocationAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index 0d15a045b..322734ab5 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -13,9 +13,11 @@ 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.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.JsonIgnoreProperties; @@ -61,11 +63,7 @@ public class CodingSequenceGenomicLocationAssociation extends LocationAssociatio }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({ - "codingSequenceGenomicLocationAssociations", - "exonGenomicLocationAssociations", - "transcriptGenomicLocationAssociations" - }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @Fetch(FetchMode.JOIN) private AssemblyComponent codingSequenceGenomicLocationAssociationObject; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 3cc57e566..7db787478 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -12,8 +12,10 @@ 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; @@ -59,11 +61,7 @@ public class ExonGenomicLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({ - "codingSequenceGenomicLocationAssociations", - "exonGenomicLocationAssociations", - "transcriptGenomicLocationAssociations" - }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @Fetch(FetchMode.JOIN) private AssemblyComponent exonGenomicLocationAssociationObject; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index 8f4558793..0669ae276 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -13,9 +13,11 @@ 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.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.JsonIgnoreProperties; @@ -61,11 +63,7 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({ - "codingSequenceGenomicLocationAssociations", - "exonGenomicLocationAssociations", - "transcriptGenomicLocationAssociations" - }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @Fetch(FetchMode.JOIN) private AssemblyComponent transcriptGenomicLocationAssociationObject; 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 69d86ef4d..0de400d57 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -124,7 +124,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assemblyId, dataProvider); if (exonLocation != null) { idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); - exonLocationService.addAssociationToSubjectAndObject(exonLocation); + exonLocationService.addAssociationToSubject(exonLocation); } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); @@ -136,7 +136,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); if (cdsLocation != null) { idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); - cdsLocationService.addAssociationToSubjectAndObject(cdsLocation); + cdsLocationService.addAssociationToSubject(cdsLocation); } } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { @@ -153,7 +153,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); if (transcriptLocation != null) { idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); - transcriptLocationService.addAssociationToSubjectAndObject(transcriptLocation); + transcriptLocationService.addAssociationToSubject(transcriptLocation); } } 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 4eb4ac33d..2bc0c88b1 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 @@ -103,7 +103,7 @@ public ObjectResponse getLocationAssoc return response; } - public void addAssociationToSubjectAndObject(CodingSequenceGenomicLocationAssociation association) { + public void addAssociationToSubject(CodingSequenceGenomicLocationAssociation association) { CodingSequence cds = association.getCodingSequenceAssociationSubject(); List currentSubjectAssociations = cds.getCodingSequenceGenomicLocationAssociations(); @@ -117,19 +117,5 @@ public void addAssociationToSubjectAndObject(CodingSequenceGenomicLocationAssoci if (!currentSubjectAssociationIds.contains(association.getId())) { currentSubjectAssociations.add(association); } - - AssemblyComponent assemblyComponent = association.getCodingSequenceGenomicLocationAssociationObject(); - - List currentObjectAssociations = assemblyComponent.getCodingSequenceGenomicLocationAssociations(); - if (currentObjectAssociations == null) { - currentObjectAssociations = new ArrayList<>(); - } - - List currentObjectAssociationIds = currentObjectAssociations.stream() - .map(CodingSequenceGenomicLocationAssociation::getId).collect(Collectors.toList()); - - if (!currentObjectAssociationIds.contains(association.getId())) { - currentObjectAssociations.add(association); - } } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java index c41861926..18b1957cd 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java @@ -103,7 +103,7 @@ public ObjectResponse getLocationAssociation(Lon return response; } - public void addAssociationToSubjectAndObject(ExonGenomicLocationAssociation association) { + public void addAssociationToSubject(ExonGenomicLocationAssociation association) { Exon exon = association.getExonAssociationSubject(); List currentSubjectAssociations = exon.getExonGenomicLocationAssociations(); @@ -117,19 +117,5 @@ public void addAssociationToSubjectAndObject(ExonGenomicLocationAssociation asso if (!currentSubjectAssociationIds.contains(association.getId())) { currentSubjectAssociations.add(association); } - - AssemblyComponent assemblyComponent = association.getExonGenomicLocationAssociationObject(); - - List currentObjectAssociations = assemblyComponent.getExonGenomicLocationAssociations(); - if (currentObjectAssociations == null) { - currentObjectAssociations = new ArrayList<>(); - } - - List currentObjectAssociationIds = currentObjectAssociations.stream() - .map(ExonGenomicLocationAssociation::getId).collect(Collectors.toList()); - - if (!currentObjectAssociationIds.contains(association.getId())) { - currentObjectAssociations.add(association); - } } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java index d4f06e2fe..758ef77e5 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java @@ -103,7 +103,7 @@ public ObjectResponse getLocationAssociati return response; } - public void addAssociationToSubjectAndObject(TranscriptGenomicLocationAssociation association) { + public void addAssociationToSubject(TranscriptGenomicLocationAssociation association) { Transcript transcript = association.getTranscriptAssociationSubject(); List currentSubjectAssociations = transcript.getTranscriptGenomicLocationAssociations(); @@ -117,19 +117,5 @@ public void addAssociationToSubjectAndObject(TranscriptGenomicLocationAssociatio if (!currentSubjectAssociationIds.contains(association.getId())) { currentSubjectAssociations.add(association); } - - AssemblyComponent assemblyComponent = association.getTranscriptGenomicLocationAssociationObject(); - - List currentObjectAssociations = assemblyComponent.getTranscriptGenomicLocationAssociations(); - if (currentObjectAssociations == null) { - currentObjectAssociations = new ArrayList<>(); - } - - List currentObjectAssociationIds = currentObjectAssociations.stream() - .map(TranscriptGenomicLocationAssociation::getId).collect(Collectors.toList()); - - if (!currentObjectAssociationIds.contains(association.getId())) { - currentObjectAssociations.add(association); - } } } From 2542437151cdfb023e0b5cd755cafd61657b57f0 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 19 Jul 2024 09:49:14 +0100 Subject: [PATCH 066/342] Remove unused imports --- .../CodingSequenceGenomicLocationAssociationService.java | 1 - 1 file changed, 1 deletion(-) 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 2bc0c88b1..e817435c9 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 @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; From ba8426e98b808e453658752cbc60abf2074cdc6c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 19 Jul 2024 09:57:03 +0100 Subject: [PATCH 067/342] Remove more unusued imports --- .../exonAssociations/ExonGenomicLocationAssociationService.java | 1 - .../TranscriptGenomicLocationAssociationService.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java index 18b1957cd..49b3c6c02 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/exonAssociations/ExonGenomicLocationAssociationService.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.associations.exonAssociations.ExonGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java index 758ef77e5..9160786f6 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/transcriptAssociations/TranscriptGenomicLocationAssociationService.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.response.ObjectResponse; From c312d633b7688bb6d1b9df4b03cd10ba41b37c06 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 24 Jul 2024 10:22:58 -0500 Subject: [PATCH 068/342] Replaced structural reasoner with ELK reasoner --- pom.xml | 8 +++++++- .../services/helpers/GenericOntologyLoadHelper.java | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 0600e13b4..eb73d83ac 100644 --- a/pom.xml +++ b/pom.xml @@ -120,7 +120,13 @@ net.sourceforge.owlapi owlapi-distribution - 5.1.19 + 5.5.0 + + + + io.github.liveontologies + elk-owlapi + 0.6.0 diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/GenericOntologyLoadHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/GenericOntologyLoadHelper.java index f4ecd55e5..05e8e35c1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/GenericOntologyLoadHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/GenericOntologyLoadHelper.java @@ -29,16 +29,14 @@ import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.reasoner.OWLReasoner; -import org.semanticweb.owlapi.reasoner.OWLReasonerFactory; -import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; import org.semanticweb.owlapi.search.EntitySearcher; +import org.semanticweb.elk.owlapi.ElkReasonerFactory; import io.quarkus.logging.Log; public class GenericOntologyLoadHelper implements OWLObjectVisitor { - private OWLReasonerFactory reasonerFactory = new StructuralReasonerFactory(); - // private OWLDataFactory df = OWLManager.getOWLDataFactory(); + private ElkReasonerFactory reasonerFactory = new ElkReasonerFactory(); private OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); private OWLReasoner reasoner; private OWLOntology ontology; From bbebddb64acd069d87b42665f920e1ef875a6819 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 24 Jul 2024 12:30:22 -0500 Subject: [PATCH 069/342] skip SQTR Gene Association test for now --- ...uenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index ed5460ac0..5c9bd1bf7 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -11,6 +11,7 @@ import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; +import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; @@ -22,6 +23,7 @@ import io.quarkus.test.junit.QuarkusIntegrationTest; import io.restassured.RestAssured; +@Disabled @QuarkusIntegrationTest @QuarkusTestResource(TestContainerResource.Initializer.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) From 2b36e97f24bf868819ed03bc0cf71d4c99f0c0a8 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 24 Jul 2024 09:07:11 -0500 Subject: [PATCH 070/342] SCRUM-4277 added obsolete filtering to all mod settings --- .../cliapp/src/service/TableStateService.js | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/src/main/cliapp/src/service/TableStateService.js b/src/main/cliapp/src/service/TableStateService.js index 0447627f1..037504ab2 100644 --- a/src/main/cliapp/src/service/TableStateService.js +++ b/src/main/cliapp/src/service/TableStateService.js @@ -47,6 +47,9 @@ const modTableSettings = { 'dataProvider.sourceOrganization.fullName': { queryString: 'RGD', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.shortName': { queryString: 'RGD', tokenOperator: 'AND' }, }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', @@ -93,6 +96,9 @@ const modTableSettings = { 'dataProvider.sourceOrganization.fullName': { queryString: 'SGD', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.shortName': { queryString: 'SGD', tokenOperator: 'AND' }, }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', @@ -103,14 +109,6 @@ const modTableSettings = { page: 0, rows: 50, first: 0, - filters: { - dataProviderFilter: { - 'dataProvider.sourceOrganization.abbreviation': { queryString: 'WB', tokenOperator: 'AND' }, - 'dataProvider.sourceOrganization.fullName': { queryString: 'WB', tokenOperator: 'AND' }, - 'dataProvider.sourceOrganization.shortName': { queryString: 'WB', tokenOperator: 'AND' }, - }, - }, - tableKeyName: 'DiseaseAnnotations', multiSortMeta: [{ field: 'dateCreated', order: -1 }], selectedColumnNames: [ 'MOD Annotation ID', @@ -148,6 +146,17 @@ const modTableSettings = { 'Genetic Modifiers', 'Asserted Genes', ], + filters: { + dataProviderFilter: { + 'dataProvider.sourceOrganization.abbreviation': { queryString: 'WB', tokenOperator: 'AND' }, + 'dataProvider.sourceOrganization.fullName': { queryString: 'WB', tokenOperator: 'AND' }, + 'dataProvider.sourceOrganization.shortName': { queryString: 'WB', tokenOperator: 'AND' }, + }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, + }, + tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', }, }, @@ -187,14 +196,14 @@ const modTableSettings = { 'Genetic Modifiers', ], filters: { - obsoleteFilter: { - obsolete: { queryString: 'false' }, - }, dataProviderFilter: { 'dataProvider.sourceOrganization.abbreviation': { queryString: 'FB', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.fullName': { queryString: 'FB', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.shortName': { queryString: 'FB', tokenOperator: 'AND' }, }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', @@ -229,6 +238,9 @@ const modTableSettings = { 'dataProvider.sourceOrganization.fullName': { queryString: 'ZFIN', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.shortName': { queryString: 'ZFIN', tokenOperator: 'AND' }, }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', @@ -269,6 +281,9 @@ const modTableSettings = { 'dataProvider.sourceOrganization.fullName': { queryString: 'ZFIN', tokenOperator: 'AND' }, 'dataProvider.sourceOrganization.shortName': { queryString: 'ZFIN', tokenOperator: 'AND' }, }, + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', From aafab688fcea2704f7eafa16aac4e91b75f0a230 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 25 Jul 2024 15:31:05 -0500 Subject: [PATCH 071/342] SCRUM-4277 add filter to default mod --- src/main/cliapp/src/service/TableStateService.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/cliapp/src/service/TableStateService.js b/src/main/cliapp/src/service/TableStateService.js index 0447627f1..f3cdc1943 100644 --- a/src/main/cliapp/src/service/TableStateService.js +++ b/src/main/cliapp/src/service/TableStateService.js @@ -375,7 +375,11 @@ const modTableSettings = { 'Genetic Modifiers', 'Internal', ], - filters: {}, + filters: { + obsoleteFilter: { + obsolete: { queryString: 'false' }, + }, + }, tableKeyName: 'DiseaseAnnotations', tableSettingsKeyName: 'DiseaseAnnotationsTableSettings', }, From b687b2a37716fc35f21052ae0b004b57832feb6b Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 11 Jul 2024 22:30:19 -0500 Subject: [PATCH 072/342] Adding HTPexpressiondataset entities --- .../cliapp/src/service/DataLoadService.js | 1 + .../enums/BackendBulkLoadType.java | 3 +- ...ThroughputExpressionDatasetAnnotation.java | 60 ++++++++++ ...6.0.4__highthroughputexpressiondataset.sql | 103 ++++++++++++++++++ 4 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java create mode 100644 src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 5e5b729fc..c361e810e 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,6 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', + 'HTP EXPRESSION DATASET ANNOTATION', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 9172530be..119aef824 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -23,7 +23,8 @@ public enum BackendBulkLoadType { INTERACTION_GEN("tsv"), PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), - EXPRESSION("json"); + EXPRESSION("json"), + HTP_EXPRESSION_DATASET_ANNOTATION("json"); public String fileExtension; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java new file mode 100644 index 000000000..f16dbd1a8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -0,0 +1,60 @@ +package org.alliancegenome.curation_api.model.entities; + +import java.util.List; + +import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; +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.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; +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.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") +public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ + + @JsonView({ View.FieldsOnly.class }) + private String name; + + @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @Fetch(FetchMode.JOIN) + @JoinTable(indexes = { + @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_reference_references_index", columnList = "references_id") + }) + @JsonView({ View.FieldsAndLists.class }) + private List references; + + @JsonView({ View.FieldsOnly.class }) + private String realtedNote; + + @JsonView({ View.FieldsOnly.class }) + private Integer numberOfChannels; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @JsonView({ View.FieldsAndLists.class }) + @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) + List categoryTags; + +} diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql new file mode 100644 index 000000000..605d58caa --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -0,0 +1,103 @@ +-- To create bulk loads + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Annotation Bulk Loads'); + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; + + +--Adding 3 extra vocabulary terms for HTPTags + +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; + +-- Adding highthroughputexpressiondatasetannotation + +CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; + +CREATE TABLE highthroughputexpressiondatasetannotation ( + 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, + curie character varying(255), + modentityid character varying(255), + modinternalid character varying(255), + name character varying(255), + numberofchannels integer, + realtednote character varying(255), + createdby_id bigint, + updatedby_id bigint, + dataprovider_id bigint +); + +CREATE TABLE highthroughputexpressiondatasetannotation_categorytags ( + highthroughputexpressiondatasetannotation_id bigint NOT NULL, + categorytags_id bigint NOT NULL + ); + +CREATE TABLE highthroughputexpressiondatasetannotation_reference ( + highthroughputexpressiondatasetannotation_id bigint NOT NULL, + references_id bigint NOT NULL + ); + +ALTER TABLE highthroughputexpressiondatasetannotation ADD CONSTRAINT highthroughputexpressiondatasetannotation_pkey PRIMARY KEY (id); + +CREATE INDEX htpdatasetannotation_reference_htpdataset_index ON highthroughputexpressiondatasetannotation_reference USING btree (highthroughputexpressiondatasetannotation_id); + +CREATE INDEX htpdatasetannotation_reference_references_index ON highthroughputexpressiondatasetannotation_reference USING btree (references_id); + +CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (categorytags_id); + +CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); + +ALTER TABLE highthroughputexpressiondatasetannotation_categorytags + ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT highthroughputexpressiondatasetannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_categorytags + ADD CONSTRAINT htpdatasetannotation_categorytags_categorytags_id_fk FOREIGN KEY (categorytags_id) REFERENCES vocabularyterm(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_reference + ADD CONSTRAINT htpdatasetannotation_reference_htpdatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); + +ALTER TABLE highthroughputexpressiondatasetannotation_reference + ADD CONSTRAINT htpdatasetannotation_reference_references_id_fk FOREIGN KEY (references_id) REFERENCES reference(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT htpdatasetannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT htpdatasetannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); \ No newline at end of file From e061e77faade24a816a1a1e29fa7b9a1e2e31475 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 11 Jul 2024 22:39:46 -0500 Subject: [PATCH 073/342] Formatting --- ...ThroughputExpressionDatasetAnnotation.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index f16dbd1a8..fd40d6e52 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -28,12 +28,12 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") -public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ +public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsOnly.class }) - private String name; + private String name; - @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) + @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.JOIN) @@ -44,17 +44,17 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject{ @JsonView({ View.FieldsAndLists.class }) private List references; - @JsonView({ View.FieldsOnly.class }) - private String realtedNote; + @JsonView({ View.FieldsOnly.class }) + private String realtedNote; - @JsonView({ View.FieldsOnly.class }) - private Integer numberOfChannels; + @JsonView({ View.FieldsOnly.class }) + private Integer numberOfChannels; - @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) - @ManyToMany - @JsonView({ View.FieldsAndLists.class }) + @ManyToMany + @JsonView({ View.FieldsAndLists.class }) @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) - List categoryTags; + List categoryTags; } From 4f2460bbc2dcfeda8b0b04b9c9f69f9c5ccb2863 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 12 Jul 2024 11:50:57 -0500 Subject: [PATCH 074/342] Note class used instead of string for related note --- .../cliapp/src/service/DataLoadService.js | 2 +- ...ThroughputExpressionDatasetAnnotation.java | 19 +++++++++++++++++-- ...6.0.4__highthroughputexpressiondataset.sql | 7 +++++-- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index c361e810e..8eaf6fb4a 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,7 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', - 'HTP EXPRESSION DATASET ANNOTATION', + 'HTP_EXPRESSION_DATASET_ANNOTATION', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index fd40d6e52..7af5d1721 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -7,17 +7,26 @@ 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.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.mapping.definition.annotation.FullTextField; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; 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; +import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToOne; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -31,6 +40,8 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") private String name; @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", "curie_keyword", "primaryCrossReferenceCurie_keyword", "crossReferences.referencedCurie_keyword"}) @@ -44,17 +55,21 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsAndLists.class }) private List references; + @IndexedEmbedded(includePaths = { "freeText", "noteType.name", "references.curie", "references.primaryCrossReferenceCurie", "freeText_keyword", "noteType.name_keyword", "references.curie_keyword", "references.primaryCrossReferenceCurie_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) - private String realtedNote; + private Note relatedNote; @JsonView({ View.FieldsOnly.class }) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) private Integer numberOfChannels; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JsonView({ View.FieldsAndLists.class }) - @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) + @JoinTable(name = "highthroughputexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) List categoryTags; } diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index 605d58caa..62108110c 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -16,7 +16,7 @@ INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) -SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; @@ -55,7 +55,7 @@ CREATE TABLE highthroughputexpressiondatasetannotation ( modinternalid character varying(255), name character varying(255), numberofchannels integer, - realtednote character varying(255), + relatednote_id bigint, createdby_id bigint, updatedby_id bigint, dataprovider_id bigint @@ -81,6 +81,9 @@ CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpression CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); +ALTER TABLE highthroughputexpressiondatasetannotation + ADD CONSTRAINT highthroughputexpressiondatasetannotation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note (id); + ALTER TABLE highthroughputexpressiondatasetannotation_categorytags ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); From 730e7e4ab971efbfa45d5bc2162dbceb3a460e83 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 12 Jul 2024 11:53:20 -0500 Subject: [PATCH 075/342] formatting --- .../entities/HighThroughputExpressionDatasetAnnotation.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index 7af5d1721..9e3431fb3 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -62,7 +62,7 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { private Note relatedNote; @JsonView({ View.FieldsOnly.class }) - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) private Integer numberOfChannels; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) From a064080f64afc1d90cece7026bb07fa2912f4128 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:27:20 -0500 Subject: [PATCH 076/342] Added vocabulary terms for HTP Dataset and HTP Dataset Sample --- .../cliapp/src/service/DataLoadService.js | 2 +- .../enums/BackendBulkLoadType.java | 2 +- ...6.0.4__highthroughputexpressiondataset.sql | 61 ++++++++++++++----- 3 files changed, 49 insertions(+), 16 deletions(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 8eaf6fb4a..28b2eaa66 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,7 +81,7 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', - 'HTP_EXPRESSION_DATASET_ANNOTATION', + 'HTPDATASET', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 119aef824..2c3ae805d 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -24,7 +24,7 @@ public enum BackendBulkLoadType { PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), EXPRESSION("json"), - HTP_EXPRESSION_DATASET_ANNOTATION("json"); + HTPDATASET("json"); public String fileExtension; diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index 62108110c..da1345447 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -3,41 +3,74 @@ INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Annotation Bulk Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +SELECT nextval('bulkload_seq'), 'HTPDATASET', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) -SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTP_EXPRESSION_DATASET_ANNOTATION'; +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTPDATASET'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTP_EXPRESSION_DATASET_ANNOTATION', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; +SELECT id, 'HTPDATASET', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; ---Adding 3 extra vocabulary terms for HTPTags +--Adding vocabulary terms INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Sample Note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) + SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH + t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_note_type' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Summary' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' + ) + ) + SELECT t1.id, t2.id FROM t1,t2; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) + SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Sample Note Type', 'htp_expression_dataset_sample_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH + t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_sample_note_type' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Sample Note' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' + ) + ) + SELECT t1.id, t2.id FROM t1,t2; + -- Adding highthroughputexpressiondatasetannotation CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; From 45a3c6c4a8ac58ba66337db867382f6b9ea2d08e Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:29:40 -0500 Subject: [PATCH 077/342] changes vocabulary terms name into snake case --- .../v0.36.0.4__highthroughputexpressiondataset.sql | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql index da1345447..a2fd4fef3 100644 --- a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql @@ -38,8 +38,8 @@ INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyt INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'HTP Expression Dataset Sample Note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; +INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_sample_note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; @@ -50,7 +50,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_note_type' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Summary' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_summary' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' ) ) @@ -65,7 +65,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_sample_note_type' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'HTP Expression Dataset Sample Note' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_sample_note' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' ) ) From e600f5527e47a47c0a4d8b1c04b9908a0f8936ba Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:37:00 -0500 Subject: [PATCH 078/342] Changed the version of the migration file --- ...dataset.sql => v0.36.0.5__highthroughputexpressiondataset.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.36.0.4__highthroughputexpressiondataset.sql => v0.36.0.5__highthroughputexpressiondataset.sql} (100%) diff --git a/src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.4__highthroughputexpressiondataset.sql rename to src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql From 1086337878847fced39c208ff759c940fe96ece0 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 16 Jul 2024 08:46:05 -0500 Subject: [PATCH 079/342] Changed the naming convention of vocabulary terms --- .../v0.36.0.5__highthroughputexpressiondataset.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql index a2fd4fef3..5ba060867 100644 --- a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql @@ -35,13 +35,13 @@ SELECT id, 'HTPDATASET', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression --Adding vocabulary terms INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional genomics and proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional_genomics_and_proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_sample_note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) @@ -56,7 +56,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ) SELECT t1.id, t2.id FROM t1,t2; -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id, vocabularytermsetdescription) +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Sample Note Type', 'htp_expression_dataset_sample_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) From a3a266a6ec862e99d7fa443de476063aab64bf90 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 26 Jul 2024 14:10:56 -0500 Subject: [PATCH 080/342] New model changes according to LinkMl --- .../entities/ExternalDataBaseEntity.java | 67 +++++++++++++++++++ ...ThroughputExpressionDatasetAnnotation.java | 15 +++++ ....0.6__highthroughputexpressiondataset.sql} | 0 3 files changed, 82 insertions(+) create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java rename src/main/resources/db/migration/{v0.36.0.5__highthroughputexpressiondataset.sql => v0.36.0.6__highthroughputexpressiondataset.sql} (100%) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java new file mode 100644 index 000000000..063932efd --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java @@ -0,0 +1,67 @@ +package org.alliancegenome.curation_api.model.entities; + +import java.util.List; + +import org.alliancegenome.curation_api.model.entities.base.CurieObject; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; +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.Indexed; +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; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.ElementCollection; +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.OneToOne; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Indexed +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "ExternalDataBaseEntity", description = "POJO that represents the ExternalDataBaseEntity") +public class ExternalDataBaseEntity extends CurieObject{ + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "secondaryIdentifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView(View.FieldsAndLists.class) + @Column(columnDefinition = "TEXT") + @JoinTable(indexes = @Index(name = "externaldatabaseentity_secondaryIdentifiers_externaldatabaseentity_index", columnList = "externaldatabaseentity_id")) + private List secondaryIdentifiers; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private CrossReference preferredCrossReference; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @OnDelete(action = OnDeleteAction.CASCADE) + @JoinTable(indexes = { + @Index(columnList = "externaldatabaseentity_id", name = "externaldatabaseentity_crossreference_externaldatabaseentity_index"), + @Index(columnList = "crossreferences_id", name = "externaldatabaseentity_crossreference_crossreferences_index") + }) + @JsonView({ View.FieldsAndLists.class }) + private List crossReferences; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index 9e3431fb3..c62508033 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -39,6 +39,21 @@ @Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private ExternalDataBaseEntity htpExpressionDataset; + + @IndexedEmbedded(includePaths = {"secondaryIdentifiers", "preferredCrossReference", "crossReferences"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @Fetch(FetchMode.JOIN) + @JoinTable(indexes = { + @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_reference_references_index", columnList = "references_id") + }) + @JsonView({ View.FieldsAndLists.class }) + private List subSeries; + @JsonView({ View.FieldsOnly.class }) @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") diff --git a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql rename to src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql From a515e571d04bf6d8085d9fbe842bfec567409f76 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 26 Jul 2024 14:37:51 -0500 Subject: [PATCH 081/342] Model changes --- .../curation_api/model/entities/ExternalDataBaseEntity.java | 2 +- .../entities/HighThroughputExpressionDatasetAnnotation.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java index 063932efd..32aadf624 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java @@ -37,7 +37,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "ExternalDataBaseEntity", description = "POJO that represents the ExternalDataBaseEntity") -public class ExternalDataBaseEntity extends CurieObject{ +public class ExternalDataBaseEntity extends CurieObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "secondaryIdentifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java index c62508033..a363d96ec 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java @@ -43,13 +43,13 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @JsonView({ View.FieldsOnly.class }) private ExternalDataBaseEntity htpExpressionDataset; - @IndexedEmbedded(includePaths = {"secondaryIdentifiers", "preferredCrossReference", "crossReferences"}) + @IndexedEmbedded(includeDepth = 1) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.JOIN) @JoinTable(indexes = { - @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), - @Index(name = "htpdatasetannotation_reference_references_index", columnList = "references_id") + @Index(name = "htpdatasetannotation_externaldatabaseentity_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_externaldatabaseentity_subseries_index", columnList = "subseries_id") }) @JsonView({ View.FieldsAndLists.class }) private List subSeries; From c49e1f74fa6bf71b6a34f7ae06e219c13ee14959 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 26 Jul 2024 14:42:59 -0500 Subject: [PATCH 082/342] removed old migration file --- ...6.0.5__highthroughputexpressiondataset.sql | 139 ------------------ 1 file changed, 139 deletions(-) delete mode 100644 src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql diff --git a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql deleted file mode 100644 index 5ba060867..000000000 --- a/src/main/resources/db/migration/v0.36.0.5__highthroughputexpressiondataset.sql +++ /dev/null @@ -1,139 +0,0 @@ --- To create bulk loads - -INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Annotation Bulk Loads'); - -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'FB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'ZFIN HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'MGI HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'RGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'SGD HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) -SELECT nextval('bulkload_seq'), 'HTPDATASET', 'WB HTP Expression Dataset Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; - -INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) -SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTPDATASET'; - -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Annotation Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Annotation Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Annotation Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Annotation Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Annotation Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) -SELECT id, 'HTPDATASET', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Annotation Load'; - - ---Adding vocabulary terms - -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'epigenome', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'functional_genomics_and_proteomics', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'karyotyping', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; - -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_summary', 'Summary of the high-throughput expression dataset' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; -INSERT INTO vocabularyterm (id, name, definition, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'htp_expression_dataset_sample_note', 'Note pertaining to a high-throughput expression dataset sample' ,id FROM vocabulary WHERE vocabularylabel = 'note_type'; - -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) - SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Note Type', 'htp_expression_dataset_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; - -INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) - WITH - t1 AS ( - SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_note_type' - ), - t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_summary' AND vocabulary_id = ( - SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' - ) - ) - SELECT t1.id, t2.id FROM t1,t2; - -INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) - SELECT nextval('vocabularytermset_seq'), 'HTP Expression Dataset Sample Note Type', 'htp_expression_dataset_sample_note_type', id FROM vocabulary WHERE vocabularylabel = 'note_type'; - -INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) - WITH - t1 AS ( - SELECT id FROM vocabularytermset WHERE vocabularylabel = 'htp_expression_dataset_sample_note_type' - ), - t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'htp_expression_dataset_sample_note' AND vocabulary_id = ( - SELECT id FROM vocabulary WHERE vocabularylabel = 'note_type' - ) - ) - SELECT t1.id, t2.id FROM t1,t2; - --- Adding highthroughputexpressiondatasetannotation - -CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; - -CREATE TABLE highthroughputexpressiondatasetannotation ( - 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, - curie character varying(255), - modentityid character varying(255), - modinternalid character varying(255), - name character varying(255), - numberofchannels integer, - relatednote_id bigint, - createdby_id bigint, - updatedby_id bigint, - dataprovider_id bigint -); - -CREATE TABLE highthroughputexpressiondatasetannotation_categorytags ( - highthroughputexpressiondatasetannotation_id bigint NOT NULL, - categorytags_id bigint NOT NULL - ); - -CREATE TABLE highthroughputexpressiondatasetannotation_reference ( - highthroughputexpressiondatasetannotation_id bigint NOT NULL, - references_id bigint NOT NULL - ); - -ALTER TABLE highthroughputexpressiondatasetannotation ADD CONSTRAINT highthroughputexpressiondatasetannotation_pkey PRIMARY KEY (id); - -CREATE INDEX htpdatasetannotation_reference_htpdataset_index ON highthroughputexpressiondatasetannotation_reference USING btree (highthroughputexpressiondatasetannotation_id); - -CREATE INDEX htpdatasetannotation_reference_references_index ON highthroughputexpressiondatasetannotation_reference USING btree (references_id); - -CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (categorytags_id); - -CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); - -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT highthroughputexpressiondatasetannotation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note (id); - -ALTER TABLE highthroughputexpressiondatasetannotation_categorytags - ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); - -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT highthroughputexpressiondatasetannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); - -ALTER TABLE highthroughputexpressiondatasetannotation_categorytags - ADD CONSTRAINT htpdatasetannotation_categorytags_categorytags_id_fk FOREIGN KEY (categorytags_id) REFERENCES vocabularyterm(id); - -ALTER TABLE highthroughputexpressiondatasetannotation_reference - ADD CONSTRAINT htpdatasetannotation_reference_htpdatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); - -ALTER TABLE highthroughputexpressiondatasetannotation_reference - ADD CONSTRAINT htpdatasetannotation_reference_references_id_fk FOREIGN KEY (references_id) REFERENCES reference(id); - -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT htpdatasetannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); - -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT htpdatasetannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); \ No newline at end of file From c317d4d3acb8c122f63228819da760cdff395b0c Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 29 Jul 2024 07:46:12 -0500 Subject: [PATCH 083/342] SCRUM-4299 add create createSequenceTargetingReagent method --- ...agentGeneAssociationBulkUploadFmsITCase.java | 5 ++--- .../curation_api/base/BaseITCase.java | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index 5c9bd1bf7..a175069fa 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -11,7 +11,6 @@ import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Order; @@ -23,7 +22,6 @@ import io.quarkus.test.junit.QuarkusIntegrationTest; import io.restassured.RestAssured; -@Disabled @QuarkusIntegrationTest @QuarkusTestResource(TestContainerResource.Initializer.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @@ -51,7 +49,8 @@ private void loadRequiredEntities() throws Exception { Vocabulary noteTypeVocab = getVocabulary("construct_relation"); relation = getVocabularyTerm(noteTypeVocab, relationName); gene = getGene(geneCurie); - sqtr = getSequenceTargetingReagent(sqtrId); + // sqtr = getSequenceTargetingReagent(sqtrId); + sqtr = createSequenceTargetingReagent(sqtrModEntityId, false, "TALEN-inhbaa"); } @Test diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index b32949a87..459378667 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -772,6 +772,23 @@ public SequenceTargetingReagent getSequenceTargetingReagent(String identifier) { return res.getEntity(); } + public SequenceTargetingReagent createSequenceTargetingReagent(String modEntityId, Boolean obsolete, String name) { + SequenceTargetingReagent sqtr = new SequenceTargetingReagent(); + sqtr.setModEntityId(modEntityId); + sqtr.setObsolete(obsolete); + sqtr.setName(name); + + ObjectResponse response = given(). + contentType("application/json"). + body(sqtr). + when(). + post("/api/sqtr"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefSequenceTargetingReagent()); + return response.getEntity(); + } + public GeneDiseaseAnnotation getGeneDiseaseAnnotation(String uniqueId) { ObjectResponse res = RestAssured.given(). when(). From ee9f309e91b055e9ca16ee8607244740a89e89ad Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 29 Jul 2024 08:05:19 -0500 Subject: [PATCH 084/342] SCRUM-4299 add a get by identifier string method --- .../crud/SequenceTargetingReagentCrudController.java | 6 ++++++ .../crud/SequenceTargetingReagentCrudInterface.java | 11 ++++++++--- .../services/SequenceTargetingReagentService.java | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java index 61afd749a..95185fef8 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java @@ -7,6 +7,7 @@ import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.SequenceTargetingReagentService; import jakarta.annotation.PostConstruct; @@ -32,5 +33,10 @@ protected void init() { public APIResponse updateSequenceTargetingReagent(String dataProvider, SequenceTargetingReagentIngestFmsDTO sqtrFmsDTO) { return sqtrExecutor.runLoadApi(dataProvider, sqtrFmsDTO.getData()); } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return sqtrService.getByIdentifier(identifierString); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java index da513eca4..5012ca283 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java @@ -50,9 +50,14 @@ public interface SequenceTargetingReagentCrudInterface extends BaseIdCrudInterfa SearchResponse search(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); - @Override + // @Override + // @GET + // @Path("/{id}") + // @JsonView(View.SequenceTargetingReagentDetailView.class) + // ObjectResponse getById(@PathParam("id") Long id); + @GET - @Path("/{id}") + @Path("/{identifierString}") @JsonView(View.SequenceTargetingReagentDetailView.class) - ObjectResponse getById(@PathParam("id") Long id); + ObjectResponse getByIdentifier(@PathParam("identifierString") String identifierString); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index 14d3fa63b..ef8d7633d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -12,6 +12,7 @@ import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.dto.fms.SequenceTargetingReagentFmsDTOValidator; @@ -45,4 +46,10 @@ public List getIdsByDataProvider(String dataProvider) { ids.removeIf(Objects::isNull); return ids; } + + public ObjectResponse getByIdentifier(String identifier) { + SequenceTargetingReagent sqtr = findByAlternativeFields(List.of("modEntityId"), identifier); + ObjectResponse ret = new ObjectResponse<>(sqtr); + return ret; + } } From cb255495882dd6b8f3eadfc22ca68d0d4aaf7e8a Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 29 Jul 2024 08:25:14 -0500 Subject: [PATCH 085/342] SCRUM-4299 get sqtr by mod entity id --- ...nceTargetingReagentGeneAssociationBulkUploadFmsITCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index a175069fa..90386d78f 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -49,8 +49,8 @@ private void loadRequiredEntities() throws Exception { Vocabulary noteTypeVocab = getVocabulary("construct_relation"); relation = getVocabularyTerm(noteTypeVocab, relationName); gene = getGene(geneCurie); - // sqtr = getSequenceTargetingReagent(sqtrId); - sqtr = createSequenceTargetingReagent(sqtrModEntityId, false, "TALEN-inhbaa"); + sqtr = getSequenceTargetingReagent(sqtrModEntityId); + // sqtr = createSequenceTargetingReagent(sqtrModEntityId, false, "TALEN-inhbaa"); } @Test From 97954bb5aab30f091cae387dcad9f1b0f3598d26 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 29 Jul 2024 10:53:45 -0500 Subject: [PATCH 086/342] Changed the class name --- .../entities/ExternalDataBaseEntity.java | 6 +- ...va => HTPExpressionDatasetAnnotation.java} | 23 ++- ...6.0.6__highthroughputexpressiondataset.sql | 131 ++++++++++++++---- 3 files changed, 117 insertions(+), 43 deletions(-) rename src/main/java/org/alliancegenome/curation_api/model/entities/{HighThroughputExpressionDatasetAnnotation.java => HTPExpressionDatasetAnnotation.java} (78%) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java index 32aadf624..87c0b26d7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java @@ -44,7 +44,7 @@ public class ExternalDataBaseEntity extends CurieObject { @ElementCollection @JsonView(View.FieldsAndLists.class) @Column(columnDefinition = "TEXT") - @JoinTable(indexes = @Index(name = "externaldatabaseentity_secondaryIdentifiers_externaldatabaseentity_index", columnList = "externaldatabaseentity_id")) + @JoinTable(indexes = @Index(name = "externaldbentity_secondaryidentifiers_externaldbentity_index", columnList = "externaldatabaseentity_id")) private List secondaryIdentifiers; @IndexedEmbedded(includeDepth = 1) @@ -58,8 +58,8 @@ public class ExternalDataBaseEntity extends CurieObject { @ManyToMany @OnDelete(action = OnDeleteAction.CASCADE) @JoinTable(indexes = { - @Index(columnList = "externaldatabaseentity_id", name = "externaldatabaseentity_crossreference_externaldatabaseentity_index"), - @Index(columnList = "crossreferences_id", name = "externaldatabaseentity_crossreference_crossreferences_index") + @Index(columnList = "externaldatabaseentity_id", name = "externaldbentity_crossreference_externaldbentity_index"), + @Index(columnList = "crossreferences_id", name = "externaldbentity_crossreference_crossreferences_index") }) @JsonView({ View.FieldsAndLists.class }) private List crossReferences; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java similarity index 78% rename from src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java rename to src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index a363d96ec..0245fe622 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HighThroughputExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -14,31 +14,26 @@ 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.GenericField; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; 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; -import jakarta.persistence.CascadeType; -import jakarta.persistence.Entity; -import jakarta.persistence.Index; -import jakarta.persistence.JoinTable; -import jakarta.persistence.ManyToMany; -import jakarta.persistence.OneToOne; +import jakarta.persistence.*; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; - -@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) -@Schema(name = "HighThroughputExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") -public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { +@Table(name = "htpexpressiondatasetannotation") +@Schema(name = "HTPExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") +public class HTPExpressionDatasetAnnotation extends SubmittedObject { + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) private ExternalDataBaseEntity htpExpressionDataset; @@ -48,7 +43,7 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @ManyToMany @Fetch(FetchMode.JOIN) @JoinTable(indexes = { - @Index(name = "htpdatasetannotation_externaldatabaseentity_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_externaldatabaseentity_htpdataset_index", columnList = "htpexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_externaldatabaseentity_subseries_index", columnList = "subseries_id") }) @JsonView({ View.FieldsAndLists.class }) @@ -64,7 +59,7 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @ManyToMany @Fetch(FetchMode.JOIN) @JoinTable(indexes = { - @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "highthroughputexpressiondatasetannotation_id"), + @Index(name = "htpdatasetannotation_reference_htpdataset_index", columnList = "htpexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_reference_references_index", columnList = "references_id") }) @JsonView({ View.FieldsAndLists.class }) @@ -84,7 +79,7 @@ public class HighThroughputExpressionDatasetAnnotation extends SubmittedObject { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JsonView({ View.FieldsAndLists.class }) - @JoinTable(name = "highthroughputexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "highthroughputexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) + @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "htpexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) List categoryTags; } diff --git a/src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql b/src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql index 5ba060867..37edab450 100644 --- a/src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql +++ b/src/main/resources/db/migration/v0.36.0.6__highthroughputexpressiondataset.sql @@ -71,11 +71,12 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ) SELECT t1.id, t2.id FROM t1,t2; --- Adding highthroughputexpressiondatasetannotation +-- Adding htpexpressiondatasetannotation -CREATE SEQUENCE highthroughputexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; +CREATE SEQUENCE htpexpressiondatasetannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; +CREATE SEQUENCE externaldatabaseentity_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; -CREATE TABLE highthroughputexpressiondatasetannotation ( +CREATE TABLE htpexpressiondatasetannotation ( id bigint NOT NULL, datecreated timestamp(6) with time zone, dateupdated timestamp(6) with time zone, @@ -91,49 +92,127 @@ CREATE TABLE highthroughputexpressiondatasetannotation ( relatednote_id bigint, createdby_id bigint, updatedby_id bigint, - dataprovider_id bigint + dataprovider_id bigint, + htpexpressiondataset_id bigint ); -CREATE TABLE highthroughputexpressiondatasetannotation_categorytags ( - highthroughputexpressiondatasetannotation_id bigint NOT NULL, +CREATE TABLE externaldatabaseentity ( + 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, + curie character varying(255), + createdby_id bigint, + updatedby_id bigint, + preferredcrossreference_id bigint +); + +CREATE TABLE externaldatabaseentity_crossreference ( + externaldatabaseentity_id bigint NOT NULL, + crossreferences_id bigint NOT NULL +); + +CREATE TABLE externaldatabaseentity_secondaryidentifiers ( + externaldatabaseentity_id bigint NOT NULL, + secondaryidentifiers text +); + +CREATE TABLE htpexpressiondatasetannotation_externaldatabaseentity ( + htpexpressiondatasetannotation_id bigint NOT NULL, + subseries_id bigint NOT NULL +); + +CREATE TABLE htpexpressiondatasetannotation_categorytags ( + htpexpressiondatasetannotation_id bigint NOT NULL, categorytags_id bigint NOT NULL ); -CREATE TABLE highthroughputexpressiondatasetannotation_reference ( - highthroughputexpressiondatasetannotation_id bigint NOT NULL, +CREATE TABLE htpexpressiondatasetannotation_reference ( + htpexpressiondatasetannotation_id bigint NOT NULL, references_id bigint NOT NULL ); -ALTER TABLE highthroughputexpressiondatasetannotation ADD CONSTRAINT highthroughputexpressiondatasetannotation_pkey PRIMARY KEY (id); +ALTER TABLE htpexpressiondatasetannotation ADD CONSTRAINT htpexpressiondatasetannotation_pkey PRIMARY KEY (id); -CREATE INDEX htpdatasetannotation_reference_htpdataset_index ON highthroughputexpressiondatasetannotation_reference USING btree (highthroughputexpressiondatasetannotation_id); +ALTER TABLE externaldatabaseentity ADD CONSTRAINT externaldatabaseentity_pkey PRIMARY KEY (id); -CREATE INDEX htpdatasetannotation_reference_references_index ON highthroughputexpressiondatasetannotation_reference USING btree (references_id); +CREATE INDEX htpdatasetannotation_reference_htpdataset_index ON htpexpressiondatasetannotation_reference USING btree (htpexpressiondatasetannotation_id); -CREATE INDEX htpdatasetannotation_categorytags_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (categorytags_id); +CREATE INDEX htpdatasetannotation_reference_references_index ON htpexpressiondatasetannotation_reference USING btree (references_id); -CREATE INDEX htpdatasetannotation_htpdatasetid_index ON highthroughputexpressiondatasetannotation_categorytags USING btree (highthroughputexpressiondatasetannotation_id); +CREATE INDEX htpdatasetannotation_categorytags_index ON htpexpressiondatasetannotation_categorytags USING btree (categorytags_id); -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT highthroughputexpressiondatasetannotation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note (id); +CREATE INDEX htpdatasetannotation_htpdatasetid_index ON htpexpressiondatasetannotation_categorytags USING btree (htpexpressiondatasetannotation_id); -ALTER TABLE highthroughputexpressiondatasetannotation_categorytags - ADD CONSTRAINT highthroughputexpressiondatasetannotation_categorytags_highthroughputexpressiondatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); +CREATE INDEX externaldbentity_crossreference_crossreferences_index ON externaldatabaseentity_crossreference USING btree (crossreferences_id); -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT highthroughputexpressiondatasetannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +CREATE INDEX externaldbentity_crossreference_externaldbentity_index ON externaldatabaseentity_crossreference USING btree (externaldatabaseentity_id); -ALTER TABLE highthroughputexpressiondatasetannotation_categorytags +CREATE INDEX externaldbentity_secondaryidentifiers_externaldbentity_index ON externaldatabaseentity_secondaryidentifiers USING btree (externaldatabaseentity_id); + +CREATE INDEX htpdatasetannotation_externaldatabaseentity_htpdataset_index ON htpexpressiondatasetannotation_externaldatabaseentity USING btree (htpexpressiondatasetannotation_id); + +CREATE INDEX htpdatasetannotation_externaldatabaseentity_subseries_index ON htpexpressiondatasetannotation_externaldatabaseentity USING btree (subseries_id); + +ALTER TABLE htpexpressiondatasetannotation_externaldatabaseentity + ADD CONSTRAINT htpdatasetannotation_externaldbentity_subseries_id_fk FOREIGN KEY (subseries_id) REFERENCES externaldatabaseentity(id); + +ALTER TABLE externaldatabaseentity_secondaryidentifiers + ADD CONSTRAINT externaldbentity_secondaryidentifiers_externaldbentity_id_fk FOREIGN KEY (externaldatabaseentity_id) REFERENCES externaldatabaseentity(id); + +ALTER TABLE externaldatabaseentity_crossreference + ADD CONSTRAINT externaldbentity_crossreference_externaldbentity_id_fk FOREIGN KEY (externaldatabaseentity_id) REFERENCES externaldatabaseentity(id) ON DELETE CASCADE; + +ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpexpressiondatasetannotation_htpexpressiondataset_id_fk FOREIGN KEY (htpexpressiondataset_id) REFERENCES externaldatabaseentity(id); + +ALTER TABLE externaldatabaseentity + ADD CONSTRAINT externaldatabaseentity_preferredcrossreference_id FOREIGN KEY (preferredcrossreference_id) REFERENCES crossreference(id); + +ALTER TABLE externaldatabaseentity + ADD CONSTRAINT externaldatabaseentity_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetannotation_externaldatabaseentity + ADD CONSTRAINT htpannotation_externaldbentity_htpannotation_id_fk FOREIGN KEY (htpexpressiondatasetannotation_id) REFERENCES htpexpressiondatasetannotation(id); + +ALTER TABLE externaldatabaseentity_crossreference + ADD CONSTRAINT externaldatabaseentity_crossreference_crossreferences_id_fk FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +ALTER TABLE externaldatabaseentity + ADD CONSTRAINT externaldatabaseentity_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpexpressiondatasetannotation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note (id); + +ALTER TABLE htpexpressiondatasetannotation_categorytags + ADD CONSTRAINT htpdatasetannotation_categorytags_htpdatasetannotation_id_fk FOREIGN KEY (htpexpressiondatasetannotation_id) REFERENCES htpexpressiondatasetannotation(id); + +ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpexpressiondatasetannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); + +ALTER TABLE htpexpressiondatasetannotation_categorytags ADD CONSTRAINT htpdatasetannotation_categorytags_categorytags_id_fk FOREIGN KEY (categorytags_id) REFERENCES vocabularyterm(id); -ALTER TABLE highthroughputexpressiondatasetannotation_reference - ADD CONSTRAINT htpdatasetannotation_reference_htpdatasetannotation_id_fk FOREIGN KEY (highthroughputexpressiondatasetannotation_id) REFERENCES highthroughputexpressiondatasetannotation(id); +ALTER TABLE htpexpressiondatasetannotation_reference + ADD CONSTRAINT htpdatasetannotation_reference_htpdatasetannotation_id_fk FOREIGN KEY (htpexpressiondatasetannotation_id) REFERENCES htpexpressiondatasetannotation(id); -ALTER TABLE highthroughputexpressiondatasetannotation_reference +ALTER TABLE htpexpressiondatasetannotation_reference ADD CONSTRAINT htpdatasetannotation_reference_references_id_fk FOREIGN KEY (references_id) REFERENCES reference(id); -ALTER TABLE highthroughputexpressiondatasetannotation +ALTER TABLE htpexpressiondatasetannotation ADD CONSTRAINT htpdatasetannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE highthroughputexpressiondatasetannotation - ADD CONSTRAINT htpdatasetannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); \ No newline at end of file +ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpdatasetannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpdatasetexpressionannotation_htpdataset_id_uk UNIQUE (htpexpressiondataset_id); + +ALTER TABLE externaldatabaseentity + ADD CONSTRAINT externaldatabaseentity_preferredcrossreference_id_uk UNIQUE (preferredcrossreference_id); + + ALTER TABLE htpexpressiondatasetannotation + ADD CONSTRAINT htpexpressiondatasetannotation_relatednote_id_uk UNIQUE (relatednote_id); \ No newline at end of file From e12e218d1ccb7064d6d7b147b351f9c0d6af544d Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 29 Jul 2024 08:39:50 -0500 Subject: [PATCH 087/342] SCRUM-4299 update stack to inherit getByIdentifier --- .../crud/SequenceTargetingReagentCrudController.java | 5 +++-- .../crud/SequenceTargetingReagentCrudInterface.java | 12 +++--------- .../services/SequenceTargetingReagentService.java | 11 ++--------- ...ingReagentGeneAssociationBulkUploadFmsITCase.java | 4 +--- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java index 95185fef8..c4c10e03a 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/SequenceTargetingReagentCrudController.java @@ -1,10 +1,11 @@ package org.alliancegenome.curation_api.controllers.crud; -import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; +import org.alliancegenome.curation_api.controllers.base.SubmittedObjectCrudController; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.interfaces.crud.SequenceTargetingReagentCrudInterface; import org.alliancegenome.curation_api.jobs.executors.SequenceTargetingReagentExecutor; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -15,7 +16,7 @@ import jakarta.inject.Inject; @RequestScoped -public class SequenceTargetingReagentCrudController extends BaseEntityCrudController implements SequenceTargetingReagentCrudInterface { +public class SequenceTargetingReagentCrudController extends SubmittedObjectCrudController implements SequenceTargetingReagentCrudInterface { @Inject SequenceTargetingReagentService sqtrService; diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java index 5012ca283..bea40b284 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/SequenceTargetingReagentCrudInterface.java @@ -2,7 +2,7 @@ import java.util.HashMap; -import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -28,7 +28,7 @@ @Tag(name = "CRUD - SQTR") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public interface SequenceTargetingReagentCrudInterface extends BaseIdCrudInterface { +public interface SequenceTargetingReagentCrudInterface extends BaseSubmittedObjectCrudInterface { @POST @Path("/bulk/{dataProvider}/sqtrfile") @@ -49,13 +49,7 @@ public interface SequenceTargetingReagentCrudInterface extends BaseIdCrudInterfa @JsonView({ View.SequenceTargetingReagentView.class }) SearchResponse search(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); - - // @Override - // @GET - // @Path("/{id}") - // @JsonView(View.SequenceTargetingReagentDetailView.class) - // ObjectResponse getById(@PathParam("id") Long id); - + @Override @GET @Path("/{identifierString}") @JsonView(View.SequenceTargetingReagentDetailView.class) diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index ef8d7633d..90b417b9f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -12,8 +12,7 @@ import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; -import org.alliancegenome.curation_api.response.ObjectResponse; -import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; import org.alliancegenome.curation_api.services.validation.dto.fms.SequenceTargetingReagentFmsDTOValidator; import jakarta.annotation.PostConstruct; @@ -22,7 +21,7 @@ import jakarta.transaction.Transactional; @RequestScoped -public class SequenceTargetingReagentService extends BaseEntityCrudService implements BaseUpsertServiceInterface { +public class SequenceTargetingReagentService extends SubmittedObjectCrudService implements BaseUpsertServiceInterface { @Inject SequenceTargetingReagentFmsDTOValidator sqtrDtoValidator; @Inject SequenceTargetingReagentDAO sqtrDAO; @@ -46,10 +45,4 @@ public List getIdsByDataProvider(String dataProvider) { ids.removeIf(Objects::isNull); return ids; } - - public ObjectResponse getByIdentifier(String identifier) { - SequenceTargetingReagent sqtr = findByAlternativeFields(List.of("modEntityId"), identifier); - ObjectResponse ret = new ObjectResponse<>(sqtr); - return ret; - } } diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index 90386d78f..91bf27444 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -35,7 +35,6 @@ public class SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase extends private VocabularyTerm relation; private String relationName = "targets"; private String geneCurie = "GENETEST:Gene0001"; - private String sqtrId = "83"; private String sqtrModEntityId = "ZFIN:ZDB-TALEN-180503-1"; private final String sqtrGeneAssociationGetEndpoint = "/api/sqtrgeneassociation/findBy"; @@ -50,7 +49,6 @@ private void loadRequiredEntities() throws Exception { relation = getVocabularyTerm(noteTypeVocab, relationName); gene = getGene(geneCurie); sqtr = getSequenceTargetingReagent(sqtrModEntityId); - // sqtr = createSequenceTargetingReagent(sqtrModEntityId, false, "TALEN-inhbaa"); } @Test @@ -71,7 +69,7 @@ public void sqtrGeneAssociationBulkUploadCheckFields() throws Exception { RestAssured.given(). when(). - get(sqtrGetEndpoint + sqtrId). + get(sqtrGetEndpoint + sqtrModEntityId). then(). statusCode(200). body("entity.sequenceTargetingReagentGeneAssociations", hasSize(1)). From 6d39216fe2db330a2035dc07d7332534d71d287e Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 29 Jul 2024 16:22:39 -0500 Subject: [PATCH 088/342] Added linkml version --- .../curation_api/model/entities/GeneToGeneParalogy.java | 2 +- .../model/entities/HTPExpressionDatasetAnnotation.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneToGeneParalogy.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneToGeneParalogy.java index d31d173f7..7499d68d1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneToGeneParalogy.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneToGeneParalogy.java @@ -22,7 +22,7 @@ @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Schema(name = "GeneToGeneParalogy", description = "POJO that represents paralogy between two genes") -@AGRCurationSchemaVersion(min = "1.7.4", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@AGRCurationSchemaVersion(min = "2.3.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table(indexes = { @Index(name = "genetogeneparalogy_createdby_index", columnList = "createdBy_id"), @Index(name = "genetogeneparalogy_updatedby_index", columnList = "updatedBy_id"), diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index 0245fe622..8bc88cd45 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -2,6 +2,9 @@ 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.base.AuditedObject; import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -30,6 +33,7 @@ @ToString(callSuper = true) @Table(name = "htpexpressiondatasetannotation") @Schema(name = "HTPExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") +@AGRCurationSchemaVersion(min = "2.6.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SubmittedObject.class }) public class HTPExpressionDatasetAnnotation extends SubmittedObject { @IndexedEmbedded(includeDepth = 1) From b8827f23bcfa3270458898dbfef34f3dde5d2ef4 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 29 Jul 2024 16:24:45 -0500 Subject: [PATCH 089/342] Removed unused import --- .../model/entities/HTPExpressionDatasetAnnotation.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index 8bc88cd45..ca9d7a342 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -4,7 +4,6 @@ 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.base.SubmittedObject; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; From df8eaa2ca7461efb9162b66e84b5acdc92417255 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 26 Jul 2024 14:50:46 +0100 Subject: [PATCH 090/342] SCRUM-3952: add ExpressionPattern, TemporalContext and AnatomicalSite --- .../constants/VocabularyConstants.java | 3 + .../model/entities/AnatomicalSite.java | 116 +++++++++ .../model/entities/ExpressionAnnotation.java | 8 +- .../model/entities/ExpressionPattern.java | 38 +++ .../model/entities/TemporalContext.java | 78 ++++++ ...neExpressionAnnotationFmsDTOValidator.java | 236 ++++++++++++++--- .../v0.36.0.6__expression_pattern.sql | 240 ++++++++++++++++++ .../ExpressionBulkUploadFmsITCase.java | 53 +++- .../curation_api/base/BaseITCase.java | 100 ++++---- .../fms/07_expression/AF_01_all_fields.json | 18 +- .../IV_05_invalid_stageterm.json | 43 ++++ .../IV_06_invalid_anatomical_structure.json | 43 ++++ ...IV_07_invalid_anatomical_substructure.json | 43 ++++ .../IV_08_invalid_cellularcomponent.json | 43 ++++ ..._invalid_anatomicalstructurequalifier.json | 43 ++++ ...valid_anatomicalsubstructurequalifier.json | 43 ++++ ...11_invalid_cellularcomponentqualifier.json | 43 ++++ ...id_anatomicalstructureuberonslimterms.json | 43 ++++ ...anatomicalsubstructureuberonslimterms.json | 43 ++++ ...R_09_norCellComponentNORanatStructure.json | 40 +++ 20 files changed, 1228 insertions(+), 89 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java create mode 100644 src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql create mode 100644 src/test/resources/bulk/fms/07_expression/IV_05_invalid_stageterm.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_06_invalid_anatomical_structure.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_07_invalid_anatomical_substructure.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_08_invalid_cellularcomponent.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_09_invalid_anatomicalstructurequalifier.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_10_invalid_anatomicalsubstructurequalifier.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_11_invalid_cellularcomponentqualifier.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_12_invalid_anatomicalstructureuberonslimterms.json create mode 100644 src/test/resources/bulk/fms/07_expression/IV_13_invalid_anatomicalsubstructureuberonslimterms.json create mode 100644 src/test/resources/bulk/fms/07_expression/MR_09_norCellComponentNORanatStructure.json 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 11b293783..23d8b7618 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -69,5 +69,8 @@ private VocabularyConstants() { public static final String GENE_EXPRESSION_VOCABULARY = "gene_expression"; public static final String GENE_EXPRESSION_RELATION_TERM = "is_expressed_in"; + public static final String STAGE_UBERON_SLIM_TERMS = "stage_uberon_slim_terms"; + public static final String ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS = "anatomical_structure_uberon_slim_terms"; + public static final String CELLULAR_COMPONENT_QUALIFIERS = "cellular_component_qualifiers"; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java new file mode 100644 index 000000000..46f1dfbf6 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -0,0 +1,116 @@ +package org.alliancegenome.curation_api.model.entities; + +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.AuditedObject; +import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; +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 java.util.List; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE) +@Schema(name = "Anatomical_Site", description = "Anatomical part of an expression pattern") +@Table(indexes = { + @Index(name = "anatomicalsite_anatomicalstructure_index ", columnList = "anatomicalstructure_id"), + @Index(name = "anatomicalsite_anatomicalsubstructure_index", columnList = "anatomicalsubstructure_id"), + @Index(name = "anatomicalsite_cellularcomponentterm_index", columnList = "cellularcomponentterm_id")} +) +public class AnatomicalSite extends AuditedObject { + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private AnatomicalTerm anatomicalStructure; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private AnatomicalTerm anatomicalSubstructure; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private GOTerm cellularComponentTerm; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "anatomicalstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "anatomicalsite_anatomicalstructurequalifiers", + indexes = { + @Index(name = "anatomicalstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), + @Index(name = "anatomicalstructurequalifiers_structurequalifiers_index", columnList = "anatomicalstructurequalifiers_id")} + ) + private List anatomicalStructureQualifiers; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "anatomicalsubstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "anatomicalsite_anatomicalsubstructurequalifiers", + indexes = { + @Index(name = "anatomicalsubstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), + @Index(name = "anatomicalsubstructurequalifiers_anatomicalsubstructurequalifiers_index", columnList = "anatomicalsubstructurequalifiers_id")} + ) + private List anatomicalSubstructureQualifiers; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "cellularcomponentqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "anatomicalsite_cellularcomponentqualifiers", + indexes = { + @Index(name = "cellularcomponentqualifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), + @Index(name = "cellularcomponentqualifiers_cellularcomponentqualifiers_index", columnList = "cellularcomponentqualifiers_id")} + ) + private List cellularComponentQualifiers; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "anatomicalstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "anatomicalsite_anatomicalstructureuberonterms", + indexes = { + @Index(name = "anatomicalstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"), + @Index(name = "anatomicalstructureuberonterms_anatomicalstructureuberonterms_index", columnList = "anatomicalstructureuberonterms_id")} + ) + private List anatomicalStructureUberonTerms; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "anatomicalsubstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "anatomicalsite_anatomicalsubstructureuberonterms", + indexes = { + @Index(name = "anatomicalsubstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"), + @Index(name = "anatomicalsubstructureuberonterms_anatomicalstructureuberonterms_index", columnList = "anatomicalsubstructureuberonterms_id")} + ) + private List anatomicalSubstructureUberonTerms; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java index cec8c128b..321d1fdc7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java @@ -30,7 +30,8 @@ @Schema(name = "Expression_Annotation", description = "Annotation class representing an expression annotation") @Table(indexes = { @Index(name = "expressionannotation_whenexpressedstagename_index ", columnList = "whenexpressedstagename"), - @Index(name = "expressionannotation_whereexpressedstatement_index", columnList = "whereexpressedstatement") + @Index(name = "expressionannotation_whereexpressedstatement_index", columnList = "whereexpressedstatement"), + @Index(name = "expressionannotation_expressionpattern_index", columnList = "expressionpattern_id") }) public abstract class ExpressionAnnotation extends Annotation { @@ -50,6 +51,11 @@ public abstract class ExpressionAnnotation extends Annotation { @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) private String whereExpressedStatement; + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JoinColumn(name = "expressionpattern_id", referencedColumnName = "id") + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private ExpressionPattern expressionPattern; + @Transient @JsonIgnore public String getDataProviderString() { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java new file mode 100644 index 000000000..ea77eac8b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java @@ -0,0 +1,38 @@ +package org.alliancegenome.curation_api.model.entities; + +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.AuditedObject; +import org.alliancegenome.curation_api.view.View; +import org.eclipse.microprofile.openapi.annotations.media.Schema; +import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE) +@Schema(name = "Expression_Pattern", description = "Annotation class representing an expression pattern") + +@Table(indexes = { + @Index(name = "expressionpattern_whenexpressed_index", columnList = "whenexpressed_id"), + @Index(name = "expressionpattern_whereexpressed_index", columnList = "whereexpressed_id") +}) +public class ExpressionPattern extends AuditedObject { + + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private TemporalContext whenExpressed; + + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private AnatomicalSite whereExpressed; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java new file mode 100644 index 000000000..f59dd7ca4 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java @@ -0,0 +1,78 @@ +package org.alliancegenome.curation_api.model.entities; + +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.AuditedObject; +import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; +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 java.util.List; + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE) +@Schema(name = "Temporal_Context", description = "Temporal expression pattern") +@Table(indexes = { + @Index(name = "temporalcontext_developmentalstagestart_index ", columnList = "developmentalstagestart_id"), + @Index(name = "temporalcontext_developmentalstagestop_index ", columnList = "developmentalstagestop_id"), + @Index(name = "temporalcontext_age_index ", columnList = "age") +}) +public class TemporalContext extends AuditedObject { + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private StageTerm developmentalStageStart; + + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private StageTerm developmentalStageStop; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "age_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + private String age; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "temporalqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "temporalcontext_temporalqualifiers", + indexes = { + @Index(name = "temporalqualifiers_temporalcontext_index", columnList = "temporalcontext_id"), + @Index(name = "temporalqualifiers_temporalqualifiers_index", columnList = "temporalqualifiers_id")} + ) + private List temporalQualifiers; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "stageuberonslimterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @ElementCollection + @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JoinTable( + name = "temporalcontext_stageuberonslimterms", + indexes = { + @Index(name = "stageuberonslimterms_temporalcontext_index", columnList = "temporalcontext_id"), + @Index(name = "stageuberonslimterms_uberonterms_index", columnList = "stageuberonslimterms_id")} + ) + private List stageUberonSlimTerms; +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 8bda1f807..11289121f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -8,41 +8,43 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; +import org.alliancegenome.curation_api.model.entities.*; +import org.alliancegenome.curation_api.model.entities.ontology.*; import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.UberonSlimTermDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; -import org.alliancegenome.curation_api.services.*; +import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.GeneService; +import org.alliancegenome.curation_api.services.ReferenceService; +import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.annotations.GeneExpressionAnnotationUniqueIdHelper; -import org.alliancegenome.curation_api.services.ontology.MmoTermService; +import org.alliancegenome.curation_api.services.ontology.*; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.ObjectUtils; -import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation; import java.time.OffsetDateTime; import java.time.format.DateTimeParseException; +import java.util.ArrayList; +import java.util.List; @RequestScoped public class GeneExpressionAnnotationFmsDTOValidator { @Inject GeneService geneService; - @Inject MmoTermService mmoTermService; - @Inject ReferenceService referenceService; - @Inject GeneExpressionAnnotationUniqueIdHelper geneExpressionAnnotationUniqueIdHelper; - @Inject GeneExpressionAnnotationDAO geneExpressionAnnotationDAO; - @Inject DataProviderService dataProviderService; - @Inject VocabularyTermService vocabularyTermService; + @Inject AnatomicalTermService anatomicalTermService; + @Inject GoTermService goTermService; + @Inject UberonTermService uberonTermService; + @Inject StageTermService stageTermService; public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpressionFmsDTO, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - ObjectResponse response = new ObjectResponse(); + ObjectResponse response = new ObjectResponse<>(); GeneExpressionAnnotation geneExpressionAnnotation; ObjectResponse singleReferenceResponse = validateEvidence(geneExpressionFmsDTO); @@ -59,6 +61,9 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr geneExpressionAnnotation = new GeneExpressionAnnotation(); geneExpressionAnnotation.setUniqueId(uniqueId); } + if (geneExpressionAnnotation.getExpressionPattern() == null) { + geneExpressionAnnotation.setExpressionPattern(new ExpressionPattern()); + } geneExpressionAnnotation.setSingleReference(singleReferenceResponse.getEntity()); } @@ -96,26 +101,24 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr } } - if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed())) { - response.addErrorMessage("whereExpressed - ", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed() + ")"); + ObjectResponse anatomicalSiteObjectResponse = validateAnatomicalSite(geneExpressionFmsDTO); + if (anatomicalSiteObjectResponse.hasErrors()) { + response.addErrorMessages("whereExpressed", anatomicalSiteObjectResponse.getErrorMessages()); + throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { - String whereExpressedStatement = geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement(); - if (ObjectUtils.isEmpty(whereExpressedStatement)) { - response.addErrorMessage("whereExpressed - whereExpressedStatement", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement() + ")"); - } else { - geneExpressionAnnotation.setWhereExpressedStatement(whereExpressedStatement); - } + geneExpressionAnnotation.setWhereExpressedStatement(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement()); + AnatomicalSite anatomicalSite = updateAnatomicalSite(anatomicalSiteObjectResponse, geneExpressionAnnotation); + geneExpressionAnnotation.getExpressionPattern().setWhereExpressed(anatomicalSite); } - if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhenExpressed())) { - response.addErrorMessage("whenExpressed - ", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhenExpressed() + ")"); + ObjectResponse temporalContextObjectResponse = validateTemporalContext(geneExpressionFmsDTO); + if (temporalContextObjectResponse.hasErrors()) { + response.addErrorMessages("whenExpressed", temporalContextObjectResponse.getErrorMessages()); + throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { - String stageName = geneExpressionFmsDTO.getWhenExpressed().getStageName(); - if (ObjectUtils.isEmpty(stageName)) { - response.addErrorMessage("whenExpressed - whenExpressedStageName", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhenExpressed().getStageName() + ")"); - } else { - geneExpressionAnnotation.setWhenExpressedStageName(stageName); - } + geneExpressionAnnotation.setWhenExpressedStageName(geneExpressionFmsDTO.getWhenExpressed().getStageName()); + TemporalContext temporalContext = updateTemporalContext(temporalContextObjectResponse, geneExpressionAnnotation); + geneExpressionAnnotation.getExpressionPattern().setWhenExpressed(temporalContext); } geneExpressionAnnotation.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); @@ -129,8 +132,153 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr return geneExpressionAnnotation; } + private ObjectResponse validateTemporalContext(GeneExpressionFmsDTO geneExpressionFmsDTO) { + ObjectResponse response = new ObjectResponse<>(); + TemporalContext temporalContext = new TemporalContext(); + if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhenExpressed())) { + response.addErrorMessage("whenExpressed - ", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhenExpressed() + ")"); + return response; + } else { + String stageName = geneExpressionFmsDTO.getWhenExpressed().getStageName(); + if (ObjectUtils.isEmpty(stageName)) { + response.addErrorMessage("whenExpressed - whenExpressedStageName", ValidationConstants.REQUIRED_MESSAGE + " (" + stageName + ")"); + } + String stageTermId = geneExpressionFmsDTO.getWhenExpressed().getStageTermId(); + if (!ObjectUtils.isEmpty(stageTermId)) { + StageTerm stageTerm = stageTermService.findByCurie(stageTermId); + if (stageTerm == null) { + response.addErrorMessage("whenExpressed - stageTermId", ValidationConstants.INVALID_MESSAGE + " (" + stageTermId + ")"); + } else { + temporalContext.setDevelopmentalStageStart(stageTerm); + } + } + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhenExpressed().getStageUberonSlimTerm())) { + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhenExpressed().getStageUberonSlimTerm().getUberonTerm())) { + String stageUberonSlimTermId = geneExpressionFmsDTO.getWhenExpressed().getStageUberonSlimTerm().getUberonTerm(); + if (!ObjectUtils.isEmpty(stageUberonSlimTermId)) { + VocabularyTerm stageUberonSlimTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS, stageUberonSlimTermId).getEntity(); + if (stageUberonSlimTerm == null) { + response.addErrorMessage("whenExpressed - stageUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + stageUberonSlimTermId + ")"); + } else { + temporalContext.setStageUberonSlimTerms(List.of(stageUberonSlimTerm)); + } + } + } + } + response.setEntity(temporalContext); + } + return response; + } + + private ObjectResponse validateAnatomicalSite(GeneExpressionFmsDTO geneExpressionFmsDTO) { + ObjectResponse response = new ObjectResponse<>(); + AnatomicalSite anatomicalSite = new AnatomicalSite(); + if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed())) { + response.addErrorMessage("whereExpressed - ", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed() + ")"); + } else { + if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement())) { + response.addErrorMessage("whereExpressed - whereExpressedStatement", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement() + ")"); + return response; + } + + boolean lackAnatomicalStructureTermId = ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureTermId()); + boolean lackStructureUberonSlimTermIds = ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureUberonSlimTermIds()); + boolean lackCellularComponentId = ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentTermId()); - private ObjectResponse validateEvidence(GeneExpressionFmsDTO geneExpressionFmsDTO) throws ObjectUpdateException { + if ((lackAnatomicalStructureTermId || lackStructureUberonSlimTermIds) && lackCellularComponentId) { + response.addErrorMessage("whereExpressed - MUST HAVe (anatomicalStructureTermId and anatomicalStructureUberonSlimTermIds) or cellularComponentTermId", ValidationConstants.REQUIRED_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed() + ")"); + } + + if (!lackAnatomicalStructureTermId) { + AnatomicalTerm anatomicalStructureTerm = anatomicalTermService.findByCurie(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureTermId()); + if (anatomicalStructureTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureTermId() + ")"); + } else { + anatomicalSite.setAnatomicalStructure(anatomicalStructureTerm); + } + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureTermId())) { + AnatomicalTerm anatomicalSubStructureTerm = anatomicalTermService.findByCurie(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureTermId()); + if (anatomicalSubStructureTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalSubStructureTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureTermId() + ")"); + } else { + anatomicalSite.setAnatomicalSubstructure(anatomicalSubStructureTerm); + } + } + + if (!lackCellularComponentId) { + GOTerm cellularComponent = goTermService.findByCurie(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentTermId()); + if (cellularComponent == null) { + response.addErrorMessage("whereExpressed - cellularComponentTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getCellularComponentTermId() + ")"); + } else { + anatomicalSite.setCellularComponentTerm(cellularComponent); + } + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId())) { + String anatomicalstructurequalifiertermId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId(); + VocabularyTerm anatomicalStructureQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS, anatomicalstructurequalifiertermId).getEntity(); + if (anatomicalStructureQualifierTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureTermId() + ")"); + } else { + anatomicalSite.setAnatomicalStructureQualifiers(List.of(anatomicalStructureQualifierTerm)); + } + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId())) { + String anatomicalsubstructurequalifierId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId(); + VocabularyTerm anatomicalSubStructureQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS, anatomicalsubstructurequalifierId).getEntity(); + if (anatomicalSubStructureQualifierTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureTermId() + ")"); + } else { + anatomicalSite.setAnatomicalSubstructureQualifiers(List.of(anatomicalSubStructureQualifierTerm)); + } + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId())) { + String cellularComponentQualifierTermId = geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId(); + VocabularyTerm cellularComponentQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS, cellularComponentQualifierTermId).getEntity(); + if (cellularComponentQualifierTerm == null) { + response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId() + ")"); + } else { + anatomicalSite.setCellularComponentQualifiers(List.of(cellularComponentQualifierTerm)); + } + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureUberonSlimTermIds())) { + List anatomicalStructureUberonSlimTermIds = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureUberonSlimTermIds(); + List uberonTerms = new ArrayList<>(); + for (UberonSlimTermDTO uberonSlimTermDTO: anatomicalStructureUberonSlimTermIds) { + UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); + if (uberonTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); + } else { + uberonTerms.add(uberonTerm); + } + } + anatomicalSite.setAnatomicalStructureUberonTerms(uberonTerms); + } + + if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureUberonSlimTermIds())) { + List anatomicalSubStructureUberonSlimTermIds = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureUberonSlimTermIds(); + List uberonTerms = new ArrayList<>(); + for (UberonSlimTermDTO uberonSlimTermDTO : anatomicalSubStructureUberonSlimTermIds) { + UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); + if (uberonTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); + } else { + uberonTerms.add(uberonTerm); + } + } + anatomicalSite.setAnatomicalSubstructureUberonTerms(uberonTerms); + } + response.setEntity(anatomicalSite); + } + return response; + } + + private ObjectResponse validateEvidence(GeneExpressionFmsDTO geneExpressionFmsDTO) { ObjectResponse response = new ObjectResponse<>(); if (ObjectUtils.isEmpty(geneExpressionFmsDTO.getEvidence())) { @@ -149,4 +297,32 @@ private ObjectResponse validateEvidence(GeneExpressionFmsDTO geneExpr } return response; } + + private TemporalContext updateTemporalContext(ObjectResponse temporalContextObjectResponse, GeneExpressionAnnotation geneExpressionAnnotation) { + TemporalContext temporalContext = temporalContextObjectResponse.getEntity(); + TemporalContext temporalContextDB = geneExpressionAnnotation.getExpressionPattern().getWhenExpressed(); + if (temporalContextDB == null) { + temporalContextDB = new TemporalContext(); + } + temporalContextDB.setDevelopmentalStageStart(temporalContext.getDevelopmentalStageStart()); + temporalContextDB.setStageUberonSlimTerms(temporalContext.getStageUberonSlimTerms()); + return temporalContextDB; + } + + private AnatomicalSite updateAnatomicalSite(ObjectResponse anatomicalSiteObjectResponse, GeneExpressionAnnotation geneExpressionAnnotation) { + AnatomicalSite anatomicalSite = anatomicalSiteObjectResponse.getEntity(); + AnatomicalSite anatomicalSiteDB = geneExpressionAnnotation.getExpressionPattern().getWhereExpressed(); + if (anatomicalSiteDB == null) { + anatomicalSiteDB = new AnatomicalSite(); + } + anatomicalSiteDB.setCellularComponentTerm(anatomicalSite.getCellularComponentTerm()); + anatomicalSiteDB.setAnatomicalStructure(anatomicalSite.getAnatomicalStructure()); + anatomicalSiteDB.setAnatomicalSubstructure(anatomicalSite.getAnatomicalSubstructure()); + anatomicalSiteDB.setAnatomicalStructureQualifiers(anatomicalSite.getAnatomicalStructureQualifiers()); + anatomicalSiteDB.setAnatomicalSubstructureQualifiers(anatomicalSite.getAnatomicalSubstructureQualifiers()); + anatomicalSiteDB.setCellularComponentQualifiers(anatomicalSite.getCellularComponentQualifiers()); + anatomicalSiteDB.setAnatomicalStructureUberonTerms(anatomicalSite.getAnatomicalStructureUberonTerms()); + anatomicalSiteDB.setAnatomicalSubstructureUberonTerms(anatomicalSite.getAnatomicalSubstructureUberonTerms()); + return anatomicalSiteDB; + } } diff --git a/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql b/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql new file mode 100644 index 000000000..3e80ee919 --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql @@ -0,0 +1,240 @@ + +CREATE SEQUENCE public.expressionpattern_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; +CREATE SEQUENCE public.temporalcontext_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; +CREATE SEQUENCE public.anatomicalsite_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; + +CREATE TABLE expressionpattern ( + id BIGINT CONSTRAINT expressionpattern_pkey PRIMARY KEY, + whenexpressed_id BIGINT, + whereexpressed_id BIGINT, + datecreated timestamp without time zone, + dbdatecreated timestamp without time zone, + dateupdated timestamp without time zone, + dbdateupdated timestamp without time zone, + internal boolean DEFAULT false, + obsolete boolean DEFAULT false, + createdby_id bigint, + updatedby_id bigint +); + +CREATE TABLE temporalcontext ( + id BIGINT CONSTRAINT temporalcontext_pkey PRIMARY KEY, + developmentalstagestart_id BIGINT, + developmentalstagestop_id BIGINT, + age VARCHAR(1000), + datecreated timestamp without time zone, + dbdatecreated timestamp without time zone, + dateupdated timestamp without time zone, + dbdateupdated timestamp without time zone, + internal boolean DEFAULT false, + obsolete boolean DEFAULT false, + createdby_id bigint, + updatedby_id bigint +); + +CREATE TABLE anatomicalsite ( + id BIGINT CONSTRAINT anatomicalsite_pkey PRIMARY KEY, + anatomicalstructure_id BIGINT, + anatomicalsubstructure_id BIGINT, + cellularcomponentterm_id BIGINT, + datecreated timestamp without time zone, + dbdatecreated timestamp without time zone, + dateupdated timestamp without time zone, + dbdateupdated timestamp without time zone, + internal boolean DEFAULT false, + obsolete boolean DEFAULT false, + createdby_id bigint, + updatedby_id bigint +); + +CREATE TABLE anatomicalsite_anatomicalstructurequalifiers ( + anatomicalsite_id BIGINT NOT NULL, + anatomicalstructurequalifiers_id BIGINT +); + +CREATE TABLE anatomicalsite_anatomicalsubstructurequalifiers ( + anatomicalsite_id BIGINT NOT NULL, + anatomicalsubstructurequalifiers_id BIGINT +); + +CREATE TABLE anatomicalsite_cellularcomponentqualifiers ( + anatomicalsite_id BIGINT NOT NULL, + cellularcomponentqualifiers_id BIGINT +); + +CREATE TABLE anatomicalsite_anatomicalstructureuberonterms ( + anatomicalsite_id BIGINT NOT NULL, + anatomicalstructureuberonterms_id BIGINT +); + +CREATE TABLE anatomicalsite_anatomicalsubstructureuberonterms ( + anatomicalsite_id BIGINT NOT NULL, + anatomicalsubstructureuberonterms_id BIGINT +); + +CREATE TABLE temporalcontext_stageuberonslimterms ( + temporalcontext_id BIGINT NOT NULL, + stageuberonslimterms_id BIGINT +); + +CREATE TABLE temporalcontext_temporalqualifiers ( + temporalcontext_id BIGINT NOT NULL, + temporalqualifiers_id BIGINT +); + +ALTER TABLE expressionannotation + ADD COLUMN expressionpattern_id BIGINT; + +ALTER TABLE expressionannotation + ADD CONSTRAINT expressionannotationexpressionpattern_fk + FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); + +ALTER TABLE expressionpattern + ADD CONSTRAINT expressionpattern_whenexpressed_fk + FOREIGN KEY (whenexpressed_id) REFERENCES temporalcontext(id); + +ALTER TABLE expressionpattern + ADD CONSTRAINT expressionpattern_whereexpressed_fk + FOREIGN KEY (whereexpressed_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_anatomicalstructurequalifiers + ADD CONSTRAINT anatomicalstructurequalifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_anatomicalstructurequalifiers + ADD CONSTRAINT anatomicalstructurequalifiers_structurequalifier_fk + FOREIGN KEY (anatomicalstructurequalifiers_id) REFERENCES vocabularyterm(id); + +ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers + ADD CONSTRAINT anatomicalsubstructurequalifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers + ADD CONSTRAINT anatomicalsubstructurequalifiers_qualifier_fk + FOREIGN KEY (anatomicalsubstructurequalifiers_id) REFERENCES vocabularyterm(id); + +ALTER TABLE anatomicalsite_cellularcomponentqualifiers + ADD CONSTRAINT cellularcomponentqualifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_cellularcomponentqualifiers + ADD CONSTRAINT cellularcomponentqualifiers_cellularcomponentqualifier_fk + FOREIGN KEY (cellularcomponentqualifiers_id) REFERENCES vocabularyterm(id); + +ALTER TABLE anatomicalsite_anatomicalstructureuberonterms + ADD CONSTRAINT anatomicalstructureuberonterms_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_anatomicalstructureuberonterms + ADD CONSTRAINT anatomicalstructureuberonterms_uberonterm_fk + FOREIGN KEY (anatomicalstructureuberonterms_id) REFERENCES ontologyterm(id); + +ALTER TABLE anatomicalsite_anatomicalsubstructureuberonterms + ADD CONSTRAINT anatomicalsubstructureuberonterms_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + +ALTER TABLE anatomicalsite_anatomicalsubstructureuberonterms + ADD CONSTRAINT anatomicalsubstructureuberonterms_uberonterm_fk + FOREIGN KEY (anatomicalsubstructureuberonterms_id) REFERENCES ontologyterm(id); + +ALTER TABLE temporalcontext_stageuberonslimterms + ADD CONSTRAINT stageuberonterms_temporalcontext_fk + FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id); + +ALTER TABLE temporalcontext_stageuberonslimterms + ADD CONSTRAINT stageuberonslimterms_uberonterm_fk + FOREIGN KEY (stageuberonslimterms_id) REFERENCES vocabularyterm(id); + +ALTER TABLE temporalcontext_temporalqualifiers + ADD CONSTRAINT temporalqualifiers_temporalcontext_fk + FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id); + +ALTER TABLE temporalcontext_temporalqualifiers + ADD CONSTRAINT temporalqualifiers_temporqualifiers_fk + FOREIGN KEY (temporalqualifiers_id) REFERENCES vocabularyterm(id); + + +CREATE INDEX expressionannotation_expressionpattern_index ON expressionannotation USING btree (expressionpattern_id); + +CREATE INDEX expressionpattern_whenexpressed_index ON expressionpattern USING btree (whenexpressed_id); +CREATE INDEX expressionpattern_whereexpressed_index ON expressionpattern USING btree (whereexpressed_id); + +CREATE INDEX temporalcontext_developmentalstagestart_index ON temporalcontext USING btree (developmentalstagestart_id); +CREATE INDEX temporalcontext_developmentalstagestop_index ON temporalcontext USING btree (developmentalstagestop_id); +CREATE INDEX temporalcontext_age_index ON temporalcontext USING btree (age); +CREATE INDEX temporalqualifiers_temporalcontext_index ON temporalcontext_temporalqualifiers USING btree (temporalcontext_id); +CREATE INDEX temporalqualifiers_temporalqualifiers_index ON temporalcontext_temporalqualifiers USING btree (temporalqualifiers_id); +CREATE INDEX stageuberonslimterms_temporalcontext_index ON temporalcontext_stageuberonslimterms USING btree (temporalcontext_id); +CREATE INDEX stageuberonslimterms_uberonterms_index ON temporalcontext_stageuberonslimterms USING btree (stageuberonslimterms_id); + +CREATE INDEX anatomicalsite_anatomicalstructure_index ON anatomicalsite USING btree (anatomicalstructure_id); +CREATE INDEX anatomicalsite_anatomicalsubstructure_index ON anatomicalsite USING btree (anatomicalsubstructure_id); +CREATE INDEX anatomicalsite_cellularcomponentterm_index ON anatomicalsite USING btree (cellularcomponentterm_id); +CREATE INDEX anatomicalstructurequalifiers_anatomicalsite_index ON anatomicalsite_anatomicalstructurequalifiers USING btree (anatomicalsite_id); +CREATE INDEX anatomicalstructurequalifiers_structurequalifiers_index ON anatomicalsite_anatomicalstructurequalifiers USING btree (anatomicalstructurequalifiers_id); +CREATE INDEX anatomicalsubstructurequalifiers_anatomicalsite_index ON anatomicalsite_anatomicalsubstructurequalifiers USING btree (anatomicalsite_id); +CREATE INDEX anatomicalsubstructurequalifiers_qualifiers_index ON anatomicalsite_anatomicalsubstructurequalifiers USING btree (anatomicalsubstructurequalifiers_id); +CREATE INDEX cellularcomponentqualifiers_anatomicalsite_index ON anatomicalsite_cellularcomponentqualifiers USING btree (anatomicalsite_id); +CREATE INDEX cellularcomponentqualifiers_qualifiers_index ON anatomicalsite_cellularcomponentqualifiers USING btree (cellularcomponentqualifiers_id); +CREATE INDEX anatomicalstructureuberonterms_anatomicalsite_index ON anatomicalsite_anatomicalstructureuberonterms USING btree (anatomicalsite_id); +CREATE INDEX anatomicalstructureuberonterms_uberonterms_index ON anatomicalsite_anatomicalstructureuberonterms USING btree (anatomicalstructureuberonterms_id); +CREATE INDEX anatomicalsubstructureuberonterms_anatomicalsite_index ON anatomicalsite_anatomicalsubstructureuberonterms USING btree (anatomicalsite_id); +CREATE INDEX anatomicalsubstructureuberonterms_uberonterms_index ON anatomicalsite_anatomicalsubstructureuberonterms USING btree (anatomicalsubstructureuberonterms_id); + + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Stage Uberon Slim Terms', 'stage_uberon_slim_terms'); +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'post embryonic', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'pre-adult', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000113', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000068', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Anatomical Structure Uberon Slim Terms', 'anatomical_structure_uberon_slim_terms'); +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001009', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0005409', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000949', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001008', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002330', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002193', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002416', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002423', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002204', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001016', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000990', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001004', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001032', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0005726', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0007037', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002105', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002104', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000924', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000925', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000926', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0003104', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0001013', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0000026', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0016887', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:6005023', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'UBERON:0002539', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'Other', id FROM vocabulary WHERE vocabularylabel = 'anatomical_structure_uberon_slim_terms'; + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Cellular Component Qualifiers', 'cellular_component_qualifiers'); +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000046', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000047', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000048', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000050', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000053', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000054', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000055', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000058', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000059', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000063', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000065', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000066', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000067', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000070', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000167', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000168', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000169', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000170', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000171', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000653', id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index c883ff20e..d782d16aa 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -39,6 +39,20 @@ public class ExpressionBulkUploadFmsITCase extends BaseITCase { private final String publicationId = "PMID:009"; private final String agrPublicationId = "AGRKB:101000000668376"; + private final String stageTermId = "ZFS:001"; + private final String stageUberonTermId = "UBERON:001"; + + private final String anatomicalStructureTermId = "ANAT:001"; + private final String anatomicalSubstructureTermId = "ANAT:002"; + private final String cellularComponentTermId = "GOTEST:0012"; + private final String anatomicalStructureQualifierTermId = "UBERON:002"; + private final String anatomicalSubstructureQualifierTermId = "UBERON:003"; + private final String cellularComponentQualifierTermId = "FBCV:001"; + private final String anatomicalStructureUberonTermId1 = "UBERON:004"; + private final String anatomicalStructureUberonTermId2 = "UBERON:005"; + private final String anatomicalSubstructureUberonTermId1 = "UBERON:006"; + private final String anatomicalSubstructureUberonTermId2 = "UBERON:007"; + @BeforeEach public void init() { RestAssured.config = RestAssuredConfig.config() @@ -68,7 +82,19 @@ public void expressionBulkUploadAllFields() throws Exception { .body("results[0].whereExpressedStatement", is("trunk")) .body("results[0].whenExpressedStageName", is("stage1")) .body("results[0].singleReference.crossReferences[0].referencedCurie", is(publicationId)) - .body("results[0].relation.name", is(VocabularyConstants.GENE_EXPRESSION_RELATION_TERM)); + .body("results[0].relation.name", is(VocabularyConstants.GENE_EXPRESSION_RELATION_TERM)) + .body("results[0].expressionPattern.whenExpressed.developmentalStageStart.curie", is(stageTermId)) + .body("results[0].expressionPattern.whenExpressed.stageUberonSlimTerms[0].name", is(stageUberonTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalStructure.curie", is(anatomicalStructureTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructure.curie", is(anatomicalSubstructureTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentTerm.curie", is(cellularComponentTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalStructureQualifiers[0].name", is(anatomicalStructureQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureQualifiers[0].name", is(anatomicalSubstructureQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentQualifiers[0].name", is(cellularComponentQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalStructureUberonTerms[0].curie", is(anatomicalStructureUberonTermId1)) + .body("results[0].expressionPattern.whereExpressed.anatomicalStructureUberonTerms[1].curie", is(anatomicalStructureUberonTermId2)) + .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureUberonTerms[0].curie", is(anatomicalSubstructureUberonTermId1)) + .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureUberonTerms[1].curie", is(anatomicalSubstructureUberonTermId2)); } @Test @@ -82,6 +108,7 @@ public void expressionBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "MR_06_no_whereExpressed.json"); checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "MR_07_nowhenExpressedStageName.json"); checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "MR_08_nowhereExpressedStatement.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "MR_09_norCellComponentNORanatStructure.json"); } @Test @@ -101,6 +128,15 @@ public void expressionBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_02_invalid_dateAssigned.json"); checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_03_invalid_assay.json"); checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_04_invalid_publicationId.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_05_invalid_stageterm.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_06_invalid_anatomical_structure.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_07_invalid_anatomical_substructure.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_08_invalid_cellularcomponent.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_09_invalid_anatomicalstructurequalifier.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_10_invalid_anatomicalsubstructurequalifier.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_11_invalid_cellularcomponentqualifier.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_12_invalid_anatomicalstructureuberonslimterms.json"); + checkFailedBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "IV_13_invalid_anatomicalsubstructureuberonslimterms.json"); } private void loadRequiredEntities() throws Exception { @@ -116,5 +152,20 @@ private void loadRequiredEntities() throws Exception { loadReference(agrReferenceId, referenceId); Vocabulary vocabulary2 = createVocabulary(VocabularyConstants.GENE_EXPRESSION_VOCABULARY, false); VocabularyTerm isExpressed = createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); + Vocabulary stageUberonTermVocabulary = getVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS); + Vocabulary anatomicalStructureUberonTermVocabulary = getVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS); + Vocabulary cellullarComponentQualififerVocabulary = getVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS); + loadStageTerm(stageTermId, "StageTermTest"); + createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); + loadAnatomyTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); + loadAnatomyTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); + loadGOTerm(cellularComponentTermId, "CellularComponentTermTest"); + createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); + createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); + createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); + loadUberonTerm(anatomicalStructureUberonTermId1, "UberonTermTest1"); + loadUberonTerm(anatomicalStructureUberonTermId2, "UberonTermTest2"); + loadUberonTerm(anatomicalSubstructureUberonTermId1, "UberonTermTest3"); + loadUberonTerm(anatomicalSubstructureUberonTermId2, "UberonTermTest4"); } } diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index b32949a87..f0b646770 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -1,57 +1,13 @@ package org.alliancegenome.curation_api.base; -import static io.restassured.RestAssured.given; -import static org.hamcrest.Matchers.is; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; -import java.util.regex.Pattern; - +import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; -import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; -import org.alliancegenome.curation_api.model.entities.Allele; -import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; -import org.alliancegenome.curation_api.model.entities.BiologicalEntity; -import org.alliancegenome.curation_api.model.entities.ConditionRelation; -import org.alliancegenome.curation_api.model.entities.Construct; -import org.alliancegenome.curation_api.model.entities.CrossReference; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.ExperimentalCondition; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.Note; -import org.alliancegenome.curation_api.model.entities.Organization; -import org.alliancegenome.curation_api.model.entities.Person; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; -import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; -import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.Variant; -import org.alliancegenome.curation_api.model.entities.Vocabulary; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; -import org.alliancegenome.curation_api.model.entities.VocabularyTermSet; +import org.alliancegenome.curation_api.model.entities.*; 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.ontology.AnatomicalTerm; -import org.alliancegenome.curation_api.model.entities.ontology.CHEBITerm; -import org.alliancegenome.curation_api.model.entities.ontology.ChemicalTerm; -import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ExperimentalConditionOntologyTerm; -import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.MITerm; -import org.alliancegenome.curation_api.model.entities.ontology.MPTerm; -import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; -import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.WBPhenotypeTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ZECOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ZFATerm; +import org.alliancegenome.curation_api.model.entities.ontology.*; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.constructSlotAnnotations.ConstructSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSymbolSlotAnnotation; @@ -60,8 +16,14 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.apache.commons.lang3.StringUtils; -import io.restassured.RestAssured; -import io.restassured.common.mapper.TypeRef; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; +import java.util.regex.Pattern; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; public class BaseITCase { @@ -100,7 +62,7 @@ public VocabularyTerm addVocabularyTermToSet(String setName, String termName, Vo public void checkFailedBulkLoad(String endpoint, String filePath) throws Exception { checkFailedBulkLoad(endpoint, filePath, 1, 1, 0); } - + public void checkFailedBulkLoad(String endpoint, String filePath, int expectedTotalRecords, int expectedFailedRecords, int expectedCompletedRecords) throws Exception { String content = Files.readString(Path.of(filePath)); @@ -349,7 +311,7 @@ public Gene createGene(String modEntityId, String taxonCurie, Boolean obsolete, symbol.setFormatText(modEntityId); gene.setGeneSymbol(symbol); - + SOTerm geneType = getSoTerm("SO:0001217"); gene.setGeneType(geneType); @@ -1235,7 +1197,7 @@ public void loadGeneWithXref(String modEntityId, String taxonCurie, VocabularyTe symbol.setFormatText(modEntityId); gene.setGeneSymbol(symbol); - + SOTerm geneType = getSoTerm("SO:0001217"); gene.setGeneType(geneType); @@ -1324,6 +1286,22 @@ public void loadMPTerm(String curie, String name) throws Exception { statusCode(200); } + public void loadStageTerm(String curie, String name) throws Exception { + MPTerm mpTerm = new MPTerm(); + mpTerm.setCurie(curie); + mpTerm.setName(name); + mpTerm.setObsolete(false); + mpTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + RestAssured.given(). + contentType("application/json"). + body(mpTerm). + when(). + put("/api/stageterm"). + then(). + statusCode(200); + } + public void loadOrganization(String abbreviation) throws Exception { Organization organization = new Organization(); organization.setAbbreviation(abbreviation); @@ -1384,6 +1362,22 @@ public void loadSOTerm(String curie, String name) throws Exception { statusCode(200); } + public void loadUberonTerm(String curie, String name) throws Exception { + SOTerm soTerm = new SOTerm(); + soTerm.setCurie(curie); + soTerm.setName(name); + soTerm.setObsolete(false); + soTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + RestAssured.given(). + contentType("application/json"). + body(soTerm). + when(). + put("/api/uberonterm"). + then(). + statusCode(200); + } + public void loadWbPhenotypeTerm(String curie, String name) throws Exception { WBPhenotypeTerm wbTerm = new WBPhenotypeTerm(); wbTerm.setCurie(curie); diff --git a/src/test/resources/bulk/fms/07_expression/AF_01_all_fields.json b/src/test/resources/bulk/fms/07_expression/AF_01_all_fields.json index 1eb527bc4..a9873c0ca 100644 --- a/src/test/resources/bulk/fms/07_expression/AF_01_all_fields.json +++ b/src/test/resources/bulk/fms/07_expression/AF_01_all_fields.json @@ -23,10 +23,20 @@ }, "whereExpressed" : { "whereExpressedStatement" : "trunk", - "anatomicalStructureTermId" : "ZFA:001", - "anatomicalStructureUberonSlimTermIds" : [ { - "uberonTerm" : "Other" - } ] + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] } } ] diff --git a/src/test/resources/bulk/fms/07_expression/IV_05_invalid_stageterm.json b/src/test/resources/bulk/fms/07_expression/IV_05_invalid_stageterm.json new file mode 100644 index 000000000..c47a34dd2 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_05_invalid_stageterm.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:NOTFOUND", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_06_invalid_anatomical_structure.json b/src/test/resources/bulk/fms/07_expression/IV_06_invalid_anatomical_structure.json new file mode 100644 index 000000000..991893a1a --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_06_invalid_anatomical_structure.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:NOTFOUND", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_07_invalid_anatomical_substructure.json b/src/test/resources/bulk/fms/07_expression/IV_07_invalid_anatomical_substructure.json new file mode 100644 index 000000000..1026a1c28 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_07_invalid_anatomical_substructure.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:NOTFOUND", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_08_invalid_cellularcomponent.json b/src/test/resources/bulk/fms/07_expression/IV_08_invalid_cellularcomponent.json new file mode 100644 index 000000000..e05d9c8a0 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_08_invalid_cellularcomponent.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:NOTFOUND", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_09_invalid_anatomicalstructurequalifier.json b/src/test/resources/bulk/fms/07_expression/IV_09_invalid_anatomicalstructurequalifier.json new file mode 100644 index 000000000..e18c849b8 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_09_invalid_anatomicalstructurequalifier.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:NOTFOUND", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_10_invalid_anatomicalsubstructurequalifier.json b/src/test/resources/bulk/fms/07_expression/IV_10_invalid_anatomicalsubstructurequalifier.json new file mode 100644 index 000000000..99239825c --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_10_invalid_anatomicalsubstructurequalifier.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:NOTFOUND", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_11_invalid_cellularcomponentqualifier.json b/src/test/resources/bulk/fms/07_expression/IV_11_invalid_cellularcomponentqualifier.json new file mode 100644 index 000000000..607930b10 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_11_invalid_cellularcomponentqualifier.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:NOTFOUND", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_12_invalid_anatomicalstructureuberonslimterms.json b/src/test/resources/bulk/fms/07_expression/IV_12_invalid_anatomicalstructureuberonslimterms.json new file mode 100644 index 000000000..4c25ca67f --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_12_invalid_anatomicalstructureuberonslimterms.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:NOTFOUND"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/IV_13_invalid_anatomicalsubstructureuberonslimterms.json b/src/test/resources/bulk/fms/07_expression/IV_13_invalid_anatomicalsubstructureuberonslimterms.json new file mode 100644 index 000000000..27e216911 --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/IV_13_invalid_anatomicalsubstructureuberonslimterms.json @@ -0,0 +1,43 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalStructureTermId" : "ANAT:001", + "anatomicalSubStructureTermId" : "ANAT:002", + "cellularComponentTermId" : "GOTEST:0012", + "anatomicalStructureQualifierTermId": "UBERON:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:NOTFOUND"} + ] + } + } +] + diff --git a/src/test/resources/bulk/fms/07_expression/MR_09_norCellComponentNORanatStructure.json b/src/test/resources/bulk/fms/07_expression/MR_09_norCellComponentNORanatStructure.json new file mode 100644 index 000000000..f392bf65a --- /dev/null +++ b/src/test/resources/bulk/fms/07_expression/MR_09_norCellComponentNORanatStructure.json @@ -0,0 +1,40 @@ +[ + { + "dateAssigned" : "2024-01-17T07:31:34-08:00", + "geneId" : "GEXPTEST:GENE001", + "evidence" : { + "crossReference" : { + "id" : "ZFIN:PUB001", + "pages" : [ "reference" ] + }, + "publicationId" : "PMID:009" + }, + "crossReference" : { + "id" : "ZFIN:ZDB-FIG-170413-34", + "pages" : [ "gene/expression/annotation/detail" ] + }, + "assay" : "GEXPTEST:assay001", + "whenExpressed" : { + "stageName" : "stage1", + "stageTermId" : "ZFS:001", + "stageUberonSlimTerm" : { + "uberonTerm" : "UBERON:001" + } + }, + "whereExpressed" : { + "whereExpressedStatement" : "trunk", + "anatomicalSubStructureTermId" : "ANAT:002", + "anatomicalSubStructureQualifierTermId": "UBERON:003", + "cellularComponentQualifierTermId": "FBCV:001", + "anatomicalStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:004"}, + {"uberonTerm" : "UBERON:005"} + ], + "anatomicalSubStructureUberonSlimTermIds" : [ + {"uberonTerm" : "UBERON:006"}, + {"uberonTerm" : "UBERON:007"} + ] + } + } +] + From 009c2813432c3a70e8fc19972a40845ddbabc29e Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Mon, 29 Jul 2024 13:54:20 +0100 Subject: [PATCH 091/342] SCRUM-3952: fix index names --- .../curation_api/model/entities/AnatomicalSite.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 46f1dfbf6..5a0d5999d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -74,7 +74,7 @@ public class AnatomicalSite extends AuditedObject { name = "anatomicalsite_anatomicalsubstructurequalifiers", indexes = { @Index(name = "anatomicalsubstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), - @Index(name = "anatomicalsubstructurequalifiers_anatomicalsubstructurequalifiers_index", columnList = "anatomicalsubstructurequalifiers_id")} + @Index(name = "anatomicalsubstructurequalifiers_qualifiers_index", columnList = "anatomicalsubstructurequalifiers_id")} ) private List anatomicalSubstructureQualifiers; @@ -98,7 +98,7 @@ public class AnatomicalSite extends AuditedObject { name = "anatomicalsite_anatomicalstructureuberonterms", indexes = { @Index(name = "anatomicalstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"), - @Index(name = "anatomicalstructureuberonterms_anatomicalstructureuberonterms_index", columnList = "anatomicalstructureuberonterms_id")} + @Index(name = "anatomicalstructureuberonterms_uberonterms_index", columnList = "anatomicalstructureuberonterms_id")} ) private List anatomicalStructureUberonTerms; @@ -110,7 +110,7 @@ public class AnatomicalSite extends AuditedObject { name = "anatomicalsite_anatomicalsubstructureuberonterms", indexes = { @Index(name = "anatomicalsubstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"), - @Index(name = "anatomicalsubstructureuberonterms_anatomicalstructureuberonterms_index", columnList = "anatomicalsubstructureuberonterms_id")} + @Index(name = "anatomicalsubstructureuberonterms_uberonterms_index", columnList = "anatomicalsubstructureuberonterms_id")} ) private List anatomicalSubstructureUberonTerms; } From 10f9b5809f38c0c1bb34ed067925cc63ddb333df Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Mon, 29 Jul 2024 15:23:47 +0100 Subject: [PATCH 092/342] SCRUM-3952: remove NOT NULLs in migration --- .../db/migration/v0.36.0.6__expression_pattern.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql b/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql index 3e80ee919..085894c1f 100644 --- a/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql +++ b/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql @@ -48,37 +48,37 @@ CREATE TABLE anatomicalsite ( ); CREATE TABLE anatomicalsite_anatomicalstructurequalifiers ( - anatomicalsite_id BIGINT NOT NULL, + anatomicalsite_id BIGINT, anatomicalstructurequalifiers_id BIGINT ); CREATE TABLE anatomicalsite_anatomicalsubstructurequalifiers ( - anatomicalsite_id BIGINT NOT NULL, + anatomicalsite_id BIGINT, anatomicalsubstructurequalifiers_id BIGINT ); CREATE TABLE anatomicalsite_cellularcomponentqualifiers ( - anatomicalsite_id BIGINT NOT NULL, + anatomicalsite_id BIGINT, cellularcomponentqualifiers_id BIGINT ); CREATE TABLE anatomicalsite_anatomicalstructureuberonterms ( - anatomicalsite_id BIGINT NOT NULL, + anatomicalsite_id BIGINT, anatomicalstructureuberonterms_id BIGINT ); CREATE TABLE anatomicalsite_anatomicalsubstructureuberonterms ( - anatomicalsite_id BIGINT NOT NULL, + anatomicalsite_id BIGINT, anatomicalsubstructureuberonterms_id BIGINT ); CREATE TABLE temporalcontext_stageuberonslimterms ( - temporalcontext_id BIGINT NOT NULL, + temporalcontext_id BIGINT, stageuberonslimterms_id BIGINT ); CREATE TABLE temporalcontext_temporalqualifiers ( - temporalcontext_id BIGINT NOT NULL, + temporalcontext_id BIGINT, temporalqualifiers_id BIGINT ); From bdac863ece819af2d0b3904e023984b1d79d00e7 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Tue, 30 Jul 2024 10:31:14 +0100 Subject: [PATCH 093/342] SCRUM-3952: rename migration prefix --- ...__expression_pattern.sql => v0.36.0.7__expression_pattern.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.36.0.6__expression_pattern.sql => v0.36.0.7__expression_pattern.sql} (100%) diff --git a/src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql b/src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.6__expression_pattern.sql rename to src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql From 3c27dc7e31cf266c6c6e825fedbf0ceb18ef3557 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 30 Jul 2024 16:28:01 -0500 Subject: [PATCH 094/342] Replacing the parent class of HTPDatasetAnnotation from SubmittedObject to AuditedObject --- .../model/entities/HTPExpressionDatasetAnnotation.java | 6 +++--- .../db/migration/v0.36.0.8__Fixing_HTPDataset.sql | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index ca9d7a342..ab1033b80 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -4,7 +4,7 @@ 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.base.AuditedObject; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.annotations.Fetch; @@ -32,8 +32,8 @@ @ToString(callSuper = true) @Table(name = "htpexpressiondatasetannotation") @Schema(name = "HTPExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") -@AGRCurationSchemaVersion(min = "2.6.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SubmittedObject.class }) -public class HTPExpressionDatasetAnnotation extends SubmittedObject { +@AGRCurationSchemaVersion(min = "2.6.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +public class HTPExpressionDatasetAnnotation extends AuditedObject { @IndexedEmbedded(includeDepth = 1) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) diff --git a/src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql b/src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql new file mode 100644 index 000000000..172b2167c --- /dev/null +++ b/src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql @@ -0,0 +1,7 @@ +ALTER TABLE htpexpressiondatasetannotation DROP CONSTRAINT htpexpressiondatasetannotation_dataprovider_id_fk; + +ALTER TABLE htpexpressiondatasetannotation DROP COLUMN curie; +ALTER TABLE htpexpressiondatasetannotation DROP COLUMN modentityid; +ALTER TABLE htpexpressiondatasetannotation DROP COLUMN modinternalid; +ALTER TABLE htpexpressiondatasetannotation DROP COLUMN dataprovider_id; + From a4af43938c36e8dc7818ad037c422372669db9a2 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Wed, 31 Jul 2024 14:19:17 +0100 Subject: [PATCH 095/342] SCRUM-3952: remove @ElementCollection annotation --- .../model/entities/AnatomicalSite.java | 10 +++---- .../model/entities/TemporalContext.java | 4 +-- .../v0.36.0.7__expression_pattern.sql | 28 +++++++++---------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 5a0d5999d..87644da95 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -56,7 +56,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "anatomicalsite_anatomicalstructurequalifiers", @@ -68,7 +68,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalsubstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "anatomicalsite_anatomicalsubstructurequalifiers", @@ -80,7 +80,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "cellularcomponentqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "anatomicalsite_cellularcomponentqualifiers", @@ -92,7 +92,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "anatomicalsite_anatomicalstructureuberonterms", @@ -104,7 +104,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalsubstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "anatomicalsite_anatomicalsubstructureuberonterms", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java index f59dd7ca4..1f3e533f4 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java @@ -54,7 +54,7 @@ public class TemporalContext extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "temporalqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "temporalcontext_temporalqualifiers", @@ -66,7 +66,7 @@ public class TemporalContext extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "stageuberonslimterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @ElementCollection + @ManyToMany @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) @JoinTable( name = "temporalcontext_stageuberonslimterms", diff --git a/src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql b/src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql index 085894c1f..ab500c931 100644 --- a/src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql +++ b/src/main/resources/db/migration/v0.36.0.7__expression_pattern.sql @@ -99,59 +99,59 @@ ALTER TABLE expressionpattern ALTER TABLE anatomicalsite_anatomicalstructurequalifiers ADD CONSTRAINT anatomicalstructurequalifiers_anatomicalsite_fk - FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalstructurequalifiers ADD CONSTRAINT anatomicalstructurequalifiers_structurequalifier_fk - FOREIGN KEY (anatomicalstructurequalifiers_id) REFERENCES vocabularyterm(id); + FOREIGN KEY (anatomicalstructurequalifiers_id) REFERENCES vocabularyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers ADD CONSTRAINT anatomicalsubstructurequalifiers_anatomicalsite_fk - FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers ADD CONSTRAINT anatomicalsubstructurequalifiers_qualifier_fk - FOREIGN KEY (anatomicalsubstructurequalifiers_id) REFERENCES vocabularyterm(id); + FOREIGN KEY (anatomicalsubstructurequalifiers_id) REFERENCES vocabularyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_cellularcomponentqualifiers ADD CONSTRAINT cellularcomponentqualifiers_anatomicalsite_fk - FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_cellularcomponentqualifiers ADD CONSTRAINT cellularcomponentqualifiers_cellularcomponentqualifier_fk - FOREIGN KEY (cellularcomponentqualifiers_id) REFERENCES vocabularyterm(id); + FOREIGN KEY (cellularcomponentqualifiers_id) REFERENCES vocabularyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalstructureuberonterms ADD CONSTRAINT anatomicalstructureuberonterms_anatomicalsite_fk - FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalstructureuberonterms ADD CONSTRAINT anatomicalstructureuberonterms_uberonterm_fk - FOREIGN KEY (anatomicalstructureuberonterms_id) REFERENCES ontologyterm(id); + FOREIGN KEY (anatomicalstructureuberonterms_id) REFERENCES ontologyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalsubstructureuberonterms ADD CONSTRAINT anatomicalsubstructureuberonterms_anatomicalsite_fk - FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id); + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE anatomicalsite_anatomicalsubstructureuberonterms ADD CONSTRAINT anatomicalsubstructureuberonterms_uberonterm_fk - FOREIGN KEY (anatomicalsubstructureuberonterms_id) REFERENCES ontologyterm(id); + FOREIGN KEY (anatomicalsubstructureuberonterms_id) REFERENCES ontologyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE temporalcontext_stageuberonslimterms ADD CONSTRAINT stageuberonterms_temporalcontext_fk - FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id); + FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE temporalcontext_stageuberonslimterms ADD CONSTRAINT stageuberonslimterms_uberonterm_fk - FOREIGN KEY (stageuberonslimterms_id) REFERENCES vocabularyterm(id); + FOREIGN KEY (stageuberonslimterms_id) REFERENCES vocabularyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE temporalcontext_temporalqualifiers ADD CONSTRAINT temporalqualifiers_temporalcontext_fk - FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id); + FOREIGN KEY (temporalcontext_id) REFERENCES temporalcontext(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; ALTER TABLE temporalcontext_temporalqualifiers ADD CONSTRAINT temporalqualifiers_temporqualifiers_fk - FOREIGN KEY (temporalqualifiers_id) REFERENCES vocabularyterm(id); + FOREIGN KEY (temporalqualifiers_id) REFERENCES vocabularyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; CREATE INDEX expressionannotation_expressionpattern_index ON expressionannotation USING btree (expressionpattern_id); From b13f217f2e09fd9013982b6d5ce417967effc826 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Wed, 31 Jul 2024 16:09:23 +0100 Subject: [PATCH 096/342] SCRUM-3952: remove ForPublic JsonView --- .../model/entities/AnatomicalSite.java | 16 ++++++++-------- .../model/entities/ExpressionAnnotation.java | 8 ++++---- .../model/entities/ExpressionPattern.java | 4 ++-- .../model/entities/GeneExpressionAnnotation.java | 4 ++-- .../model/entities/TemporalContext.java | 10 +++++----- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 87644da95..d8673d9e7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -39,25 +39,25 @@ public class AnatomicalSite extends AuditedObject { @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private AnatomicalTerm anatomicalStructure; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private AnatomicalTerm anatomicalSubstructure; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private GOTerm cellularComponentTerm; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "anatomicalsite_anatomicalstructurequalifiers", indexes = { @@ -69,7 +69,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalsubstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "anatomicalsite_anatomicalsubstructurequalifiers", indexes = { @@ -81,7 +81,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "cellularcomponentqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "anatomicalsite_cellularcomponentqualifiers", indexes = { @@ -93,7 +93,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "anatomicalsite_anatomicalstructureuberonterms", indexes = { @@ -105,7 +105,7 @@ public class AnatomicalSite extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalsubstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "anatomicalsite_anatomicalsubstructureuberonterms", indexes = { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java index 321d1fdc7..0f1b9e017 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java @@ -38,22 +38,22 @@ public abstract class ExpressionAnnotation extends Annotation { @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private VocabularyTerm relation; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "whenExpressedStageName_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private String whenExpressedStageName; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "whereExpressedStatement_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({ View.FieldsOnly.class}) private String whereExpressedStatement; @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "expressionpattern_id", referencedColumnName = "id") - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({ View.FieldsOnly.class}) private ExpressionPattern expressionPattern; @Transient diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java index ea77eac8b..240b2ff44 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionPattern.java @@ -28,11 +28,11 @@ public class ExpressionPattern extends AuditedObject { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({ View.FieldsOnly.class}) private TemporalContext whenExpressed; @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({ View.FieldsOnly.class}) private AnatomicalSite whereExpressed; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java index 83711b3f7..0fa94780c 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java @@ -34,13 +34,13 @@ public class GeneExpressionAnnotation extends ExpressionAnnotation { @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, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class }) private Gene expressionAnnotationSubject; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private MMOTerm expressionAssayUsed; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java index 1f3e533f4..64562f441 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java @@ -38,24 +38,24 @@ public class TemporalContext extends AuditedObject { @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private StageTerm developmentalStageStart; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private StageTerm developmentalStageStop; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "age_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) + @JsonView({View.FieldsOnly.class}) private String age; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "temporalqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "temporalcontext_temporalqualifiers", indexes = { @@ -67,7 +67,7 @@ public class TemporalContext extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "stageuberonslimterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ManyToMany - @JsonView({View.FieldsAndLists.class, View.ForPublic.class}) + @JsonView({View.FieldsOnly.class}) @JoinTable( name = "temporalcontext_stageuberonslimterms", indexes = { From bc8af6e7164f7ec3870915b904ea46e9aa1c2d2c Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Fri, 2 Aug 2024 16:43:20 +0200 Subject: [PATCH 097/342] SCRUM-4305 set obsolete / internal variables explicitly when being updated. (#1629) --- .../helpers/UniqueIdentifierHelper.java | 72 +++++++++++++++++++ .../dto/AGMDiseaseAnnotationDTOValidator.java | 50 +++++-------- .../AlleleDiseaseAnnotationDTOValidator.java | 19 ++--- .../dto/AnnotationDTOValidator.java | 8 +-- .../validation/dto/ConstructDTOValidator.java | 22 ++---- .../dto/DiseaseAnnotationDTOValidator.java | 39 +++++----- .../GeneDiseaseAnnotationDTOValidator.java | 29 +++----- 7 files changed, 132 insertions(+), 107 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdentifierHelper.java diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdentifierHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdentifierHelper.java new file mode 100644 index 000000000..a0fea2520 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/UniqueIdentifierHelper.java @@ -0,0 +1,72 @@ +package org.alliancegenome.curation_api.services.helpers; + +import org.alliancegenome.curation_api.model.entities.Annotation; +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; +import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; +import org.alliancegenome.curation_api.model.ingest.dto.AnnotationDTO; +import org.alliancegenome.curation_api.model.ingest.dto.DiseaseAnnotationDTO; +import org.alliancegenome.curation_api.model.ingest.dto.base.SubmittedObjectDTO; +import org.apache.commons.lang3.StringUtils; + +public class UniqueIdentifierHelper { + + public static String getIdentifyingField(E annotationDTO) { + if (StringUtils.isNotBlank(annotationDTO.getModEntityId())) { + return "modEntityId"; + } else if (StringUtils.isNotBlank(annotationDTO.getModInternalId())) { + return "modInternalId"; + } else { + return "uniqueId"; + } + } + + public static void setObsoleteAndInternal(DiseaseAnnotationDTO dto, AuditedObject annotation) { + // default obsolete value: false + annotation.setObsolete(dto.getObsolete() != null && dto.getObsolete()); + // default internal value: false + annotation.setInternal(dto.getInternal() != null && dto.getInternal()); + } + + public static String setAnnotationID(E annotationDTO, F annotation, String uniqueId) { + if (StringUtils.isNotBlank(annotationDTO.getModEntityId())) { + annotation.setModEntityId(annotationDTO.getModEntityId()); + return annotationDTO.getModEntityId(); + } else if (StringUtils.isNotBlank(annotationDTO.getModInternalId())) { + annotation.setModInternalId(annotationDTO.getModInternalId()); + return annotationDTO.getModInternalId(); + } else { + return uniqueId; + } + } + + + public static String getIdentifyingField(E submittedObjectDto) { + if (StringUtils.isNotBlank(submittedObjectDto.getModEntityId())) { + return "modEntityId"; + } else if (StringUtils.isNotBlank(submittedObjectDto.getModInternalId())) { + return "modInternalId"; + } else { + return "uniqueId"; + } + } + + public static void setObsoleteAndInternal(SubmittedObjectDTO dto, SubmittedObject submittedObject) { + // default obsolete value: false + submittedObject.setObsolete(dto.getObsolete() != null && dto.getObsolete()); + // default internal value: false + submittedObject.setInternal(dto.getInternal() != null && dto.getInternal()); + } + + public static String setAnnotationID(E submittedObjectDTO, F submittedObject, String uniqueId) { + if (StringUtils.isNotBlank(submittedObjectDTO.getModEntityId())) { + submittedObject.setModEntityId(submittedObjectDTO.getModEntityId()); + return submittedObjectDTO.getModEntityId(); + } else if (StringUtils.isNotBlank(submittedObjectDTO.getModInternalId())) { + submittedObject.setModInternalId(submittedObjectDTO.getModInternalId()); + return submittedObjectDTO.getModInternalId(); + } else { + return uniqueId; + } + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java index 875022490..42ef855a4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java @@ -1,20 +1,14 @@ package org.alliancegenome.curation_api.services.validation.dto; -import java.util.ArrayList; -import java.util.List; - +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; -import org.alliancegenome.curation_api.model.entities.Allele; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.model.ingest.dto.AGMDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -22,22 +16,28 @@ import org.alliancegenome.curation_api.services.AlleleService; import org.alliancegenome.curation_api.services.GeneService; import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.alliancegenome.curation_api.services.helpers.UniqueIdentifierHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationRetrievalHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationUniqueIdHelper; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.util.ArrayList; +import java.util.List; @RequestScoped public class AGMDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOValidator { - @Inject AGMDiseaseAnnotationDAO agmDiseaseAnnotationDAO; - @Inject VocabularyTermService vocabularyTermService; - @Inject AffectedGenomicModelService agmService; - @Inject GeneService geneService; - @Inject AlleleService alleleService; + @Inject + AGMDiseaseAnnotationDAO agmDiseaseAnnotationDAO; + @Inject + VocabularyTermService vocabularyTermService; + @Inject + AffectedGenomicModelService agmService; + @Inject + GeneService geneService; + @Inject + AlleleService alleleService; public AGMDiseaseAnnotation validateAGMDiseaseAnnotationDTO(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, ObjectValidationException { @@ -58,27 +58,15 @@ public AGMDiseaseAnnotation validateAGMDiseaseAnnotationDTO(AGMDiseaseAnnotation if (agm == null) { adaResponse.addErrorMessage("agm_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAgmIdentifier() + ")"); } else { - String annotationId; - String identifyingField; String uniqueId = AnnotationUniqueIdHelper.getDiseaseAnnotationUniqueId(dto, dto.getAgmIdentifier(), refCurie); - - if (StringUtils.isNotBlank(dto.getModEntityId())) { - annotationId = dto.getModEntityId(); - annotation.setModEntityId(annotationId); - identifyingField = "modEntityId"; - } else if (StringUtils.isNotBlank(dto.getModInternalId())) { - annotationId = dto.getModInternalId(); - annotation.setModInternalId(annotationId); - identifyingField = "modInternalId"; - } else { - annotationId = uniqueId; - identifyingField = "uniqueId"; - } + String annotationId = UniqueIdentifierHelper.setAnnotationID(dto, annotation, uniqueId); + String identifyingField = UniqueIdentifierHelper.getIdentifyingField(dto); SearchResponse annotationList = agmDiseaseAnnotationDAO.findByField(identifyingField, annotationId); annotation = AnnotationRetrievalHelper.getCurrentAnnotation(annotation, annotationList); annotation.setUniqueId(uniqueId); annotation.setDiseaseAnnotationSubject(agm); + UniqueIdentifierHelper.setObsoleteAndInternal(dto, annotation); if (dataProvider != null && (dataProvider.name().equals("RGD") || dataProvider.name().equals("HUMAN")) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java index 69c1ad33f..8baba7e91 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java @@ -19,6 +19,7 @@ import org.alliancegenome.curation_api.services.AlleleService; import org.alliancegenome.curation_api.services.GeneService; import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.alliancegenome.curation_api.services.helpers.UniqueIdentifierHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationRetrievalHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationUniqueIdHelper; import org.apache.commons.collections.CollectionUtils; @@ -53,27 +54,15 @@ public AlleleDiseaseAnnotation validateAlleleDiseaseAnnotationDTO(AlleleDiseaseA if (allele == null) { adaResponse.addErrorMessage("allele_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAlleleIdentifier() + ")"); } else { - String annotationId; - String identifyingField; String uniqueId = AnnotationUniqueIdHelper.getDiseaseAnnotationUniqueId(dto, dto.getAlleleIdentifier(), refCurie); - - if (StringUtils.isNotBlank(dto.getModEntityId())) { - annotationId = dto.getModEntityId(); - annotation.setModEntityId(annotationId); - identifyingField = "modEntityId"; - } else if (StringUtils.isNotBlank(dto.getModInternalId())) { - annotationId = dto.getModInternalId(); - annotation.setModInternalId(annotationId); - identifyingField = "modInternalId"; - } else { - annotationId = uniqueId; - identifyingField = "uniqueId"; - } + String annotationId = UniqueIdentifierHelper.setAnnotationID(dto, annotation, uniqueId); + String identifyingField = UniqueIdentifierHelper.getIdentifyingField(dto); SearchResponse annotationList = alleleDiseaseAnnotationDAO.findByField(identifyingField, annotationId); annotation = AnnotationRetrievalHelper.getCurrentAnnotation(annotation, annotationList); annotation.setUniqueId(uniqueId); annotation.setDiseaseAnnotationSubject(allele); + UniqueIdentifierHelper.setObsoleteAndInternal(dto, annotation); if (dataProvider != null && (dataProvider.name().equals("RGD") || dataProvider.name().equals("HUMAN")) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AnnotationDTOValidator.java index 6f7026b73..5044fed15 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AnnotationDTOValidator.java @@ -10,11 +10,7 @@ import org.alliancegenome.curation_api.dao.ConditionRelationDAO; import org.alliancegenome.curation_api.dao.DataProviderDAO; import org.alliancegenome.curation_api.dao.NoteDAO; -import org.alliancegenome.curation_api.model.entities.Annotation; -import org.alliancegenome.curation_api.model.entities.ConditionRelation; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.Note; -import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.model.ingest.dto.AnnotationDTO; import org.alliancegenome.curation_api.model.ingest.dto.ConditionRelationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -141,4 +137,6 @@ public ObjectResponse validat aResponse.setEntity(annotation); return aResponse; } + + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java index 667802e52..c3523d1e2 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java @@ -20,6 +20,7 @@ import org.alliancegenome.curation_api.model.ingest.dto.slotAnnotions.constructSlotAnnotations.ConstructComponentSlotAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.helpers.UniqueIdentifierHelper; import org.alliancegenome.curation_api.services.helpers.constructs.ConstructUniqueIdHelper; import org.alliancegenome.curation_api.services.helpers.slotAnnotations.SlotAnnotationIdentityHelper; import org.alliancegenome.curation_api.services.validation.dto.slotAnnotations.constructSlotAnnotations.ConstructComponentSlotAnnotationDTOValidator; @@ -27,7 +28,6 @@ import org.alliancegenome.curation_api.services.validation.dto.slotAnnotations.constructSlotAnnotations.ConstructSymbolSlotAnnotationDTOValidator; import org.alliancegenome.curation_api.services.validation.dto.slotAnnotations.constructSlotAnnotations.ConstructSynonymSlotAnnotationDTOValidator; import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.lang3.StringUtils; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -48,25 +48,13 @@ public class ConstructDTOValidator extends ReagentDTOValidator { @Transactional public Construct validateConstructDTO(ConstructDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { - constructResponse = new ObjectResponse(); + constructResponse = new ObjectResponse<>(); Construct construct = new Construct(); - String constructId; - String identifyingField; String uniqueId = ConstructUniqueIdHelper.getConstructUniqueId(dto); - - if (StringUtils.isNotBlank(dto.getModEntityId())) { - constructId = dto.getModEntityId(); - construct.setModEntityId(constructId); - identifyingField = "modEntityId"; - } else if (StringUtils.isNotBlank(dto.getModInternalId())) { - constructId = dto.getModInternalId(); - construct.setModInternalId(constructId); - identifyingField = "modInternalId"; - } else { - constructId = uniqueId; - identifyingField = "uniqueId"; - } + String constructId = UniqueIdentifierHelper.setAnnotationID(dto, construct, uniqueId); + String identifyingField = UniqueIdentifierHelper.getIdentifyingField(dto); + UniqueIdentifierHelper.setObsoleteAndInternal(dto, construct); SearchResponse constructList = constructDAO.findByField(identifyingField, constructId); if (constructList != null && constructList.getResults().size() > 0) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java index 522038733..5d327504b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java @@ -1,17 +1,12 @@ package org.alliancegenome.curation_api.services.validation.dto; -import java.util.ArrayList; -import java.util.List; - +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.DataProviderDAO; -import org.alliancegenome.curation_api.model.entities.BiologicalEntity; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.DiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; import org.alliancegenome.curation_api.model.ingest.dto.DiseaseAnnotationDTO; @@ -25,20 +20,28 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.util.ArrayList; +import java.util.List; @RequestScoped public class DiseaseAnnotationDTOValidator extends AnnotationDTOValidator { - @Inject DoTermService doTermService; - @Inject EcoTermService ecoTermService; - @Inject ReferenceService referenceService; - @Inject VocabularyTermService vocabularyTermService; - @Inject GeneService geneService; - @Inject BiologicalEntityService biologicalEntityService; - @Inject DataProviderDTOValidator dataProviderDtoValidator; - @Inject DataProviderDAO dataProviderDAO; + @Inject + DoTermService doTermService; + @Inject + EcoTermService ecoTermService; + @Inject + ReferenceService referenceService; + @Inject + VocabularyTermService vocabularyTermService; + @Inject + GeneService geneService; + @Inject + BiologicalEntityService biologicalEntityService; + @Inject + DataProviderDTOValidator dataProviderDtoValidator; + @Inject + DataProviderDAO dataProviderDAO; public ObjectResponse validateDiseaseAnnotationDTO(E annotation, D dto) { ObjectResponse daResponse = validateAnnotationDTO(annotation, dto, VocabularyConstants.DISEASE_ANNOTATION_NOTE_TYPES_VOCABULARY_TERM_SET); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDiseaseAnnotationDTOValidator.java index 0b54f7f96..3cc48b120 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDiseaseAnnotationDTOValidator.java @@ -7,16 +7,13 @@ import org.alliancegenome.curation_api.dao.NoteDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.model.ingest.dto.GeneDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.AffectedGenomicModelService; import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.alliancegenome.curation_api.services.helpers.UniqueIdentifierHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationRetrievalHelper; import org.alliancegenome.curation_api.services.helpers.annotations.AnnotationUniqueIdHelper; import org.apache.commons.lang3.StringUtils; @@ -36,7 +33,7 @@ public class GeneDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOValid public GeneDiseaseAnnotation validateGeneDiseaseAnnotationDTO(GeneDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { GeneDiseaseAnnotation annotation = new GeneDiseaseAnnotation(); Gene gene; - ObjectResponse gdaResponse = new ObjectResponse(); + ObjectResponse gdaResponse = new ObjectResponse<>(); ObjectResponse refResponse = validateReference(annotation, dto); gdaResponse.addErrorMessages(refResponse.getErrorMessages()); @@ -51,27 +48,16 @@ public GeneDiseaseAnnotation validateGeneDiseaseAnnotationDTO(GeneDiseaseAnnotat if (gene == null) { gdaResponse.addErrorMessage("gene_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getGeneIdentifier() + ")"); } else { - String annotationId; - String identifyingField; String uniqueId = AnnotationUniqueIdHelper.getDiseaseAnnotationUniqueId(dto, dto.getGeneIdentifier(), refCurie); - - if (StringUtils.isNotBlank(dto.getModEntityId())) { - annotationId = dto.getModEntityId(); - annotation.setModEntityId(annotationId); - identifyingField = "modEntityId"; - } else if (StringUtils.isNotBlank(dto.getModInternalId())) { - annotationId = dto.getModInternalId(); - annotation.setModInternalId(annotationId); - identifyingField = "modInternalId"; - } else { - annotationId = uniqueId; - identifyingField = "uniqueId"; - } + String annotationId = UniqueIdentifierHelper.setAnnotationID(dto, annotation, uniqueId); + String identifyingField = UniqueIdentifierHelper.getIdentifyingField(dto); SearchResponse annotationList = geneDiseaseAnnotationDAO.findByField(identifyingField, annotationId); annotation = AnnotationRetrievalHelper.getCurrentAnnotation(annotation, annotationList); annotation.setUniqueId(uniqueId); annotation.setDiseaseAnnotationSubject(gene); + UniqueIdentifierHelper.setObsoleteAndInternal(dto, annotation); + if (dataProvider != null && (dataProvider.name().equals("RGD") || dataProvider.name().equals("HUMAN")) && !gene.getTaxon().getCurie().equals(dataProvider.canonicalTaxonCurie) || !dataProvider.sourceOrganization.equals(gene.getDataProvider().getSourceOrganization().getAbbreviation())) { @@ -111,4 +97,5 @@ public GeneDiseaseAnnotation validateGeneDiseaseAnnotationDTO(GeneDiseaseAnnotat return annotation; } + } From a1d93d750ada1904c5402149c97e988250d298bc Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 7 Aug 2024 12:49:22 +0100 Subject: [PATCH 098/342] Validation code --- .../constants/VocabularyConstants.java | 4 + .../jobs/executors/Gff3Executor.java | 44 ++++--- .../model/entities/CodingSequence.java | 2 +- .../curation_api/model/entities/Exon.java | 2 +- .../curation_api/model/entities/Gene.java | 2 +- .../model/entities/Transcript.java | 2 +- .../AlleleGeneAssociation.java | 2 +- ...quenceTargetingReagentGeneAssociation.java | 2 +- .../curation_api/services/Gff3Service.java | 24 ++++ .../validation/dto/Gff3DtoValidator.java | 117 ++++++++++++++++++ ...37.0.1__transcript_association_tables.sql} | 10 +- .../curation_api/Gff3BulkUploadITCase.java | 3 + 12 files changed, 188 insertions(+), 26 deletions(-) rename src/main/resources/db/migration/{v0.36.0.6__transcript_association_tables.sql => v0.37.0.1__transcript_association_tables.sql} (92%) 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 11b293783..5a3028a66 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -69,5 +69,9 @@ private VocabularyConstants() { public static final String GENE_EXPRESSION_VOCABULARY = "gene_expression"; public static final String GENE_EXPRESSION_RELATION_TERM = "is_expressed_in"; + + public static final String TRANSCRIPT_RELATION_VOCABULARY = "transcript_relation"; + public static final String TRANSCRIPT_CHILD_TERM= "is_child_of"; + public static final String TRANSCRIPT_PARENT_TERM= "is_parent_of"; } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 794ef80ea..68709051a 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -23,6 +23,9 @@ import org.alliancegenome.curation_api.services.TranscriptService; 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.transcriptAssociations.TranscriptCodingSequenceAssociationService; +import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; +import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; @@ -44,6 +47,9 @@ public class Gff3Executor extends LoadFileExecutor { @Inject ExonGenomicLocationAssociationService exonLocationService; @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; + @Inject TranscriptGeneAssociationService transcriptGeneService; + @Inject TranscriptExonAssociationService transcriptExonService; + @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; public void execLoad(BulkLoadFile bulkLoadFile) { try { @@ -66,14 +72,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - Map> idsAdded = new HashMap>(); - idsAdded.put("Transcript", new ArrayList()); - idsAdded.put("Exon", new ArrayList()); - idsAdded.put("CodingSequence", new ArrayList()); - idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); - idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); - idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); - + Map> idsAdded = createIdsAddedMap(); Map> previousIds = getPreviouslyLoadedIds(dataProvider); BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); @@ -85,6 +84,9 @@ public void execLoad(BulkLoadFile bulkLoadFile) { runCleanup(transcriptLocationService, history, dataProvider.name(), previousIds.get("TranscriptGenomicLocationAssociation"), idsAdded.get("TranscriptGenomicLocationAssociation"), "GFF transcript genomic location association", bulkLoadFile.getMd5Sum()); runCleanup(exonLocationService, history, dataProvider.name(), previousIds.get("ExonGenomicLocationAssociation"), idsAdded.get("ExonGenomicLocationAssociation"), "GFF exon genomic location association", bulkLoadFile.getMd5Sum()); runCleanup(cdsLocationService, history, dataProvider.name(), previousIds.get("CodingSequenceGenomicLocationAssociation"), idsAdded.get("CodingSequenceGenomicLocationAssociation"), "GFF coding sequence genomic location association", bulkLoadFile.getMd5Sum()); + runCleanup(transcriptGeneService, history, dataProvider.name(), previousIds.get("TranscriptGeneAssociation"), idsAdded.get("TranscriptGeneAssociation"), "GFF transcript gene association", bulkLoadFile.getMd5Sum()); + runCleanup(transcriptExonService, history, dataProvider.name(), previousIds.get("TranscriptExonAssociation"), idsAdded.get("TranscriptExonAssociation"), "GFF transcript exon association", bulkLoadFile.getMd5Sum()); + runCleanup(transcriptCdsService, history, dataProvider.name(), previousIds.get("TranscriptCodingSequenceAssociation"), idsAdded.get("TranscriptCodingSequenceAssociation"), "GFF transcript coding sequence association", bulkLoadFile.getMd5Sum()); history.finishLoad(); finalSaveHistory(history); @@ -94,6 +96,21 @@ public void execLoad(BulkLoadFile bulkLoadFile) { } } + private Map> createIdsAddedMap() { + Map> idsAdded = new HashMap>(); + idsAdded.put("Transcript", new ArrayList()); + idsAdded.put("Exon", new ArrayList()); + idsAdded.put("CodingSequence", new ArrayList()); + idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); + idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); + idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); + idsAdded.put("TranscriptGeneAssociation", new ArrayList()); + idsAdded.put("TranscriptExonAssociation", new ArrayList()); + idsAdded.put("TranscriptCodingSequenceAssociation", new ArrayList()); + + return idsAdded; + } + private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { Map> previousIds = new HashMap<>(); @@ -103,6 +120,9 @@ private Map> getPreviouslyLoadedIds(BackendBulkDataProvider d previousIds.put("TranscriptGenomicLocationAssociation", transcriptLocationService.getIdsByDataProvider(dataProvider)); previousIds.put("ExonGenomicLocationAssociation", exonLocationService.getIdsByDataProvider(dataProvider)); previousIds.put("CodingSequenceGenomicLocationAssociation", cdsLocationService.getIdsByDataProvider(dataProvider)); + previousIds.put("TranscriptGeneAssociation", transcriptGeneService.getIdsByDataProvider(dataProvider)); + previousIds.put("TranscriptExonAssociation", transcriptExonService.getIdsByDataProvider(dataProvider)); + previousIds.put("TranscriptCodingSequenceAssociation", transcriptCdsService.getIdsByDataProvider(dataProvider)); return previousIds; @@ -128,13 +148,7 @@ private Map> runLoad(BulkLoadFileHistory history, List gffData) { - Map> idsAdded = new HashMap>(); - idsAdded.put("Transcript", new ArrayList()); - idsAdded.put("Exon", new ArrayList()); - idsAdded.put("CodingSequence", new ArrayList()); - idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); - idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); - idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); + Map> idsAdded = createIdsAddedMap(); BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); runLoad(history, null, gffData, idsAdded, dataProvider, assemblyName); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java index 5c3395cf9..6f943b836 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -35,7 +35,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = "codingSequenceGenomicLocationAssociations", callSuper = true) +@ToString(exclude = {"codingSequenceGenomicLocationAssociations", "transcriptCodingSequenceAssociations"}, callSuper = true) @Schema(name = "CodingSequence", description = "POJO that represents the CodingSequence (CDS)") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table(indexes = {@Index(name = "codingsequence_uniqueid_index", columnList = "uniqueid")}) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java index 9edbc3622..79ea67850 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -35,7 +35,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = "exonGenomicLocationAssociations", callSuper = true) +@ToString(exclude = {"exonGenomicLocationAssociations", "transcriptExonAssociations"}, callSuper = true) @Schema(name = "Exon", description = "POJO that represents the Exon") @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table(indexes = {@Index(name = "exon_uniqueid_index", columnList = "uniqueid")}) 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 6282721d6..e474f129e 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 @@ -39,7 +39,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = { "geneDiseaseAnnotations", "geneGeneAssociations", "geneSymbol", "geneFullName", "geneSystematicName", "geneSynonyms", "geneSecondaryIds", "alleleGeneAssociations", "sequenceTargetingReagentGeneAssociations" }, callSuper = true) +@ToString(exclude = { "geneDiseaseAnnotations", "geneGeneAssociations", "geneSymbol", "geneFullName", "geneSystematicName", "geneSynonyms", "geneSecondaryIds", "alleleGeneAssociations", "sequenceTargetingReagentGeneAssociations", "transcriptGeneAssociations" }, 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") }) 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 6e82c4bc5..e6300403d 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 @@ -30,7 +30,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = "transcriptGenomicLocationAssociations", 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 }) public class Transcript extends GenomicEntity { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java index 9e7e01a3b..ca9e0bf8c 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java @@ -54,6 +54,6 @@ public class AlleleGeneAssociation extends AlleleGenomicEntityAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class, View.AlleleView.class }) - @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations" }) + @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations", "transcriptGeneAssociations" }) private Gene alleleGeneAssociationObject; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java index 836ed15cc..e4a0f5340 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java @@ -63,6 +63,6 @@ public class SequenceTargetingReagentGeneAssociation extends EvidenceAssociation @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations" }) + @JsonIgnoreProperties({ "alleleGeneAssociations", "constructGenomicEntityAssociations", "sequenceTargetingReagentGeneAssociations", "transcriptGeneAssociations" }) private Gene sequenceTargetingReagentGeneAssociationObject; } 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 0de400d57..3f9b75c2e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -20,12 +20,18 @@ 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.transcriptAssociations.TranscriptCodingSequenceAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; 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.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.transcriptAssociations.TranscriptCodingSequenceAssociationService; +import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; +import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; @@ -47,6 +53,9 @@ public class Gff3Service { @Inject ExonGenomicLocationAssociationService exonLocationService; @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; + @Inject TranscriptGeneAssociationService transcriptGeneService; + @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; + @Inject TranscriptExonAssociationService transcriptExonService; @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject Gff3DtoValidator gff3DtoValidator; @@ -126,6 +135,11 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); exonLocationService.addAssociationToSubject(exonLocation); } + TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); + if (transcriptAssociation != null) { + idsAdded.get("TranscriptExonAssociation").add(transcriptAssociation.getId()); + transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); + } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); @@ -138,6 +152,11 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); cdsLocationService.addAssociationToSubject(cdsLocation); } + TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); + if (transcriptAssociation != null) { + idsAdded.get("TranscriptCodingSequenceAssociation").add(transcriptAssociation.getId()); + transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); + } } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); @@ -155,6 +174,11 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); transcriptLocationService.addAssociationToSubject(transcriptLocation); } + TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes); + if (geneAssociation != null) { + idsAdded.get("TranscriptGeneAssociation").add(geneAssociation.getId()); + transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); + } } return idsAdded; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index a89ff1654..3a4975da3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -6,23 +6,32 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.constants.Gff3Constants; import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.dao.TranscriptDAO; import org.alliancegenome.curation_api.dao.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.dao.associations.exonAssociations.ExonGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptCodingSequenceAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptExonAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGeneAssociationDAO; import org.alliancegenome.curation_api.dao.associations.transcriptAssociations.TranscriptGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.dao.ontology.SoTermDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GenomicEntity; import org.alliancegenome.curation_api.model.entities.LocationAssociation; 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.transcriptAssociations.TranscriptCodingSequenceAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptExonAssociation; +import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGeneAssociation; import org.alliancegenome.curation_api.model.entities.associations.transcriptAssociations.TranscriptGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; @@ -30,6 +39,7 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.AssemblyComponentService; import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.GeneService; import org.alliancegenome.curation_api.services.Gff3Service; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; @@ -47,8 +57,12 @@ public class Gff3DtoValidator { @Inject ExonDAO exonDAO; @Inject TranscriptDAO transcriptDAO; @Inject CodingSequenceDAO codingSequenceDAO; + @Inject GeneService geneService; @Inject ExonGenomicLocationAssociationDAO exonLocationDAO; @Inject TranscriptGenomicLocationAssociationDAO transcriptLocationDAO; + @Inject TranscriptGeneAssociationDAO transcriptGeneDAO; + @Inject TranscriptExonAssociationDAO transcriptExonDAO; + @Inject TranscriptCodingSequenceAssociationDAO transcriptCdsDAO; @Inject CodingSequenceGenomicLocationAssociationDAO cdsLocationDAO; @Inject AssemblyComponentService assemblyComponentService; @Inject DataProviderService dataProviderService; @@ -243,6 +257,102 @@ public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO g return transcriptLocationDAO.persist(locationResponse.getEntity()); } + @Transactional + public TranscriptGeneAssociation validateTranscriptGeneAssociation(Gff3DTO gffEntry, Transcript transcript, Map attributes) throws ObjectValidationException { + TranscriptGeneAssociation association = new TranscriptGeneAssociation(); + + ObjectResponse associationResponse = new ObjectResponse(); + if (!attributes.containsKey("Parent")) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.REQUIRED_MESSAGE); + } else { + Gene parentGene = geneService.findByIdentifierString(attributes.get("Parent")); + if (parentGene == null) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); + } else { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", transcript.getId()); + params.put("transcriptGeneAssociationObject.id", parentGene.getId()); + SearchResponse searchResponse = transcriptGeneDAO.findByParams(params); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + association = searchResponse.getSingleResult(); + } + association.setTranscriptGeneAssociationObject(parentGene); + } + } + association.setTranscriptAssociationSubject(transcript); + association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.TRANSCRIPT_RELATION_VOCABULARY, VocabularyConstants.TRANSCRIPT_CHILD_TERM).getEntity()); + + if (associationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, associationResponse.errorMessagesString()); + } + + return transcriptGeneDAO.persist(association); + } + + @Transactional + public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssociation(Gff3DTO gffEntry, CodingSequence cds, Map attributes) throws ObjectValidationException { + TranscriptCodingSequenceAssociation association = new TranscriptCodingSequenceAssociation(); + + ObjectResponse associationResponse = new ObjectResponse(); + if (!attributes.containsKey("Parent")) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.REQUIRED_MESSAGE); + } else { + SearchResponse parentTranscriptSearch = transcriptDAO.findByField("modInternalId", attributes.get("Parent")); + if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); + } else { + Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", parentTranscript.getId()); + params.put("transcriptCodingSequenceAssociationObject.id", cds.getId()); + SearchResponse searchResponse = transcriptCdsDAO.findByParams(params); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + association = searchResponse.getSingleResult(); + } + association.setTranscriptAssociationSubject(parentTranscript); + } + } + association.setTranscriptCodingSequenceAssociationObject(cds); + association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.TRANSCRIPT_RELATION_VOCABULARY, VocabularyConstants.TRANSCRIPT_PARENT_TERM).getEntity()); + + if (associationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, associationResponse.errorMessagesString()); + } + + return transcriptCdsDAO.persist(association); + } + + @Transactional + public TranscriptExonAssociation validateTranscriptExonAssociation(Gff3DTO gffEntry, Exon exon, Map attributes) throws ObjectValidationException { + TranscriptExonAssociation association = new TranscriptExonAssociation(); + + ObjectResponse associationResponse = new ObjectResponse(); + if (!attributes.containsKey("Parent")) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.REQUIRED_MESSAGE); + } else { + SearchResponse parentTranscriptSearch = transcriptDAO.findByField("modInternalId", attributes.get("Parent")); + if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); + } else { + Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); + params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", parentTranscript.getId()); + params.put("transcriptExonAssociationObject.id", exon.getId()); + SearchResponse searchResponse = transcriptExonDAO.findByParams(params); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + association = searchResponse.getSingleResult(); + } + association.setTranscriptAssociationSubject(parentTranscript); + } + } + association.setTranscriptExonAssociationObject(exon); + association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.TRANSCRIPT_RELATION_VOCABULARY, VocabularyConstants.TRANSCRIPT_PARENT_TERM).getEntity()); + + if (associationResponse.hasErrors()) { + throw new ObjectValidationException(gffEntry, associationResponse.errorMessagesString()); + } + + return transcriptExonDAO.persist(association); + } + private ObjectResponse validateLocationAssociation(E association, Gff3DTO dto, AssemblyComponent assemblyComponent) { ObjectResponse associationResponse = new ObjectResponse(); @@ -276,5 +386,12 @@ private ObjectResponse validateLocationAssoci return associationResponse; } + + private ObjectResponse validateParent(E association, Map attributes) { + ObjectResponse associationResponse = new ObjectResponse(); + + + return associationResponse; + } } diff --git a/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql b/src/main/resources/db/migration/v0.37.0.1__transcript_association_tables.sql similarity index 92% rename from src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql rename to src/main/resources/db/migration/v0.37.0.1__transcript_association_tables.sql index b1cdc7024..c8207dedf 100644 --- a/src/main/resources/db/migration/v0.36.0.6__transcript_association_tables.sql +++ b/src/main/resources/db/migration/v0.37.0.1__transcript_association_tables.sql @@ -69,8 +69,8 @@ CREATE INDEX transcriptgeneassociation_object_index ON transcriptgeneassociation INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Transcript Relation', 'transcript_relation'); -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'parent_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; -INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'child_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'is_parent_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'is_child_of', id FROM vocabulary WHERE vocabularylabel = 'transcript_relation'; INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) SELECT nextval('vocabularytermset_seq'), 'Transcript CodingSequence Association Relation', 'transcript_coding_sequence_relation', id FROM vocabulary @@ -87,7 +87,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_coding_sequence_relation' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'is_parent_of' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) @@ -98,7 +98,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_exon_relation' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'parent_of' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'is_parent_of' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) @@ -109,7 +109,7 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms SELECT id FROM vocabularytermset WHERE vocabularylabel = 'transcript_gene_relation' ), t2 AS ( - SELECT id FROM vocabularyterm WHERE name = 'child_of' AND vocabulary_id = ( + SELECT id FROM vocabularyterm WHERE name = 'is_child_of' AND vocabulary_id = ( SELECT id FROM vocabulary WHERE vocabularylabel = 'transcript_relation' ) ) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 5ea4d9709..3baa72b5b 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -4,6 +4,7 @@ import static org.hamcrest.Matchers.hasSize; import org.alliancegenome.curation_api.base.BaseITCase; +import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.resources.TestContainerResource; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -51,6 +52,8 @@ private void loadRequiredEntities() throws Exception { createSoTerm("SO:0001035", "piRNA", false); createSoTerm("SO:0000147", "exon", false); createSoTerm("SO:0000316", "CDS", false); + createGene("WB:WBGene00022276", "NCBITaxon:6239", false, getVocabularyTerm( + getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY), "nomenclature_symbol")); } @Test From 03ae315b67f68e36113abfabc2e1c8633a8ae394 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 7 Aug 2024 10:34:58 -0600 Subject: [PATCH 099/342] Removed indexing from failing annotations --- .../curation_api/model/entities/AGMPhenotypeAnnotation.java | 3 +-- .../curation_api/model/entities/AllelePhenotypeAnnotation.java | 3 +-- .../curation_api/model/entities/GenePhenotypeAnnotation.java | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java index a4b288a67..605bfdc0e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java @@ -9,7 +9,6 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -27,7 +26,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java index ddee7fca3..5fbb7f3d8 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java @@ -9,7 +9,6 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -27,7 +26,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java index ad9fc2d83..a22dcf91a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -21,7 +20,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) From e927f5dbe3dc8391e2000ff64b8e258196cf57a0 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 7 Aug 2024 21:43:53 +0100 Subject: [PATCH 100/342] Add GFF association integration tests --- .../curation_api/Gff3BulkUploadITCase.java | 31 ++++++++++++++++++- .../ER_03_empty_transcript_parent.json | 16 ++++++++++ .../08_gff_data/ER_04_empty_exon_parent.json | 14 +++++++++ .../08_gff_data/ER_05_empty_cds_parent.json | 15 +++++++++ .../IV_03_invalid_transcript_parent.json | 16 ++++++++++ .../IV_04_invalid_exon_parent.json | 14 +++++++++ .../08_gff_data/IV_05_invalid_cds_parent.json | 15 +++++++++ .../MR_05_no_transcript_parent.json | 15 +++++++++ .../fms/08_gff_data/MR_06_no_exon_parent.json | 13 ++++++++ .../fms/08_gff_data/MR_07_no_cds_parent.json | 14 +++++++++ 10 files changed, 162 insertions(+), 1 deletion(-) create mode 100644 src/test/resources/bulk/fms/08_gff_data/ER_03_empty_transcript_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/ER_04_empty_exon_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/ER_05_empty_cds_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/IV_03_invalid_transcript_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/IV_05_invalid_cds_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_05_no_transcript_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json create mode 100644 src/test/resources/bulk/fms/08_gff_data/MR_07_no_cds_parent.json diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 3baa72b5b..9d7b3d687 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -80,7 +80,10 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { body("entity.transcriptGenomicLocationAssociations[0].start", is(1)). body("entity.transcriptGenomicLocationAssociations[0].end", is(1000)). body("entity.transcriptGenomicLocationAssociations[0].phase", is(0)). - body("entity.transcriptGenomicLocationAssociations[0].strand", is("+")); + body("entity.transcriptGenomicLocationAssociations[0].strand", is("+")). + body("entity.transcriptGeneAssociations", hasSize(1)). + body("entity.transcriptGeneAssociations[0].relation.name", is("is_child_of")). + body("entity.transcriptGeneAssociations[0].transcriptGeneAssociationObject.modEntityId", is("WB:WBGene00022276")); } @@ -105,6 +108,14 @@ public void gff3DataBulkUploadExonEntity() throws Exception { body("entity.exonGenomicLocationAssociations[0].end", is(100)). body("entity.exonGenomicLocationAssociations[0].strand", is("+")); + RestAssured.given(). + when(). + get(transcriptGetEndpoint + transcriptId). + then(). + statusCode(200). + body("entity.transcriptExonAssociations", hasSize(1)). + body("entity.transcriptExonAssociations[0].relation.name", is("is_parent_of")). + body("entity.transcriptExonAssociations[0].transcriptExonAssociationObject.uniqueId", is(exonUniqueId)); } @Test @@ -129,6 +140,15 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { body("entity.codingSequenceGenomicLocationAssociations[0].phase", is(1)). body("entity.codingSequenceGenomicLocationAssociations[0].strand", is("+")); + RestAssured.given(). + when(). + get(transcriptGetEndpoint + transcriptId). + then(). + statusCode(200). + body("entity.transcriptCodingSequenceAssociations", hasSize(1)). + body("entity.transcriptCodingSequenceAssociations[0].relation.name", is("is_parent_of")). + body("entity.transcriptCodingSequenceAssociations[0].transcriptCodingSequenceAssociationObject.uniqueId", is(cdsUniqueId)); + } @Test @@ -164,6 +184,9 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 3, 1, 2); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 3, 1, 2); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", 3, 1, 2); } @Test @@ -171,6 +194,9 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 3, 1, 2); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", 3, 1, 2); } @Test @@ -178,6 +204,9 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { public void gff3DataBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 3, 1, 2); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", 3, 1, 2); } } diff --git a/src/test/resources/bulk/fms/08_gff_data/ER_03_empty_transcript_parent.json b/src/test/resources/bulk/fms/08_gff_data/ER_03_empty_transcript_parent.json new file mode 100644 index 000000000..3e262c924 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/ER_03_empty_transcript_parent.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/ER_04_empty_exon_parent.json b/src/test/resources/bulk/fms/08_gff_data/ER_04_empty_exon_parent.json new file mode 100644 index 000000000..7be8e5a63 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/ER_04_empty_exon_parent.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "exon", + "start": 1, + "end": 100, + "strand": "+", + "attributes": [ + "ID=Exon:Y74C9A.2a_exon", + "Parent=" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/ER_05_empty_cds_parent.json b/src/test/resources/bulk/fms/08_gff_data/ER_05_empty_cds_parent.json new file mode 100644 index 000000000..3664e5b32 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/ER_05_empty_cds_parent.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "CDS", + "start": 10, + "end": 100, + "strand": "+", + "phase": 1, + "attributes": [ + "ID=CDS:Y74C9A.2a", + "Parent=" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_03_invalid_transcript_parent.json b/src/test/resources/bulk/fms/08_gff_data/IV_03_invalid_transcript_parent.json new file mode 100644 index 000000000..8d524dd08 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/IV_03_invalid_transcript_parent.json @@ -0,0 +1,16 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Parent=Gene:Invalid", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json b/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json new file mode 100644 index 000000000..f916191ad --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "exon", + "start": 1, + "end": 100, + "strand": "+", + "attributes": [ + "ID=Exon:Y74C9A.2a_exon", + "Parent=Transcript:Invalid" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_05_invalid_cds_parent.json b/src/test/resources/bulk/fms/08_gff_data/IV_05_invalid_cds_parent.json new file mode 100644 index 000000000..122837faf --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/IV_05_invalid_cds_parent.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "CDS", + "start": 10, + "end": 100, + "strand": "+", + "phase": 1, + "attributes": [ + "ID=CDS:Y74C9A.2a", + "Parent=Transcript:Invalid" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_05_no_transcript_parent.json b/src/test/resources/bulk/fms/08_gff_data/MR_05_no_transcript_parent.json new file mode 100644 index 000000000..123f5e739 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_05_no_transcript_parent.json @@ -0,0 +1,15 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "mRNA", + "start": 1, + "end": 1000, + "strand": "+", + "phase": 0, + "attributes": [ + "ID=Transcript:Y74C9A.2a.1", + "Name=Y74C9A.2a.1" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json b/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json new file mode 100644 index 000000000..23734f7ee --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json @@ -0,0 +1,13 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "exon", + "start": 1, + "end": 100, + "strand": "+", + "attributes": [ + "ID=Exon:Y74C9A.2a_exon" + ] + } +] diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_07_no_cds_parent.json b/src/test/resources/bulk/fms/08_gff_data/MR_07_no_cds_parent.json new file mode 100644 index 000000000..a50ccf660 --- /dev/null +++ b/src/test/resources/bulk/fms/08_gff_data/MR_07_no_cds_parent.json @@ -0,0 +1,14 @@ +[ + { + "seqId": "I", + "source": "WormBase", + "type": "CDS", + "start": 10, + "end": 100, + "strand": "+", + "phase": 1, + "attributes": [ + "ID=CDS:Y74C9A.2a" + ] + } +] From 0a3c469c02c02c3ec7afae08571a12e2ab640e02 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 8 Aug 2024 14:21:10 +0100 Subject: [PATCH 101/342] Handle multiple parents and non-curie IDs --- .../jobs/executors/Gff3Executor.java | 65 ++++++++++++++----- .../curation_api/services/Gff3Service.java | 26 ++++++-- .../validation/dto/Gff3DtoValidator.java | 5 +- 3 files changed, 75 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 68709051a..b2f15c9ab 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -27,7 +27,9 @@ import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; 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; @@ -67,17 +69,18 @@ public void execLoad(BulkLoadFile bulkLoadFile) { } } gffData.subList(0, gffHeaderData.size()).clear(); - BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + Map> idsAdded = createIdsAddedMap(); Map> previousIds = getPreviouslyLoadedIds(dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 2) + 1); createHistory(history, bulkLoadFile); - idsAdded = runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider); + idsAdded = runLoad(history, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); @@ -128,12 +131,12 @@ private Map> getPreviouslyLoadedIds(BackendBulkDataProvider d return previousIds; } - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider) { return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); } - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List gffData, + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); @@ -143,15 +146,19 @@ private Map> runLoad(BulkLoadFileHistory history, List gffData) { Map> idsAdded = createIdsAddedMap(); - BulkLoadFileHistory history = new BulkLoadFileHistory((gffData.size() * 2) + 1); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - runLoad(history, null, gffData, idsAdded, dataProvider, assemblyName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 2) + 1); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); @@ -175,11 +182,11 @@ private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory histo return assemblyName; } - private Map> loadEntities(BulkLoadFileHistory history, List gffData, Map> idsAdded, + private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - for (Gff3DTO gff3Entry : gffData) { + for (ImmutablePair> gff3EntryPair : gffData) { try { - idsAdded = gff3Service.loadEntity(history, gff3Entry, idsAdded, dataProvider); + idsAdded = gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -187,7 +194,7 @@ private Map> loadEntities(BulkLoadFileHistory history, List> loadEntities(BulkLoadFileHistory history, List> loadAssociations(BulkLoadFileHistory history, List gffData, Map> idsAdded, + private Map> loadAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, ProcessDisplayHelper ph) { - for (Gff3DTO gff3Entry : gffData) { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData, dataProvider); + + for (ImmutablePair> gff3EntryPair : gffData) { try { - idsAdded = gff3Service.loadAssociations(history, gff3Entry, idsAdded, dataProvider, assemblyId); + idsAdded = gff3Service.loadAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -208,7 +217,7 @@ private Map> loadAssociations(BulkLoadFileHistory history, Li } catch (Exception e) { e.printStackTrace(); history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gff3Entry, e.getMessage(), e.getStackTrace())); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); } updateHistory(history); ph.progressProcess(); @@ -216,4 +225,30 @@ private Map> loadAssociations(BulkLoadFileHistory history, Li return idsAdded; } + + private List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { + List>> processedGffData = new ArrayList<>(); + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF pre-processing for " + dataProvider.name(), gffData.size()); + + for (Gff3DTO originalGffEntry : gffData) { + Map attributes = Gff3AttributesHelper.getAttributes(originalGffEntry, dataProvider); + if (attributes.containsKey("Parent") && attributes.get("Parent").indexOf(",") > -1) { + for (String parent : attributes.get("Parent").split(",")) { + HashMap attributesCopy = new HashMap<>(); + attributesCopy.putAll(attributes); + attributesCopy.put("Parent", parent); + processedGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); + } + } else { + processedGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); + } + ph.progressProcess(); + } + ph.finishProcess(); + + return processedGffData; + } } 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 3f9b75c2e..719c7d03b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -1,5 +1,6 @@ package org.alliancegenome.curation_api.services; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -37,7 +38,9 @@ import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -92,7 +95,8 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData } } - public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Map> loadEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, dataProvider); if (exon != null) { @@ -116,12 +120,13 @@ public Map> loadEntity(BulkLoadFileHistory history, Gff3DTO g } @Transactional - public Map> loadAssociations(BulkLoadFileHistory history, Gff3DTO gffEntry, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ObjectUpdateException { + public Map> loadAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - Map attributes = Gff3AttributesHelper.getAttributes(gffEntry, dataProvider); if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); @@ -174,7 +179,7 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); transcriptLocationService.addAssociationToSubject(transcriptLocation); } - TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes); + TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes, geneIdCurieMap); if (geneAssociation != null) { idsAdded.get("TranscriptGeneAssociation").add(geneAssociation.getId()); transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); @@ -183,5 +188,18 @@ public Map> loadAssociations(BulkLoadFileHistory history, Gff return idsAdded; } + + public Map getIdCurieMap(List>> gffData, BackendBulkDataProvider dataProvider) { + Map geneIdCurieMap = new HashMap<>(); + + for (ImmutablePair> gffEntryPair : gffData) { + Map attributes = gffEntryPair.getValue(); + if (attributes.containsKey("ID") && attributes.containsKey("gene_id")) { + geneIdCurieMap.put(attributes.get("ID"), attributes.get("gene_id")); + } + } + + return geneIdCurieMap; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 3a4975da3..d04275639 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -258,14 +258,15 @@ public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO g } @Transactional - public TranscriptGeneAssociation validateTranscriptGeneAssociation(Gff3DTO gffEntry, Transcript transcript, Map attributes) throws ObjectValidationException { + public TranscriptGeneAssociation validateTranscriptGeneAssociation(Gff3DTO gffEntry, Transcript transcript, Map attributes, Map geneIdCurieMap) throws ObjectValidationException { TranscriptGeneAssociation association = new TranscriptGeneAssociation(); ObjectResponse associationResponse = new ObjectResponse(); if (!attributes.containsKey("Parent")) { associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.REQUIRED_MESSAGE); } else { - Gene parentGene = geneService.findByIdentifierString(attributes.get("Parent")); + String geneCurie = geneIdCurieMap.containsKey(attributes.get("Parent")) ? geneIdCurieMap.get(attributes.get("Parent")) : attributes.get("Parent"); + Gene parentGene = geneService.findByIdentifierString(geneCurie); if (parentGene == null) { associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); } else { From 3791ac2436502fbebf594dbe182a210a68edeea3 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 9 Aug 2024 13:08:13 +0100 Subject: [PATCH 102/342] SCRUM-3953: ignore the entry -Other- for Uberon terms --- ...neExpressionAnnotationFmsDTOValidator.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 11289121f..6b4f4ac8c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -250,11 +250,13 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD List anatomicalStructureUberonSlimTermIds = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureUberonSlimTermIds(); List uberonTerms = new ArrayList<>(); for (UberonSlimTermDTO uberonSlimTermDTO: anatomicalStructureUberonSlimTermIds) { - UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); - if (uberonTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); - } else { - uberonTerms.add(uberonTerm); + if (!uberonSlimTermDTO.getUberonTerm().equals("Other")) { + UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); + if (uberonTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); + } else { + uberonTerms.add(uberonTerm); + } } } anatomicalSite.setAnatomicalStructureUberonTerms(uberonTerms); @@ -264,11 +266,13 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD List anatomicalSubStructureUberonSlimTermIds = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureUberonSlimTermIds(); List uberonTerms = new ArrayList<>(); for (UberonSlimTermDTO uberonSlimTermDTO : anatomicalSubStructureUberonSlimTermIds) { - UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); - if (uberonTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); - } else { - uberonTerms.add(uberonTerm); + if (!uberonSlimTermDTO.getUberonTerm().equals("Other")) { + UBERONTerm uberonTerm = uberonTermService.getByCurie(uberonSlimTermDTO.getUberonTerm()).getEntity(); + if (uberonTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureUberonSlimTermId", ValidationConstants.INVALID_MESSAGE + " (" + uberonSlimTermDTO.getUberonTerm() + ")"); + } else { + uberonTerms.add(uberonTerm); + } } } anatomicalSite.setAnatomicalSubstructureUberonTerms(uberonTerms); From 926b1a581a71839e31f243880c0cee9915ef5d16 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 12 Aug 2024 18:14:39 -0500 Subject: [PATCH 103/342] Added code to load ExternalDatabaseEntity --- .../dao/ExternalDataBaseEntityDAO.java | 14 +++ .../HTPExpressionDatasetAnnotationDAO.java | 14 +++ .../jobs/executors/BulkLoadJobExecutor.java | 3 + ...TPExpressionDatasetAnnotationExecutor.java | 85 ++++++++++++++ .../HTPExpressionDatasetAnnotationFmsDTO.java | 22 ++++ ...pressionDatasetAnnotationIngestFmsDTO.java | 15 +++ .../model/ingest/dto/fms/HTPIdFmsDTO.java | 18 +++ .../ExternalDataBaseEntityService.java | 31 +++++ ...HTPExpressionDatasetAnnotationService.java | 31 +++++ .../fms/CrossReferenceFmsDTOValidator.java | 52 ++++++++ ...ExternalDataBaseEntityFmsDTOValidator.java | 111 ++++++++++++++++++ ...ssionDatasetAnnotationFmsDTOValidator.java | 17 +++ 12 files changed, 413 insertions(+) create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetAnnotationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java new file mode 100644 index 000000000..d202ee62d --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.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.ExternalDataBaseEntity; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class ExternalDataBaseEntityDAO extends BaseSQLDAO { + + protected ExternalDataBaseEntityDAO() { + super(ExternalDataBaseEntity.class); + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetAnnotationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetAnnotationDAO.java new file mode 100644 index 000000000..35d7d823a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/HTPExpressionDatasetAnnotationDAO.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.HTPExpressionDatasetAnnotation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class HTPExpressionDatasetAnnotationDAO extends BaseSQLDAO { + + protected HTPExpressionDatasetAnnotationDAO() { + super(HTPExpressionDatasetAnnotation.class); + } +} 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 2c1728e20..c2b03efa7 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 @@ -52,6 +52,7 @@ public class BulkLoadJobExecutor { @Inject GeneExpressionExecutor geneExpressionExecutor; @Inject SequenceTargetingReagentExecutor sqtrExecutor; @Inject Gff3Executor gff3Executor; + @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor; public void process(BulkLoadFile bulkLoadFile, Boolean cleanUp) throws Exception { @@ -117,6 +118,8 @@ public void process(BulkLoadFile bulkLoadFile, Boolean cleanUp) throws Exception geneExpressionExecutor.execLoad(bulkLoadFile); } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF) { gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) { + htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFile); } else { log.info("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); throw new Exception("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java new file mode 100644 index 000000000..2bbd2eef3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -0,0 +1,85 @@ +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.HTPExpressionDatasetAnnotationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; +import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationIngestFmsDTO; +import org.alliancegenome.curation_api.services.ExternalDataBaseEntityService; +import org.alliancegenome.curation_api.services.HTPExpressionDatasetAnnotationService; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class HTPExpressionDatasetAnnotationExecutor extends LoadFileExecutor { + + @Inject ExternalDataBaseEntityService externalDataBaseEntityService; + @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; + @Inject HTPExpressionDatasetAnnotationService htpExpressionDatasetAnnotationService; + @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; + + public void execLoad(BulkLoadFile bulkLoadFile) { + try { + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + + HTPExpressionDatasetAnnotationIngestFmsDTO htpExpressionDatasetData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), HTPExpressionDatasetAnnotationIngestFmsDTO.class); + bulkLoadFile.setRecordCount(htpExpressionDatasetData.getData().size()); + + AGRCurationSchemaVersion version = HTPExpressionDatasetAnnotation.class.getAnnotation(AGRCurationSchemaVersion.class); + bulkLoadFile.setLinkMLSchemaVersion(version.max()); + if (htpExpressionDatasetData.getMetaData() != null && StringUtils.isNotBlank(htpExpressionDatasetData.getMetaData().getRelease())) { + bulkLoadFile.setAllianceMemberReleaseVersion(htpExpressionDatasetData.getMetaData().getRelease()); + } + + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); + + bulkLoadFileDAO.merge(bulkLoadFile); + List datasetIdsLoaded = new ArrayList<>(); + BulkLoadFileHistory history = new BulkLoadFileHistory(htpExpressionDatasetData.getData().size()); + createHistory(history, bulkLoadFile); + Boolean result = runLoaddatasetid(externalDataBaseEntityService, history, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); + } catch (Exception e) { + failLoad(bulkLoadFile, e); + e.printStackTrace(); + } + } + + private boolean runLoaddatasetid(ExternalDataBaseEntityService externalDataBaseEntityService, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List htpDatasetData, List datasetIdsLoaded, boolean isUpdate) { + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("External Database Entity DTO Update for " + dataProvider.name(), htpDatasetData.size()); + for (HTPExpressionDatasetAnnotationFmsDTO dto : htpDatasetData) { + try{ + ExternalDataBaseEntity dbObject = externalDataBaseEntityService.upsert(dto.getDatasetId(), dataProvider); + history.incrementCompleted(); + if (datasetIdsLoaded != null) { + datasetIdsLoaded.add(dbObject.getId()); + } + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + } + ph.finishProcess(); + return true; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java new file mode 100644 index 000000000..f92aea682 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java @@ -0,0 +1,22 @@ +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 HTPExpressionDatasetAnnotationFmsDTO extends BaseDTO{ + + private HTPIdFmsDTO datasetId; + private List publications; + private String title; + private String summary; + private Integer numChannels; + private List subSeries; + private String dateAssigned; + private List categoryTags; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java new file mode 100644 index 000000000..9e48e2739 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.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 HTPExpressionDatasetAnnotationIngestFmsDTO extends BaseDTO{ + + private MetaDataFmsDTO metaData; + private List data; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java new file mode 100644 index 000000000..84ed3ed9b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java @@ -0,0 +1,18 @@ +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 HTPIdFmsDTO extends BaseDTO { + + private String primaryId; + private List alternateIds; + private CrossReferenceFmsDTO preferredCrossReference; + private List crossReferences; +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java new file mode 100644 index 000000000..78b05a25a --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java @@ -0,0 +1,31 @@ +package org.alliancegenome.curation_api.services; + +import org.alliancegenome.curation_api.dao.ExternalDataBaseEntityDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; +import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPIdFmsDTO; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.fms.ExternalDataBaseEntityFmsDTOValidator; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class ExternalDataBaseEntityService extends BaseEntityCrudService implements BaseUpsertServiceInterface { + + @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; + @Inject ExternalDataBaseEntityFmsDTOValidator externalDataBaseEntityFmsDtoValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(externalDataBaseEntityDAO); + } + + public ExternalDataBaseEntity upsert(HTPIdFmsDTO htpIdData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + return externalDataBaseEntityFmsDtoValidator.validateExternalDataBaseEntityFmsDTO(htpIdData); + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java new file mode 100644 index 000000000..fad8d45de --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java @@ -0,0 +1,31 @@ +package org.alliancegenome.curation_api.services; + +import org.alliancegenome.curation_api.dao.HTPExpressionDatasetAnnotationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; +import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.fms.HTPExpressionDatasetAnnotationFmsDTOValidator; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class HTPExpressionDatasetAnnotationService extends BaseEntityCrudService implements BaseUpsertServiceInterface { + + @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; + @Inject HTPExpressionDatasetAnnotationFmsDTOValidator htpExpressionDatasetAnnotationFmsDtoValidator; + + @Override + @PostConstruct + protected void init() { + setSQLDao(htpExpressionDatasetAnnotationDAO); + } + + public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + return htpExpressionDatasetAnnotationFmsDtoValidator.validateHTPExpressionDatasetAnnotationFmsDTO(htpExpressionDatasetAnnotationData); + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java new file mode 100644 index 000000000..274b3976b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java @@ -0,0 +1,52 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import java.util.ArrayList; +import java.util.List; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +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.ObjectListResponse; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.ResourceDescriptorPageService; +import org.apache.commons.collections.CollectionUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class CrossReferenceFmsDTOValidator { + + @Inject ResourceDescriptorPageService resourceDescriptorPageService; + + public ObjectListResponse validateCrossReferenceFmsDTO(CrossReferenceFmsDTO dto) throws ObjectValidationException{ + List xrefs = new ArrayList<>(); + ObjectListResponse crResponse = new ObjectListResponse<>(); + if (CollectionUtils.isNotEmpty(dto.getPages())) { + String prefix = getPrefix(dto.getId()); + for(String xrefPage : dto.getPages()) { + CrossReference xref = new CrossReference(); + ResourceDescriptorPage rdp = resourceDescriptorPageService.getPageForResourceDescriptor(prefix, xrefPage); + if (rdp == null) { + crResponse.addErrorMessage("page", ValidationConstants.INVALID_MESSAGE + " (" + xrefPage + ")"); + } + else { + xref.setReferencedCurie(dto.getId()); + xref.setResourceDescriptorPage(rdp); + } + xrefs.add(xref); + } + crResponse.setEntities(xrefs); + } else { + crResponse.addErrorMessage("page", ValidationConstants.REQUIRED_MESSAGE); + } + return crResponse; + } + + private String getPrefix(String id){ + return id.indexOf(":") == -1 ? id : id.substring(0, id.indexOf(":")); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java new file mode 100644 index 000000000..3b3a29aff --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -0,0 +1,111 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.dao.CrossReferenceDAO; +import org.alliancegenome.curation_api.dao.ExternalDataBaseEntityDAO; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; +import org.alliancegenome.curation_api.model.ingest.dto.fms.CrossReferenceFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPIdFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.CrossReferenceService; +import org.alliancegenome.curation_api.services.ExternalDataBaseEntityService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@RequestScoped +public class ExternalDataBaseEntityFmsDTOValidator { + + @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; + @Inject ExternalDataBaseEntityService externalDataBaseEntityService; + @Inject CrossReferenceDAO crossReferenceDAO; + @Inject CrossReferenceService crossReferenceService; + + @Transactional + public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO dto) throws ObjectValidationException,ObjectUpdateException { + + ObjectResponse externalDBEntityResponse = new ObjectResponse<>(); + ExternalDataBaseEntity externalDBEntity = null; + + if(StringUtils.isEmpty(dto.getPrimaryId())) { + externalDBEntityResponse.addErrorMessage("primaryId", ValidationConstants.REQUIRED_MESSAGE); + } else { + externalDBEntity = externalDataBaseEntityService.findByCurie(dto.getPrimaryId()); + } + + if(externalDBEntity == null) { + externalDBEntity = new ExternalDataBaseEntity(); + externalDBEntity.setCurie(dto.getPrimaryId()); + } + + if(CollectionUtils.isNotEmpty(dto.getAlternateIds())) { + if(externalDBEntity.getSecondaryIdentifiers() == null) { + externalDBEntity.setSecondaryIdentifiers(new ArrayList<>()); + } + Set existingSecondaryIds = new HashSet<>(externalDBEntity.getSecondaryIdentifiers()); + Set incomingAlternateIds = new HashSet<>(dto.getAlternateIds()); + + existingSecondaryIds.retainAll(incomingAlternateIds); + existingSecondaryIds.addAll(incomingAlternateIds); + externalDBEntity.setSecondaryIdentifiers(new ArrayList<>(existingSecondaryIds)); + } + + List currentXrefIds; + if (externalDBEntity.getCrossReferences() == null) { + currentXrefIds = new ArrayList<>(); + } else { + currentXrefIds = externalDBEntity.getCrossReferences().stream().map(CrossReference::getId).collect(Collectors.toList()); + } + + List mergedXrefIds; + if(CollectionUtils.isNotEmpty(dto.getCrossReferences())) { + List mergedCrossReferences = crossReferenceService.getMergedFmsXrefList(dto.getCrossReferences(), externalDBEntity.getCrossReferences()); + mergedXrefIds = mergedCrossReferences.stream().map(CrossReference::getId).collect(Collectors.toList()); + externalDBEntity.setCrossReferences(mergedCrossReferences); + } else { + mergedXrefIds = new ArrayList<>(); + externalDBEntity.setCrossReferences(null); + } + + // CrossReference xref = new CrossReference(); + // if(dto.getPreferredCrossReference() != null) { + // if(dto.getPreferredCrossReference().getPages().size() == 1) { + // List incomingXrefDto = new ArrayList<>(); + // incomingXrefDto.add(dto.getPreferredCrossReference()); + // List existingXReferences = new ArrayList<>(); + // existingXReferences.add(externalDBEntity.getPreferredCrossReference()); + // List preferredXReferences = crossReferenceService.getMergedFmsXrefList(incomingXrefDto, existingXReferences); + // xref = preferredXReferences.get(0); + // externalDBEntity.setPreferredCrossReference(xref); + // } else { + // externalDBEntityResponse.addErrorMessage("preferredCrossReference.pages", ValidationConstants.INVALID_MESSAGE + " Only one page is allowed"); + // } + // } + + externalDataBaseEntityDAO.persist(externalDBEntity); + + for (Long currentId : currentXrefIds) { + if (!mergedXrefIds.contains(currentId)) { + System.out.println("Removing CrossReference with ID: " + crossReferenceDAO.find(currentId).getId()); + crossReferenceDAO.remove(currentId); + } + } + + if(externalDBEntityResponse.hasErrors()) { + throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); + } + return externalDBEntity; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java new file mode 100644 index 000000000..35637d71c --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -0,0 +1,17 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; +import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.transaction.Transactional; + +@RequestScoped +public class HTPExpressionDatasetAnnotationFmsDTOValidator { + + @Transactional + public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException{ + return null; + } +} From 5e593b8c4069ad7626bf700f60a058a5f2d77aed Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 13 Aug 2024 09:08:42 +0100 Subject: [PATCH 104/342] Load parent/child associations separately from location --- .../curation_api/constants/Gff3Constants.java | 3 +- .../jobs/executors/Gff3Executor.java | 46 +++++++++-- .../curation_api/services/Gff3Service.java | 76 ++++++++++++++----- .../helpers/gff3/Gff3AttributesHelper.java | 38 +++++----- .../validation/dto/Gff3DtoValidator.java | 11 +-- .../curation_api/Gff3BulkUploadITCase.java | 42 +++++----- .../bulk/fms/08_gff_data/GFF_02_exon.json | 2 +- .../IV_04_invalid_exon_parent.json | 2 +- .../fms/08_gff_data/MR_06_no_exon_parent.json | 2 +- 9 files changed, 147 insertions(+), 75 deletions(-) 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 1c7a78891..9ecf6976c 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/Gff3Constants.java @@ -11,7 +11,8 @@ private Gff3Constants() { 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", "snoRNA_gene", "pseudogenic_transcript", "lnc_RNA" + "pseudogene_attribute", "pseudogenic_transcript", "lnc_RNA", "nc_primary_transcript", + "circular_ncRNA" ); public static final List STRANDS = List.of("+", "-"); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index b2f15c9ab..1b543ee4a 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -36,6 +36,7 @@ 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; @@ -78,7 +79,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { Map> idsAdded = createIdsAddedMap(); Map> previousIds = getPreviouslyLoadedIds(dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 2) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); createHistory(history, bulkLoadFile); idsAdded = runLoad(history, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); @@ -141,11 +142,15 @@ private Map> runLoad(BulkLoadFileHistory history, List geneIdCurieMap = gff3Service.getIdCurieMap(gffData, dataProvider); + + idsAdded = loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + idsAdded = loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); ph.finishProcess(); @@ -156,7 +161,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List Map> idsAdded = createIdsAddedMap(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 2) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); @@ -203,13 +208,34 @@ private Map> loadEntities(BulkLoadFileHistory history, List> loadAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, - BackendBulkDataProvider dataProvider, String assemblyId, ProcessDisplayHelper ph) { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData, dataProvider); + private Map> loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, + BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + + for (ImmutablePair> gff3EntryPair : gffData) { + try { + idsAdded = gff3Service.loadLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + } + + return idsAdded; + } + + private Map> loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, + BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { for (ImmutablePair> gff3EntryPair : gffData) { try { - idsAdded = gff3Service.loadAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + idsAdded = gff3Service.loadParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -239,6 +265,10 @@ private List>> preProcessGffData(List< for (String parent : attributes.get("Parent").split(",")) { HashMap attributesCopy = new HashMap<>(); attributesCopy.putAll(attributes); + String[] parentIdParts = parent.split(":"); + if (parentIdParts.length == 1) { + parent = dataProvider.name() + ':' + parentIdParts[0]; + } attributesCopy.put("Parent", parent); processedGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); } 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 719c7d03b..694445112 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -1,6 +1,5 @@ package org.alliancegenome.curation_api.services; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,11 +33,9 @@ import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; -import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; -import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -97,13 +94,14 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData public Map> loadEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, dataProvider); + Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, attributes, dataProvider); if (exon != null) { idsAdded.get("Exon").add(exon.getId()); } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { - CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, dataProvider); + CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, attributes, dataProvider); if (cds != null) { idsAdded.get("CodingSequence").add(cds.getId()); } @@ -111,7 +109,7 @@ public Map> loadEntity(BulkLoadFileHistory history, Immutable if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); } - Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, dataProvider); + Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, attributes, dataProvider); if (transcript != null) { idsAdded.get("Transcript").add(transcript.getId()); } @@ -120,7 +118,7 @@ public Map> loadEntity(BulkLoadFileHistory history, Immutable } @Transactional - public Map> loadAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public Map> loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -140,11 +138,6 @@ public Map> loadAssociations(BulkLoadFileHistory history, Imm idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); exonLocationService.addAssociationToSubject(exonLocation); } - TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); - if (transcriptAssociation != null) { - idsAdded.get("TranscriptExonAssociation").add(transcriptAssociation.getId()); - transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); - } } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); @@ -152,16 +145,12 @@ public Map> loadAssociations(BulkLoadFileHistory history, Imm throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } CodingSequence cds = response.getSingleResult(); + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); if (cdsLocation != null) { idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); cdsLocationService.addAssociationToSubject(cdsLocation); } - TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); - if (transcriptAssociation != null) { - idsAdded.get("TranscriptCodingSequenceAssociation").add(transcriptAssociation.getId()); - transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); - } } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); @@ -174,11 +163,64 @@ public Map> loadAssociations(BulkLoadFileHistory history, Imm throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); } Transcript transcript = response.getSingleResult(); + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); if (transcriptLocation != null) { idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); transcriptLocationService.addAssociationToSubject(transcriptLocation); } + } + + return idsAdded; + } + + @Transactional + public Map> loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + Exon exon = response.getSingleResult(); + + TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); + if (transcriptAssociation != null) { + idsAdded.get("TranscriptExonAssociation").add(transcriptAssociation.getId()); + transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); + } + } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + CodingSequence cds = response.getSingleResult(); + + TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); + if (transcriptAssociation != null) { + idsAdded.get("TranscriptCodingSequenceAssociation").add(transcriptAssociation.getId()); + transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); + } + } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { + gffEntry.setType("lncRNA"); + } + if (!attributes.containsKey("ID")) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); + } + SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); + } + Transcript transcript = response.getSingleResult(); + TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes, geneIdCurieMap); if (geneAssociation != null) { idsAdded.get("TranscriptGeneAssociation").add(geneAssociation.getId()); diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index 50239d962..a0c61da1c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -1,5 +1,6 @@ package org.alliancegenome.curation_api.services.helpers.gff3; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -9,6 +10,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import io.quarkus.logging.Log; + public class Gff3AttributesHelper { public static Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { @@ -22,27 +25,26 @@ public static Map getAttributes(Gff3DTO dto, BackendBulkDataProv } } - if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { - for (String key : List.of("ID", "Parent")) { - if (attributes.containsKey(key)) { - String id = attributes.get(key); - String[] idParts = id.split(":"); - if (idParts.length > 1) { - id = idParts[1]; - } - attributes.put(key, id); - } - } - } - + // Ensure identifiers have MOD prefix for (String key : List.of("ID", "Parent")) { if (attributes.containsKey(key)) { - String id = attributes.get(key); - String[] idParts = id.split(":"); - if (idParts.length == 1) { - id = dataProvider.name() + ':' + idParts[0]; + String idsString = attributes.get(key); + if (StringUtils.equals(dataProvider.sourceOrganization, "WB")) { + // Remove prefixes like Gene: and Transcript: from WB identifiers + idsString = idsString.replaceAll("Gene:", ""); + idsString = idsString.replaceAll("Transcript:", ""); + idsString = idsString.replaceAll("CDS:", ""); + } + String[] idsList = idsString.split(","); + List processedIdList = new ArrayList<>(); + for (String id : idsList) { + String[] idParts = id.split(":"); + if (idParts.length == 1) { + id = dataProvider.name() + ':' + idParts[0]; + } + processedIdList.add(id); } - attributes.put(key, id); + attributes.put(key, String.join(",", processedIdList)); } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index d04275639..a67900dce 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -72,11 +72,10 @@ public class Gff3DtoValidator { @Inject VocabularyTermService vocabularyTermService; @Transactional - public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Exon validateExonEntry(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) throws ObjectValidationException { Exon exon = null; - Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = exonDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -100,11 +99,10 @@ public Exon validateExonEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) } @Transactional - public CodingSequence validateCdsEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public CodingSequence validateCdsEntry(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) throws ObjectValidationException { CodingSequence cds = null; - Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = codingSequenceDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -128,11 +126,10 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, BackendBulkDataProvider data } @Transactional - public Transcript validateTranscriptEntry(Gff3DTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Transcript validateTranscriptEntry(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) throws ObjectValidationException { Transcript transcript = null; - Map attributes = Gff3AttributesHelper.getAttributes(dto, dataProvider); if (attributes.containsKey("ID")) { SearchResponse searchResponse = transcriptDAO.findByField("modInternalId", attributes.get("ID")); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -300,7 +297,7 @@ public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssoc } else { SearchResponse parentTranscriptSearch = transcriptDAO.findByField("modInternalId", attributes.get("Parent")); if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { - associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); + associationResponse.addErrorMessage("Attributes - Parent",ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); } else { Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", parentTranscript.getId()); diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 9d7b3d687..167e0ff5a 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -61,7 +61,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 3); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 4); RestAssured.given(). when(). @@ -90,7 +90,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 3); + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 4); RestAssured.given(). when(). @@ -121,7 +121,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 3); + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 4); RestAssured.given(). when(). @@ -154,7 +154,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 3); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 4); RestAssured.given(). when(). @@ -180,33 +180,33 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { @Test @Order(5) public void gff3DataBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", 4, 1, 3); } @Test @Order(6) public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", 4, 1, 3); } @Test @Order(7) public void gff3DataBulkUploadInvalidFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 3, 1, 2); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", 3, 1, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", 4, 1, 3); } } diff --git a/src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json b/src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json index 06b8abf5c..fe01268c0 100644 --- a/src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json +++ b/src/test/resources/bulk/fms/08_gff_data/GFF_02_exon.json @@ -7,7 +7,7 @@ "end": 100, "strand": "+", "attributes": [ - "ID=Exon:Y74C9A.2a_exon", + "ID=Y74C9A.2a_exon", "Parent=Transcript:Y74C9A.2a.1" ] } diff --git a/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json b/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json index f916191ad..34d56074e 100644 --- a/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json +++ b/src/test/resources/bulk/fms/08_gff_data/IV_04_invalid_exon_parent.json @@ -7,7 +7,7 @@ "end": 100, "strand": "+", "attributes": [ - "ID=Exon:Y74C9A.2a_exon", + "ID=Y74C9A.2a_exon", "Parent=Transcript:Invalid" ] } diff --git a/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json b/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json index 23734f7ee..9f7dd01f4 100644 --- a/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json +++ b/src/test/resources/bulk/fms/08_gff_data/MR_06_no_exon_parent.json @@ -7,7 +7,7 @@ "end": 100, "strand": "+", "attributes": [ - "ID=Exon:Y74C9A.2a_exon" + "ID=Y74C9A.2a_exon" ] } ] From d47431e1b8d55d7c221060789f0b5e10618cb3f5 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 13 Aug 2024 09:31:16 +0100 Subject: [PATCH 105/342] Checkstyle fixes --- .../jobs/executors/Gff3Executor.java | 25 +++++++++---------- .../model/entities/Transcript.java | 4 +-- .../curation_api/services/Gff3Service.java | 10 ++++---- .../helpers/gff3/Gff3AttributesHelper.java | 2 -- .../validation/dto/Gff3DtoValidator.java | 13 +++++----- 5 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 1b543ee4a..9ba729cca 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -36,7 +36,6 @@ 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; @@ -74,7 +73,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); Map> idsAdded = createIdsAddedMap(); Map> previousIds = getPreviouslyLoadedIds(dataProvider); @@ -132,12 +131,12 @@ private Map> getPreviouslyLoadedIds(BackendBulkDataProvider d return previousIds; } - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider) { return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); } - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, + private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); @@ -160,7 +159,7 @@ private Map> runLoad(BulkLoadFileHistory history, List gffData) { Map> idsAdded = createIdsAddedMap(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); @@ -187,9 +186,9 @@ private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory histo return assemblyName; } - private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, + private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - for (ImmutablePair> gff3EntryPair : gffData) { + for (ImmutablePair> gff3EntryPair : gffData) { try { idsAdded = gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); history.incrementCompleted(); @@ -208,16 +207,16 @@ private Map> loadEntities(BulkLoadFileHistory history, List> loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, + private Map> loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { - for (ImmutablePair> gff3EntryPair : gffData) { + for (ImmutablePair> gff3EntryPair : gffData) { try { idsAdded = gff3Service.loadLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); - addException(history, e.getData()); + addException(history, e.getData()); } catch (Exception e) { e.printStackTrace(); history.incrementFailed(); @@ -230,10 +229,10 @@ private Map> loadLocationAssociations(BulkLoadFileHistory his return idsAdded; } - private Map> loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, + private Map> loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { - for (ImmutablePair> gff3EntryPair : gffData) { + for (ImmutablePair> gff3EntryPair : gffData) { try { idsAdded = gff3Service.loadParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); history.incrementCompleted(); @@ -252,7 +251,7 @@ private Map> loadParentChildAssociations(BulkLoadFileHistory return idsAdded; } - private List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { + private List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { List>> processedGffData = new ArrayList<>(); ProcessDisplayHelper ph = new ProcessDisplayHelper(); 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 e6300403d..7480f83ce 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 @@ -61,7 +61,7 @@ public class Transcript extends GenomicEntity { "transcriptCodingSequenceAssociationObject.curie", "transcriptCodingSequenceAssociationObject.name", "transcriptCodingSequenceAssociationObject.modEntityId", "transcriptCodingSequenceAssociationObject.modInternalId", "transcriptCodingSequenceAssociationObject.uniqueId", "transcriptCodingSequenceAssociationObject.curie_keyword", "transcriptCodingSequenceAssociationObject.name_keyword", "transcriptCodingSequenceAssociationObject.modEntityId_keyword", - "transcriptCodingSequenceAssociationObject.modInternalId_keyword", "transcriptCodingSequenceAssociationObject.uniqueId_keyword", + "transcriptCodingSequenceAssociationObject.modInternalId_keyword", "transcriptCodingSequenceAssociationObject.uniqueId_keyword" } ) @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) @@ -73,7 +73,7 @@ public class Transcript extends GenomicEntity { "transcriptExonAssociationObject.curie", "transcriptExonAssociationObject.name", "transcriptExonAssociationObject.modEntityId", "transcriptExonAssociationObject.modInternalId", "transcriptExonAssociationObject.uniqueId", "transcriptExonAssociationObject.curie_keyword", "transcriptExonAssociationObject.name_keyword", "transcriptExonAssociationObject.modEntityId_keyword", - "transcriptExonAssociationObject.modInternalId_keyword", "transcriptExonAssociationObject.uniqueId_keyword", + "transcriptExonAssociationObject.modInternalId_keyword", "transcriptExonAssociationObject.uniqueId_keyword" } ) @OneToMany(mappedBy = "transcriptAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) 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 694445112..99500c959 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -92,7 +92,7 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData } } - public Map> loadEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Map> loadEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { @@ -118,7 +118,7 @@ public Map> loadEntity(BulkLoadFileHistory history, Immutable } @Transactional - public Map> loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public Map> loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -175,7 +175,7 @@ public Map> loadLocationAssociations(BulkLoadFileHistory hist } @Transactional - public Map> loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public Map> loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -231,10 +231,10 @@ public Map> loadParentChildAssociations(BulkLoadFileHistory h return idsAdded; } - public Map getIdCurieMap(List>> gffData, BackendBulkDataProvider dataProvider) { + public Map getIdCurieMap(List>> gffData, BackendBulkDataProvider dataProvider) { Map geneIdCurieMap = new HashMap<>(); - for (ImmutablePair> gffEntryPair : gffData) { + for (ImmutablePair> gffEntryPair : gffData) { Map attributes = gffEntryPair.getValue(); if (attributes.containsKey("ID") && attributes.containsKey("gene_id")) { geneIdCurieMap.put(attributes.get("ID"), attributes.get("gene_id")); diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index a0c61da1c..4eca281c6 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -10,8 +10,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import io.quarkus.logging.Log; - public class Gff3AttributesHelper { public static Map getAttributes(Gff3DTO dto, BackendBulkDataProvider dataProvider) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index a67900dce..0bb8938fb 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -42,7 +42,6 @@ import org.alliancegenome.curation_api.services.GeneService; import org.alliancegenome.curation_api.services.Gff3Service; import org.alliancegenome.curation_api.services.VocabularyTermService; -import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.apache.commons.lang3.StringUtils; @@ -254,7 +253,7 @@ public TranscriptGenomicLocationAssociation validateTranscriptLocation(Gff3DTO g return transcriptLocationDAO.persist(locationResponse.getEntity()); } - @Transactional + @Transactional public TranscriptGeneAssociation validateTranscriptGeneAssociation(Gff3DTO gffEntry, Transcript transcript, Map attributes, Map geneIdCurieMap) throws ObjectValidationException { TranscriptGeneAssociation association = new TranscriptGeneAssociation(); @@ -287,7 +286,7 @@ public TranscriptGeneAssociation validateTranscriptGeneAssociation(Gff3DTO gffEn return transcriptGeneDAO.persist(association); } - @Transactional + @Transactional public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssociation(Gff3DTO gffEntry, CodingSequence cds, Map attributes) throws ObjectValidationException { TranscriptCodingSequenceAssociation association = new TranscriptCodingSequenceAssociation(); @@ -299,7 +298,8 @@ public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssoc if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { associationResponse.addErrorMessage("Attributes - Parent",ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); } else { - Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); + Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); + Map params = new HashMap<>(); params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", parentTranscript.getId()); params.put("transcriptCodingSequenceAssociationObject.id", cds.getId()); SearchResponse searchResponse = transcriptCdsDAO.findByParams(params); @@ -319,7 +319,7 @@ public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssoc return transcriptCdsDAO.persist(association); } - @Transactional + @Transactional public TranscriptExonAssociation validateTranscriptExonAssociation(Gff3DTO gffEntry, Exon exon, Map attributes) throws ObjectValidationException { TranscriptExonAssociation association = new TranscriptExonAssociation(); @@ -331,7 +331,8 @@ public TranscriptExonAssociation validateTranscriptExonAssociation(Gff3DTO gffEn if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); } else { - Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); + Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); + Map params = new HashMap<>(); params.put(EntityFieldConstants.TRANSCRIPT_ASSOCIATION_SUBJECT + ".id", parentTranscript.getId()); params.put("transcriptExonAssociationObject.id", exon.getId()); SearchResponse searchResponse = transcriptExonDAO.findByParams(params); From 3d194033ce2151129396b8b3bde53b3f2eb6028f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 13 Aug 2024 09:37:06 +0100 Subject: [PATCH 106/342] More checkstyle fixes --- .../curation_api/constants/VocabularyConstants.java | 4 ++-- .../services/validation/dto/Gff3DtoValidator.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 d904c83ab..1a5d162dc 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -71,8 +71,8 @@ private VocabularyConstants() { public static final String GENE_EXPRESSION_RELATION_TERM = "is_expressed_in"; public static final String TRANSCRIPT_RELATION_VOCABULARY = "transcript_relation"; - public static final String TRANSCRIPT_CHILD_TERM= "is_child_of"; - public static final String TRANSCRIPT_PARENT_TERM= "is_parent_of"; + public static final String TRANSCRIPT_CHILD_TERM = "is_child_of"; + public static final String TRANSCRIPT_PARENT_TERM = "is_parent_of"; public static final String STAGE_UBERON_SLIM_TERMS = "stage_uberon_slim_terms"; public static final String ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS = "anatomical_structure_uberon_slim_terms"; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 0bb8938fb..08a9496aa 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -296,7 +296,7 @@ public TranscriptCodingSequenceAssociation validateTranscriptCodingSequenceAssoc } else { SearchResponse parentTranscriptSearch = transcriptDAO.findByField("modInternalId", attributes.get("Parent")); if (parentTranscriptSearch == null || parentTranscriptSearch.getSingleResult() == null) { - associationResponse.addErrorMessage("Attributes - Parent",ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); + associationResponse.addErrorMessage("Attributes - Parent", ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("Parent") + ")"); } else { Transcript parentTranscript = parentTranscriptSearch.getSingleResult(); Map params = new HashMap<>(); From 1d891c018687935fa69ca0850afbf6a393206828 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 14 Aug 2024 09:21:43 +0100 Subject: [PATCH 107/342] Add reference caching --- .../services/ReferenceService.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) 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 db4455628..4d8d97576 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ReferenceService.java @@ -1,6 +1,8 @@ package org.alliancegenome.curation_api.services; import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; import java.util.List; import org.alliancegenome.curation_api.dao.ReferenceDAO; @@ -10,6 +12,7 @@ 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; @@ -20,6 +23,9 @@ public class ReferenceService extends BaseEntityCrudService referenceCacheMap = new HashMap<>(); @Override @PostConstruct @@ -45,6 +51,23 @@ public ObjectResponse getByCurie(String curie) { @Transactional public Reference retrieveFromDbOrLiteratureService(String curieOrXref) { Reference reference = null; + if (referenceRequest != null) { + if (referenceCacheMap.containsKey(curieOrXref)) { + reference = referenceCacheMap.get(curieOrXref); + } else { + Log.debug("Reference not cached, caching reference: (" + curieOrXref + ")"); + reference = findOrCreateReference(curieOrXref); + referenceCacheMap.put(curieOrXref, reference); + } + } else { + reference = findOrCreateReference(curieOrXref); + referenceRequest = new Date(); + } + return reference; + } + + private Reference findOrCreateReference(String curieOrXref) { + Reference reference = null; if (curieOrXref.startsWith("AGRKB:")) { reference = findByCurie(curieOrXref); From ed54b95ec830cd1e38b7a1f728e13433a35ada5c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 14 Aug 2024 20:16:51 -0500 Subject: [PATCH 108/342] Added loading code for preferred cross reference for ExternalDataBase Entity --- .../fms/CrossReferenceFmsDTOValidator.java | 52 ----------- ...ExternalDataBaseEntityFmsDTOValidator.java | 90 +++++++++++++------ 2 files changed, 62 insertions(+), 80 deletions(-) delete mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java deleted file mode 100644 index 274b3976b..000000000 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java +++ /dev/null @@ -1,52 +0,0 @@ -package org.alliancegenome.curation_api.services.validation.dto.fms; - -import java.util.ArrayList; -import java.util.List; - -import org.alliancegenome.curation_api.constants.ValidationConstants; -import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -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.ObjectListResponse; -import org.alliancegenome.curation_api.response.ObjectResponse; -import org.alliancegenome.curation_api.services.ResourceDescriptorPageService; -import org.apache.commons.collections.CollectionUtils; - -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; - -@RequestScoped -public class CrossReferenceFmsDTOValidator { - - @Inject ResourceDescriptorPageService resourceDescriptorPageService; - - public ObjectListResponse validateCrossReferenceFmsDTO(CrossReferenceFmsDTO dto) throws ObjectValidationException{ - List xrefs = new ArrayList<>(); - ObjectListResponse crResponse = new ObjectListResponse<>(); - if (CollectionUtils.isNotEmpty(dto.getPages())) { - String prefix = getPrefix(dto.getId()); - for(String xrefPage : dto.getPages()) { - CrossReference xref = new CrossReference(); - ResourceDescriptorPage rdp = resourceDescriptorPageService.getPageForResourceDescriptor(prefix, xrefPage); - if (rdp == null) { - crResponse.addErrorMessage("page", ValidationConstants.INVALID_MESSAGE + " (" + xrefPage + ")"); - } - else { - xref.setReferencedCurie(dto.getId()); - xref.setResourceDescriptorPage(rdp); - } - xrefs.add(xref); - } - crResponse.setEntities(xrefs); - } else { - crResponse.addErrorMessage("page", ValidationConstants.REQUIRED_MESSAGE); - } - return crResponse; - } - - private String getPrefix(String id){ - return id.indexOf(":") == -1 ? id : id.substring(0, id.indexOf(":")); - } - -} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java index 3b3a29aff..c4516f33c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -1,23 +1,26 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; 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.stream.Collectors; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.dao.ExternalDataBaseEntityDAO; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; import org.alliancegenome.curation_api.model.ingest.dto.fms.CrossReferenceFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPIdFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.CrossReferenceService; import org.alliancegenome.curation_api.services.ExternalDataBaseEntityService; +import org.alliancegenome.curation_api.services.ResourceDescriptorPageService; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -32,9 +35,10 @@ public class ExternalDataBaseEntityFmsDTOValidator { @Inject ExternalDataBaseEntityService externalDataBaseEntityService; @Inject CrossReferenceDAO crossReferenceDAO; @Inject CrossReferenceService crossReferenceService; + @Inject ResourceDescriptorPageService resourceDescriptorPageService; @Transactional - public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO dto) throws ObjectValidationException,ObjectUpdateException { + public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO dto) throws ObjectValidationException { ObjectResponse externalDBEntityResponse = new ObjectResponse<>(); ExternalDataBaseEntity externalDBEntity = null; @@ -69,9 +73,10 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d currentXrefIds = externalDBEntity.getCrossReferences().stream().map(CrossReference::getId).collect(Collectors.toList()); } - List mergedXrefIds; + List mergedXrefIds = null; + List mergedCrossReferences = new ArrayList<>(); if(CollectionUtils.isNotEmpty(dto.getCrossReferences())) { - List mergedCrossReferences = crossReferenceService.getMergedFmsXrefList(dto.getCrossReferences(), externalDBEntity.getCrossReferences()); + mergedCrossReferences = crossReferenceService.getMergedFmsXrefList(dto.getCrossReferences(), externalDBEntity.getCrossReferences()); mergedXrefIds = mergedCrossReferences.stream().map(CrossReference::getId).collect(Collectors.toList()); externalDBEntity.setCrossReferences(mergedCrossReferences); } else { @@ -79,33 +84,62 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d externalDBEntity.setCrossReferences(null); } - // CrossReference xref = new CrossReference(); - // if(dto.getPreferredCrossReference() != null) { - // if(dto.getPreferredCrossReference().getPages().size() == 1) { - // List incomingXrefDto = new ArrayList<>(); - // incomingXrefDto.add(dto.getPreferredCrossReference()); - // List existingXReferences = new ArrayList<>(); - // existingXReferences.add(externalDBEntity.getPreferredCrossReference()); - // List preferredXReferences = crossReferenceService.getMergedFmsXrefList(incomingXrefDto, existingXReferences); - // xref = preferredXReferences.get(0); - // externalDBEntity.setPreferredCrossReference(xref); - // } else { - // externalDBEntityResponse.addErrorMessage("preferredCrossReference.pages", ValidationConstants.INVALID_MESSAGE + " Only one page is allowed"); - // } - // } - - externalDataBaseEntityDAO.persist(externalDBEntity); - - for (Long currentId : currentXrefIds) { - if (!mergedXrefIds.contains(currentId)) { - System.out.println("Removing CrossReference with ID: " + crossReferenceDAO.find(currentId).getId()); - crossReferenceDAO.remove(currentId); + Map mergedXrefUniqueIdsMap = new HashMap<>(); + for(CrossReference mergedXref : mergedCrossReferences) { + mergedXrefUniqueIdsMap.put(crossReferenceService.getCrossReferenceUniqueId(mergedXref), mergedXref); + } + + if(externalDBEntity.getPreferredCrossReference() != null) { + if(dto.getPreferredCrossReference() != null) { + CrossReference incomingPreferredXref = createNewCrossReference(dto.getPreferredCrossReference()); + String incomingXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(incomingPreferredXref); + String currentXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(externalDBEntity.getPreferredCrossReference()); + + if(!incomingXrefUniqueId.equals(currentXrefUniqueId)){ + if(mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { + externalDBEntity.setPreferredCrossReference(mergedXrefUniqueIdsMap.get(incomingXrefUniqueId)); + } else { + externalDBEntity.setPreferredCrossReference(crossReferenceDAO.persist(incomingPreferredXref)); + } + } + } else { + externalDBEntity.setPreferredCrossReference(null); + } + } else { + if(dto.getPreferredCrossReference() != null) { + CrossReference incomingPreferredXref = createNewCrossReference(dto.getPreferredCrossReference()); + String incomingXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(incomingPreferredXref); + if(mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { + externalDBEntity.setPreferredCrossReference(mergedXrefUniqueIdsMap.get(incomingXrefUniqueId)); + } else { + externalDBEntity.setPreferredCrossReference(crossReferenceDAO.persist(incomingPreferredXref)); + } } } - if(externalDBEntityResponse.hasErrors()) { - throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); + externalDataBaseEntityDAO.persist(externalDBEntity); + + for (Long currentId : currentXrefIds) { + if (!mergedXrefIds.contains(currentId)) { + crossReferenceDAO.remove(currentId); + } + } + + if(externalDBEntityResponse.hasErrors()) { + throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); + } + return externalDBEntity; + } + + private CrossReference createNewCrossReference(CrossReferenceFmsDTO dto) { + CrossReference xref = new CrossReference(); + xref.setReferencedCurie(dto.getCurie()); + xref.setDisplayName(dto.getCurie()); + String prefix = dto.getCurie().indexOf(":") == -1 ? dto.getCurie() : dto.getCurie().substring(0, dto.getCurie().indexOf(":")); + ResourceDescriptorPage rdp = resourceDescriptorPageService.getPageForResourceDescriptor(prefix, dto.getPages().get(0)); + if (rdp != null) { + xref.setResourceDescriptorPage(rdp); } - return externalDBEntity; + return xref; } } From 3a448b8afabc7bd48ccd699186cfd5d3496ce5f0 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 14 Aug 2024 20:34:29 -0500 Subject: [PATCH 109/342] Changes in loading preferred Cross References --- .../dto/fms/ExternalDataBaseEntityFmsDTOValidator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java index c4516f33c..06415a628 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -96,6 +96,7 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d String currentXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(externalDBEntity.getPreferredCrossReference()); if(!incomingXrefUniqueId.equals(currentXrefUniqueId)){ + externalDBEntity.setPreferredCrossReference(null); if(mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { externalDBEntity.setPreferredCrossReference(mergedXrefUniqueIdsMap.get(incomingXrefUniqueId)); } else { From 1a139401217ffbf6afdef93e92401d2c3c90c6d9 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 14 Aug 2024 20:55:45 -0500 Subject: [PATCH 110/342] checkstyle fix --- .../dao/ExternalDataBaseEntityDAO.java | 8 ++--- ...TPExpressionDatasetAnnotationExecutor.java | 32 +++++++++---------- .../HTPExpressionDatasetAnnotationFmsDTO.java | 18 +++++------ ...pressionDatasetAnnotationIngestFmsDTO.java | 4 +-- .../model/ingest/dto/fms/HTPIdFmsDTO.java | 8 ++--- .../ExternalDataBaseEntityService.java | 22 ++++++------- ...HTPExpressionDatasetAnnotationService.java | 22 ++++++------- ...t.sql => v0.37.0.2__Fixing_HTPDataset.sql} | 0 8 files changed, 57 insertions(+), 57 deletions(-) rename src/main/resources/db/migration/{v0.36.0.8__Fixing_HTPDataset.sql => v0.37.0.2__Fixing_HTPDataset.sql} (100%) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java index d202ee62d..95342da51 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/ExternalDataBaseEntityDAO.java @@ -7,8 +7,8 @@ @ApplicationScoped public class ExternalDataBaseEntityDAO extends BaseSQLDAO { - - protected ExternalDataBaseEntityDAO() { - super(ExternalDataBaseEntity.class); - } + + protected ExternalDataBaseEntityDAO() { + super(ExternalDataBaseEntity.class); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java index 2bbd2eef3..a87797f07 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -29,12 +29,12 @@ @ApplicationScoped public class HTPExpressionDatasetAnnotationExecutor extends LoadFileExecutor { - @Inject ExternalDataBaseEntityService externalDataBaseEntityService; - @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; - @Inject HTPExpressionDatasetAnnotationService htpExpressionDatasetAnnotationService; - @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; - - public void execLoad(BulkLoadFile bulkLoadFile) { + @Inject ExternalDataBaseEntityService externalDataBaseEntityService; + @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; + @Inject HTPExpressionDatasetAnnotationService htpExpressionDatasetAnnotationService; + @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; + + public void execLoad(BulkLoadFile bulkLoadFile) { try { BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); @@ -47,10 +47,10 @@ public void execLoad(BulkLoadFile bulkLoadFile) { bulkLoadFile.setAllianceMemberReleaseVersion(htpExpressionDatasetData.getMetaData().getRelease()); } - BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); bulkLoadFileDAO.merge(bulkLoadFile); - List datasetIdsLoaded = new ArrayList<>(); + List datasetIdsLoaded = new ArrayList<>(); BulkLoadFileHistory history = new BulkLoadFileHistory(htpExpressionDatasetData.getData().size()); createHistory(history, bulkLoadFile); Boolean result = runLoaddatasetid(externalDataBaseEntityService, history, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); @@ -60,26 +60,26 @@ public void execLoad(BulkLoadFile bulkLoadFile) { } } - private boolean runLoaddatasetid(ExternalDataBaseEntityService externalDataBaseEntityService, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List htpDatasetData, List datasetIdsLoaded, boolean isUpdate) { + private boolean runLoaddatasetid(ExternalDataBaseEntityService externalDataBaseEntityService, BulkLoadFileHistory history, BackendBulkDataProvider dataProvider, List htpDatasetData, List datasetIdsLoaded, boolean isUpdate) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("External Database Entity DTO Update for " + dataProvider.name(), htpDatasetData.size()); - for (HTPExpressionDatasetAnnotationFmsDTO dto : htpDatasetData) { - try{ - ExternalDataBaseEntity dbObject = externalDataBaseEntityService.upsert(dto.getDatasetId(), dataProvider); - history.incrementCompleted(); + for (HTPExpressionDatasetAnnotationFmsDTO dto : htpDatasetData) { + try{ + ExternalDataBaseEntity dbObject = externalDataBaseEntityService.upsert(dto.getDatasetId(), dataProvider); + history.incrementCompleted(); if (datasetIdsLoaded != null) { datasetIdsLoaded.add(dbObject.getId()); } - } catch (ObjectUpdateException e) { + } catch (ObjectUpdateException e) { history.incrementFailed(); addException(history, e.getData()); } catch (Exception e) { history.incrementFailed(); addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); } - } + } ph.finishProcess(); - return true; + return true; } } diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java index f92aea682..7f38be69b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationFmsDTO.java @@ -9,14 +9,14 @@ @Data @EqualsAndHashCode(callSuper = true) -public class HTPExpressionDatasetAnnotationFmsDTO extends BaseDTO{ +public class HTPExpressionDatasetAnnotationFmsDTO extends BaseDTO { - private HTPIdFmsDTO datasetId; - private List publications; - private String title; - private String summary; - private Integer numChannels; - private List subSeries; - private String dateAssigned; - private List categoryTags; + private HTPIdFmsDTO datasetId; + private List publications; + private String title; + private String summary; + private Integer numChannels; + private List subSeries; + private String dateAssigned; + private List categoryTags; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java index 9e48e2739..2862e84d7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPExpressionDatasetAnnotationIngestFmsDTO.java @@ -8,8 +8,8 @@ import lombok.EqualsAndHashCode; @Data @EqualsAndHashCode(callSuper = true) -public class HTPExpressionDatasetAnnotationIngestFmsDTO extends BaseDTO{ +public class HTPExpressionDatasetAnnotationIngestFmsDTO extends BaseDTO { - private MetaDataFmsDTO metaData; + private MetaDataFmsDTO metaData; private List data; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java index 84ed3ed9b..31aae4bb0 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java @@ -11,8 +11,8 @@ @EqualsAndHashCode(callSuper=true) public class HTPIdFmsDTO extends BaseDTO { - private String primaryId; - private List alternateIds; - private CrossReferenceFmsDTO preferredCrossReference; - private List crossReferences; + private String primaryId; + private List alternateIds; + private CrossReferenceFmsDTO preferredCrossReference; + private List crossReferences; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java index 78b05a25a..171c50f9d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java @@ -15,17 +15,17 @@ @RequestScoped public class ExternalDataBaseEntityService extends BaseEntityCrudService implements BaseUpsertServiceInterface { - - @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; - @Inject ExternalDataBaseEntityFmsDTOValidator externalDataBaseEntityFmsDtoValidator; + + @Inject ExternalDataBaseEntityDAO externalDataBaseEntityDAO; + @Inject ExternalDataBaseEntityFmsDTOValidator externalDataBaseEntityFmsDtoValidator; - @Override - @PostConstruct - protected void init() { - setSQLDao(externalDataBaseEntityDAO); - } + @Override + @PostConstruct + protected void init() { + setSQLDao(externalDataBaseEntityDAO); + } - public ExternalDataBaseEntity upsert(HTPIdFmsDTO htpIdData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { - return externalDataBaseEntityFmsDtoValidator.validateExternalDataBaseEntityFmsDTO(htpIdData); - } + public ExternalDataBaseEntity upsert(HTPIdFmsDTO htpIdData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + return externalDataBaseEntityFmsDtoValidator.validateExternalDataBaseEntityFmsDTO(htpIdData); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java index fad8d45de..80abe345f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java @@ -15,17 +15,17 @@ @RequestScoped public class HTPExpressionDatasetAnnotationService extends BaseEntityCrudService implements BaseUpsertServiceInterface { - - @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; - @Inject HTPExpressionDatasetAnnotationFmsDTOValidator htpExpressionDatasetAnnotationFmsDtoValidator; + + @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; + @Inject HTPExpressionDatasetAnnotationFmsDTOValidator htpExpressionDatasetAnnotationFmsDtoValidator; - @Override - @PostConstruct - protected void init() { - setSQLDao(htpExpressionDatasetAnnotationDAO); - } + @Override + @PostConstruct + protected void init() { + setSQLDao(htpExpressionDatasetAnnotationDAO); + } - public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { - return htpExpressionDatasetAnnotationFmsDtoValidator.validateHTPExpressionDatasetAnnotationFmsDTO(htpExpressionDatasetAnnotationData); - } + public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + return htpExpressionDatasetAnnotationFmsDtoValidator.validateHTPExpressionDatasetAnnotationFmsDTO(htpExpressionDatasetAnnotationData); + } } diff --git a/src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql b/src/main/resources/db/migration/v0.37.0.2__Fixing_HTPDataset.sql similarity index 100% rename from src/main/resources/db/migration/v0.36.0.8__Fixing_HTPDataset.sql rename to src/main/resources/db/migration/v0.37.0.2__Fixing_HTPDataset.sql From cf09acffd2aac6b17c12ae3564c9495de3b1662c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 14 Aug 2024 21:05:39 -0500 Subject: [PATCH 111/342] checkstyle fix --- ...TPExpressionDatasetAnnotationExecutor.java | 2 +- .../model/ingest/dto/fms/HTPIdFmsDTO.java | 2 +- ...HTPExpressionDatasetAnnotationService.java | 2 +- ...ExternalDataBaseEntityFmsDTOValidator.java | 26 +++++++++---------- ...ssionDatasetAnnotationFmsDTOValidator.java | 8 +++--- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java index a87797f07..42be2d132 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -65,7 +65,7 @@ private boolean runLoaddatasetid(ExternalDataBaseEntityService externalDataBaseE ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("External Database Entity DTO Update for " + dataProvider.name(), htpDatasetData.size()); for (HTPExpressionDatasetAnnotationFmsDTO dto : htpDatasetData) { - try{ + try { ExternalDataBaseEntity dbObject = externalDataBaseEntityService.upsert(dto.getDatasetId(), dataProvider); history.incrementCompleted(); if (datasetIdsLoaded != null) { diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java index 31aae4bb0..5cc78241f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/HTPIdFmsDTO.java @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode(callSuper=true) +@EqualsAndHashCode(callSuper = true) public class HTPIdFmsDTO extends BaseDTO { private String primaryId; diff --git a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java index 80abe345f..43415f694 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java @@ -25,7 +25,7 @@ protected void init() { setSQLDao(htpExpressionDatasetAnnotationDAO); } - public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { return htpExpressionDatasetAnnotationFmsDtoValidator.validateHTPExpressionDatasetAnnotationFmsDTO(htpExpressionDatasetAnnotationData); } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java index 06415a628..0e079b599 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -43,19 +43,19 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d ObjectResponse externalDBEntityResponse = new ObjectResponse<>(); ExternalDataBaseEntity externalDBEntity = null; - if(StringUtils.isEmpty(dto.getPrimaryId())) { + if (StringUtils.isEmpty(dto.getPrimaryId())) { externalDBEntityResponse.addErrorMessage("primaryId", ValidationConstants.REQUIRED_MESSAGE); } else { externalDBEntity = externalDataBaseEntityService.findByCurie(dto.getPrimaryId()); } - if(externalDBEntity == null) { + if (externalDBEntity == null) { externalDBEntity = new ExternalDataBaseEntity(); externalDBEntity.setCurie(dto.getPrimaryId()); } - if(CollectionUtils.isNotEmpty(dto.getAlternateIds())) { - if(externalDBEntity.getSecondaryIdentifiers() == null) { + if (CollectionUtils.isNotEmpty(dto.getAlternateIds())) { + if (externalDBEntity.getSecondaryIdentifiers() == null) { externalDBEntity.setSecondaryIdentifiers(new ArrayList<>()); } Set existingSecondaryIds = new HashSet<>(externalDBEntity.getSecondaryIdentifiers()); @@ -75,7 +75,7 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d List mergedXrefIds = null; List mergedCrossReferences = new ArrayList<>(); - if(CollectionUtils.isNotEmpty(dto.getCrossReferences())) { + if (CollectionUtils.isNotEmpty(dto.getCrossReferences())) { mergedCrossReferences = crossReferenceService.getMergedFmsXrefList(dto.getCrossReferences(), externalDBEntity.getCrossReferences()); mergedXrefIds = mergedCrossReferences.stream().map(CrossReference::getId).collect(Collectors.toList()); externalDBEntity.setCrossReferences(mergedCrossReferences); @@ -85,19 +85,19 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d } Map mergedXrefUniqueIdsMap = new HashMap<>(); - for(CrossReference mergedXref : mergedCrossReferences) { + for (CrossReference mergedXref : mergedCrossReferences) { mergedXrefUniqueIdsMap.put(crossReferenceService.getCrossReferenceUniqueId(mergedXref), mergedXref); } - if(externalDBEntity.getPreferredCrossReference() != null) { - if(dto.getPreferredCrossReference() != null) { + if (externalDBEntity.getPreferredCrossReference() != null) { + if (dto.getPreferredCrossReference() != null) { CrossReference incomingPreferredXref = createNewCrossReference(dto.getPreferredCrossReference()); String incomingXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(incomingPreferredXref); String currentXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(externalDBEntity.getPreferredCrossReference()); - if(!incomingXrefUniqueId.equals(currentXrefUniqueId)){ + if (!incomingXrefUniqueId.equals(currentXrefUniqueId)) { externalDBEntity.setPreferredCrossReference(null); - if(mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { + if (mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { externalDBEntity.setPreferredCrossReference(mergedXrefUniqueIdsMap.get(incomingXrefUniqueId)); } else { externalDBEntity.setPreferredCrossReference(crossReferenceDAO.persist(incomingPreferredXref)); @@ -107,10 +107,10 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d externalDBEntity.setPreferredCrossReference(null); } } else { - if(dto.getPreferredCrossReference() != null) { + if (dto.getPreferredCrossReference() != null) { CrossReference incomingPreferredXref = createNewCrossReference(dto.getPreferredCrossReference()); String incomingXrefUniqueId = crossReferenceService.getCrossReferenceUniqueId(incomingPreferredXref); - if(mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { + if (mergedXrefUniqueIdsMap.containsKey(incomingXrefUniqueId)) { externalDBEntity.setPreferredCrossReference(mergedXrefUniqueIdsMap.get(incomingXrefUniqueId)); } else { externalDBEntity.setPreferredCrossReference(crossReferenceDAO.persist(incomingPreferredXref)); @@ -126,7 +126,7 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d } } - if(externalDBEntityResponse.hasErrors()) { + if (externalDBEntityResponse.hasErrors()) { throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); } return externalDBEntity; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java index 35637d71c..c32d89169 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -10,8 +10,8 @@ @RequestScoped public class HTPExpressionDatasetAnnotationFmsDTOValidator { - @Transactional - public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException{ - return null; - } + @Transactional + public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException { + return null; + } } From 950bbe9e74559e807380196da4cb0eab33e6ca64 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 14 Aug 2024 21:07:38 -0500 Subject: [PATCH 112/342] checkstyle fix --- .../curation_api/services/ExternalDataBaseEntityService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java index 171c50f9d..483d42132 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ExternalDataBaseEntityService.java @@ -25,7 +25,7 @@ protected void init() { setSQLDao(externalDataBaseEntityDAO); } - public ExternalDataBaseEntity upsert(HTPIdFmsDTO htpIdData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public ExternalDataBaseEntity upsert(HTPIdFmsDTO htpIdData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { return externalDataBaseEntityFmsDtoValidator.validateExternalDataBaseEntityFmsDTO(htpIdData); } } From 45054968172ffe3f017067a3569e65290eaa5d98 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 15 Aug 2024 08:27:55 -0500 Subject: [PATCH 113/342] adding curation version to ExternalDataBase Entity --- .../constants/LinkMLSchemaConstants.java | 2 +- ...TPExpressionDatasetAnnotationExecutor.java | 2 +- .../entities/ExternalDataBaseEntity.java | 3 +++ ...ExternalDataBaseEntityFmsDTOValidator.java | 19 ++++++++++--------- ...ssionDatasetAnnotationFmsDTOValidator.java | 6 ++++-- 5 files changed, 19 insertions(+), 13 deletions(-) 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 65fdf41c8..056d25135 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.4.0"; + public static final String LATEST_RELEASE = "2.6.0"; 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/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java index 42be2d132..26f85c705 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -53,7 +53,7 @@ public void execLoad(BulkLoadFile bulkLoadFile) { List datasetIdsLoaded = new ArrayList<>(); BulkLoadFileHistory history = new BulkLoadFileHistory(htpExpressionDatasetData.getData().size()); createHistory(history, bulkLoadFile); - Boolean result = runLoaddatasetid(externalDataBaseEntityService, history, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); + boolean result = runLoaddatasetid(externalDataBaseEntityService, history, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); } catch (Exception e) { failLoad(bulkLoadFile, e); e.printStackTrace(); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java index 87c0b26d7..8d1df2821 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExternalDataBaseEntity.java @@ -2,6 +2,8 @@ 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.base.CurieObject; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -37,6 +39,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "ExternalDataBaseEntity", description = "POJO that represents the ExternalDataBaseEntity") +@AGRCurationSchemaVersion(min = "2.6.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { CurieObject.class }) public class ExternalDataBaseEntity extends CurieObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java index 0e079b599..1c667ac7f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -118,18 +118,19 @@ public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO d } } - externalDataBaseEntityDAO.persist(externalDBEntity); + externalDataBaseEntityDAO.persist(externalDBEntity); - for (Long currentId : currentXrefIds) { - if (!mergedXrefIds.contains(currentId)) { - crossReferenceDAO.remove(currentId); + for (Long currentId : currentXrefIds) { + if (!mergedXrefIds.contains(currentId)) { + crossReferenceDAO.remove(currentId); + } } - } - if (externalDBEntityResponse.hasErrors()) { - throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); - } - return externalDBEntity; + if (externalDBEntityResponse.hasErrors()) { + throw new ObjectValidationException(dto, externalDBEntityResponse.errorMessagesString()); + } + + return externalDBEntity; } private CrossReference createNewCrossReference(CrossReferenceFmsDTO dto) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java index c32d89169..9431130d4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -4,6 +4,8 @@ import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; +import com.arjuna.ats.jta.exceptions.NotImplementedException; + import jakarta.enterprise.context.RequestScoped; import jakarta.transaction.Transactional; @@ -11,7 +13,7 @@ public class HTPExpressionDatasetAnnotationFmsDTOValidator { @Transactional - public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException { - return null; + public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException, NotImplementedException { + throw new NotImplementedException(); } } From 015d62aaa7e240a6ab89ba5ed7710c242d5c2299 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 15 Aug 2024 08:35:07 -0500 Subject: [PATCH 114/342] Changed the NotImplementedException package type --- .../fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java index 9431130d4..030747edf 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -3,8 +3,7 @@ import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; - -import com.arjuna.ats.jta.exceptions.NotImplementedException; +import org.apache.commons.lang3.NotImplementedException; import jakarta.enterprise.context.RequestScoped; import jakarta.transaction.Transactional; @@ -13,7 +12,7 @@ public class HTPExpressionDatasetAnnotationFmsDTOValidator { @Transactional - public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException, NotImplementedException { + public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto) throws ObjectValidationException { throw new NotImplementedException(); } } From 65c0a806f199ab95cb230c624467d5ff57a8a709 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 12 Aug 2024 11:18:11 -0500 Subject: [PATCH 115/342] SCRUM-4300 add cellularComponentRibbonTerm and cellularComponentOther to AnatomicalSite --- .../model/entities/AnatomicalSite.java | 15 +++++++++++++++ .../services/base/BaseOntologyTermService.java | 11 +++++++++++ .../services/ontology/GoTermService.java | 1 + .../GeneExpressionAnnotationFmsDTOValidator.java | 8 ++++++++ 4 files changed, 35 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index d8673d9e7..8a5a4b783 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -7,6 +7,7 @@ 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.base.AuditedObject; import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; @@ -17,6 +18,7 @@ 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.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -53,6 +55,19 @@ public class AnatomicalSite extends AuditedObject { @ManyToOne @JsonView({View.FieldsOnly.class}) private GOTerm cellularComponentTerm; + + //celullar compoent ribbon -- slim + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({View.FieldsOnly.class}) + private GOTerm cellularComponentRibbonTerm; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer", valueBridge = @ValueBridgeRef(type = BooleanValueBridge.class)) + @KeywordField(name = "cellularComponentOther_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 cellularComponentOther = false; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") diff --git a/src/main/java/org/alliancegenome/curation_api/services/base/BaseOntologyTermService.java b/src/main/java/org/alliancegenome/curation_api/services/base/BaseOntologyTermService.java index 7b56e26b3..a612843b6 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/base/BaseOntologyTermService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/base/BaseOntologyTermService.java @@ -300,4 +300,15 @@ private void handleCrossReferences(OntologyTerm dbTerm, OntologyTerm incomingTer } } + public T findSubsetTerm(T childTerm, String subsetName) { + for (OntologyTerm term : childTerm.getIsaAncestors()) { + for (String subset : term.getSubsets()) { + if (subset.contains(subsetName)) { + return (T) term; + } + } + } + return null; + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java b/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java index df1693e5e..84a3588f2 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java @@ -1,5 +1,6 @@ package org.alliancegenome.curation_api.services.ontology; + import org.alliancegenome.curation_api.dao.ontology.GoTermDAO; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; import org.alliancegenome.curation_api.services.base.BaseOntologyTermService; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 6b4f4ac8c..424286f84 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -212,6 +212,12 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (cellularComponent == null) { response.addErrorMessage("whereExpressed - cellularComponentTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getCellularComponentTermId() + ")"); } else { + GOTerm cellularComponentRibbon = goTermService.findSubsetTerm(cellularComponent, "goslim_agr"); + if (cellularComponentRibbon == null) { + anatomicalSite.setCellularComponentOther(true); + } else { + anatomicalSite.setCellularComponentRibbonTerm(cellularComponentRibbon); + } anatomicalSite.setCellularComponentTerm(cellularComponent); } } @@ -320,6 +326,8 @@ private AnatomicalSite updateAnatomicalSite(ObjectResponse anato anatomicalSiteDB = new AnatomicalSite(); } anatomicalSiteDB.setCellularComponentTerm(anatomicalSite.getCellularComponentTerm()); + anatomicalSiteDB.setCellularComponentRibbonTerm(anatomicalSite.getCellularComponentRibbonTerm()); + anatomicalSiteDB.setCellularComponentOther(anatomicalSite.getCellularComponentOther()); anatomicalSiteDB.setAnatomicalStructure(anatomicalSite.getAnatomicalStructure()); anatomicalSiteDB.setAnatomicalSubstructure(anatomicalSite.getAnatomicalSubstructure()); anatomicalSiteDB.setAnatomicalStructureQualifiers(anatomicalSite.getAnatomicalStructureQualifiers()); From cd211f149e922da347d5878ee51f9fbba1cdcd69 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 13 Aug 2024 17:02:26 -0500 Subject: [PATCH 116/342] SCRUM-4300 add migration file --- .../db/migration/v0.37.0.2__add_expression_ribbon_terms.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql diff --git a/src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql b/src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql new file mode 100644 index 000000000..3e3b6950f --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql @@ -0,0 +1,6 @@ +ALTER TABLE anatomicalsite + ADD COLUMN cellularcomponentother boolean DEFAULT false NOT NULL, + ADD COLUMN cellularcomponentribbonterm_id bigint; + +ALTER TABLE ONLY anatomicalsite + ADD CONSTRAINT fkcuqc7qacirmg4wqcwuou8abjn FOREIGN KEY (cellularcomponentribbonterm_id) REFERENCES public.ontologyterm(id); \ No newline at end of file From 603e4948a037af710229b80254c8243372e97bfa Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 14 Aug 2024 09:28:45 -0500 Subject: [PATCH 117/342] SCRUM-4300 add test cases --- .../ExpressionBulkUploadFmsITCase.java | 11 ++++- .../curation_api/base/BaseITCase.java | 40 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index d782d16aa..2fc303713 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -11,10 +11,13 @@ import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; import org.junit.jupiter.api.*; +import java.util.ArrayList; import java.util.List; +import java.util.Set; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; @@ -45,6 +48,7 @@ public class ExpressionBulkUploadFmsITCase extends BaseITCase { private final String anatomicalStructureTermId = "ANAT:001"; private final String anatomicalSubstructureTermId = "ANAT:002"; private final String cellularComponentTermId = "GOTEST:0012"; + private final String cellularComponentRibbonTermId = "GOSLIMTEST:0012"; private final String anatomicalStructureQualifierTermId = "UBERON:002"; private final String anatomicalSubstructureQualifierTermId = "UBERON:003"; private final String cellularComponentQualifierTermId = "FBCV:001"; @@ -88,6 +92,8 @@ public void expressionBulkUploadAllFields() throws Exception { .body("results[0].expressionPattern.whereExpressed.anatomicalStructure.curie", is(anatomicalStructureTermId)) .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructure.curie", is(anatomicalSubstructureTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentTerm.curie", is(cellularComponentTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentRibbonTerm.curie", is(cellularComponentTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentOther", is(false)) .body("results[0].expressionPattern.whereExpressed.anatomicalStructureQualifiers[0].name", is(anatomicalStructureQualifierTermId)) .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureQualifiers[0].name", is(anatomicalSubstructureQualifierTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentQualifiers[0].name", is(cellularComponentQualifierTermId)) @@ -159,7 +165,10 @@ private void loadRequiredEntities() throws Exception { createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); loadAnatomyTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); loadAnatomyTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); - loadGOTerm(cellularComponentTermId, "CellularComponentTermTest"); + List subsets = new ArrayList(); + subsets.add("goslim_agr"); + GOTerm isaAncestor = createGOTermWithSubsets(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", subsets); + loadGOTermWithAncestors(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 82165ba77..8b40f5260 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -20,6 +20,7 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.regex.Pattern; import static io.restassured.RestAssured.given; @@ -344,6 +345,25 @@ public GOTerm createGoTerm(String curie, String name, Boolean obsolete) { return response.getEntity(); } + public GOTerm createGOTermWithSubsets(String curie, String name, List subsets) throws Exception { + GOTerm goTerm = new GOTerm(); + goTerm.setCurie(curie); + goTerm.setName(name); + goTerm.setObsolete(false); + goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + goTerm.setSubsets(subsets); + + ObjectResponse response = given(). + contentType("application/json"). + body(goTerm). + when(). + post("/api/goterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefGOTerm()); + return response.getEntity(); + } + public MPTerm createMpTerm(String curie, Boolean obsolete) { MPTerm mpTerm = new MPTerm(); mpTerm.setCurie(curie); @@ -1256,6 +1276,26 @@ public void loadGOTerm(String curie, String name) throws Exception { statusCode(200); } + + public void loadGOTermWithAncestors(String curie, String name, GOTerm ancestor) throws Exception { + GOTerm goTerm = new GOTerm(); + List subsets = new ArrayList(); + subsets.add("goslim_agr"); + goTerm.setCurie(curie); + goTerm.setName(name); + goTerm.setObsolete(false); + goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + goTerm.addIsaAncestor(ancestor); + + RestAssured.given(). + contentType("application/json"). + body(goTerm). + when(). + put("/api/goterm"). + then(). + statusCode(200); + } + public void loadMITerm(String curie, String name) throws Exception { MITerm miTerm = new MITerm(); miTerm.setCurie(curie); From a5c45bfb5a15d147cfb33f2099d25908bbd00451 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 14 Aug 2024 09:41:12 -0500 Subject: [PATCH 118/342] fix checkstyle --- .../curation_api/ExpressionBulkUploadFmsITCase.java | 1 - .../java/org/alliancegenome/curation_api/base/BaseITCase.java | 1 - 2 files changed, 2 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 2fc303713..2d09a469f 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -17,7 +17,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Set; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 8b40f5260..2af45eae5 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -20,7 +20,6 @@ import java.nio.file.Path; import java.util.ArrayList; import java.util.List; -import java.util.Set; import java.util.regex.Pattern; import static io.restassured.RestAssured.given; From 8164b6df962ec0490cd49e5b078b9282f02c86cf Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 14 Aug 2024 09:48:39 -0500 Subject: [PATCH 119/342] fix integration test --- .../curation_api/services/ontology/GoTermService.java | 1 - .../curation_api/ExpressionBulkUploadFmsITCase.java | 4 ++-- .../java/org/alliancegenome/curation_api/base/BaseITCase.java | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java b/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java index 84a3588f2..df1693e5e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ontology/GoTermService.java @@ -1,6 +1,5 @@ package org.alliancegenome.curation_api.services.ontology; - import org.alliancegenome.curation_api.dao.ontology.GoTermDAO; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; import org.alliancegenome.curation_api.services.base.BaseOntologyTermService; diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 2d09a469f..022135b5e 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -91,7 +91,7 @@ public void expressionBulkUploadAllFields() throws Exception { .body("results[0].expressionPattern.whereExpressed.anatomicalStructure.curie", is(anatomicalStructureTermId)) .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructure.curie", is(anatomicalSubstructureTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentTerm.curie", is(cellularComponentTermId)) - .body("results[0].expressionPattern.whereExpressed.cellularComponentRibbonTerm.curie", is(cellularComponentTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentRibbonTerm.curie", is(cellularComponentRibbonTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentOther", is(false)) .body("results[0].expressionPattern.whereExpressed.anatomicalStructureQualifiers[0].name", is(anatomicalStructureQualifierTermId)) .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureQualifiers[0].name", is(anatomicalSubstructureQualifierTermId)) @@ -167,7 +167,7 @@ private void loadRequiredEntities() throws Exception { List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGOTermWithSubsets(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", subsets); - loadGOTermWithAncestors(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); + loadGOTermWithAncestor(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 2af45eae5..af35bd743 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -1276,7 +1276,7 @@ public void loadGOTerm(String curie, String name) throws Exception { } - public void loadGOTermWithAncestors(String curie, String name, GOTerm ancestor) throws Exception { + public void loadGOTermWithAncestor(String curie, String name, GOTerm ancestor) throws Exception { GOTerm goTerm = new GOTerm(); List subsets = new ArrayList(); subsets.add("goslim_agr"); From 41ed4217d427b8e2bccda0c9025fa53dfcd39e76 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 15 Aug 2024 15:06:43 -0500 Subject: [PATCH 120/342] SCRUM-4300 update GOTerm BaseIT methods --- ...neExpressionAnnotationFmsDTOValidator.java | 1 + ...0.37.0.3__add_expression_ribbon_terms.sql} | 0 .../ExpressionBulkUploadFmsITCase.java | 4 +- .../curation_api/base/BaseITCase.java | 45 ++++++------------- 4 files changed, 16 insertions(+), 34 deletions(-) rename src/main/resources/db/migration/{v0.37.0.2__add_expression_ribbon_terms.sql => v0.37.0.3__add_expression_ribbon_terms.sql} (100%) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 424286f84..fc3d9fe02 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -216,6 +216,7 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (cellularComponentRibbon == null) { anatomicalSite.setCellularComponentOther(true); } else { + anatomicalSite.setCellularComponentOther(false); anatomicalSite.setCellularComponentRibbonTerm(cellularComponentRibbon); } anatomicalSite.setCellularComponentTerm(cellularComponent); diff --git a/src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql b/src/main/resources/db/migration/v0.37.0.3__add_expression_ribbon_terms.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.2__add_expression_ribbon_terms.sql rename to src/main/resources/db/migration/v0.37.0.3__add_expression_ribbon_terms.sql diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 022135b5e..c600b678c 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -166,8 +166,8 @@ private void loadRequiredEntities() throws Exception { loadAnatomyTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); List subsets = new ArrayList(); subsets.add("goslim_agr"); - GOTerm isaAncestor = createGOTermWithSubsets(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", subsets); - loadGOTermWithAncestor(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); + GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); + loadGOTerm(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index af35bd743..357f313ea 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -327,30 +327,21 @@ public Gene createGene(String modEntityId, String taxonCurie, Boolean obsolete, } public GOTerm createGoTerm(String curie, String name, Boolean obsolete) { - GOTerm goTerm = new GOTerm(); - goTerm.setCurie(curie); - goTerm.setObsolete(obsolete); - goTerm.setName(name); - goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + return createGoTerm(curie, name, obsolete, null, null); + } - ObjectResponse response = given(). - contentType("application/json"). - body(goTerm). - when(). - post("/api/goterm"). - then(). - statusCode(200). - extract().body().as(getObjectResponseTypeRefGOTerm()); - return response.getEntity(); + public GOTerm createGoTerm(String curie, String name, Boolean obsolete, List subsets) { + return createGoTerm(curie, name, obsolete, null, subsets); } - public GOTerm createGOTermWithSubsets(String curie, String name, List subsets) throws Exception { + public GOTerm createGoTerm(String curie, String name, Boolean obsolete, GOTerm ancestor, List subsets) { GOTerm goTerm = new GOTerm(); goTerm.setCurie(curie); + goTerm.setObsolete(obsolete); goTerm.setName(name); - goTerm.setObsolete(false); goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); goTerm.setSubsets(subsets); + goTerm.addIsaAncestor(ancestor); ObjectResponse response = given(). contentType("application/json"). @@ -1260,31 +1251,21 @@ public void loadGenes(List modEntityIds, String taxonCurie, VocabularyTe } public void loadGOTerm(String curie, String name) throws Exception { - GOTerm goTerm = new GOTerm(); - goTerm.setCurie(curie); - goTerm.setName(name); - goTerm.setObsolete(false); - goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(goTerm). - when(). - put("/api/goterm"). - then(). - statusCode(200); + loadGOTerm(curie, name, null, null); } + public void loadGOTerm(String curie, String name, GOTerm ancestor) throws Exception { + loadGOTerm(curie, name, ancestor, null); + } - public void loadGOTermWithAncestor(String curie, String name, GOTerm ancestor) throws Exception { + public void loadGOTerm(String curie, String name, GOTerm ancestor, List subsets) throws Exception { GOTerm goTerm = new GOTerm(); - List subsets = new ArrayList(); - subsets.add("goslim_agr"); goTerm.setCurie(curie); goTerm.setName(name); goTerm.setObsolete(false); goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); goTerm.addIsaAncestor(ancestor); + goTerm.setSubsets(subsets); RestAssured.given(). contentType("application/json"). From 4327993c5a59e3a04579102dc4968febd3f29919 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 19 Aug 2024 12:47:11 +0100 Subject: [PATCH 121/342] Clean up erroneous DO terms --- .../v0.37.0.3__cleanup_erroneous_do_terms.sql | 124 ++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql diff --git a/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql b/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql new file mode 100644 index 000000000..4c96a8c9d --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql @@ -0,0 +1,124 @@ +-- Create temporary tables + +CREATE TABLE ontology_ids_to_delete ( + id bigint PRIMARY KEY +); + +CREATE TABLE other_ids_to_delete ( + id bigint PRIMARY KEY +); + +INSERT INTO ontology_ids_to_delete (id) SELECT id FROM ontologyterm + WHERE curie = 'DOID:0080025' OR curie = 'DOID:0080004' OR curie = 'DOID:0080003'; + +-- Clean up disease annotations + +INSERT INTO other_ids_to_delete (id) SELECT id FROM diseaseannotation WHERE diseaseannotationobject_id IN ( + SELECT id FROM ontology_ids_to_delete +); + +DELETE FROM agmdiseaseannotation_gene WHERE agmdiseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM agmdiseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM allelediseaseannotation_gene WHERE allelediseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM allelediseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM genediseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM genediseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM genediseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM diseaseannotation_biologicalentity WHERE diseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM diseaseannotation_gene WHERE diseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM diseaseannotation_ontologyterm WHERE diseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM diseaseannotation_vocabularyterm WHERE diseaseannotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM diseaseannotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM annotation_conditionrelation WHERE annotation_id IN (SELECT id FROM other_ids_to_delete); + +CREATE TABLE note_ids_to_delete ( + id bigint PRIMARY KEY +); + +INSERT INTO note_ids_to_delete (id) SELECT relatednotes_id FROM annotation_note WHERE annotation_id IN ( + SELECT id FROM other_ids_to_delete +); + +DELETE FROM annotation_note WHERE annotation_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM note WHERE id IN (SELECT id FROM note_ids_to_delete); + +DROP TABLE note_ids_to_delete; + +DELETE FROM annotation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM singlereferenceassociation WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM association WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM other_ids_to_delete; + +-- Clean up xrefs + +INSERT INTO other_ids_to_delete (id) SELECT crossreferences_id FROM ontologyterm_crossreference WHERE ontologyterm_id IN ( + SELECT id FROM ontology_ids_to_delete +); + +DELETE FROM ontologyterm_crossreference WHERE crossreferences_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM crossreference WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM ids_to_delete; + +-- Clean up definition URLs + +DELETE FROM ontologyterm_definitionurls WHERE ontologyterm_id IN (SELECT id FROM ontology_ids_to_delete); + +-- Clean up ancestor/descendants + +DELETE FROM ontologyterm_isa_ancestor_descendant WHERE isaancestors_id IN (SELECT id FROM ontology_ids_to_delete); + +DELETE FROM ontologyterm_isa_ancestor_descendant WHERE isadescendants_id IN (SELECT id FROM ontology_ids_to_delete); + +-- Clean up parents/children + +DELETE FROM ontologyterm_isa_parent_children WHERE isachildren_id IN (SELECT id FROM ontology_ids_to_delete); + +DELETE FROM ontologyterm_isa_parent_children WHERE isaparents_id IN (SELECT id FROM ontology_ids_to_delete); + +-- Clean up secondary identifiers + +DELETE FROM ontologyterm_secondaryidentifiers where ontologyterm_id IN (SELECT id FROM ontology_ids_to_delete); + +-- Clean up subsets + +DELETE FROM ontologyterm_subsets where ontologyterm_id IN (SELECT id FROM ontology_ids_to_delete); + +-- Clean up synonyms + +INSERT INTO other_ids_to_delete (id) SELECT synonyms_id FROM ontologyterm_synonym WHERE ontologyterm_id IN ( + SELECT id FROM ontology_ids_to_delete +); + +DELETE FROM ontologyterm_synonym WHERE synonyms_id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM synonym WHERE id IN (SELECT id FROM other_ids_to_delete); + +DELETE FROM ids_to_delete; + +-- Clean up ontology terms + +DELETE FROM ontologyterm WHERE id IN (SELECT id FROM ontology_ids_to_delete); + +-- Remove temporary tables + +DROP TABLE ontology_ids_to_delete; + +DROP TABLE other_ids_to_delete; \ No newline at end of file From bae0d18cce8760f42e3c648f0732c6a093b0dd3e Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 19 Aug 2024 13:56:59 +0100 Subject: [PATCH 122/342] Fix tmp table name --- .../db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql b/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql index 4c96a8c9d..7beec0550 100644 --- a/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql +++ b/src/main/resources/db/migration/v0.37.0.3__cleanup_erroneous_do_terms.sql @@ -9,7 +9,8 @@ CREATE TABLE other_ids_to_delete ( ); INSERT INTO ontology_ids_to_delete (id) SELECT id FROM ontologyterm - WHERE curie = 'DOID:0080025' OR curie = 'DOID:0080004' OR curie = 'DOID:0080003'; + WHERE curie = 'DOID:0080025' OR curie = 'DOID:0080004' OR curie = 'DOID:0080003' + OR curie = 'DOID:0080035' OR curie = 'DOID:0080002'; -- Clean up disease annotations @@ -75,7 +76,7 @@ DELETE FROM ontologyterm_crossreference WHERE crossreferences_id IN (SELECT id F DELETE FROM crossreference WHERE id IN (SELECT id FROM other_ids_to_delete); -DELETE FROM ids_to_delete; +DELETE FROM other_ids_to_delete; -- Clean up definition URLs @@ -111,7 +112,7 @@ DELETE FROM ontologyterm_synonym WHERE synonyms_id IN (SELECT id FROM other_ids_ DELETE FROM synonym WHERE id IN (SELECT id FROM other_ids_to_delete); -DELETE FROM ids_to_delete; +DELETE FROM other_ids_to_delete; -- Clean up ontology terms From df094dc08badded340a00663f6a14282212d4d04 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 20 Aug 2024 21:23:55 +0100 Subject: [PATCH 123/342] Remove Pseudogene: prefix --- .../curation_api/services/helpers/gff3/Gff3AttributesHelper.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index 4eca281c6..ef6eef1c3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -32,6 +32,7 @@ public static Map getAttributes(Gff3DTO dto, BackendBulkDataProv idsString = idsString.replaceAll("Gene:", ""); idsString = idsString.replaceAll("Transcript:", ""); idsString = idsString.replaceAll("CDS:", ""); + idsString = idsString.replaceAll("Pseudogene:", ""); } String[] idsList = idsString.split(","); List processedIdList = new ArrayList<>(); From 57aa5bd1c1aa1f63ac39e7cc14e7c9b9599bc134 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 23 Aug 2024 13:17:12 +0100 Subject: [PATCH 124/342] SCRUM-3952: Fix stage uberon slim terms --- .../db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql diff --git a/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql b/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql new file mode 100644 index 000000000..2ffe88672 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql @@ -0,0 +1,3 @@ +DELETE FROM vocabularyterm WHERE name = 'post embryonic' AND id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); +DELETE FROM vocabularyterm WHERE name = 'pre-adult' AND id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'post embryonic, pre-adult', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; From 5f4768436a077b2068bd1af66cbfb57a7b6a1651 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 23 Aug 2024 13:57:21 +0100 Subject: [PATCH 125/342] SCRUM-3952: Fix stage uberon slim terms --- .../db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql b/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql index 2ffe88672..1344b0135 100644 --- a/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql +++ b/src/main/resources/db/migration/v0.37.0.4__fix_stageuberonslim_terms.sql @@ -1,3 +1,3 @@ -DELETE FROM vocabularyterm WHERE name = 'post embryonic' AND id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); -DELETE FROM vocabularyterm WHERE name = 'pre-adult' AND id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); +DELETE FROM vocabularyterm WHERE name = 'post embryonic' AND vocabulary_id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); +DELETE FROM vocabularyterm WHERE name = 'pre-adult' AND vocabulary_id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'); INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'post embryonic, pre-adult', id FROM vocabulary WHERE vocabularylabel = 'stage_uberon_slim_terms'; From b444d9d46962232e496c68c6cfc087352d75fe3a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 23 Aug 2024 14:05:26 +0100 Subject: [PATCH 126/342] Remove redundant test methods and correct LinkML version --- .../constants/LinkMLSchemaConstants.java | 2 +- .../model/entities/AnatomicalSite.java | 2 +- .../DiseaseAnnotationBulkUploadITCase.java | 4 +-- .../ExpressionBulkUploadFmsITCase.java | 4 +-- ...henotypeAnnotationBulkUploadFmsITCase.java | 2 +- .../curation_api/base/BaseITCase.java | 30 +++---------------- 6 files changed, 11 insertions(+), 33 deletions(-) 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 056d25135..f668f7188 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.6.0"; + public static final String LATEST_RELEASE = "2.6.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/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 8a5a4b783..469969cd5 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -30,7 +30,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE) +@AGRCurationSchemaVersion(min = "2.6.1", max = LinkMLSchemaConstants.LATEST_RELEASE) @Schema(name = "Anatomical_Site", description = "Anatomical part of an expression pattern") @Table(indexes = { @Index(name = "anatomicalsite_anatomicalstructure_index ", columnList = "anatomicalstructure_id"), diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java index bd17c4ce7..ad115c5cf 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java @@ -122,8 +122,8 @@ private void loadRequiredEntities() throws Exception { createEcoTerm(ecoTerm, "Test ECOTerm", false, true); createEcoTerm(ecoTerm2, "Test ECOTerm 2", false, true); createEcoTerm(unsupportedEcoTerm, "Test unsupported ECOTerm", false, false); - loadGOTerm(goTerm, "Test GOTerm"); - loadGOTerm(goTerm2, "Test GOTerm 2"); + createGoTerm(goTerm, "Test GOTerm", false); + createGoTerm(goTerm2, "Test GOTerm 2", false); loadExperimentalConditionTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); loadZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", OntologyConstants.ZECO_AGR_SLIM_SUBSET); loadZecoTerm(zecoTerm2, "Test ExperimentalConditionOntologyTerm 2", OntologyConstants.ZECO_AGR_SLIM_SUBSET); diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index c600b678c..f25763efc 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -156,7 +156,7 @@ private void loadRequiredEntities() throws Exception { loadReference(agrPublicationId, publicationId); loadReference(agrReferenceId, referenceId); Vocabulary vocabulary2 = createVocabulary(VocabularyConstants.GENE_EXPRESSION_VOCABULARY, false); - VocabularyTerm isExpressed = createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); + createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); Vocabulary stageUberonTermVocabulary = getVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS); Vocabulary anatomicalStructureUberonTermVocabulary = getVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS); Vocabulary cellullarComponentQualififerVocabulary = getVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS); @@ -167,7 +167,7 @@ private void loadRequiredEntities() throws Exception { List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); - loadGOTerm(cellularComponentTermId, "CellularComponentTermTest", isaAncestor); + createGoTerm(cellularComponentTermId, "CellularComponentTermTest", false, isaAncestor); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); diff --git a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java index 116d02737..3c62cbe04 100644 --- a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java @@ -73,7 +73,7 @@ public void init() { private final String phenotypeStatement = "test phenotype statement"; private void loadRequiredEntities() throws Exception { - loadGOTerm(goTerm, "Test GOTerm"); + createGoTerm(goTerm, "Test GOTerm", false); loadExperimentalConditionTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); loadZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", OntologyConstants.ZECO_AGR_SLIM_SUBSET); loadZecoTerm(nonSlimZecoTerm, "Test ExperimentalConditionOntologyTerm", null); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 357f313ea..c9cd81528 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -334,6 +334,10 @@ public GOTerm createGoTerm(String curie, String name, Boolean obsolete, List subsets) { GOTerm goTerm = new GOTerm(); goTerm.setCurie(curie); @@ -1250,32 +1254,6 @@ public void loadGenes(List modEntityIds, String taxonCurie, VocabularyTe } } - public void loadGOTerm(String curie, String name) throws Exception { - loadGOTerm(curie, name, null, null); - } - - public void loadGOTerm(String curie, String name, GOTerm ancestor) throws Exception { - loadGOTerm(curie, name, ancestor, null); - } - - public void loadGOTerm(String curie, String name, GOTerm ancestor, List subsets) throws Exception { - GOTerm goTerm = new GOTerm(); - goTerm.setCurie(curie); - goTerm.setName(name); - goTerm.setObsolete(false); - goTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - goTerm.addIsaAncestor(ancestor); - goTerm.setSubsets(subsets); - - RestAssured.given(). - contentType("application/json"). - body(goTerm). - when(). - put("/api/goterm"). - then(). - statusCode(200); - } - public void loadMITerm(String curie, String name) throws Exception { MITerm miTerm = new MITerm(); miTerm.setCurie(curie); From d6c2e1acb077b93521630a8ba77b2ab4de825ca0 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 23 Aug 2024 14:23:56 +0100 Subject: [PATCH 127/342] Bump migration version --- ...ibbon_terms.sql => v0.37.0.4__add_expression_ribbon_terms.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.37.0.3__add_expression_ribbon_terms.sql => v0.37.0.4__add_expression_ribbon_terms.sql} (100%) diff --git a/src/main/resources/db/migration/v0.37.0.3__add_expression_ribbon_terms.sql b/src/main/resources/db/migration/v0.37.0.4__add_expression_ribbon_terms.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.3__add_expression_ribbon_terms.sql rename to src/main/resources/db/migration/v0.37.0.4__add_expression_ribbon_terms.sql From 239cf252a96adb5ab76d6c77d8a66c37392fdcae Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 23 Aug 2024 15:56:30 +0100 Subject: [PATCH 128/342] Another migration version nr bump --- ...ibbon_terms.sql => v0.37.0.5__add_expression_ribbon_terms.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.37.0.4__add_expression_ribbon_terms.sql => v0.37.0.5__add_expression_ribbon_terms.sql} (100%) diff --git a/src/main/resources/db/migration/v0.37.0.4__add_expression_ribbon_terms.sql b/src/main/resources/db/migration/v0.37.0.5__add_expression_ribbon_terms.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.4__add_expression_ribbon_terms.sql rename to src/main/resources/db/migration/v0.37.0.5__add_expression_ribbon_terms.sql From e61ece8f92d9378faae6536899826acc4434cec6 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 21 Aug 2024 23:34:27 -0600 Subject: [PATCH 129/342] Initial Code for flattening the tables --- .../slotAnnotations/NameSlotAnnotation.java | 9 +- .../slotAnnotations/SlotAnnotation.java | 24 +- .../AlleleDatabaseStatusSlotAnnotation.java | 4 - .../AlleleFullNameSlotAnnotation.java | 3 - .../AlleleFunctionalImpactSlotAnnotation.java | 9 +- ...mlineTransmissionStatusSlotAnnotation.java | 4 - .../AlleleInheritanceModeSlotAnnotation.java | 5 - .../AlleleMutationTypeSlotAnnotation.java | 8 +- ...AlleleNomenclatureEventSlotAnnotation.java | 4 - .../AlleleSecondaryIdSlotAnnotation.java | 3 - .../AlleleSymbolSlotAnnotation.java | 3 - .../AlleleSynonymSlotAnnotation.java | 3 - .../ConstructComponentSlotAnnotation.java | 11 +- .../ConstructFullNameSlotAnnotation.java | 3 - .../ConstructSymbolSlotAnnotation.java | 3 - .../ConstructSynonymSlotAnnotation.java | 3 - .../GeneFullNameSlotAnnotation.java | 3 - .../GeneSecondaryIdSlotAnnotation.java | 3 - .../GeneSymbolSlotAnnotation.java | 3 - .../GeneSynonymSlotAnnotation.java | 3 - .../GeneSystematicNameSlotAnnotation.java | 3 - ....37.0.4__flatten_slotannotation_tables.sql | 242 ++++++++++++++++++ 22 files changed, 276 insertions(+), 80 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/NameSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/NameSlotAnnotation.java index 1337d5176..fefcffbc9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/NameSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/NameSlotAnnotation.java @@ -18,10 +18,9 @@ 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; @@ -32,10 +31,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "NameSlotAnnotation", description = "POJO representing a name slot annotation") -@Table(indexes = { - @Index(name = "nameslotannotation_nametype_index", columnList = "nameType_id"), - @Index(name = "nameslotannotation_synonymscope_index", columnList = "synonymScope_id") -}) public abstract class NameSlotAnnotation extends SlotAnnotation { @IndexedEmbedded(includeDepth = 1) @@ -49,12 +44,14 @@ public abstract class NameSlotAnnotation extends SlotAnnotation { @KeywordField(name = "formatText_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) @EqualsAndHashCode.Include + @Column(columnDefinition = "TEXT") protected String formatText; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "displayText_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) @EqualsAndHashCode.Include + @Column(columnDefinition = "TEXT") protected String displayText; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java index 4bcfa0423..d2cb73b8b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java @@ -14,6 +14,7 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.DiscriminatorColumn; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.Inheritance; @@ -25,16 +26,33 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Inheritance(strategy = InheritanceType.JOINED) +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "SlotAnnotationType") @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Schema(name = "SlotAnnotation", description = "POJO that represents a SlotAnnotation") @ToString(callSuper = true) @Table(indexes = { - @Index(name = "slotannotation_createdby_index", columnList = "createdBy_id"), - @Index(name = "slotannotation_updatedby_index", columnList = "updatedBy_id") + @Index(name = "slotannotation_createdby_index", columnList = "createdBy_id"), + @Index(name = "slotannotation_updatedby_index", columnList = "updatedBy_id"), + @Index(name = "slotannotation_singleallele_index", columnList = "singleallele_id"), + @Index(name = "slotannotation_singleconstruct_index", columnList = "singleConstruct_id"), + @Index(name = "slotannotation_singlegene_index", columnList = "singlegene_id"), + @Index(name = "slotannotation_inheritancemode_index", columnList = "inheritancemode_id"), + @Index(name = "slotannotation_phenotypeterm_index", columnList = "phenotypeterm_id"), + @Index(name = "slotannotation_status_index", columnList = "germlinetransmissionstatus_id"), + @Index(name = "slotannotation_nomenclatureevent_index", columnList = "nomenclatureevent_id"), + @Index(name = "slotannotation_databasestatus_index", columnList = "databasestatus_id"), + @Index(name = "slotannotation_componentsymbol_index", columnList = "componentSymbol"), + @Index(name = "slotannotation_taxon_index", columnList = "taxon_id"), + @Index(name = "slotannotation_relation_index", columnList = "relation_id"), + @Index(name = "slotannotation_nametype_index", columnList = "nameType_id"), + @Index(name = "slotannotation_synonymscope_index", columnList = "synonymScope_id") }) + + + @AGRCurationSchemaVersion(min = "1.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) public class SlotAnnotation extends AuditedObject { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleDatabaseStatusSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleDatabaseStatusSlotAnnotation.java index ad40fc984..aa3018a19 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleDatabaseStatusSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleDatabaseStatusSlotAnnotation.java @@ -15,10 +15,8 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -29,8 +27,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleDatabaseStatusSlotAnnotation", description = "POJO representing an allele database status slot annotation") -@Table(indexes = { @Index(name = "alleledatabasestatus_singleallele_index", columnList = "singleallele_id"), - @Index(name = "alleledatabasestatus_databasestatus_index", columnList = "databasestatus_id")}) public class AlleleDatabaseStatusSlotAnnotation extends SlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFullNameSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFullNameSlotAnnotation.java index 5086889cb..d6803bb4f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFullNameSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFullNameSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "AlleleFullNameSlotAnnotation", description = "POJO representing an allele full name slot annotation") -@Table(indexes = { @Index(name = "allelefullname_singleallele_index", columnList = "singleallele_id") }) public class AlleleFullNameSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java index 6ea256d75..97848806b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java @@ -30,7 +30,6 @@ 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; @@ -41,8 +40,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.1", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleFunctionalImpactSlotAnnotation", description = "POJO representing an allele functional impact slot annotation") -@Table(indexes = { @Index(name = "allelefunctionalimpact_singleallele_index", columnList = "singleallele_id"), - @Index(name = "allelefunctionalimpact_phenotypeterm_index", columnList = "phenotypeterm_id")}) public class AlleleFunctionalImpactSlotAnnotation extends SlotAnnotation { @ManyToOne @@ -53,8 +50,10 @@ public class AlleleFunctionalImpactSlotAnnotation extends SlotAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.SELECT) - @JoinTable(indexes = { @Index(name = "allelefunctionalimpactsa_vocabterm_afisa_index", columnList = "allelefunctionalimpactslotannotation_id"), - @Index(name = "allelefunctionalimpactsa_vocabterm_functionalimpacts_index", columnList = "functionalimpacts_id") }) + @JoinTable(indexes = { + @Index(name = "slotannotation_id_index", columnList = "slotannotation_id"), + @Index(name = "slotannotation_functionalimpacts_index", columnList = "functionalimpacts_id") + }) @JsonView({ View.FieldsAndLists.class, View.AlleleView.class }) private List functionalImpacts; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleGermlineTransmissionStatusSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleGermlineTransmissionStatusSlotAnnotation.java index cb8a284c7..80380a0e1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleGermlineTransmissionStatusSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleGermlineTransmissionStatusSlotAnnotation.java @@ -15,9 +15,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -28,8 +26,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleGermlineTransmissionStatusSlotAnnotation", description = "POJO representing an allele germline transmission status slot annotation") -@Table(indexes = { @Index(name = "allelegermlinetransmissionstatus_singleallele_index", columnList = "singleallele_id"), - @Index(name = "allelegermlinetransmissionstatus_status_index", columnList = "germlinetransmissionstatus_id")}) public class AlleleGermlineTransmissionStatusSlotAnnotation extends SlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleInheritanceModeSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleInheritanceModeSlotAnnotation.java index 97cee9787..67940fe2a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleInheritanceModeSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleInheritanceModeSlotAnnotation.java @@ -22,9 +22,7 @@ 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; @@ -35,9 +33,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.1", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleInheritanceModeSlotAnnotation", description = "POJO representing an allele inheritance mode slot annotation") -@Table(indexes = { @Index(name = "alleleinheritancemode_singleallele_index", columnList = "singleallele_id"), - @Index(name = "alleleinheritancemode_inheritancemode_index", columnList = "inheritancemode_id"), - @Index(name = "alleleinheritancemode_phenotypeterm_index", columnList = "phenotypeterm_id")}) public class AlleleInheritanceModeSlotAnnotation extends SlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java index d23436f00..b4abf380e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java @@ -23,7 +23,6 @@ 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; @@ -34,7 +33,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleMutationtTypeSlotAnnotation", description = "POJO representing an allele mutation type slot annotation") -@Table(indexes = { @Index(name = "allelemutationtype_singleallele_index", columnList = "singleallele_id") }) public class AlleleMutationTypeSlotAnnotation extends SlotAnnotation { @ManyToOne @@ -45,8 +43,10 @@ public class AlleleMutationTypeSlotAnnotation extends SlotAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.SELECT) - @JoinTable(indexes = { @Index(name = "allelemutationtypesa_soterm_amsa_index", columnList = "allelemutationtypeslotannotation_id"), - @Index(name = "allelemutationtypesa_soterm_mutationtypes_index", columnList = "mutationtypes_id") }) + @JoinTable(indexes = { + @Index(name = "slotannotation_soterm_amsa_index", columnList = "slotannotation_id"), + @Index(name = "slotannotation_soterm_mutationtypes_index", columnList = "mutationtypes_id") + }) @JsonView({ View.FieldsAndLists.class, View.AlleleView.class }) private List mutationTypes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleNomenclatureEventSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleNomenclatureEventSlotAnnotation.java index b626d523f..4b5632328 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleNomenclatureEventSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleNomenclatureEventSlotAnnotation.java @@ -15,9 +15,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -28,8 +26,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleNomenclatureSlotAnnotation", description = "POJO representing an allele nomenclature event slot annotation") -@Table(indexes = { @Index(name = "allelenomenclatureevent_singleallele_index", columnList = "singleallele_id"), - @Index(name = "allelenomenclatureevent_nomenclatureevent_index", columnList = "nomenclatureevent_id")}) public class AlleleNomenclatureEventSlotAnnotation extends SlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSecondaryIdSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSecondaryIdSlotAnnotation.java index c61be7b64..4d8027919 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSecondaryIdSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSecondaryIdSlotAnnotation.java @@ -10,9 +10,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; 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; @@ -23,7 +21,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "AlleleSecondaryIdSlotAnnotation", description = "POJO representing an allele secondary ID slot annotation") -@Table(indexes = { @Index(name = "allelesecondaryid_singleallele_index", columnList = "singleallele_id") }) public class AlleleSecondaryIdSlotAnnotation extends SecondaryIdSlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSymbolSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSymbolSlotAnnotation.java index c384b2836..f14bec427 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSymbolSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSymbolSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "AlleleSymbolSlotAnnotation", description = "POJO representing an allele symbol slot annotation") -@Table(indexes = { @Index(name = "allelesymbol_singleallele_index", columnList = "singleallele_id") }) public class AlleleSymbolSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSynonymSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSynonymSlotAnnotation.java index d04b130da..227634f25 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSynonymSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleSynonymSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; 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; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "AlleleSynonymSlotAnnotation", description = "POJO representing an allele synonym slot annotation") -@Table(indexes = { @Index(name = "allelesynonym_singleallele_index", columnList = "singleallele_id") }) public class AlleleSynonymSlotAnnotation extends NameSlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java index eb0422054..5f3ac569d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java @@ -30,7 +30,6 @@ 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; @@ -41,12 +40,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.10.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "ConstructComponentSlotAnnotation", description = "POJO representing a construct component slot annotation") -@Table(indexes = { - @Index(name = "constructcomponentslotannotation_singleconstruct_index", columnList = "singleConstruct_id"), - @Index(name = "constructcomponentslotannotation_componentsymbol_index", columnList = "componentSymbol"), - @Index(name = "constructcomponentslotannotation_taxon_index", columnList = "taxon_id"), - @Index(name = "constructcomponentslotannotation_relation_index", columnList = "relation_id") -}) public class ConstructComponentSlotAnnotation extends SlotAnnotation { @ManyToOne @@ -85,8 +78,8 @@ public class ConstructComponentSlotAnnotation extends SlotAnnotation { @JsonView({ View.FieldsAndLists.class, View.ConstructView.class }) @JoinTable( indexes = { - @Index(name = "constructcomponentsa_note_ccsa_index", columnList = "constructcomponentslotannotation_id"), - @Index(name = "constructcomponentsa_note_relatednotes_index", columnList = "relatednotes_id") + @Index(name = "slotannotation_note_ccsa_index", columnList = "slotannotation_id"), + @Index(name = "slotannotation_note_relatednotes_index", columnList = "relatednotes_id") } ) private List relatedNotes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructFullNameSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructFullNameSlotAnnotation.java index 6eca7ca3d..5d4be1bcf 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructFullNameSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructFullNameSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.10.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "ConstructFullNameSlotAnnotation", description = "POJO representing a construct full name slot annotation") -@Table(indexes = { @Index(name = "constructfullname_singleconstruct_index", columnList = "singleconstruct_id") }) public class ConstructFullNameSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSymbolSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSymbolSlotAnnotation.java index fe6926c4a..aa0614176 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSymbolSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSymbolSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.10.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "ConstructSymbolSlotAnnotation", description = "POJO representing a construct symbol slot annotation") -@Table(indexes = { @Index(name = "constructsymbol_singleconstruct_index", columnList = "singleconstruct_id") }) public class ConstructSymbolSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSynonymSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSynonymSlotAnnotation.java index 82f895f76..6c803d16a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSynonymSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructSynonymSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; 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; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.10.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "ConstructSynonymSlotAnnotation", description = "POJO representing a construct synonym slot annotation") -@Table(indexes = { @Index(name = "constructsynonym_singleconstruct_index", columnList = "singleconstruct_id") }) public class ConstructSynonymSlotAnnotation extends NameSlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneFullNameSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneFullNameSlotAnnotation.java index 630da4b8c..fe3f53f7d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneFullNameSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneFullNameSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "GeneFullNameSlotAnnotation", description = "POJO representing a gene full name slot annotation") -@Table(indexes = { @Index(name = "genefullname_singlegene_index", columnList = "singlegene_id") }) public class GeneFullNameSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSecondaryIdSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSecondaryIdSlotAnnotation.java index de66ef259..3d1f0c332 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSecondaryIdSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSecondaryIdSlotAnnotation.java @@ -10,9 +10,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; 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; @@ -23,7 +21,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.7.2", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { SlotAnnotation.class }) @Schema(name = "GeneSecondaryIdSlotAnnotation", description = "POJO representing a gene secondary ID slot annotation") -@Table(indexes = { @Index(name = "genesecondaryid_singlegene_index", columnList = "singlegene_id") }) public class GeneSecondaryIdSlotAnnotation extends SecondaryIdSlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSymbolSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSymbolSlotAnnotation.java index b55cf3898..6b1bd54b1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSymbolSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSymbolSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "GeneSymbolSlotAnnotation", description = "POJO representing a gene symbol slot annotation") -@Table(indexes = { @Index(name = "genesymbol_singlegene_index", columnList = "singlegene_id") }) public class GeneSymbolSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSynonymSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSynonymSlotAnnotation.java index 22ee85268..52067a5b2 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSynonymSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSynonymSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; 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; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "GeneSynonymSlotAnnotation", description = "POJO representing a gene synonym slot annotation") -@Table(indexes = { @Index(name = "genesynonym_singlegene_index", columnList = "singlegene_id") }) public class GeneSynonymSlotAnnotation extends NameSlotAnnotation { @ManyToOne diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSystematicNameSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSystematicNameSlotAnnotation.java index 72042e3b0..074464f0a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSystematicNameSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/geneSlotAnnotations/GeneSystematicNameSlotAnnotation.java @@ -9,9 +9,7 @@ import com.fasterxml.jackson.annotation.JsonBackReference; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -22,7 +20,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.5.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { NameSlotAnnotation.class }) @Schema(name = "GeneSystematicNameSlotAnnotation", description = "POJO representing a gene systematic name slot annotation") -@Table(indexes = { @Index(name = "genesystematicname_singlegene_index", columnList = "singlegene_id") }) public class GeneSystematicNameSlotAnnotation extends NameSlotAnnotation { @OneToOne diff --git a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql new file mode 100644 index 000000000..87ae7c81b --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql @@ -0,0 +1,242 @@ +ALTER TABLE SlotAnnotation + ADD COLUMN phenotypestatement text + ADD COLUMN secondaryid character varying(255), + ADD COLUMN displaytext character text, + ADD COLUMN formattext character text, + ADD COLUMN synonymurl character varying(255), + ADD COLUMN componentsymbol character varying(255), + ADD COLUMN taxontext character varying(255), + + ADD COLUMN inheritancemode_id bigint, + ADD COLUMN phenotypeterm_id bigint, + ADD COLUMN singleallele_id bigint, + ADD COLUMN nomenclatureevent_id bigint, + ADD COLUMN nametype_id bigint, + ADD COLUMN synonymscope_id bigint, + ADD COLUMN singleconstruct_id bigint, + ADD COLUMN singlegene_id bigint, + ADD COLUMN databasestatus_id bigint, + ADD COLUMN germlinetransmissionstatus_id bigint, + ADD COLUMN relation_id bigint, + ADD COLUMN taxon_id bigint, + ADD COLUMN slotannotationtype character varying(96); + + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleDatabaseStatusSlotAnnotation', + databasestatus_id = a.databasestatus_id, + singleallele_id = a.singleallele_id +FROM alleledatabasestatusslotannotation a WHERE s.id = a.id; + +DROP TABLE AlleleDatabaseStatusSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleFullNameSlotAnnotation', + singleallele_id = a.singleallele_id +FROM AlleleFullNameSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleFullNameSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleFunctionalImpactSlotAnnotation', + singleallele_id = a.singleallele_id, + phenotypestatement = a.phenotypestatement, + phenotypeterm_id = a.phenotypeterm_id +FROM AlleleFunctionalImpactSlotAnnotation a WHERE s.id = a.id; + +ALTER TABLE allelefunctionalimpactslotannotation_vocabularyterm RENAME TO slotannotation_vocabularyterm; +ALTER TABLE slotannotation_vocabularyterm RENAME COLUMN allelefunctionalimpactslotannotation_id TO slotannotation_id; +ALTER TABLE SlotAnnotation_vocabularyterm DROP CONSTRAINT allelefunctionalimpactsa_vocabterm_afisa_id_fk; +ALTER TABLE SlotAnnotation_vocabularyterm DROP CONSTRAINT allelefunctionalimpactsa_vocabterm_functionalimpacts_id_fk; +ALTER TABLE SlotAnnotation_vocabularyterm ADD CONSTRAINT fk8q2b6xm3sbackqpj60xo24nk2 FOREIGN KEY (slotannotation_id) REFERENCES slotannotation(id); +ALTER TABLE SlotAnnotation_vocabularyterm ADD CONSTRAINT fkaj5ybyv1kfuy92vmxnlplvu58 FOREIGN KEY (functionalimpacts_id) REFERENCES vocabularyterm(id); +DROP INDEX allelefunctionalimpactsa_vocabterm_afisa_index; +DROP INDEX allelefunctionalimpactsa_vocabterm_functionalimpacts_index; +CREATE INDEX slotannotation_id_index ON SlotAnnotation_vocabularyterm USING btree (slotannotation_id); +CREATE INDEX slotannotation_functionalimpacts_index ON SlotAnnotation_vocabularyterm USING btree (functionalimpacts_id); + +DROP TABLE AlleleFunctionalImpactSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleGermlineTransmissionStatusSlotAnnotation', + singleallele_id = a.singleallele_id, + germlinetransmissionstatus_id = a.germlinetransmissionstatus_id +FROM AlleleGermlineTransmissionStatusSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleGermlineTransmissionStatusSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleInheritanceModeSlotAnnotation', + singleallele_id = a.singleallele_id, + germlinetransmissionstatus_id = a.germlinetransmissionstatus_id +FROM AlleleInheritanceModeSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleInheritanceModeSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleMutationTypeSlotAnnotation', + singleallele_id = a.singleallele_id +FROM AlleleMutationTypeSlotAnnotation a WHERE s.id = a.id; + +ALTER TABLE allelemutationtypeslotannotation_ontologyterm RENAME TO slotannotation_ontologyterm; +ALTER TABLE slotannotation_ontologyterm RENAME COLUMN allelemutationtypeslotannotation_id TO slotannotation_id; +ALTER TABLE slotannotation_ontologyterm DROP CONSTRAINT allelemutationtypesa_soterm_amsa_id_fk; +ALTER TABLE slotannotation_ontologyterm DROP CONSTRAINT allelemutationtypesa_soterm_mutationtypes_id_fk; +ALTER TABLE SlotAnnotation_ontologyterm ADD CONSTRAINT fkm3aokfd4q1j2okqsyaj5v95kj FOREIGN KEY (slotannotation_id) REFERENCES slotannotation(id); +ALTER TABLE SlotAnnotation_ontologyterm ADD CONSTRAINT fklaf991287ttlt4yb8fbaimrqo FOREIGN KEY (mutationtypes_id) REFERENCES ontologyterm(id); +DROP INDEX allelemutationtypesa_soterm_amsa_index; +DROP INDEX allelemutationtypesa_soterm_mutationtypes_index; +CREATE INDEX slotannotation_soterm_amsa_index ON slotannotation_ontologyterm USING btree (slotannotation_id); +CREATE INDEX slotannotation_soterm_mutationtypes_index ON slotannotation_ontologyterm USING btree (mutationtypes_id); + +DROP TABLE AlleleMutationTypeSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleNomenclatureEventSlotAnnotation', + singleallele_id = a.singleallele_id, + nomenclatureevent_id = a.nomenclatureevent_id +FROM AlleleNomenclatureEventSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleNomenclatureEventSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleSecondaryIdSlotAnnotation', + singleallele_id = a.singleallele_id +FROM AlleleSecondaryIdSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleSecondaryIdSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleSymbolSlotAnnotation', + singleallele_id = a.singleallele_id +FROM AlleleSymbolSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleSymbolSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'AlleleSynonymSlotAnnotation', + singleallele_id = a.singleallele_id +FROM AlleleSynonymSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE AlleleSynonymSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'ConstructComponentSlotAnnotation', + singleconstruct_id = a.singleconstruct_id, + componentsymbol = a.componentsymbol, + taxontext = a.taxontext, + relation_id = a.relation_id, + taxon_id = a.taxon_id +FROM ConstructComponentSlotAnnotation a WHERE s.id = a.id; + +ALTER TABLE constructcomponentslotannotation_note RENAME TO slotannotation_note; +ALTER TABLE slotannotation_note RENAME COLUMN constructcomponentslotannotation_id TO slotannotation_id; +ALTER TABLE slotannotation_note DROP CONSTRAINT constructcomponentslotannotation_note_ccsa_id_fk; +ALTER TABLE slotannotation_note DROP CONSTRAINT constructcomponentslotannotation_note_relatednotes_id_fk; +ALTER TABLE SlotAnnotation_note ADD CONSTRAINT fk4m4koh58321p1igpp8prt03wl FOREIGN KEY (slotannotation_id) REFERENCES slotannotation(id); +ALTER TABLE SlotAnnotation_note ADD CONSTRAINT fk4yafsa344go9s548rca9vwv6m FOREIGN KEY (relatednotes_id) REFERENCES note(id); +DROP INDEX constructcomponentsa_note_ccsa_index; +DROP INDEX constructcomponentsa_note_relatednotes_index; +CREATE INDEX slotannotation_note_ccsa_index ON slotannotation_note USING btree (slotannotation_id); +CREATE INDEX slotannotation_note_relatednotes_index ON slotannotation_note USING btree (relatednotes_id); + +DROP TABLE ConstructComponentSlotAnnotation; + +UPDATE SlotAnnotation s SET -- needs to get the type set + SlotAnnotationType = 'ConstructFullNameSlotAnnotation', + singleconstruct_id = a.singleconstruct_id +FROM ConstructFullNameSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE ConstructFullNameSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'ConstructSymbolSlotAnnotation', + singleconstruct_id = a.singleconstruct_id +FROM ConstructSymbolSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE ConstructSymbolSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'ConstructSynonymSlotAnnotation', + singleconstruct_id = a.singleconstruct_id +FROM ConstructSynonymSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE ConstructSynonymSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'GeneFullNameSlotAnnotation', + singlegene_id = a.singlegene_id +FROM GeneFullNameSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE GeneFullNameSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'GeneSecondaryIdSlotAnnotation', + singlegene_id = a.singlegene_id +FROM GeneSecondaryIdSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE GeneSecondaryIdSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'GeneSymbolSlotAnnotation', + singlegene_id = a.singlegene_id +FROM GeneSymbolSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE GeneSymbolSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'GeneSynonymSlotAnnotation', + singlegene_id = a.singlegene_id +FROM GeneSynonymSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE GeneSynonymSlotAnnotation; + +UPDATE SlotAnnotation s SET + SlotAnnotationType = 'GeneSystematicNameSlotAnnotation', + singlegene_id = a.singlegene_id +FROM GeneSystematicNameSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE GeneSystematicNameSlotAnnotation; + +UPDATE SlotAnnotation s SET + secondaryid = a.secondaryid +FROM SecondaryIdSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE SecondaryIdSlotAnnotation; + +UPDATE SlotAnnotation s SET + displaytext = a.displaytext, + formattext = a.formattext, + synonymurl = a.synonymurl, + nametype_id = a.nametype_id, + synonymscope_id = a.synonymscope_id +FROM NameSlotAnnotation a WHERE s.id = a.id; + +DROP TABLE NameSlotAnnotation; + +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk19ret4dubt1ckfrbkng18lovq FOREIGN KEY (inheritancemode_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk7gu3slsry4u26f33ns6gc7w0m FOREIGN KEY (taxon_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk8whffy7l5ievs39b0nnbir6ph FOREIGN KEY (nametype_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkbg9tp7mj2818od5n7ysaj37tf FOREIGN KEY (synonymscope_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkc8o0sm7ank0efy810051wfqsd FOREIGN KEY (germlinetransmissionstatus_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fke3jo24un80y5wbimk8q3vi8ij FOREIGN KEY (nomenclatureevent_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkhg0s2w84inbudpe523k2568vr FOREIGN KEY (singleallele_id) REFERENCES allele(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkju1yhk6ryh61926japwdojk54 FOREIGN KEY (singlegene_id) REFERENCES gene(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkp4p1tdkllrsmx3v1jfr5iyk6y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkq8ci945lhcjeysbmhgc96op5r FOREIGN KEY (phenotypeterm_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkqkk6210gn4gugy1eae8uxp443 FOREIGN KEY (singleconstruct_id) REFERENCES construct(id); +ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fksjf0g4ao72a95jqwpp332d84q FOREIGN KEY (databasestatus_id) REFERENCES vocabularyterm(id); + +CREATE INDEX slotannotation_inheritancemode_index ON slotannotation USING btree (inheritancemode_id); +CREATE INDEX slotannotation_taxon_index ON slotannotation USING btree (taxon_id); +CREATE INDEX slotannotation_nametype_index ON slotannotation USING btree (nametype_id); +CREATE INDEX slotannotation_synonymscope_index ON slotannotation USING btree (synonymscope_id); +CREATE INDEX slotannotation_status_index ON slotannotation USING btree (germlinetransmissionstatus_id); +CREATE INDEX slotannotation_nomenclatureevent_index ON slotannotation USING btree (nomenclatureevent_id); +CREATE INDEX slotannotation_singleallele_index ON slotannotation USING btree (singleallele_id); +CREATE INDEX slotannotation_singlegene_index ON slotannotation USING btree (singlegene_id); +CREATE INDEX slotannotation_relation_index ON slotannotation USING btree (relation_id); +CREATE INDEX slotannotation_phenotypeterm_index ON slotannotation USING btree (phenotypeterm_id); +CREATE INDEX slotannotation_singleconstruct_index ON slotannotation USING btree (singleconstruct_id); +CREATE INDEX slotannotation_databasestatus_index ON slotannotation USING btree (databasestatus_id); +CREATE INDEX slotannotation_componentsymbol_index ON slotannotation USING btree (componentsymbol); From 8b993e23bc0eec3f8dff0275d75256018f29fd0c Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 21 Aug 2024 23:38:18 -0600 Subject: [PATCH 130/342] Removed ONLY's from query --- ....37.0.4__flatten_slotannotation_tables.sql | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql index 87ae7c81b..cd72d4429 100644 --- a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql +++ b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql @@ -214,18 +214,18 @@ FROM NameSlotAnnotation a WHERE s.id = a.id; DROP TABLE NameSlotAnnotation; -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk19ret4dubt1ckfrbkng18lovq FOREIGN KEY (inheritancemode_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk7gu3slsry4u26f33ns6gc7w0m FOREIGN KEY (taxon_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fk8whffy7l5ievs39b0nnbir6ph FOREIGN KEY (nametype_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkbg9tp7mj2818od5n7ysaj37tf FOREIGN KEY (synonymscope_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkc8o0sm7ank0efy810051wfqsd FOREIGN KEY (germlinetransmissionstatus_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fke3jo24un80y5wbimk8q3vi8ij FOREIGN KEY (nomenclatureevent_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkhg0s2w84inbudpe523k2568vr FOREIGN KEY (singleallele_id) REFERENCES allele(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkju1yhk6ryh61926japwdojk54 FOREIGN KEY (singlegene_id) REFERENCES gene(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkp4p1tdkllrsmx3v1jfr5iyk6y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkq8ci945lhcjeysbmhgc96op5r FOREIGN KEY (phenotypeterm_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fkqkk6210gn4gugy1eae8uxp443 FOREIGN KEY (singleconstruct_id) REFERENCES construct(id); -ALTER TABLE ONLY SlotAnnotation ADD CONSTRAINT fksjf0g4ao72a95jqwpp332d84q FOREIGN KEY (databasestatus_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fk19ret4dubt1ckfrbkng18lovq FOREIGN KEY (inheritancemode_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fk7gu3slsry4u26f33ns6gc7w0m FOREIGN KEY (taxon_id) REFERENCES ontologyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fk8whffy7l5ievs39b0nnbir6ph FOREIGN KEY (nametype_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkbg9tp7mj2818od5n7ysaj37tf FOREIGN KEY (synonymscope_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkc8o0sm7ank0efy810051wfqsd FOREIGN KEY (germlinetransmissionstatus_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fke3jo24un80y5wbimk8q3vi8ij FOREIGN KEY (nomenclatureevent_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkhg0s2w84inbudpe523k2568vr FOREIGN KEY (singleallele_id) REFERENCES allele(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkju1yhk6ryh61926japwdojk54 FOREIGN KEY (singlegene_id) REFERENCES gene(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkp4p1tdkllrsmx3v1jfr5iyk6y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkq8ci945lhcjeysbmhgc96op5r FOREIGN KEY (phenotypeterm_id) REFERENCES ontologyterm(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fkqkk6210gn4gugy1eae8uxp443 FOREIGN KEY (singleconstruct_id) REFERENCES construct(id); +ALTER TABLE SlotAnnotation ADD CONSTRAINT fksjf0g4ao72a95jqwpp332d84q FOREIGN KEY (databasestatus_id) REFERENCES vocabularyterm(id); CREATE INDEX slotannotation_inheritancemode_index ON slotannotation USING btree (inheritancemode_id); CREATE INDEX slotannotation_taxon_index ON slotannotation USING btree (taxon_id); From aeb69ebf9c5ca8c8601f2c16345c2b1e31fddec5 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 22 Aug 2024 11:00:27 -0600 Subject: [PATCH 131/342] Updated migration file --- ....37.0.4__flatten_slotannotation_tables.sql | 66 ++++++++++++------- 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql index cd72d4429..2ee8cb5b1 100644 --- a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql +++ b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql @@ -1,25 +1,25 @@ ALTER TABLE SlotAnnotation - ADD COLUMN phenotypestatement text - ADD COLUMN secondaryid character varying(255), - ADD COLUMN displaytext character text, - ADD COLUMN formattext character text, - ADD COLUMN synonymurl character varying(255), - ADD COLUMN componentsymbol character varying(255), - ADD COLUMN taxontext character varying(255), - - ADD COLUMN inheritancemode_id bigint, - ADD COLUMN phenotypeterm_id bigint, - ADD COLUMN singleallele_id bigint, - ADD COLUMN nomenclatureevent_id bigint, - ADD COLUMN nametype_id bigint, - ADD COLUMN synonymscope_id bigint, - ADD COLUMN singleconstruct_id bigint, - ADD COLUMN singlegene_id bigint, - ADD COLUMN databasestatus_id bigint, - ADD COLUMN germlinetransmissionstatus_id bigint, - ADD COLUMN relation_id bigint, - ADD COLUMN taxon_id bigint, - ADD COLUMN slotannotationtype character varying(96); + ADD COLUMN phenotypestatement text, + ADD COLUMN secondaryid character varying(255), + ADD COLUMN displaytext text, + ADD COLUMN formattext text, + ADD COLUMN synonymurl character varying(255), + ADD COLUMN componentsymbol character varying(255), + ADD COLUMN taxontext character varying(255), + + ADD COLUMN inheritancemode_id bigint, + ADD COLUMN phenotypeterm_id bigint, + ADD COLUMN singleallele_id bigint, + ADD COLUMN nomenclatureevent_id bigint, + ADD COLUMN nametype_id bigint, + ADD COLUMN synonymscope_id bigint, + ADD COLUMN singleconstruct_id bigint, + ADD COLUMN singlegene_id bigint, + ADD COLUMN databasestatus_id bigint, + ADD COLUMN germlinetransmissionstatus_id bigint, + ADD COLUMN relation_id bigint, + ADD COLUMN taxon_id bigint, + ADD COLUMN slotannotationtype character varying(96); UPDATE SlotAnnotation s SET @@ -67,8 +67,10 @@ DROP TABLE AlleleGermlineTransmissionStatusSlotAnnotation; UPDATE SlotAnnotation s SET SlotAnnotationType = 'AlleleInheritanceModeSlotAnnotation', + inheritancemode_id = a.inheritancemode_id, + phenotypestatement = a.phenotypestatement, singleallele_id = a.singleallele_id, - germlinetransmissionstatus_id = a.germlinetransmissionstatus_id + phenotypeterm_id = a.phenotypeterm_id FROM AlleleInheritanceModeSlotAnnotation a WHERE s.id = a.id; DROP TABLE AlleleInheritanceModeSlotAnnotation; @@ -142,7 +144,7 @@ CREATE INDEX slotannotation_note_relatednotes_index ON slotannotation_note USING DROP TABLE ConstructComponentSlotAnnotation; -UPDATE SlotAnnotation s SET -- needs to get the type set +UPDATE SlotAnnotation s SET SlotAnnotationType = 'ConstructFullNameSlotAnnotation', singleconstruct_id = a.singleconstruct_id FROM ConstructFullNameSlotAnnotation a WHERE s.id = a.id; @@ -240,3 +242,21 @@ CREATE INDEX slotannotation_phenotypeterm_index ON slotannotation USING btree (p CREATE INDEX slotannotation_singleconstruct_index ON slotannotation USING btree (singleconstruct_id); CREATE INDEX slotannotation_databasestatus_index ON slotannotation USING btree (databasestatus_id); CREATE INDEX slotannotation_componentsymbol_index ON slotannotation USING btree (componentsymbol); + +CREATE TABLE evidence_ids_to_delete ( id bigint PRIMARY KEY); + +INSERT INTO evidence_ids_to_delete (id) + SELECT i.id + FROM slotannotation s, slotannotation_informationcontententity si, informationcontententity i + WHERE s.id = si.slotannotation_id and si.evidence_id = i.id and s.slotannotationtype is null; + +DELETE FROM slotannotation_informationcontententity WHERE evidence_id in (SELECT id FROM evidence_ids_to_delete); + +DROP TABLE evidence_ids_to_delete; + +DELETE FROM SlotAnnotation WHERE slotannotationtype is null; + +ALTER TABLE SlotAnnotation ALTER COLUMN slotannotationtype SET NOT null; +ALTER TABLE OntologyTerm ALTER COLUMN ontologytermtype SET NOT null; -- Missed this on the last flattening exercise. + +CREATE INDEX slotannotation_slotannotationtype ON slotannotation USING btree (slotannotationtype); From f94b9d6283b377d5ef32e9b4c84c6a61343a0e0d Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 22 Aug 2024 17:55:25 -0600 Subject: [PATCH 132/342] Forgot the distinct --- .../db/migration/v0.37.0.4__flatten_slotannotation_tables.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql index 2ee8cb5b1..ed116f482 100644 --- a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql +++ b/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql @@ -246,7 +246,7 @@ CREATE INDEX slotannotation_componentsymbol_index ON slotannotation USING btree CREATE TABLE evidence_ids_to_delete ( id bigint PRIMARY KEY); INSERT INTO evidence_ids_to_delete (id) - SELECT i.id + SELECT distinct i.id FROM slotannotation s, slotannotation_informationcontententity si, informationcontententity i WHERE s.id = si.slotannotation_id and si.evidence_id = i.id and s.slotannotationtype is null; From 2c88a2661bdf7d12bea003d540862edd399a6e7a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 22 Aug 2024 18:59:55 -0600 Subject: [PATCH 133/342] Fix for FK's --- docker/run_opensearch | 2 +- .../AlleleFunctionalImpactSlotAnnotation.java | 13 +++++++++---- .../AlleleMutationTypeSlotAnnotation.java | 13 +++++++++---- .../ConstructComponentSlotAnnotation.java | 3 +++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/docker/run_opensearch b/docker/run_opensearch index b757da902..1367561b2 100755 --- a/docker/run_opensearch +++ b/docker/run_opensearch @@ -1 +1 @@ -docker run -d --net curation -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:1.2.4 +docker run -d --net curation -p 9201:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:2.13.0 diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java index 97848806b..bcbbde846 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleFunctionalImpactSlotAnnotation.java @@ -27,6 +27,7 @@ import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; @@ -50,10 +51,14 @@ public class AlleleFunctionalImpactSlotAnnotation extends SlotAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.SELECT) - @JoinTable(indexes = { - @Index(name = "slotannotation_id_index", columnList = "slotannotation_id"), - @Index(name = "slotannotation_functionalimpacts_index", columnList = "functionalimpacts_id") - }) + @JoinTable( + joinColumns = @JoinColumn(name = "slotannotation_id"), + inverseJoinColumns = @JoinColumn(name = "functionalimpacts_id"), + indexes = { + @Index(name = "slotannotation_id_index", columnList = "slotannotation_id"), + @Index(name = "slotannotation_functionalimpacts_index", columnList = "functionalimpacts_id") + } + ) @JsonView({ View.FieldsAndLists.class, View.AlleleView.class }) private List functionalImpacts; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java index b4abf380e..c43e3c438 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/alleleSlotAnnotations/AlleleMutationTypeSlotAnnotation.java @@ -20,6 +20,7 @@ import jakarta.persistence.Entity; import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; @@ -43,10 +44,14 @@ public class AlleleMutationTypeSlotAnnotation extends SlotAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.SELECT) - @JoinTable(indexes = { - @Index(name = "slotannotation_soterm_amsa_index", columnList = "slotannotation_id"), - @Index(name = "slotannotation_soterm_mutationtypes_index", columnList = "mutationtypes_id") - }) + @JoinTable( + joinColumns = @JoinColumn(name = "slotannotation_id"), + inverseJoinColumns = @JoinColumn(name = "mutationtypes_id"), + indexes = { + @Index(name = "slotannotation_soterm_amsa_index", columnList = "slotannotation_id"), + @Index(name = "slotannotation_soterm_mutationtypes_index", columnList = "mutationtypes_id") + } + ) @JsonView({ View.FieldsAndLists.class, View.AlleleView.class }) private List mutationTypes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java index 5f3ac569d..8a77ec356 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotation.java @@ -27,6 +27,7 @@ import jakarta.persistence.Entity; import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; @@ -77,6 +78,8 @@ public class ConstructComponentSlotAnnotation extends SlotAnnotation { @OneToMany @JsonView({ View.FieldsAndLists.class, View.ConstructView.class }) @JoinTable( + joinColumns = @JoinColumn(name = "slotannotation_id"), + inverseJoinColumns = @JoinColumn(name = "relatednotes_id"), indexes = { @Index(name = "slotannotation_note_ccsa_index", columnList = "slotannotation_id"), @Index(name = "slotannotation_note_relatednotes_index", columnList = "relatednotes_id") From fb18f2f579a3ea36afb662f8246abf27e4f4ad12 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 23 Aug 2024 08:15:56 -0600 Subject: [PATCH 134/342] Updated migration file name --- ...on_tables.sql => v0.37.0.5__flatten_slotannotation_tables.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.37.0.4__flatten_slotannotation_tables.sql => v0.37.0.5__flatten_slotannotation_tables.sql} (100%) diff --git a/src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.5__flatten_slotannotation_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.4__flatten_slotannotation_tables.sql rename to src/main/resources/db/migration/v0.37.0.5__flatten_slotannotation_tables.sql From fb3ee0372307a6fcc0ed3361609f3854511f9b46 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 23 Aug 2024 08:17:49 -0600 Subject: [PATCH 135/342] Revert --- docker/run_opensearch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/run_opensearch b/docker/run_opensearch index 1367561b2..b757da902 100755 --- a/docker/run_opensearch +++ b/docker/run_opensearch @@ -1 +1 @@ -docker run -d --net curation -p 9201:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:2.13.0 +docker run -d --net curation -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:1.2.4 From 10c3a7431dc5cc13acbd9ff81e195288540533f5 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 23 Aug 2024 10:11:50 -0600 Subject: [PATCH 136/342] Update to OS 2.13 --- pom.xml | 2 +- src/main/resources/application.properties.defaults | 2 +- .../curation_api/resources/TestContainerResource.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index eb73d83ac..f6128b88b 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 3.0.1 2.0.0 0.5.1 - 3.5.0 + 3.13.3 3.0.0-M7 3.3.1 10.17.0 diff --git a/src/main/resources/application.properties.defaults b/src/main/resources/application.properties.defaults index f8686f556..2f736b0ce 100644 --- a/src/main/resources/application.properties.defaults +++ b/src/main/resources/application.properties.defaults @@ -34,7 +34,7 @@ quarkus.flyway.clean-disabled=true quarkus.elasticsearch.protocol = http -quarkus.hibernate-search-orm.elasticsearch.version=opensearch:1.2.4 +quarkus.hibernate-search-orm.elasticsearch.version=opensearch:2.13.0 quarkus.hibernate-search-orm.elasticsearch.protocol=http quarkus.hibernate-search-orm.elasticsearch.read-timeout=600S quarkus.hibernate-search-orm.schema-management.strategy=create-or-update diff --git a/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java b/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java index 5f63ea6b2..589d87d2f 100644 --- a/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java +++ b/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java @@ -24,7 +24,7 @@ public Map start() { DockerImageName esImage = DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch:7.10.2").asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch"); //esContainer = new ElasticsearchContainer(esImage); - osContainer = new OpenSearchContainer("opensearchproject/opensearch:1.2.4"); + osContainer = new OpenSearchContainer("opensearchproject/opensearch:2.13.0"); pgContainer = new PostgreSQLContainer("postgres:14.2"); From 199f2e52c461da84d6f52a16e0421291d447ae52 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 23 Aug 2024 10:18:13 -0600 Subject: [PATCH 137/342] Update migration version --- ...on_tables.sql => v0.37.0.6__flatten_slotannotation_tables.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.37.0.5__flatten_slotannotation_tables.sql => v0.37.0.6__flatten_slotannotation_tables.sql} (100%) diff --git a/src/main/resources/db/migration/v0.37.0.5__flatten_slotannotation_tables.sql b/src/main/resources/db/migration/v0.37.0.6__flatten_slotannotation_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.5__flatten_slotannotation_tables.sql rename to src/main/resources/db/migration/v0.37.0.6__flatten_slotannotation_tables.sql From b150f481a3987544e4ee8150974b564caf5421ed Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 23 Aug 2024 10:24:34 -0600 Subject: [PATCH 138/342] Fix integration errors --- .../ConstructComponentSlotAnnotationDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotationDAO.java index e8d85cd2a..425f3ddf5 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotationDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/slotAnnotations/constructSlotAnnotations/ConstructComponentSlotAnnotationDAO.java @@ -19,7 +19,7 @@ protected ConstructComponentSlotAnnotationDAO() { } public void deleteAttachedNote(Long id) { - Query jpqlQuery = entityManager.createNativeQuery("DELETE FROM constructcomponentslotannotation_note WHERE relatednotes_id = '" + id + "'"); + Query jpqlQuery = entityManager.createNativeQuery("DELETE FROM slotannotation_note WHERE relatednotes_id = '" + id + "'"); jpqlQuery.executeUpdate(); noteDAO.remove(id); From b41619acb73fea764f8699649290b47a58ced69b Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Mon, 26 Aug 2024 09:43:25 -0600 Subject: [PATCH 139/342] Remove all exceptions after two weeks --- .../dao/loads/BulkLoadFileExceptionDAO.java | 6 +++ .../curation_api/jobs/JobScheduler.java | 50 +------------------ 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java index 774194e14..a6a30618f 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java @@ -4,10 +4,16 @@ import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.Query; @ApplicationScoped public class BulkLoadFileExceptionDAO extends BaseSQLDAO { protected BulkLoadFileExceptionDAO() { super(BulkLoadFileException.class); } + + public void cleanUpTwoWeekOldExceptions() { + Query jpqlQuery = entityManager.createNativeQuery("DELETE FROM BulkLoadFileException WHERE dbdatecreated < NOW() - INTERVAL '14 days'"); + jpqlQuery.executeUpdate(); + } } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java index 6042e6459..f475d638b 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java @@ -2,8 +2,6 @@ import java.io.File; import java.time.ZonedDateTime; -import java.util.Collections; -import java.util.Comparator; import java.util.concurrent.Semaphore; import org.alliancegenome.curation_api.dao.loads.BulkLoadDAO; @@ -18,12 +16,9 @@ import org.alliancegenome.curation_api.jobs.util.SlackNotifier; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadGroup; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkScheduledLoad; import org.alliancegenome.curation_api.response.SearchResponse; -import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.eclipse.microprofile.config.inject.ConfigProperty; import com.cronutils.model.Cron; @@ -188,50 +183,7 @@ public void pendingFileJobs(@Observes PendingBulkLoadFileJobEvent event) { @Scheduled(cron = "0 0 0 ? * SAT") public void cleanUpFileExceptions() { - SearchResponse groups = groupDAO.findAll(); - - Comparator c = new Comparator() { - @Override - public int compare(BulkLoadFile blf1, BulkLoadFile blf2) { - if (blf1.getDateLastLoaded() == null && blf2.getDateLastLoaded() == null) { - return 0; - } - if (blf1.getDateLastLoaded() == null) { - return 1; - } - if (blf2.getDateLastLoaded() == null) { - return -1; - } - return blf2.getDateLastLoaded().compareTo(blf1.getDateLastLoaded()); - } - }; - - int historyExceptionsToKeep = 3; - - ProcessDisplayHelper ph = new ProcessDisplayHelper(); - ph.startProcess("Bulk Load File History Exception Cleanup"); - - for (BulkLoadGroup g : groups.getResults()) { - Log.debug("Group Clean Up: " + g.getName()); - if (g.getLoads().size() > 0) { - for (BulkLoad b : g.getLoads()) { - Log.debug("Load Clean Up: " + b.getName()); - Collections.sort(b.getLoadFiles(), c); - if (b.getLoadFiles().size() > historyExceptionsToKeep) { - for (int i = historyExceptionsToKeep; i < b.getLoadFiles().size(); i++) { - Log.debug("File Clean Up: " + b.getLoadFiles().get(i).getDateLastLoaded()); - for (BulkLoadFileHistory h : b.getLoadFiles().get(i).getHistory()) { - for (BulkLoadFileException e : h.getExceptions()) { - bulkLoadFileExceptionDAO.remove(e.getId()); - ph.progressProcess(); - } - } - } - } - } - } - } - ph.finishProcess(); + bulkLoadFileExceptionDAO.cleanUpTwoWeekOldExceptions(); } @Scheduled(cron = "0 0 0 ? * SUN") From dcb91a21a8bcba2ce5b02deddd114fee456e2f5a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Mon, 26 Aug 2024 09:45:50 -0600 Subject: [PATCH 140/342] Removed whitespace --- .../java/org/alliancegenome/curation_api/jobs/JobScheduler.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java index f475d638b..b5ac99ad3 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java @@ -183,7 +183,7 @@ public void pendingFileJobs(@Observes PendingBulkLoadFileJobEvent event) { @Scheduled(cron = "0 0 0 ? * SAT") public void cleanUpFileExceptions() { - bulkLoadFileExceptionDAO.cleanUpTwoWeekOldExceptions(); + bulkLoadFileExceptionDAO.cleanUpTwoWeekOldExceptions(); } @Scheduled(cron = "0 0 0 ? * SUN") From 4ddf5700e21afd5739af4db6bce64bf4a528cd86 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 27 Aug 2024 09:16:04 -0600 Subject: [PATCH 141/342] Updated cluster version --- src/main/resources/application.properties.defaults | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/application.properties.defaults b/src/main/resources/application.properties.defaults index 2f736b0ce..f1cf5b070 100644 --- a/src/main/resources/application.properties.defaults +++ b/src/main/resources/application.properties.defaults @@ -34,7 +34,7 @@ quarkus.flyway.clean-disabled=true quarkus.elasticsearch.protocol = http -quarkus.hibernate-search-orm.elasticsearch.version=opensearch:2.13.0 +quarkus.hibernate-search-orm.elasticsearch.version=opensearch:2.16.0 quarkus.hibernate-search-orm.elasticsearch.protocol=http quarkus.hibernate-search-orm.elasticsearch.read-timeout=600S quarkus.hibernate-search-orm.schema-management.strategy=create-or-update From ee7d1805f4f6bce2abebb77f880e765d55a55f1d Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 27 Aug 2024 09:42:03 -0600 Subject: [PATCH 142/342] updated the test containers --- .../curation_api/resources/TestContainerResource.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java b/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java index 589d87d2f..36e7e4151 100644 --- a/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java +++ b/src/test/java/org/alliancegenome/curation_api/resources/TestContainerResource.java @@ -24,7 +24,7 @@ public Map start() { DockerImageName esImage = DockerImageName.parse("docker.elastic.co/elasticsearch/elasticsearch:7.10.2").asCompatibleSubstituteFor("docker.elastic.co/elasticsearch/elasticsearch"); //esContainer = new ElasticsearchContainer(esImage); - osContainer = new OpenSearchContainer("opensearchproject/opensearch:2.13.0"); + osContainer = new OpenSearchContainer("opensearchproject/opensearch:2.16.0"); pgContainer = new PostgreSQLContainer("postgres:14.2"); From 0369b712cfb6f3446437bda5e5bd2c10275f650a Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Wed, 28 Aug 2024 19:41:26 +0200 Subject: [PATCH 143/342] upgrade opensearch version (#1651) --- docker/run_opensearch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/run_opensearch b/docker/run_opensearch index b757da902..80cf62178 100755 --- a/docker/run_opensearch +++ b/docker/run_opensearch @@ -1 +1 @@ -docker run -d --net curation -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:1.2.4 +docker run -d --net curation -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" -e "DISABLE_SECURITY_PLUGIN=true" --name opensearch opensearchproject/opensearch:2.16.0 From b15c3972f75aa278451fea6db6ced4cd1d203f36 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 28 Aug 2024 18:14:51 -0600 Subject: [PATCH 144/342] Initial Code for removing dups --- .../curation_api/dao/DataProviderDAO.java | 42 +++++++++++++++++ .../curation_api/dao/OrganizationDAO.java | 21 +++++++++ .../curation_api/dao/base/BaseSQLDAO.java | 9 +--- .../jobs/executors/Gff3Executor.java | 2 + .../curation_api/main/Main.java | 6 --- .../model/entities/AssemblyComponent.java | 3 +- .../model/entities/CodingSequence.java | 3 +- .../curation_api/model/entities/Exon.java | 3 +- .../model/entities/Organization.java | 1 + .../model/entities/Transcript.java | 3 +- .../services/AssemblyComponentService.java | 2 +- .../services/DataProviderService.java | 45 +++++-------------- .../curation_api/services/Gff3Service.java | 2 +- .../DiseaseAnnotationValidator.java | 2 +- .../validation/dto/Gff3DtoValidator.java | 2 +- ...neExpressionAnnotationFmsDTOValidator.java | 35 ++++++++++----- .../PhenotypeAnnotationFmsDTOValidator.java | 2 +- ...quenceTargetingReagentFmsDTOValidator.java | 2 +- .../v0.37.0.10__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.11__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.12__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.13__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.14__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.15__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.16__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.17__remove_dataprovider_dups.sql | 21 +++++++++ .../v0.37.0.18__remove_dataprovider_dups.sql | 18 ++++++++ .../v0.37.0.19__remove_dataprovider_dups.sql | 19 ++++++++ .../v0.37.0.20__remove_dataprovider_dups.sql | 19 ++++++++ .../v0.37.0.21__remove_dataprovider_dups.sql | 19 ++++++++ .../v0.37.0.22__remove_dataprovider_dups.sql | 19 ++++++++ .../v0.37.0.23__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.24__remove_dataprovider_dups.sql | 25 +++++++++++ .../v0.37.0.25__remove_dataprovider_dups.sql | 22 +++++++++ .../v0.37.0.26__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.27__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.28__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.29__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.30__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.31__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.32__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.33__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.34__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.35__remove_dataprovider_dups.sql | 3 ++ .../v0.37.0.36__remove_dataprovider_dups.sql | 22 +++++++++ .../v0.37.0.37__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.38__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.39__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.40__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.41__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.42__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.43__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.44__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.45__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.46__remove_dataprovider_dups.sql | 5 +++ .../v0.37.0.7__remove_dataprovider_dups.sql | 11 +++++ .../v0.37.0.8__remove_dataprovider_dups.sql | 20 +++++++++ .../v0.37.0.9__remove_dataprovider_dups.sql | 21 +++++++++ 58 files changed, 884 insertions(+), 71 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.25__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.26__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.27__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.28__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.29__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.30__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.31__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.32__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.33__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.34__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.35__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.36__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.37__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.38__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.39__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.40__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.41__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.42__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.43__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.44__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.45__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql create mode 100644 src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index 420710b65..dcd7a918b 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -1,14 +1,56 @@ package org.alliancegenome.curation_api.dao; +import java.util.HashMap; + import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; +import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.response.SearchResponse; import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; @ApplicationScoped public class DataProviderDAO extends BaseSQLDAO { + @Inject CrossReferenceDAO crossReferenceDAO; + + private HashMap dataProviderCache = new HashMap<>(); + protected DataProviderDAO() { super(DataProvider.class); } + + @Transactional + public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { + + if (dataProviderCache.containsKey(sourceOrganization.getAbbreviation())) { + return dataProviderCache.get(sourceOrganization.getAbbreviation()); + } + + SearchResponse orgResponse = findByField("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); + if (orgResponse != null) { + DataProvider member = orgResponse.getSingleResult(); + if (member != null && member.getSourceOrganization() != null) { + return member; + } + } else { + DataProvider dataProvider = new DataProvider(); + + dataProvider.setSourceOrganization(sourceOrganization); + + CrossReference xref = new CrossReference(); + xref.setDisplayName(sourceOrganization.getAbbreviation()); + xref.setReferencedCurie(sourceOrganization.getAbbreviation()); + xref.setResourceDescriptorPage(sourceOrganization.getHomepageResourceDescriptorPage()); + dataProvider.setCrossReference(crossReferenceDAO.persist(xref)); + + return persist(dataProvider); + + } + + return null; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java index 18fbb5f0a..37d33336e 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java @@ -1,15 +1,36 @@ package org.alliancegenome.curation_api.dao; +import java.util.HashMap; + import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.response.SearchResponse; import jakarta.enterprise.context.ApplicationScoped; @ApplicationScoped public class OrganizationDAO extends BaseSQLDAO { + private HashMap organizationCache = new HashMap<>(); + protected OrganizationDAO() { super(Organization.class); } + public Organization getOrCreateOrganization(String abbreviation) { + if (organizationCache.containsKey(abbreviation)) { + return organizationCache.get(abbreviation); + } else { + HashMap params = new HashMap<>(); + params.put("abbreviation", abbreviation); + SearchResponse resp = findByParams(params); + if (resp != null) { + return resp.getSingleResult(); + } else { + Organization o = new Organization(); + o.setAbbreviation(abbreviation); + return persist(o); + } + } + } } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 94bf5a5a1..50869c7d4 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -17,7 +17,6 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.processing.IndexProcessDisplayService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; -import org.eclipse.microprofile.config.inject.ConfigProperty; import org.elasticsearch.index.query.Operator; import org.hibernate.exception.ConstraintViolationException; import org.hibernate.query.sqm.internal.QuerySqmImpl; @@ -58,10 +57,6 @@ public class BaseSQLDAO extends BaseEntityDAO { - @ConfigProperty(name = "quarkus.hibernate-search-orm.elasticsearch.hosts") String esHosts; - - @ConfigProperty(name = "quarkus.hibernate-search-orm.elasticsearch.protocol") String esProtocol; - @Inject protected EntityManager entityManager; @Inject protected SearchSession searchSession; @Inject protected IndexProcessDisplayService indexProcessDisplayService; @@ -361,7 +356,7 @@ public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSiz Reflections reflections = new Reflections("org.alliancegenome.curation_api"); Set> annotatedClasses = reflections.get(TypesAnnotated.with(Indexed.class).asClass(reflections.getConfiguration().getClassLoaders())); - ProcessDisplayHelper ph = new ProcessDisplayHelper(2000); + ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); ph.addDisplayHandler(indexProcessDisplayService); ph.startProcess("Mass Index Everything"); MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) @@ -402,7 +397,7 @@ public void reindex(Class objectClass, Integer batchSizeToLoadObjects, Intege MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) .monitor(new MassIndexingMonitor() { - ProcessDisplayHelper ph = new ProcessDisplayHelper(2000); + ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); @Override public void documentsAdded(long increment) { diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 9ba729cca..da955293f 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -75,6 +75,8 @@ public void execLoad(BulkLoadFile bulkLoadFile) { List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + gffData.clear(); + Map> idsAdded = createIdsAddedMap(); Map> previousIds = getPreviouslyLoadedIds(dataProvider); diff --git a/src/main/java/org/alliancegenome/curation_api/main/Main.java b/src/main/java/org/alliancegenome/curation_api/main/Main.java index e3da100a3..7b1c960ee 100644 --- a/src/main/java/org/alliancegenome/curation_api/main/Main.java +++ b/src/main/java/org/alliancegenome/curation_api/main/Main.java @@ -6,14 +6,8 @@ @QuarkusMain public class Main { - - private Main() { - // Hidden from view, as it is a utility class - } - public static void main(String[] args) { Log.info("Running main method of quarkus"); Quarkus.run(args); } - } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index 862c73da6..cbf53c0fd 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -19,7 +18,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java index 6f943b836..c223316d6 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CodingSequence.java @@ -14,7 +14,6 @@ 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.Indexed; 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; @@ -31,7 +30,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java index 79ea67850..784485a45 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Exon.java @@ -14,7 +14,6 @@ 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.Indexed; 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; @@ -31,7 +30,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Organization.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Organization.java index 8520a597b..6ed8573a7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Organization.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Organization.java @@ -33,6 +33,7 @@ @AGRCurationSchemaVersion(min = "1.4.1", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Agent.class }) @Table(indexes = { @Index(name = "organization_homepageresourcedescriptorpage_id_index", columnList = "homepageresourcedescriptorpage_id"), + @Index(name = "organization_abbreviation_index", columnList = "abbreviation"), @Index(name = "organization_createdby_index", columnList = "createdBy_id"), @Index(name = "organization_updatedby_index", columnList = "updatedBy_id") }) 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 7480f83ce..3ef380bde 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 @@ -12,7 +12,6 @@ import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; @@ -26,7 +25,7 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Indexed +//@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) diff --git a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java index 50d797d3c..b5065e08d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java @@ -77,7 +77,7 @@ private AssemblyComponent findAssemblyComponentOrCreateDB(String name, String as assemblyComponent.setGenomeAssembly(assemblyResponse.getSingleResult()); } assemblyComponent.setTaxon(ncbiTaxonTermService.getByCurie(taxonCurie).getEntity()); - assemblyComponent.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProviderAbbreviation)); + assemblyComponent.setDataProvider(dataProviderService.getDefaultDataProvider(dataProviderAbbreviation)); return assemblyComponentDAO.persist(assemblyComponent); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index cb0807349..9796e9092 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -1,16 +1,12 @@ package org.alliancegenome.curation_api.services; import org.alliancegenome.curation_api.auth.AuthenticatedUser; -import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.dao.DataProviderDAO; import org.alliancegenome.curation_api.dao.OrganizationDAO; import org.alliancegenome.curation_api.model.entities.AllianceMember; -import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.Organization; import org.alliancegenome.curation_api.model.entities.Person; import org.alliancegenome.curation_api.response.ObjectResponse; -import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.DataProviderValidator; @@ -28,7 +24,6 @@ public class DataProviderService extends BaseEntityCrudService orgResponse = organizationDAO.findByField("abbreviation", organizationAbbreviation); - if (orgResponse == null || orgResponse.getSingleResult() == null) { - return null; - } - Organization member = orgResponse.getSingleResult(); - - return createDataProvider(member); + public DataProvider getAllianceDataProvider() { + return getDefaultDataProvider("Alliance"); } - - public DataProvider createAllianceDataProvider() { - return createOrganizationDataProvider("Alliance"); - } - - private DataProvider createDataProvider(Organization member) { - DataProvider dataProvider = new DataProvider(); - - dataProvider.setSourceOrganization(member); - - CrossReference xref = new CrossReference(); - xref.setDisplayName(member.getAbbreviation()); - xref.setReferencedCurie(member.getAbbreviation()); - xref.setResourceDescriptorPage(member.getHomepageResourceDescriptorPage()); - dataProvider.setCrossReference(crossReferenceDAO.persist(xref)); - - return dataProviderDAO.persist(dataProvider); + + @Transactional + public DataProvider getDefaultDataProvider(String sourceOrganizationAbbreviation) { + return dataProviderDAO.getOrCreateDataProvider(organizationDAO.getOrCreateOrganization(sourceOrganizationAbbreviation)); } @Transactional @@ -87,4 +62,6 @@ public ObjectResponse upsert(DataProvider uiEntity) { public ObjectResponse validate(DataProvider uiEntity) { return dataProviderValidator.validateDataProvider(uiEntity, null, true); } + + } 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 99500c959..307dffc75 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -80,7 +80,7 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData if (resp == null || resp.getSingleResult() == null) { GenomeAssembly assembly = new GenomeAssembly(); assembly.setModEntityId(assemblyName); - assembly.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + assembly.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); genomeAssemblyDAO.persist(assembly); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java index ee929311d..d0fdbb4da 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java @@ -150,7 +150,7 @@ public DataProvider validateSecondaryDataProvider(DiseaseAnnotation uiEntity, Di if (uiEntity.getSecondaryDataProvider() == null) { if (dbEntity.getId() == null) { - uiEntity.setSecondaryDataProvider(dataProviderService.createAllianceDataProvider()); + uiEntity.setSecondaryDataProvider(dataProviderService.getAllianceDataProvider()); if (uiEntity.getSecondaryDataProvider() == null) { return null; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 08a9496aa..87f0ebcfa 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -163,7 +163,7 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, Map attri private ObjectResponse validateGffEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { ObjectResponse geResponse = new ObjectResponse(); - entity.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + entity.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); entity.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); geResponse.setEntity(entity); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index fc3d9fe02..5467b1eb3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -1,15 +1,28 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.time.OffsetDateTime; +import java.time.format.DateTimeParseException; +import java.util.ArrayList; +import java.util.List; + import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.GeneExpressionAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.*; -import org.alliancegenome.curation_api.model.entities.ontology.*; +import org.alliancegenome.curation_api.model.entities.AnatomicalSite; +import org.alliancegenome.curation_api.model.entities.ExpressionPattern; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation; +import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.TemporalContext; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; +import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.UberonSlimTermDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -19,14 +32,16 @@ import org.alliancegenome.curation_api.services.ReferenceService; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.annotations.GeneExpressionAnnotationUniqueIdHelper; -import org.alliancegenome.curation_api.services.ontology.*; +import org.alliancegenome.curation_api.services.ontology.AnatomicalTermService; +import org.alliancegenome.curation_api.services.ontology.GoTermService; +import org.alliancegenome.curation_api.services.ontology.MmoTermService; +import org.alliancegenome.curation_api.services.ontology.StageTermService; +import org.alliancegenome.curation_api.services.ontology.UberonTermService; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.ObjectUtils; -import java.time.OffsetDateTime; -import java.time.format.DateTimeParseException; -import java.util.ArrayList; -import java.util.List; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; @RequestScoped public class GeneExpressionAnnotationFmsDTOValidator { @@ -121,7 +136,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr geneExpressionAnnotation.getExpressionPattern().setWhenExpressed(temporalContext); } - geneExpressionAnnotation.setDataProvider(dataProviderService.createOrganizationDataProvider(dataProvider.sourceOrganization)); + geneExpressionAnnotation.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); geneExpressionAnnotation.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.GENE_EXPRESSION_VOCABULARY, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM).getEntity()); geneExpressionAnnotation.setObsolete(false); geneExpressionAnnotation.setInternal(false); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/PhenotypeAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/PhenotypeAnnotationFmsDTOValidator.java index 8ccc75bb0..ee59dceb0 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/PhenotypeAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/PhenotypeAnnotationFmsDTOValidator.java @@ -88,7 +88,7 @@ public ObjectResponse validatePhenotypeAnnota annotation.setConditionRelations(null); } - annotation.setDataProvider(dataProviderService.createOrganizationDataProvider(beDataProvider.sourceOrganization)); + annotation.setDataProvider(dataProviderService.getDefaultDataProvider(beDataProvider.sourceOrganization)); annotation.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.PHENOTYPE_RELATION_VOCABULARY, "has_phenotype").getEntity()); CrossReference evidenceXref = null; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java index 55cdec3ba..b73581071 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java @@ -86,7 +86,7 @@ public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDT } if (beDataProvider != null) { - sqtr.setDataProvider(dataProviderService.createOrganizationDataProvider(beDataProvider.sourceOrganization)); + sqtr.setDataProvider(dataProviderService.getDefaultDataProvider(beDataProvider.sourceOrganization)); } if (sqtrResponse.hasErrors()) { diff --git a/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql new file mode 100644 index 000000000..7d150a49e --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a MGI dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'MGI' + AND cr1.referencedCurie = 'MGI' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'MGI'; + + diff --git a/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql new file mode 100644 index 000000000..4ced7b6c7 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a WB dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'WB' + AND cr1.referencedCurie = 'WB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'WB'; + + diff --git a/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql new file mode 100644 index 000000000..dbac17613 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a SGD dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'SGD' + AND cr1.referencedCurie = 'SGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'SGD'; + + diff --git a/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql new file mode 100644 index 000000000..307820d78 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a RGD dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'RGD' + AND cr1.referencedCurie = 'RGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'RGD'; + + diff --git a/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql new file mode 100644 index 000000000..734568644 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a ZFIN dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'ZFIN' + AND cr1.referencedCurie = 'ZFIN' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'ZFIN'; + + diff --git a/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql new file mode 100644 index 000000000..df089c801 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +-- Update all BiologicalEntity.dataProvider to point to a Alliance dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'Alliance' + AND cr1.referencedCurie = 'Alliance' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'Alliance'; + diff --git a/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql new file mode 100644 index 000000000..a2f85ddeb --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all annotation.dataProvider to point to a ZFIN dataprovider that is first in the DB + +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'ZFIN' + AND cr1.referencedCurie = 'ZFIN' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'ZFIN'; + + diff --git a/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql new file mode 100644 index 000000000..b4c0f063c --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ + + +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'Alliance' + AND cr1.referencedCurie = 'Alliance' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'Alliance'; + + diff --git a/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql new file mode 100644 index 000000000..04c19384b --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql @@ -0,0 +1,18 @@ +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'XB' + AND cr1.referencedCurie = 'XB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'XB'; + diff --git a/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql new file mode 100644 index 000000000..5564cd288 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql @@ -0,0 +1,19 @@ +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'MGI' + AND cr1.referencedCurie = 'MGI' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'MGI'; + + diff --git a/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql new file mode 100644 index 000000000..0fe17c326 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql @@ -0,0 +1,19 @@ +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'RGD' + AND cr1.referencedCurie = 'RGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'RGD'; + + diff --git a/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql new file mode 100644 index 000000000..b48953348 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql @@ -0,0 +1,19 @@ +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'SGD' + AND cr1.referencedCurie = 'SGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'SGD'; + + diff --git a/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql new file mode 100644 index 000000000..56fa0cd3f --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql @@ -0,0 +1,19 @@ +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'FB' + AND cr1.referencedCurie = 'FB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'FB'; + + diff --git a/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql new file mode 100644 index 000000000..6b717c108 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ + +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'WB' + AND cr1.referencedCurie = 'WB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'WB'; + + diff --git a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql new file mode 100644 index 000000000..221275a12 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql @@ -0,0 +1,25 @@ +CREATE TABLE dataprovider_ids_to_keep ( + id bigint PRIMARY KEY +); +CREATE TABLE crossreference_ids_to_delete ( + id bigint +); +CREATE TABLE dataprovider_ids_to_delete ( + id bigint +); + +-- select all the dataproviders that we are going to keep +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM annotation where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 191431 +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM biologicalentity where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 6241140 +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM chromosome where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 0 +INSERT INTO dataprovider_ids_to_keep (id) SELECT secondarydataprovider_id FROM diseaseannotation where secondarydataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 14380 +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM htpexpressiondatasetannotation where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 0 +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM reagent where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 226431 +INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM species where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 10 +-- Total 6673392 + +INSERT INTO crossreference_ids_to_delete (id) select crossreference_id from dataprovider dp left join dataprovider_ids_to_keep dk on dp.id = dk.id where dp.crossreference_id is not null and dk.id is null; -- 42582734 +CREATE INDEX crossreference_ids_to_delete_index ON crossreference_ids_to_delete USING btree (id); + +INSERT INTO dataprovider_ids_to_delete (id) select dp.id from dataprovider dp left join dataprovider_ids_to_keep dk on dp.id = dk.id where dk.id is null; +CREATE INDEX dataprovider_ids_to_delete_index ON dataprovider_ids_to_delete USING btree (id); diff --git a/src/main/resources/db/migration/v0.37.0.25__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.25__remove_dataprovider_dups.sql new file mode 100644 index 000000000..ebfd4ed96 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.25__remove_dataprovider_dups.sql @@ -0,0 +1,22 @@ +-- This is faster then doing the query in one go as it seems this is done in memory whereas a larger query operates on disk which is much slower + +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 0) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.26__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.26__remove_dataprovider_dups.sql new file mode 100644 index 000000000..4fde4f3c5 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.26__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.27__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.27__remove_dataprovider_dups.sql new file mode 100644 index 000000000..2be88dac0 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.27__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.28__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.28__remove_dataprovider_dups.sql new file mode 100644 index 000000000..6186a22c7 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.28__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.29__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.29__remove_dataprovider_dups.sql new file mode 100644 index 000000000..c257dafb8 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.29__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.30__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.30__remove_dataprovider_dups.sql new file mode 100644 index 000000000..bfb3e0e10 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.30__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.31__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.31__remove_dataprovider_dups.sql new file mode 100644 index 000000000..6f301efc3 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.31__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.32__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.32__remove_dataprovider_dups.sql new file mode 100644 index 000000000..6d2e71d86 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.32__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.33__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.33__remove_dataprovider_dups.sql new file mode 100644 index 000000000..71f2c8077 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.33__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.34__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.34__remove_dataprovider_dups.sql new file mode 100644 index 000000000..fed63fae5 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.34__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49000000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49250000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49500000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM dataprovider_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49750000) DELETE FROM dataprovider WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.35__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.35__remove_dataprovider_dups.sql new file mode 100644 index 000000000..d4ecb635e --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.35__remove_dataprovider_dups.sql @@ -0,0 +1,3 @@ + +-- Just in case anything was missed this query should run much faster after all the rows have been deleted +DELETE FROM dataprovider dp USING dataprovider_ids_to_delete cd WHERE dp.id = cd.id; diff --git a/src/main/resources/db/migration/v0.37.0.36__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.36__remove_dataprovider_dups.sql new file mode 100644 index 000000000..571cf2476 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.36__remove_dataprovider_dups.sql @@ -0,0 +1,22 @@ +-- This is faster then doing the query in one go as it seems this is done in memory whereas a larger query operates on disk which is much slower + +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 0) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 1750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 2750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 3750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 4750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.37__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.37__remove_dataprovider_dups.sql new file mode 100644 index 000000000..a67689b29 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.37__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 5750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 6750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 7750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 8750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 9750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.38__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.38__remove_dataprovider_dups.sql new file mode 100644 index 000000000..54d68ac7e --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.38__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 10750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 11750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 12750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 13750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 14750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.39__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.39__remove_dataprovider_dups.sql new file mode 100644 index 000000000..70a25d95b --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.39__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 15750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 16750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 17750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 18750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 19750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.40__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.40__remove_dataprovider_dups.sql new file mode 100644 index 000000000..68859f711 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.40__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 20750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 21750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 22750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 23750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 24750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.41__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.41__remove_dataprovider_dups.sql new file mode 100644 index 000000000..1500ed3d1 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.41__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 25750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 26750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 27750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 28750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 29750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.42__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.42__remove_dataprovider_dups.sql new file mode 100644 index 000000000..ff118bb2c --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.42__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 30750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 31750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 32750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 33750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 34750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.43__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.43__remove_dataprovider_dups.sql new file mode 100644 index 000000000..c6d2fc4db --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.43__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 35750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 36750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 37750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 38750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 39750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.44__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.44__remove_dataprovider_dups.sql new file mode 100644 index 000000000..29c934d3e --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.44__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 40750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 41750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 42750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 43750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 44750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.45__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.45__remove_dataprovider_dups.sql new file mode 100644 index 000000000..37dae1a75 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.45__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 45750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 46750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 47750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 48750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49000000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49250000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49500000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); +WITH ids AS (SELECT id FROM crossreference_ids_to_delete ORDER BY id LIMIT 250000 OFFSET 49750000) DELETE FROM crossreference WHERE id IN (SELECT id FROM ids); diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql new file mode 100644 index 000000000..b82cdb6a4 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -0,0 +1,5 @@ +DELETE FROM crossreference cr USING crossreference_ids_to_delete cd WHERE cr.id = cd.id; + +DROP TABLE dataprovider_ids_to_keep; +DROP TABLE crossreference_ids_to_delete; +DROP TABLE dataprovider_ids_to_delete; diff --git a/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql new file mode 100644 index 000000000..6bd15b727 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql @@ -0,0 +1,11 @@ +-- Update the null resourcedescriptorpage_id to the XB home page because Xenbase != XB + +update crossreference + set resourcedescriptorpage_id = ( + SELECT rp.id + FROM resourcedescriptorpage rp, resourcedescriptor rd + WHERE rp.resourcedescriptor_id=rd.id and rd.prefix = 'Xenbase' and rp.name = 'homepage' +) +WHERE resourcedescriptorpage_id is null and referencedCurie = 'XB'; + +CREATE INDEX organization_abbreviation_index ON organization USING btree (abbreviation); diff --git a/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql new file mode 100644 index 000000000..aa005d10c --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql @@ -0,0 +1,20 @@ +-- Update all BiologicalEntity.dataProvider to point to a XB dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'XB' + AND cr1.referencedCurie = 'XB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'XB'; + diff --git a/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql new file mode 100644 index 000000000..47783da19 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql @@ -0,0 +1,21 @@ +-- Update all BiologicalEntity.dataProvider to point to a FB dataprovider that is first in the DB + +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'FB' + AND cr1.referencedCurie = 'FB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o, crossreference cr +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id = cr.id AND + o.abbreviation = cr.referencedCurie AND + o.abbreviation = 'FB'; + + From d670d07ee2102e5d071a39f30ba3426469265375 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 28 Aug 2024 19:01:53 -0600 Subject: [PATCH 145/342] Fixed migration file --- .../db/migration/v0.37.0.24__remove_dataprovider_dups.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql index 221275a12..943628a8f 100644 --- a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql @@ -13,7 +13,6 @@ INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM annotation INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM biologicalentity where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 6241140 INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM chromosome where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 0 INSERT INTO dataprovider_ids_to_keep (id) SELECT secondarydataprovider_id FROM diseaseannotation where secondarydataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 14380 -INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM htpexpressiondatasetannotation where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 0 INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM reagent where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 226431 INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM species where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 10 -- Total 6673392 From b043391685b7b2452e79dd45d53ac7b0f17982fa Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 28 Aug 2024 20:36:36 -0600 Subject: [PATCH 146/342] Added missing indexes and updated dao's to use cache --- .../curation_api/dao/DataProviderDAO.java | 8 +++++++- .../curation_api/dao/OrganizationDAO.java | 2 ++ .../curation_api/jobs/executors/Gff3Executor.java | 11 +++++++---- .../curation_api/model/entities/CodingSequence.java | 5 ++++- .../curation_api/model/entities/Exon.java | 5 ++++- .../curation_api/model/entities/Transcript.java | 5 +++++ .../model/entities/ontology/OntologyTerm.java | 1 + .../migration/v0.37.0.7__remove_dataprovider_dups.sql | 5 +++++ 8 files changed, 35 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index dcd7a918b..22ed12adf 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -29,11 +29,16 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { if (dataProviderCache.containsKey(sourceOrganization.getAbbreviation())) { return dataProviderCache.get(sourceOrganization.getAbbreviation()); } + + HashMap params = new HashMap<>(); + params.put("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); + params.put("crossReference.referencedCurie", sourceOrganization.getAbbreviation()); - SearchResponse orgResponse = findByField("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); + SearchResponse orgResponse = findByParams(params); if (orgResponse != null) { DataProvider member = orgResponse.getSingleResult(); if (member != null && member.getSourceOrganization() != null) { + dataProviderCache.put(sourceOrganization.getAbbreviation(), member); return member; } } else { @@ -47,6 +52,7 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { xref.setResourceDescriptorPage(sourceOrganization.getHomepageResourceDescriptorPage()); dataProvider.setCrossReference(crossReferenceDAO.persist(xref)); + dataProviderCache.put(sourceOrganization.getAbbreviation(), dataProvider); return persist(dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java index 37d33336e..c28fafc7f 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/OrganizationDAO.java @@ -25,10 +25,12 @@ public Organization getOrCreateOrganization(String abbreviation) { params.put("abbreviation", abbreviation); SearchResponse resp = findByParams(params); if (resp != null) { + organizationCache.put(abbreviation, resp.getSingleResult()); return resp.getSingleResult(); } else { Organization o = new Organization(); o.setAbbreviation(abbreviation); + organizationCache.put(abbreviation, o); return persist(o); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index da955293f..0b6f1efb1 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -188,8 +188,9 @@ private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory histo return assemblyName; } - private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, - BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + int updateThreshhold = 500; // Aim for every 5 seconds (r/s * 5 = this number) + int updateCounter = 0; for (ImmutablePair> gff3EntryPair : gffData) { try { idsAdded = gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); @@ -202,10 +203,12 @@ private Map> loadEntities(BulkLoadFileHistory history, List Date: Thu, 29 Aug 2024 11:58:08 -0600 Subject: [PATCH 147/342] Initial code to restructure bulk load file history --- .../cliapp/src/service/DataLoadService.js | 3 + .../crud/CodingSequenceCrudController.java | 7 +- .../controllers/crud/ExonCrudController.java | 6 +- .../crud/TranscriptCrudController.java | 7 +- .../enums/BackendBulkLoadType.java | 18 +- .../curation_api/jobs/JobScheduler.java | 44 +- ...JobEvent.java => PendingLoadJobEvent.java} | 2 +- ...JobEvent.java => StartedLoadJobEvent.java} | 2 +- .../AgmDiseaseAnnotationExecutor.java | 24 +- .../jobs/executors/AgmExecutor.java | 24 +- .../AlleleDiseaseAnnotationExecutor.java | 25 +- .../jobs/executors/AlleleExecutor.java | 24 +- .../jobs/executors/BulkLoadJobExecutor.java | 108 +++-- .../jobs/executors/ConstructExecutor.java | 25 +- .../GeneDiseaseAnnotationExecutor.java | 24 +- .../jobs/executors/GeneExecutor.java | 24 +- .../executors/GeneExpressionExecutor.java | 42 +- .../GeneGeneticInteractionExecutor.java | 18 +- .../GeneMolecularInteractionExecutor.java | 19 +- .../jobs/executors/Gff3CDSExecutor.java | 130 +++++ .../jobs/executors/Gff3Executor.java | 446 +++++++++--------- .../jobs/executors/Gff3ExonExecutor.java | 130 +++++ .../executors/Gff3TranscriptExecutor.java | 125 +++++ ...TPExpressionDatasetAnnotationExecutor.java | 27 +- .../jobs/executors/LoadFileExecutor.java | 91 ++-- .../jobs/executors/MoleculeExecutor.java | 26 +- .../jobs/executors/OntologyExecutor.java | 118 +++-- .../jobs/executors/OrthologyExecutor.java | 30 +- .../jobs/executors/ParalogyExecutor.java | 30 +- .../PhenotypeAnnotationExecutor.java | 38 +- .../executors/ResourceDescriptorExecutor.java | 31 +- .../SequenceTargetingReagentExecutor.java | 40 +- .../jobs/executors/VariantExecutor.java | 24 +- .../AlleleGeneAssociationExecutor.java | 24 +- ...tructGenomicEntityAssociationExecutor.java | 24 +- .../jobs/processors/BulkLoadProcessor.java | 98 ++-- .../jobs/processors/StartLoadProcessor.java | 35 +- .../curation_api/jobs/util/SlackNotifier.java | 26 +- .../model/entities/bulkloads/BulkLoad.java | 14 +- .../entities/bulkloads/BulkLoadFile.java | 35 +- .../bulkloads/BulkLoadFileHistory.java | 19 +- .../curation_api/services/Gff3Service.java | 79 ++-- .../loads/BulkLoadFileHistoryService.java | 2 +- .../services/loads/BulkLoadFileService.java | 19 +- .../validation/dto/Gff3DtoValidator.java | 8 +- 45 files changed, 1276 insertions(+), 839 deletions(-) rename src/main/java/org/alliancegenome/curation_api/jobs/events/{PendingBulkLoadFileJobEvent.java => PendingLoadJobEvent.java} (78%) rename src/main/java/org/alliancegenome/curation_api/jobs/events/{StartedBulkLoadFileJobEvent.java => StartedLoadJobEvent.java} (78%) create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 28b2eaa66..518f64a5f 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -81,6 +81,9 @@ export class DataLoadService extends BaseAuthService { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', + 'GFF_EXON', + 'GFF_CDS', + 'GFF_TRANSCRIPT', 'HTPDATASET', 'INTERACTION-GEN', 'INTERACTION-MOL', diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java index 5585ab971..412afee93 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.interfaces.crud.CodingSequenceCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.jobs.executors.Gff3CDSExecutor; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -22,7 +22,7 @@ public class CodingSequenceCrudController extends BaseEntityCrudController gffData) { - return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + return gff3CDSExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java index bf4c105dd..f34218e37 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.interfaces.crud.ExonCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.jobs.executors.Gff3ExonExecutor; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -22,7 +22,7 @@ public class ExonCrudController extends BaseEntityCrudController gffData) { - return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + return gff3ExonExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index a2b5e6c2a..0e2f19afd 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.TranscriptDAO; import org.alliancegenome.curation_api.interfaces.crud.TranscriptCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3Executor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExecutor; import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -22,7 +22,7 @@ public class TranscriptCrudController extends BaseEntityCrudController gffData) { - return gff3Executor.runLoadApi(dataProvider, assembly, gffData); + return gff3TranscriptExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override 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 2c3ae805d..3996ad186 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -18,13 +18,27 @@ public enum BackendBulkLoadType { ALLELE_ASSOCIATION("json"), CONSTRUCT_ASSOCIATION("json"), VARIANT("json"), - GFF("gff"), + + // GFF all from the same file but split out + GFF("gff"), // For Database entries + + GFF_EXON("gff"), + GFF_CDS("gff"), + GFF_TRANSCRIPT("gff"), + GFF_EXON_LOCATION("gff"), + GFF_CDS_LOCATION("gff"), + GFF_TRANSCRIPT_LOCATION("gff"), + GFF_TRANSCRIPT_GENE("gff"), + GFF_TRANSCRIPT_EXON("gff"), + GFF_TRANSCRIPT_CDS("gff"), + INTERACTION_MOL("tsv"), INTERACTION_GEN("tsv"), PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), EXPRESSION("json"), - HTPDATASET("json"); + HTPDATASET("json"), + ; public String fileExtension; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java index b5ac99ad3..ebfe5685d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java @@ -7,15 +7,17 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileExceptionDAO; +import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadGroupDAO; import org.alliancegenome.curation_api.enums.JobStatus; -import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadFileJobEvent; import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; -import org.alliancegenome.curation_api.jobs.events.StartedBulkLoadFileJobEvent; +import org.alliancegenome.curation_api.jobs.events.PendingLoadJobEvent; import org.alliancegenome.curation_api.jobs.events.StartedBulkLoadJobEvent; +import org.alliancegenome.curation_api.jobs.events.StartedLoadJobEvent; import org.alliancegenome.curation_api.jobs.util.SlackNotifier; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadGroup; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkScheduledLoad; import org.alliancegenome.curation_api.response.SearchResponse; @@ -46,9 +48,11 @@ public class JobScheduler { @Inject Event startedJobEvents; - @Inject Event startedFileJobEvents; + @Inject Event startedFileJobEvents; + @Inject BulkLoadFileDAO bulkLoadFileDAO; + @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; @Inject BulkLoadGroupDAO groupDAO; @Inject BulkLoadDAO bulkLoadDAO; @Inject BulkLoadFileExceptionDAO bulkLoadFileExceptionDAO; @@ -70,21 +74,23 @@ public void init() { if (g.getLoads().size() > 0) { for (BulkLoad b : g.getLoads()) { boolean isFirst = true; - for (BulkLoadFile bf : b.getLoadFiles()) { - if (bf.getBulkloadStatus() == null || bf.getBulkloadStatus().isRunning() || bf.getBulkloadStatus().isStarted() || bf.getLocalFilePath() != null) { - if (bf.getLocalFilePath() != null) { - File file = new File(bf.getLocalFilePath()); + for (BulkLoadFileHistory bfh : b.getHistory()) { + BulkLoadFile bulkLoadFile = bfh.getBulkLoadFile(); + if (bfh.getBulkloadStatus() == null || bfh.getBulkloadStatus().isRunning() || bfh.getBulkloadStatus().isStarted() || bulkLoadFile.getLocalFilePath() != null) { + if (bulkLoadFile.getLocalFilePath() != null) { + File file = new File(bulkLoadFile.getLocalFilePath()); if (file.exists()) { file.delete(); } } - bf.setLocalFilePath(null); - bf.setErrorMessage("Failed due to server start up: Process never finished before the server restarted"); - bf.setBulkloadStatus(JobStatus.FAILED); + bulkLoadFile.setLocalFilePath(null); + bfh.setErrorMessage("Failed due to server start up: Process never finished before the server restarted"); + bfh.setBulkloadStatus(JobStatus.FAILED); if (isFirst) { - slackNotifier.slackalert(bf); // Only notify on the first failed file not all the failed files under a load + slackNotifier.slackalert(bfh); // Only notify on the first failed file not all the failed files under a load } - bulkLoadFileDAO.merge(bf); + bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistoryDAO.merge(bfh); } isFirst = false; } @@ -168,15 +174,15 @@ public void pendingJobs(@Observes PendingBulkLoadJobEvent event) { } } - public void pendingFileJobs(@Observes PendingBulkLoadFileJobEvent event) { + public void pendingFileJobs(@Observes PendingLoadJobEvent event) { // Log.info("pendingFileJobs: " + event.getId()); - BulkLoadFile fileLoad = bulkLoadFileDAO.find(event.getId()); - if (fileLoad != null) { - if (fileLoad.getBulkloadStatus().isPending()) { - fileLoad.setBulkloadStatus(fileLoad.getBulkloadStatus().getNextStatus()); - bulkLoadFileDAO.merge(fileLoad); + BulkLoadFileHistory fileLoadHistory = bulkLoadFileHistoryDAO.find(event.getId()); + if (fileLoadHistory != null) { + if (fileLoadHistory.getBulkloadStatus().isPending()) { + fileLoadHistory.setBulkloadStatus(fileLoadHistory.getBulkloadStatus().getNextStatus()); + bulkLoadFileHistoryDAO.merge(fileLoadHistory); // Log.info("Firing Start File Job Event: " + fileLoad.getId()); - startedFileJobEvents.fire(new StartedBulkLoadFileJobEvent(fileLoad.getId())); + startedFileJobEvents.fire(new StartedLoadJobEvent(fileLoadHistory.getId())); } } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/events/PendingBulkLoadFileJobEvent.java b/src/main/java/org/alliancegenome/curation_api/jobs/events/PendingLoadJobEvent.java similarity index 78% rename from src/main/java/org/alliancegenome/curation_api/jobs/events/PendingBulkLoadFileJobEvent.java rename to src/main/java/org/alliancegenome/curation_api/jobs/events/PendingLoadJobEvent.java index e4765286f..9e789d4f8 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/events/PendingBulkLoadFileJobEvent.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/events/PendingLoadJobEvent.java @@ -4,6 +4,6 @@ import lombok.Data; @Data @AllArgsConstructor -public class PendingBulkLoadFileJobEvent { +public class PendingLoadJobEvent { private Long id; } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/events/StartedBulkLoadFileJobEvent.java b/src/main/java/org/alliancegenome/curation_api/jobs/events/StartedLoadJobEvent.java similarity index 78% rename from src/main/java/org/alliancegenome/curation_api/jobs/events/StartedBulkLoadFileJobEvent.java rename to src/main/java/org/alliancegenome/curation_api/jobs/events/StartedLoadJobEvent.java index 97ecbde78..ecd5f5abf 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/events/StartedBulkLoadFileJobEvent.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/events/StartedLoadJobEvent.java @@ -4,6 +4,6 @@ import lombok.Data; @Data @AllArgsConstructor -public class StartedBulkLoadFileJobEvent { +public class StartedLoadJobEvent { private Long id; } 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 26a9dfaff..d0ee8f677 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 @@ -6,7 +6,6 @@ import org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.AGMDiseaseAnnotationDTO; @@ -26,13 +25,13 @@ public class AgmDiseaseAnnotationExecutor extends LoadFileExecutor { @Inject DiseaseAnnotationService diseaseAnnotationService; @Inject AGMDiseaseAnnotationService agmDiseaseAnnotationService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider: " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, AGMDiseaseAnnotationDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AGMDiseaseAnnotationDTO.class); if (ingestDto == null) { return; } @@ -49,17 +48,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { annotationIdsBefore.removeIf(Objects::isNull); } - bulkLoadFile.setRecordCount(annotations.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(annotations.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(agmDiseaseAnnotationService, history, dataProvider, annotations, annotationIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) annotations.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(agmDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded); if (success && cleanUp) { - runCleanup(diseaseAnnotationService, history, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "AGM disease annotation", bulkLoadFile.getMd5Sum()); + runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "AGM disease annotation"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmExecutor.java index a46ef21e6..8ec7922a9 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AgmExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.dao.AffectedGenomicModelDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.AffectedGenomicModelDTO; @@ -26,12 +25,12 @@ public class AgmExecutor extends LoadFileExecutor { @Inject NcbiTaxonTermService ncbiTaxonTermService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); Log.info("Running with: " + manual.getDataProvider().name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, AffectedGenomicModelDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AffectedGenomicModelDTO.class); if (ingestDto == null) { return; } @@ -50,17 +49,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { Log.debug("runLoad: Before: total " + agmIdsBefore.size()); } - bulkLoadFile.setRecordCount(agms.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(agms.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(agms.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(affectedGenomicModelService, history, dataProvider, agms, agmIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) agms.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(affectedGenomicModelService, bulkLoadFileHistory, dataProvider, agms, agmIdsLoaded); if (success && cleanUp) { - runCleanup(affectedGenomicModelService, history, dataProvider.name(), agmIdsBefore, agmIdsLoaded, "AGM", bulkLoadFile.getMd5Sum()); + runCleanup(affectedGenomicModelService, bulkLoadFileHistory, dataProvider.name(), agmIdsBefore, agmIdsLoaded, "AGM"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(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 22b3134d4..a4faa1dc2 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 @@ -6,7 +6,6 @@ import org.alliancegenome.curation_api.dao.AlleleDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.AlleleDiseaseAnnotationDTO; @@ -26,13 +25,13 @@ public class AlleleDiseaseAnnotationExecutor extends LoadFileExecutor { @Inject AlleleDiseaseAnnotationService alleleDiseaseAnnotationService; @Inject DiseaseAnnotationService diseaseAnnotationService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider: " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, AlleleDiseaseAnnotationDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AlleleDiseaseAnnotationDTO.class); if (ingestDto == null) { return; } @@ -49,17 +48,19 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { annotationIdsBefore.removeIf(Objects::isNull); } - bulkLoadFile.setRecordCount(annotations.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(annotations.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(alleleDiseaseAnnotationService, history, dataProvider, annotations, annotationIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) annotations.size()); + + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(alleleDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded); if (success && cleanUp) { - runCleanup(diseaseAnnotationService, history, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "allele disease annotation", bulkLoadFile.getMd5Sum()); + runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "allele disease annotation"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleExecutor.java index 7b1293226..263e6cc48 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/AlleleExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.dao.AlleleDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.AlleleDTO; @@ -22,12 +21,12 @@ public class AlleleExecutor extends LoadFileExecutor { @Inject AlleleDAO alleleDAO; @Inject AlleleService alleleService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); Log.info("Running with: " + manual.getDataProvider().name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, AlleleDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AlleleDTO.class); if (ingestDto == null) { return; } @@ -46,17 +45,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { Log.debug("runLoad: Before: total " + alleleIdsBefore.size()); } - bulkLoadFile.setRecordCount(alleles.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(alleles.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(alleles.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(alleleService, history, dataProvider, alleles, alleleIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) alleles.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(alleleService, bulkLoadFileHistory, dataProvider, alleles, alleleIdsLoaded); if (success && cleanUp) { - runCleanup(alleleService, history, dataProvider.name(), alleleIdsBefore, alleleIdsLoaded, "allele", bulkLoadFile.getMd5Sum()); + runCleanup(alleleService, bulkLoadFileHistory, dataProvider.name(), alleleIdsBefore, alleleIdsLoaded, "allele"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } 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 c2b03efa7..2da5e806a 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 @@ -19,7 +19,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkLoadType; import org.alliancegenome.curation_api.jobs.executors.associations.alleleAssociations.AlleleGeneAssociationExecutor; import org.alliancegenome.curation_api.jobs.executors.associations.constructAssociations.ConstructGenomicEntityAssociationExecutor; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; @@ -51,79 +51,101 @@ public class BulkLoadJobExecutor { @Inject ParalogyExecutor paralogyExecutor; @Inject GeneExpressionExecutor geneExpressionExecutor; @Inject SequenceTargetingReagentExecutor sqtrExecutor; - @Inject Gff3Executor gff3Executor; + + @Inject Gff3ExonExecutor gff3ExonExecutor; + @Inject Gff3CDSExecutor gff3CDSExecutor; + @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; + @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor; - public void process(BulkLoadFile bulkLoadFile, Boolean cleanUp) throws Exception { + public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) throws Exception { - BackendBulkLoadType loadType = bulkLoadFile.getBulkLoad().getBackendBulkLoadType(); + BackendBulkLoadType loadType = bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType(); List ingestTypes = List.of(AGM_DISEASE_ANNOTATION, ALLELE_DISEASE_ANNOTATION, GENE_DISEASE_ANNOTATION, DISEASE_ANNOTATION, AGM, ALLELE, GENE, VARIANT, CONSTRUCT, FULL_INGEST, ALLELE_ASSOCIATION, CONSTRUCT_ASSOCIATION); if (ingestTypes.contains(loadType)) { - bulkLoadFile.setRecordCount(0); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(0); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); if (loadType == AGM || loadType == FULL_INGEST) { - agmExecutor.execLoad(bulkLoadFile, cleanUp); + agmExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == ALLELE || loadType == FULL_INGEST) { - alleleExecutor.execLoad(bulkLoadFile, cleanUp); + alleleExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == GENE || loadType == FULL_INGEST) { - geneExecutor.execLoad(bulkLoadFile, cleanUp); + geneExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == CONSTRUCT || loadType == FULL_INGEST) { - constructExecutor.execLoad(bulkLoadFile, cleanUp); + constructExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == VARIANT || loadType == FULL_INGEST) { - variantExecutor.execLoad(bulkLoadFile, cleanUp); + variantExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == ALLELE_DISEASE_ANNOTATION || loadType == DISEASE_ANNOTATION || loadType == FULL_INGEST) { - alleleDiseaseAnnotationExecutor.execLoad(bulkLoadFile, cleanUp); + alleleDiseaseAnnotationExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == AGM_DISEASE_ANNOTATION || loadType == DISEASE_ANNOTATION || loadType == FULL_INGEST) { - agmDiseaseAnnotationExecutor.execLoad(bulkLoadFile, cleanUp); + agmDiseaseAnnotationExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == GENE_DISEASE_ANNOTATION || loadType == DISEASE_ANNOTATION || loadType == FULL_INGEST) { - geneDiseaseAnnotationExecutor.execLoad(bulkLoadFile, cleanUp); + geneDiseaseAnnotationExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == ALLELE_ASSOCIATION || loadType == FULL_INGEST) { - alleleGeneAssociationExecutor.execLoad(bulkLoadFile, cleanUp); + alleleGeneAssociationExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == CONSTRUCT_ASSOCIATION || loadType == FULL_INGEST) { - constructGenomicEntityAssociationExecutor.execLoad(bulkLoadFile, cleanUp); + constructGenomicEntityAssociationExecutor.execLoad(bulkLoadFileHistory, cleanUp); } - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.MOLECULE) { - moleculeExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.SEQUENCE_TARGETING_REAGENT) { - sqtrExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.INTERACTION_MOL) { - geneMolecularInteractionExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.INTERACTION_GEN) { - geneGeneticInteractionExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.PHENOTYPE) { - phenotypeAnnotationExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ORTHOLOGY) { - orthologyExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.PARALOGY) { - paralogyExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ONTOLOGY) { - ontologyExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.RESOURCE_DESCRIPTOR) { - resourceDescriptorExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION) { - geneExpressionExecutor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF) { - gff3Executor.execLoad(bulkLoadFile); - } else if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) { - htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.MOLECULE) { + moleculeExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.SEQUENCE_TARGETING_REAGENT) { + sqtrExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.INTERACTION_MOL) { + geneMolecularInteractionExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.INTERACTION_GEN) { + geneGeneticInteractionExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.PHENOTYPE) { + phenotypeAnnotationExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ORTHOLOGY) { + orthologyExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.PARALOGY) { + paralogyExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ONTOLOGY) { + ontologyExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.RESOURCE_DESCRIPTOR) { + resourceDescriptorExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION) { + geneExpressionExecutor.execLoad(bulkLoadFileHistory); + + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON) { + gff3ExonExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS) { + gff3CDSExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT) { + gff3TranscriptExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON_LOCATION) { + //gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS_LOCATION) { + //gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_LOCATION) { + //gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_GENE) { + //gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_EXON) { + //gff3Executor.execLoad(bulkLoadFile); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_CDS) { + //gff3Executor.execLoad(bulkLoadFile); + + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) { + htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFileHistory); } else { - log.info("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); - throw new Exception("Load: " + bulkLoadFile.getBulkLoad().getName() + " not implemented"); + 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"); } - log.info("Process Finished for: " + bulkLoadFile.getBulkLoad().getName()); + log.info("Process Finished for: " + bulkLoadFileHistory.getBulkLoad().getName()); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ConstructExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ConstructExecutor.java index 22096d26d..676efb083 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/ConstructExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ConstructExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.dao.ConstructDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.ConstructDTO; @@ -26,12 +25,12 @@ public class ConstructExecutor extends LoadFileExecutor { @Inject NcbiTaxonTermService ncbiTaxonTermService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); Log.info("Running with: " + manual.getDataProvider().name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, ConstructDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, ConstructDTO.class); if (ingestDto == null) { return; } @@ -50,17 +49,19 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { Log.debug("runLoad: Before: total " + constructIdsBefore.size()); } - bulkLoadFile.setRecordCount(constructs.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(constructs.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(constructs.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(constructService, history, dataProvider, constructs, constructIdsLoaded); + bulkLoadFileHistory.setTotalDeleteRecords((long) constructs.size()); + + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(constructService, bulkLoadFileHistory, dataProvider, constructs, constructIdsLoaded); if (success && cleanUp) { - runCleanup(constructService, history, dataProvider.name(), constructIdsBefore, constructIdsLoaded, "construct", bulkLoadFile.getMd5Sum()); + runCleanup(constructService, bulkLoadFileHistory, dataProvider.name(), constructIdsBefore, constructIdsLoaded, "construct"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } 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 aeb8367d0..5e3579921 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 @@ -6,7 +6,6 @@ import org.alliancegenome.curation_api.dao.GeneDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.GeneDiseaseAnnotationDTO; @@ -26,13 +25,13 @@ public class GeneDiseaseAnnotationExecutor extends LoadFileExecutor { @Inject GeneDiseaseAnnotationService geneDiseaseAnnotationService; @Inject DiseaseAnnotationService diseaseAnnotationService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider: " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, GeneDiseaseAnnotationDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, GeneDiseaseAnnotationDTO.class); if (ingestDto == null) { return; } @@ -49,17 +48,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { annotationIdsBefore.removeIf(Objects::isNull); } - bulkLoadFile.setRecordCount(annotations.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(annotations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(annotations.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(geneDiseaseAnnotationService, history, dataProvider, annotations, annotationIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) annotations.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(geneDiseaseAnnotationService, bulkLoadFileHistory, dataProvider, annotations, annotationIdsLoaded); if (success && cleanUp) { - runCleanup(diseaseAnnotationService, history, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene disease annotation", bulkLoadFile.getMd5Sum()); + runCleanup(diseaseAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene disease annotation"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExecutor.java index a7b0cec73..fb140f31e 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/GeneExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.dao.GeneDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.GeneDTO; @@ -27,13 +26,13 @@ public class GeneExecutor extends LoadFileExecutor { @Inject NcbiTaxonTermService ncbiTaxonTermService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider : " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, GeneDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, GeneDTO.class); if (ingestDto == null) { return; } @@ -50,17 +49,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { log.debug("runLoad: Before: total " + geneIdsBefore.size()); } - bulkLoadFile.setRecordCount(genes.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(genes.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(genes.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(geneService, history, dataProvider, genes, geneIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) genes.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(geneService, bulkLoadFileHistory, dataProvider, genes, geneIdsLoaded); if (success && cleanUp) { - runCleanup(geneService, history, dataProvider.name(), geneIdsBefore, geneIdsLoaded, "gene", bulkLoadFile.getMd5Sum()); + runCleanup(geneService, bulkLoadFileHistory, dataProvider.name(), geneIdsBefore, geneIdsLoaded, "gene"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(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 8f9d81f88..f477ed15a 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,55 +1,57 @@ package org.alliancegenome.curation_api.jobs.executors; -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; + import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionIngestFmsDTO; import org.alliancegenome.curation_api.services.GeneExpressionAnnotationService; import org.apache.commons.lang3.StringUtils; -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; @ApplicationScoped public class GeneExpressionExecutor extends LoadFileExecutor { @Inject GeneExpressionAnnotationService geneExpressionAnnotationService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); - GeneExpressionIngestFmsDTO geneExpressionIngestFmsDTO = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), GeneExpressionIngestFmsDTO.class); - bulkLoadFile.setRecordCount(geneExpressionIngestFmsDTO.getData().size()); + GeneExpressionIngestFmsDTO geneExpressionIngestFmsDTO = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), GeneExpressionIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(geneExpressionIngestFmsDTO.getData().size()); AGRCurationSchemaVersion version = GeneExpressionAnnotation.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (geneExpressionIngestFmsDTO.getMetaData() != null && StringUtils.isNotBlank(geneExpressionIngestFmsDTO.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(geneExpressionIngestFmsDTO.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(geneExpressionIngestFmsDTO.getMetaData().getRelease()); } + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(geneExpressionIngestFmsDTO.getData().size()); - createHistory(history, bulkLoadFile); + bulkLoadFileHistory.setTotalRecords((long) geneExpressionIngestFmsDTO.getData().size()); + updateHistory(bulkLoadFileHistory); + List annotationIdsLoaded = new ArrayList<>(); List annotationIdsBefore = geneExpressionAnnotationService.getAnnotationIdsByDataProvider(dataProvider); - boolean success = runLoad(geneExpressionAnnotationService, history, dataProvider, geneExpressionIngestFmsDTO.getData(), annotationIdsLoaded); + boolean success = runLoad(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider, geneExpressionIngestFmsDTO.getData(), annotationIdsLoaded); if (success) { - runCleanup(geneExpressionAnnotationService, history, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene expression annotation", bulkLoadFile.getMd5Sum()); + runCleanup(geneExpressionAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded, "gene expression annotation"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } 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 cba477bd8..936cb5bf8 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 @@ -7,7 +7,6 @@ import org.alliancegenome.curation_api.dao.GeneGeneticInteractionDAO; import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; import org.alliancegenome.curation_api.services.GeneGeneticInteractionService; @@ -28,28 +27,29 @@ public class GeneGeneticInteractionExecutor extends LoadFileExecutor { @Inject GeneGeneticInteractionService geneGeneticInteractionService; @Inject GeneInteractionService geneInteractionService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { CsvSchema psiMiTabSchema = CsvSchemaBuilder.psiMiTabSchema(); CsvMapper csvMapper = new CsvMapper(); - MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath()))); + MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()))); List interactionData = it.readAll(); List interactionIdsLoaded = new ArrayList<>(); List interactionIdsBefore = geneGeneticInteractionDAO.findAllIds().getResults(); + bulkLoadFileHistory.setTotalRecords((long) interactionData.size()); + updateHistory(bulkLoadFileHistory); - BulkLoadFileHistory history = new BulkLoadFileHistory(interactionData.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(geneGeneticInteractionService, history, null, interactionData, interactionIdsLoaded, false); + boolean success = runLoad(geneGeneticInteractionService, bulkLoadFileHistory, null, interactionData, interactionIdsLoaded, false); if (success) { - runCleanup(geneInteractionService, history, "COMBINED", interactionIdsBefore, interactionIdsLoaded, "gene genetic interaction", bulkLoadFile.getMd5Sum()); + runCleanup(geneInteractionService, bulkLoadFileHistory, "COMBINED", interactionIdsBefore, interactionIdsLoaded, "gene genetic interaction"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } 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 acfbe9953..bbbe4bdb6 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 @@ -7,7 +7,6 @@ import org.alliancegenome.curation_api.dao.GeneMolecularInteractionDAO; import org.alliancegenome.curation_api.jobs.util.CsvSchemaBuilder; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; import org.alliancegenome.curation_api.services.GeneInteractionService; @@ -28,27 +27,29 @@ public class GeneMolecularInteractionExecutor extends LoadFileExecutor { @Inject GeneMolecularInteractionService geneMolecularInteractionService; @Inject GeneInteractionService geneInteractionService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { CsvSchema psiMiTabSchema = CsvSchemaBuilder.psiMiTabSchema(); CsvMapper csvMapper = new CsvMapper(); - MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath()))); + MappingIterator it = csvMapper.enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS).readerFor(PsiMiTabDTO.class).with(psiMiTabSchema).readValues(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()))); List interactionData = it.readAll(); List interactionIdsLoaded = new ArrayList<>(); List interactionIdsBefore = geneMolecularInteractionDAO.findAllIds().getResults(); - BulkLoadFileHistory history = new BulkLoadFileHistory(interactionData.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(geneMolecularInteractionService, history, null, interactionData, interactionIdsLoaded, false); + bulkLoadFileHistory.setTotalRecords((long) interactionData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(geneMolecularInteractionService, bulkLoadFileHistory, null, interactionData, interactionIdsLoaded, false); if (success) { - runCleanup(geneInteractionService, history, "COMBINED", interactionIdsBefore, interactionIdsLoaded, "gene molecular interaction", bulkLoadFile.getMd5Sum()); + runCleanup(geneInteractionService, bulkLoadFileHistory, "COMBINED", interactionIdsBefore, interactionIdsLoaded, "gene molecular interaction"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java new file mode 100644 index 000000000..d670630ed --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java @@ -0,0 +1,130 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.CodingSequenceService; +import org.alliancegenome.curation_api.services.Gff3Service; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3CDSExecutor extends Gff3Executor { + + @Inject Gff3Service gff3Service; + @Inject CodingSequenceService cdsService; + + @Override + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + + if (success) { + runCleanup(cdsService, bulkLoadFileHistory, dataProvider.name(), cdsService.getIdsByDataProvider(dataProvider), idsAdded, "GFF coding sequence"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); + + loadCDSEntities(history, gffData, idsAdded, dataProvider, ph); + + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + + private void loadCDSEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) + int updateCounter = 0; + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadCDSEntity(history, gff3EntryPair, idsAdded, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + if (updateCounter++ % updateThreshhold == 0) { + updateHistory(history); + } + ph.progressProcess(); + } + updateHistory(history); + } + + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index 0b6f1efb1..cd537d0d9 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -1,262 +1,244 @@ package org.alliancegenome.curation_api.jobs.executors; -import java.io.FileInputStream; import java.util.ArrayList; import java.util.HashMap; 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.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.BulkLoadFile; 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.CodingSequenceService; -import org.alliancegenome.curation_api.services.ExonService; -import org.alliancegenome.curation_api.services.Gff3Service; -import org.alliancegenome.curation_api.services.TranscriptService; -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.transcriptAssociations.TranscriptCodingSequenceAssociationService; -import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; -import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; -import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; 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 jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; @ApplicationScoped public class Gff3Executor extends LoadFileExecutor { - @Inject Gff3Service gff3Service; - @Inject ExonService exonService; - @Inject CodingSequenceService cdsService; - @Inject TranscriptService transcriptService; - @Inject ExonGenomicLocationAssociationService exonLocationService; - @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; - @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; - @Inject TranscriptGeneAssociationService transcriptGeneService; - @Inject TranscriptExonAssociationService transcriptExonService; - @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; +// @Inject Gff3Service gff3Service; +// @Inject ExonService exonService; +// @Inject CodingSequenceService cdsService; +// @Inject TranscriptService transcriptService; +// @Inject ExonGenomicLocationAssociationService exonLocationService; +// @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; +// @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; +// @Inject TranscriptGeneAssociationService transcriptGeneService; +// @Inject TranscriptExonAssociationService transcriptExonService; +// @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; - public void execLoad(BulkLoadFile bulkLoadFile) { - 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(bulkLoadFile.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) bulkLoadFile.getBulkLoad(); - BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - - gffData.clear(); - - Map> idsAdded = createIdsAddedMap(); - Map> previousIds = getPreviouslyLoadedIds(dataProvider); - - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); - createHistory(history, bulkLoadFile); - idsAdded = runLoad(history, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); - runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); - runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); - runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); - runCleanup(transcriptLocationService, history, dataProvider.name(), previousIds.get("TranscriptGenomicLocationAssociation"), idsAdded.get("TranscriptGenomicLocationAssociation"), "GFF transcript genomic location association", bulkLoadFile.getMd5Sum()); - runCleanup(exonLocationService, history, dataProvider.name(), previousIds.get("ExonGenomicLocationAssociation"), idsAdded.get("ExonGenomicLocationAssociation"), "GFF exon genomic location association", bulkLoadFile.getMd5Sum()); - runCleanup(cdsLocationService, history, dataProvider.name(), previousIds.get("CodingSequenceGenomicLocationAssociation"), idsAdded.get("CodingSequenceGenomicLocationAssociation"), "GFF coding sequence genomic location association", bulkLoadFile.getMd5Sum()); - runCleanup(transcriptGeneService, history, dataProvider.name(), previousIds.get("TranscriptGeneAssociation"), idsAdded.get("TranscriptGeneAssociation"), "GFF transcript gene association", bulkLoadFile.getMd5Sum()); - runCleanup(transcriptExonService, history, dataProvider.name(), previousIds.get("TranscriptExonAssociation"), idsAdded.get("TranscriptExonAssociation"), "GFF transcript exon association", bulkLoadFile.getMd5Sum()); - runCleanup(transcriptCdsService, history, dataProvider.name(), previousIds.get("TranscriptCodingSequenceAssociation"), idsAdded.get("TranscriptCodingSequenceAssociation"), "GFF transcript coding sequence association", bulkLoadFile.getMd5Sum()); - - history.finishLoad(); - finalSaveHistory(history); - - } catch (Exception e) { - e.printStackTrace(); - } + 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(bulkLoadFile.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) bulkLoadFile.getBulkLoad(); +// BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); +// +// List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); +// +// gffData.clear(); +// +// Map> idsAdded = createIdsAddedMap(); +// +// BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); +// createHistory(history, bulkLoadFile); +// +// boolean success = runLoad(history, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); +// +// if (success) { +// Map> previousIds = getPreviouslyLoadedIds(dataProvider); +// runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); +// runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); +// runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); +// runCleanup(transcriptLocationService, history, dataProvider.name(), previousIds.get("TranscriptGenomicLocationAssociation"), idsAdded.get("TranscriptGenomicLocationAssociation"), "GFF transcript genomic location association", bulkLoadFile.getMd5Sum()); +// runCleanup(exonLocationService, history, dataProvider.name(), previousIds.get("ExonGenomicLocationAssociation"), idsAdded.get("ExonGenomicLocationAssociation"), "GFF exon genomic location association", bulkLoadFile.getMd5Sum()); +// runCleanup(cdsLocationService, history, dataProvider.name(), previousIds.get("CodingSequenceGenomicLocationAssociation"), idsAdded.get("CodingSequenceGenomicLocationAssociation"), "GFF coding sequence genomic location association", bulkLoadFile.getMd5Sum()); +// runCleanup(transcriptGeneService, history, dataProvider.name(), previousIds.get("TranscriptGeneAssociation"), idsAdded.get("TranscriptGeneAssociation"), "GFF transcript gene association", bulkLoadFile.getMd5Sum()); +// runCleanup(transcriptExonService, history, dataProvider.name(), previousIds.get("TranscriptExonAssociation"), idsAdded.get("TranscriptExonAssociation"), "GFF transcript exon association", bulkLoadFile.getMd5Sum()); +// runCleanup(transcriptCdsService, history, dataProvider.name(), previousIds.get("TranscriptCodingSequenceAssociation"), idsAdded.get("TranscriptCodingSequenceAssociation"), "GFF transcript coding sequence association", bulkLoadFile.getMd5Sum()); +// } +// history.finishLoad(); +// finalSaveHistory(history); +// +// } catch (Exception e) { +// e.printStackTrace(); +// } } - private Map> createIdsAddedMap() { - Map> idsAdded = new HashMap>(); - idsAdded.put("Transcript", new ArrayList()); - idsAdded.put("Exon", new ArrayList()); - idsAdded.put("CodingSequence", new ArrayList()); - idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); - idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); - idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); - idsAdded.put("TranscriptGeneAssociation", new ArrayList()); - idsAdded.put("TranscriptExonAssociation", new ArrayList()); - idsAdded.put("TranscriptCodingSequenceAssociation", new ArrayList()); - - return idsAdded; - } +// private Map> createIdsAddedMap() { +// Map> idsAdded = new HashMap>(); +// idsAdded.put("Transcript", new ArrayList()); +// idsAdded.put("Exon", new ArrayList()); +// idsAdded.put("CodingSequence", new ArrayList()); +// idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); +// idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); +// idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); +// idsAdded.put("TranscriptGeneAssociation", new ArrayList()); +// idsAdded.put("TranscriptExonAssociation", new ArrayList()); +// idsAdded.put("TranscriptCodingSequenceAssociation", new ArrayList()); +// +// return idsAdded; +// } - private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { - Map> previousIds = new HashMap<>(); - - previousIds.put("Transcript", transcriptService.getIdsByDataProvider(dataProvider)); - previousIds.put("Exon", exonService.getIdsByDataProvider(dataProvider)); - previousIds.put("CodingSequence", cdsService.getIdsByDataProvider(dataProvider)); - previousIds.put("TranscriptGenomicLocationAssociation", transcriptLocationService.getIdsByDataProvider(dataProvider)); - previousIds.put("ExonGenomicLocationAssociation", exonLocationService.getIdsByDataProvider(dataProvider)); - previousIds.put("CodingSequenceGenomicLocationAssociation", cdsLocationService.getIdsByDataProvider(dataProvider)); - previousIds.put("TranscriptGeneAssociation", transcriptGeneService.getIdsByDataProvider(dataProvider)); - previousIds.put("TranscriptExonAssociation", transcriptExonService.getIdsByDataProvider(dataProvider)); - previousIds.put("TranscriptCodingSequenceAssociation", transcriptCdsService.getIdsByDataProvider(dataProvider)); - - - return previousIds; - } +// private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { +// Map> previousIds = new HashMap<>(); +// +// previousIds.put("Transcript", transcriptService.getIdsByDataProvider(dataProvider)); +// previousIds.put("Exon", exonService.getIdsByDataProvider(dataProvider)); +// previousIds.put("CodingSequence", cdsService.getIdsByDataProvider(dataProvider)); +// previousIds.put("TranscriptGenomicLocationAssociation", transcriptLocationService.getIdsByDataProvider(dataProvider)); +// previousIds.put("ExonGenomicLocationAssociation", exonLocationService.getIdsByDataProvider(dataProvider)); +// previousIds.put("CodingSequenceGenomicLocationAssociation", cdsLocationService.getIdsByDataProvider(dataProvider)); +// previousIds.put("TranscriptGeneAssociation", transcriptGeneService.getIdsByDataProvider(dataProvider)); +// previousIds.put("TranscriptExonAssociation", transcriptExonService.getIdsByDataProvider(dataProvider)); +// previousIds.put("TranscriptCodingSequenceAssociation", transcriptCdsService.getIdsByDataProvider(dataProvider)); +// +// +// return previousIds; +// } - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, - Map> idsAdded, BackendBulkDataProvider dataProvider) { - return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); - } - - private Map> runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, - Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { - - ProcessDisplayHelper ph = new ProcessDisplayHelper(); - ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); - - assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); - idsAdded = loadEntities(history, gffData, idsAdded, dataProvider, ph); - - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData, dataProvider); - - idsAdded = loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); - idsAdded = loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); - - ph.finishProcess(); - - return idsAdded; - } +// private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider) { +// return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); +// } +// +// private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { +// +// ProcessDisplayHelper ph = new ProcessDisplayHelper(); +// ph.addDisplayHandler(loadProcessDisplayService); +// ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); +// +// assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); +// +// if (assemblyId == null) { +// failLoad(history.getBulkLoadFile(), new Exception("GFF Header does not contain assembly")); +// return false; +// } else { +// loadEntities(history, gffData, idsAdded, dataProvider, ph); +// Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); +// loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); +// loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); +// } +// ph.finishProcess(); +// +// return true; +// } - public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { - Map> idsAdded = createIdsAddedMap(); - BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); - - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); - history.finishLoad(); - - return new LoadHistoryResponce(history); - } - - private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - try { - assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); - history.incrementCompleted(); - } catch (ObjectUpdateException e) { - history.incrementFailed(); - addException(history, e.getData()); - } catch (Exception e) { - e.printStackTrace(); - history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); - } - updateHistory(history); - ph.progressProcess(); - - return assemblyName; - } +// public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { +// Map> idsAdded = createIdsAddedMap(); +// BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); +// List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); +// BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); +// +// runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); +// history.finishLoad(); +// +// return new LoadHistoryResponce(history); +// } +// +// private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { +// try { +// assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); +// history.incrementCompleted(); +// } catch (ObjectUpdateException e) { +// //e.printStackTrace(); +// history.incrementFailed(); +// addException(history, e.getData()); +// } catch (Exception e) { +// e.printStackTrace(); +// history.incrementFailed(); +// addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); +// } +// updateHistory(history); +// ph.progressProcess(); +// +// return assemblyName; +// } - private Map> loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - int updateThreshhold = 500; // Aim for every 5 seconds (r/s * 5 = this number) - int updateCounter = 0; - for (ImmutablePair> gff3EntryPair : gffData) { - try { - idsAdded = gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); - history.incrementCompleted(); - } catch (ObjectUpdateException e) { - history.incrementFailed(); - addException(history, e.getData()); - } catch (Exception e) { - e.printStackTrace(); - history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); - } - if (updateCounter++ % updateThreshhold == 0) { - updateHistory(history); - } - ph.progressProcess(); - } - updateHistory(history); - return idsAdded; - } - - private Map> loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, - BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { - - for (ImmutablePair> gff3EntryPair : gffData) { - try { - idsAdded = gff3Service.loadLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); - history.incrementCompleted(); - } catch (ObjectUpdateException e) { - history.incrementFailed(); - addException(history, e.getData()); - } catch (Exception e) { - e.printStackTrace(); - history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); - } - updateHistory(history); - ph.progressProcess(); - } - - return idsAdded; - } - - private Map> loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, - BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { - - for (ImmutablePair> gff3EntryPair : gffData) { - try { - idsAdded = gff3Service.loadParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); - history.incrementCompleted(); - } catch (ObjectUpdateException e) { - history.incrementFailed(); - addException(history, e.getData()); - } catch (Exception e) { - e.printStackTrace(); - history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); - } - updateHistory(history); - ph.progressProcess(); - } - - return idsAdded; - } +// private void loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { +// int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) +// int updateCounter = 0; +// for (ImmutablePair> gff3EntryPair : gffData) { +// try { +// gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); +// history.incrementCompleted(); +// } catch (ObjectUpdateException e) { +// history.incrementFailed(); +// addException(history, e.getData()); +// } catch (Exception e) { +// e.printStackTrace(); +// history.incrementFailed(); +// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); +// } +// if (updateCounter++ % updateThreshhold == 0) { +// updateHistory(history); +// } +// ph.progressProcess(); +// } +// updateHistory(history); +// +// } +// +// private void loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { +// int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) +// int updateCounter = 0; +// for (ImmutablePair> gff3EntryPair : gffData) { +// try { +// gff3Service.loadLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); +// history.incrementCompleted(); +// } catch (ObjectUpdateException e) { +// e.printStackTrace(); +// history.incrementFailed(); +// addException(history, e.getData()); +// } catch (Exception e) { +// e.printStackTrace(); +// history.incrementFailed(); +// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); +// } +// if (updateCounter++ % updateThreshhold == 0) { +// updateHistory(history); +// } +// ph.progressProcess(); +// } +// updateHistory(history); +// +// } +// +// private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, +// BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { +// +// for (ImmutablePair> gff3EntryPair : gffData) { +// try { +// gff3Service.loadParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); +// history.incrementCompleted(); +// } catch (ObjectUpdateException e) { +// history.incrementFailed(); +// addException(history, e.getData()); +// } catch (Exception e) { +// e.printStackTrace(); +// history.incrementFailed(); +// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); +// } +// updateHistory(history); +// ph.progressProcess(); +// } +// +// } - private List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { + protected List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { List>> processedGffData = new ArrayList<>(); ProcessDisplayHelper ph = new ProcessDisplayHelper(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java new file mode 100644 index 000000000..f635fda48 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java @@ -0,0 +1,130 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.ExonService; +import org.alliancegenome.curation_api.services.Gff3Service; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3ExonExecutor extends Gff3Executor { + + @Inject Gff3Service gff3Service; + @Inject ExonService exonService; + + @Override + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + if (success) { + runCleanup(exonService, bulkLoadFileHistory, dataProvider.name(), exonService.getIdsByDataProvider(dataProvider), idsAdded, "GFF exon"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Exon update for " + dataProvider.name(), (gffData.size() * 3) + 1); + + loadExonEntities(history, gffData, idsAdded, dataProvider, ph); + + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + + private void loadExonEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) + int updateCounter = 0; + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadExonEntity(history, gff3EntryPair, idsAdded, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + //if (++updateCounter % updateThreshhold == 0) { + // updateHistory(history); + //} + ph.progressProcess(); + } + updateHistory(history); + + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java new file mode 100644 index 000000000..635c6bbb6 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java @@ -0,0 +1,125 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.Gff3Service; +import org.alliancegenome.curation_api.services.TranscriptService; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3TranscriptExecutor extends Gff3Executor { + + @Inject Gff3Service gff3Service; + @Inject TranscriptService transcriptService; + + @Override + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + + if (success) { + runCleanup(transcriptService, bulkLoadFileHistory, dataProvider.name(), transcriptService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); + + loadTranscriptEntities(history, gffData, idsAdded, dataProvider, ph); + + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadTranscriptEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadTranscriptEntity(history, gff3EntryPair, idsAdded, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java index 26f85c705..dd2b5fde1 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -14,7 +14,6 @@ import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationIngestFmsDTO; @@ -34,28 +33,31 @@ public class HTPExpressionDatasetAnnotationExecutor extends LoadFileExecutor { @Inject HTPExpressionDatasetAnnotationService htpExpressionDatasetAnnotationService; @Inject HTPExpressionDatasetAnnotationDAO htpExpressionDatasetAnnotationDAO; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); - HTPExpressionDatasetAnnotationIngestFmsDTO htpExpressionDatasetData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), HTPExpressionDatasetAnnotationIngestFmsDTO.class); - bulkLoadFile.setRecordCount(htpExpressionDatasetData.getData().size()); + HTPExpressionDatasetAnnotationIngestFmsDTO htpExpressionDatasetData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), HTPExpressionDatasetAnnotationIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(htpExpressionDatasetData.getData().size()); AGRCurationSchemaVersion version = HTPExpressionDatasetAnnotation.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (htpExpressionDatasetData.getMetaData() != null && StringUtils.isNotBlank(htpExpressionDatasetData.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(htpExpressionDatasetData.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(htpExpressionDatasetData.getMetaData().getRelease()); } BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); + List datasetIdsLoaded = new ArrayList<>(); - BulkLoadFileHistory history = new BulkLoadFileHistory(htpExpressionDatasetData.getData().size()); - createHistory(history, bulkLoadFile); - boolean result = runLoaddatasetid(externalDataBaseEntityService, history, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); + + bulkLoadFileHistory.setTotalRecords((long) htpExpressionDatasetData.getData().size()); + updateHistory(bulkLoadFileHistory); + + boolean result = runLoaddatasetid(externalDataBaseEntityService, bulkLoadFileHistory, dataProvider, htpExpressionDatasetData.getData(), datasetIdsLoaded, false); } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } @@ -79,6 +81,7 @@ private boolean runLoaddatasetid(ExternalDataBaseEntityService externalDataBaseE addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); } } + updateHistory(history); ph.finishProcess(); return true; } 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 827693c81..5765f4391 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 @@ -20,7 +20,6 @@ import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.jobs.util.SlackNotifier; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.IngestDTO; @@ -50,17 +49,6 @@ public class LoadFileExecutor { @Inject APIVersionInfoService apiVersionInfoService; @Inject SlackNotifier slackNotifier; - protected void createHistory(BulkLoadFileHistory history, BulkLoadFile bulkLoadFile) { - if (bulkLoadFile != null) { - history.setBulkLoadFile(bulkLoadFile); - } - bulkLoadFileHistoryDAO.persist(history); - if (bulkLoadFile != null) { - bulkLoadFile.getHistory().add(history); - bulkLoadFileDAO.merge(bulkLoadFile); - } - } - protected void updateHistory(BulkLoadFileHistory history) { bulkLoadFileHistoryDAO.merge(history); } @@ -108,39 +96,41 @@ private List getVersionParts(String version) { return intParts; } - protected boolean checkSchemaVersion(BulkLoadFile bulkLoadFile, Class dtoClass) { - if (bulkLoadFile.getLinkMLSchemaVersion() == null) { - bulkLoadFile.setErrorMessage("Missing Schema Version"); - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - slackNotifier.slackalert(bulkLoadFile); - bulkLoadFileDAO.merge(bulkLoadFile); + protected boolean checkSchemaVersion(BulkLoadFileHistory bulkLoadFileHistory, Class dtoClass) { + if (bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion() == null) { + bulkLoadFileHistory.setErrorMessage("Missing Schema Version"); + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + slackNotifier.slackalert(bulkLoadFileHistory); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); return false; } - if (!validSchemaVersion(bulkLoadFile.getLinkMLSchemaVersion(), dtoClass)) { - bulkLoadFile.setErrorMessage("Invalid Schema Version: " + bulkLoadFile.getLinkMLSchemaVersion()); - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - slackNotifier.slackalert(bulkLoadFile); - bulkLoadFileDAO.merge(bulkLoadFile); + if (!validSchemaVersion(bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion(), dtoClass)) { + bulkLoadFileHistory.setErrorMessage("Invalid Schema Version: " + bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion()); + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + slackNotifier.slackalert(bulkLoadFileHistory); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); return false; } return true; } - protected IngestDTO readIngestFile(BulkLoadFile bulkLoadFile, Class dtoClass) { + protected IngestDTO readIngestFile(BulkLoadFileHistory bulkLoadFileHistory, Class dtoClass) { try { - IngestDTO ingestDto = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), IngestDTO.class); - bulkLoadFile.setLinkMLSchemaVersion(getVersionNumber(ingestDto.getLinkMLVersion())); + IngestDTO ingestDto = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), IngestDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(getVersionNumber(ingestDto.getLinkMLVersion())); if (StringUtils.isNotBlank(ingestDto.getAllianceMemberReleaseVersion())) { - bulkLoadFile.setAllianceMemberReleaseVersion(ingestDto.getAllianceMemberReleaseVersion()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(ingestDto.getAllianceMemberReleaseVersion()); } - - if (!checkSchemaVersion(bulkLoadFile, dtoClass)) { + + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); + + if (!checkSchemaVersion(bulkLoadFileHistory, dtoClass)) { return null; } return ingestDto; } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } return null; @@ -214,7 +204,8 @@ protected boolean runLoad(BaseUpser loadMessage = loadMessage + " for " + dataProvider.name(); } ph.startProcess(loadMessage, objectList.size()); - + + updateHistory(history); for (T dtoObject : objectList) { try { E dbObject = service.upsert(dtoObject, dataProvider); @@ -234,23 +225,24 @@ protected boolean runLoad(BaseUpser if (terminateFailing && history.getErrorRate() > 0.25) { Log.error("Failure Rate > 25% aborting load"); finalSaveHistory(history); - failLoadAboveErrorRateCutoff(history.getBulkLoadFile()); + failLoadAboveErrorRateCutoff(history); return false; } - updateHistory(history); ph.progressProcess(); } + updateHistory(history); + ph.finishProcess(); } return true; } - protected > void runCleanup(S service, BulkLoadFileHistory history, String dataProviderName, List annotationIdsBefore, List annotationIdsAfter, String loadTypeString, String md5sum) { - runCleanup(service, history, dataProviderName, annotationIdsBefore, annotationIdsAfter, loadTypeString, md5sum, true); + protected > void runCleanup(S service, BulkLoadFileHistory history, String dataProviderName, List annotationIdsBefore, List annotationIdsAfter, String loadTypeString) { + runCleanup(service, history, dataProviderName, annotationIdsBefore, annotationIdsAfter, loadTypeString, true); } // The following methods are for bulk validation - protected > void runCleanup(S service, BulkLoadFileHistory history, String dataProviderName, List annotationIdsBefore, List annotationIdsAfter, String loadTypeString, String md5sum, Boolean deprecate) { + protected > void runCleanup(S service, 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()); @@ -260,26 +252,27 @@ protected boolean runLoad(BaseUpser Log.debug("runLoad: Remove: " + dataProviderName + " " + idsToRemove.size()); long existingDeletes = history.getTotalDeleteRecords() == null ? 0 : history.getTotalDeleteRecords(); - history.setTotalDeleteRecords((long) idsToRemove.size() + existingDeletes); + history.setTotalDeleteRecords(idsToRemove.size() + existingDeletes); ProcessDisplayHelper ph = new ProcessDisplayHelper(10000); ph.startProcess("Deletion/deprecation of entities linked to unloaded " + dataProviderName, idsToRemove.size()); + updateHistory(history); for (Long id : idsToRemove) { try { - String loadDescription = dataProviderName + " " + loadTypeString + " bulk load (" + md5sum + ")"; + String loadDescription = dataProviderName + " " + loadTypeString + " bulk load (" + history.getBulkLoadFile().getMd5Sum() + ")"; service.deprecateOrDelete(id, false, loadDescription, deprecate); history.incrementDeleted(); } catch (Exception e) { history.incrementDeleteFailed(); addException(history, new ObjectUpdateExceptionData("{ \"id\": " + id + "}", e.getMessage(), e.getStackTrace())); } - updateHistory(history); ph.progressProcess(); } + updateHistory(history); ph.finishProcess(); } - protected void failLoad(BulkLoadFile bulkLoadFile, Exception e) { + protected void failLoad(BulkLoadFileHistory bulkLoadFileHistory, Exception e) { Set errorMessages = new LinkedHashSet(); errorMessages.add(e.getMessage()); errorMessages.add(e.getLocalizedMessage()); @@ -288,16 +281,16 @@ protected void failLoad(BulkLoadFile bulkLoadFile, Exception e) { errorMessages.add(cause.getMessage()); cause = cause.getCause(); } - bulkLoadFile.setErrorMessage(String.join("|", errorMessages)); - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - slackNotifier.slackalert(bulkLoadFile); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.setErrorMessage(String.join("|", errorMessages)); + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + slackNotifier.slackalert(bulkLoadFileHistory); + updateHistory(bulkLoadFileHistory); } - protected void failLoadAboveErrorRateCutoff(BulkLoadFile bulkLoadFile) { - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - bulkLoadFile.setErrorMessage("Failure rate exceeded cutoff"); - slackNotifier.slackalert(bulkLoadFile); - bulkLoadFileDAO.merge(bulkLoadFile); + protected void failLoadAboveErrorRateCutoff(BulkLoadFileHistory bulkLoadFileHistory) { + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + bulkLoadFileHistory.setErrorMessage("Failure rate exceeded cutoff"); + slackNotifier.slackalert(bulkLoadFileHistory); + updateHistory(bulkLoadFileHistory); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/MoleculeExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/MoleculeExecutor.java index 8a8b58a52..9f8126459 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/MoleculeExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/MoleculeExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.Molecule; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.MoleculeIngestFmsDTO; import org.alliancegenome.curation_api.services.MoleculeService; @@ -19,24 +18,25 @@ public class MoleculeExecutor extends LoadFileExecutor { @Inject MoleculeService moleculeService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - MoleculeIngestFmsDTO moleculeData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), MoleculeIngestFmsDTO.class); - bulkLoadFile.setRecordCount(moleculeData.getData().size()); - if (bulkLoadFile.getLinkMLSchemaVersion() == null) { + MoleculeIngestFmsDTO moleculeData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), MoleculeIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(moleculeData.getData().size()); + if (bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion() == null) { AGRCurationSchemaVersion version = Molecule.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); } if (moleculeData.getMetaData() != null && StringUtils.isNotBlank(moleculeData.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(moleculeData.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(moleculeData.getMetaData().getRelease()); } - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(moleculeData.getData().size()); - createHistory(history, bulkLoadFile); - runLoad(moleculeService, history, null, moleculeData.getData(), null); - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.setTotalRecords((long) moleculeData.getData().size()); + updateHistory(bulkLoadFileHistory); + + runLoad(moleculeService, bulkLoadFileHistory, null, moleculeData.getData(), null); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { e.printStackTrace(); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java index cbd396d53..0956b296c 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OntologyExecutor.java @@ -1,14 +1,13 @@ package org.alliancegenome.curation_api.jobs.executors; import java.io.FileInputStream; -import java.time.OffsetDateTime; import java.util.Map; import java.util.Map.Entry; import java.util.zip.GZIPInputStream; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; import org.alliancegenome.curation_api.enums.OntologyBulkLoadType; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.ontology.OntologyTerm; import org.alliancegenome.curation_api.services.base.BaseOntologyTermService; import org.alliancegenome.curation_api.services.helpers.GenericOntologyLoadConfig; @@ -21,9 +20,9 @@ import org.alliancegenome.curation_api.services.ontology.CmoTermService; import org.alliancegenome.curation_api.services.ontology.DaoTermService; import org.alliancegenome.curation_api.services.ontology.DoTermService; -import org.alliancegenome.curation_api.services.ontology.FbcvTermService; import org.alliancegenome.curation_api.services.ontology.EcoTermService; import org.alliancegenome.curation_api.services.ontology.EmapaTermService; +import org.alliancegenome.curation_api.services.ontology.FbcvTermService; import org.alliancegenome.curation_api.services.ontology.FbdvTermService; import org.alliancegenome.curation_api.services.ontology.GenoTermService; import org.alliancegenome.curation_api.services.ontology.GoTermService; @@ -112,20 +111,19 @@ public class OntologyExecutor { @Inject BulkLoadFileDAO bulkLoadFileDAO; @Inject LoadProcessDisplayService loadProcessDisplayService; - public void execLoad(BulkLoadFile bulkLoadFile) throws Exception { - bulkLoadFile.setRecordCount(0); + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws Exception { GenericOntologyLoadConfig config = new GenericOntologyLoadConfig(); - OntologyBulkLoadType ontologyType = bulkLoadFile.getBulkLoad().getOntologyType(); + OntologyBulkLoadType ontologyType = bulkLoadFileHistory.getBulkLoad().getOntologyType(); switch (ontologyType) { case ZECO -> { config.setLoadOnlyIRIPrefix("ZECO"); - processTerms(bulkLoadFile, zecoTermService, config); + processTerms(bulkLoadFileHistory, zecoTermService, config); } case EMAPA -> { config.getAltNameSpaces().add("anatomical_structure"); - processTerms(bulkLoadFile, emapaTermService, config); + processTerms(bulkLoadFileHistory, emapaTermService, config); } case GO -> { config.setLoadOnlyIRIPrefix("GO"); // GO has to have both prefix and namespaces as obsolete terms do not show up in @@ -133,137 +131,137 @@ public void execLoad(BulkLoadFile bulkLoadFile) throws Exception { config.getAltNameSpaces().add("biological_process"); config.getAltNameSpaces().add("molecular_function"); config.getAltNameSpaces().add("cellular_component"); - processTerms(bulkLoadFile, goTermService, config); + processTerms(bulkLoadFileHistory, goTermService, config); } - case SO -> processTerms(bulkLoadFile, soTermService, config); - case XCO -> processTerms(bulkLoadFile, xcoTermService, config); + case SO -> processTerms(bulkLoadFileHistory, soTermService, config); + case XCO -> processTerms(bulkLoadFileHistory, xcoTermService, config); case ECO -> { - processTerms(bulkLoadFile, ecoTermService, config); + processTerms(bulkLoadFileHistory, ecoTermService, config); ecoTermService.updateAbbreviations(); } case CHEBI -> { config.setLoadOnlyIRIPrefix("CHEBI"); - processTerms(bulkLoadFile, chebiTermService, config); + processTerms(bulkLoadFileHistory, chebiTermService, config); } case ZFA -> { config.getAltNameSpaces().add("zebrafish_anatomy"); - processTerms(bulkLoadFile, zfaTermService, config); + processTerms(bulkLoadFileHistory, zfaTermService, config); } - case DO -> processTerms(bulkLoadFile, doTermService, config); + case DO -> processTerms(bulkLoadFileHistory, doTermService, config); case MP -> { config.setLoadOnlyIRIPrefix("MP"); - processTerms(bulkLoadFile, mpTermService, config); + processTerms(bulkLoadFileHistory, mpTermService, config); } case RO -> { config.setLoadObjectProperties(true); config.setLoadOnlyIRIPrefix("RO"); - processTerms(bulkLoadFile, roTermService, config); + processTerms(bulkLoadFileHistory, roTermService, config); } - case MA -> processTerms(bulkLoadFile, maTermService, config); - case WBBT -> processTerms(bulkLoadFile, wbbtTermService, config); + case MA -> processTerms(bulkLoadFileHistory, maTermService, config); + case WBBT -> processTerms(bulkLoadFileHistory, wbbtTermService, config); case DAO -> { config.setLoadOnlyIRIPrefix("FBbt"); - processTerms(bulkLoadFile, daoTermService, config); + processTerms(bulkLoadFileHistory, daoTermService, config); } - case WBLS -> processTerms(bulkLoadFile, wblsTermService, config); - case FBDV -> processTerms(bulkLoadFile, fbdvTermService, config); + case WBLS -> processTerms(bulkLoadFileHistory, wblsTermService, config); + case FBDV -> processTerms(bulkLoadFileHistory, fbdvTermService, config); case MMUSDV -> { config.getAltNameSpaces().add("mouse_developmental_stage"); config.getAltNameSpaces().add("mouse_stages_ontology"); - processTerms(bulkLoadFile, mmusdvTermService, config); + processTerms(bulkLoadFileHistory, mmusdvTermService, config); } - case ZFS -> processTerms(bulkLoadFile, zfsTermService, config); + case ZFS -> processTerms(bulkLoadFileHistory, zfsTermService, config); case XBA_XBS -> { config.getAltNameSpaces().add("xenopus_anatomy"); config.getAltNameSpaces().add("xenopus_anatomy_in_vitro"); - processTerms(bulkLoadFile, OntologyBulkLoadType.XBA, xbaTermService, config); + processTerms(bulkLoadFileHistory, OntologyBulkLoadType.XBA, xbaTermService, config); GenericOntologyLoadConfig config2 = new GenericOntologyLoadConfig(); config2.getAltNameSpaces().add("xenopus_developmental_stage"); - processTerms(bulkLoadFile, OntologyBulkLoadType.XBS, xbsTermService, config2); + processTerms(bulkLoadFileHistory, OntologyBulkLoadType.XBS, xbsTermService, config2); } case XPO -> { config.setLoadOnlyIRIPrefix("XPO"); - processTerms(bulkLoadFile, xpoTermService, config); + processTerms(bulkLoadFileHistory, xpoTermService, config); } case ATP -> { config.setLoadOnlyIRIPrefix("ATP"); - processTerms(bulkLoadFile, atpTermService, config); + processTerms(bulkLoadFileHistory, atpTermService, config); } - case XBED -> processTerms(bulkLoadFile, xbedTermService, config); - case VT -> processTerms(bulkLoadFile, vtTermService, config); - case XSMO -> processTerms(bulkLoadFile, xsmoTermService, config); + case XBED -> processTerms(bulkLoadFileHistory, xbedTermService, config); + case VT -> processTerms(bulkLoadFileHistory, vtTermService, config); + case XSMO -> processTerms(bulkLoadFileHistory, xsmoTermService, config); case OBI -> { config.setLoadOnlyIRIPrefix("OBI"); - processTerms(bulkLoadFile, obiTermService, config); + processTerms(bulkLoadFileHistory, obiTermService, config); } - case WBPheno -> processTerms(bulkLoadFile, wbPhenotypeTermService, config); - case PATO -> processTerms(bulkLoadFile, patoTermService, config); + case WBPheno -> processTerms(bulkLoadFileHistory, wbPhenotypeTermService, config); + case PATO -> processTerms(bulkLoadFileHistory, patoTermService, config); case HP -> { config.setLoadOnlyIRIPrefix("HP"); - processTerms(bulkLoadFile, hpTermService, config); + processTerms(bulkLoadFileHistory, hpTermService, config); } case FBCV -> { config.setLoadOnlyIRIPrefix("FBcv"); - processTerms(bulkLoadFile, fbcvTermService, config); + processTerms(bulkLoadFileHistory, fbcvTermService, config); } - case MMO -> processTerms(bulkLoadFile, mmoTermService, config); + case MMO -> processTerms(bulkLoadFileHistory, mmoTermService, config); case APO -> { config.getAltNameSpaces().add("experiment_type"); config.getAltNameSpaces().add("mutant_type"); config.getAltNameSpaces().add("observable"); config.getAltNameSpaces().add("qualifier"); - processTerms(bulkLoadFile, apoTermService, config); + processTerms(bulkLoadFileHistory, apoTermService, config); } - case MI -> processTerms(bulkLoadFile, miTermService, config); - case MPATH -> processTerms(bulkLoadFile, mpathTermService, config); - case MOD -> processTerms(bulkLoadFile, modTermService, config); + case MI -> processTerms(bulkLoadFileHistory, miTermService, config); + case MPATH -> processTerms(bulkLoadFileHistory, mpathTermService, config); + case MOD -> processTerms(bulkLoadFileHistory, modTermService, config); case UBERON -> { config.setLoadOnlyIRIPrefix("UBERON"); - processTerms(bulkLoadFile, uberonTermService, config); + processTerms(bulkLoadFileHistory, uberonTermService, config); } - case RS -> processTerms(bulkLoadFile, rsTermService, config); - case PW -> processTerms(bulkLoadFile, pwTermService, config); + case RS -> processTerms(bulkLoadFileHistory, rsTermService, config); + case PW -> processTerms(bulkLoadFileHistory, pwTermService, config); case CL -> { config.setLoadOnlyIRIPrefix("CL"); - processTerms(bulkLoadFile, clTermService, config); + processTerms(bulkLoadFileHistory, clTermService, config); } case CMO -> { config.setLoadOnlyIRIPrefix("CMO"); - processTerms(bulkLoadFile, cmoTermService, config); + processTerms(bulkLoadFileHistory, cmoTermService, config); } case BSPO -> { config.setLoadOnlyIRIPrefix("BSPO"); - processTerms(bulkLoadFile, bspoTermService, config); + processTerms(bulkLoadFileHistory, bspoTermService, config); } case GENO -> { config.setLoadOnlyIRIPrefix("GENO"); - processTerms(bulkLoadFile, genoTermService, config); + processTerms(bulkLoadFileHistory, genoTermService, config); } default -> { - log.info("Ontology Load: " + bulkLoadFile.getBulkLoad().getName() + " for OT: " + ontologyType + " not implemented"); - throw new Exception("Ontology Load: " + bulkLoadFile.getBulkLoad().getName() + " for OT: " + ontologyType + " not implemented"); + log.info("Ontology Load: " + bulkLoadFileHistory.getBulkLoad().getName() + " for OT: " + ontologyType + " not implemented"); + throw new Exception("Ontology Load: " + bulkLoadFileHistory.getBulkLoad().getName() + " for OT: " + ontologyType + " not implemented"); } } } - private void processTerms(BulkLoadFile bulkLoadFile, BaseOntologyTermService service, GenericOntologyLoadConfig config) throws Exception { - processTerms(bulkLoadFile, bulkLoadFile.getBulkLoad().getOntologyType(), service, config); + private void processTerms(BulkLoadFileHistory bulkLoadFileHistory, BaseOntologyTermService service, GenericOntologyLoadConfig config) throws Exception { + processTerms(bulkLoadFileHistory, bulkLoadFileHistory.getBulkLoad().getOntologyType(), service, config); } - private void processTerms(BulkLoadFile bulkLoadFile, OntologyBulkLoadType ontologyType, BaseOntologyTermService service, GenericOntologyLoadConfig config) throws Exception { + private void processTerms(BulkLoadFileHistory bulkLoadFileHistory, OntologyBulkLoadType ontologyType, BaseOntologyTermService service, GenericOntologyLoadConfig config) throws Exception { GenericOntologyLoadHelper loader = new GenericOntologyLoadHelper<>(ontologyType.getClazz(), config); - Map termMap = loader.load(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath()))); + Map termMap = loader.load(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()))); - bulkLoadFile.setRecordCount(bulkLoadFile.getRecordCount() + termMap.size()); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(bulkLoadFileHistory.getBulkLoadFile().getRecordCount() + termMap.size()); - bulkLoadFile.setDateLastLoaded(OffsetDateTime.now()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); + ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess(bulkLoadFile.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Terms", termMap.size()); + ph.startProcess(bulkLoadFileHistory.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Terms", termMap.size()); for (Entry entry : termMap.entrySet()) { service.processUpdate(entry.getValue()); ph.progressProcess(); @@ -272,7 +270,7 @@ private void processTerms(BulkLoadFile bulkLoadFile, OntologyBulkLoadType ontolo ProcessDisplayHelper ph1 = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph1.startProcess(bulkLoadFile.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Closure", termMap.size()); + ph1.startProcess(bulkLoadFileHistory.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Closure", termMap.size()); for (Entry entry : termMap.entrySet()) { service.processUpdateRelationships(entry.getValue()); // Thread.sleep(5000); @@ -282,7 +280,7 @@ private void processTerms(BulkLoadFile bulkLoadFile, OntologyBulkLoadType ontolo ProcessDisplayHelper ph2 = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph2.startProcess(bulkLoadFile.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Counts", termMap.size()); + ph2.startProcess(bulkLoadFileHistory.getBulkLoad().getName() + ": " + ontologyType.getClazz().getSimpleName() + " Counts", termMap.size()); for (Entry entry : termMap.entrySet()) { service.processCounts(entry.getValue()); // Thread.sleep(5000); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OrthologyExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OrthologyExecutor.java index bf36f066a..9066c010d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/OrthologyExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/OrthologyExecutor.java @@ -9,7 +9,6 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.orthology.GeneToGeneOrthologyGenerated; import org.alliancegenome.curation_api.model.ingest.dto.fms.OrthologyIngestFmsDTO; @@ -27,17 +26,17 @@ public class OrthologyExecutor extends LoadFileExecutor { @Inject GeneToGeneOrthologyGeneratedService generatedOrthologyService; @Inject GeneToGeneOrthologyGeneratedDAO generatedOrthologyDAO; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); - OrthologyIngestFmsDTO orthologyData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), OrthologyIngestFmsDTO.class); - bulkLoadFile.setRecordCount(orthologyData.getData().size()); + OrthologyIngestFmsDTO orthologyData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), OrthologyIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(orthologyData.getData().size()); AGRCurationSchemaVersion version = GeneToGeneOrthologyGenerated.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (orthologyData.getMetaData() != null && StringUtils.isNotBlank(orthologyData.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(orthologyData.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(orthologyData.getMetaData().getRelease()); } List orthoPairIdsLoaded = new ArrayList<>(); @@ -45,18 +44,19 @@ public void execLoad(BulkLoadFile bulkLoadFile) { List orthoPairIdsBefore = generatedOrthologyService.getAllOrthologyPairIdsBySubjectGeneDataProvider(dataProvider); log.debug("runLoad: Before: total " + orthoPairIdsBefore.size()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(orthologyData.getData().size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(generatedOrthologyService, history, dataProvider, orthologyData.getData(), orthoPairIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) orthologyData.getData().size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(generatedOrthologyService, bulkLoadFileHistory, dataProvider, orthologyData.getData(), orthoPairIdsLoaded); if (success) { - runCleanup(generatedOrthologyService, history, fms.getFmsDataSubType(), orthoPairIdsBefore, orthoPairIdsLoaded, fms.getFmsDataType(), bulkLoadFile.getMd5Sum(), false); + runCleanup(generatedOrthologyService, bulkLoadFileHistory, fms.getFmsDataSubType(), orthoPairIdsBefore, orthoPairIdsLoaded, fms.getFmsDataType(), false); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } 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 f2cbf69c6..a1daf443e 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 @@ -10,7 +10,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.GeneToGeneParalogy; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.ParalogyIngestFmsDTO; import org.alliancegenome.curation_api.services.GeneToGeneParalogyService; @@ -26,17 +25,17 @@ public class ParalogyExecutor extends LoadFileExecutor { @Inject GeneToGeneParalogyService geneToGeneParalogyService; @Inject GeneToGeneParalogyDAO geneToGeneParalogyDAO; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); - ParalogyIngestFmsDTO paralogyData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), ParalogyIngestFmsDTO.class); - bulkLoadFile.setRecordCount(paralogyData.getData().size()); + ParalogyIngestFmsDTO paralogyData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), ParalogyIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(paralogyData.getData().size()); AGRCurationSchemaVersion version = GeneToGeneParalogy.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (paralogyData.getMetaData() != null && StringUtils.isNotBlank(paralogyData.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(paralogyData.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(paralogyData.getMetaData().getRelease()); } List paralogyIdsLoaded = new ArrayList<>(); @@ -44,21 +43,22 @@ public void execLoad(BulkLoadFile bulkLoadFile) { List paralogyPairsBefore = geneToGeneParalogyService.getAllParalogyPairIdsBySubjectGeneDataProvider(dataProvider); Log.debug("runLoad: Before: total " + paralogyPairsBefore.size()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(paralogyData.getData().size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(geneToGeneParalogyService, history, dataProvider, paralogyData.getData(), paralogyIdsLoaded, false); + bulkLoadFileHistory.setTotalRecords((long) paralogyData.getData().size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(geneToGeneParalogyService, bulkLoadFileHistory, dataProvider, paralogyData.getData(), paralogyIdsLoaded, false); if (success) { - runCleanup(geneToGeneParalogyService, history, fms.getFmsDataSubType(), paralogyPairsBefore, paralogyIdsLoaded, fms.getFmsDataType(), bulkLoadFile.getMd5Sum(), false); + runCleanup(geneToGeneParalogyService, bulkLoadFileHistory, fms.getFmsDataSubType(), paralogyPairsBefore, paralogyIdsLoaded, fms.getFmsDataType(), false); } - history.finishLoad(); + bulkLoadFileHistory.finishLoad(); - finalSaveHistory(history); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/PhenotypeAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/PhenotypeAnnotationExecutor.java index 772f78a46..cb7847068 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/PhenotypeAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/PhenotypeAnnotationExecutor.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.Molecule; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.PhenotypeFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.PhenotypeIngestFmsDTO; @@ -32,35 +31,37 @@ public class PhenotypeAnnotationExecutor extends LoadFileExecutor { @Inject PhenotypeAnnotationService phenotypeAnnotationService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - PhenotypeIngestFmsDTO phenotypeData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), PhenotypeIngestFmsDTO.class); - bulkLoadFile.setRecordCount(phenotypeData.getData().size()); - if (bulkLoadFile.getLinkMLSchemaVersion() == null) { + PhenotypeIngestFmsDTO phenotypeData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), PhenotypeIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(phenotypeData.getData().size()); + if (bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion() == null) { AGRCurationSchemaVersion version = Molecule.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); } if (phenotypeData.getMetaData() != null && StringUtils.isNotBlank(phenotypeData.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(phenotypeData.getMetaData().getRelease()); + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(phenotypeData.getMetaData().getRelease()); } - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); + + bulkLoadFileHistory.setTotalRecords((long) phenotypeData.getData().size()); + updateHistory(bulkLoadFileHistory); - BulkLoadFileHistory history = new BulkLoadFileHistory(phenotypeData.getData().size()); - createHistory(history, bulkLoadFile); Set annotationIdsLoaded = new HashSet<>(); List annotationIdsBefore = phenotypeAnnotationService.getAnnotationIdsByDataProvider(dataProvider); - runLoad(history, phenotypeData.getData(), annotationIdsLoaded, dataProvider); + runLoad(bulkLoadFileHistory, phenotypeData.getData(), annotationIdsLoaded, dataProvider); - runCleanup(phenotypeAnnotationService, history, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded.stream().collect(Collectors.toList()), "phenotype annotation", bulkLoadFile.getMd5Sum()); + runCleanup(phenotypeAnnotationService, bulkLoadFileHistory, dataProvider.name(), annotationIdsBefore, annotationIdsLoaded.stream().collect(Collectors.toList()), "phenotype annotation"); - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } @@ -109,10 +110,10 @@ private void loadSecondaryAnnotations(BulkLoadFileHistory history, List annotations, Set idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { @@ -137,9 +138,10 @@ private void loadPrimaryAnnotations(BulkLoadFileHistory history, List dtos = mapper.readValue(new GZIPInputStream(new FileInputStream(rdFile)), listType); List rdNamesBefore = resourceDescriptorService.getAllNames(); List rdNamesAfter = new ArrayList<>(); - BulkLoadFileHistory history = new BulkLoadFileHistory(dtos.size()); - createHistory(history, bulkLoadFile); - - dtos.forEach(dto -> { + + bulkLoadFileHistory.setTotalRecords((long) dtos.size()); + + updateHistory(bulkLoadFileHistory); + for (ResourceDescriptorDTO dto : dtos) { try { ResourceDescriptor rd = resourceDescriptorService.upsert(dto); - history.incrementCompleted(); - updateHistory(history); + bulkLoadFileHistory.incrementCompleted(); rdNamesAfter.add(rd.getName()); } catch (ObjectUpdateException e) { - addException(history, e.getData()); + bulkLoadFileHistory.incrementFailed(); + addException(bulkLoadFileHistory, e.getData()); } catch (Exception e) { - addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + bulkLoadFileHistory.incrementFailed(); + addException(bulkLoadFileHistory, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); } - }); - history.finishLoad(); - finalSaveHistory(history); + } + updateHistory(bulkLoadFileHistory); + + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); resourceDescriptorService.removeNonUpdatedResourceDescriptors(rdNamesBefore, rdNamesAfter); log.info("Loading ResourceDescriptorFileFinished"); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java index fc16b5cab..14fda2aee 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/SequenceTargetingReagentExecutor.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentIngestFmsDTO; @@ -34,24 +33,20 @@ public class SequenceTargetingReagentExecutor extends LoadFileExecutor { @Inject SequenceTargetingReagentGeneAssociationService sqtrGeneAssociationService; - public void execLoad(BulkLoadFile bulkLoadFile) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { - BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFile.getBulkLoad(); + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); - SequenceTargetingReagentIngestFmsDTO sqtrIngestFmsDTO = mapper.readValue( - new GZIPInputStream(new FileInputStream(bulkLoadFile.getLocalFilePath())), - SequenceTargetingReagentIngestFmsDTO.class); - bulkLoadFile.setRecordCount(sqtrIngestFmsDTO.getData().size()); + SequenceTargetingReagentIngestFmsDTO sqtrIngestFmsDTO = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), SequenceTargetingReagentIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(sqtrIngestFmsDTO.getData().size()); - AGRCurationSchemaVersion version = SequenceTargetingReagent.class - .getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFile.setLinkMLSchemaVersion(version.max()); + AGRCurationSchemaVersion version = SequenceTargetingReagent.class.getAnnotation(AGRCurationSchemaVersion.class); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); - if (sqtrIngestFmsDTO.getMetaData() != null - && StringUtils.isNotBlank(sqtrIngestFmsDTO.getMetaData().getRelease())) { - bulkLoadFile.setAllianceMemberReleaseVersion(sqtrIngestFmsDTO.getMetaData().getRelease()); + if (sqtrIngestFmsDTO.getMetaData() != null && StringUtils.isNotBlank(sqtrIngestFmsDTO.getMetaData().getRelease())) { + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(sqtrIngestFmsDTO.getMetaData().getRelease()); } BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); @@ -62,20 +57,21 @@ public void execLoad(BulkLoadFile bulkLoadFile) { Map> previousIds = getPreviouslyLoadedIds(dataProvider); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(sqtrIngestFmsDTO.getData().size() * 2); + bulkLoadFileHistory.setTotalRecords((long) sqtrIngestFmsDTO.getData().size() * 2); + updateHistory(bulkLoadFileHistory); + + runLoad(bulkLoadFileHistory, dataProvider, sqtrIngestFmsDTO.getData(), idsAdded.get("SQTR"), idsAdded.get("SQTRGeneAssociation")); - runLoad(history, dataProvider, sqtrIngestFmsDTO.getData(), idsAdded.get("SQTR"), idsAdded.get("SQTRGeneAssociation")); + runCleanup(sqtrService, bulkLoadFileHistory, dataProvider.name(), previousIds.get("SQTR"), idsAdded.get("SQTR"), "SQTR"); + runCleanup(sqtrService, bulkLoadFileHistory, dataProvider.name(), previousIds.get("SQTRGeneAssociation"), idsAdded.get("SQTRGeneAssociation"), "SQTR Gene Associations"); - runCleanup(sqtrService, history, dataProvider.name(), previousIds.get("SQTR"), idsAdded.get("SQTR"), "SQTR", bulkLoadFile.getMd5Sum()); - runCleanup(sqtrService, history, dataProvider.name(), previousIds.get("SQTRGeneAssociation"), idsAdded.get("SQTRGeneAssociation"), "SQTR Gene Associations", bulkLoadFile.getMd5Sum()); + bulkLoadFileHistory.finishLoad(); - history.finishLoad(); - - updateHistory(history); + finalSaveHistory(bulkLoadFileHistory); } catch (Exception e) { - failLoad(bulkLoadFile, e); + failLoad(bulkLoadFileHistory, e); e.printStackTrace(); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantExecutor.java index f6da35942..c3cfc31ab 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantExecutor.java @@ -5,7 +5,6 @@ import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.IngestDTO; @@ -22,12 +21,12 @@ public class VariantExecutor extends LoadFileExecutor { @Inject VariantDAO variantDAO; @Inject VariantService variantService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); Log.info("Running with: " + manual.getDataProvider().name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, VariantDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, VariantDTO.class); if (ingestDto == null) { return; } @@ -46,17 +45,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { Log.debug("runLoad: Before: total " + variantIdsBefore.size()); } - bulkLoadFile.setRecordCount(variants.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(variants.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(variants.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(variantService, history, dataProvider, variants, variantIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) variants.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(variantService, bulkLoadFileHistory, dataProvider, variants, variantIdsLoaded); if (success && cleanUp) { - runCleanup(variantService, history, dataProvider.name(), variantIdsBefore, variantIdsLoaded, "variant", bulkLoadFile.getMd5Sum()); + runCleanup(variantService, bulkLoadFileHistory, dataProvider.name(), variantIdsBefore, variantIdsLoaded, "variant"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/alleleAssociations/AlleleGeneAssociationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/alleleAssociations/AlleleGeneAssociationExecutor.java index 627597ad9..827e61c82 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/alleleAssociations/AlleleGeneAssociationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/associations/alleleAssociations/AlleleGeneAssociationExecutor.java @@ -6,7 +6,6 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.jobs.executors.LoadFileExecutor; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.IngestDTO; @@ -23,13 +22,13 @@ public class AlleleGeneAssociationExecutor extends LoadFileExecutor { @Inject AlleleGeneAssociationService alleleGeneAssociationService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider: " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, AlleleGeneAssociationDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, AlleleGeneAssociationDTO.class); if (ingestDto == null) { return; } @@ -46,17 +45,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { associationIdsBefore.removeIf(Objects::isNull); } - bulkLoadFile.setRecordCount(associations.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(associations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(associations.size()); - createHistory(history, bulkLoadFile); - boolean success = runLoad(alleleGeneAssociationService, history, dataProvider, associations, associationIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) associations.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(alleleGeneAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded); if (success && cleanUp) { - runCleanup(alleleGeneAssociationService, history, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "allele gene association", bulkLoadFile.getMd5Sum()); + runCleanup(alleleGeneAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "allele gene association"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } 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 6e9f0a485..4949ea763 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 @@ -7,7 +7,6 @@ import org.alliancegenome.curation_api.dao.associations.constructAssociations.ConstructGenomicEntityAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.jobs.executors.LoadFileExecutor; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; import org.alliancegenome.curation_api.model.ingest.dto.IngestDTO; @@ -25,13 +24,13 @@ public class ConstructGenomicEntityAssociationExecutor extends LoadFileExecutor @Inject ConstructGenomicEntityAssociationDAO constructGenomicEntityAssociationDAO; @Inject ConstructGenomicEntityAssociationService constructGenomicEntityAssociationService; - public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) { - BulkManualLoad manual = (BulkManualLoad) bulkLoadFile.getBulkLoad(); + BulkManualLoad manual = (BulkManualLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = manual.getDataProvider(); log.info("Running with dataProvider: " + dataProvider.name()); - IngestDTO ingestDto = readIngestFile(bulkLoadFile, ConstructGenomicEntityAssociationDTO.class); + IngestDTO ingestDto = readIngestFile(bulkLoadFileHistory, ConstructGenomicEntityAssociationDTO.class); if (ingestDto == null) { return; } @@ -48,17 +47,18 @@ public void execLoad(BulkLoadFile bulkLoadFile, Boolean cleanUp) { associationIdsBefore.removeIf(Objects::isNull); } - bulkLoadFile.setRecordCount(associations.size() + bulkLoadFile.getRecordCount()); - bulkLoadFileDAO.merge(bulkLoadFile); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(associations.size() + bulkLoadFileHistory.getBulkLoadFile().getRecordCount()); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - BulkLoadFileHistory history = new BulkLoadFileHistory(associations.size()); - createHistory(history, bulkLoadFile); - runLoad(constructGenomicEntityAssociationService, history, dataProvider, associations, associationIdsLoaded); + bulkLoadFileHistory.setTotalRecords((long) associations.size()); + updateHistory(bulkLoadFileHistory); + + runLoad(constructGenomicEntityAssociationService, bulkLoadFileHistory, dataProvider, associations, associationIdsLoaded); if (cleanUp) { - runCleanup(constructGenomicEntityAssociationService, history, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "construct genomic entity association", bulkLoadFile.getMd5Sum()); + runCleanup(constructGenomicEntityAssociationService, bulkLoadFileHistory, dataProvider.name(), associationIdsBefore, associationIdsLoaded, "construct genomic entity association"); } - history.finishLoad(); - finalSaveHistory(history); + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); } } 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 d67a683b7..7319f919c 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 @@ -1,20 +1,22 @@ package org.alliancegenome.curation_api.jobs.processors; import java.io.File; -import java.time.OffsetDateTime; +import java.time.LocalDateTime; import org.alliancegenome.curation_api.dao.loads.BulkFMSLoadDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; +import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.dao.loads.BulkManualLoadDAO; import org.alliancegenome.curation_api.dao.loads.BulkURLLoadDAO; import org.alliancegenome.curation_api.enums.BulkLoadCleanUp; import org.alliancegenome.curation_api.enums.JobStatus; -import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadFileJobEvent; +import org.alliancegenome.curation_api.jobs.events.PendingLoadJobEvent; import org.alliancegenome.curation_api.jobs.executors.BulkLoadJobExecutor; import org.alliancegenome.curation_api.jobs.util.SlackNotifier; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.fms.DataFileService; import org.alliancegenome.curation_api.util.FileTransferHelper; @@ -34,8 +36,11 @@ public class BulkLoadProcessor { @Inject DataFileService fmsDataFileService; @Inject BulkLoadDAO bulkLoadDAO; - @Inject BulkManualLoadDAO bulkManualLoadDAO; @Inject BulkLoadFileDAO bulkLoadFileDAO; + @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; + + + @Inject BulkManualLoadDAO bulkManualLoadDAO; @Inject BulkFMSLoadDAO bulkFMSLoadDAO; @Inject BulkURLLoadDAO bulkURLLoadDAO; @@ -43,7 +48,7 @@ public class BulkLoadProcessor { @Inject SlackNotifier slackNotifier; - @Inject Event pendingFileJobEvents; + @Inject Event pendingFileJobEvents; protected FileTransferHelper fileHelper = new FileTransferHelper(); @@ -60,36 +65,43 @@ public class BulkLoadProcessor { // return null; // } - public void syncWithS3(BulkLoadFile bulkLoadFile) { + public void syncWithS3(BulkLoadFileHistory bulkLoadFileHistory) { + BulkLoad bulkLoad = bulkLoadFileHistory.getBulkLoad(); + BulkLoadFile bulkLoadFile = bulkLoadFileHistory.getBulkLoadFile(); Log.info("Syncing with S3"); Log.info("Local: " + bulkLoadFile.getLocalFilePath()); Log.info("S3: " + bulkLoadFile.getS3Path()); - if ((bulkLoadFile.getS3Path() != null || bulkLoadFile.generateS3MD5Path() != null) && bulkLoadFile.getLocalFilePath() == null) { + if ((bulkLoadFile.getS3Path() != null || bulkLoadFile.generateS3MD5Path(bulkLoad) != null) && bulkLoadFile.getLocalFilePath() == null) { File outfile = fileHelper.downloadFileFromS3(s3AccessKey, s3SecretKey, s3Bucket, bulkLoadFile.getS3Path()); if (outfile != null) { // log.info(outfile + " is of size: " + outfile.length()); bulkLoadFile.setFileSize(outfile.length()); bulkLoadFile.setLocalFilePath(outfile.getAbsolutePath()); + bulkLoadFileDAO.merge(bulkLoadFile); } else { // log.error("Failed to download file from S3 Path: " + s3PathPrefix + "/" + // bulkLoadFile.generateS3MD5Path()); - bulkLoadFile.setErrorMessage("Failed to download file from S3 Path: " + s3PathPrefix + "/" + bulkLoadFile.generateS3MD5Path()); - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - slackNotifier.slackalert(bulkLoadFile); + bulkLoadFileHistory.setErrorMessage("Failed to download file from S3 Path: " + s3PathPrefix + "/" + bulkLoadFile.generateS3MD5Path(bulkLoad)); + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + slackNotifier.slackalert(bulkLoadFileHistory); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); } // log.info("Saving File: " + bulkLoadFile); - bulkLoadFileDAO.merge(bulkLoadFile); + } else if (bulkLoadFile.getS3Path() == null && bulkLoadFile.getLocalFilePath() != null) { if (s3AccessKey != null && s3AccessKey.length() > 0) { - String s3Path = fileHelper.uploadFileToS3(s3AccessKey, s3SecretKey, s3Bucket, s3PathPrefix, bulkLoadFile.generateS3MD5Path(), new File(bulkLoadFile.getLocalFilePath())); + String s3Path = fileHelper.uploadFileToS3(s3AccessKey, s3SecretKey, s3Bucket, s3PathPrefix, bulkLoadFile.generateS3MD5Path(bulkLoad), new File(bulkLoadFile.getLocalFilePath())); bulkLoadFile.setS3Path(s3Path); } bulkLoadFileDAO.merge(bulkLoadFile); } else if (bulkLoadFile.getS3Path() == null && bulkLoadFile.getLocalFilePath() == null) { - bulkLoadFile.setErrorMessage("Failed to download or upload file with S3 Path: " + s3PathPrefix + "/" + bulkLoadFile.generateS3MD5Path() + " Local and remote file missing"); - bulkLoadFile.setBulkloadStatus(JobStatus.FAILED); - slackNotifier.slackalert(bulkLoadFile); + bulkLoadFileHistory.setErrorMessage("Failed to download or upload file with S3 Path: " + s3PathPrefix + "/" + bulkLoadFile.generateS3MD5Path(bulkLoad) + " Local and remote file missing"); + bulkLoadFileHistory.setBulkloadStatus(JobStatus.FAILED); + slackNotifier.slackalert(bulkLoadFileHistory); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); + } else { + Log.info("No S3 syncing required"); } Log.info("Syncing with S3 Finished"); } @@ -108,21 +120,23 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean SearchResponse bulkLoadFiles = bulkLoadFileDAO.findByField("md5Sum", md5Sum); BulkLoadFile bulkLoadFile; + + BulkLoadFileHistory history = new BulkLoadFileHistory(); if (bulkLoadFiles == null || bulkLoadFiles.getResults().size() == 0) { Log.info("Bulk File does not exist creating it"); bulkLoadFile = new BulkLoadFile(); - bulkLoadFile.setBulkLoad(load); bulkLoadFile.setMd5Sum(md5Sum); bulkLoadFile.setFileSize(inputFile.length()); + if (load.getBulkloadStatus() == JobStatus.FORCED_RUNNING) { - bulkLoadFile.setBulkloadStatus(JobStatus.FORCED_PENDING); + history.setBulkloadStatus(JobStatus.FORCED_PENDING); } if (load.getBulkloadStatus() == JobStatus.SCHEDULED_RUNNING) { - bulkLoadFile.setBulkloadStatus(JobStatus.SCHEDULED_PENDING); + history.setBulkloadStatus(JobStatus.SCHEDULED_PENDING); } if (load.getBulkloadStatus() == JobStatus.MANUAL_RUNNING) { - bulkLoadFile.setBulkloadStatus(JobStatus.MANUAL_PENDING); + history.setBulkloadStatus(JobStatus.MANUAL_PENDING); } Log.info(load.getBulkloadStatus()); @@ -134,10 +148,10 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean bulkLoadFileDAO.persist(bulkLoadFile); } else if (load.getBulkloadStatus().isForced()) { bulkLoadFile = bulkLoadFiles.getResults().get(0); - if (bulkLoadFile.getBulkloadStatus().isNotRunning()) { + if (history.getBulkloadStatus().isNotRunning()) { bulkLoadFile.setLocalFilePath(localFilePath); - bulkLoadFile.setErrorMessage(null); - bulkLoadFile.setBulkloadStatus(JobStatus.FORCED_PENDING); + history.setErrorMessage(null); + history.setBulkloadStatus(JobStatus.FORCED_PENDING); } else { Log.warn("Bulk File is already running: " + bulkLoadFile.getMd5Sum()); Log.info("Cleaning up downloaded file: " + localFilePath); @@ -150,17 +164,18 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean new File(localFilePath).delete(); bulkLoadFile.setLocalFilePath(null); } + + history.setBulkLoad(bulkLoad); + history.setBulkLoadFile(bulkLoadFile); + bulkLoadFileHistoryDAO.persist(history); - if (!load.getLoadFiles().contains(bulkLoadFile)) { - load.getLoadFiles().add(bulkLoadFile); - } if (cleanUp) { bulkLoadFile.setBulkloadCleanUp(BulkLoadCleanUp.YES); } bulkLoadFileDAO.merge(bulkLoadFile); bulkLoadDAO.merge(load); - Log.info("Firing Pending Bulk File Event: " + bulkLoadFile.getId()); - pendingFileJobEvents.fire(new PendingBulkLoadFileJobEvent(bulkLoadFile.getId())); + Log.info("Firing Pending Bulk File History Event: " + history.getId()); + pendingFileJobEvents.fire(new PendingLoadJobEvent(history.getId())); } protected void startLoad(BulkLoad load) { @@ -187,26 +202,27 @@ protected void endLoad(BulkLoad load, String message, JobStatus status) { Log.info("Load: " + bulkLoad.getName() + " is finished"); } - protected void startLoadFile(BulkLoadFile bulkLoadFile) { - bulkLoadFile.setBulkloadStatus(bulkLoadFile.getBulkloadStatus().getNextStatus()); - bulkLoadFileDAO.merge(bulkLoadFile); - Log.info("Load File: " + bulkLoadFile.getMd5Sum() + " is running with file: " + bulkLoadFile.getLocalFilePath()); + protected void startLoad(BulkLoadFileHistory bulkLoadFileHistory) { + bulkLoadFileHistory.setBulkloadStatus(bulkLoadFileHistory.getBulkloadStatus().getNextStatus()); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); + Log.info("Load File: " + bulkLoadFileHistory.getBulkLoadFile().getMd5Sum() + " is running with file: " + bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()); } - protected void endLoadFile(BulkLoadFile bulkLoadFile, String message, JobStatus status) { - if (bulkLoadFile.getLocalFilePath() != null) { - Log.info("Removing old input file: " + bulkLoadFile.getLocalFilePath()); - new File(bulkLoadFile.getLocalFilePath()).delete(); - bulkLoadFile.setLocalFilePath(null); + protected void endLoad(BulkLoadFileHistory bulkLoadFileHistory, String message, JobStatus status) { + if (bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath() != null) { + Log.info("Removing old input file: " + bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()); + new File(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()).delete(); + bulkLoadFileHistory.getBulkLoadFile().setLocalFilePath(null); + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); } - bulkLoadFile.setErrorMessage(message); - bulkLoadFile.setBulkloadStatus(status); - bulkLoadFile.setDateLastLoaded(OffsetDateTime.now()); + bulkLoadFileHistory.setErrorMessage(message); + bulkLoadFileHistory.setBulkloadStatus(status); + bulkLoadFileHistory.setLoadFinished(LocalDateTime.now()); if (status != JobStatus.FINISHED) { - slackNotifier.slackalert(bulkLoadFile); + slackNotifier.slackalert(bulkLoadFileHistory); } - bulkLoadFileDAO.merge(bulkLoadFile); - Log.info("Load File: " + bulkLoadFile.getMd5Sum() + " is finished. Message: " + message + " Status: " + status); + bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); + Log.info("Load File: " + bulkLoadFileHistory.getBulkLoadFile().getMd5Sum() + " is finished. Message: " + message + " Status: " + status); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java index 62b163f9b..3eb00466b 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java @@ -1,10 +1,10 @@ package org.alliancegenome.curation_api.jobs.processors; -import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; +import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.enums.BulkLoadCleanUp; import org.alliancegenome.curation_api.enums.JobStatus; -import org.alliancegenome.curation_api.jobs.events.StartedBulkLoadFileJobEvent; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.jobs.events.StartedLoadJobEvent; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; @@ -14,31 +14,30 @@ @ApplicationScoped public class StartLoadProcessor extends BulkLoadProcessor { - @Inject BulkLoadFileDAO bulkLoadFileDAO; + @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; - public void bulkLoadFile(@Observes StartedBulkLoadFileJobEvent event) { // An @Observes method should not be in a super class as then it gets run for - // every child class - BulkLoadFile bulkLoadFile = bulkLoadFileDAO.find(event.getId()); - if (!bulkLoadFile.getBulkloadStatus().isStarted()) { - Log.warn("bulkLoadFile: Job is not started returning: " + bulkLoadFile.getBulkloadStatus()); + public void bulkLoadFile(@Observes StartedLoadJobEvent event) { // An @Observes method should not be in a super class as then it gets run for + // every child class + BulkLoadFileHistory bulkLoadFileHistory = bulkLoadFileHistoryDAO.find(event.getId()); + + if (!bulkLoadFileHistory.getBulkloadStatus().isStarted()) { + Log.warn("bulkLoadFileHistory: Job is not started returning: " + bulkLoadFileHistory.getBulkloadStatus()); // endLoad(bulkLoadFile, "Finished ended due to status: " + // bulkLoadFile.getBulkloadStatus(), bulkLoadFile.getBulkloadStatus()); return; } else { - startLoadFile(bulkLoadFile); + startLoad(bulkLoadFileHistory); } try { - if (bulkLoadFile.getLocalFilePath() == null || bulkLoadFile.getS3Path() == null) { - syncWithS3(bulkLoadFile); - } - bulkLoadJobExecutor.process(bulkLoadFile, bulkLoadFile.getBulkloadCleanUp() == BulkLoadCleanUp.YES); - JobStatus status = bulkLoadFile.getBulkloadStatus().equals(JobStatus.FAILED) ? JobStatus.FAILED : JobStatus.FINISHED; - endLoadFile(bulkLoadFile, bulkLoadFile.getErrorMessage(), status); + syncWithS3(bulkLoadFileHistory); + bulkLoadJobExecutor.process(bulkLoadFileHistory, bulkLoadFileHistory.getBulkLoadFile().getBulkloadCleanUp() == BulkLoadCleanUp.YES); + JobStatus status = bulkLoadFileHistory.getBulkloadStatus().equals(JobStatus.FAILED) ? JobStatus.FAILED : JobStatus.FINISHED; + endLoad(bulkLoadFileHistory, bulkLoadFileHistory.getErrorMessage(), status); } catch (Exception e) { - endLoadFile(bulkLoadFile, "Failed loading: " + bulkLoadFile.getBulkLoad().getName() + " please check the logs for more info. " + bulkLoadFile.getErrorMessage(), JobStatus.FAILED); - Log.error("Load File: " + bulkLoadFile.getBulkLoad().getName() + " is failed"); + endLoad(bulkLoadFileHistory, "Failed loading: " + bulkLoadFileHistory.getBulkLoad().getName() + " please check the logs for more info. " + bulkLoadFileHistory.getErrorMessage(), JobStatus.FAILED); + Log.error("Load File: " + bulkLoadFileHistory.getBulkLoad().getName() + " is failed"); e.printStackTrace(); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/util/SlackNotifier.java b/src/main/java/org/alliancegenome/curation_api/jobs/util/SlackNotifier.java index fd8cbeb32..1a2099773 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/util/SlackNotifier.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/util/SlackNotifier.java @@ -7,7 +7,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkLoadType; import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.eclipse.microprofile.config.inject.ConfigProperty; import com.slack.api.Slack; @@ -84,24 +84,24 @@ public void slackalert(BulkLoad bulkLoad) { } } - public void slackalert(BulkLoadFile bulkLoadFile) { + public void slackalert(BulkLoadFileHistory bulkLoadFileHistory) { - if (bulkLoadFile.getBulkloadStatus() == JobStatus.FAILED) { + if (bulkLoadFileHistory.getBulkloadStatus() == JobStatus.FAILED) { List fields = new ArrayList<>(); - fields.add(new Field("Load Type", String.valueOf(bulkLoadFile.getBulkLoad().getBackendBulkLoadType()), true)); - if (bulkLoadFile.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ONTOLOGY) { - fields.add(new Field("Ontology Type", String.valueOf(bulkLoadFile.getBulkLoad().getOntologyType()), true)); + fields.add(new Field("Load Type", String.valueOf(bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType()), true)); + if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.ONTOLOGY) { + fields.add(new Field("Ontology Type", String.valueOf(bulkLoadFileHistory.getBulkLoad().getOntologyType()), true)); } - fields.add(new Field("MD5Sum", bulkLoadFile.getMd5Sum(), true)); - fields.add(new Field("File Size", String.valueOf(bulkLoadFile.getFileSize()), true)); - if (bulkLoadFile.getLinkMLSchemaVersion() != null) { - fields.add(new Field("LinkML Version", bulkLoadFile.getLinkMLSchemaVersion(), true)); + fields.add(new Field("MD5Sum", bulkLoadFileHistory.getBulkLoadFile().getMd5Sum(), true)); + fields.add(new Field("File Size", String.valueOf(bulkLoadFileHistory.getBulkLoadFile().getFileSize()), true)); + if (bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion() != null) { + fields.add(new Field("LinkML Version", bulkLoadFileHistory.getBulkLoadFile().getLinkMLSchemaVersion(), true)); } - if (bulkLoadFile.getAllianceMemberReleaseVersion() != null) { - fields.add(new Field("Alliance Member Release Version", bulkLoadFile.getAllianceMemberReleaseVersion(), false)); + if (bulkLoadFileHistory.getBulkLoadFile().getAllianceMemberReleaseVersion() != null) { + fields.add(new Field("Alliance Member Release Version", bulkLoadFileHistory.getBulkLoadFile().getAllianceMemberReleaseVersion(), false)); } - slackalert(bulkLoadFile.getBulkLoad().getGroup().getName(), bulkLoadFile.getBulkLoad().getName(), bulkLoadFile.getErrorMessage(), fields); + slackalert(bulkLoadFileHistory.getBulkLoad().getGroup().getName(), bulkLoadFileHistory.getBulkLoad().getName(), bulkLoadFileHistory.getErrorMessage(), fields); } } } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java index 6e437f466..de61c14cc 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java @@ -71,10 +71,16 @@ public abstract class BulkLoad extends AuditedObject { @ManyToOne private BulkLoadGroup group; - + @JsonView({ View.FieldsOnly.class }) - @OneToMany(mappedBy = "bulkLoad", fetch = FetchType.EAGER) - @OrderBy("dateUpdated DESC") - private List loadFiles; + @OneToMany(mappedBy = "bulkLoadFile", fetch = FetchType.EAGER) + @OrderBy("loadFinished DESC") + private List history; + +// @JsonView({ View.FieldsOnly.class }) +// @OneToMany(mappedBy = "bulkLoad", fetch = FetchType.EAGER) +// @OrderBy("dateUpdated DESC") +// private List loadFiles; + } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java index 49a4d5551..b969a6697 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java @@ -1,21 +1,12 @@ package org.alliancegenome.curation_api.model.entities.bulkloads; -import java.time.OffsetDateTime; import java.util.List; import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.enums.BulkLoadCleanUp; -import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; -import org.alliancegenome.curation_api.model.bridges.OffsetDateTimeValueBridge; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; 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.bridge.mapping.annotation.ValueBridgeRef; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.FullTextField; -import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonView; @@ -24,11 +15,8 @@ import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; -import jakarta.persistence.FetchType; import jakarta.persistence.Index; -import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; -import jakarta.persistence.OrderBy; import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; @@ -38,7 +26,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = { "bulkLoad" }) +@ToString(exclude = { "history" }) @AGRCurationSchemaVersion(min = "1.3.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table( indexes = { @@ -50,15 +38,6 @@ ) public class BulkLoadFile extends AuditedObject { - @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer", valueBridge = @ValueBridgeRef(type = OffsetDateTimeValueBridge.class)) - @KeywordField(name = "dateLastLoaded_keyword", sortable = Sortable.YES, searchable = Searchable.YES, aggregable = Aggregable.YES, valueBridge = @ValueBridgeRef(type = OffsetDateTimeValueBridge.class)) - @JsonView(View.FieldsOnly.class) - private OffsetDateTime dateLastLoaded; - - @JsonView({ View.FieldsOnly.class }) - @Enumerated(EnumType.STRING) - private JobStatus bulkloadStatus; - @JsonView({ View.FieldsOnly.class }) @Enumerated(EnumType.STRING) private BulkLoadCleanUp bulkloadCleanUp; @@ -79,22 +58,14 @@ public class BulkLoadFile extends AuditedObject { @JsonView({ View.FieldsOnly.class }) private Integer recordCount; - @JsonView({ View.FieldsOnly.class }) - @Column(columnDefinition = "TEXT") - private String errorMessage; - @JsonView({ View.FieldsOnly.class }) private String linkMLSchemaVersion; @JsonView({ View.FieldsOnly.class }) private String allianceMemberReleaseVersion; - @ManyToOne - private BulkLoad bulkLoad; - @JsonView({ View.FieldsOnly.class }) - @OneToMany(mappedBy = "bulkLoadFile", fetch = FetchType.EAGER) - @OrderBy("loadFinished DESC") + @OneToMany(mappedBy = "bulkLoad") private List history; @Transient @@ -106,7 +77,7 @@ public String getS3Url() { @Transient @JsonIgnore @JsonView({ View.FieldsOnly.class }) - public String generateS3MD5Path() { + public String generateS3MD5Path(BulkLoad bulkLoad) { if (md5Sum != null && md5Sum.length() > 0) { return md5Sum.charAt(0) + "/" + md5Sum.charAt(1) + "/" + md5Sum.charAt(2) + "/" + md5Sum.charAt(3) + "/" + md5Sum + "." + bulkLoad.getBackendBulkLoadType().fileExtension + ".gz"; } else { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java index 187386aa0..05de25735 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java @@ -5,6 +5,7 @@ import java.util.List; import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.view.View; @@ -13,7 +14,10 @@ import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.Column; import jakarta.persistence.Entity; +import jakarta.persistence.EnumType; +import jakarta.persistence.Enumerated; import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; @@ -42,11 +46,11 @@ public class BulkLoadFileHistory extends AuditedObject { @JsonView({ View.FieldsOnly.class }) - private LocalDateTime loadStarted; + private LocalDateTime loadStarted = LocalDateTime.now(); @JsonView({ View.FieldsOnly.class }) private LocalDateTime loadFinished; - + @JsonView({ View.FieldsOnly.class }) private Long totalRecords = 0L; @@ -68,9 +72,20 @@ public class BulkLoadFileHistory extends AuditedObject { @JsonView({ View.FieldsOnly.class }) private Double errorRate = 0.0; + @JsonView({ View.FieldsOnly.class }) + @Enumerated(EnumType.STRING) + private JobStatus bulkloadStatus; + + @JsonView({ View.FieldsOnly.class }) + @Column(columnDefinition = "TEXT") + private String errorMessage; + @ManyToOne @OnDelete(action = OnDeleteAction.CASCADE) private BulkLoadFile bulkLoadFile; + + @ManyToOne + private BulkLoad bulkLoad; @OneToMany(mappedBy = "bulkLoadFileHistory") @JsonView(View.BulkLoadFileHistoryView.class) 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 307dffc75..767cd48de 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -60,6 +60,48 @@ public class Gff3Service { @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject Gff3DtoValidator gff3DtoValidator; + + @Transactional + public void loadExonEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { + Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, attributes, dataProvider); + if (exon != null) { + idsAdded.add(exon.getId()); + } + } + } + + @Transactional + public void loadCDSEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.equals(gffEntry.getType(), "CDS")) { + CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, attributes, dataProvider); + if (cds != null) { + idsAdded.add(cds.getId()); + } + } + } + + @Transactional + public void loadTranscriptEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { + gffEntry.setType("lncRNA"); + } + Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, attributes, dataProvider); + if (transcript != null) { + idsAdded.add(transcript.getId()); + } + } + } + + + @Transactional public String loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { @@ -92,33 +134,8 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData } } - public Map> loadEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); - if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, attributes, dataProvider); - if (exon != null) { - idsAdded.get("Exon").add(exon.getId()); - } - } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { - CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, attributes, dataProvider); - if (cds != null) { - idsAdded.get("CodingSequence").add(cds.getId()); - } - } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { - if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { - gffEntry.setType("lncRNA"); - } - Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, attributes, dataProvider); - if (transcript != null) { - idsAdded.get("Transcript").add(transcript.getId()); - } - } - return idsAdded; - } - @Transactional - public Map> loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -170,12 +187,11 @@ public Map> loadLocationAssociations(BulkLoadFileHistory hist transcriptLocationService.addAssociationToSubject(transcriptLocation); } } - - return idsAdded; + } @Transactional - public Map> loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -227,11 +243,10 @@ public Map> loadParentChildAssociations(BulkLoadFileHistory h transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); } } - - return idsAdded; + } - public Map getIdCurieMap(List>> gffData, BackendBulkDataProvider dataProvider) { + public Map getIdCurieMap(List>> gffData) { Map geneIdCurieMap = new HashMap<>(); for (ImmutablePair> gffEntryPair : gffData) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java index d342c0044..f366e9de6 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java @@ -71,7 +71,7 @@ public Response download(Long id) { // response.header("Content-Disposition", "attachment; filename=\"" + id + "_file_exceptions.json\""); Response.ResponseBuilder response = Response.ok(jsonArray.toString()); - response.header("Content-Disposition", "attachment; filename=\"" + bulkLoadFileHistory.getBulkLoadFile().getBulkLoad().getName().replace(" ", "_") + "_exceptions.json\""); + response.header("Content-Disposition", "attachment; filename=\"" + bulkLoadFileHistory.getBulkLoad().getName().replace(" ", "_") + "_exceptions.json\""); response.type(MediaType.APPLICATION_OCTET_STREAM); return response.build(); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java index 503d85c3e..aca1fe571 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java @@ -1,12 +1,12 @@ package org.alliancegenome.curation_api.services.loads; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; -import org.alliancegenome.curation_api.enums.JobStatus; -import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadFileJobEvent; +import org.alliancegenome.curation_api.jobs.events.PendingLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import io.quarkus.logging.Log; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.event.Event; @@ -18,7 +18,7 @@ public class BulkLoadFileService extends BaseEntityCrudService pendingFileJobEvents; + @Inject Event pendingFileJobEvents; @Override @PostConstruct @@ -29,7 +29,7 @@ protected void init() { public ObjectResponse restartLoad(Long id) { ObjectResponse resp = updateLoad(id); if (resp != null) { - pendingFileJobEvents.fire(new PendingBulkLoadFileJobEvent(id)); + pendingFileJobEvents.fire(new PendingLoadJobEvent(id)); return resp; } return null; @@ -37,11 +37,12 @@ public ObjectResponse restartLoad(Long id) { @Transactional protected ObjectResponse updateLoad(Long id) { - BulkLoadFile load = bulkLoadFileDAO.find(id); - if (load != null && load.getBulkloadStatus().isNotRunning()) { - load.setBulkloadStatus(JobStatus.FORCED_PENDING); - return new ObjectResponse(load); - } + Log.error("Not Implemented anymore restarting a load happens through the history"); + //BulkLoadFile load = bulkLoadFileDAO.find(id); + //if (load != null && load.getBulkloadStatus().isNotRunning()) { + // load.setBulkloadStatus(JobStatus.FORCED_PENDING); + // return new ObjectResponse(load); + //} return null; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 87f0ebcfa..4ccaa427c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -88,7 +88,7 @@ public Exon validateExonEntry(Gff3DTO dto, Map attributes, Backe exon.setName(attributes.get("Name")); } - ObjectResponse exonResponse = validateGffEntity(exon, dto, attributes, dataProvider); + ObjectResponse exonResponse = validateGenomicEntity(exon, dto, attributes, dataProvider); if (exonResponse.hasErrors()) { throw new ObjectValidationException(dto, exonResponse.errorMessagesString()); @@ -115,7 +115,7 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, Map attribut cds.setName(attributes.get("Name")); } - ObjectResponse cdsResponse = validateGffEntity(cds, dto, attributes, dataProvider); + ObjectResponse cdsResponse = validateGenomicEntity(cds, dto, attributes, dataProvider); if (cdsResponse.hasErrors()) { throw new ObjectValidationException(dto, cdsResponse.errorMessagesString()); @@ -148,7 +148,7 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, Map attri transcript.setName(attributes.get("Name")); } - ObjectResponse transcriptResponse = validateGffEntity(transcript, dto, attributes, dataProvider); + ObjectResponse transcriptResponse = validateGenomicEntity(transcript, dto, attributes, dataProvider); if (!attributes.containsKey("ID")) { transcriptResponse.addErrorMessage("attributes - ID", ValidationConstants.REQUIRED_MESSAGE); } @@ -160,7 +160,7 @@ public Transcript validateTranscriptEntry(Gff3DTO dto, Map attri return transcriptDAO.persist(transcriptResponse.getEntity()); } - private ObjectResponse validateGffEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { + private ObjectResponse validateGenomicEntity(E entity, Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) { ObjectResponse geResponse = new ObjectResponse(); entity.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); From a01b94e93664c731c552d30346f9e20414d2428c Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 29 Aug 2024 12:37:19 -0600 Subject: [PATCH 148/342] Fix for linking objects together --- .../model/entities/bulkloads/BulkLoad.java | 8 +---- .../entities/bulkloads/BulkLoadFile.java | 2 +- .../v0.37.0.46__remove_dataprovider_dups.sql | 36 +++++++++++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java index de61c14cc..626252464 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoad.java @@ -73,14 +73,8 @@ public abstract class BulkLoad extends AuditedObject { private BulkLoadGroup group; @JsonView({ View.FieldsOnly.class }) - @OneToMany(mappedBy = "bulkLoadFile", fetch = FetchType.EAGER) + @OneToMany(mappedBy = "bulkLoad", fetch = FetchType.EAGER) @OrderBy("loadFinished DESC") private List history; - -// @JsonView({ View.FieldsOnly.class }) -// @OneToMany(mappedBy = "bulkLoad", fetch = FetchType.EAGER) -// @OrderBy("dateUpdated DESC") -// private List loadFiles; - } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java index b969a6697..2626f6732 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java @@ -65,7 +65,7 @@ public class BulkLoadFile extends AuditedObject { private String allianceMemberReleaseVersion; @JsonView({ View.FieldsOnly.class }) - @OneToMany(mappedBy = "bulkLoad") + @OneToMany(mappedBy = "bulkLoadFile") private List history; @Transient diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql index b82cdb6a4..7c7cfcd70 100644 --- a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -3,3 +3,39 @@ DELETE FROM crossreference cr USING crossreference_ids_to_delete cd WHERE cr.id DROP TABLE dataprovider_ids_to_keep; DROP TABLE crossreference_ids_to_delete; DROP TABLE dataprovider_ids_to_delete; + +-- Migration to switch bulk load file and history around + +ALTER TABLE bulkloadfilehistory ADD COLUMN bulkload_id bigint; +ALTER TABLE bulkloadfilehistory ADD COLUMN errormessage text; +ALTER TABLE bulkloadfilehistory ADD COLUMN bulkloadstatus character varying(255); +ALTER TABLE bulkloadfilehistory ADD CONSTRAINT bulkloadfilehistory_bulkload_fk FOREIGN KEY (bulkload_id) REFERENCES bulkload(id); + +CREATE INDEX bulkloadfilehistory_bulkloadstatus_index ON bulkloadfilehistory USING btree (bulkloadstatus); +CREATE INDEX bulkloadfilehistory_bulkload_index ON bulkloadfilehistory USING btree (bulkload_id); +CREATE INDEX bulkloadfile_md5sum_index ON bulkloadfile USING btree (md5sum); + +UPDATE bulkloadfilehistory bh +SET bulkload_id = bf.bulkload_id +FROM bulkloadfile bf +WHERE + bf.id = bh.bulkloadfile_id; + +UPDATE bulkloadfilehistory bh +SET errormessage = bf.errormessage +FROM bulkloadfile bf +WHERE + bf.id = bh.bulkloadfile_id; + +UPDATE bulkloadfilehistory bh +SET bulkloadstatus = bf.bulkloadstatus +FROM bulkloadfile bf +WHERE + bf.id = bh.bulkloadfile_id; + +DELETE from bulkloadfilehistory where bulkloadfile_id is null; + +ALTER TABLE bulkloadfile DROP COLUMN bulkload_id; +ALTER TABLE bulkloadfile DROP COLUMN errorMessage; +ALTER TABLE bulkloadfile DROP COLUMN bulkloadStatus; + From f187d7348d3d63190267ed65b77d4bf5b7330802 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 29 Aug 2024 19:53:39 -0600 Subject: [PATCH 149/342] Added more code for better performance --- .../dataLoadsPage/DataLoadsComponent.js | 39 ++- .../cliapp/src/service/DataLoadService.js | 16 +- .../jobs/executors/BulkLoadJobExecutor.java | 20 +- .../jobs/executors/Gff3CDSExecutor.java | 11 +- .../executors/Gff3CDSLocationExecutor.java | 131 ++++++++++ .../jobs/executors/Gff3Executor.java | 242 ++---------------- .../jobs/executors/Gff3ExonExecutor.java | 15 +- .../executors/Gff3ExonLocationExecutor.java | 131 ++++++++++ .../executors/Gff3TranscriptCDSExecutor.java | 130 ++++++++++ .../executors/Gff3TranscriptExecutor.java | 9 +- .../executors/Gff3TranscriptExonExecutor.java | 130 ++++++++++ .../executors/Gff3TranscriptGeneExecutor.java | 129 ++++++++++ .../Gff3TranscriptLocationExecutor.java | 132 ++++++++++ .../model/entities/AssemblyComponent.java | 4 +- .../entities/bulkloads/BulkLoadFile.java | 1 - .../bulkloads/BulkLoadFileHistory.java | 8 +- .../curation_api/services/Gff3Service.java | 107 +++++--- ...enceGenomicLocationAssociationService.java | 3 +- .../websocket/IndexProcessingWebsocket.java | 4 +- .../websocket/LoadProcessingWebsocket.java | 4 +- .../v0.37.0.46__remove_dataprovider_dups.sql | 115 +++++++++ .../v0.37.0.7__remove_dataprovider_dups.sql | 3 + 22 files changed, 1072 insertions(+), 312 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonLocationExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 360ec99b7..f13611187 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -105,8 +105,8 @@ export const DataLoadsComponent = () => { if (group.loads) { for (let load of group.loads) { load.group = group.id; - if (load.loadFiles) { - let sortedFiles = sortFilesByDate(load.loadFiles); + if (load.history) { + let sortedFiles = sortFilesByDate(load.history); if (sortedFiles[0].bulkloadStatus === 'FAILED') { _errorLoads.push(load); } @@ -161,7 +161,7 @@ export const DataLoadsComponent = () => { }; const urlTemplate = (rowData) => { - return Download; + return Download; }; const refresh = () => { @@ -190,9 +190,9 @@ export const DataLoadsComponent = () => { setDisableFormFields(true); }; - const deleteLoadFile = (rowData) => { + const deleteLoadFileHistory = (rowData) => { getService() - .deleteLoadFile(rowData.id) + .deleteLoadFileHistory(rowData.id) .then((response) => { queryClient.invalidateQueries(['bulkloadtable']); }); @@ -306,7 +306,7 @@ export const DataLoadsComponent = () => { key="delete" icon="pi pi-trash" className="p-button-rounded p-button-danger mr-2" - onClick={() => deleteLoadFile(rowData)} + onClick={() => deleteLoadFileHistory(rowData)} /> ); } @@ -354,7 +354,7 @@ export const DataLoadsComponent = () => { ); } - if (!rowData.loadFiles || rowData.loadFiles.length === 0) { + if (!rowData.history || rowData.history.length === 0) { ret.push(
); @@ -599,7 +614,7 @@ export const DataLoadsComponent = () => { responsiveLayout="scroll" expandedRows={expandedLoadRows} onRowToggle={(e) => setExpandedLoadRows(e.data)} - rowExpansionTemplate={fileTable} + rowExpansionTemplate={historyTable} dataKey="id" > @@ -795,7 +810,7 @@ export const DataLoadsComponent = () => { responsiveLayout="scroll" expandedRows={expandedErrorLoadRows} onRowToggle={(e) => setExpandedErrorLoadRows(e.data)} - rowExpansionTemplate={fileTable} + rowExpansionTemplate={historyTable} dataKey="id" > diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 518f64a5f..f3eb988a3 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -19,8 +19,6 @@ export class DataLoadService extends BaseAuthService { delete newLoad[objectKey]; } } - console.log('Creating: '); - console.log(newLoad); return this.api.post(`/${endpoint}`, newLoad); } @@ -77,13 +75,27 @@ export class DataLoadService extends BaseAuthService { return this.api.delete(`/bulkloadfile/${id}`); } + deleteLoadFileHistory(id) { + return this.api.delete(`/bulkloadfilehistory/${id}`); + } + getBackendBulkLoadTypes(loadType) { const bulkLoadTypes = { BulkFMSLoad: [ 'GFF', + 'GFF_EXON', 'GFF_CDS', 'GFF_TRANSCRIPT', + + 'GFF_EXON_LOCATION', + 'GFF_CDS_LOCATION', + 'GFF_TRANSCRIPT_LOCATION', + + 'GFF_TRANSCRIPT_CDS', + 'GFF_TRANSCRIPT_EXON', + 'GFF_TRANSCRIPT_GENE', + 'HTPDATASET', 'INTERACTION-GEN', 'INTERACTION-MOL', 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 2da5e806a..f6490947b 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 @@ -55,6 +55,14 @@ public class BulkLoadJobExecutor { @Inject Gff3ExonExecutor gff3ExonExecutor; @Inject Gff3CDSExecutor gff3CDSExecutor; @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; + + @Inject Gff3TranscriptLocationExecutor gff3TranscriptLocationExecutor; + @Inject Gff3ExonLocationExecutor gff3ExonLocationExecutor; + @Inject Gff3CDSLocationExecutor gff3CDSLocationExecutor; + + @Inject Gff3TranscriptExonExecutor gff3TranscriptExonExecutor; + @Inject Gff3TranscriptCDSExecutor gff3TranscriptCDSExecutor; + @Inject Gff3TranscriptGeneExecutor gff3TranscriptGeneExecutor; @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor; @@ -128,17 +136,17 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT) { gff3TranscriptExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON_LOCATION) { - //gff3Executor.execLoad(bulkLoadFile); + gff3ExonLocationExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS_LOCATION) { - //gff3Executor.execLoad(bulkLoadFile); + gff3CDSLocationExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_LOCATION) { - //gff3Executor.execLoad(bulkLoadFile); + gff3TranscriptLocationExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_GENE) { - //gff3Executor.execLoad(bulkLoadFile); + gff3TranscriptGeneExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_EXON) { - //gff3Executor.execLoad(bulkLoadFile); + gff3TranscriptExonExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_TRANSCRIPT_CDS) { - //gff3Executor.execLoad(bulkLoadFile); + gff3TranscriptCDSExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) { htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFileHistory); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java index d670630ed..faecca58d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java @@ -34,7 +34,6 @@ public class Gff3CDSExecutor extends Gff3Executor { @Inject Gff3Service gff3Service; @Inject CodingSequenceService cdsService; - @Override public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -81,7 +80,7 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); + ph.startProcess("GFF CDS update for " + dataProvider.name(), gffData.size()); loadCDSEntities(history, gffData, idsAdded, dataProvider, ph); @@ -94,7 +93,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); history.finishLoad(); @@ -104,8 +103,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List private void loadCDSEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) - int updateCounter = 0; + updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { gff3Service.loadCDSEntity(history, gff3EntryPair, idsAdded, dataProvider); @@ -118,9 +116,6 @@ private void loadCDSEntities(BulkLoadFileHistory history, List 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(cdsLocationService, bulkLoadFileHistory, dataProvider.name(), cdsLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF coding sequence genomic location association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF CDS Location update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadCDSLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java index cd537d0d9..2db33f4e1 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java @@ -6,237 +6,41 @@ import java.util.Map; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.services.Gff3Service; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; @ApplicationScoped public class Gff3Executor extends LoadFileExecutor { -// @Inject Gff3Service gff3Service; -// @Inject ExonService exonService; -// @Inject CodingSequenceService cdsService; -// @Inject TranscriptService transcriptService; -// @Inject ExonGenomicLocationAssociationService exonLocationService; -// @Inject CodingSequenceGenomicLocationAssociationService cdsLocationService; -// @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; -// @Inject TranscriptGeneAssociationService transcriptGeneService; -// @Inject TranscriptExonAssociationService transcriptExonService; -// @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; - - 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(bulkLoadFile.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) bulkLoadFile.getBulkLoad(); -// BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); -// -// List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); -// -// gffData.clear(); -// -// Map> idsAdded = createIdsAddedMap(); -// -// BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); -// createHistory(history, bulkLoadFile); -// -// boolean success = runLoad(history, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); -// -// if (success) { -// Map> previousIds = getPreviouslyLoadedIds(dataProvider); -// runCleanup(transcriptService, history, dataProvider.name(), previousIds.get("Transcript"), idsAdded.get("Transcript"), "GFF transcript", bulkLoadFile.getMd5Sum()); -// runCleanup(exonService, history, dataProvider.name(), previousIds.get("Exon"), idsAdded.get("Exon"), "GFF exon", bulkLoadFile.getMd5Sum()); -// runCleanup(cdsService, history, dataProvider.name(), previousIds.get("CodingSequence"), idsAdded.get("CodingSequence"), "GFF coding sequence", bulkLoadFile.getMd5Sum()); -// runCleanup(transcriptLocationService, history, dataProvider.name(), previousIds.get("TranscriptGenomicLocationAssociation"), idsAdded.get("TranscriptGenomicLocationAssociation"), "GFF transcript genomic location association", bulkLoadFile.getMd5Sum()); -// runCleanup(exonLocationService, history, dataProvider.name(), previousIds.get("ExonGenomicLocationAssociation"), idsAdded.get("ExonGenomicLocationAssociation"), "GFF exon genomic location association", bulkLoadFile.getMd5Sum()); -// runCleanup(cdsLocationService, history, dataProvider.name(), previousIds.get("CodingSequenceGenomicLocationAssociation"), idsAdded.get("CodingSequenceGenomicLocationAssociation"), "GFF coding sequence genomic location association", bulkLoadFile.getMd5Sum()); -// runCleanup(transcriptGeneService, history, dataProvider.name(), previousIds.get("TranscriptGeneAssociation"), idsAdded.get("TranscriptGeneAssociation"), "GFF transcript gene association", bulkLoadFile.getMd5Sum()); -// runCleanup(transcriptExonService, history, dataProvider.name(), previousIds.get("TranscriptExonAssociation"), idsAdded.get("TranscriptExonAssociation"), "GFF transcript exon association", bulkLoadFile.getMd5Sum()); -// runCleanup(transcriptCdsService, history, dataProvider.name(), previousIds.get("TranscriptCodingSequenceAssociation"), idsAdded.get("TranscriptCodingSequenceAssociation"), "GFF transcript coding sequence association", bulkLoadFile.getMd5Sum()); -// } -// history.finishLoad(); -// finalSaveHistory(history); -// -// } catch (Exception e) { -// e.printStackTrace(); -// } - } - -// private Map> createIdsAddedMap() { -// Map> idsAdded = new HashMap>(); -// idsAdded.put("Transcript", new ArrayList()); -// idsAdded.put("Exon", new ArrayList()); -// idsAdded.put("CodingSequence", new ArrayList()); -// idsAdded.put("TranscriptGenomicLocationAssociation", new ArrayList()); -// idsAdded.put("ExonGenomicLocationAssociation", new ArrayList()); -// idsAdded.put("CodingSequenceGenomicLocationAssociation", new ArrayList()); -// idsAdded.put("TranscriptGeneAssociation", new ArrayList()); -// idsAdded.put("TranscriptExonAssociation", new ArrayList()); -// idsAdded.put("TranscriptCodingSequenceAssociation", new ArrayList()); -// -// return idsAdded; -// } - -// private Map> getPreviouslyLoadedIds(BackendBulkDataProvider dataProvider) { -// Map> previousIds = new HashMap<>(); -// -// previousIds.put("Transcript", transcriptService.getIdsByDataProvider(dataProvider)); -// previousIds.put("Exon", exonService.getIdsByDataProvider(dataProvider)); -// previousIds.put("CodingSequence", cdsService.getIdsByDataProvider(dataProvider)); -// previousIds.put("TranscriptGenomicLocationAssociation", transcriptLocationService.getIdsByDataProvider(dataProvider)); -// previousIds.put("ExonGenomicLocationAssociation", exonLocationService.getIdsByDataProvider(dataProvider)); -// previousIds.put("CodingSequenceGenomicLocationAssociation", cdsLocationService.getIdsByDataProvider(dataProvider)); -// previousIds.put("TranscriptGeneAssociation", transcriptGeneService.getIdsByDataProvider(dataProvider)); -// previousIds.put("TranscriptExonAssociation", transcriptExonService.getIdsByDataProvider(dataProvider)); -// previousIds.put("TranscriptCodingSequenceAssociation", transcriptCdsService.getIdsByDataProvider(dataProvider)); -// -// -// return previousIds; -// } - -// private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider) { -// return runLoad(history, gffHeaderData, gffData, idsAdded, dataProvider, null); -// } -// -// private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { -// -// ProcessDisplayHelper ph = new ProcessDisplayHelper(); -// ph.addDisplayHandler(loadProcessDisplayService); -// ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); -// -// assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); -// -// if (assemblyId == null) { -// failLoad(history.getBulkLoadFile(), new Exception("GFF Header does not contain assembly")); -// return false; -// } else { -// loadEntities(history, gffData, idsAdded, dataProvider, ph); -// Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); -// loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); -// loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); -// } -// ph.finishProcess(); -// -// return true; -// } - -// public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { -// Map> idsAdded = createIdsAddedMap(); -// BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); -// List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); -// BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); -// -// runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); -// history.finishLoad(); -// -// return new LoadHistoryResponce(history); -// } -// -// private String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { -// try { -// assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); -// history.incrementCompleted(); -// } catch (ObjectUpdateException e) { -// //e.printStackTrace(); -// history.incrementFailed(); -// addException(history, e.getData()); -// } catch (Exception e) { -// e.printStackTrace(); -// history.incrementFailed(); -// addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); -// } -// updateHistory(history); -// ph.progressProcess(); -// -// return assemblyName; -// } + @Inject Gff3Service gff3Service; -// private void loadEntities(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { -// int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) -// int updateCounter = 0; -// for (ImmutablePair> gff3EntryPair : gffData) { -// try { -// gff3Service.loadEntity(history, gff3EntryPair, idsAdded, dataProvider); -// history.incrementCompleted(); -// } catch (ObjectUpdateException e) { -// history.incrementFailed(); -// addException(history, e.getData()); -// } catch (Exception e) { -// e.printStackTrace(); -// history.incrementFailed(); -// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); -// } -// if (updateCounter++ % updateThreshhold == 0) { -// updateHistory(history); -// } -// ph.progressProcess(); -// } -// updateHistory(history); -// -// } -// -// private void loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { -// int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) -// int updateCounter = 0; -// for (ImmutablePair> gff3EntryPair : gffData) { -// try { -// gff3Service.loadLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); -// history.incrementCompleted(); -// } catch (ObjectUpdateException e) { -// e.printStackTrace(); -// history.incrementFailed(); -// addException(history, e.getData()); -// } catch (Exception e) { -// e.printStackTrace(); -// history.incrementFailed(); -// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); -// } -// if (updateCounter++ % updateThreshhold == 0) { -// updateHistory(history); -// } -// ph.progressProcess(); -// } -// updateHistory(history); -// -// } -// -// private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, Map> idsAdded, -// BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { -// -// for (ImmutablePair> gff3EntryPair : gffData) { -// try { -// gff3Service.loadParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); -// history.incrementCompleted(); -// } catch (ObjectUpdateException e) { -// history.incrementFailed(); -// addException(history, e.getData()); -// } catch (Exception e) { -// e.printStackTrace(); -// history.incrementFailed(); -// addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); -// } -// updateHistory(history); -// ph.progressProcess(); -// } -// -// } + protected String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + try { + assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + //e.printStackTrace(); + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + + return assemblyName; + } protected List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { List>> processedGffData = new ArrayList<>(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java index f635fda48..35b37b6c1 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java @@ -16,7 +16,6 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.ExonService; -import org.alliancegenome.curation_api.services.Gff3Service; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -31,10 +30,8 @@ @ApplicationScoped public class Gff3ExonExecutor extends Gff3Executor { - @Inject Gff3Service gff3Service; @Inject ExonService exonService; - - @Override + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -81,7 +78,7 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess("GFF Exon update for " + dataProvider.name(), (gffData.size() * 3) + 1); + ph.startProcess("GFF Exon update for " + dataProvider.name(), gffData.size()); loadExonEntities(history, gffData, idsAdded, dataProvider, ph); @@ -94,7 +91,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List List idsAdded = new ArrayList(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); history.finishLoad(); @@ -104,8 +101,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List private void loadExonEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - int updateThreshhold = 1000; // Aim for every 5 seconds (r/s * 5 = this number) - int updateCounter = 0; + updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { gff3Service.loadExonEntity(history, gff3EntryPair, idsAdded, dataProvider); @@ -118,9 +114,6 @@ private void loadExonEntities(BulkLoadFileHistory history, List 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(exonLocationService, bulkLoadFileHistory, dataProvider.name(), exonLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF exon genomic location association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Exon Location update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadExonLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java new file mode 100644 index 000000000..bdeb7a100 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java @@ -0,0 +1,130 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.transcriptAssociations.TranscriptCodingSequenceAssociationService; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3TranscriptCDSExecutor extends Gff3Executor { + + @Inject TranscriptCodingSequenceAssociationService transcriptCdsService; + + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(transcriptCdsService, bulkLoadFileHistory, dataProvider.name(), transcriptCdsService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript coding sequence association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Transcript CDS update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadCDSParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + + ph.progressProcess(); + } + updateHistory(history); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java index 635c6bbb6..3c9f76bbd 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java @@ -15,7 +15,6 @@ 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.Gff3Service; import org.alliancegenome.curation_api.services.TranscriptService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -31,10 +30,8 @@ @ApplicationScoped public class Gff3TranscriptExecutor extends Gff3Executor { - @Inject Gff3Service gff3Service; @Inject TranscriptService transcriptService; - - @Override + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -81,7 +78,7 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess("GFF update for " + dataProvider.name(), (gffData.size() * 3) + 1); + ph.startProcess("GFF Transcript update for " + dataProvider.name(), gffData.size()); loadTranscriptEntities(history, gffData, idsAdded, dataProvider, ph); @@ -94,7 +91,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory((preProcessedGffData.size() * 3) + 1); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); history.finishLoad(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java new file mode 100644 index 000000000..3d9bb8ea0 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java @@ -0,0 +1,130 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.transcriptAssociations.TranscriptExonAssociationService; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3TranscriptExonExecutor extends Gff3Executor { + + @Inject TranscriptExonAssociationService transcriptExonService; + + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(transcriptExonService, bulkLoadFileHistory, dataProvider.name(), transcriptExonService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript exon association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Transcript Exon update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadExonParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + + ph.progressProcess(); + } + updateHistory(history); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java new file mode 100644 index 000000000..166dfd549 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java @@ -0,0 +1,129 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.transcriptAssociations.TranscriptGeneAssociationService; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3TranscriptGeneExecutor extends Gff3Executor { + + @Inject TranscriptGeneAssociationService transcriptGeneService; + + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(transcriptGeneService, bulkLoadFileHistory, dataProvider.name(), transcriptGeneService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript gene association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Transcript Gene update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadGeneParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java new file mode 100644 index 000000000..07ee505a0 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java @@ -0,0 +1,132 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.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.transcriptAssociations.TranscriptGenomicLocationAssociationService; +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 jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3TranscriptLocationExecutor extends Gff3Executor { + + @Inject TranscriptGenomicLocationAssociationService transcriptLocationService; + + 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>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + + gffData.clear(); + + List idsAdded = new ArrayList<>(); + + bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + + if (success) { + runCleanup(transcriptLocationService, bulkLoadFileHistory, dataProvider.name(), transcriptLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript genomic location association"); + } + bulkLoadFileHistory.finishLoad(); + finalSaveHistory(bulkLoadFileHistory); + + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("GFF Transcript Location update for " + dataProvider.name(), gffData.size()); + + assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + + if (assemblyId == null) { + failLoad(history, new Exception("GFF Header does not contain assembly")); + return false; + } else { + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadLocationAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + } + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + + runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + + + private void loadLocationAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + updateHistory(history); + for (ImmutablePair> gff3EntryPair : gffData) { + try { + gff3Service.loadTranscriptLocationAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gff3EntryPair.getKey(), e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index cbf53c0fd..a0a58a63e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -27,7 +27,9 @@ @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table( indexes = { - @Index(name = "assemblycomponent_genomeassembly_index", columnList = "genomeassembly_id") + @Index(name = "assemblycomponent_genomeassembly_index", columnList = "genomeassembly_id"), + @Index(name = "assemblycomponent_mapsToChromosome_index", columnList = "mapsToChromosome_id"), + @Index(name = "assemblycomponent_name_index", columnList = "name") } ) public class AssemblyComponent extends GenomicEntity { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java index 2626f6732..5faf23901 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java @@ -64,7 +64,6 @@ public class BulkLoadFile extends AuditedObject { @JsonView({ View.FieldsOnly.class }) private String allianceMemberReleaseVersion; - @JsonView({ View.FieldsOnly.class }) @OneToMany(mappedBy = "bulkLoadFile") private List history; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java index 05de25735..0ddbbd270 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java @@ -9,8 +9,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.view.View; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; import com.fasterxml.jackson.annotation.JsonView; @@ -34,7 +32,7 @@ @AllArgsConstructor @NoArgsConstructor @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = { "bulkLoadFile", "exceptions" }, callSuper = true) +@ToString(exclude = { "bulkLoadFile", "bulkLoad", "exceptions" }, callSuper = true) @AGRCurationSchemaVersion(min = "1.2.4", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table( indexes = { @@ -74,14 +72,14 @@ public class BulkLoadFileHistory extends AuditedObject { @JsonView({ View.FieldsOnly.class }) @Enumerated(EnumType.STRING) - private JobStatus bulkloadStatus; + private JobStatus bulkloadStatus = JobStatus.STOPPED; @JsonView({ View.FieldsOnly.class }) @Column(columnDefinition = "TEXT") private String errorMessage; @ManyToOne - @OnDelete(action = OnDeleteAction.CASCADE) + @JsonView({ View.FieldsOnly.class }) private BulkLoadFile bulkLoadFile; @ManyToOne 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 767cd48de..792468ea4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -59,7 +59,6 @@ public class Gff3Service { @Inject DataProviderService dataProviderService; @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject Gff3DtoValidator gff3DtoValidator; - @Transactional public void loadExonEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { @@ -72,7 +71,7 @@ public void loadExonEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); @@ -99,12 +98,10 @@ public void loadTranscriptEntity(BulkLoadFileHistory history, ImmutablePair gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - + if (StringUtils.isBlank(assemblyName)) { for (String header : gffHeaderData) { if (header.startsWith("#!assembly")) { @@ -117,31 +114,31 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData params.put("modEntityId", assemblyName); params.put(EntityFieldConstants.DATA_PROVIDER, dataProvider.sourceOrganization); params.put(EntityFieldConstants.TAXON, dataProvider.canonicalTaxonCurie); - + SearchResponse resp = genomeAssemblyDAO.findByParams(params); if (resp == null || resp.getSingleResult() == null) { GenomeAssembly assembly = new GenomeAssembly(); assembly.setModEntityId(assemblyName); assembly.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); assembly.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); - + genomeAssemblyDAO.persist(assembly); } - + return assemblyName; } else { throw new ObjectValidationException(gffHeaderData, "#!assembly - " + ValidationConstants.REQUIRED_MESSAGE); } } - + @Transactional - public void loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadExonLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); @@ -149,26 +146,47 @@ public void loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair< throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } Exon exon = response.getSingleResult(); - + ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assemblyId, dataProvider); if (exonLocation != null) { - idsAdded.get("ExonGenomicLocationAssociation").add(exonLocation.getId()); + idsAdded.add(exonLocation.getId()); exonLocationService.addAssociationToSubject(exonLocation); } - } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { + } + } + + @Transactional + public void loadCDSLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + if (StringUtils.equals(gffEntry.getType(), "CDS")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); if (response == null || response.getSingleResult() == null) { throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } CodingSequence cds = response.getSingleResult(); - + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); if (cdsLocation != null) { - idsAdded.get("CodingSequenceGenomicLocationAssociation").add(cdsLocation.getId()); + idsAdded.add(cdsLocation.getId()); cdsLocationService.addAssociationToSubject(cdsLocation); } - } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + } + } + + @Transactional + public void loadTranscriptLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + + if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); } @@ -180,24 +198,23 @@ public void loadLocationAssociations(BulkLoadFileHistory history, ImmutablePair< throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); } Transcript transcript = response.getSingleResult(); - + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); if (transcriptLocation != null) { - idsAdded.get("TranscriptGenomicLocationAssociation").add(transcriptLocation.getId()); + idsAdded.add(transcriptLocation.getId()); transcriptLocationService.addAssociationToSubject(transcriptLocation); } } - } @Transactional - public void loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, Map> idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadExonParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - + if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); @@ -205,26 +222,47 @@ public void loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePa throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } Exon exon = response.getSingleResult(); - + TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); if (transcriptAssociation != null) { - idsAdded.get("TranscriptExonAssociation").add(transcriptAssociation.getId()); + idsAdded.add(transcriptAssociation.getId()); transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); } - } else if (StringUtils.equals(gffEntry.getType(), "CDS")) { + } + } + + @Transactional + public void loadCDSParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + if (StringUtils.equals(gffEntry.getType(), "CDS")) { String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); if (response == null || response.getSingleResult() == null) { throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } CodingSequence cds = response.getSingleResult(); - + TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); if (transcriptAssociation != null) { - idsAdded.get("TranscriptCodingSequenceAssociation").add(transcriptAssociation.getId()); + idsAdded.add(transcriptAssociation.getId()); transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); } - } else if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + } + } + + @Transactional + public void loadGeneParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + Gff3DTO gffEntry = gffEntryPair.getKey(); + Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { + throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + } + + if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { gffEntry.setType("lncRNA"); } @@ -236,27 +274,26 @@ public void loadParentChildAssociations(BulkLoadFileHistory history, ImmutablePa throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); } Transcript transcript = response.getSingleResult(); - + TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes, geneIdCurieMap); if (geneAssociation != null) { - idsAdded.get("TranscriptGeneAssociation").add(geneAssociation.getId()); + idsAdded.add(geneAssociation.getId()); transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); } } - } public Map getIdCurieMap(List>> gffData) { Map geneIdCurieMap = new HashMap<>(); - + for (ImmutablePair> gffEntryPair : gffData) { Map attributes = gffEntryPair.getValue(); if (attributes.containsKey("ID") && attributes.containsKey("gene_id")) { geneIdCurieMap.put(attributes.get("ID"), attributes.get("gene_id")); } } - + return geneIdCurieMap; } - + } 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 3502a11c3..0ca58b1fb 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 @@ -114,8 +114,7 @@ public void addAssociationToSubject(CodingSequenceGenomicLocationAssociation ass currentSubjectAssociations = new ArrayList<>(); } - List currentSubjectAssociationIds = currentSubjectAssociations.stream() - .map(CodingSequenceGenomicLocationAssociation::getId).collect(Collectors.toList()); + List currentSubjectAssociationIds = currentSubjectAssociations.stream().map(CodingSequenceGenomicLocationAssociation::getId).collect(Collectors.toList()); if (!currentSubjectAssociationIds.contains(association.getId())) { currentSubjectAssociations.add(association); diff --git a/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java b/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java index 8fbf88d94..9636125de 100644 --- a/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java +++ b/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java @@ -1,8 +1,8 @@ package org.alliancegenome.curation_api.websocket; +import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; import org.alliancegenome.curation_api.model.event.index.IndexProcessingEvent; @@ -26,7 +26,7 @@ public class IndexProcessingWebsocket { @Inject ObjectMapper mapper; - Map sessions = new ConcurrentHashMap<>(); + Map sessions = new HashMap<>(); @Getter private IndexProcessingEvent event; diff --git a/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java b/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java index 28f0ef6d7..8eb808095 100644 --- a/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java +++ b/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java @@ -1,8 +1,8 @@ package org.alliancegenome.curation_api.websocket; +import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; -import java.util.concurrent.ConcurrentHashMap; import org.alliancegenome.curation_api.model.event.load.LoadProcessingEvent; @@ -25,7 +25,7 @@ public class LoadProcessingWebsocket { @Inject ObjectMapper mapper; - Map sessions = new ConcurrentHashMap<>(); + Map sessions = new HashMap<>(); @OnOpen public void onOpen(Session session) { diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql index 7c7cfcd70..2ae4b3777 100644 --- a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -39,3 +39,118 @@ ALTER TABLE bulkloadfile DROP COLUMN bulkload_id; ALTER TABLE bulkloadfile DROP COLUMN errorMessage; ALTER TABLE bulkloadfile DROP COLUMN bulkloadStatus; +DELETE from bulkloadfileexception where bulkloadfilehistory_id in (select id from bulkloadfilehistory where bulkload_id in (select id from bulkload where name like '%GFF%')); +DELETE from bulkloadfilehistory where bulkload_id in (select id from bulkload where name like '%GFF%'); + +DELETE from bulkfmsload where id in (select id from bulkload where name like '%GFF%'); +DELETE from bulkscheduledload where id in (select id from bulkload where name like '%GFF%'); +DELETE from bulkload where name like '%GFF%'; +DELETE from bulkloadgroup where name = 'GFF Loads'; + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'File Management System (FMS) GFF Loads'); + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'FB GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'Human GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'MGI GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'RGD GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'SGD GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'WB GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'XBXL GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'XBXT GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT', 'ZFIN GFF Transcript Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'FB GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'Human GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'MGI GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'RGD GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'SGD GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'WB GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'XBXL GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'XBXT GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS', 'ZFIN GFF CDS Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'FB GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'Human GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'MGI GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'RGD GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'SGD GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'WB GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'XBXL GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'XBXT GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON', 'ZFIN GFF Exon Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'FB GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'Human GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'MGI GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'RGD GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'SGD GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'WB GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'XBXL GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'XBXT GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_EXON_LOCATION', 'ZFIN GFF Exon Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'FB GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'Human GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'MGI GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'RGD GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'SGD GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'WB GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'XBXL GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'XBXT GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_CDS_LOCATION', 'ZFIN GFF CDS Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'FB GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'Human GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'MGI GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'RGD GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'SGD GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'WB GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'XBXL GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'XBXT GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_LOCATION', 'ZFIN GFF Transcript Location Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'FB GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'Human GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'MGI GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'RGD GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'SGD GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'WB GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'XBXL GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'XBXT GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_GENE', 'ZFIN GFF Transcript Gene Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'FB GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'Human GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'MGI GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'RGD GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'SGD GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'WB GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'XBXL GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'XBXT GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_EXON', 'ZFIN GFF Transcript Exon Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'FB GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'Human GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'MGI GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'RGD GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'SGD GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'WB GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'XBXL GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'XBXT GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'ZFIN GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype in( + 'GFF_TRANSCRIPT', 'GFF_CDS', 'GFF_EXON', + 'GFF_EXON_LOCATION', 'GFF_CDS_LOCATION', 'GFF_TRANSCRIPT_LOCATION', + 'GFF_TRANSCRIPT_GENE', 'GFF_TRANSCRIPT_EXON', 'GFF_TRANSCRIPT_CDS' +); + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'FB' FROM bulkload WHERE name like 'FB GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'HUMAN' FROM bulkload WHERE name like 'Human GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'MGI' FROM bulkload WHERE name like 'MGI GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'RGD' FROM bulkload WHERE name like 'RGD GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'SGD' FROM bulkload WHERE name like 'SGD GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'WB' FROM bulkload WHERE name like 'WB GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'XBXL' FROM bulkload WHERE name like 'XBXL GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'XBXT' FROM bulkload WHERE name like 'XBXT GFF%'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'GFF', 'ZFIN' FROM bulkload WHERE name like 'ZFIN GFF%'; diff --git a/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql index d0c7f3722..31bd82544 100644 --- a/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.7__remove_dataprovider_dups.sql @@ -14,3 +14,6 @@ CREATE INDEX codingsequence_cdsType_index ON codingsequence USING btree (cdstype CREATE INDEX transcript_transcriptType_index ON transcript USING btree (transcripttype_id); CREATE INDEX exon_exonType_index ON exon USING btree (exontype_id); CREATE INDEX ontologyterm_name_index ON ontologyterm USING btree (name); + +CREATE INDEX assemblycomponent_mapsToChromosome_index ON AssemblyComponent USING btree (mapsToChromosome_id); +CREATE INDEX assemblycomponent_name_index ON AssemblyComponent USING btree (name); From a1800fec6e94cd716778118a9739aaf85d156e13 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 29 Aug 2024 20:09:57 -0600 Subject: [PATCH 150/342] Updated UI --- src/main/cliapp/package-lock.json | 29 ++++++++++--------- src/main/cliapp/package.json | 3 +- .../dataLoadsPage/DataLoadsComponent.js | 4 ++- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/cliapp/package-lock.json b/src/main/cliapp/package-lock.json index c6d039af3..ed768ebe8 100644 --- a/src/main/cliapp/package-lock.json +++ b/src/main/cliapp/package-lock.json @@ -45,6 +45,7 @@ "react-use-websocket": "^3.0.0", "react18-json-view": "^0.2.8", "sass": "^1.32.8", + "update-browserslist-db": "^1.1.0", "use-immer": "^0.7.0" }, "devDependencies": { @@ -6840,9 +6841,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001509", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001509.tgz", - "integrity": "sha512-2uDDk+TRiTX5hMcUYT/7CSyzMZxjfGu0vAUjS2g0LSD8UoXOv0LtpH4LxGMemsiPq6LCVIUjNwVM0erkOkGCDA==", + "version": "1.0.30001653", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001653.tgz", + "integrity": "sha512-XGWQVB8wFQ2+9NZwZ10GxTYC5hk0Fa+q8cSkr0tgvMhYhMHP/QC+WTgrePMDBWiWc/pV+1ik82Al20XOK25Gcw==", "funding": [ { "type": "opencollective", @@ -8357,9 +8358,9 @@ } }, "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", "engines": { "node": ">=6" } @@ -16190,9 +16191,9 @@ "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" }, "node_modules/picocolors": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", - "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==" + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.1.tgz", + "integrity": "sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==" }, "node_modules/picomatch": { "version": "2.3.1", @@ -20194,9 +20195,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.0.tgz", + "integrity": "sha512-EdRAaAyk2cUE1wOf2DkEhzxqOQvFOoRJFNS6NeyJ01Gp2beMRpBAINjM2iDXE3KCuKhwnvHIQCJm6ThL2Z+HzQ==", "funding": [ { "type": "opencollective", @@ -20212,8 +20213,8 @@ } ], "dependencies": { - "escalade": "^3.1.1", - "picocolors": "^1.0.0" + "escalade": "^3.1.2", + "picocolors": "^1.0.1" }, "bin": { "update-browserslist-db": "cli.js" diff --git a/src/main/cliapp/package.json b/src/main/cliapp/package.json index d934280f3..f7525ca55 100644 --- a/src/main/cliapp/package.json +++ b/src/main/cliapp/package.json @@ -45,6 +45,7 @@ "react-use-websocket": "^3.0.0", "react18-json-view": "^0.2.8", "sass": "^1.32.8", + "update-browserslist-db": "^1.1.0", "use-immer": "^0.7.0" }, "scripts": { @@ -56,7 +57,7 @@ "eslintConfig": { "extends": [ "react-app", - "prettier" + "prettier" ] }, "browserslist": [ diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index f13611187..672a5d8aa 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -45,7 +45,7 @@ export const DataLoadsComponent = () => { const [bulkLoadDialog, setBulkLoadDialog] = useState(false); const [expandedGroupRows, setExpandedGroupRows] = useState(null); const [expandedLoadRows, setExpandedLoadRows] = useState(null); - const [expandedFileRows, setExpandedFileRows] = useState(null); + //const [expandedFileRows, setExpandedFileRows] = useState(null); const [expandedErrorLoadRows, setExpandedErrorLoadRows] = useState(null); const [disableFormFields, setDisableFormFields] = useState(false); const errorMessage = useRef(null); @@ -566,6 +566,7 @@ export const DataLoadsComponent = () => { return sortedFiles; }; +/* const fileTable = (load) => { let sortedFiles = []; if (load.loadFiles) { @@ -599,6 +600,7 @@ export const DataLoadsComponent = () => {
); }; +*/ const loadTable = (group) => { let sortedLoads = []; From 7b14a714bfd610741aa30c93843200d62c48e19a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 29 Aug 2024 20:16:56 -0600 Subject: [PATCH 151/342] Pretty --- .../src/containers/dataLoadsPage/DataLoadsComponent.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 672a5d8aa..7dc1a5298 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -516,7 +516,6 @@ export const DataLoadsComponent = () => { - @@ -526,9 +525,6 @@ export const DataLoadsComponent = () => { - - - ); @@ -566,7 +562,7 @@ export const DataLoadsComponent = () => { return sortedFiles; }; -/* + /* const fileTable = (load) => { let sortedFiles = []; if (load.loadFiles) { From da0e2fa734778df75e07d381f916234fcae1e3a6 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 29 Aug 2024 21:57:53 -0600 Subject: [PATCH 152/342] Fix for missing DP --- .../alliancegenome/curation_api/dao/DataProviderDAO.java | 8 ++++---- .../validation/base/SubmittedObjectValidator.java | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index 22ed12adf..cc59d5b10 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -35,7 +35,7 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { params.put("crossReference.referencedCurie", sourceOrganization.getAbbreviation()); SearchResponse orgResponse = findByParams(params); - if (orgResponse != null) { + if (orgResponse != null && orgResponse.getSingleResult() != null) { DataProvider member = orgResponse.getSingleResult(); if (member != null && member.getSourceOrganization() != null) { dataProviderCache.put(sourceOrganization.getAbbreviation(), member); @@ -52,9 +52,9 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { xref.setResourceDescriptorPage(sourceOrganization.getHomepageResourceDescriptorPage()); dataProvider.setCrossReference(crossReferenceDAO.persist(xref)); - dataProviderCache.put(sourceOrganization.getAbbreviation(), dataProvider); - return persist(dataProvider); - + DataProvider dp = persist(dataProvider); + dataProviderCache.put(sourceOrganization.getAbbreviation(), dp); + return dp; } return null; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java index 821e4e67c..2673ba52d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java @@ -56,6 +56,7 @@ public DataProvider validateDataProvider(E uiEntity, E dbEntity) { if (uiEntity.getDataProvider() == null) { if (dbEntity.getDataProvider() == null) { uiEntity.setDataProvider(dataProviderService.createAffiliatedModDataProvider()); + dbEntity.setDataProvider(uiEntity.getDataProvider()); } if (uiEntity.getDataProvider() == null) { addMessageResponse(field, ValidationConstants.REQUIRED_MESSAGE); From 31e09233cebcbe8c117d961f42831d93c140f367 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 06:45:51 -0600 Subject: [PATCH 153/342] Revert DP DAO --- .../org/alliancegenome/curation_api/dao/DataProviderDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index cc59d5b10..539c77e0f 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -35,7 +35,7 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { params.put("crossReference.referencedCurie", sourceOrganization.getAbbreviation()); SearchResponse orgResponse = findByParams(params); - if (orgResponse != null && orgResponse.getSingleResult() != null) { + if (orgResponse != null) { DataProvider member = orgResponse.getSingleResult(); if (member != null && member.getSourceOrganization() != null) { dataProviderCache.put(sourceOrganization.getAbbreviation(), member); From 2a78f2e46039d9340a742a847879fff9ee0b6f62 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 07:13:08 -0600 Subject: [PATCH 154/342] Another attempt to fix DP's --- .../alliancegenome/curation_api/dao/DataProviderDAO.java | 2 +- .../services/validation/DataProviderValidator.java | 2 +- .../curation_api/services/validation/GeneValidator.java | 2 +- .../validation/base/SubmittedObjectValidator.java | 1 - .../migration/v0.37.0.24__remove_dataprovider_dups.sql | 9 +++++++++ 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index 539c77e0f..c6d1861c6 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -37,7 +37,7 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { SearchResponse orgResponse = findByParams(params); if (orgResponse != null) { DataProvider member = orgResponse.getSingleResult(); - if (member != null && member.getSourceOrganization() != null) { + if (member != null && member.getSourceOrganization() != null && member.getCrossReference() != null) { dataProviderCache.put(sourceOrganization.getAbbreviation(), member); return member; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java index 597ec31c1..8132d9541 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java @@ -40,7 +40,7 @@ public ObjectResponse validateDataProvider(DataProvider uiEntity, dbEntity = new DataProvider(); } - dbEntity = (DataProvider) validateAuditedObjectFields(uiEntity, dbEntity, newEntity); + dbEntity = validateAuditedObjectFields(uiEntity, dbEntity, newEntity); Organization sourceOrganization = validateSourceOrganization(uiEntity, dbEntity); dbEntity.setSourceOrganization(sourceOrganization); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java index e10a219a7..dee9d0270 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/GeneValidator.java @@ -76,7 +76,7 @@ public Gene validateGeneCreate(Gene uiEntity) { private Gene validateGene(Gene uiEntity, Gene dbEntity) { - dbEntity = (Gene) validateGenomicEntityFields(uiEntity, dbEntity); + dbEntity = validateGenomicEntityFields(uiEntity, dbEntity); SOTerm geneType = validateGeneType(uiEntity, dbEntity); dbEntity.setGeneType(geneType); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java index 2673ba52d..821e4e67c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/base/SubmittedObjectValidator.java @@ -56,7 +56,6 @@ public DataProvider validateDataProvider(E uiEntity, E dbEntity) { if (uiEntity.getDataProvider() == null) { if (dbEntity.getDataProvider() == null) { uiEntity.setDataProvider(dataProviderService.createAffiliatedModDataProvider()); - dbEntity.setDataProvider(uiEntity.getDataProvider()); } if (uiEntity.getDataProvider() == null) { addMessageResponse(field, ValidationConstants.REQUIRED_MESSAGE); diff --git a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql index 943628a8f..bbf4d76f0 100644 --- a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql @@ -8,6 +8,15 @@ CREATE TABLE dataprovider_ids_to_delete ( id bigint ); +INSERT INTO dataprovider_ids_to_keep (id) +SELECT dp1.id + FROM dataprovider dp1, organization o1, crossreference cr1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id = cr1.id + AND o1.abbreviation = 'Alliance' + AND cr1.referencedCurie = 'Alliance' + ORDER BY dp1.id ASC LIMIT 1; + -- select all the dataproviders that we are going to keep INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM annotation where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 191431 INSERT INTO dataprovider_ids_to_keep (id) SELECT dataprovider_id FROM biologicalentity where dataprovider_id is not null ON CONFLICT (id) DO NOTHING; -- 6241140 From e2340934f6fc846b2227dd8696d68601ae88059a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 07:44:15 -0600 Subject: [PATCH 155/342] Added fix for null cross references --- .../v0.37.0.10__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.11__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.12__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.13__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.14__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.15__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.16__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.17__remove_dataprovider_dups.sql | 15 +++++++++++++++ .../v0.37.0.18__remove_dataprovider_dups.sql | 17 +++++++++++++++++ .../v0.37.0.19__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.20__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.21__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.22__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.23__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.8__remove_dataprovider_dups.sql | 16 ++++++++++++++++ .../v0.37.0.9__remove_dataprovider_dups.sql | 15 +++++++++++++++ 16 files changed, 249 insertions(+) diff --git a/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql index 7d150a49e..b4c4b4803 100644 --- a/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.10__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'MGI'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'MGI' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'MGI'; diff --git a/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql index 4ced7b6c7..0da883e0d 100644 --- a/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.11__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'WB'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'WB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'WB'; diff --git a/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql index dbac17613..abcf6bf09 100644 --- a/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.12__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'SGD'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'SGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'SGD'; diff --git a/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql index 307820d78..d83fc3aad 100644 --- a/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.13__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'RGD'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'RGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'RGD'; diff --git a/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql index 734568644..1b31e9112 100644 --- a/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.14__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'ZFIN'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'ZFIN' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'ZFIN'; diff --git a/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql index df089c801..b101a2fdc 100644 --- a/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.15__remove_dataprovider_dups.sql @@ -18,3 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'Alliance'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'Alliance' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'Alliance'; + diff --git a/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql index a2f85ddeb..84eb5e068 100644 --- a/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.16__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'ZFIN'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'ZFIN' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'ZFIN'; diff --git a/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql index b4c0f063c..59b5622ac 100644 --- a/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.17__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'Alliance'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'Alliance' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'Alliance'; diff --git a/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql index 04c19384b..35a07035f 100644 --- a/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.18__remove_dataprovider_dups.sql @@ -16,3 +16,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'XB'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'XB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'XB'; + + diff --git a/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql index 5564cd288..1b0a923a7 100644 --- a/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.19__remove_dataprovider_dups.sql @@ -16,4 +16,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'MGI'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'MGI' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'MGI'; + diff --git a/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql index 0fe17c326..126dfe0f7 100644 --- a/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.20__remove_dataprovider_dups.sql @@ -16,4 +16,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'RGD'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'RGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'RGD'; + diff --git a/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql index b48953348..6a17ab82a 100644 --- a/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.21__remove_dataprovider_dups.sql @@ -16,4 +16,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'SGD'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'SGD' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'SGD'; + diff --git a/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql index 56fa0cd3f..3cad8c41d 100644 --- a/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.22__remove_dataprovider_dups.sql @@ -16,4 +16,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'FB'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'FB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'FB'; + diff --git a/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql index 6b717c108..f65984e9f 100644 --- a/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.23__remove_dataprovider_dups.sql @@ -17,4 +17,20 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'WB'; +UPDATE annotation an +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'WB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + an.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'WB'; + diff --git a/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql index aa005d10c..86f4e1279 100644 --- a/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.8__remove_dataprovider_dups.sql @@ -18,3 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'XB'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'XB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'XB'; + diff --git a/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql index 47783da19..7b62392ee 100644 --- a/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.9__remove_dataprovider_dups.sql @@ -18,4 +18,19 @@ WHERE o.abbreviation = cr.referencedCurie AND o.abbreviation = 'FB'; +UPDATE biologicalentity be +SET dataprovider_id = ( + SELECT dp1.id + FROM dataprovider dp1, organization o1 + WHERE o1.id = dp1.sourceorganization_id + AND dp1.crossreference_id is null + AND o1.abbreviation = 'FB' + ORDER BY dp1.id ASC LIMIT 1 +) +FROM dataprovider dp, organization o +WHERE + be.dataprovider_id=dp.id AND + dp.sourceorganization_id=o.id AND + dp.crossreference_id is null AND + o.abbreviation = 'FB'; From 09c7fa9da3ef2867e67c4576c3c531a9fe6d8d4f Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 08:36:32 -0600 Subject: [PATCH 156/342] Cache only when it comes from the DB --- .../org/alliancegenome/curation_api/dao/DataProviderDAO.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index c6d1861c6..c3222d924 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -35,9 +35,9 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { params.put("crossReference.referencedCurie", sourceOrganization.getAbbreviation()); SearchResponse orgResponse = findByParams(params); - if (orgResponse != null) { + if (orgResponse != null && orgResponse.getSingleResult() != null) { DataProvider member = orgResponse.getSingleResult(); - if (member != null && member.getSourceOrganization() != null && member.getCrossReference() != null) { + if (member.getSourceOrganization() != null && member.getCrossReference() != null) { dataProviderCache.put(sourceOrganization.getAbbreviation(), member); return member; } @@ -53,7 +53,6 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { dataProvider.setCrossReference(crossReferenceDAO.persist(xref)); DataProvider dp = persist(dataProvider); - dataProviderCache.put(sourceOrganization.getAbbreviation(), dp); return dp; } From ebaf68f9cbe616054b80d2131ac9ca1f8d29efb1 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 09:13:41 -0600 Subject: [PATCH 157/342] Update IT's --- .../crud/CodingSequenceCrudController.java | 14 +++++++---- .../controllers/crud/ExonCrudController.java | 14 +++++++---- .../crud/TranscriptCrudController.java | 25 ++++++++++++++----- .../curation_api/Gff3BulkUploadITCase.java | 10 ++++---- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java index 412afee93..f308a79e5 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java @@ -6,6 +6,8 @@ import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.interfaces.crud.CodingSequenceCrudInterface; import org.alliancegenome.curation_api.jobs.executors.Gff3CDSExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3CDSLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptCDSExecutor; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -19,10 +21,10 @@ @RequestScoped public class CodingSequenceCrudController extends BaseEntityCrudController implements CodingSequenceCrudInterface { - @Inject - CodingSequenceService codingSequenceService; - @Inject - Gff3CDSExecutor gff3CDSExecutor; + @Inject CodingSequenceService codingSequenceService; + @Inject Gff3CDSExecutor gff3CDSExecutor; + @Inject Gff3CDSLocationExecutor gff3CDSLocationExecutor; + @Inject Gff3TranscriptCDSExecutor gff3TranscriptCDSExecutor; @Override @PostConstruct @@ -32,7 +34,9 @@ protected void init() { @Override public APIResponse updateCodingSequences(String dataProvider, String assembly, List gffData) { - return gff3CDSExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3CDSExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3CDSLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + return gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java index f34218e37..691d20d10 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java @@ -6,6 +6,8 @@ import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.interfaces.crud.ExonCrudInterface; import org.alliancegenome.curation_api.jobs.executors.Gff3ExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3ExonLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExonExecutor; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -19,10 +21,10 @@ @RequestScoped public class ExonCrudController extends BaseEntityCrudController implements ExonCrudInterface { - @Inject - ExonService exonService; - @Inject - Gff3ExonExecutor gff3ExonExecutor; + @Inject ExonService exonService; + @Inject Gff3ExonExecutor gff3ExonExecutor; + @Inject Gff3ExonLocationExecutor gff3ExonLocationExecutor; + @Inject Gff3TranscriptExonExecutor gff3TranscriptExonExecutor; @Override @PostConstruct @@ -32,7 +34,9 @@ protected void init() { @Override public APIResponse updateExons(String dataProvider, String assembly, List gffData) { - return gff3ExonExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3ExonExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3ExonLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + return gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index 0e2f19afd..ea91a1434 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -5,7 +5,11 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.TranscriptDAO; import org.alliancegenome.curation_api.interfaces.crud.TranscriptCrudInterface; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptCDSExecutor; import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptGeneExecutor; +import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptLocationExecutor; import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -19,11 +23,16 @@ @RequestScoped public class TranscriptCrudController extends BaseEntityCrudController implements TranscriptCrudInterface { - @Inject - TranscriptService transcriptService; - @Inject - Gff3TranscriptExecutor gff3TranscriptExecutor; - + @Inject TranscriptService transcriptService; + + @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; + @Inject Gff3TranscriptLocationExecutor gff3TranscriptLocationExecutor; + @Inject Gff3TranscriptGeneExecutor gff3TranscriptGeneExecutor; + @Inject Gff3TranscriptCDSExecutor gff3TranscriptCDSExecutor; + @Inject Gff3TranscriptExonExecutor gff3TranscriptExonExecutor; + + + @Override @PostConstruct protected void init() { @@ -32,7 +41,11 @@ protected void init() { @Override public APIResponse updateTranscripts(String dataProvider, String assembly, List gffData) { - return gff3TranscriptExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3TranscriptExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3TranscriptLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3TranscriptGeneExecutor.runLoadApi(dataProvider, assembly, gffData); + gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); + return gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); } @Override diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 167e0ff5a..4686481ab 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -1,7 +1,7 @@ package org.alliancegenome.curation_api; -import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.VocabularyConstants; @@ -61,7 +61,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 4); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1); RestAssured.given(). when(). @@ -90,7 +90,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 4); + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1); RestAssured.given(). when(). @@ -121,7 +121,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 4); + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1); RestAssured.given(). when(). @@ -154,7 +154,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 4); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1); RestAssured.given(). when(). From 09b8de97188c6302c2cc131eb7b95492492fab34 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 09:27:39 -0600 Subject: [PATCH 158/342] Fix IT's --- .../curation_api/Gff3BulkUploadITCase.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 4686481ab..5a0d85b1c 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -61,7 +61,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 2); RestAssured.given(). when(). @@ -90,7 +90,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1); + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 2); RestAssured.given(). when(). @@ -121,7 +121,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1); + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 2); RestAssured.given(). when(). @@ -154,7 +154,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 2); RestAssured.given(). when(). @@ -180,7 +180,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { @Test @Order(5) public void gff3DataBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 1, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 4, 1, 3); @@ -192,7 +192,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { @Test @Order(6) public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 1, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 4, 1, 3); @@ -202,7 +202,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { @Test @Order(7) public void gff3DataBulkUploadInvalidFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 4, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 1, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 4, 1, 3); From d9cb0490da22a4a0dacd06e5a6dc9baa5b85d096 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 09:35:53 -0600 Subject: [PATCH 159/342] Fix IT's --- .../curation_api/Gff3BulkUploadITCase.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 5a0d85b1c..eceae8172 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -61,7 +61,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 2); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1); RestAssured.given(). when(). @@ -90,7 +90,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 2); + checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1); RestAssured.given(). when(). @@ -121,7 +121,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 2); + checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1); RestAssured.given(). when(). @@ -154,7 +154,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 2); + checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1); RestAssured.given(). when(). @@ -180,7 +180,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { @Test @Order(5) public void gff3DataBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 1, 1, 3); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 4, 1, 3); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 4, 1, 3); From 0917172f1accf8b412d276b3a45fd02dbf589d2a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 09:45:31 -0600 Subject: [PATCH 160/342] Fix IT's --- .../alliancegenome/curation_api/Gff3BulkUploadITCase.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index eceae8172..a1c1bfefd 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -61,7 +61,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1, 0, 2); RestAssured.given(). when(). @@ -90,7 +90,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkSuccessfulBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1); + checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1, 0, 2); RestAssured.given(). when(). @@ -121,7 +121,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkSuccessfulBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1); + checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1, 0, 2); RestAssured.given(). when(). @@ -154,7 +154,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkSuccessfulBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1, 0, 2); RestAssured.given(). when(). From a34f9398175e369fb43d2d9f37e6cc34ec7e4a44 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 14:49:05 -0600 Subject: [PATCH 161/342] More fixes for GFF --- .../crud/CodingSequenceCrudController.java | 19 +++++- .../controllers/crud/ExonCrudController.java | 19 +++++- .../crud/TranscriptCrudController.java | 35 ++++++++--- .../curation_api/Gff3BulkUploadITCase.java | 58 +++++++++++-------- 4 files changed, 91 insertions(+), 40 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java index f308a79e5..8b45a1a03 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java @@ -9,8 +9,10 @@ import org.alliancegenome.curation_api.jobs.executors.Gff3CDSLocationExecutor; import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptCDSExecutor; import org.alliancegenome.curation_api.model.entities.CodingSequence; +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.response.ObjectResponse; import org.alliancegenome.curation_api.services.CodingSequenceService; @@ -34,9 +36,20 @@ protected void init() { @Override public APIResponse updateCodingSequences(String dataProvider, String assembly, List gffData) { - gff3CDSExecutor.runLoadApi(dataProvider, assembly, gffData); - gff3CDSLocationExecutor.runLoadApi(dataProvider, assembly, gffData); - return gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); + BulkLoadFileHistory history = new BulkLoadFileHistory(); + LoadHistoryResponce resp = (LoadHistoryResponce) gff3CDSExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3CDSLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + return new LoadHistoryResponce(history); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java index 691d20d10..714d743b9 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java @@ -9,8 +9,10 @@ import org.alliancegenome.curation_api.jobs.executors.Gff3ExonLocationExecutor; import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExonExecutor; import org.alliancegenome.curation_api.model.entities.Exon; +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.response.ObjectResponse; import org.alliancegenome.curation_api.services.ExonService; @@ -34,9 +36,20 @@ protected void init() { @Override public APIResponse updateExons(String dataProvider, String assembly, List gffData) { - gff3ExonExecutor.runLoadApi(dataProvider, assembly, gffData); - gff3ExonLocationExecutor.runLoadApi(dataProvider, assembly, gffData); - return gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); + BulkLoadFileHistory history = new BulkLoadFileHistory(); + LoadHistoryResponce resp = (LoadHistoryResponce) gff3ExonExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3ExonLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + return new LoadHistoryResponce(history); } @Override diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index ea91a1434..a7979b864 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -11,8 +11,10 @@ import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptGeneExecutor; import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptLocationExecutor; import org.alliancegenome.curation_api.model.entities.Transcript; +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.response.ObjectResponse; import org.alliancegenome.curation_api.services.TranscriptService; @@ -24,15 +26,13 @@ public class TranscriptCrudController extends BaseEntityCrudController implements TranscriptCrudInterface { @Inject TranscriptService transcriptService; - + @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; @Inject Gff3TranscriptLocationExecutor gff3TranscriptLocationExecutor; @Inject Gff3TranscriptGeneExecutor gff3TranscriptGeneExecutor; @Inject Gff3TranscriptCDSExecutor gff3TranscriptCDSExecutor; @Inject Gff3TranscriptExonExecutor gff3TranscriptExonExecutor; - - - + @Override @PostConstruct protected void init() { @@ -41,11 +41,28 @@ protected void init() { @Override public APIResponse updateTranscripts(String dataProvider, String assembly, List gffData) { - gff3TranscriptExecutor.runLoadApi(dataProvider, assembly, gffData); - gff3TranscriptLocationExecutor.runLoadApi(dataProvider, assembly, gffData); - gff3TranscriptGeneExecutor.runLoadApi(dataProvider, assembly, gffData); - gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); - return gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); + BulkLoadFileHistory history = new BulkLoadFileHistory(); + LoadHistoryResponce resp = (LoadHistoryResponce) gff3TranscriptExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptLocationExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptGeneExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + return new LoadHistoryResponce(history); } @Override diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index a1c1bfefd..ae74b8687 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -52,8 +52,7 @@ private void loadRequiredEntities() throws Exception { createSoTerm("SO:0001035", "piRNA", false); createSoTerm("SO:0000147", "exon", false); createSoTerm("SO:0000316", "CDS", false); - createGene("WB:WBGene00022276", "NCBITaxon:6239", false, getVocabularyTerm( - getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY), "nomenclature_symbol")); + createGene("WB:WBGene00022276", "NCBITaxon:6239", false, getVocabularyTerm(getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY), "nomenclature_symbol")); } @Test @@ -61,7 +60,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 1, 0, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 5, 0, 9); RestAssured.given(). when(). @@ -90,7 +89,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 1, 0, 2); + checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 3, 0, 5); RestAssured.given(). when(). @@ -121,7 +120,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 1, 0, 2); + checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 3, 0, 5); RestAssured.given(). when(). @@ -154,7 +153,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 1, 0, 2); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 5, 0, 9); RestAssured.given(). when(). @@ -180,33 +179,42 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { @Test @Order(5) public void gff3DataBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", 4, 1, 3); + int total = 5; + int failed = 1; + int completed = 8; + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", total, failed, completed); } - + @Test @Order(6) public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", 1, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", 4, 1, 3); + int total = 5; + int failed = 1; + int completed = 8; + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", total, failed, completed); } - + @Test @Order(7) public void gff3DataBulkUploadInvalidFields() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", 1, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 4, 1, 3); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", 4, 1, 3); + int total = 5; + int failed = 1; + int completed = 8; + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", total, failed, completed); } } From 7ad4d9e215faf48f8371f50684d7bffd0f587e26 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 30 Aug 2024 14:52:03 -0600 Subject: [PATCH 162/342] Removed exceptions --- .../curation_api/jobs/executors/Gff3CDSLocationExecutor.java | 1 - .../curation_api/jobs/executors/Gff3ExonLocationExecutor.java | 1 - .../jobs/executors/Gff3TranscriptLocationExecutor.java | 1 - 3 files changed, 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java index cecc01c56..58a68dc23 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java @@ -114,7 +114,6 @@ private void loadLocationAssociations(BulkLoadFileHistory history, List Date: Fri, 30 Aug 2024 10:01:31 +0100 Subject: [PATCH 163/342] SCRUM-3952: fix to save exceptions in DB a --- .../curation_api/response/APIResponse.java | 16 +++++++--------- .../GeneExpressionAnnotationFmsDTOValidator.java | 2 -- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java b/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java index f64a13adb..5326c1cec 100644 --- a/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java +++ b/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java @@ -1,17 +1,15 @@ package org.alliancegenome.curation_api.response; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - +import com.fasterxml.jackson.annotation.JsonView; +import lombok.Data; import org.alliancegenome.curation_api.view.View; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; -import com.fasterxml.jackson.annotation.JsonView; - -import lombok.Data; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; @Data public class APIResponse { @@ -50,7 +48,7 @@ public void addErrorMessages(String fieldName, Integer rowIndex, Object fieldErr } public boolean hasErrors() { - return StringUtils.isNotEmpty(errorMessage) || MapUtils.isNotEmpty(errorMessages); + return StringUtils.isNotEmpty(errorMessage) || MapUtils.isNotEmpty(errorMessages) || MapUtils.isNotEmpty(supplementalData); } public String errorMessagesString() { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 5467b1eb3..22437b279 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -119,7 +119,6 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse anatomicalSiteObjectResponse = validateAnatomicalSite(geneExpressionFmsDTO); if (anatomicalSiteObjectResponse.hasErrors()) { response.addErrorMessages("whereExpressed", anatomicalSiteObjectResponse.getErrorMessages()); - throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { geneExpressionAnnotation.setWhereExpressedStatement(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement()); AnatomicalSite anatomicalSite = updateAnatomicalSite(anatomicalSiteObjectResponse, geneExpressionAnnotation); @@ -129,7 +128,6 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse temporalContextObjectResponse = validateTemporalContext(geneExpressionFmsDTO); if (temporalContextObjectResponse.hasErrors()) { response.addErrorMessages("whenExpressed", temporalContextObjectResponse.getErrorMessages()); - throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { geneExpressionAnnotation.setWhenExpressedStageName(geneExpressionFmsDTO.getWhenExpressed().getStageName()); TemporalContext temporalContext = updateTemporalContext(temporalContextObjectResponse, geneExpressionAnnotation); From f388c5f58cfedb89c85cab1c4c665edeffd2f400 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Tue, 3 Sep 2024 15:41:25 +0100 Subject: [PATCH 164/342] SCRUM-3952: change to errorMessagesString --- .../curation_api/response/APIResponse.java | 16 +++++++++------- .../GeneExpressionAnnotationFmsDTOValidator.java | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java b/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java index 5326c1cec..f64a13adb 100644 --- a/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java +++ b/src/main/java/org/alliancegenome/curation_api/response/APIResponse.java @@ -1,16 +1,18 @@ package org.alliancegenome.curation_api.response; -import com.fasterxml.jackson.annotation.JsonView; -import lombok.Data; -import org.alliancegenome.curation_api.view.View; -import org.apache.commons.collections.MapUtils; -import org.apache.commons.lang3.StringUtils; - import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import org.alliancegenome.curation_api.view.View; +import org.apache.commons.collections.MapUtils; +import org.apache.commons.lang3.StringUtils; + +import com.fasterxml.jackson.annotation.JsonView; + +import lombok.Data; + @Data public class APIResponse { @@ -48,7 +50,7 @@ public void addErrorMessages(String fieldName, Integer rowIndex, Object fieldErr } public boolean hasErrors() { - return StringUtils.isNotEmpty(errorMessage) || MapUtils.isNotEmpty(errorMessages) || MapUtils.isNotEmpty(supplementalData); + return StringUtils.isNotEmpty(errorMessage) || MapUtils.isNotEmpty(errorMessages); } public String errorMessagesString() { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 22437b279..c6006790a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -64,7 +64,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse singleReferenceResponse = validateEvidence(geneExpressionFmsDTO); if (singleReferenceResponse.hasErrors()) { - response.addErrorMessages("singleReference", singleReferenceResponse.getErrorMessages()); + response.addErrorMessages("singleReference", singleReferenceResponse.errorMessagesString()); throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { String referenceCurie = singleReferenceResponse.getEntity().getCurie(); @@ -118,7 +118,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse anatomicalSiteObjectResponse = validateAnatomicalSite(geneExpressionFmsDTO); if (anatomicalSiteObjectResponse.hasErrors()) { - response.addErrorMessages("whereExpressed", anatomicalSiteObjectResponse.getErrorMessages()); + response.addErrorMessages("whereExpressed", anatomicalSiteObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhereExpressedStatement(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement()); AnatomicalSite anatomicalSite = updateAnatomicalSite(anatomicalSiteObjectResponse, geneExpressionAnnotation); @@ -127,7 +127,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse temporalContextObjectResponse = validateTemporalContext(geneExpressionFmsDTO); if (temporalContextObjectResponse.hasErrors()) { - response.addErrorMessages("whenExpressed", temporalContextObjectResponse.getErrorMessages()); + response.addErrorMessages("whenExpressed", temporalContextObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhenExpressedStageName(geneExpressionFmsDTO.getWhenExpressed().getStageName()); TemporalContext temporalContext = updateTemporalContext(temporalContextObjectResponse, geneExpressionAnnotation); From 5130a0fd6313fcbc82f821bf583f6193e15554b9 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Tue, 3 Sep 2024 15:52:11 +0100 Subject: [PATCH 165/342] SCRUM-3952: change to errorMessagesString --- .../dto/fms/GeneExpressionAnnotationFmsDTOValidator.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index c6006790a..80a584c70 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -64,7 +64,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse singleReferenceResponse = validateEvidence(geneExpressionFmsDTO); if (singleReferenceResponse.hasErrors()) { - response.addErrorMessages("singleReference", singleReferenceResponse.errorMessagesString()); + response.addErrorMessage("singleReference", singleReferenceResponse.errorMessagesString()); throw new ObjectValidationException(geneExpressionFmsDTO, response.errorMessagesString()); } else { String referenceCurie = singleReferenceResponse.getEntity().getCurie(); @@ -118,7 +118,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse anatomicalSiteObjectResponse = validateAnatomicalSite(geneExpressionFmsDTO); if (anatomicalSiteObjectResponse.hasErrors()) { - response.addErrorMessages("whereExpressed", anatomicalSiteObjectResponse.errorMessagesString()); + response.addErrorMessage("whereExpressed", anatomicalSiteObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhereExpressedStatement(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement()); AnatomicalSite anatomicalSite = updateAnatomicalSite(anatomicalSiteObjectResponse, geneExpressionAnnotation); @@ -127,7 +127,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse temporalContextObjectResponse = validateTemporalContext(geneExpressionFmsDTO); if (temporalContextObjectResponse.hasErrors()) { - response.addErrorMessages("whenExpressed", temporalContextObjectResponse.errorMessagesString()); + response.addErrorMessage("whenExpressed", temporalContextObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhenExpressedStageName(geneExpressionFmsDTO.getWhenExpressed().getStageName()); TemporalContext temporalContext = updateTemporalContext(temporalContextObjectResponse, geneExpressionAnnotation); From e8ef14074ec861a5eacd4d61c13fc0af1c10bdb8 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 14:12:05 -0600 Subject: [PATCH 166/342] Remove and add back FK's --- .../db/migration/v0.37.0.24__remove_dataprovider_dups.sql | 4 ++++ .../db/migration/v0.37.0.46__remove_dataprovider_dups.sql | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql index bbf4d76f0..715462dfb 100644 --- a/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.24__remove_dataprovider_dups.sql @@ -31,3 +31,7 @@ CREATE INDEX crossreference_ids_to_delete_index ON crossreference_ids_to_delete INSERT INTO dataprovider_ids_to_delete (id) select dp.id from dataprovider dp left join dataprovider_ids_to_keep dk on dp.id = dk.id where dk.id is null; CREATE INDEX dataprovider_ids_to_delete_index ON dataprovider_ids_to_delete USING btree (id); + +ALTER TABLE ONLY phenotypeannotation DROP CONSTRAINT crossreference_id_fk; +ALTER TABLE ONLY dataprovider DROP CONSTRAINT dataprovider_crossreference_id_fk; +ALTER TABLE ONLY externaldatabaseentity DROP CONSTRAINT externaldatabaseentity_preferredcrossreference_id; diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql index 2ae4b3777..16082183c 100644 --- a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -4,6 +4,10 @@ DROP TABLE dataprovider_ids_to_keep; DROP TABLE crossreference_ids_to_delete; DROP TABLE dataprovider_ids_to_delete; +ALTER TABLE ONLY public.phenotypeannotation ADD CONSTRAINT crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES public.crossreference(id); +ALTER TABLE ONLY public.dataprovider ADD CONSTRAINT dataprovider_crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES public.crossreference(id); +ALTER TABLE ONLY public.externaldatabaseentity ADD CONSTRAINT externaldatabaseentity_preferredcrossreference_id FOREIGN KEY (preferredcrossreference_id) REFERENCES public.crossreference(id); + -- Migration to switch bulk load file and history around ALTER TABLE bulkloadfilehistory ADD COLUMN bulkload_id bigint; From 0b0bdf0299c4546eac0904121d0273c5a7a31a5d Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 14:13:50 -0600 Subject: [PATCH 167/342] Updated constraints --- .../db/migration/v0.37.0.46__remove_dataprovider_dups.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql index 16082183c..c9eda5500 100644 --- a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -4,9 +4,9 @@ DROP TABLE dataprovider_ids_to_keep; DROP TABLE crossreference_ids_to_delete; DROP TABLE dataprovider_ids_to_delete; -ALTER TABLE ONLY public.phenotypeannotation ADD CONSTRAINT crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES public.crossreference(id); -ALTER TABLE ONLY public.dataprovider ADD CONSTRAINT dataprovider_crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES public.crossreference(id); -ALTER TABLE ONLY public.externaldatabaseentity ADD CONSTRAINT externaldatabaseentity_preferredcrossreference_id FOREIGN KEY (preferredcrossreference_id) REFERENCES public.crossreference(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); +ALTER TABLE ONLY dataprovider ADD CONSTRAINT dataprovider_crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); +ALTER TABLE ONLY externaldatabaseentity ADD CONSTRAINT externaldatabaseentity_preferredcrossreference_id FOREIGN KEY (preferredcrossreference_id) REFERENCES crossreference(id); -- Migration to switch bulk load file and history around From bf823a10ce2da2467b55141bacb9e4127800270f Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 15:46:03 -0600 Subject: [PATCH 168/342] Turned off the loads by default --- .../db/migration/v0.37.0.46__remove_dataprovider_dups.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql index c9eda5500..a6148f5f1 100644 --- a/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql +++ b/src/main/resources/db/migration/v0.37.0.46__remove_dataprovider_dups.sql @@ -143,7 +143,7 @@ INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) S INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'XBXT GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'GFF_TRANSCRIPT_CDS', 'ZFIN GFF Transcript CDS Association Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) GFF Loads'; -INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype in( +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype in( 'GFF_TRANSCRIPT', 'GFF_CDS', 'GFF_EXON', 'GFF_EXON_LOCATION', 'GFF_CDS_LOCATION', 'GFF_TRANSCRIPT_LOCATION', 'GFF_TRANSCRIPT_GENE', 'GFF_TRANSCRIPT_EXON', 'GFF_TRANSCRIPT_CDS' From ea89bcc0be512a6a7f70e19ee6fbe01994f6fead Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 22:25:39 -0600 Subject: [PATCH 169/342] Split out data for smaller memory footprint --- .../crud/CodingSequenceCrudController.java | 6 +- .../controllers/crud/ExonCrudController.java | 6 +- .../crud/TranscriptCrudController.java | 10 +- .../jobs/executors/BulkLoadJobExecutor.java | 9 + .../jobs/executors/Gff3Executor.java | 74 ------ .../executors/{ => gff}/Gff3CDSExecutor.java | 55 +++-- .../{ => gff}/Gff3CDSLocationExecutor.java | 15 +- .../jobs/executors/gff/Gff3Executor.java | 40 +++ .../executors/{ => gff}/Gff3ExonExecutor.java | 54 ++-- .../{ => gff}/Gff3ExonLocationExecutor.java | 15 +- .../{ => gff}/Gff3TranscriptCDSExecutor.java | 21 +- .../{ => gff}/Gff3TranscriptExecutor.java | 25 +- .../{ => gff}/Gff3TranscriptExonExecutor.java | 23 +- .../{ => gff}/Gff3TranscriptGeneExecutor.java | 21 +- .../Gff3TranscriptLocationExecutor.java | 15 +- .../curation_api/services/Gff3Service.java | 231 ++++++++---------- .../helpers/gff3/Gff3AttributesHelper.java | 68 ++++++ .../validation/dto/Gff3DtoValidator.java | 13 +- 18 files changed, 367 insertions(+), 334 deletions(-) delete mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3CDSExecutor.java (83%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3CDSLocationExecutor.java (90%) create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3ExonExecutor.java (82%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3ExonLocationExecutor.java (90%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3TranscriptCDSExecutor.java (87%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3TranscriptExecutor.java (82%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3TranscriptExonExecutor.java (85%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3TranscriptGeneExecutor.java (86%) rename src/main/java/org/alliancegenome/curation_api/jobs/executors/{ => gff}/Gff3TranscriptLocationExecutor.java (90%) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java index 8b45a1a03..206a7878c 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/CodingSequenceCrudController.java @@ -5,9 +5,9 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.interfaces.crud.CodingSequenceCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3CDSExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3CDSLocationExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptCDSExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3CDSExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3CDSLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptCDSExecutor; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java index 714d743b9..be499d5a3 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/ExonCrudController.java @@ -5,9 +5,9 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.interfaces.crud.ExonCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3ExonExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3ExonLocationExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3ExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3ExonLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExonExecutor; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index a7979b864..66f391198 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -5,11 +5,11 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.TranscriptDAO; import org.alliancegenome.curation_api.interfaces.crud.TranscriptCrudInterface; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptCDSExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptExonExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptGeneExecutor; -import org.alliancegenome.curation_api.jobs.executors.Gff3TranscriptLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptCDSExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptGeneExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptLocationExecutor; import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; 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 f6490947b..1619fc0d0 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 @@ -19,6 +19,15 @@ import org.alliancegenome.curation_api.enums.BackendBulkLoadType; import org.alliancegenome.curation_api.jobs.executors.associations.alleleAssociations.AlleleGeneAssociationExecutor; 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.Gff3CDSLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3ExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3ExonLocationExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptCDSExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptExonExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptGeneExecutor; +import org.alliancegenome.curation_api.jobs.executors.gff.Gff3TranscriptLocationExecutor; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import jakarta.enterprise.context.ApplicationScoped; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java deleted file mode 100644 index 2db33f4e1..000000000 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3Executor.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.alliancegenome.curation_api.jobs.executors; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; -import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; -import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; -import org.alliancegenome.curation_api.services.Gff3Service; -import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; -import org.alliancegenome.curation_api.util.ProcessDisplayHelper; -import org.apache.commons.lang3.tuple.ImmutablePair; - -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; - -@ApplicationScoped -public class Gff3Executor extends LoadFileExecutor { - - @Inject Gff3Service gff3Service; - - protected String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { - try { - assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); - history.incrementCompleted(); - } catch (ObjectUpdateException e) { - //e.printStackTrace(); - history.incrementFailed(); - addException(history, e.getData()); - } catch (Exception e) { - e.printStackTrace(); - history.incrementFailed(); - addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); - } - updateHistory(history); - ph.progressProcess(); - - return assemblyName; - } - - protected List>> preProcessGffData(List gffData, BackendBulkDataProvider dataProvider) { - List>> processedGffData = new ArrayList<>(); - - ProcessDisplayHelper ph = new ProcessDisplayHelper(); - ph.addDisplayHandler(loadProcessDisplayService); - ph.startProcess("GFF pre-processing for " + dataProvider.name(), gffData.size()); - - for (Gff3DTO originalGffEntry : gffData) { - Map attributes = Gff3AttributesHelper.getAttributes(originalGffEntry, dataProvider); - if (attributes.containsKey("Parent") && attributes.get("Parent").indexOf(",") > -1) { - for (String parent : attributes.get("Parent").split(",")) { - HashMap attributesCopy = new HashMap<>(); - attributesCopy.putAll(attributes); - String[] parentIdParts = parent.split(":"); - if (parentIdParts.length == 1) { - parent = dataProvider.name() + ':' + parentIdParts[0]; - } - attributesCopy.put("Parent", parent); - processedGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); - } - } else { - processedGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); - } - ph.progressProcess(); - } - ph.finishProcess(); - - return processedGffData; - } -} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java similarity index 83% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java index faecca58d..201d47c0c 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -10,6 +10,7 @@ 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.CodingSequence; 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; @@ -17,6 +18,8 @@ import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.CodingSequenceService; import org.alliancegenome.curation_api.services.Gff3Service; +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; @@ -33,6 +36,7 @@ public class Gff3CDSExecutor extends Gff3Executor { @Inject Gff3Service gff3Service; @Inject CodingSequenceService cdsService; + @Inject Gff3DtoValidator gff3DtoValidator; public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -54,16 +58,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedCDSGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedCDSGffData, idsAdded, dataProvider); if (success) { runCleanup(cdsService, bulkLoadFileHistory, dataProvider.name(), cdsService.getIdsByDataProvider(dataProvider), idsAdded, "GFF coding sequence"); @@ -82,31 +86,13 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF CDS update for " + dataProvider.name(), gffData.size()); - loadCDSEntities(history, gffData, idsAdded, dataProvider, ph); - - ph.finishProcess(); - - return true; - } - - public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { - List idsAdded = new ArrayList<>(); - BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); - - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); - history.finishLoad(); - - return new LoadHistoryResponce(history); - } - - - private void loadCDSEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { - gff3Service.loadCDSEntity(history, gff3EntryPair, idsAdded, dataProvider); + CodingSequence cds = gff3DtoValidator.validateCdsEntry(gff3EntryPair.getKey(), gff3EntryPair.getValue(), dataProvider); + if (cds != null) { + idsAdded.add(cds.getId()); + } history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -119,7 +105,22 @@ private void loadCDSEntities(BulkLoadFileHistory history, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedCDSGffData.size()); + + runLoad(history, null, preProcessedCDSGffData, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSLocationExecutor.java similarity index 90% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSLocationExecutor.java index 58a68dc23..83e1703df 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3CDSLocationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSLocationExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.codingSequenceAssociations.CodingSequenceGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedCDSGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedCDSGffData, idsAdded, dataProvider, null); if (success) { runCleanup(cdsLocationService, bulkLoadFileHistory, dataProvider.name(), cdsLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF coding sequence genomic location association"); @@ -98,10 +99,10 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedCDSGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedCDSGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java new file mode 100644 index 000000000..fed9dd4a3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java @@ -0,0 +1,40 @@ +package org.alliancegenome.curation_api.jobs.executors.gff; + +import java.util.List; + +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; +import org.alliancegenome.curation_api.jobs.executors.LoadFileExecutor; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.services.Gff3Service; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class Gff3Executor extends LoadFileExecutor { + + @Inject Gff3Service gff3Service; + + protected String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { + try { + assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); + history.incrementCompleted(); + } catch (ObjectUpdateException e) { + //e.printStackTrace(); + history.incrementFailed(); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); + } + updateHistory(history); + ph.progressProcess(); + + return assemblyName; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java similarity index 82% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java index 35b37b6c1..6e2e6d596 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -10,12 +10,15 @@ 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.Exon; 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.ExonService; +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; @@ -31,6 +34,7 @@ public class Gff3ExonExecutor extends Gff3Executor { @Inject ExonService exonService; + @Inject Gff3DtoValidator gff3DtoValidator; public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -52,16 +56,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedExonGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedExonGffData, idsAdded, dataProvider); if (success) { runCleanup(exonService, bulkLoadFileHistory, dataProvider.name(), exonService.getIdsByDataProvider(dataProvider), idsAdded, "GFF exon"); } @@ -80,31 +84,13 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Exon update for " + dataProvider.name(), gffData.size()); - loadExonEntities(history, gffData, idsAdded, dataProvider, ph); - - ph.finishProcess(); - - return true; - } - - public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { - List idsAdded = new ArrayList(); - BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); - - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); - history.finishLoad(); - - return new LoadHistoryResponce(history); - } - - - private void loadExonEntities(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, ProcessDisplayHelper ph) { updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { - gff3Service.loadExonEntity(history, gff3EntryPair, idsAdded, dataProvider); + Exon exon = gff3DtoValidator.validateExonEntry(gff3EntryPair.getKey(), gff3EntryPair.getValue(), dataProvider); + if (exon != null) { + idsAdded.add(exon.getId()); + } history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); @@ -118,6 +104,22 @@ private void loadExonEntities(BulkLoadFileHistory history, List gffData) { + List idsAdded = new ArrayList(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedExonGffData.size()); + + runLoad(history, null, preProcessedExonGffData, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonLocationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonLocationExecutor.java similarity index 90% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonLocationExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonLocationExecutor.java index 0c7ee92bf..7063df784 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3ExonLocationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonLocationExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.exonAssociations.ExonGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedExonGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedExonGffData, idsAdded, dataProvider, null); if (success) { runCleanup(exonLocationService, bulkLoadFileHistory, dataProvider.name(), exonLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF exon genomic location association"); @@ -98,10 +99,10 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedExonGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedExonGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java similarity index 87% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java index bdeb7a100..a91b5cdaa 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptCDSExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptCodingSequenceAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedCDSGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedCDSGffData, idsAdded, dataProvider, null); if (success) { runCleanup(transcriptCdsService, bulkLoadFileHistory, dataProvider.name(), transcriptCdsService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript coding sequence association"); @@ -88,7 +89,7 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, return false; } else { Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); } ph.finishProcess(); @@ -98,20 +99,20 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedCDSGffData = Gff3AttributesHelper.getCDSGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedCDSGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedCDSGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); } - private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap, ProcessDisplayHelper ph) { updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { - gff3Service.loadCDSParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadCDSParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java similarity index 82% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java index 3c9f76bbd..8ef6e17c2 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -10,12 +10,15 @@ 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.Transcript; 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.TranscriptService; +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; @@ -31,7 +34,8 @@ public class Gff3TranscriptExecutor extends Gff3Executor { @Inject TranscriptService transcriptService; - + @Inject Gff3DtoValidator gff3DtoValidator; + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { try { @@ -52,16 +56,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedTranscriptGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, idsAdded, dataProvider); if (success) { runCleanup(transcriptService, bulkLoadFileHistory, dataProvider.name(), transcriptService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript"); @@ -90,10 +94,10 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedTranscriptGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider); + runLoad(history, null, preProcessedTranscriptGffData, idsAdded, dataProvider); history.finishLoad(); return new LoadHistoryResponce(history); @@ -103,7 +107,10 @@ private void loadTranscriptEntities(BulkLoadFileHistory history, List> gff3EntryPair : gffData) { try { - gff3Service.loadTranscriptEntity(history, gff3EntryPair, idsAdded, dataProvider); + Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gff3EntryPair.getKey(), gff3EntryPair.getValue(), dataProvider); + if (transcript != null) { + idsAdded.add(transcript.getId()); + } history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java similarity index 85% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java index 3d9bb8ea0..40555da29 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptExonExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedExonGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedExonGffData, idsAdded, dataProvider, null); if (success) { runCleanup(transcriptExonService, bulkLoadFileHistory, dataProvider.name(), transcriptExonService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript exon association"); @@ -81,14 +82,14 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Transcript Exon update for " + dataProvider.name(), gffData.size()); - assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); + assemblyId = loadGenomeAssembly(null, history, gffHeaderData, dataProvider, ph); if (assemblyId == null) { failLoad(history, new Exception("GFF Header does not contain assembly")); return false; } else { Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); } ph.finishProcess(); @@ -98,20 +99,20 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedExonGffData = Gff3AttributesHelper.getExonGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedExonGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedExonGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); } - private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap, ProcessDisplayHelper ph) { updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { - gff3Service.loadExonParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadExonParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java similarity index 86% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java index 166dfd549..2fc8f7163 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptGeneExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedTranscriptGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, idsAdded, dataProvider, null); if (success) { runCleanup(transcriptGeneService, bulkLoadFileHistory, dataProvider.name(), transcriptGeneService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript gene association"); @@ -88,7 +89,7 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, return false; } else { Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, assemblyId, geneIdCurieMap, ph); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); } ph.finishProcess(); @@ -98,20 +99,20 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedTranscriptGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedTranscriptGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); } - private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap, ProcessDisplayHelper ph) { + private void loadParentChildAssociations(BulkLoadFileHistory history, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap, ProcessDisplayHelper ph) { updateHistory(history); for (ImmutablePair> gff3EntryPair : gffData) { try { - gff3Service.loadGeneParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadGeneParentChildAssociations(history, gff3EntryPair, idsAdded, dataProvider, geneIdCurieMap); history.incrementCompleted(); } catch (ObjectUpdateException e) { history.incrementFailed(); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptLocationExecutor.java similarity index 90% rename from src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java rename to src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptLocationExecutor.java index 456482a1b..a59131bab 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/Gff3TranscriptLocationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptLocationExecutor.java @@ -1,4 +1,4 @@ -package org.alliancegenome.curation_api.jobs.executors; +package org.alliancegenome.curation_api.jobs.executors.gff; import java.io.FileInputStream; import java.util.ArrayList; @@ -16,6 +16,7 @@ import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.LoadHistoryResponce; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.tuple.ImmutablePair; @@ -52,16 +53,16 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fmsLoad = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); gffData.clear(); List idsAdded = new ArrayList<>(); - bulkLoadFileHistory.setTotalRecords((long) preProcessedGffData.size()); + bulkLoadFileHistory.setTotalRecords((long) preProcessedTranscriptGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, idsAdded, dataProvider, null); if (success) { runCleanup(transcriptLocationService, bulkLoadFileHistory, dataProvider.name(), transcriptLocationService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript genomic location association"); @@ -98,10 +99,10 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, public APIResponse runLoadApi(String dataProviderName, String assemblyName, List gffData) { List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); - List>> preProcessedGffData = preProcessGffData(gffData, dataProvider); - BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedGffData.size()); + List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); + BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedTranscriptGffData.size()); - runLoad(history, null, preProcessedGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedTranscriptGffData, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); 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 792468ea4..208bb51b2 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -60,45 +60,6 @@ public class Gff3Service { @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject Gff3DtoValidator gff3DtoValidator; - @Transactional - public void loadExonEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); - if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - Exon exon = gff3DtoValidator.validateExonEntry(gffEntry, attributes, dataProvider); - if (exon != null) { - idsAdded.add(exon.getId()); - } - } - } - - @Transactional - public void loadCDSEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); - if (StringUtils.equals(gffEntry.getType(), "CDS")) { - CodingSequence cds = gff3DtoValidator.validateCdsEntry(gffEntry, attributes, dataProvider); - if (cds != null) { - idsAdded.add(cds.getId()); - } - } - } - - @Transactional - public void loadTranscriptEntity(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { - Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); - if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { - if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { - gffEntry.setType("lncRNA"); - } - Transcript transcript = gff3DtoValidator.validateTranscriptEntry(gffEntry, attributes, dataProvider); - if (transcript != null) { - idsAdded.add(transcript.getId()); - } - } - } - @Transactional public String loadGenomeAssembly(String assemblyName, List gffHeaderData, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { @@ -134,25 +95,28 @@ public String loadGenomeAssembly(String assemblyName, List gffHeaderData @Transactional public void loadExonLocationAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); + if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); - SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); - } - Exon exon = response.getSingleResult(); + if (!StringUtils.equals(gffEntry.getType(), "exon") && !StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Exon Location"); + } - ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assemblyId, dataProvider); - if (exonLocation != null) { - idsAdded.add(exonLocation.getId()); - exonLocationService.addAssociationToSubject(exonLocation); - } + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, gffEntryPair.getValue(), dataProvider); + SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); } + Exon exon = response.getSingleResult(); + + ExonGenomicLocationAssociation exonLocation = gff3DtoValidator.validateExonLocation(gffEntry, exon, assemblyId, dataProvider); + if (exonLocation != null) { + idsAdded.add(exonLocation.getId()); + exonLocationService.addAssociationToSubject(exonLocation); + } + } @Transactional @@ -162,20 +126,24 @@ public void loadCDSLocationAssociations(BulkLoadFileHistory history, ImmutablePa if (StringUtils.isBlank(assemblyId)) { throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - if (StringUtils.equals(gffEntry.getType(), "CDS")) { - String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); - SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); - } - CodingSequence cds = response.getSingleResult(); - CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); - if (cdsLocation != null) { - idsAdded.add(cdsLocation.getId()); - cdsLocationService.addAssociationToSubject(cdsLocation); - } + if (!StringUtils.equals(gffEntry.getType(), "CDS")) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for CDS Location"); + } + + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + CodingSequence cds = response.getSingleResult(); + + CodingSequenceGenomicLocationAssociation cdsLocation = gff3DtoValidator.validateCdsLocation(gffEntry, cds, assemblyId, dataProvider); + if (cdsLocation != null) { + idsAdded.add(cdsLocation.getId()); + cdsLocationService.addAssociationToSubject(cdsLocation); } + } @Transactional @@ -186,100 +154,95 @@ public void loadTranscriptLocationAssociations(BulkLoadFileHistory history, Immu throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); } - if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { - if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { - gffEntry.setType("lncRNA"); - } - if (!attributes.containsKey("ID")) { - throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); - } - SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); - } - Transcript transcript = response.getSingleResult(); + if (!Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Transcript Location"); + } - TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); - if (transcriptLocation != null) { - idsAdded.add(transcriptLocation.getId()); - transcriptLocationService.addAssociationToSubject(transcriptLocation); - } + if (!attributes.containsKey("ID")) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); + } + SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); + } + Transcript transcript = response.getSingleResult(); + + TranscriptGenomicLocationAssociation transcriptLocation = gff3DtoValidator.validateTranscriptLocation(gffEntry, transcript, assemblyId, dataProvider); + if (transcriptLocation != null) { + idsAdded.add(transcriptLocation.getId()); + transcriptLocationService.addAssociationToSubject(transcriptLocation); } } - + @Transactional - public void loadExonParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadExonParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); - Map attributes = gffEntryPair.getValue(); - if (StringUtils.isBlank(assemblyId)) { - throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + + if (!StringUtils.equals(gffEntry.getType(), "exon") && !StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Exon Transcript Associations"); } - if (StringUtils.equals(gffEntry.getType(), "exon") || StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { - String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); - SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); - } - Exon exon = response.getSingleResult(); + Map attributes = gffEntryPair.getValue(); + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = exonDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + Exon exon = response.getSingleResult(); - TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); - if (transcriptAssociation != null) { - idsAdded.add(transcriptAssociation.getId()); - transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); - } + TranscriptExonAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptExonAssociation(gffEntry, exon, attributes); + if (transcriptAssociation != null) { + idsAdded.add(transcriptAssociation.getId()); + transcriptExonService.addAssociationToSubjectAndObject(transcriptAssociation); } + } - + @Transactional - public void loadCDSParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadCDSParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); - if (StringUtils.isBlank(assemblyId)) { - throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + + if (!StringUtils.equals(gffEntry.getType(), "CDS")) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for CDS Transcript Associations"); } - if (StringUtils.equals(gffEntry.getType(), "CDS")) { - String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); - SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); - } - CodingSequence cds = response.getSingleResult(); - TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); - if (transcriptAssociation != null) { - idsAdded.add(transcriptAssociation.getId()); - transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); - } + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(gffEntry, attributes, dataProvider); + SearchResponse response = cdsDAO.findByField("uniqueId", uniqueId); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "uniqueId - " + ValidationConstants.INVALID_MESSAGE + " (" + uniqueId + ")"); + } + CodingSequence cds = response.getSingleResult(); + + TranscriptCodingSequenceAssociation transcriptAssociation = gff3DtoValidator.validateTranscriptCodingSequenceAssociation(gffEntry, cds, attributes); + if (transcriptAssociation != null) { + idsAdded.add(transcriptAssociation.getId()); + transcriptCdsService.addAssociationToSubjectAndObject(transcriptAssociation); } } @Transactional - public void loadGeneParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadGeneParentChildAssociations(BulkLoadFileHistory history, ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { Gff3DTO gffEntry = gffEntryPair.getKey(); + if (!Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { + throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Gene Transcript Associations"); + } + Map attributes = gffEntryPair.getValue(); - if (StringUtils.isBlank(assemblyId)) { - throw new ObjectValidationException(gffEntry, "Cannot load associations without assembly"); + if (!attributes.containsKey("ID")) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); } - if (Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { - if (StringUtils.equals(gffEntry.getType(), "lnc_RNA")) { - gffEntry.setType("lncRNA"); - } - if (!attributes.containsKey("ID")) { - throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.REQUIRED_MESSAGE); - } - SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); - if (response == null || response.getSingleResult() == null) { - throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); - } - Transcript transcript = response.getSingleResult(); + SearchResponse response = transcriptDAO.findByField("modInternalId", attributes.get("ID")); + if (response == null || response.getSingleResult() == null) { + throw new ObjectValidationException(gffEntry, "attributes - ID - " + ValidationConstants.INVALID_MESSAGE + " (" + attributes.get("ID") + ")"); + } + Transcript transcript = response.getSingleResult(); - TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes, geneIdCurieMap); - if (geneAssociation != null) { - idsAdded.add(geneAssociation.getId()); - transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); - } + TranscriptGeneAssociation geneAssociation = gff3DtoValidator.validateTranscriptGeneAssociation(gffEntry, transcript, attributes, geneIdCurieMap); + if (geneAssociation != null) { + idsAdded.add(geneAssociation.getId()); + transcriptGeneService.addAssociationToSubjectAndObject(geneAssociation); } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index ef6eef1c3..2f2c0f51b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -5,10 +5,13 @@ import java.util.List; import java.util.Map; +import org.alliancegenome.curation_api.constants.Gff3Constants; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.ingest.dto.fms.Gff3DTO; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; public class Gff3AttributesHelper { @@ -49,5 +52,70 @@ public static Map getAttributes(Gff3DTO dto, BackendBulkDataProv return attributes; } + + public static List>> getExonGffData(List gffData, BackendBulkDataProvider dataProvider) { + List>> retGffData = new ArrayList<>(); + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.startProcess("GFF Exon pre-processing for " + dataProvider.name(), gffData.size()); + for (Gff3DTO originalGffEntry : gffData) { + if (StringUtils.equals(originalGffEntry.getType(), "exon") || StringUtils.equals(originalGffEntry.getType(), "noncoding_exon")) { + processGffEntry(originalGffEntry, retGffData, dataProvider); + } + ph.progressProcess(); + } + ph.finishProcess(); + return retGffData; + } + + public static List>> getCDSGffData(List gffData, BackendBulkDataProvider dataProvider) { + List>> retGffData = new ArrayList<>(); + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.startProcess("GFF CDS pre-processing for " + dataProvider.name(), gffData.size()); + for (Gff3DTO originalGffEntry : gffData) { + if (StringUtils.equals(originalGffEntry.getType(), "CDS")) { + processGffEntry(originalGffEntry, retGffData, dataProvider); + } + ph.progressProcess(); + } + ph.finishProcess(); + return retGffData; + } + + + public static List>> getTranscriptGffData(List gffData, BackendBulkDataProvider dataProvider) { + List>> retGffData = new ArrayList<>(); + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.startProcess("GFF Transcript pre-processing for " + dataProvider.name(), gffData.size()); + for (Gff3DTO originalGffEntry : gffData) { + if (StringUtils.equals(originalGffEntry.getType(), "lnc_RNA")) { + originalGffEntry.setType("lncRNA"); + } + if (Gff3Constants.TRANSCRIPT_TYPES.contains(originalGffEntry.getType())) { + processGffEntry(originalGffEntry, retGffData, dataProvider); + } + ph.progressProcess(); + } + ph.finishProcess(); + return retGffData; + } + + private static void processGffEntry(Gff3DTO originalGffEntry, List>> retGffData, BackendBulkDataProvider dataProvider) { + Map attributes = getAttributes(originalGffEntry, dataProvider); + if (attributes.containsKey("Parent") && attributes.get("Parent").indexOf(",") > -1) { + for (String parent : attributes.get("Parent").split(",")) { + HashMap attributesCopy = new HashMap<>(); + attributesCopy.putAll(attributes); + String[] parentIdParts = parent.split(":"); + if (parentIdParts.length == 1) { + parent = dataProvider.name() + ':' + parentIdParts[0]; + } + attributesCopy.put("Parent", parent); + retGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); + } + } else { + retGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); + } + + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 4ccaa427c..8659ab3fa 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -74,6 +74,10 @@ public class Gff3DtoValidator { public Exon validateExonEntry(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) throws ObjectValidationException { Exon exon = null; + + if (!StringUtils.equals(dto.getType(), "exon") && !StringUtils.equals(dto.getType(), "noncoding_exon")) { + throw new ObjectValidationException(dto, "Invalid Type: " + dto.getType() + " for Exon Entity"); + } String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = exonDAO.findByField("uniqueId", uniqueId); @@ -102,6 +106,10 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, Map attribut CodingSequence cds = null; + if (!StringUtils.equals(dto.getType(), "CDS")) { + throw new ObjectValidationException(dto, "Invalid Type: " + dto.getType() + " for CDS Entity"); + } + String uniqueId = Gff3UniqueIdHelper.getExonOrCodingSequenceUniqueId(dto, attributes, dataProvider); SearchResponse searchResponse = codingSequenceDAO.findByField("uniqueId", uniqueId); if (searchResponse != null && searchResponse.getSingleResult() != null) { @@ -127,8 +135,11 @@ public CodingSequence validateCdsEntry(Gff3DTO dto, Map attribut @Transactional public Transcript validateTranscriptEntry(Gff3DTO dto, Map attributes, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + if (!Gff3Constants.TRANSCRIPT_TYPES.contains(dto.getType())) { + throw new ObjectValidationException(dto, "Invalid Type: " + dto.getType() + " for Transcript Entity"); + } + Transcript transcript = null; - if (attributes.containsKey("ID")) { SearchResponse searchResponse = transcriptDAO.findByField("modInternalId", attributes.get("ID")); if (searchResponse != null && searchResponse.getSingleResult() != null) { From bcca90c49d49d2563e36f1cdef231c111b76d383 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 22:46:39 -0600 Subject: [PATCH 170/342] Removed assembly id as its not needed for the associations --- .../gff/Gff3TranscriptCDSExecutor.java | 12 +++--------- .../gff/Gff3TranscriptExonExecutor.java | 12 +++--------- .../gff/Gff3TranscriptGeneExecutor.java | 18 ++++++------------ 3 files changed, 12 insertions(+), 30 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java index a91b5cdaa..4fd75a255 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptCDSExecutor.java @@ -82,15 +82,9 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Transcript CDS update for " + dataProvider.name(), gffData.size()); - assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); - - if (assemblyId == null) { - failLoad(history, new Exception("GFF Header does not contain assembly")); - return false; - } else { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); - } + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); + ph.finishProcess(); return true; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java index 40555da29..0162208a2 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExonExecutor.java @@ -82,15 +82,9 @@ private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Transcript Exon update for " + dataProvider.name(), gffData.size()); - assemblyId = loadGenomeAssembly(null, history, gffHeaderData, dataProvider, ph); - - if (assemblyId == null) { - failLoad(history, new Exception("GFF Header does not contain assembly")); - return false; - } else { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); - } + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); + ph.finishProcess(); return true; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java index 2fc8f7163..4e58fd818 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptGeneExecutor.java @@ -62,7 +62,7 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { bulkLoadFileHistory.setTotalRecords((long) preProcessedTranscriptGffData.size()); updateHistory(bulkLoadFileHistory); - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, idsAdded, dataProvider, null); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, idsAdded, dataProvider); if (success) { runCleanup(transcriptGeneService, bulkLoadFileHistory, dataProvider.name(), transcriptGeneService.getIdsByDataProvider(dataProvider), idsAdded, "GFF transcript gene association"); @@ -76,21 +76,15 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { } } - private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { + private boolean runLoad(BulkLoadFileHistory history, List gffHeaderData, List>> gffData, List idsAdded, BackendBulkDataProvider dataProvider) { ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Transcript Gene update for " + dataProvider.name(), gffData.size()); - assemblyId = loadGenomeAssembly(assemblyId, history, gffHeaderData, dataProvider, ph); - - if (assemblyId == null) { - failLoad(history, new Exception("GFF Header does not contain assembly")); - return false; - } else { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); - } + Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); + loadParentChildAssociations(history, gffData, idsAdded, dataProvider, geneIdCurieMap, ph); + ph.finishProcess(); return true; @@ -102,7 +96,7 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); BulkLoadFileHistory history = new BulkLoadFileHistory(preProcessedTranscriptGffData.size()); - runLoad(history, null, preProcessedTranscriptGffData, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedTranscriptGffData, idsAdded, dataProvider); history.finishLoad(); return new LoadHistoryResponce(history); From 684e69b607786b05d3571f1f8e2a72f5d95005c8 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 3 Sep 2024 23:24:32 -0600 Subject: [PATCH 171/342] Fixed IT's --- .../controllers/crud/TranscriptCrudController.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index 66f391198..b225267fe 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -54,14 +54,6 @@ public APIResponse updateTranscripts(String dataProvider, String assembly, List< history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); - resp = (LoadHistoryResponce) gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); - history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); - history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); - history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); - resp = (LoadHistoryResponce) gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); - history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); - history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); - history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); return new LoadHistoryResponce(history); } From 032e375ca47c0a1f15ca8d7173aba5b5b1ef66fc Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 06:35:35 -0600 Subject: [PATCH 172/342] Fix IT's --- .../curation_api/Gff3BulkUploadITCase.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index ae74b8687..b352a5de9 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -60,7 +60,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 5, 0, 9); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 3, 0, 9); RestAssured.given(). when(). @@ -89,7 +89,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { @Test @Order(2) public void gff3DataBulkUploadExonEntity() throws Exception { - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 3, 0, 5); + checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", 3, 0, 4); RestAssured.given(). when(). @@ -120,7 +120,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { @Test @Order(3) public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 3, 0, 5); + checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", 3, 0, 4); RestAssured.given(). when(). @@ -153,7 +153,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 5, 0, 9); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 3, 0, 9); RestAssured.given(). when(). @@ -179,7 +179,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { @Test @Order(5) public void gff3DataBulkUploadMissingRequiredFields() throws Exception { - int total = 5; + int total = 3; int failed = 1; int completed = 8; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", total, failed, completed); @@ -194,7 +194,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { @Test @Order(6) public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { - int total = 5; + int total = 3; int failed = 1; int completed = 8; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", total, failed, completed); @@ -207,7 +207,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { @Test @Order(7) public void gff3DataBulkUploadInvalidFields() throws Exception { - int total = 5; + int total = 3; int failed = 1; int completed = 8; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", total, failed, completed); From 73f1cd3630b82420f6f46fd0d73fe51b32fb157e Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 06:59:34 -0600 Subject: [PATCH 173/342] Fix IT's --- .../curation_api/Gff3BulkUploadITCase.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index b352a5de9..763f42fde 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -60,7 +60,7 @@ private void loadRequiredEntities() throws Exception { public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 3, 0, 9); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", 3, 0, 4); RestAssured.given(). when(). @@ -153,7 +153,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { @Test @Order(4) public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 3, 0, 9); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", 3, 0, 4); RestAssured.given(). when(). @@ -181,7 +181,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { public void gff3DataBulkUploadMissingRequiredFields() throws Exception { int total = 3; int failed = 1; - int completed = 8; + int completed = 3; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", total, failed, completed); @@ -196,7 +196,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { int total = 3; int failed = 1; - int completed = 8; + int completed = 3; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", total, failed, completed); @@ -209,7 +209,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { public void gff3DataBulkUploadInvalidFields() throws Exception { int total = 3; int failed = 1; - int completed = 8; + int completed = 3; checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", total, failed, completed); From ac033aedb8522e506fc05e8b411e55625d6df44d Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 07:08:08 -0600 Subject: [PATCH 174/342] Fix transcript endpoint --- .../controllers/crud/TranscriptCrudController.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java index b225267fe..66f391198 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/TranscriptCrudController.java @@ -54,6 +54,14 @@ public APIResponse updateTranscripts(String dataProvider, String assembly, List< history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptCDSExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); + resp = (LoadHistoryResponce) gff3TranscriptExonExecutor.runLoadApi(dataProvider, assembly, gffData); + history.setFailedRecords(history.getFailedRecords() + resp.getHistory().getFailedRecords()); + history.setCompletedRecords(history.getCompletedRecords() + resp.getHistory().getCompletedRecords()); + history.setTotalRecords(history.getTotalRecords() + resp.getHistory().getTotalRecords()); return new LoadHistoryResponce(history); } From 9c931a47fcad8eff3d4d68d27f012c157ff673fe Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 07:28:27 -0600 Subject: [PATCH 175/342] Fix IT's --- .../alliancegenome/curation_api/Gff3BulkUploadITCase.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 763f42fde..a586b8056 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -187,7 +187,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 1, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", total, failed, completed); } @@ -200,7 +200,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 1, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", total, failed, completed); } @@ -213,7 +213,7 @@ public void gff3DataBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 1, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", total, failed, completed); } From e2d1ec69ac59baa8519a42f44941e73a80fe2c9a Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 07:42:34 -0600 Subject: [PATCH 176/342] Fix IT's --- .../alliancegenome/curation_api/Gff3BulkUploadITCase.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index a586b8056..2268e4d18 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -187,7 +187,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 1, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 1, failed, 1); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", total, failed, completed); } @@ -200,7 +200,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 1, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 1, failed, 1); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", total, failed, completed); } @@ -213,7 +213,7 @@ public void gff3DataBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", total, failed, completed); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 1, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 1, failed, 1); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", total, failed, completed); } From dea102d8c92a0c9ca3ff0c03bdd7827b57f89d66 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Wed, 4 Sep 2024 08:08:29 -0600 Subject: [PATCH 177/342] Fix IT's --- .../alliancegenome/curation_api/Gff3BulkUploadITCase.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 2268e4d18..7d9e8fc0b 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -188,7 +188,7 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", 1, failed, 1); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", 1, failed, 1); } @Test @@ -201,7 +201,7 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", 1, failed, 1); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", 1, failed, 1); } @Test @@ -214,7 +214,7 @@ public void gff3DataBulkUploadInvalidFields() throws Exception { checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", total, failed, completed); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", 1, failed, 1); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", total, failed, completed); + checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", 1, failed, 1); } } From 1100d54b7e68b0df5f5d0d9f90840c354f1a4587 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 3 Sep 2024 14:56:37 -0500 Subject: [PATCH 178/342] SCRUM-3754 add ObjectListTemplate and tests --- .../Templates/ObjectListTemplate.js | 27 ++++++ .../Templates/StringListTemplate.js | 5 +- .../__tests__/ObjectListTemplate.test.js | 83 +++++++++++++++++++ .../__tests__/StringListTemplate.test.js | 44 ++++++++++ .../cliapp/src/components/Templates/utils.js | 3 + .../ConditionRelationTable.js | 12 ++- 6 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 src/main/cliapp/src/components/Templates/ObjectListTemplate.js create mode 100644 src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js create mode 100644 src/main/cliapp/src/components/Templates/__tests__/StringListTemplate.test.js create mode 100644 src/main/cliapp/src/components/Templates/utils.js diff --git a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js new file mode 100644 index 000000000..1e43f4465 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js @@ -0,0 +1,27 @@ +import { EllipsisTableCell } from '../EllipsisTableCell'; +import { ListTableCell } from '../ListTableCell'; +import { Tooltip } from 'primereact/tooltip'; + +export const ObjectListTemplate = ({ list, sortMethod, stringTemplate, showBullets = false }) => { + if (!list || list.length === 0) return null; + + const targetClass = `a${global.crypto.randomUUID()}`; + + const sortedList = sortMethod ? sortMethod(list) : list; + + const listTemplate = (item) => { + const template = stringTemplate(item); + return template ? {template} : null; + }; + + return ( + <> +
+ +
+ + + + + ); +}; diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 2b9ae3ecc..76fcbfb5d 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -7,9 +7,12 @@ export const StringListTemplate = ({ list }) => { const targetClass = `a${global.crypto.randomUUID()}`; - const sortedList = list.sort(); + //filter out falsy values + const filteredList = list.filter(item => item); + const sortedList = filteredList.sort(); const listTemplate = (item) => { + if(!item) return; return {item}; }; diff --git a/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js new file mode 100644 index 000000000..81a2d743b --- /dev/null +++ b/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js @@ -0,0 +1,83 @@ +import { render, screen } from '@testing-library/react'; +import { ObjectListTemplate } from '../ObjectListTemplate'; +import '../../../tools/jest/setupTests'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min'; + +describe('ObjectListTemplate', () => { + it('should render a list of items using the provided stringTemplate with object list', () => { + const list = [{ id: 1, name: 'item1' }, { id: 2, name: 'item2' }]; + const stringTemplate = (item) => `Template: ${item.name}`; + const sortMethod = (list) => list.sort((a, b) => a.name - b.name); + + render( + + ); + + const renderedListItems = screen.getAllByRole('listitem'); + const firstItemText = renderedListItems[0].textContent; + const secondItemText = renderedListItems[1].textContent; + + expect(renderedListItems.length).toBe(2); + expect(firstItemText).toBe('Template: item1'); + expect(secondItemText).toBe('Template: item2'); + }); + + it('should return null when list is empty or null', () => { + const { container: container1 } = render( + + ); + expect(container1.firstChild).toBeNull(); + + const { container: container2 } = render( + + ); + expect(container2.firstChild).toBeNull(); + }); + + it('should apply custom sort method to the list when provided', () => { + const list = [{ id: 2, name: 'Alice' }, { id: 1, name: 'Bob' }]; + const sortMethod = (list) => list.sort((a, b) => a.id - b.id); + const stringTemplate = (item) => item.name; + + render( + + ); + + // Assert the order of items in the rendered list after custom sorting + const renderedListItems = screen.getAllByRole('listitem'); + expect(renderedListItems[0]).toHaveTextContent('Bob'); + expect(renderedListItems[1]).toHaveTextContent('Alice'); + }); + + it('should render in original order when no sort method is provided', () => { + const list = [{ id: 2, name: 'B' }, { id: 1, name: 'A' }]; + const stringTemplate = (item) => item.name; + + const result = render( + + ); + + const renderedListItems = screen.getAllByRole('listitem'); + const firstItemText = renderedListItems[0].textContent; + const secondItemText = renderedListItems[1].textContent; + + expect(firstItemText).toBe('B'); + expect(secondItemText).toBe('A'); + }); + + it('should handle null fields that are accessed by string template', () => { + const list = [{ id: 2 }, { id: 1, name: 'A' }]; + const stringTemplate = (item) => item.name; + + render( + + ); + + const renderedListItems = screen.getAllByRole('listitem'); + const firstItemText = renderedListItems[0].textContent; + const secondItemText = renderedListItems[1].textContent; + + expect(firstItemText).toBe(''); + expect(secondItemText).toBe('A'); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/StringListTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/StringListTemplate.test.js new file mode 100644 index 000000000..d95610807 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/__tests__/StringListTemplate.test.js @@ -0,0 +1,44 @@ +import { render, screen } from '@testing-library/react'; +import { StringListTemplate } from '../StringListTemplate'; +import '../../../tools/jest/setupTests'; +import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min'; + +describe('StringListTemplate', () => { + it('should render correctly when provided with a non-empty list', () => { + const list = ['item1', 'item2', 'item3']; + const { container } = render(); + + expect(container.firstChild).not.toBeNull(); + + const renderedListItems = screen.getAllByRole('listitem'); + + expect(renderedListItems.length).toBe(list.length); + }); + + it('should return null when provided with an empty list', () => { + const list = []; + const { container } = render(); + + expect(container.firstChild).toBeNull(); + }); + + it('should return null when list is null', () => { + const list = null; + + const result = StringListTemplate({ list }); + + expect(result).toBeNull(); + }); + + it('should handle lists with falsy elements', () => { + const list = [null, undefined, 0, '', false, 'Apple', null, 'Banana']; + + render(); + + const renderedListItems = screen.getAllByRole('listitem'); + + expect(renderedListItems).toHaveLength(2); + expect(renderedListItems[0].textContent).toBe('Apple'); + expect(renderedListItems[1].textContent).toBe('Banana'); + }); +}); diff --git a/src/main/cliapp/src/components/Templates/utils.js b/src/main/cliapp/src/components/Templates/utils.js new file mode 100644 index 000000000..50a011db4 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/utils.js @@ -0,0 +1,3 @@ +export const conditionsSort = (conditions) => { + return conditions.toSorted((a, b) => a.conditionSummary > b.conditionSummary ? 1 : -1); +} \ No newline at end of file diff --git a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js index 26d72cd3c..94dad8366 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js @@ -31,6 +31,8 @@ import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; +import { conditionsSort } from '../../components/Templates/utils'; export const ConditionRelationTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); @@ -126,6 +128,7 @@ export const ConditionRelationTable = () => { ); }; + //todo: replace const conditionTemplate = (rowData) => { if (rowData.conditions) { const listTemplate = (condition) => { @@ -153,6 +156,7 @@ export const ConditionRelationTable = () => { autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; + //todo: replace const conditionRelationTemplate = (props) => { return ( <> @@ -186,6 +190,7 @@ export const ConditionRelationTable = () => { ); }; + //todo: replace const singleReferenceBodyTemplate = (rowData) => { if (rowData && rowData.singleReference) { let refString = getRefString(rowData.singleReference); @@ -237,7 +242,12 @@ export const ConditionRelationTable = () => { field: 'conditions.conditionSummary', header: 'Experimental Conditions', sortable: true, - body: conditionTemplate, + body: (rowData) => item.conditionSummary} + showBullets={true} + />, filterConfig: FILTER_CONFIGS.experimentalConditionFilterConfig, editor: (props) => conditionRelationTemplate(props), }, From 35fee1e75b068193ecc0759a475ff26ac718b691 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 4 Sep 2024 09:12:21 -0500 Subject: [PATCH 179/342] SCRUM-3754 replace CrossReferencesTemplate --- .../Templates/CrossReferencesTemplate.js | 28 ------------------- .../src/components/Templates/sortMethods.js | 7 +++++ .../cliapp/src/components/Templates/utils.js | 3 -- .../AffectedGenomicModelTable.js | 9 ++++-- .../containers/allelesPage/AllelesTable.js | 9 ++++-- .../src/containers/genesPage/GenesTable.js | 9 ++++-- .../containers/variantsPage/VariantsTable.js | 9 ++++-- 7 files changed, 35 insertions(+), 39 deletions(-) delete mode 100644 src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js create mode 100644 src/main/cliapp/src/components/Templates/sortMethods.js delete mode 100644 src/main/cliapp/src/components/Templates/utils.js diff --git a/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js b/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js deleted file mode 100644 index 92ae9b616..000000000 --- a/src/main/cliapp/src/components/Templates/CrossReferencesTemplate.js +++ /dev/null @@ -1,28 +0,0 @@ -import { EllipsisTableCell } from '../EllipsisTableCell'; -import { ListTableCell } from '../ListTableCell'; -import { Tooltip } from 'primereact/tooltip'; - -export const CrossReferencesTemplate = ({ xrefs }) => { - if (!xrefs || xrefs.length === 0) return null; - - const targetClass = `a${global.crypto.randomUUID()}`; - - const sortedXrefs = xrefs.sort((a, b) => - a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 - ); - - const listTemplate = (item) => { - return {item.displayName + ' (' + item.resourceDescriptorPage.name + ')'}; - }; - - return ( - <> -
- -
- - - - - ); -}; diff --git a/src/main/cliapp/src/components/Templates/sortMethods.js b/src/main/cliapp/src/components/Templates/sortMethods.js new file mode 100644 index 000000000..0028db1ca --- /dev/null +++ b/src/main/cliapp/src/components/Templates/sortMethods.js @@ -0,0 +1,7 @@ +export const conditionsSort = (conditions) => { + return conditions.toSorted((a, b) => a.conditionSummary > b.conditionSummary ? 1 : -1); +} + +export const crossReferencesSort = (crossReferences) =>{ + return crossReferences.sort((a, b) => a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 ); +} \ No newline at end of file diff --git a/src/main/cliapp/src/components/Templates/utils.js b/src/main/cliapp/src/components/Templates/utils.js deleted file mode 100644 index 50a011db4..000000000 --- a/src/main/cliapp/src/components/Templates/utils.js +++ /dev/null @@ -1,3 +0,0 @@ -export const conditionsSort = (conditions) => { - return conditions.toSorted((a, b) => a.conditionSummary > b.conditionSummary ? 1 : -1); -} \ No newline at end of file diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index 0052e4816..cc9dbdbe6 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -7,11 +7,12 @@ import { NameTemplate } from '../../components/Templates/NameTemplate'; import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; -import { CrossReferencesTemplate } from '../../components/Templates/CrossReferencesTemplate'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; +import { crossReferencesSort } from '../../components/Templates/utils'; export const AffectedGenomicModelTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); @@ -76,7 +77,11 @@ export const AffectedGenomicModelTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => , + body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} + />, }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js index 471566ee7..eca3f09db 100644 --- a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js +++ b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js @@ -30,7 +30,7 @@ import { TextDialogTemplate } from '../../components/Templates/dialog/TextDialog import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialogTemplate'; import { NestedListDialogTemplate } from '../../components/Templates/dialog/NestedListDialogTemplate'; import { CountDialogTemplate } from '../../components/Templates/dialog/CountDialogTemplate'; -import { CrossReferencesTemplate } from '../../components/Templates/CrossReferencesTemplate'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { Tooltip } from 'primereact/tooltip'; import { Toast } from 'primereact/toast'; @@ -38,6 +38,7 @@ import { Button } from 'primereact/button'; import { EditMessageTooltip } from '../../components/EditMessageTooltip'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; +import { crossReferencesSort } from '../../components/Templates/sortMethods'; export const AllelesTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); @@ -1234,7 +1235,11 @@ export const AllelesTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => , + body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} + />, }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index e6054770e..25751b8b8 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -8,7 +8,7 @@ import { SynonymsDialog } from '../nameSlotAnnotations/dialogs/SynonymsDialog'; import { SymbolDialog } from '../nameSlotAnnotations/dialogs/SymbolDialog'; import { FullNameDialog } from '../nameSlotAnnotations/dialogs/FullNameDialog'; import { SystematicNameDialog } from './SystematicNameDialog'; -import { CrossReferencesTemplate } from '../../components/Templates/CrossReferencesTemplate'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { IdTemplate } from '../../components/Templates/IdTemplate'; @@ -17,6 +17,7 @@ import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialog import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; +import { crossReferencesSort } from '../../components/Templates/sortMethods'; import { SearchService } from '../../service/SearchService'; @@ -218,7 +219,11 @@ export const GenesTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => , + body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} + />, }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index 143b1e4a3..7ef82ffe4 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -19,9 +19,10 @@ import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; -import { CrossReferencesTemplate } from '../../components/Templates/CrossReferencesTemplate'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; +import { crossReferencesSort } from '../../components/Templates/sortMethods'; import { SearchService } from '../../service/SearchService'; @@ -294,7 +295,11 @@ export const VariantsTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => , + body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} + />, }, { field: 'updatedBy.uniqueId', From 6f4338530ad447a072bcfa98a10c235f2ef11ef6 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 4 Sep 2024 11:48:22 -0500 Subject: [PATCH 180/342] SCRUM-3754 replace DiseaseQualifiersTemplate --- .../Templates/DiseaseQualifiersTemplate.js | 15 ------ .../__tests__/CrossReferencesTemplate.test.js | 52 ------------------- .../DiseaseQualifiersTemplate.test.js | 41 --------------- .../src/components/Templates/sortMethods.js | 4 +- .../AffectedGenomicModelTable.js | 2 +- .../ConditionRelationTable.js | 18 +------ .../DiseaseAnnotationsTable.js | 9 +++- 7 files changed, 12 insertions(+), 129 deletions(-) delete mode 100644 src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js delete mode 100644 src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js delete mode 100644 src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js diff --git a/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js b/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js deleted file mode 100644 index 2d78a8a4c..000000000 --- a/src/main/cliapp/src/components/Templates/DiseaseQualifiersTemplate.js +++ /dev/null @@ -1,15 +0,0 @@ -import { ListTableCell } from '../ListTableCell'; - -export const DiseaseQualifiersTemplate = ({ diseaseQualifiers }) => { - if (!diseaseQualifiers || diseaseQualifiers.length === 0) return null; - - const sortedDiseaseQualifiers = diseaseQualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); - - const listTemplate = (item) => item.name; - - return ( -
- -
- ); -}; diff --git a/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js deleted file mode 100644 index a376a9b1c..000000000 --- a/src/main/cliapp/src/components/Templates/__tests__/CrossReferencesTemplate.test.js +++ /dev/null @@ -1,52 +0,0 @@ -import { render, fireEvent } from '@testing-library/react'; -import { CrossReferencesTemplate } from '../CrossReferencesTemplate'; -import '../../../tools/jest/setupTests'; - -describe('CrossReferencesTemplate', () => { - it('should render a sorted list of cross-references with their page name in parenthesis', () => { - const xrefs = [ - { displayName: 'xref B', resourceDescriptorPage: { name: 'page B' } }, - { displayName: 'xref C', resourceDescriptorPage: { name: 'page C' } }, - { displayName: 'xref A', resourceDescriptorPage: { name: 'page A' } }, - ]; - - const { container } = render(); - const listItems = container.querySelectorAll('li'); - - expect(listItems[0]).toHaveTextContent('xref A (page A)'); - expect(listItems[1]).toHaveTextContent('xref B (page B)'); - expect(listItems[2]).toHaveTextContent('xref C (page C)'); - }); - - it('should return null when xrefs is undefined', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should return null when xrefs is an empty array', () => { - const xrefs = []; - - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should display tooltip when hovering over the cross references list', async () => { - const xrefs = [ - { displayName: 'xref ABC', resourceDescriptorPage: { name: 'page ABC' } }, - { displayName: 'xref DEF', resourceDescriptorPage: { name: 'page DEF' } }, - { displayName: 'xref GHI', resourceDescriptorPage: { name: 'page GHI' } }, - ]; - - const result = render(); - - let listContentArray = result.getAllByText('xref ABC (page ABC)'); - expect(listContentArray).toHaveLength(1); - - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - listContentArray = await result.findAllByText('xref ABC (page ABC)'); - - expect(listContentArray).toHaveLength(2); - }); -}); diff --git a/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js deleted file mode 100644 index f65298a1f..000000000 --- a/src/main/cliapp/src/components/Templates/__tests__/DiseaseQualifiersTemplate.test.js +++ /dev/null @@ -1,41 +0,0 @@ -import { render, within } from '@testing-library/react'; -import { DiseaseQualifiersTemplate } from '../DiseaseQualifiersTemplate'; -import '../../../tools/jest/setupTests'; - -describe('DiseaseQualifiersTemplate', () => { - it('should return null when diseaseQualifiers is falsy', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should sort diseaseQualifiers by name', () => { - const diseaseQualifiers = [{ name: 'Qualifier C' }, { name: 'Qualifier A' }, { name: 'Qualifier B' }]; - - const result = render(); - - const qualifiersList = result.getByRole('list'); - const listItems = within(qualifiersList).getAllByRole('listitem'); - - expect(listItems[0]).toHaveTextContent('Qualifier A'); - expect(listItems[1]).toHaveTextContent('Qualifier B'); - expect(listItems[2]).toHaveTextContent('Qualifier C'); - }); - - it('should return null when diseaseQualifiers is an empty array', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should render diseaseQualifiers without a name property', () => { - const diseaseQualifiers = [{ id: 1 }, { id: 2 }, { id: 3 }]; - - const result = render(); - - const qualifiersList = result.getByRole('list'); - const listItems = within(qualifiersList).getAllByRole('listitem'); - - expect(listItems[0]).toHaveTextContent(''); - expect(listItems[1]).toHaveTextContent(''); - expect(listItems[2]).toHaveTextContent(''); - }); -}); diff --git a/src/main/cliapp/src/components/Templates/sortMethods.js b/src/main/cliapp/src/components/Templates/sortMethods.js index 0028db1ca..2ac8a3cec 100644 --- a/src/main/cliapp/src/components/Templates/sortMethods.js +++ b/src/main/cliapp/src/components/Templates/sortMethods.js @@ -4,4 +4,6 @@ export const conditionsSort = (conditions) => { export const crossReferencesSort = (crossReferences) =>{ return crossReferences.sort((a, b) => a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 ); -} \ No newline at end of file +} + +export const diseaseQualifiersSort = (qualifiers) => qualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); \ No newline at end of file diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index cc9dbdbe6..23b89f8f6 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -12,7 +12,7 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; -import { crossReferencesSort } from '../../components/Templates/utils'; +import { crossReferencesSort } from '../../components/Templates/sortMethods'; export const AffectedGenomicModelTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); diff --git a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js index 94dad8366..969625fc7 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js @@ -6,8 +6,6 @@ import { Messages } from 'primereact/messages'; import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; -import { EllipsisTableCell } from '../../components/EllipsisTableCell'; -import { ListTableCell } from '../../components/ListTableCell'; import { Tooltip } from 'primereact/tooltip'; import { Button } from 'primereact/button'; import { ConditionRelationService } from '../../service/ConditionRelationService'; @@ -32,7 +30,7 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; -import { conditionsSort } from '../../components/Templates/utils'; +import { conditionsSort } from '../../components/Templates/sortMethods'; export const ConditionRelationTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); @@ -128,20 +126,6 @@ export const ConditionRelationTable = () => { ); }; - //todo: replace - const conditionTemplate = (rowData) => { - if (rowData.conditions) { - const listTemplate = (condition) => { - return {condition.conditionSummary}; - }; - return ( -
- -
- ); - } - }; - const onConditionRelationValueChange = (event, setFieldValue, props) => { multipleAutocompleteOnChange(props, event, 'conditions', setFieldValue); }; diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index a561bdecf..92d7decef 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -16,7 +16,7 @@ import { ConditionRelationsDialog } from '../../components/ConditionRelationsDia import { EvidenceCodesTemplate } from '../../components/Templates/EvidenceCodesTemplate'; import { SingleReferenceTemplate } from '../../components/Templates/reference/SingleReferenceTemplate'; -import { DiseaseQualifiersTemplate } from '../../components/Templates/DiseaseQualifiersTemplate'; +import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; import { GenomicEntityTemplate } from '../../components/Templates/genomicEntity/GenomicEntityTemplate'; @@ -44,6 +44,7 @@ import { getIdentifier, setNewEntity, } from '../../utils/utils'; +import { diseaseQualifiersSort } from '../../components/Templates/sortMethods'; import { useNewAnnotationReducer } from './useNewAnnotationReducer'; import { NewAnnotationForm } from './NewAnnotationForm'; import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; @@ -1149,7 +1150,11 @@ export const DiseaseAnnotationsTable = () => { { field: 'diseaseQualifiers.name', header: 'Disease Qualifiers', - body: (rowData) => , + body: (rowData) => item.name} + />, sortable: true, filterConfig: FILTER_CONFIGS.diseaseQualifiersFilterConfig, editor: (props) => diseaseQualifiersEditor(props), From 97ee4441f11de0fd7220e8032a7947d35e687911 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 4 Sep 2024 12:15:16 -0500 Subject: [PATCH 181/342] SCRUM-3754 replace EvidenceCodesTemplate --- .../Templates/EvidenceCodesTemplate.js | 28 ---------- .../__tests__/EvidenceCodesTemplate.test.js | 52 ------------------- .../Templates/{ => utils}/sortMethods.js | 12 +++-- .../AffectedGenomicModelTable.js | 2 +- .../containers/allelesPage/AllelesTable.js | 2 +- .../ConditionRelationTable.js | 2 +- .../DiseaseAnnotationsTable.js | 13 +++-- .../src/containers/genesPage/GenesTable.js | 2 +- .../containers/variantsPage/VariantsTable.js | 2 +- 9 files changed, 21 insertions(+), 94 deletions(-) delete mode 100644 src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js delete mode 100644 src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js rename src/main/cliapp/src/components/Templates/{ => utils}/sortMethods.js (53%) diff --git a/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js b/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js deleted file mode 100644 index b765f7786..000000000 --- a/src/main/cliapp/src/components/Templates/EvidenceCodesTemplate.js +++ /dev/null @@ -1,28 +0,0 @@ -import { EllipsisTableCell } from '../EllipsisTableCell'; -import { ListTableCell } from '../ListTableCell'; -import { Tooltip } from 'primereact/tooltip'; - -export const EvidenceCodesTemplate = ({ evidenceCodes }) => { - if (!evidenceCodes || evidenceCodes.length === 0) return null; - - const targetClass = `a${global.crypto.randomUUID()}`; - - const sortedEvidenceCodes = evidenceCodes.sort((a, b) => - a.abbreviation > b.abbreviation ? 1 : a.curie === b.curie ? 1 : -1 - ); - - const listTemplate = (item) => { - return {item.abbreviation + ' - ' + item.name + ' (' + item.curie + ')'}; - }; - - return ( - <> -
- -
- - - - - ); -}; diff --git a/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js deleted file mode 100644 index 6d1b97094..000000000 --- a/src/main/cliapp/src/components/Templates/__tests__/EvidenceCodesTemplate.test.js +++ /dev/null @@ -1,52 +0,0 @@ -import { render, fireEvent } from '@testing-library/react'; -import { EvidenceCodesTemplate } from '../EvidenceCodesTemplate'; -import '../../../tools/jest/setupTests'; - -describe('EvidenceCodesTemplate', () => { - it('should render a sorted list of evidence codes', () => { - const evidenceCodes = [ - { abbreviation: 'Code B', name: 'Code B Name', curie: 'Code B Curie' }, - { abbreviation: 'Code A', name: 'Code A Name', curie: 'Code A Curie' }, - { abbreviation: 'Code C', name: 'Code C Name', curie: 'Code C Curie' }, - ]; - - const { container } = render(); - const listItems = container.querySelectorAll('li'); - - expect(listItems[0]).toHaveTextContent('Code A - Code A Name (Code A Curie)'); - expect(listItems[1]).toHaveTextContent('Code B - Code B Name (Code B Curie)'); - expect(listItems[2]).toHaveTextContent('Code C - Code C Name (Code C Curie)'); - }); - - it('should return null when evidenceCodes is undefined', () => { - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should return null when evidenceCodes is an empty array', () => { - const evidenceCodes = []; - - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - - it('should display tooltip when hovering over the evidence codes list', async () => { - const evidenceCodes = [ - { abbreviation: 'ABC', name: 'Code ABC', curie: 'ABC123' }, - { abbreviation: 'DEF', name: 'Code DEF', curie: 'DEF456' }, - { abbreviation: 'GHI', name: 'Code GHI', curie: 'GHI789' }, - ]; - - const result = render(); - - let listContentArray = result.getAllByText('ABC - Code ABC (ABC123)'); - expect(listContentArray).toHaveLength(1); - - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - listContentArray = await result.findAllByText('ABC - Code ABC (ABC123)'); - - expect(listContentArray).toHaveLength(2); - }); -}); diff --git a/src/main/cliapp/src/components/Templates/sortMethods.js b/src/main/cliapp/src/components/Templates/utils/sortMethods.js similarity index 53% rename from src/main/cliapp/src/components/Templates/sortMethods.js rename to src/main/cliapp/src/components/Templates/utils/sortMethods.js index 2ac8a3cec..a3448dd3c 100644 --- a/src/main/cliapp/src/components/Templates/sortMethods.js +++ b/src/main/cliapp/src/components/Templates/utils/sortMethods.js @@ -2,8 +2,12 @@ export const conditionsSort = (conditions) => { return conditions.toSorted((a, b) => a.conditionSummary > b.conditionSummary ? 1 : -1); } -export const crossReferencesSort = (crossReferences) =>{ - return crossReferences.sort((a, b) => a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 ); -} +export const crossReferencesSort = (crossReferences) => { + return crossReferences.sort((a, b) => a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1); +} + +export const diseaseQualifiersSort = (qualifiers) => qualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); -export const diseaseQualifiersSort = (qualifiers) => qualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); \ No newline at end of file +export const evidenceCodesSort = (evidenceCodes) => { + return evidenceCodes.sort((a, b) => a.abbreviation > b.abbreviation ? 1 : a.curie === b.curie ? 1 : -1); +} \ No newline at end of file diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index 23b89f8f6..501eae745 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -12,7 +12,7 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; -import { crossReferencesSort } from '../../components/Templates/sortMethods'; +import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; export const AffectedGenomicModelTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); diff --git a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js index eca3f09db..ce2359f53 100644 --- a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js +++ b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js @@ -38,7 +38,7 @@ import { Button } from 'primereact/button'; import { EditMessageTooltip } from '../../components/EditMessageTooltip'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; -import { crossReferencesSort } from '../../components/Templates/sortMethods'; +import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; export const AllelesTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); diff --git a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js index 969625fc7..535254f0b 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js @@ -30,7 +30,7 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; -import { conditionsSort } from '../../components/Templates/sortMethods'; +import { conditionsSort } from '../../components/Templates/utils/sortMethods'; export const ConditionRelationTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index 92d7decef..14e728130 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -14,7 +14,6 @@ import { DiseaseAnnotationService } from '../../service/DiseaseAnnotationService import { RelatedNotesDialog } from '../../components/RelatedNotesDialog'; import { ConditionRelationsDialog } from '../../components/ConditionRelationsDialog'; -import { EvidenceCodesTemplate } from '../../components/Templates/EvidenceCodesTemplate'; import { SingleReferenceTemplate } from '../../components/Templates/reference/SingleReferenceTemplate'; import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { IdTemplate } from '../../components/Templates/IdTemplate'; @@ -44,7 +43,7 @@ import { getIdentifier, setNewEntity, } from '../../utils/utils'; -import { diseaseQualifiersSort } from '../../components/Templates/sortMethods'; +import { diseaseQualifiersSort, evidenceCodesSort } from '../../components/Templates/utils/sortMethods'; import { useNewAnnotationReducer } from './useNewAnnotationReducer'; import { NewAnnotationForm } from './NewAnnotationForm'; import { AutocompleteMultiEditor } from '../../components/Autocomplete/AutocompleteMultiEditor'; @@ -1082,7 +1081,11 @@ export const DiseaseAnnotationsTable = () => { { field: 'evidenceCodes.abbreviation', header: 'Evidence Code', - body: (rowData) => , + body: (rowData) => `${item.abbreviation} - ${item.name} (${item.curie})`} + />, sortable: true, filterConfig: FILTER_CONFIGS.evidenceCodesFilterConfig, editor: (props) => evidenceEditorTemplate(props), @@ -1150,8 +1153,8 @@ export const DiseaseAnnotationsTable = () => { { field: 'diseaseQualifiers.name', header: 'Disease Qualifiers', - body: (rowData) => item.name} />, diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index 25751b8b8..173362d34 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -17,7 +17,7 @@ import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialog import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; -import { crossReferencesSort } from '../../components/Templates/sortMethods'; +import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; import { SearchService } from '../../service/SearchService'; diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index 7ef82ffe4..b681ac572 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -22,7 +22,7 @@ import { ControlledVocabularyDropdown } from '../../components/ControlledVocabul import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; -import { crossReferencesSort } from '../../components/Templates/sortMethods'; +import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; import { SearchService } from '../../service/SearchService'; From 488a05009d61113e51a67587149dd3e503b4d780 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 4 Sep 2024 12:24:23 -0500 Subject: [PATCH 182/342] SCRUM-3754 add SingleReferenceTemplate to ConditionRelationTable --- .../ConditionRelationTable.js | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js index 535254f0b..e658b0bbb 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js @@ -6,7 +6,6 @@ import { Messages } from 'primereact/messages'; import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; -import { Tooltip } from 'primereact/tooltip'; import { Button } from 'primereact/button'; import { ConditionRelationService } from '../../service/ConditionRelationService'; import { AutocompleteEditor } from '../../components/Autocomplete/AutocompleteEditor'; @@ -30,6 +29,7 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; +import { SingleReferenceTemplate } from '../../components/Templates/reference/SingleReferenceTemplate'; import { conditionsSort } from '../../components/Templates/utils/sortMethods'; export const ConditionRelationTable = () => { @@ -140,7 +140,6 @@ export const ConditionRelationTable = () => { autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; - //todo: replace const conditionRelationTemplate = (props) => { return ( <> @@ -174,30 +173,6 @@ export const ConditionRelationTable = () => { ); }; - //todo: replace - const singleReferenceBodyTemplate = (rowData) => { - if (rowData && rowData.singleReference) { - let refString = getRefString(rowData.singleReference); - return ( - <> -
- -
- - - ); - } - }; - const columns = [ { field: 'handle', @@ -213,7 +188,8 @@ export const ConditionRelationTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig, editor: (props) => referenceEditorTemplate(props), - body: singleReferenceBodyTemplate, + body: (rowData) => , + }, { field: 'conditionRelationType.name', From 3411bc41fd59e969f864ce474cddc9db6711c82e Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 4 Sep 2024 12:26:11 -0500 Subject: [PATCH 183/342] SCRUM-3754 UI formatting --- .../Templates/StringListTemplate.js | 4 +- .../__tests__/ObjectListTemplate.test.js | 39 +++++++++---------- .../components/Templates/utils/sortMethods.js | 14 ++++--- .../AffectedGenomicModelTable.js | 12 +++--- .../containers/allelesPage/AllelesTable.js | 12 +++--- .../ConditionRelationTable.js | 15 +++---- .../DiseaseAnnotationsTable.js | 24 +++++++----- .../src/containers/genesPage/GenesTable.js | 12 +++--- .../containers/variantsPage/VariantsTable.js | 12 +++--- 9 files changed, 79 insertions(+), 65 deletions(-) diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 76fcbfb5d..5b6c6f253 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -8,11 +8,11 @@ export const StringListTemplate = ({ list }) => { const targetClass = `a${global.crypto.randomUUID()}`; //filter out falsy values - const filteredList = list.filter(item => item); + const filteredList = list.filter((item) => item); const sortedList = filteredList.sort(); const listTemplate = (item) => { - if(!item) return; + if (!item) return; return {item}; }; diff --git a/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js index 81a2d743b..e00d145d4 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/ObjectListTemplate.test.js @@ -5,37 +5,37 @@ import { BrowserRouter } from 'react-router-dom/cjs/react-router-dom.min'; describe('ObjectListTemplate', () => { it('should render a list of items using the provided stringTemplate with object list', () => { - const list = [{ id: 1, name: 'item1' }, { id: 2, name: 'item2' }]; + const list = [ + { id: 1, name: 'item1' }, + { id: 2, name: 'item2' }, + ]; const stringTemplate = (item) => `Template: ${item.name}`; const sortMethod = (list) => list.sort((a, b) => a.name - b.name); - render( - - ); - + render(); + const renderedListItems = screen.getAllByRole('listitem'); const firstItemText = renderedListItems[0].textContent; const secondItemText = renderedListItems[1].textContent; - + expect(renderedListItems.length).toBe(2); expect(firstItemText).toBe('Template: item1'); expect(secondItemText).toBe('Template: item2'); }); it('should return null when list is empty or null', () => { - const { container: container1 } = render( - - ); + const { container: container1 } = render(); expect(container1.firstChild).toBeNull(); - const { container: container2 } = render( - - ); + const { container: container2 } = render(); expect(container2.firstChild).toBeNull(); }); it('should apply custom sort method to the list when provided', () => { - const list = [{ id: 2, name: 'Alice' }, { id: 1, name: 'Bob' }]; + const list = [ + { id: 2, name: 'Alice' }, + { id: 1, name: 'Bob' }, + ]; const sortMethod = (list) => list.sort((a, b) => a.id - b.id); const stringTemplate = (item) => item.name; @@ -50,12 +50,13 @@ describe('ObjectListTemplate', () => { }); it('should render in original order when no sort method is provided', () => { - const list = [{ id: 2, name: 'B' }, { id: 1, name: 'A' }]; + const list = [ + { id: 2, name: 'B' }, + { id: 1, name: 'A' }, + ]; const stringTemplate = (item) => item.name; - const result = render( - - ); + const result = render(); const renderedListItems = screen.getAllByRole('listitem'); const firstItemText = renderedListItems[0].textContent; @@ -69,9 +70,7 @@ describe('ObjectListTemplate', () => { const list = [{ id: 2 }, { id: 1, name: 'A' }]; const stringTemplate = (item) => item.name; - render( - - ); + render(); const renderedListItems = screen.getAllByRole('listitem'); const firstItemText = renderedListItems[0].textContent; diff --git a/src/main/cliapp/src/components/Templates/utils/sortMethods.js b/src/main/cliapp/src/components/Templates/utils/sortMethods.js index a3448dd3c..645ecdfa5 100644 --- a/src/main/cliapp/src/components/Templates/utils/sortMethods.js +++ b/src/main/cliapp/src/components/Templates/utils/sortMethods.js @@ -1,13 +1,15 @@ export const conditionsSort = (conditions) => { - return conditions.toSorted((a, b) => a.conditionSummary > b.conditionSummary ? 1 : -1); -} + return conditions.sort((a, b) => (a.conditionSummary > b.conditionSummary ? 1 : -1)); +}; export const crossReferencesSort = (crossReferences) => { - return crossReferences.sort((a, b) => a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1); -} + return crossReferences.sort((a, b) => + a.displayName > b.displayName ? 1 : a.resourceDescriptorPage.name === b.resourceDescriptorPage.name ? 1 : -1 + ); +}; export const diseaseQualifiersSort = (qualifiers) => qualifiers.sort((a, b) => (a.name > b.name ? 1 : -1)); export const evidenceCodesSort = (evidenceCodes) => { - return evidenceCodes.sort((a, b) => a.abbreviation > b.abbreviation ? 1 : a.curie === b.curie ? 1 : -1); -} \ No newline at end of file + return evidenceCodes.sort((a, b) => (a.abbreviation > b.abbreviation ? 1 : a.curie === b.curie ? 1 : -1)); +}; diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index 501eae745..d5261c541 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -77,11 +77,13 @@ export const AffectedGenomicModelTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} - />, + body: (rowData) => ( + `${item.displayName} (${item.resourceDescriptorPage.name})`} + /> + ), }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js index ce2359f53..f23454806 100644 --- a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js +++ b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js @@ -1235,11 +1235,13 @@ export const AllelesTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} - />, + body: (rowData) => ( + `${item.displayName} (${item.resourceDescriptorPage.name})`} + /> + ), }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js index e658b0bbb..497b655b2 100644 --- a/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js +++ b/src/main/cliapp/src/containers/conditionRelationPage/ConditionRelationTable.js @@ -189,7 +189,6 @@ export const ConditionRelationTable = () => { filterConfig: FILTER_CONFIGS.singleReferenceFilterConfig, editor: (props) => referenceEditorTemplate(props), body: (rowData) => , - }, { field: 'conditionRelationType.name', @@ -202,12 +201,14 @@ export const ConditionRelationTable = () => { field: 'conditions.conditionSummary', header: 'Experimental Conditions', sortable: true, - body: (rowData) => item.conditionSummary} - showBullets={true} - />, + body: (rowData) => ( + item.conditionSummary} + showBullets={true} + /> + ), filterConfig: FILTER_CONFIGS.experimentalConditionFilterConfig, editor: (props) => conditionRelationTemplate(props), }, diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index 14e728130..ecdc322df 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -1081,11 +1081,13 @@ export const DiseaseAnnotationsTable = () => { { field: 'evidenceCodes.abbreviation', header: 'Evidence Code', - body: (rowData) => `${item.abbreviation} - ${item.name} (${item.curie})`} - />, + body: (rowData) => ( + `${item.abbreviation} - ${item.name} (${item.curie})`} + /> + ), sortable: true, filterConfig: FILTER_CONFIGS.evidenceCodesFilterConfig, editor: (props) => evidenceEditorTemplate(props), @@ -1153,11 +1155,13 @@ export const DiseaseAnnotationsTable = () => { { field: 'diseaseQualifiers.name', header: 'Disease Qualifiers', - body: (rowData) => item.name} - />, + body: (rowData) => ( + item.name} + /> + ), sortable: true, filterConfig: FILTER_CONFIGS.diseaseQualifiersFilterConfig, editor: (props) => diseaseQualifiersEditor(props), diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index 173362d34..fc4255259 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -219,11 +219,13 @@ export const GenesTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} - />, + body: (rowData) => ( + `${item.displayName} (${item.resourceDescriptorPage.name})`} + /> + ), }, { field: 'updatedBy.uniqueId', diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index b681ac572..c8bfc26ff 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -295,11 +295,13 @@ export const VariantsTable = () => { header: 'Cross References', sortable: true, filterConfig: FILTER_CONFIGS.crossReferencesFilterConfig, - body: (rowData) => `${item.displayName} (${item.resourceDescriptorPage.name})`} - />, + body: (rowData) => ( + `${item.displayName} (${item.resourceDescriptorPage.name})`} + /> + ), }, { field: 'updatedBy.uniqueId', From ec66ff88db26fdde41bf622a697ed1dfc96f2abd Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 5 Sep 2024 14:30:51 -0500 Subject: [PATCH 184/342] add duration column and update number formats --- .../dataLoadsPage/DataLoadsComponent.js | 34 ++++++++++++++----- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 7dc1a5298..bf483e0ef 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -1,6 +1,7 @@ import React, { useReducer, useRef, useState, useContext } from 'react'; import { useQuery } from '@tanstack/react-query'; import { DataTable } from 'primereact/datatable'; +import Moment from 'react-moment'; import { Column } from 'primereact/column'; import { FileUpload } from 'primereact/fileupload'; import { Toast } from 'primereact/toast'; @@ -494,6 +495,21 @@ export const DataLoadsComponent = () => { return
); @@ -692,6 +694,10 @@ export const DataLoadsComponent = () => { } }; + const exemptTypes = (loadType) => { + return (loadType == "GFF_EXON" || loadType == "GFF_TRANSCRIPT" || loadType == "GFF_CDS"); + } + const fileWithinSchemaRange = (fileVersion, loadType) => { if (!fileVersion) return false; const classVersions = apiVersion?.agrCurationSchemaVersions; diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index f3eb988a3..dc17d0a29 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -42,13 +42,12 @@ export class DataLoadService extends BaseAuthService { return this.api.delete(`/${endpoint}/${id}`); } - restartLoad(loadType, id) { - let endpoint = loadType.toLowerCase(); - return this.api.get(`/${endpoint}/restart/${id}`); + restartLoad(id) { + return this.api.get(`/bulkloadfilehistory/restart/${id}`); } - restartLoadFile(id) { - return this.api.get(`/bulkloadfile/restart/${id}`); + restartHistoryLoad(id) { + return this.api.get(`/bulkloadfilehistory/restart/${id}`); } getFileHistoryFile(id) { @@ -82,20 +81,11 @@ export class DataLoadService extends BaseAuthService { getBackendBulkLoadTypes(loadType) { const bulkLoadTypes = { BulkFMSLoad: [ - 'GFF', + 'GFF', // This needs to be removed at some point 'GFF_EXON', 'GFF_CDS', 'GFF_TRANSCRIPT', - - 'GFF_EXON_LOCATION', - 'GFF_CDS_LOCATION', - 'GFF_TRANSCRIPT_LOCATION', - - 'GFF_TRANSCRIPT_CDS', - 'GFF_TRANSCRIPT_EXON', - 'GFF_TRANSCRIPT_GENE', - 'HTPDATASET', 'INTERACTION-GEN', 'INTERACTION-MOL', diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkFMSLoadCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkFMSLoadCrudController.java index e31dc34ea..5b7ba77fc 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkFMSLoadCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkFMSLoadCrudController.java @@ -4,7 +4,6 @@ import org.alliancegenome.curation_api.dao.loads.BulkFMSLoadDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkFMSLoadCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkFMSLoadService; import jakarta.annotation.PostConstruct; @@ -23,9 +22,4 @@ protected void init() { setService(bulkFMSLoadService); } - @Override - public ObjectResponse restartLoad(Long id) { - return bulkFMSLoadService.restartLoad(id); - } - } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileCrudController.java index e59b72ec1..768cfed2b 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileCrudController.java @@ -4,7 +4,6 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkLoadFileCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkLoadFileService; import jakarta.annotation.PostConstruct; @@ -23,9 +22,4 @@ protected void init() { setService(bulkLoadFileService); } - @Override - public ObjectResponse restartLoadFile(Long id) { - return bulkLoadFileService.restartLoad(id); - } - } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java index 51a71f20e..5a2c43244 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java @@ -3,7 +3,9 @@ import org.alliancegenome.curation_api.controllers.base.BaseEntityCrudController; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkLoadFileHistoryCrudInterface; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkLoadFileHistoryService; import jakarta.annotation.PostConstruct; @@ -27,5 +29,10 @@ protected void init() { public Response download(Long id) { return bulkLoadFileHistoryService.download(id); } + + @Override + public ObjectResponse restartLoad(Long id) { + return bulkLoadFileHistoryService.restartLoad(id); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkManualLoadCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkManualLoadCrudController.java index 4e6e17b03..4f52f4a52 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkManualLoadCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkManualLoadCrudController.java @@ -4,7 +4,6 @@ import org.alliancegenome.curation_api.dao.loads.BulkManualLoadDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkManualLoadCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkManualLoadService; import jakarta.annotation.PostConstruct; @@ -23,8 +22,4 @@ protected void init() { setService(bulkManualLoadService); } - @Override - public ObjectResponse restartLoad(Long id) { - return bulkManualLoadService.restartLoad(id); - } } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkURLLoadCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkURLLoadCrudController.java index f9eba2212..fd2fa7676 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkURLLoadCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkURLLoadCrudController.java @@ -4,7 +4,6 @@ import org.alliancegenome.curation_api.dao.loads.BulkURLLoadDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkURLLoadCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkURLLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkURLLoadService; import jakarta.annotation.PostConstruct; @@ -23,8 +22,4 @@ protected void init() { setService(bulkURLLoadService); } - @Override - public ObjectResponse restartLoad(Long id) { - return bulkURLLoadService.restartLoad(id); - } } 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 3996ad186..45350c869 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -25,12 +25,6 @@ public enum BackendBulkLoadType { GFF_EXON("gff"), GFF_CDS("gff"), GFF_TRANSCRIPT("gff"), - GFF_EXON_LOCATION("gff"), - GFF_CDS_LOCATION("gff"), - GFF_TRANSCRIPT_LOCATION("gff"), - GFF_TRANSCRIPT_GENE("gff"), - GFF_TRANSCRIPT_EXON("gff"), - GFF_TRANSCRIPT_CDS("gff"), INTERACTION_MOL("tsv"), INTERACTION_GEN("tsv"), diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkFMSLoadCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkFMSLoadCrudInterface.java index b1f856ab7..0985bedac 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkFMSLoadCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkFMSLoadCrudInterface.java @@ -2,16 +2,10 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; -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.GET; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; @@ -20,10 +14,5 @@ @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public interface BulkFMSLoadCrudInterface extends BaseIdCrudInterface { - - @GET - @Path("/restart/{id}") - @JsonView(View.FieldsOnly.class) - ObjectResponse restartLoad(@PathParam("id") Long id); - + } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileCrudInterface.java index 3a8bd1c47..44e3f5037 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileCrudInterface.java @@ -2,16 +2,10 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; -import org.alliancegenome.curation_api.response.ObjectResponse; -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.GET; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; @@ -21,8 +15,4 @@ @Consumes(MediaType.APPLICATION_JSON) public interface BulkLoadFileCrudInterface extends BaseIdCrudInterface { - @GET - @Path("/restart/{id}") - @JsonView(View.FieldsOnly.class) - ObjectResponse restartLoadFile(@PathParam("id") Long id); } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java index a9a202735..0c31c0176 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java @@ -1,7 +1,9 @@ package org.alliancegenome.curation_api.interfaces.crud.bulkloads; import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.tags.Tag; @@ -25,4 +27,10 @@ public interface BulkLoadFileHistoryCrudInterface extends BaseIdCrudInterface restartLoad(@PathParam("id") Long id); + } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkManualLoadCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkManualLoadCrudInterface.java index b6f33cf41..56b5e31b9 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkManualLoadCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkManualLoadCrudInterface.java @@ -2,16 +2,10 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; -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.GET; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; @@ -21,9 +15,4 @@ @Consumes(MediaType.APPLICATION_JSON) public interface BulkManualLoadCrudInterface extends BaseIdCrudInterface { - @GET - @Path("/restart/{id}") - @JsonView(View.FieldsOnly.class) - ObjectResponse restartLoad(@PathParam("id") Long id); - } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkURLLoadCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkURLLoadCrudInterface.java index d5827eca7..d7e31e355 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkURLLoadCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkURLLoadCrudInterface.java @@ -2,16 +2,10 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkURLLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; -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.GET; import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.MediaType; @@ -21,8 +15,4 @@ @Consumes(MediaType.APPLICATION_JSON) public interface BulkURLLoadCrudInterface extends BaseIdCrudInterface { - @GET - @Path("/restart/{id}") - @JsonView(View.FieldsOnly.class) - ObjectResponse restartLoad(@PathParam("id") Long id); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java index 9fdc42bb6..a5bc5c365 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java @@ -24,26 +24,4 @@ public String loadGenomeAssemblyFromGFF(List gffHeaderData) throws Objec return null; } -// -// -// protected String loadGenomeAssembly(String assemblyName, BulkLoadFileHistory history, List gffHeaderData, BackendBulkDataProvider dataProvider) { -// try { -// assemblyName = gff3Service.loadGenomeAssembly(assemblyName, gffHeaderData, dataProvider); -// } catch (ObjectUpdateException e) { -// //e.printStackTrace(); -// history.incrementFailed("Assembly"); -// addException(history, e.getData()); -// } catch (Exception e) { -// e.printStackTrace(); -// history.incrementFailed("Assembly"); -// addException(history, new ObjectUpdateExceptionData(gffHeaderData, e.getMessage(), e.getStackTrace())); -// } -// updateHistory(history); -// -// return assemblyName; -// } - - - - } diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkFMSLoadService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkFMSLoadService.java index 9cae02f33..20c9faf14 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkFMSLoadService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkFMSLoadService.java @@ -1,47 +1,22 @@ package org.alliancegenome.curation_api.services.loads; import org.alliancegenome.curation_api.dao.loads.BulkFMSLoadDAO; -import org.alliancegenome.curation_api.enums.JobStatus; -import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkFMSLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; -import jakarta.enterprise.event.Event; import jakarta.inject.Inject; -import jakarta.transaction.Transactional; @RequestScoped public class BulkFMSLoadService extends BaseEntityCrudService { @Inject BulkFMSLoadDAO bulkFMSLoadDAO; - @Inject Event pendingJobEvents; - @Override @PostConstruct protected void init() { setSQLDao(bulkFMSLoadDAO); } - public ObjectResponse restartLoad(Long id) { - ObjectResponse resp = updateLoad(id); - if (resp != null) { - pendingJobEvents.fire(new PendingBulkLoadJobEvent(id)); - return resp; - } - return null; - } - - @Transactional - protected ObjectResponse updateLoad(Long id) { - BulkFMSLoad load = bulkFMSLoadDAO.find(id); - if (load != null && load.getBulkloadStatus().isNotRunning()) { - load.setBulkloadStatus(JobStatus.FORCED_PENDING); - return new ObjectResponse(load); - } - return null; - } } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java index f366e9de6..9f226a6c8 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java @@ -1,15 +1,21 @@ package org.alliancegenome.curation_api.services.loads; +import org.alliancegenome.curation_api.dao.loads.BulkLoadDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileExceptionDAO; import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; +import org.alliancegenome.curation_api.enums.JobStatus; +import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; +import jakarta.enterprise.event.Event; import jakarta.inject.Inject; import jakarta.transaction.Transactional; import jakarta.ws.rs.core.MediaType; @@ -18,9 +24,11 @@ @RequestScoped public class BulkLoadFileHistoryService extends BaseEntityCrudService { + @Inject Event pendingJobEvents; @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; @Inject BulkLoadFileExceptionDAO bulkLoadFileExceptionDAO; - + @Inject BulkLoadDAO bulkLoadDAO; + @Override @PostConstruct protected void init() { @@ -75,5 +83,24 @@ public Response download(Long id) { response.type(MediaType.APPLICATION_OCTET_STREAM); return response.build(); } + + public ObjectResponse restartLoad(Long id) { + ObjectResponse resp = updateLoad(id); + if (resp != null) { + pendingJobEvents.fire(new PendingBulkLoadJobEvent(id)); + return resp; + } + return null; + } + + @Transactional + protected ObjectResponse updateLoad(Long id) { + BulkLoad load = bulkLoadDAO.find(id); + if (load != null && load.getBulkloadStatus().isNotRunning()) { + load.setBulkloadStatus(JobStatus.FORCED_PENDING); + return new ObjectResponse(load); + } + return null; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java index aca1fe571..54a776d65 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileService.java @@ -3,15 +3,12 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadFileDAO; import org.alliancegenome.curation_api.jobs.events.PendingLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; -import io.quarkus.logging.Log; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.event.Event; import jakarta.inject.Inject; -import jakarta.transaction.Transactional; @RequestScoped public class BulkLoadFileService extends BaseEntityCrudService { @@ -26,24 +23,4 @@ protected void init() { setSQLDao(bulkLoadFileDAO); } - public ObjectResponse restartLoad(Long id) { - ObjectResponse resp = updateLoad(id); - if (resp != null) { - pendingFileJobEvents.fire(new PendingLoadJobEvent(id)); - return resp; - } - return null; - } - - @Transactional - protected ObjectResponse updateLoad(Long id) { - Log.error("Not Implemented anymore restarting a load happens through the history"); - //BulkLoadFile load = bulkLoadFileDAO.find(id); - //if (load != null && load.getBulkloadStatus().isNotRunning()) { - // load.setBulkloadStatus(JobStatus.FORCED_PENDING); - // return new ObjectResponse(load); - //} - return null; - } - } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkManualLoadService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkManualLoadService.java index ea7a58fde..af47be51c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkManualLoadService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkManualLoadService.java @@ -1,17 +1,14 @@ package org.alliancegenome.curation_api.services.loads; import org.alliancegenome.curation_api.dao.loads.BulkManualLoadDAO; -import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkManualLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.event.Event; import jakarta.inject.Inject; -import jakarta.transaction.Transactional; @RequestScoped public class BulkManualLoadService extends BaseEntityCrudService { @@ -26,23 +23,4 @@ protected void init() { setSQLDao(bulkManualLoadDAO); } - public ObjectResponse restartLoad(Long id) { - ObjectResponse resp = updateLoad(id); - if (resp != null) { - pendingJobEvents.fire(new PendingBulkLoadJobEvent(id)); - return resp; - } - return null; - } - - @Transactional - protected ObjectResponse updateLoad(Long id) { - BulkManualLoad load = bulkManualLoadDAO.find(id); - if (load != null && load.getBulkloadStatus().isNotRunning()) { - load.setBulkloadStatus(JobStatus.FORCED_PENDING); - return new ObjectResponse(load); - } - return null; - } - } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkURLLoadService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkURLLoadService.java index d86c89e38..7822346ff 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkURLLoadService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkURLLoadService.java @@ -1,18 +1,14 @@ package org.alliancegenome.curation_api.services.loads; import org.alliancegenome.curation_api.dao.loads.BulkURLLoadDAO; -import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkURLLoad; -import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; -import io.quarkus.logging.Log; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.RequestScoped; import jakarta.enterprise.event.Event; import jakarta.inject.Inject; -import jakarta.transaction.Transactional; @RequestScoped public class BulkURLLoadService extends BaseEntityCrudService { @@ -27,25 +23,4 @@ protected void init() { setSQLDao(bulkURLLoadDAO); } - public ObjectResponse restartLoad(Long id) { - Log.info("restartLoad: " + id); - ObjectResponse resp = updateLoad(id); - if (resp != null) { - Log.info("Firing Load Pending Event: " + id); - pendingJobEvents.fire(new PendingBulkLoadJobEvent(id)); - return resp; - } - return null; - } - - @Transactional - protected ObjectResponse updateLoad(Long id) { - Log.info("updateLoad: " + id); - BulkURLLoad load = bulkURLLoadDAO.find(id); - if (load != null && load.getBulkloadStatus().isNotRunning()) { - load.setBulkloadStatus(JobStatus.FORCED_PENDING); - return new ObjectResponse(load); - } - return null; - } } \ No newline at end of file From 4c550d5ec8938c604260612a0f4c88bdadb32ec8 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 6 Sep 2024 17:12:25 -0600 Subject: [PATCH 202/342] Fixed play buttons and timing out waiting for play buttons not does everything async fashion --- .../dataLoadsPage/DataLoadsComponent.js | 4 +- .../cliapp/src/service/DataLoadService.js | 4 +- .../BulkLoadFileHistoryCrudController.java | 11 ++++-- .../BulkLoadFileHistoryCrudInterface.java | 9 ++++- .../curation_api/jobs/JobScheduler.java | 20 +++++----- .../jobs/processors/BulkLoadFMSProcessor.java | 4 +- .../processors/BulkLoadManualProcessor.java | 10 ++--- .../jobs/processors/BulkLoadProcessor.java | 15 +------ .../jobs/processors/BulkLoadURLProcessor.java | 12 +++--- .../jobs/processors/StartLoadProcessor.java | 6 +-- .../loads/BulkLoadFileHistoryService.java | 39 ++++++++++++++++--- .../IndexProcessDisplayService.java | 6 +-- .../processing/LoadProcessDisplayService.java | 6 +-- 13 files changed, 83 insertions(+), 63 deletions(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 808903c8d..7faf21ed4 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -179,7 +179,7 @@ export const DataLoadsComponent = () => { const runHistoryLoad = (rowData) => { getService() - .restartHisotryLoad(rowData.id) + .restartHistoryLoad(rowData.id) .then((response) => { queryClient.invalidateQueries(['bulkloadtable']); }); @@ -695,7 +695,7 @@ export const DataLoadsComponent = () => { }; const exemptTypes = (loadType) => { - return (loadType == "GFF_EXON" || loadType == "GFF_TRANSCRIPT" || loadType == "GFF_CDS"); + return (loadType === "GFF_EXON" || loadType === "GFF_TRANSCRIPT" || loadType === "GFF_CDS"); } const fileWithinSchemaRange = (fileVersion, loadType) => { diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index dc17d0a29..b0917e7f3 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -43,11 +43,11 @@ export class DataLoadService extends BaseAuthService { } restartLoad(id) { - return this.api.get(`/bulkloadfilehistory/restart/${id}`); + return this.api.get(`/bulkloadfilehistory/restartload/${id}`); } restartHistoryLoad(id) { - return this.api.get(`/bulkloadfilehistory/restart/${id}`); + return this.api.get(`/bulkloadfilehistory/restartloadhistory/${id}`); } getFileHistoryFile(id) { diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java index 5a2c43244..f2374faa6 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/loads/BulkLoadFileHistoryCrudController.java @@ -4,6 +4,7 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.interfaces.crud.bulkloads.BulkLoadFileHistoryCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.loads.BulkLoadFileHistoryService; @@ -31,8 +32,12 @@ public Response download(Long id) { } @Override - public ObjectResponse restartLoad(Long id) { - return bulkLoadFileHistoryService.restartLoad(id); + public ObjectResponse restartBulkLoad(Long id) { + return bulkLoadFileHistoryService.restartBulkLoad(id); + } + + @Override + public ObjectResponse restartBulkLoadHistory(Long id) { + return bulkLoadFileHistoryService.restartBulkLoadHistory(id); } - } diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java index 0c31c0176..5cd921812 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/bulkloads/BulkLoadFileHistoryCrudInterface.java @@ -2,6 +2,7 @@ import org.alliancegenome.curation_api.interfaces.base.BaseIdCrudInterface; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.view.View; @@ -29,8 +30,12 @@ public interface BulkLoadFileHistoryCrudInterface extends BaseIdCrudInterface restartLoad(@PathParam("id") Long id); + ObjectResponse restartBulkLoad(@PathParam("id") Long id); + @GET + @Path("/restartloadhistory/{id}") + @JsonView(View.FieldsOnly.class) + ObjectResponse restartBulkLoadHistory(@PathParam("id") Long id); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java index ebfe5685d..94484d143 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java @@ -35,7 +35,7 @@ import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.event.Event; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import jakarta.inject.Inject; @ApplicationScoped @@ -76,7 +76,7 @@ public void init() { boolean isFirst = true; for (BulkLoadFileHistory bfh : b.getHistory()) { BulkLoadFile bulkLoadFile = bfh.getBulkLoadFile(); - if (bfh.getBulkloadStatus() == null || bfh.getBulkloadStatus().isRunning() || bfh.getBulkloadStatus().isStarted() || bulkLoadFile.getLocalFilePath() != null) { + if (bfh.getBulkloadStatus() == null || bfh.getBulkloadStatus().isPending() || bfh.getBulkloadStatus().isRunning() || bfh.getBulkloadStatus().isStarted() || bulkLoadFile.getLocalFilePath() != null) { if (bulkLoadFile.getLocalFilePath() != null) { File file = new File(bulkLoadFile.getLocalFilePath()); if (file.exists()) { @@ -137,7 +137,7 @@ public void scheduleCronGroupJobs() { bsl.setSchedulingErrorMessage(null); bsl.setBulkloadStatus(JobStatus.SCHEDULED_PENDING); bulkLoadDAO.merge(bsl); - pendingJobEvents.fire(new PendingBulkLoadJobEvent(bsl.getId())); + pendingJobEvents.fireAsync(new PendingBulkLoadJobEvent(bsl.getId())); } } } catch (Exception e) { @@ -161,28 +161,26 @@ public void scheduleCronGroupJobs() { } } - public void pendingJobs(@Observes PendingBulkLoadJobEvent event) { - // Log.info("pendingJobs: " + event.getId()); + public void pendingJobs(@ObservesAsync PendingBulkLoadJobEvent event) { BulkLoad load = bulkLoadDAO.find(event.getId()); if (load != null) { if (load.getBulkloadStatus().isPending()) { load.setBulkloadStatus(load.getBulkloadStatus().getNextStatus()); bulkLoadDAO.merge(load); - // Log.info("Firing Start Job Event: " + load.getId()); - startedJobEvents.fire(new StartedBulkLoadJobEvent(load.getId())); + Log.debug("Firing Start Job Event: " + load.getId()); + startedJobEvents.fireAsync(new StartedBulkLoadJobEvent(load.getId())); } } } - public void pendingFileJobs(@Observes PendingLoadJobEvent event) { - // Log.info("pendingFileJobs: " + event.getId()); + public void pendingFileJobs(@ObservesAsync PendingLoadJobEvent event) { BulkLoadFileHistory fileLoadHistory = bulkLoadFileHistoryDAO.find(event.getId()); if (fileLoadHistory != null) { if (fileLoadHistory.getBulkloadStatus().isPending()) { fileLoadHistory.setBulkloadStatus(fileLoadHistory.getBulkloadStatus().getNextStatus()); bulkLoadFileHistoryDAO.merge(fileLoadHistory); - // Log.info("Firing Start File Job Event: " + fileLoad.getId()); - startedFileJobEvents.fire(new StartedLoadJobEvent(fileLoadHistory.getId())); + Log.debug("Firing Start File History Job Event: " + fileLoadHistory.getId()); + startedFileJobEvents.fireAsync(new StartedLoadJobEvent(fileLoadHistory.getId())); } } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java index ddc80dd89..30a61e50a 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java @@ -10,14 +10,14 @@ import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import lombok.extern.jbosslog.JBossLog; @JBossLog @ApplicationScoped public class BulkLoadFMSProcessor extends BulkLoadProcessor { - public void processBulkFMSLoad(@Observes StartedBulkLoadJobEvent load) { + public void processBulkFMSLoad(@ObservesAsync StartedBulkLoadJobEvent load) { BulkLoad bulkLoad = bulkLoadDAO.find(load.getId()); if (bulkLoad instanceof BulkFMSLoad bulkFMSLoad) { diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java index 2108f9159..6facae6c7 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java @@ -16,14 +16,12 @@ import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; -import lombok.extern.jbosslog.JBossLog; +import jakarta.enterprise.event.ObservesAsync; -@JBossLog @ApplicationScoped public class BulkLoadManualProcessor extends BulkLoadProcessor { - public void processBulkManualLoad(@Observes StartedBulkLoadJobEvent load) { + public void processBulkManualLoad(@ObservesAsync StartedBulkLoadJobEvent load) { BulkLoad bulkLoad = bulkLoadDAO.find(load.getId()); if (bulkLoad instanceof BulkManualLoad bulkURLLoad) { Log.info("processBulkManualLoad: " + load.getId()); @@ -36,7 +34,7 @@ public void processBulkManualLoadFromDQM(MultipartFormDataInput input, BackendBu Map> form = input.getFormDataMap(); if (form.containsKey(loadType)) { - log.warn("Key not found: " + loadType); + Log.warn("Key not found: " + loadType); return; } @@ -59,7 +57,7 @@ public void processBulkManualLoadFromDQM(MultipartFormDataInput input, BackendBu endLoad(bulkManualLoad, null, JobStatus.FINISHED); } else { - log.warn("BulkManualLoad not found: " + loadType); + Log.warn("BulkManualLoad not found: " + loadType); endLoad(bulkManualLoad, "BulkManualLoad not found: " + loadType, JobStatus.FAILED); } 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 7319f919c..fb72b7e71 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 @@ -52,19 +52,6 @@ public class BulkLoadProcessor { protected FileTransferHelper fileHelper = new FileTransferHelper(); -// private String processFMS(String dataType, String dataSubType) { -// List files = fmsDataFileService.getDataFiles(dataType, dataSubType); -// -// if (files.size() == 1) { -// DataFile df = files.get(0); -// return df.getS3Url(); -// } else { -// Log.warn("Files: " + files); -// Log.warn("Issue pulling files from the FMS: " + dataType + " " + dataSubType); -// } -// return null; -// } - public void syncWithS3(BulkLoadFileHistory bulkLoadFileHistory) { BulkLoad bulkLoad = bulkLoadFileHistory.getBulkLoad(); BulkLoadFile bulkLoadFile = bulkLoadFileHistory.getBulkLoadFile(); @@ -175,7 +162,7 @@ protected void processFilePath(BulkLoad bulkLoad, String localFilePath, Boolean bulkLoadFileDAO.merge(bulkLoadFile); bulkLoadDAO.merge(load); Log.info("Firing Pending Bulk File History Event: " + history.getId()); - pendingFileJobEvents.fire(new PendingLoadJobEvent(history.getId())); + pendingFileJobEvents.fireAsync(new PendingLoadJobEvent(history.getId())); } protected void startLoad(BulkLoad load) { diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadURLProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadURLProcessor.java index 822cc5a79..3a46f9a22 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadURLProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadURLProcessor.java @@ -8,17 +8,15 @@ import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import jakarta.inject.Inject; -import lombok.extern.jbosslog.JBossLog; -@JBossLog @ApplicationScoped public class BulkLoadURLProcessor extends BulkLoadProcessor { @Inject BulkLoadDAO bulkLoadDAO; - public void processBulkURLLoad(@Observes StartedBulkLoadJobEvent load) { + public void processBulkURLLoad(@ObservesAsync StartedBulkLoadJobEvent load) { BulkLoad bulkLoad = bulkLoadDAO.find(load.getId()); if (bulkLoad instanceof BulkURLLoad bulkURLLoad) { @@ -31,17 +29,17 @@ public void processBulkURLLoad(@Observes StartedBulkLoadJobEvent load) { String localFilePath = fileHelper.compressInputFile(filePath); if (filePath == null) { - log.info("Load: " + bulkURLLoad.getName() + " failed"); + Log.info("Load: " + bulkURLLoad.getName() + " failed"); endLoad(bulkURLLoad, "Load: " + bulkURLLoad.getName() + " failed: to download URL: " + bulkURLLoad.getBulkloadUrl(), JobStatus.FAILED); } else if (localFilePath == null) { - log.info("Load: " + bulkURLLoad.getName() + " failed"); + Log.info("Load: " + bulkURLLoad.getName() + " failed"); endLoad(bulkURLLoad, "Load: " + bulkURLLoad.getName() + " failed: to save local file: " + filePath, JobStatus.FAILED); } else { processFilePath(bulkURLLoad, localFilePath); endLoad(bulkURLLoad, null, JobStatus.FINISHED); } } else { - log.info("Load: " + bulkURLLoad.getName() + " failed: URL is missing"); + Log.info("Load: " + bulkURLLoad.getName() + " failed: URL is missing"); endLoad(bulkURLLoad, "Load: " + bulkURLLoad.getName() + " failed: URL is missing", JobStatus.FAILED); } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java index 3eb00466b..27563042e 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java @@ -8,7 +8,7 @@ import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import jakarta.inject.Inject; @ApplicationScoped @@ -16,8 +16,8 @@ public class StartLoadProcessor extends BulkLoadProcessor { @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; - public void bulkLoadFile(@Observes StartedLoadJobEvent event) { // An @Observes method should not be in a super class as then it gets run for - // every child class + public void bulkLoadFile(@ObservesAsync StartedLoadJobEvent event) { // An @Observes method should not be in a super class as then it gets run for every child class + Log.info("bulkLoadFile: " + event); BulkLoadFileHistory bulkLoadFileHistory = bulkLoadFileHistoryDAO.find(event.getId()); if (!bulkLoadFileHistory.getBulkloadStatus().isStarted()) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java index 9f226a6c8..e3df7705a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java @@ -5,12 +5,15 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.enums.JobStatus; import org.alliancegenome.curation_api.jobs.events.PendingBulkLoadJobEvent; +import org.alliancegenome.curation_api.jobs.events.PendingLoadJobEvent; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoad; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFile; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import io.quarkus.logging.Log; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import jakarta.annotation.PostConstruct; @@ -25,6 +28,7 @@ public class BulkLoadFileHistoryService extends BaseEntityCrudService { @Inject Event pendingJobEvents; + @Inject Event pendingLoadJobEvents; @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; @Inject BulkLoadFileExceptionDAO bulkLoadFileExceptionDAO; @Inject BulkLoadDAO bulkLoadDAO; @@ -84,17 +88,21 @@ public Response download(Long id) { return response.build(); } - public ObjectResponse restartLoad(Long id) { - ObjectResponse resp = updateLoad(id); + + + public ObjectResponse restartBulkLoad(Long id) { + ObjectResponse resp = updateBulkLoad(id); // Transaction has to close before calling the fire + Log.info("Restart Bulk Load: " + id); if (resp != null) { - pendingJobEvents.fire(new PendingBulkLoadJobEvent(id)); + Log.info("Firing Event: " + id); + pendingJobEvents.fireAsync(new PendingBulkLoadJobEvent(id)); return resp; } return null; } - + @Transactional - protected ObjectResponse updateLoad(Long id) { + public ObjectResponse updateBulkLoad(Long id) { BulkLoad load = bulkLoadDAO.find(id); if (load != null && load.getBulkloadStatus().isNotRunning()) { load.setBulkloadStatus(JobStatus.FORCED_PENDING); @@ -103,4 +111,25 @@ protected ObjectResponse updateLoad(Long id) { return null; } + public ObjectResponse restartBulkLoadHistory(Long id) { + ObjectResponse resp = updateBulkLoadHistory(id); + Log.info("Restart Bulk Load History: " + id); + if (resp != null) { + Log.info("Firing Event: " + id); + pendingLoadJobEvents.fireAsync(new PendingLoadJobEvent(id)); + return resp; + } + return null; + } + + @Transactional + public ObjectResponse updateBulkLoadHistory(Long id) { + BulkLoadFileHistory history = bulkLoadFileHistoryDAO.find(id); + if (history != null && history.getBulkloadStatus().isNotRunning()) { + history.setBulkloadStatus(JobStatus.FORCED_PENDING); + return new ObjectResponse(history.getBulkLoadFile()); + } + return null; + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/processing/IndexProcessDisplayService.java b/src/main/java/org/alliancegenome/curation_api/services/processing/IndexProcessDisplayService.java index 0b848a73a..f6dcafdb1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/processing/IndexProcessDisplayService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/processing/IndexProcessDisplayService.java @@ -18,16 +18,16 @@ public class IndexProcessDisplayService implements ProcessDisplayHandler { @Override public void startProcess(String message, long startTime, long totalSize) { - processingEvent.fire(new StartIndexProcessingEvent(message, startTime, totalSize)); + processingEvent.fireAsync(new StartIndexProcessingEvent(message, startTime, totalSize)); } @Override public void progressProcess(String message, String data, long startTime, long nowTime, long lastTime, long currentCount, long lastCount, long totalSize) { - processingEvent.fire(new ProgressIndexProcessingEvent(message, data, startTime, nowTime, lastTime, currentCount, lastCount, totalSize)); + processingEvent.fireAsync(new ProgressIndexProcessingEvent(message, data, startTime, nowTime, lastTime, currentCount, lastCount, totalSize)); } @Override public void finishProcess(String message, String data, long current, long totalSize, long duration) { - processingEvent.fire(new EndIndexProcessingEvent(message, data, current, totalSize, duration)); + processingEvent.fireAsync(new EndIndexProcessingEvent(message, data, current, totalSize, duration)); } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/processing/LoadProcessDisplayService.java b/src/main/java/org/alliancegenome/curation_api/services/processing/LoadProcessDisplayService.java index 07f543bf3..1ab7c0bda 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/processing/LoadProcessDisplayService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/processing/LoadProcessDisplayService.java @@ -18,16 +18,16 @@ public class LoadProcessDisplayService implements ProcessDisplayHandler { @Override public void startProcess(String message, long startTime, long totalSize) { - processingEvent.fire(new StartLoadProcessingEvent(message, startTime, totalSize)); + processingEvent.fireAsync(new StartLoadProcessingEvent(message, startTime, totalSize)); } @Override public void progressProcess(String message, String data, long startTime, long nowTime, long lastTime, long currentCount, long lastCount, long totalSize) { - processingEvent.fire(new ProgressLoadProcessingEvent(message, data, startTime, nowTime, lastTime, currentCount, lastCount, totalSize)); + processingEvent.fireAsync(new ProgressLoadProcessingEvent(message, data, startTime, nowTime, lastTime, currentCount, lastCount, totalSize)); } @Override public void finishProcess(String message, String data, long current, long totalSize, long duration) { - processingEvent.fire(new EndLoadProcessingEvent(message, data, current, totalSize, duration)); + processingEvent.fireAsync(new EndLoadProcessingEvent(message, data, current, totalSize, duration)); } } From 667f3567d87040644518b771d8eb6ac5797a7426 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 6 Sep 2024 17:21:54 -0600 Subject: [PATCH 203/342] Added pretties --- Makefile | 3 +++ src/main/cliapp/Makefile | 3 +++ .../dataLoadsPage/DataLoadsComponent.js | 24 ++++++++++++------- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 4bccc226d..22dc47e30 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,9 @@ uirun: make -B -C src/main/cliapp make -B -C src/main/cliapp run +pretty: + make -B -C src/main/cliapp pretty + uirunalpha: export API_URL=https://alpha-curation.alliancegenome.org; make -B -C src/main/cliapp run; unset API_URL diff --git a/src/main/cliapp/Makefile b/src/main/cliapp/Makefile index 1d315d0ea..3d00ba5bc 100644 --- a/src/main/cliapp/Makefile +++ b/src/main/cliapp/Makefile @@ -6,6 +6,9 @@ all: run: npm start +pretty: + npx prettier --write . + runalpha: export API_URL=https://alpha-curation.alliancegenome.org; make run; unset API_URL diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 7faf21ed4..5efc1ce20 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -185,7 +185,6 @@ export const DataLoadsComponent = () => { }); }; - const editLoad = (rowData) => { bulkLoadDispatch({ type: 'EDIT', editBulkLoad: rowData }); setBulkLoadDialog(true); @@ -287,7 +286,10 @@ export const DataLoadsComponent = () => { rowData.bulkloadStatus === 'FAILED' || rowData.bulkloadStatus === 'STOPPED' ) { - if (fileWithinSchemaRange(rowData.bulkLoadFile.linkMLSchemaVersion, bulkload.backendBulkLoadType) || exemptTypes(bulkload.backendBulkLoadType)) { + if ( + fileWithinSchemaRange(rowData.bulkLoadFile.linkMLSchemaVersion, bulkload.backendBulkLoadType) || + exemptTypes(bulkload.backendBulkLoadType) + ) { ret.push(
); @@ -695,8 +701,8 @@ export const DataLoadsComponent = () => { }; const exemptTypes = (loadType) => { - return (loadType === "GFF_EXON" || loadType === "GFF_TRANSCRIPT" || loadType === "GFF_CDS"); - } + return loadType === 'GFF_EXON' || loadType === 'GFF_TRANSCRIPT' || loadType === 'GFF_CDS'; + }; const fileWithinSchemaRange = (fileVersion, loadType) => { if (!fileVersion) return false; From 654c7e0597b215d08916d76838d2871077a9a9c0 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 6 Sep 2024 17:56:24 -0600 Subject: [PATCH 204/342] Fixed error messaging and defaults --- .../src/containers/dataLoadsPage/DataLoadsComponent.js | 6 +++--- .../jobs/processors/BulkLoadFMSProcessor.java | 2 +- .../jobs/processors/BulkLoadManualProcessor.java | 2 +- .../curation_api/jobs/processors/BulkLoadProcessor.java | 7 ++++--- .../curation_api/jobs/processors/StartLoadProcessor.java | 1 - .../services/loads/BulkLoadFileHistoryService.java | 8 ++++---- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 5efc1ce20..1de20b789 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -501,18 +501,18 @@ export const DataLoadsComponent = () => { const durationTemplate = (rowData) => { let started = new Date(rowData.loadStarted); - let finished = Date.now(); + let finished = Date.UTC(); if (rowData.loadFinished) { finished = new Date(rowData.loadFinished); } return ( <> - Start: + Start:
{rowData.loadFinished && ( <> - End: + End:
Duration: diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java index 30a61e50a..295447b90 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadFMSProcessor.java @@ -21,7 +21,7 @@ public void processBulkFMSLoad(@ObservesAsync StartedBulkLoadJobEvent load) { BulkLoad bulkLoad = bulkLoadDAO.find(load.getId()); if (bulkLoad instanceof BulkFMSLoad bulkFMSLoad) { - Log.info("processBulkFMSLoad: " + load.getId()); + Log.debug("processBulkFMSLoad: " + load.getId()); startLoad(bulkFMSLoad); if (bulkFMSLoad.getFmsDataType() != null && bulkFMSLoad.getFmsDataSubType() != null) { diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java index 6facae6c7..7017f9efc 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/BulkLoadManualProcessor.java @@ -24,7 +24,7 @@ public class BulkLoadManualProcessor extends BulkLoadProcessor { public void processBulkManualLoad(@ObservesAsync StartedBulkLoadJobEvent load) { BulkLoad bulkLoad = bulkLoadDAO.find(load.getId()); if (bulkLoad instanceof BulkManualLoad bulkURLLoad) { - Log.info("processBulkManualLoad: " + load.getId()); + Log.debug("processBulkManualLoad: " + load.getId()); // We do nothing because at the load level we don't try to figure out what the // next file to run is } 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 fb72b7e71..bd4b6707a 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 @@ -55,9 +55,7 @@ public class BulkLoadProcessor { public void syncWithS3(BulkLoadFileHistory bulkLoadFileHistory) { BulkLoad bulkLoad = bulkLoadFileHistory.getBulkLoad(); BulkLoadFile bulkLoadFile = bulkLoadFileHistory.getBulkLoadFile(); - Log.info("Syncing with S3"); - Log.info("Local: " + bulkLoadFile.getLocalFilePath()); - Log.info("S3: " + bulkLoadFile.getS3Path()); + Log.info("Starting Syncing with S3: Local File: " + bulkLoadFile.getLocalFilePath() + " S3 File: " + bulkLoadFile.getS3Path()); if ((bulkLoadFile.getS3Path() != null || bulkLoadFile.generateS3MD5Path(bulkLoad) != null) && bulkLoadFile.getLocalFilePath() == null) { File outfile = fileHelper.downloadFileFromS3(s3AccessKey, s3SecretKey, s3Bucket, bulkLoadFile.getS3Path()); @@ -191,6 +189,9 @@ protected void endLoad(BulkLoad load, String message, JobStatus status) { protected void startLoad(BulkLoadFileHistory bulkLoadFileHistory) { bulkLoadFileHistory.setBulkloadStatus(bulkLoadFileHistory.getBulkloadStatus().getNextStatus()); + bulkLoadFileHistory.setLoadStarted(LocalDateTime.now()); + bulkLoadFileHistory.setErrorMessage(null); + bulkLoadFileHistory.setLoadFinished(null); bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); Log.info("Load File: " + bulkLoadFileHistory.getBulkLoadFile().getMd5Sum() + " is running with file: " + bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java index 27563042e..ba6fcbf6d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/processors/StartLoadProcessor.java @@ -17,7 +17,6 @@ public class StartLoadProcessor extends BulkLoadProcessor { @Inject BulkLoadFileHistoryDAO bulkLoadFileHistoryDAO; public void bulkLoadFile(@ObservesAsync StartedLoadJobEvent event) { // An @Observes method should not be in a super class as then it gets run for every child class - Log.info("bulkLoadFile: " + event); BulkLoadFileHistory bulkLoadFileHistory = bulkLoadFileHistoryDAO.find(event.getId()); if (!bulkLoadFileHistory.getBulkloadStatus().isStarted()) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java index e3df7705a..68237141d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/loads/BulkLoadFileHistoryService.java @@ -92,9 +92,9 @@ public Response download(Long id) { public ObjectResponse restartBulkLoad(Long id) { ObjectResponse resp = updateBulkLoad(id); // Transaction has to close before calling the fire - Log.info("Restart Bulk Load: " + id); + Log.debug("Restart Bulk Load: " + id); if (resp != null) { - Log.info("Firing Event: " + id); + Log.debug("Firing Event: " + id); pendingJobEvents.fireAsync(new PendingBulkLoadJobEvent(id)); return resp; } @@ -113,9 +113,9 @@ public ObjectResponse updateBulkLoad(Long id) { public ObjectResponse restartBulkLoadHistory(Long id) { ObjectResponse resp = updateBulkLoadHistory(id); - Log.info("Restart Bulk Load History: " + id); + Log.debug("Restart Bulk Load History: " + id); if (resp != null) { - Log.info("Firing Event: " + id); + Log.debug("Firing Event: " + id); pendingLoadJobEvents.fireAsync(new PendingLoadJobEvent(id)); return resp; } From 6c77d95892fabe147b994d4325f9bf75b5cfb200 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 6 Sep 2024 18:26:15 -0600 Subject: [PATCH 205/342] Fixed persistant issue by reordering commits --- .../curation_api/jobs/processors/BulkLoadProcessor.java | 4 ++++ 1 file changed, 4 insertions(+) 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 bd4b6707a..86c18ec11 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 @@ -193,6 +193,8 @@ protected void startLoad(BulkLoadFileHistory bulkLoadFileHistory) { bulkLoadFileHistory.setErrorMessage(null); bulkLoadFileHistory.setLoadFinished(null); bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); + bulkLoadFileHistory.getBulkLoad().setBulkloadStatus(bulkLoadFileHistory.getBulkloadStatus()); + bulkLoadDAO.merge(bulkLoadFileHistory.getBulkLoad()); Log.info("Load File: " + bulkLoadFileHistory.getBulkLoadFile().getMd5Sum() + " is running with file: " + bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath()); } @@ -210,6 +212,8 @@ protected void endLoad(BulkLoadFileHistory bulkLoadFileHistory, String message, slackNotifier.slackalert(bulkLoadFileHistory); } bulkLoadFileHistoryDAO.merge(bulkLoadFileHistory); + bulkLoadFileHistory.getBulkLoad().setBulkloadStatus(status); + bulkLoadDAO.merge(bulkLoadFileHistory.getBulkLoad()); Log.info("Load File: " + bulkLoadFileHistory.getBulkLoadFile().getMd5Sum() + " is finished. Message: " + message + " Status: " + status); } From b1d010239c2d36b5917b5dacf85c0f2027410497 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 6 Sep 2024 21:31:03 -0500 Subject: [PATCH 206/342] Changes in htp executor to return false when load fails --- .../jobs/executors/HTPExpressionDatasetAnnotationExecutor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java index e1e39a8af..209ac9c95 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/HTPExpressionDatasetAnnotationExecutor.java @@ -99,10 +99,12 @@ private boolean runLoad(BulkLoadFileHistory history, BackendBulkDataProvider dat updateHistory(history); updateExceptions(history); failLoadAboveErrorRateCutoff(history); + return false; } ph.progressProcess(); } updateHistory(history); + updateExceptions(history); ph.finishProcess(); return true; } From 3548b15279fc8edbdd902aad4b8fb674e066dcfd Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 6 Sep 2024 15:15:14 -0500 Subject: [PATCH 207/342] Removed required constraint for similarilty, identity and length fields --- .../validation/dto/fms/ParalogyFmsDTOValidator.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java index 6a6d611f2..dfad9f3d5 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java @@ -162,19 +162,13 @@ public GeneToGeneParalogy validateParalogyFmsDTO(ParalogyFmsDTO dto) throws Obje } paralogyData.setConfidence(confidence); - if (dto.getSimilarity() == null) { - paralogyResponse.addErrorMessage("Similarity", ValidationConstants.REQUIRED_MESSAGE); - } else { + if (dto.getSimilarity() != null) { paralogyData.setSimilarity(dto.getSimilarity()); } - if (dto.getIdentity() == null) { - paralogyResponse.addErrorMessage("Identity", ValidationConstants.REQUIRED_MESSAGE); - } else { + if (dto.getIdentity() != null) { paralogyData.setIdentity(dto.getIdentity()); } - if (dto.getLength() == null) { - paralogyResponse.addErrorMessage("Length", ValidationConstants.REQUIRED_MESSAGE); - } else { + if (dto.getLength() != null) { paralogyData.setLength(dto.getLength()); } if (dto.getRank() == null) { From 3930876521901b62f3492372828f4faa1e170d15 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 9 Sep 2024 09:48:48 -0500 Subject: [PATCH 208/342] Changes in Paralogy test case --- .../curation_api/ParalogyBulkUploadFmsITCase.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java index e70784e4e..a295c0a59 100644 --- a/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java @@ -31,8 +31,8 @@ @QuarkusTestResource(TestContainerResource.Initializer.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestInstance(TestInstance.Lifecycle.PER_CLASS) -@DisplayName("605 - Paralogy bulk upload - FMS") -@Order(605) +@DisplayName("607 - Paralogy bulk upload - FMS") +@Order(607) public class ParalogyBulkUploadFmsITCase extends BaseITCase { @BeforeEach @@ -89,10 +89,7 @@ public void paralogyBulkUploadMissingRequiredFields() throws Exception { checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_02_no_gene2.json"); checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_03_no_species.json"); checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_04_no_confidence.json"); - checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_05_no_identity.json"); - checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_06_no_length.json"); checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_07_no_rank.json"); - checkFailedBulkLoad(paralogyBulkPostEndpoint, paralogyTestFilePath + "MR_08_no_similarity.json"); } @Test From 4aaeda536f47a56a3007d5d5ee9b4bbb77f89f3d Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 9 Sep 2024 10:00:56 -0500 Subject: [PATCH 209/342] Checkstyle fix --- .../services/validation/dto/fms/ParalogyFmsDTOValidator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java index dfad9f3d5..68247c5d3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java @@ -168,7 +168,7 @@ public GeneToGeneParalogy validateParalogyFmsDTO(ParalogyFmsDTO dto) throws Obje if (dto.getIdentity() != null) { paralogyData.setIdentity(dto.getIdentity()); } - if (dto.getLength() != null) { + if (dto.getLength() != null) { paralogyData.setLength(dto.getLength()); } if (dto.getRank() == null) { From 81d58206f51e636dc3ebe2082ed13f34a15d989e Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Mon, 9 Sep 2024 12:01:05 -0600 Subject: [PATCH 210/342] Added missing column types and indexes --- .../model/entities/ExpressionAnnotation.java | 26 ++++++++++++++----- .../model/entities/Reference.java | 5 +++- .../model/entities/TemporalContext.java | 21 ++++++++++----- .../model/entities/VocabularyTerm.java | 1 + .../entities/bulkloads/BulkLoadFile.java | 4 +-- .../model/entities/ontology/OntologyTerm.java | 2 +- .../slotAnnotations/SlotAnnotation.java | 2 +- 7 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java index 0f1b9e017..a1f057ce9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java @@ -1,12 +1,5 @@ package org.alliancegenome.curation_api.model.entities; -import com.fasterxml.jackson.annotation.JsonIgnore; -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.view.View; @@ -20,6 +13,23 @@ 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.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonView; + +import jakarta.persistence.CascadeType; +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +import jakarta.persistence.JoinColumn; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; +import jakarta.persistence.Transient; +import lombok.Data; +import lombok.EqualsAndHashCode; + @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @JsonSubTypes.Type(value = GeneExpressionAnnotation.class, name = "GeneExpressionAnnotation") }) @@ -44,11 +54,13 @@ public abstract class ExpressionAnnotation extends Annotation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "whenExpressedStageName_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({View.FieldsOnly.class}) + @Column(length = 2000) private String whenExpressedStageName; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "whereExpressedStatement_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class}) + @Column(length = 2000) private String whereExpressedStatement; @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Reference.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Reference.java index 555ffdfa1..dc53a3bf2 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Reference.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Reference.java @@ -28,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.JoinTable; @@ -61,7 +62,9 @@ public class Reference extends InformationContentEntity { @JsonView({ View.FieldsOnly.class }) @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "shortCitation_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") private String shortCitation; + @KeywordField(name = "shortCitation_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @Column(columnDefinition = "TEXT") + private String shortCitation; /** * Retrieve PMID if available in the crossReference collection otherwise MOD ID diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java index 64562f441..293eee1ab 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/TemporalContext.java @@ -1,10 +1,7 @@ package org.alliancegenome.curation_api.model.entities; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonView; -import jakarta.persistence.*; -import lombok.Data; -import lombok.EqualsAndHashCode; +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.base.AuditedObject; @@ -20,7 +17,18 @@ import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField; -import java.util.List; +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.JoinTable; +import jakarta.persistence.ManyToMany; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.Table; +import lombok.Data; +import lombok.EqualsAndHashCode; @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type") @Entity @@ -50,6 +58,7 @@ public class TemporalContext extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "age_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({View.FieldsOnly.class}) + @Column(length = 1000) private String age; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/VocabularyTerm.java b/src/main/java/org/alliancegenome/curation_api/model/entities/VocabularyTerm.java index fa5961687..4aa2dcb3d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/VocabularyTerm.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/VocabularyTerm.java @@ -59,6 +59,7 @@ public class VocabularyTerm extends AuditedObject { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "definition_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) + @Column(columnDefinition = "TEXT") private String definition; @IndexedEmbedded(includeDepth = 1) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java index 5faf23901..f79fa942a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java @@ -30,10 +30,8 @@ @AGRCurationSchemaVersion(min = "1.3.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table( indexes = { - @Index(name = "bulkloadfile_bulkLoad_index", columnList = "bulkLoad_id"), @Index(name = "bulkloadfile_createdby_index", columnList = "createdBy_id"), - @Index(name = "bulkloadfile_updatedby_index", columnList = "updatedBy_id"), - @Index(name = "bulkloadfile_bulkloadStatus_index", columnList = "bulkloadStatus") + @Index(name = "bulkloadfile_updatedby_index", columnList = "updatedBy_id") } ) public class BulkLoadFile extends AuditedObject { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java index 2fb738475..787804245 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ontology/OntologyTerm.java @@ -38,7 +38,7 @@ import lombok.ToString; @Inheritance(strategy = InheritanceType.SINGLE_TABLE) -@DiscriminatorColumn(name = "OntologyTermType") +@DiscriminatorColumn(name = "OntologyTermType", length = 64) @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Entity diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java index d2cb73b8b..8bd39c8a1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/slotAnnotations/SlotAnnotation.java @@ -27,7 +27,7 @@ import lombok.ToString; @Inheritance(strategy = InheritanceType.SINGLE_TABLE) -@DiscriminatorColumn(name = "SlotAnnotationType") +@DiscriminatorColumn(name = "SlotAnnotationType", length = 96) @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) From c02caa6f38e96a888f7c577d18415e341ec98b04 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 9 Sep 2024 22:55:32 +0100 Subject: [PATCH 211/342] Enable skipping of known issues --- .../curation_api/constants/ValidationConstants.java | 3 ++- .../base/BaseAnnotationDTOCrudController.java | 5 +++-- .../controllers/base/SubmittedObjectCrudController.java | 5 +++-- .../exceptions/KnownIssueValidationException.java | 8 ++++++++ .../interfaces/base/BaseUpsertControllerInterface.java | 3 ++- .../interfaces/crud/BaseUpsertServiceInterface.java | 5 +++-- .../curation_api/jobs/executors/LoadFileExecutor.java | 7 ++++++- .../model/entities/bulkloads/BulkLoadFileHistory.java | 8 ++++++++ .../curation_api/services/MoleculeService.java | 5 +++-- .../orthology/GeneToGeneOrthologyGeneratedService.java | 3 ++- .../validation/dto/fms/OrthologyFmsDTOValidator.java | 9 ++++++--- 11 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java 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 39a44ba41..0e879c431 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/ValidationConstants.java @@ -14,5 +14,6 @@ private ValidationConstants() { public static final String UNSUPPORTED_MESSAGE = "Unsupported value specified"; 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 + } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java index 17136ef31..3a733fcac 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java @@ -2,6 +2,7 @@ import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; 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.interfaces.base.BaseUpsertControllerInterface; import org.alliancegenome.curation_api.model.entities.Annotation; @@ -22,11 +23,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ObjectUpdateException { + public E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException { return service.upsert(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java index fa5fdc9a5..000a7e0ec 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java @@ -2,6 +2,7 @@ import org.alliancegenome.curation_api.dao.base.BaseEntityDAO; 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.interfaces.base.BaseSubmittedObjectCrudInterface; import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; @@ -21,11 +22,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ObjectUpdateException { + public E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException { return service.upsert(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java b/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java new file mode 100644 index 000000000..ddb7b3ff8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java @@ -0,0 +1,8 @@ +package org.alliancegenome.curation_api.exceptions; + +public class KnownIssueValidationException extends Exception { + + public KnownIssueValidationException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java index 07efff0e9..d85d38ca7 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java @@ -1,5 +1,6 @@ package org.alliancegenome.curation_api.interfaces.base; +import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; @@ -15,5 +16,5 @@ public interface BaseUpsertControllerInterface { - default E upsert(T dto) throws ObjectUpdateException { + default E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { return upsert(dto, null); } - E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException; + E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException; } 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 0043c473a..b25c7506d 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 @@ -14,6 +14,7 @@ import org.alliancegenome.curation_api.dao.loads.BulkLoadFileHistoryDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.enums.JobStatus; +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.interfaces.AGRCurationSchemaVersion; @@ -220,7 +221,11 @@ protected boolean runLoad(BaseUpser // e.printStackTrace(); history.incrementFailed(); addException(history, e.getData()); - } catch (Exception e) { + } 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())); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java index 4544de58e..f925eeae5 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java @@ -136,6 +136,14 @@ public void incrementFailed(String countType) { getProcessCount(countType).incrementFailed(); } @Transient + public void incrementSkipped() { + incrementSkipped(COUNT_TYPE); + } + @Transient + public void incrementSkipped(String countType) { + getProcessCount(countType).incrementSkipped(); + } + @Transient public double getErrorRate() { return getErrorRate(COUNT_TYPE); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java b/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java index 4d9fa076e..9dca70697 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.ResourceDescriptorPageDAO; import org.alliancegenome.curation_api.dao.SynonymDAO; 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.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.CrossReference; @@ -61,7 +62,7 @@ public ObjectResponse update(Molecule uiEntity) { } @Transactional - public Molecule upsert(MoleculeFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public Molecule upsert(MoleculeFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException, KnownIssueValidationException { log.debug("processUpdate Molecule: "); if (StringUtils.isBlank(dto.getId())) { @@ -71,7 +72,7 @@ public Molecule upsert(MoleculeFmsDTO dto, BackendBulkDataProvider backendBulkDa if (dto.getId().startsWith("CHEBI:")) { log.debug("Skipping processing of " + dto.getId()); - throw new ObjectUpdateException(dto, "Skipping processing of " + dto.getId()); + throw new KnownIssueValidationException("Skipping processing of " + dto.getId()); } if (StringUtils.isBlank(dto.getName())) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/orthology/GeneToGeneOrthologyGeneratedService.java b/src/main/java/org/alliancegenome/curation_api/services/orthology/GeneToGeneOrthologyGeneratedService.java index 205fb9828..d5f179343 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/orthology/GeneToGeneOrthologyGeneratedService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/orthology/GeneToGeneOrthologyGeneratedService.java @@ -7,6 +7,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.orthology.GeneToGeneOrthologyGeneratedDAO; 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.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.orthology.GeneToGeneOrthologyGenerated; @@ -31,7 +32,7 @@ protected void init() { setSQLDao(geneToGeneOrthologyGeneratedDAO); } - public GeneToGeneOrthologyGenerated upsert(OrthologyFmsDTO orthoPair, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public GeneToGeneOrthologyGenerated upsert(OrthologyFmsDTO orthoPair, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException, KnownIssueValidationException { return orthologyFmsDtoValidator.validateOrthologyFmsDTO(orthoPair); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java index 7c2c19fc3..e9bf41af1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.orthology.GeneToGeneOrthologyGeneratedDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; @@ -36,7 +37,7 @@ public class OrthologyFmsDTOValidator { @Inject VocabularyTermService vocabularyTermService; @Transactional - public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) throws ObjectValidationException { + public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) throws ObjectValidationException, KnownIssueValidationException { ObjectResponse orthologyResponse = new ObjectResponse(); @@ -60,7 +61,8 @@ public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) if (StringUtils.isNotBlank(dto.getGene1())) { subjectGene = geneService.findByIdentifierString(subjectGeneIdentifier); if (subjectGene == null) { - orthologyResponse.addErrorMessage("gene1", ValidationConstants.INVALID_MESSAGE + " (" + subjectGeneIdentifier + ")"); + //orthologyResponse.addErrorMessage("gene1", ValidationConstants.INVALID_MESSAGE + " (" + subjectGeneIdentifier + ")"); + throw new KnownIssueValidationException(ValidationConstants.UNRECOGNIZED_MESSAGE + " (" + subjectGeneIdentifier + ")"); } else { if (dto.getGene1Species() == null) { orthologyResponse.addErrorMessage("gene1Species", ValidationConstants.REQUIRED_MESSAGE); @@ -80,7 +82,8 @@ public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) if (StringUtils.isNotBlank(dto.getGene2())) { objectGene = geneService.findByIdentifierString(objectGeneIdentifier); if (objectGene == null) { - orthologyResponse.addErrorMessage("gene2", ValidationConstants.INVALID_MESSAGE + " (" + objectGeneIdentifier + ")"); + //orthologyResponse.addErrorMessage("gene2", ValidationConstants.INVALID_MESSAGE + " (" + objectGeneIdentifier + ")"); + throw new KnownIssueValidationException(ValidationConstants.UNRECOGNIZED_MESSAGE + " (" + objectGeneIdentifier + ")"); } else { if (dto.getGene2Species() == null) { orthologyResponse.addErrorMessage("gene2Species", ValidationConstants.REQUIRED_MESSAGE); From 34ee2c1df4a21086c3e10569859929e7b90d7d1c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 9 Sep 2024 22:58:46 +0100 Subject: [PATCH 212/342] Checkstyle fixes --- .../curation_api/jobs/executors/LoadFileExecutor.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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 b25c7506d..d7b6b8b52 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 @@ -221,11 +221,10 @@ protected boolean runLoad(BaseUpser // e.printStackTrace(); history.incrementFailed(); addException(history, e.getData()); - } catch (KnownIssueValidationException e) { + } catch (KnownIssueValidationException e) { Log.debug(e.getMessage()); history.incrementSkipped(); - } - catch (Exception e) { + } catch (Exception e) { // e.printStackTrace(); history.incrementFailed(); addException(history, new ObjectUpdateExceptionData(dtoObject, e.getMessage(), e.getStackTrace())); From b30cbd21acc8915a315e1552d7927c182d31f1c0 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 9 Sep 2024 23:25:01 +0100 Subject: [PATCH 213/342] Add skipped count to integration tests --- .../curation_api/Gff3BulkUploadITCase.java | 54 +++++++++---------- .../OrthologyBulkUploadFmsITCase.java | 4 +- ...ceTargetingReagentBulkUploadFmsITCase.java | 9 ++-- ...entGeneAssociationBulkUploadFmsITCase.java | 4 +- .../curation_api/base/BaseITCase.java | 41 ++++++-------- 5 files changed, 52 insertions(+), 60 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 503f12fd1..db0b00622 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -65,9 +65,9 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { loadRequiredEntities(); HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", params); @@ -100,9 +100,9 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { public void gff3DataBulkUploadExonEntity() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", params); @@ -137,9 +137,9 @@ public void gff3DataBulkUploadExonEntity() throws Exception { public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", params); @@ -176,9 +176,9 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", params); @@ -208,17 +208,17 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { public void gff3DataBulkUploadMissingRequiredFields() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 1, 0)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", params); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", params); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", params); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", params); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", params); checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", params); checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", params); @@ -229,15 +229,15 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 1, 0)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", params); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", params); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", params); checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", params); checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", params); @@ -248,15 +248,15 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { public void gff3DataBulkUploadInvalidFields() throws Exception { HashMap> params = new HashMap<>(); - params.put("Entities", createCountParams(1, 0, 1)); - params.put("Locations", createCountParams(1, 1, 0)); - params.put("Associations", createCountParams(1, 0, 1)); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", params); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", params); - params.put("Locations", createCountParams(1, 0, 1)); - params.put("Associations", createCountParams(1, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", params); checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", params); checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", params); diff --git a/src/test/java/org/alliancegenome/curation_api/OrthologyBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/OrthologyBulkUploadFmsITCase.java index 29b9cbf32..271bdb623 100644 --- a/src/test/java/org/alliancegenome/curation_api/OrthologyBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/OrthologyBulkUploadFmsITCase.java @@ -101,8 +101,8 @@ public void orthologyBulkUploadEmptyRequiredFields() throws Exception { @Order(4) public void orthologyBulkUploadInvalidFields() throws Exception { - checkFailedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_01_invalid_gene1.json"); - checkFailedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_02_invalid_gene2.json"); + checkSkippedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_01_invalid_gene1.json"); + checkSkippedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_02_invalid_gene2.json"); checkFailedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_03_invalid_gene1Species.json"); checkFailedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_04_invalid_gene2Species.json"); checkFailedBulkLoad(orthologyBulkPostEndpoint, orthologyTestFilePath + "IV_05_invalid_isBestScore.json"); diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java index d0db7a31d..5bb9fe659 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentBulkUploadFmsITCase.java @@ -67,17 +67,16 @@ public void sqtrBulkUploadCheckFields() throws Exception { @Order(2) public void sqtrBulkUploadMissingRequiredFields() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_01_no_name.json", "Records", 2, 1, 1); - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_02_no_taxon.json", "Records", 2, 1, 1); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_01_no_name.json", "Records", 2, 1, 1, 0); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrTestFilePath + "MR_02_no_taxon.json", "Records", 2, 1, 1, 0); } @Test @Order(3) public void sqtrBulkUploadEmptyRequiredFields() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_01_empty_name.json", "Records", 2, 1, 1); - - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_02_empty_taxon.json", "Records", 2, 1, 1); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_01_empty_name.json", "Records", 2, 1, 1, 0); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrTestFilePath + "ER_02_empty_taxon.json", "Records", 2, 1, 1, 0); } diff --git a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java index 34b7069b1..46158106e 100644 --- a/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/SequenceTargetingReagentGeneAssociationBulkUploadFmsITCase.java @@ -91,13 +91,13 @@ public void sqtrGeneAssociationBulkUploadCheckFields() throws Exception { @Test @Order(2) public void sqtrGeneAssociationBulkUploadInvalidGenes() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "IV_01_invalid_gene_ids.json", "Records", 2, 1, 1); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "IV_01_invalid_gene_ids.json", "Records", 2, 1, 1, 0); } @Test @Order(3) public void sqtrGeneAssociationBulkUploadMissingGenes() throws Exception { - checkFailedBulkLoad(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "UE_01_update_empty_gene_ids.json", "Records", 2, 0, 2); + checkBulkLoadRecordCounts(sqtrBulkPostEndpoint, sqtrGeneAssociationTestFilePath + "UE_01_update_empty_gene_ids.json", "Records", 2, 0, 2, 0); } diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 16d94af98..ae88210ff 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -101,10 +101,10 @@ public VocabularyTerm addVocabularyTermToSet(String setName, String termName, Vo } public void checkFailedBulkLoad(String endpoint, String filePath) throws Exception { - checkFailedBulkLoad(endpoint, filePath, "Records", 1, 1, 0); + checkBulkLoadRecordCounts(endpoint, filePath, "Records", 1, 1, 0, 0); } - public void checkFailedBulkLoad(String endpoint, String filePath, String countType, int expectedTotalRecords, int expectedFailedRecords, int expectedCompletedRecords) throws Exception { + public void checkBulkLoadRecordCounts(String endpoint, String filePath, String countType, int expectedTotalRecords, int expectedFailedRecords, int expectedCompletedRecords, int expectedSkippedRecords) throws Exception { String content = Files.readString(Path.of(filePath)); RestAssured.given(). @@ -116,10 +116,10 @@ public void checkFailedBulkLoad(String endpoint, String filePath, String countTy statusCode(200). body("history.counts." + countType + ".total", is(expectedTotalRecords)). body("history.counts." + countType + ".failed", is(expectedFailedRecords)). - body("history.counts." + countType + ".completed", is(expectedCompletedRecords)); + body("history.counts." + countType + ".completed", is(expectedCompletedRecords)). + body("history.counts." + countType + ".skipped", is(expectedSkippedRecords)); } - public void checkFailedBulkLoad(String endpoint, String filePath, HashMap> params) throws Exception { String content = Files.readString(Path.of(filePath)); @@ -135,39 +135,32 @@ public void checkFailedBulkLoad(String endpoint, String filePath, HashMap createCountParams(int total, int failed, int completed) { + public HashMap createCountParams(int total, int failed, int completed, int skipped) { HashMap map = new HashMap(); map.put("total", total); map.put("failed", failed); map.put("completed", completed); + map.put("skipped", skipped); return map; } From eaee086a80534c81723ebf661febc1bd452ed008 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 9 Sep 2024 23:30:27 +0100 Subject: [PATCH 214/342] Add space --- .../java/org/alliancegenome/curation_api/base/BaseITCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index ae88210ff..9946cab1d 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -152,7 +152,7 @@ public void checkSuccessfulBulkLoad(String endpoint, String filePath) throws Exc } public void checkSuccessfulBulkLoad(String endpoint, String filePath, int nrRecords) throws Exception { - checkBulkLoadRecordCounts(endpoint, filePath, "Records",nrRecords, 0, nrRecords, 0); + checkBulkLoadRecordCounts(endpoint, filePath, "Records", nrRecords, 0, nrRecords, 0); } public HashMap createCountParams(int total, int failed, int completed, int skipped) { From d9ad97ee3450dcc87df265b351fe0f3b55e4bae7 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 9 Sep 2024 23:37:18 +0100 Subject: [PATCH 215/342] IT method refactor --- .../alliancegenome/curation_api/base/BaseITCase.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 9946cab1d..1cdc1c319 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -100,10 +100,6 @@ public VocabularyTerm addVocabularyTermToSet(String setName, String termName, Vo return response.getEntity(); } - public void checkFailedBulkLoad(String endpoint, String filePath) throws Exception { - checkBulkLoadRecordCounts(endpoint, filePath, "Records", 1, 1, 0, 0); - } - public void checkBulkLoadRecordCounts(String endpoint, String filePath, String countType, int expectedTotalRecords, int expectedFailedRecords, int expectedCompletedRecords, int expectedSkippedRecords) throws Exception { String content = Files.readString(Path.of(filePath)); @@ -120,7 +116,7 @@ public void checkBulkLoadRecordCounts(String endpoint, String filePath, String c body("history.counts." + countType + ".skipped", is(expectedSkippedRecords)); } - public void checkFailedBulkLoad(String endpoint, String filePath, HashMap> params) throws Exception { + public void checkBulkLoadRecordCounts(String endpoint, String filePath, HashMap> params) throws Exception { String content = Files.readString(Path.of(filePath)); ValidatableResponse resp = RestAssured.given(). @@ -139,6 +135,10 @@ public void checkFailedBulkLoad(String endpoint, String filePath, HashMap Date: Mon, 9 Sep 2024 23:45:11 +0100 Subject: [PATCH 216/342] Update method name --- .../curation_api/Gff3BulkUploadITCase.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index db0b00622..f678403e1 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -69,7 +69,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "GFF_01_transcript.json", params); RestAssured.given(). when(). @@ -104,7 +104,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", params); + checkBulkLoadRecordCounts(exonBulkPostEndpoint, gffDataTestFilePath + "GFF_02_exon.json", params); RestAssured.given(). when(). @@ -141,7 +141,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", params); + checkBulkLoadRecordCounts(cdsBulkPostEndpoint, gffDataTestFilePath + "GFF_03_CDS.json", params); RestAssured.given(). when(). @@ -180,7 +180,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "UD_01_update_transcript.json", params); RestAssured.given(). when(). @@ -212,16 +212,16 @@ public void gff3DataBulkUploadMissingRequiredFields() throws Exception { params.put("Locations", createCountParams(1, 1, 0, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", params); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", params); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", params); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_01_no_seq_id.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_02_no_start.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_03_no_end.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_04_no_strand.json", params); params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 1, 0, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", params); - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", params); - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "MR_05_no_transcript_parent.json", params); + checkBulkLoadRecordCounts(exonBulkPostEndpoint, gffDataTestFilePath + "MR_06_no_exon_parent.json", params); + checkBulkLoadRecordCounts(cdsBulkPostEndpoint, gffDataTestFilePath + "MR_07_no_cds_parent.json", params); } @Test @@ -233,14 +233,14 @@ public void gff3DataBulkUploadEmptyRequiredFields() throws Exception { params.put("Locations", createCountParams(1, 1, 0, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", params); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_01_empty_seq_id.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_02_empty_strand.json", params); params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 1, 0, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", params); - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", params); - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "ER_03_empty_transcript_parent.json", params); + checkBulkLoadRecordCounts(exonBulkPostEndpoint, gffDataTestFilePath + "ER_04_empty_exon_parent.json", params); + checkBulkLoadRecordCounts(cdsBulkPostEndpoint, gffDataTestFilePath + "ER_05_empty_cds_parent.json", params); } @Test @@ -252,14 +252,14 @@ public void gff3DataBulkUploadInvalidFields() throws Exception { params.put("Locations", createCountParams(1, 1, 0, 0)); params.put("Associations", createCountParams(1, 0, 1, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", params); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_01_invalid_strand.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_02_invalid_phase.json", params); params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 1, 0, 0)); - checkFailedBulkLoad(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", params); - checkFailedBulkLoad(exonBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", params); - checkFailedBulkLoad(cdsBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", params); + checkBulkLoadRecordCounts(transcriptBulkPostEndpoint, gffDataTestFilePath + "IV_03_invalid_transcript_parent.json", params); + checkBulkLoadRecordCounts(exonBulkPostEndpoint, gffDataTestFilePath + "IV_04_invalid_exon_parent.json", params); + checkBulkLoadRecordCounts(cdsBulkPostEndpoint, gffDataTestFilePath + "IV_05_invalid_cds_parent.json", params); } } From 170a28317e1c69ff184fd779fe9db10ecdd647a3 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Mon, 9 Sep 2024 17:40:18 -0600 Subject: [PATCH 217/342] Fix NPE --- .../curation_api/model/entities/bulkloads/BulkLoadFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java index f79fa942a..50bd4293b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFile.java @@ -54,7 +54,7 @@ public class BulkLoadFile extends AuditedObject { private String s3Path; @JsonView({ View.FieldsOnly.class }) - private Integer recordCount; + private Integer recordCount = 0; @JsonView({ View.FieldsOnly.class }) private String linkMLSchemaVersion; From b6a602a1f0fce2ee6ee3a35ce937872815ba5012 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 08:56:35 +0100 Subject: [PATCH 218/342] Update exception inheritance --- .../base/BaseAnnotationDTOCrudController.java | 6 +++--- .../base/SubmittedObjectCrudController.java | 6 +++--- .../exceptions/KnownIssueValidationException.java | 2 +- .../exceptions/ObjectUpdateException.java | 2 +- .../exceptions/ValidationException.java | 10 ++++++++++ .../base/BaseUpsertControllerInterface.java | 4 ++-- .../crud/BaseUpsertServiceInterface.java | 6 +++--- .../jobs/executors/gff/Gff3Executor.java | 4 ++-- .../services/AGMDiseaseAnnotationService.java | 4 ++-- .../services/AGMPhenotypeAnnotationService.java | 6 +++--- .../services/AffectedGenomicModelService.java | 4 ++-- .../services/AlleleDiseaseAnnotationService.java | 4 ++-- .../services/AllelePhenotypeAnnotationService.java | 6 +++--- .../curation_api/services/AlleleService.java | 4 ++-- .../services/BiologicalEntityService.java | 4 ++-- .../curation_api/services/ConstructService.java | 4 ++-- .../services/GeneDiseaseAnnotationService.java | 4 ++-- .../services/GeneExpressionAnnotationService.java | 4 ++-- .../services/GeneGeneticInteractionService.java | 4 ++-- .../services/GeneMolecularInteractionService.java | 4 ++-- .../services/GenePhenotypeAnnotationService.java | 4 ++-- .../curation_api/services/GeneService.java | 6 +++--- .../services/GeneToGeneParalogyService.java | 4 ++-- .../services/GenomicEntityService.java | 6 +++--- .../curation_api/services/Gff3Service.java | 14 +++++++------- .../HTPExpressionDatasetAnnotationService.java | 4 ++-- .../curation_api/services/MoleculeService.java | 3 ++- .../services/PhenotypeAnnotationService.java | 6 +++--- .../services/ResourceDescriptorService.java | 4 ++-- .../services/SequenceTargetingReagentService.java | 4 ++-- .../curation_api/services/VariantService.java | 4 ++-- ...enceTargetingReagentGeneAssociationService.java | 4 ++-- .../AlleleGeneAssociationService.java | 4 ++-- .../ConstructGenomicEntityAssociationService.java | 4 ++-- .../services/base/BaseDTOCrudService.java | 4 ++-- .../GeneToGeneOrthologyGeneratedService.java | 5 ++--- .../dto/AGMDiseaseAnnotationDTOValidator.java | 4 ++-- .../GeneExpressionAnnotationFmsDTOValidator.java | 4 ++-- .../dto/fms/OrthologyFmsDTOValidator.java | 3 ++- 39 files changed, 97 insertions(+), 86 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/exceptions/ValidationException.java diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java index 3a733fcac..66440b4b5 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java @@ -3,7 +3,7 @@ import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; 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.ValidationException; import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; import org.alliancegenome.curation_api.model.entities.Annotation; import org.alliancegenome.curation_api.model.ingest.dto.AnnotationDTO; @@ -23,11 +23,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { + public E upsert(T dto) throws ValidationException, KnownIssueValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException { return service.upsert(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java index 000a7e0ec..70261bf39 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java @@ -3,7 +3,7 @@ import org.alliancegenome.curation_api.dao.base.BaseEntityDAO; 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.ValidationException; import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; @@ -22,11 +22,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { + public E upsert(T dto) throws ValidationException, KnownIssueValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException { return service.upsert(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java b/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java index ddb7b3ff8..5ce5b4cfc 100644 --- a/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java +++ b/src/main/java/org/alliancegenome/curation_api/exceptions/KnownIssueValidationException.java @@ -1,6 +1,6 @@ package org.alliancegenome.curation_api.exceptions; -public class KnownIssueValidationException extends Exception { +public class KnownIssueValidationException extends ValidationException { public KnownIssueValidationException(String message) { super(message); diff --git a/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java b/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java index 15516e435..1999bc7c6 100644 --- a/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java +++ b/src/main/java/org/alliancegenome/curation_api/exceptions/ObjectUpdateException.java @@ -13,7 +13,7 @@ import lombok.NoArgsConstructor; @Data -public class ObjectUpdateException extends Exception { +public class ObjectUpdateException extends ValidationException { private ObjectUpdateExceptionData data; diff --git a/src/main/java/org/alliancegenome/curation_api/exceptions/ValidationException.java b/src/main/java/org/alliancegenome/curation_api/exceptions/ValidationException.java new file mode 100644 index 000000000..e56f8e5cf --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/exceptions/ValidationException.java @@ -0,0 +1,10 @@ +package org.alliancegenome.curation_api.exceptions; + +import lombok.NoArgsConstructor; + +@NoArgsConstructor +public class ValidationException extends Exception { + public ValidationException(String message) { + super(message); + } +} \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java index d85d38ca7..5a0f46fe9 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java @@ -1,7 +1,7 @@ package org.alliancegenome.curation_api.interfaces.base; import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; import org.alliancegenome.curation_api.view.View; @@ -16,5 +16,5 @@ public interface BaseUpsertControllerInterface { - default E upsert(T dto) throws ObjectUpdateException, KnownIssueValidationException { + default E upsert(T dto) throws ValidationException, KnownIssueValidationException { return upsert(dto, null); } - E upsert(T dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException, KnownIssueValidationException; + E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException; } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java index a5bc5c365..f4183aced 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3Executor.java @@ -2,7 +2,7 @@ import java.util.List; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.jobs.executors.LoadFileExecutor; import org.alliancegenome.curation_api.services.Gff3Service; @@ -14,7 +14,7 @@ public class Gff3Executor extends LoadFileExecutor { @Inject Gff3Service gff3Service; - public String loadGenomeAssemblyFromGFF(List gffHeaderData) throws ObjectUpdateException { + public String loadGenomeAssemblyFromGFF(List gffHeaderData) throws ValidationException { for (String header : gffHeaderData) { if (header.startsWith("#!assembly")) { String assemblyName = header.split(" ")[1]; diff --git a/src/main/java/org/alliancegenome/curation_api/services/AGMDiseaseAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/AGMDiseaseAnnotationService.java index 749aecd0d..5ef94e4f1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AGMDiseaseAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AGMDiseaseAnnotationService.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; import org.alliancegenome.curation_api.dao.ConditionRelationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.AGMDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -48,7 +48,7 @@ public ObjectResponse create(AGMDiseaseAnnotation uiEntity } @Transactional - public AGMDiseaseAnnotation upsert(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AGMDiseaseAnnotation upsert(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AGMDiseaseAnnotation annotation = agmDiseaseAnnotationDtoValidator.validateAGMDiseaseAnnotationDTO(dto, dataProvider); return agmDiseaseAnnotationDAO.persist(annotation); diff --git a/src/main/java/org/alliancegenome/curation_api/services/AGMPhenotypeAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/AGMPhenotypeAnnotationService.java index fbcf98f70..afdb82612 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AGMPhenotypeAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AGMPhenotypeAnnotationService.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.dao.AGMPhenotypeAnnotationDAO; import org.alliancegenome.curation_api.dao.ConditionRelationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.ingest.dto.fms.PhenotypeFmsDTO; @@ -45,13 +45,13 @@ public ObjectResponse create(AGMPhenotypeAnnotation uiEn } @Transactional - public AGMPhenotypeAnnotation upsertPrimaryAnnotation(AffectedGenomicModel subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AGMPhenotypeAnnotation upsertPrimaryAnnotation(AffectedGenomicModel subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AGMPhenotypeAnnotation annotation = agmPhenotypeAnnotationFmsDtoValidator.validatePrimaryAnnotation(subject, dto, dataProvider); return agmPhenotypeAnnotationDAO.persist(annotation); } @Transactional - public List addInferredOrAssertedEntities(AffectedGenomicModel primaryAnnotationSubject, PhenotypeFmsDTO secondaryAnnotationDto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public List addInferredOrAssertedEntities(AffectedGenomicModel primaryAnnotationSubject, PhenotypeFmsDTO secondaryAnnotationDto, BackendBulkDataProvider dataProvider) throws ValidationException { List annotations = agmPhenotypeAnnotationFmsDtoValidator.validateInferredOrAssertedEntities(primaryAnnotationSubject, secondaryAnnotationDto, dataProvider); for (AGMPhenotypeAnnotation annotation : annotations) { agmPhenotypeAnnotationDAO.persist(annotation); diff --git a/src/main/java/org/alliancegenome/curation_api/services/AffectedGenomicModelService.java b/src/main/java/org/alliancegenome/curation_api/services/AffectedGenomicModelService.java index 864322e57..c8c706a4f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AffectedGenomicModelService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AffectedGenomicModelService.java @@ -11,7 +11,7 @@ import org.alliancegenome.curation_api.dao.AlleleDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.ingest.dto.AffectedGenomicModelDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -60,7 +60,7 @@ public ObjectResponse create(AffectedGenomicModel uiEntity } @Transactional - public AffectedGenomicModel upsert(AffectedGenomicModelDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AffectedGenomicModel upsert(AffectedGenomicModelDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AffectedGenomicModel agm = agmDtoValidator.validateAffectedGenomicModelDTO(dto, dataProvider); if (agm == null) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/AlleleDiseaseAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/AlleleDiseaseAnnotationService.java index c37106298..33d24d3a8 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AlleleDiseaseAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AlleleDiseaseAnnotationService.java @@ -4,7 +4,7 @@ import org.alliancegenome.curation_api.dao.AlleleDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.AlleleDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -46,7 +46,7 @@ public ObjectResponse create(AlleleDiseaseAnnotation ui } @Transactional - public AlleleDiseaseAnnotation upsert(AlleleDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AlleleDiseaseAnnotation upsert(AlleleDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AlleleDiseaseAnnotation annotation = alleleDiseaseAnnotationDtoValidator.validateAlleleDiseaseAnnotationDTO(dto, dataProvider); return alleleDiseaseAnnotationDAO.persist(annotation); diff --git a/src/main/java/org/alliancegenome/curation_api/services/AllelePhenotypeAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/AllelePhenotypeAnnotationService.java index 98df22cf6..598981b22 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AllelePhenotypeAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AllelePhenotypeAnnotationService.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.dao.AllelePhenotypeAnnotationDAO; import org.alliancegenome.curation_api.dao.ConditionRelationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.PhenotypeFmsDTO; @@ -45,13 +45,13 @@ public ObjectResponse create(AllelePhenotypeAnnotatio } @Transactional - public AllelePhenotypeAnnotation upsertPrimaryAnnotation(Allele subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AllelePhenotypeAnnotation upsertPrimaryAnnotation(Allele subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AllelePhenotypeAnnotation annotation = allelePhenotypeAnnotationFmsDtoValidator.validatePrimaryAnnotation(subject, dto, dataProvider); return allelePhenotypeAnnotationDAO.persist(annotation); } @Transactional - public List addInferredOrAssertedEntities(Allele primaryAnnotationSubject, PhenotypeFmsDTO secondaryAnnotationDto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public List addInferredOrAssertedEntities(Allele primaryAnnotationSubject, PhenotypeFmsDTO secondaryAnnotationDto, BackendBulkDataProvider dataProvider) throws ValidationException { List annotations = allelePhenotypeAnnotationFmsDtoValidator.validateInferredOrAssertedEntities(primaryAnnotationSubject, secondaryAnnotationDto, dataProvider); for (AllelePhenotypeAnnotation annotation : annotations) { allelePhenotypeAnnotationDAO.persist(annotation); diff --git a/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java b/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java index 3a5ed3d90..ac0457877 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java @@ -10,7 +10,7 @@ import org.alliancegenome.curation_api.dao.AlleleDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.ingest.dto.AlleleDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -65,7 +65,7 @@ public ObjectResponse create(Allele uiEntity) { return new ObjectResponse(dbEntity); } - public Allele upsert(AlleleDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Allele upsert(AlleleDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { return alleleDtoValidator.validateAlleleDTO(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/BiologicalEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/BiologicalEntityService.java index 3cc6c4127..891e98540 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/BiologicalEntityService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/BiologicalEntityService.java @@ -2,7 +2,7 @@ import org.alliancegenome.curation_api.dao.BiologicalEntityDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.BiologicalEntity; import org.alliancegenome.curation_api.model.ingest.dto.BiologicalEntityDTO; import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; @@ -23,7 +23,7 @@ protected void init() { } @Override - public BiologicalEntity upsert(BiologicalEntityDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public BiologicalEntity upsert(BiologicalEntityDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { return null; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java b/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java index bd985dcd3..28a6c076b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java @@ -11,7 +11,7 @@ import org.alliancegenome.curation_api.dao.slotAnnotations.constructSlotAnnotations.ConstructComponentSlotAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Construct; import org.alliancegenome.curation_api.model.ingest.dto.ConstructDTO; @@ -73,7 +73,7 @@ public ObjectResponse create(Construct uiEntity) { } @Transactional - public Construct upsert(ConstructDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Construct upsert(ConstructDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { Construct construct = constructDtoValidator.validateConstructDTO(dto, dataProvider); return constructDAO.persist(construct); diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneDiseaseAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneDiseaseAnnotationService.java index a59e770a3..7e3747345 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneDiseaseAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneDiseaseAnnotationService.java @@ -4,7 +4,7 @@ import org.alliancegenome.curation_api.dao.GeneDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.GeneDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -46,7 +46,7 @@ public ObjectResponse create(GeneDiseaseAnnotation uiEnti } @Transactional - public GeneDiseaseAnnotation upsert(GeneDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public GeneDiseaseAnnotation upsert(GeneDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { GeneDiseaseAnnotation annotation = geneDiseaseAnnotationDtoValidator.validateGeneDiseaseAnnotationDTO(dto, dataProvider); return geneDiseaseAnnotationDAO.persist(annotation); 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 226d8798d..1ffe515ac 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneExpressionAnnotationService.java @@ -7,7 +7,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.GeneExpressionAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionFmsDTO; @@ -43,7 +43,7 @@ public List getAnnotationIdsByDataProvider(BackendBulkDataProvider dataPro @Transactional @Override - public GeneExpressionAnnotation upsert(GeneExpressionFmsDTO geneExpressionFmsDTO, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public GeneExpressionAnnotation upsert(GeneExpressionFmsDTO geneExpressionFmsDTO, BackendBulkDataProvider dataProvider) throws ValidationException { GeneExpressionAnnotation geneExpressionAnnotation = geneExpressionAnnotationFmsDTOValidator.validateAnnotation(geneExpressionFmsDTO, dataProvider); return geneExpressionAnnotationDAO.persist(geneExpressionAnnotation); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneGeneticInteractionService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneGeneticInteractionService.java index af65d76cc..906341741 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneGeneticInteractionService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneGeneticInteractionService.java @@ -4,7 +4,7 @@ import org.alliancegenome.curation_api.dao.GeneGeneticInteractionDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.GeneGeneticInteraction; import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; @@ -35,7 +35,7 @@ public ObjectResponse getByIdentifier(String identifier) } @Transactional - public GeneGeneticInteraction upsert(PsiMiTabDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public GeneGeneticInteraction upsert(PsiMiTabDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { GeneGeneticInteraction interaction = geneGeneticInteractionValidator.validateGeneGeneticInteractionFmsDTO(dto); return geneGeneticInteractionDAO.persist(interaction); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneMolecularInteractionService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneMolecularInteractionService.java index c0ff26fab..dbbc33b2f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneMolecularInteractionService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneMolecularInteractionService.java @@ -4,7 +4,7 @@ import org.alliancegenome.curation_api.dao.GeneMolecularInteractionDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.GeneMolecularInteraction; import org.alliancegenome.curation_api.model.ingest.dto.fms.PsiMiTabDTO; @@ -34,7 +34,7 @@ public ObjectResponse getByIdentifier(String identifie } @Transactional - public GeneMolecularInteraction upsert(PsiMiTabDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public GeneMolecularInteraction upsert(PsiMiTabDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { GeneMolecularInteraction interaction = geneMolInteractionValidator.validateGeneMolecularInteractionFmsDTO(dto); return geneMolecularInteractionDAO.persist(interaction); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GenePhenotypeAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/GenePhenotypeAnnotationService.java index 4b72fc0f5..5b9f13f28 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GenePhenotypeAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GenePhenotypeAnnotationService.java @@ -5,7 +5,7 @@ import org.alliancegenome.curation_api.dao.ConditionRelationDAO; import org.alliancegenome.curation_api.dao.GenePhenotypeAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GenePhenotypeAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.PhenotypeFmsDTO; @@ -45,7 +45,7 @@ public ObjectResponse create(GenePhenotypeAnnotation ui } @Transactional - public GenePhenotypeAnnotation upsertPrimaryAnnotation(Gene subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public GenePhenotypeAnnotation upsertPrimaryAnnotation(Gene subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { GenePhenotypeAnnotation annotation = genePhenotypeAnnotationFmsDtoValidator.validatePrimaryAnnotation(subject, dto, dataProvider); return genePhenotypeAnnotationDAO.persist(annotation); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneService.java index 0203641b4..fb9bf1ab3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneService.java @@ -10,7 +10,7 @@ import org.alliancegenome.curation_api.dao.GeneDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.ingest.dto.GeneDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -64,12 +64,12 @@ public ObjectResponse create(Gene uiEntity) { } @Override - public Gene upsert(GeneDTO dto) throws ObjectUpdateException { + public Gene upsert(GeneDTO dto) throws ValidationException { return upsert(dto, null); } @Override - public Gene upsert(GeneDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Gene upsert(GeneDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { return geneDtoValidator.validateGeneDTO(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GeneToGeneParalogyService.java b/src/main/java/org/alliancegenome/curation_api/services/GeneToGeneParalogyService.java index 40bb57c20..b2fb2509b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GeneToGeneParalogyService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GeneToGeneParalogyService.java @@ -7,7 +7,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.GeneToGeneParalogyDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.GeneToGeneParalogy; import org.alliancegenome.curation_api.model.ingest.dto.fms.ParalogyFmsDTO; @@ -31,7 +31,7 @@ protected void init() { setSQLDao(geneToGeneParalogyDAO); } - public GeneToGeneParalogy upsert(ParalogyFmsDTO paralogyData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public GeneToGeneParalogy upsert(ParalogyFmsDTO paralogyData, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { return paralogyFmsDtoValidator.validateParalogyFmsDTO(paralogyData); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java index 5eb528dc7..b1a21dfd0 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java @@ -2,7 +2,7 @@ import org.alliancegenome.curation_api.dao.GenomicEntityDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.GenomicEntity; import org.alliancegenome.curation_api.model.ingest.dto.GenomicEntityDTO; import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; @@ -23,12 +23,12 @@ protected void init() { } @Override - public GenomicEntity upsert(GenomicEntityDTO dto) throws ObjectUpdateException { + public GenomicEntity upsert(GenomicEntityDTO dto) throws ValidationException { return null; } @Override - public GenomicEntity upsert(GenomicEntityDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public GenomicEntity upsert(GenomicEntityDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { return null; } 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 3b7e3f854..35d51a418 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -11,7 +11,7 @@ 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.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.CodingSequence; import org.alliancegenome.curation_api.model.entities.Exon; @@ -58,7 +58,7 @@ public class Gff3Service { @Inject Gff3DtoValidator gff3DtoValidator; @Transactional - public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); if (StringUtils.isBlank(assemblyId)) { @@ -85,7 +85,7 @@ public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadCDSLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -112,7 +112,7 @@ public void loadCDSLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadTranscriptLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -140,7 +140,7 @@ public void loadTranscriptLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadExonParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); if (!StringUtils.equals(gffEntry.getType(), "exon") && !StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { @@ -164,7 +164,7 @@ public void loadExonParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadCDSParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); @@ -187,7 +187,7 @@ public void loadCDSParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ObjectUpdateException { + public void loadGeneParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); if (!Gff3Constants.TRANSCRIPT_TYPES.contains(gffEntry.getType())) { throw new ObjectValidationException(gffEntry, "Invalid Type: " + gffEntry.getType() + " for Gene Transcript Associations"); diff --git a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java index b6a674d35..75a29ed17 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/HTPExpressionDatasetAnnotationService.java @@ -8,7 +8,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.HTPExpressionDatasetAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; @@ -31,7 +31,7 @@ protected void init() { setSQLDao(htpExpressionDatasetAnnotationDAO); } - public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException { + public HTPExpressionDatasetAnnotation upsert(HTPExpressionDatasetAnnotationFmsDTO htpExpressionDatasetAnnotationData, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { return htpExpressionDatasetAnnotationFmsDtoValidator.validateHTPExpressionDatasetAnnotationFmsDTO(htpExpressionDatasetAnnotationData, backendBulkDataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java b/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java index 9dca70697..8c23a6c58 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/MoleculeService.java @@ -11,6 +11,7 @@ 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.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.Molecule; @@ -62,7 +63,7 @@ public ObjectResponse update(Molecule uiEntity) { } @Transactional - public Molecule upsert(MoleculeFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectUpdateException, KnownIssueValidationException { + public Molecule upsert(MoleculeFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { log.debug("processUpdate Molecule: "); if (StringUtils.isBlank(dto.getId())) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/PhenotypeAnnotationService.java b/src/main/java/org/alliancegenome/curation_api/services/PhenotypeAnnotationService.java index aaf95f4d8..b27f56562 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/PhenotypeAnnotationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/PhenotypeAnnotationService.java @@ -15,7 +15,7 @@ import org.alliancegenome.curation_api.dao.PhenotypeAnnotationDAO; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; @@ -91,7 +91,7 @@ protected > List getAnnotationIdsByDataProvider(D return annotationIds; } - public Long upsertPrimaryAnnotation(PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Long upsertPrimaryAnnotation(PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { if (StringUtils.isBlank(dto.getObjectId())) { throw new ObjectValidationException(dto, "objectId - " + ValidationConstants.REQUIRED_MESSAGE); } @@ -115,7 +115,7 @@ public Long upsertPrimaryAnnotation(PhenotypeFmsDTO dto, BackendBulkDataProvider } - public List addInferredOrAssertedEntities(PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public List addInferredOrAssertedEntities(PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { List primaryAnnotationIds = new ArrayList<>(); for (String primaryGeneticEntityCurie : dto.getPrimaryGeneticEntityIds()) { GenomicEntity primaryAnnotationSubject = genomicEntityService.findByIdentifierString(primaryGeneticEntityCurie); diff --git a/src/main/java/org/alliancegenome/curation_api/services/ResourceDescriptorService.java b/src/main/java/org/alliancegenome/curation_api/services/ResourceDescriptorService.java index 545ff6d59..30cfd1d80 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ResourceDescriptorService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ResourceDescriptorService.java @@ -6,7 +6,7 @@ import java.util.Objects; import org.alliancegenome.curation_api.dao.ResourceDescriptorDAO; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; import org.alliancegenome.curation_api.model.ingest.dto.ResourceDescriptorDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -43,7 +43,7 @@ public List getAllNames() { } @Transactional - public ResourceDescriptor upsert(ResourceDescriptorDTO dto) throws ObjectUpdateException { + public ResourceDescriptor upsert(ResourceDescriptorDTO dto) throws ValidationException { ResourceDescriptor rd = resourceDescriptorDtoValidator.validateResourceDescriptorDTO(dto); if (rd == null) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java index 90b417b9f..6fe61cffe 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/SequenceTargetingReagentService.java @@ -8,7 +8,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; @@ -33,7 +33,7 @@ protected void init() { } @Transactional - public SequenceTargetingReagent upsert(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public SequenceTargetingReagent upsert(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { SequenceTargetingReagent sqtr = sqtrDtoValidator.validateSQTRFmsDTO(dto, dataProvider); return sqtrDAO.persist(sqtr); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java index fd8b1808b..9b720b5fe 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java @@ -10,7 +10,7 @@ import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; @@ -55,7 +55,7 @@ public ObjectResponse create(Variant uiEntity) { return new ObjectResponse(dbEntity); } - public Variant upsert(VariantDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public Variant upsert(VariantDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { return variantDtoValidator.validateVariantDTO(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java index feeef193a..25e767f6f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/SequenceTargetingReagentGeneAssociationService.java @@ -10,7 +10,7 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.associations.SequenceTargetingReagentGeneAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations.SequenceTargetingReagentGeneAssociation; @@ -40,7 +40,7 @@ protected void init() { } @Transactional - public List loadGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public List loadGeneAssociations(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { List associations = sequenceTargetingReagentGeneAssociationFmsDTOValidator .validateSQTRGeneAssociationFmsDTO(dto, dataProvider); diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleGeneAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleGeneAssociationService.java index 0cc75b83f..9b3b46f04 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleGeneAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleGeneAssociationService.java @@ -15,7 +15,7 @@ import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.crud.BaseUpsertServiceInterface; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.Gene; @@ -72,7 +72,7 @@ public ObjectResponse validate(AlleleGeneAssociation uiEn @Override @Transactional - public AlleleGeneAssociation upsert(AlleleGeneAssociationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public AlleleGeneAssociation upsert(AlleleGeneAssociationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AlleleGeneAssociation association = alleleGeneAssociationDtoValidator.validateAlleleGeneAssociationDTO(dto, dataProvider); if (association != null) { addAssociationToAllele(association); 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 cac42ed22..338ad13fa 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 @@ -15,7 +15,7 @@ import org.alliancegenome.curation_api.dao.associations.constructAssociations.ConstructGenomicEntityAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +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; @@ -70,7 +70,7 @@ public ObjectResponse validate(ConstructGenom } @Transactional - public ConstructGenomicEntityAssociation upsert(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectUpdateException { + public ConstructGenomicEntityAssociation upsert(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { ConstructGenomicEntityAssociation association = constructGenomicEntityAssociationDtoValidator.validateConstructGenomicEntityAssociationDTO(dto, dataProvider); if (association != null) { addAssociationToConstruct(association); diff --git a/src/main/java/org/alliancegenome/curation_api/services/base/BaseDTOCrudService.java b/src/main/java/org/alliancegenome/curation_api/services/base/BaseDTOCrudService.java index 56b19cc25..933c7ff4d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/base/BaseDTOCrudService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/base/BaseDTOCrudService.java @@ -2,7 +2,7 @@ import org.alliancegenome.curation_api.dao.base.BaseEntityDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; @@ -10,6 +10,6 @@ public abstract class BaseDTOCrudService response = new ObjectResponse<>(); GeneExpressionAnnotation geneExpressionAnnotation; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java index e9bf41af1..7e5ed7a78 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/OrthologyFmsDTOValidator.java @@ -11,6 +11,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; 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.Gene; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; @@ -37,7 +38,7 @@ public class OrthologyFmsDTOValidator { @Inject VocabularyTermService vocabularyTermService; @Transactional - public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) throws ObjectValidationException, KnownIssueValidationException { + public GeneToGeneOrthologyGenerated validateOrthologyFmsDTO(OrthologyFmsDTO dto) throws ValidationException { ObjectResponse orthologyResponse = new ObjectResponse(); From 79f0ec41b3ec23d9b7abea18f9965ac61dae1338 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 08:58:15 +0100 Subject: [PATCH 219/342] Update controllers --- .../controllers/base/BaseAnnotationDTOCrudController.java | 5 ++--- .../controllers/base/SubmittedObjectCrudController.java | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java index 66440b4b5..1e3765869 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/BaseAnnotationDTOCrudController.java @@ -2,7 +2,6 @@ import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; import org.alliancegenome.curation_api.model.entities.Annotation; @@ -23,11 +22,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ValidationException, KnownIssueValidationException { + public E upsert(T dto) throws ValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException { return service.upsert(dto, dataProvider); } diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java index 70261bf39..6831cdb0e 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/base/SubmittedObjectCrudController.java @@ -2,7 +2,6 @@ import org.alliancegenome.curation_api.dao.base.BaseEntityDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; @@ -22,11 +21,11 @@ protected void setService(S service) { } @Override - public E upsert(T dto) throws ValidationException, KnownIssueValidationException { + public E upsert(T dto) throws ValidationException { return service.upsert(dto); } - public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException { + public E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException { return service.upsert(dto, dataProvider); } From be9ef8b8dead62c6f7ae1b223cb2403575e85e7f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 14:31:02 +0100 Subject: [PATCH 220/342] Integration test base method refactor --- .../curation_api/AlleleBulkUploadITCase.java | 8 +- .../AlleleGeneAssociationITCase.java | 12 +- .../curation_api/AlleleITCase.java | 4 +- ...nstructGenomicEntityAssociationITCase.java | 6 +- .../curation_api/ConstructITCase.java | 2 +- .../DiseaseAnnotationBulkUploadITCase.java | 51 +- .../curation_api/DiseaseAnnotationITCase.java | 28 +- .../ExpressionBulkUploadFmsITCase.java | 22 +- .../curation_api/GeneBulkUploadITCase.java | 4 +- .../GeneInteractionBulkUploadFmsITCase.java | 28 +- .../curation_api/Gff3BulkUploadITCase.java | 2 +- .../ParalogyBulkUploadFmsITCase.java | 2 +- ...henotypeAnnotationBulkUploadFmsITCase.java | 22 +- .../curation_api/VariantBulkUploadITCase.java | 8 +- .../curation_api/base/BaseITCase.java | 618 ++++++++---------- 15 files changed, 375 insertions(+), 442 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/AlleleBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/AlleleBulkUploadITCase.java index 692f7302d..5b8f69c76 100644 --- a/src/test/java/org/alliancegenome/curation_api/AlleleBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/AlleleBulkUploadITCase.java @@ -56,10 +56,10 @@ public void init() { private final String alleleTestFilePath = "src/test/resources/bulk/02_allele/"; private void loadRequiredEntities() throws Exception { - loadSOTerm(requiredSoTerm, "Test SOTerm"); - loadSOTerm(requiredSoTerm2, "Test SOTerm2"); - loadMPTerm(requiredMpTerm, "Test MPTerm"); - loadMPTerm(requiredMpTerm2, "Test MPTerm2"); + createSoTerm(requiredSoTerm, "Test SOTerm", false); + createSoTerm(requiredSoTerm2, "Test SOTerm2", false); + createMpTerm(requiredMpTerm, "Test MPTerm"); + createMpTerm(requiredMpTerm2, "Test MPTerm2"); } @Test diff --git a/src/test/java/org/alliancegenome/curation_api/AlleleGeneAssociationITCase.java b/src/test/java/org/alliancegenome/curation_api/AlleleGeneAssociationITCase.java index 89133587b..8ab1144aa 100644 --- a/src/test/java/org/alliancegenome/curation_api/AlleleGeneAssociationITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/AlleleGeneAssociationITCase.java @@ -67,12 +67,12 @@ public class AlleleGeneAssociationITCase extends BaseITCase { private void loadRequiredEntities() { Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolNameType = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); - allele = createAllele("AGA:Allele0001", "NCBITaxon:6239", false, symbolNameType); - allele2 = createAllele("AGA:Allele0002", "NCBITaxon:6239", false, symbolNameType); - obsoleteAllele = createAllele("AGA:Allele0003", "NCBITaxon:6239", true, symbolNameType); - gene = createGene("AGA:Gene0001", "NCBITaxon:6239", false, symbolNameType); - gene2 = createGene("AGA:Gene0002", "NCBITaxon:6239", false, symbolNameType); - obsoleteGene = createGene("AGA:Gene0003", "NCBITaxon:6239", true, symbolNameType); + allele = createAllele("AGA:Allele0001", "NCBITaxon:6239", symbolNameType, false); + allele2 = createAllele("AGA:Allele0002", "NCBITaxon:6239", symbolNameType, false); + obsoleteAllele = createAllele("AGA:Allele0003", "NCBITaxon:6239", symbolNameType, true); + gene = createGene("AGA:Gene0001", "NCBITaxon:6239", symbolNameType, false); + gene2 = createGene("AGA:Gene0002", "NCBITaxon:6239", symbolNameType, false); + obsoleteGene = createGene("AGA:Gene0003", "NCBITaxon:6239", symbolNameType, true); Vocabulary relationVocabulary = getVocabulary(VocabularyConstants.ALLELE_RELATION_VOCABULARY); relation = getVocabularyTerm(relationVocabulary, "is_allele_of"); relation2 = getVocabularyTerm(relationVocabulary, "mutation_excludes"); diff --git a/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java b/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java index 0eefb703a..891683641 100644 --- a/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/AlleleITCase.java @@ -206,8 +206,8 @@ private void loadRequiredEntities() { nonPersistedOrganization = new Organization(); nonPersistedOrganization.setAbbreviation("INV"); VocabularyTerm symbolNameType = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); - gene = createGene("TEST:AssociatedGene1", "NCBITaxon:6239", false, symbolNameType); - gene2 = createGene("TEST:AssociatedGene2", "NCBITaxon:6239", false, symbolNameType); + gene = createGene("TEST:AssociatedGene1", "NCBITaxon:6239", symbolNameType, false); + gene2 = createGene("TEST:AssociatedGene2", "NCBITaxon:6239", symbolNameType, false); Vocabulary relationVocabulary = getVocabulary(VocabularyConstants.ALLELE_RELATION_VOCABULARY); geneAssociationRelation = getVocabularyTerm(relationVocabulary, "is_allele_of"); geneAssociationRelation2 = getVocabularyTerm(relationVocabulary, "duplication"); diff --git a/src/test/java/org/alliancegenome/curation_api/ConstructGenomicEntityAssociationITCase.java b/src/test/java/org/alliancegenome/curation_api/ConstructGenomicEntityAssociationITCase.java index 47fd87120..05382712c 100644 --- a/src/test/java/org/alliancegenome/curation_api/ConstructGenomicEntityAssociationITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ConstructGenomicEntityAssociationITCase.java @@ -67,9 +67,9 @@ private void loadRequiredEntities() { construct = createConstruct("CGEA:Construct0001", false, symbolNameType); construct2 = createConstruct("CGEA:Construct0002", false, symbolNameType); obsoleteConstruct = createConstruct("CGEA:Construct0003", true, symbolNameType); - gene = createGene("CGEA:Gene0001", "NCBITaxon:6239", false, symbolNameType); - gene2 = createGene("CGEA:Gene0002", "NCBITaxon:6239", false, symbolNameType); - obsoleteGene = createGene("CGEA:Gene0003", "NCBITaxon:6239", true, symbolNameType); + gene = createGene("CGEA:Gene0001", "NCBITaxon:6239", symbolNameType, false); + gene2 = createGene("CGEA:Gene0002", "NCBITaxon:6239", symbolNameType, false); + obsoleteGene = createGene("CGEA:Gene0003", "NCBITaxon:6239", symbolNameType, true); Vocabulary relationVocabulary = getVocabulary(VocabularyConstants.CONSTRUCT_RELATION_VOCABULARY); relation = getVocabularyTerm(relationVocabulary, "is_regulated_by"); relation2 = getVocabularyTerm(relationVocabulary, "targets"); diff --git a/src/test/java/org/alliancegenome/curation_api/ConstructITCase.java b/src/test/java/org/alliancegenome/curation_api/ConstructITCase.java index d30ee762d..dc690e728 100644 --- a/src/test/java/org/alliancegenome/curation_api/ConstructITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ConstructITCase.java @@ -133,7 +133,7 @@ private void loadRequiredEntities() { constructFullName = createConstructFullNameSlotAnnotation(List.of(reference), "Test name", fullNameType, exactSynonymScope, "https://test.org"); constructSynonym = createConstructSynonymSlotAnnotation(List.of(reference), "Test synonym", systematicNameType, exactSynonymScope, "https://test.org"); VocabularyTerm symbolNameType = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); - gene = createGene("TEST:AssociatedGenomicEntity1", "NCBITaxon:6239", false, symbolNameType); + gene = createGene("TEST:AssociatedGenomicEntity1", "NCBITaxon:6239", symbolNameType, false); Vocabulary relationVocabulary = getVocabulary(VocabularyConstants.CONSTRUCT_RELATION_VOCABULARY); geAssociationRelation = getVocabularyTerm(relationVocabulary, "is_regulated_by"); } diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java index ad115c5cf..98edcd16d 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java @@ -117,41 +117,40 @@ public void init() { private final String daTestFilePath = "src/test/resources/bulk/04_disease_annotation/"; private void loadRequiredEntities() throws Exception { - loadDOTerm(doTerm, "Test DOTerm"); - loadDOTerm(doTerm2, "Test DOTerm 2"); + createDoTerm(doTerm, "Test DOTerm"); + createDoTerm(doTerm2, "Test DOTerm 2"); createEcoTerm(ecoTerm, "Test ECOTerm", false, true); createEcoTerm(ecoTerm2, "Test ECOTerm 2", false, true); createEcoTerm(unsupportedEcoTerm, "Test unsupported ECOTerm", false, false); createGoTerm(goTerm, "Test GOTerm", false); createGoTerm(goTerm2, "Test GOTerm 2", false); - loadExperimentalConditionTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); - loadZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", OntologyConstants.ZECO_AGR_SLIM_SUBSET); - loadZecoTerm(zecoTerm2, "Test ExperimentalConditionOntologyTerm 2", OntologyConstants.ZECO_AGR_SLIM_SUBSET); - loadZecoTerm(nonSlimZecoTerm, "Test ExperimentalConditionOntologyTerm", null); - loadChemicalTerm(chemicalTerm, "Test ChemicalTerm"); - loadChemicalTerm(chemicalTerm2, "Test ChemicalTerm 2"); - loadAnatomyTerm(anatomyTerm, "Test AnatomicalTerm"); - loadAnatomyTerm(anatomyTerm2, "Test AnatomicalTerm 2"); + createExperimentalConditionOntologyTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); + createZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", false, OntologyConstants.ZECO_AGR_SLIM_SUBSET); + createZecoTerm(zecoTerm2, "Test ExperimentalConditionOntologyTerm 2", false, OntologyConstants.ZECO_AGR_SLIM_SUBSET); + createZecoTerm(nonSlimZecoTerm, "Test ExperimentalConditionOntologyTerm", false); + createChemicalTerm(chemicalTerm, "Test ChemicalTerm"); + createChemicalTerm(chemicalTerm2, "Test ChemicalTerm 2"); + createAnatomicalTerm(anatomyTerm, "Test AnatomicalTerm"); + createAnatomicalTerm(anatomyTerm2, "Test AnatomicalTerm 2"); Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); DataProvider ratDataProvider = createDataProvider("RGD", false); - loadGenes(List.of(gene, gene2), "NCBITaxon:6239", symbolTerm, dataProvider); - loadGenes(List.of(withGene, withGene2), "NCBITaxon:9606", symbolTerm, dataProvider); - loadGenes(List.of(ratGene), "NCBITaxon:10116", symbolTerm, ratDataProvider); - loadGenes(List.of(humanGene), "NCBITaxon:9606", symbolTerm, ratDataProvider); - loadAllele(allele, "TestAllele", "NCBITaxon:6239", symbolTerm, dataProvider); - loadAllele(allele2, "TestAllele2", "NCBITaxon:6239", symbolTerm, dataProvider); - loadAllele(ratAllele, "TestAllele3", "NCBITaxon:10116", symbolTerm, ratDataProvider); - loadAllele(humanAllele, "TestAllele4", "NCBITaxon:9606", symbolTerm, ratDataProvider); - loadAffectedGenomicModel(agm, "Test AGM", "NCBITaxon:6239", "fish", dataProvider); - loadAffectedGenomicModel(agm2, "Test AGM2", "NCBITaxon:6239", "genotype", dataProvider); - loadAffectedGenomicModel(ratAgm, "TestAGM3", "NCBITaxon:10116", "genotype", ratDataProvider); - loadAffectedGenomicModel(humanAgm, "TestAGM4", "NCBITaxon:9606", "genotype", ratDataProvider); - loadAffectedGenomicModel(sgdBackgroundStrain, "Test SGD AGM", "NCBITaxon:559292", "strain", dataProvider); - loadAffectedGenomicModel(sgdBackgroundStrain2, "Test SGD AGM2", "NCBITaxon:559292", "strain", dataProvider); - loadReference(reference, referenceXref); - loadOrganization("OBSOLETE"); + createGenes(List.of(gene, gene2), "NCBITaxon:6239", symbolTerm, false, dataProvider); + createGenes(List.of(withGene, withGene2), "NCBITaxon:9606", symbolTerm, false, dataProvider); + createGenes(List.of(ratGene), "NCBITaxon:10116", symbolTerm, false, ratDataProvider); + createGenes(List.of(humanGene), "NCBITaxon:9606", symbolTerm, false, ratDataProvider); + createAllele(allele, "TestAllele", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAllele(allele2, "TestAllele2", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAllele(ratAllele, "TestAllele3", "NCBITaxon:10116", symbolTerm, false, ratDataProvider); + createAllele(humanAllele, "TestAllele4", "NCBITaxon:9606", symbolTerm, false, ratDataProvider); + createAffectedGenomicModel(agm, "Test AGM", "NCBITaxon:6239", "fish", false, dataProvider); + createAffectedGenomicModel(agm2, "Test AGM2", "NCBITaxon:6239", "genotype", false, dataProvider); + createAffectedGenomicModel(ratAgm, "TestAGM3", "NCBITaxon:10116", "genotype", false, ratDataProvider); + createAffectedGenomicModel(humanAgm, "TestAGM4", "NCBITaxon:9606", "genotype", false, ratDataProvider); + createAffectedGenomicModel(sgdBackgroundStrain, "Test SGD AGM", "NCBITaxon:559292", "strain", false, dataProvider); + createAffectedGenomicModel(sgdBackgroundStrain2, "Test SGD AGM2", "NCBITaxon:559292", "strain", false, dataProvider); + createReference(reference, referenceXref); Vocabulary noteTypeVocabulary = getVocabulary(VocabularyConstants.NOTE_TYPE_VOCABULARY); Vocabulary relationVocabulary = createVocabulary(VocabularyConstants.DISEASE_RELATION_VOCABULARY, false); diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java index a35498688..58fd93d20 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java @@ -129,7 +129,7 @@ public class DiseaseAnnotationITCase extends BaseITCase { private ExperimentalCondition nonPersistedCondition; - private void loadRequiredEntities() { + private void loadRequiredEntities() throws Exception { reference = createReference("AGRKB:100000005", false); reference2 = createReference("AGRKB:100000006", false); obsoleteReference = createReference("AGRKB:100000009", true); @@ -142,20 +142,20 @@ private void loadRequiredEntities() { unsupportedEcoTerm = createEcoTerm("ECO:da00004", "Test unsupported evidence code", false, false); nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); symbolNameType = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); - gene = createGene("GENE:da0001", "NCBITaxon:9606", false, symbolNameType); - gene2 = createGene("GENE:da0002", "NCBITaxon:9606", false, symbolNameType); - obsoleteGene = createGene("HGNC:da0003", "NCBITaxon:9606", true, symbolNameType); - withGene = createGene("HGNC:1", "NCBITaxon:9606", false, symbolNameType); - withGene2 = createGene("HGNC:2", "NCBITaxon:9606", false, symbolNameType); - allele = createAllele("ALLELE:da0001", "NCBITaxon:9606", false, symbolNameType); - allele2 = createAllele("ALLELE:da0002", "NCBITaxon:9606", false, symbolNameType); - obsoleteAllele = createAllele("ALLELE:da0003", "NCBITaxon:9606", true, symbolNameType); + gene = createGene("GENE:da0001", "NCBITaxon:9606", symbolNameType, false); + gene2 = createGene("GENE:da0002", "NCBITaxon:9606", symbolNameType, false); + obsoleteGene = createGene("HGNC:da0003", "NCBITaxon:9606", symbolNameType, true); + withGene = createGene("HGNC:1", "NCBITaxon:9606", symbolNameType, false); + withGene2 = createGene("HGNC:2", "NCBITaxon:9606", symbolNameType, false); + allele = createAllele("ALLELE:da0001", "NCBITaxon:9606", symbolNameType, false); + allele2 = createAllele("ALLELE:da0002", "NCBITaxon:9606", symbolNameType, false); + obsoleteAllele = createAllele("ALLELE:da0003", "NCBITaxon:9606", symbolNameType, true); datetime = OffsetDateTime.parse("2022-03-09T22:10:12+00:00"); datetime2 = OffsetDateTime.parse("2022-04-10T22:10:11+00:00"); - agm = createAffectedGenomicModel("SGD:da0001", "NCBITaxon:559292", "strain", "TestAGM", false); - agm2 = createAffectedGenomicModel("SGD:da0002", "NCBITaxon:559292", "strain", "TestAGM2", false); - obsoleteAgm = createAffectedGenomicModel("SGD:da0003", "NCBITaxon:559292", "strain", "TestAGM3", true); - nonSgdAgm = createAffectedGenomicModel("WB:da0004", "NCBITaxon:6239", "genotype", "TestAGM4", false); + agm = createAffectedGenomicModel("SGD:da0001", "TestAGM", "NCBITaxon:559292", "strain", false); + agm2 = createAffectedGenomicModel("SGD:da0002", "TestAGM2", "NCBITaxon:559292", "strain", false); + obsoleteAgm = createAffectedGenomicModel("SGD:da0003", "TestAGM3", "NCBITaxon:559292", "strain", true); + nonSgdAgm = createAffectedGenomicModel("WB:da0004", "TestAGM4", "NCBITaxon:6239", "genotype", false); experimentalCondition = createExperimentalCondition("Statement", "ZECO:da001", "Test"); experimentalCondition2 = createExperimentalCondition("Statement2", "ZECO:da002", "Test2"); relationVocabulary = getVocabulary(VocabularyConstants.DISEASE_RELATION_VOCABULARY); @@ -217,7 +217,7 @@ private void loadRequiredEntities() { @Test @Order(1) - public void createGeneDiseaseAnnotation() { + public void createGeneDiseaseAnnotation() throws Exception { loadRequiredEntities(); GeneDiseaseAnnotation diseaseAnnotation = new GeneDiseaseAnnotation(); diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index f25763efc..7a079be7d 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -148,22 +148,22 @@ private void loadRequiredEntities() throws Exception { DataProvider dataProvider = createDataProvider("ZFIN", false); Vocabulary vocabulary1 = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolTerm = getVocabularyTerm(vocabulary1, "nomenclature_symbol"); - loadGenes(List.of(gene), taxon, symbolTerm, dataProvider); - loadMMOTerm(mmoTerm, "assay001"); + createGene(gene, taxon, symbolTerm, false, dataProvider); + createMmoTerm(mmoTerm, "assay001"); ResourceDescriptor rd1 = createResourceDescriptor("ZFIN"); createResourceDescriptorPage("homepage", "https://zfin.org/", rd1); createResourceDescriptorPage("reference", "https://zfin.org/[%s]", rd1); - loadReference(agrPublicationId, publicationId); - loadReference(agrReferenceId, referenceId); + createReference(agrPublicationId, publicationId); + createReference(agrReferenceId, referenceId); Vocabulary vocabulary2 = createVocabulary(VocabularyConstants.GENE_EXPRESSION_VOCABULARY, false); createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); Vocabulary stageUberonTermVocabulary = getVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS); Vocabulary anatomicalStructureUberonTermVocabulary = getVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS); Vocabulary cellullarComponentQualififerVocabulary = getVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS); - loadStageTerm(stageTermId, "StageTermTest"); + createStageTerm(stageTermId, "StageTermTest"); createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); - loadAnatomyTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); - loadAnatomyTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); + createAnatomicalTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); + createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); @@ -171,9 +171,9 @@ private void loadRequiredEntities() throws Exception { createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); - loadUberonTerm(anatomicalStructureUberonTermId1, "UberonTermTest1"); - loadUberonTerm(anatomicalStructureUberonTermId2, "UberonTermTest2"); - loadUberonTerm(anatomicalSubstructureUberonTermId1, "UberonTermTest3"); - loadUberonTerm(anatomicalSubstructureUberonTermId2, "UberonTermTest4"); + createUberonTerm(anatomicalStructureUberonTermId1, "UberonTermTest1"); + createUberonTerm(anatomicalStructureUberonTermId2, "UberonTermTest2"); + createUberonTerm(anatomicalSubstructureUberonTermId1, "UberonTermTest3"); + createUberonTerm(anatomicalSubstructureUberonTermId2, "UberonTermTest4"); } } diff --git a/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java index f42adcd72..8351574f4 100644 --- a/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/GeneBulkUploadITCase.java @@ -56,8 +56,8 @@ public void init() { private final String geneTestFilePath = "src/test/resources/bulk/01_gene/"; private void loadRequiredEntities() throws Exception { - loadReference(requiredReference, requiredReferenceXref); - loadReference(requiredReference2, requiredReferenceXref2); + createReference(requiredReference, requiredReferenceXref); + createReference(requiredReference2, requiredReferenceXref2); ResourceDescriptor rd = createResourceDescriptor("TEST"); createResourceDescriptorPage("homepage", "http://test.org", rd); ResourceDescriptor rd2 = createResourceDescriptor("TEST2"); diff --git a/src/test/java/org/alliancegenome/curation_api/GeneInteractionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/GeneInteractionBulkUploadFmsITCase.java index 8c00612e3..2856af58e 100644 --- a/src/test/java/org/alliancegenome/curation_api/GeneInteractionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/GeneInteractionBulkUploadFmsITCase.java @@ -78,20 +78,20 @@ private void loadRequiredEntities() throws Exception { VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); DataProvider dataProvider2 = createDataProvider("RGD", false); - loadGenes(List.of(gene1, gene2), "NCBITaxon:6239", symbolTerm, dataProvider); - loadGeneWithXref(gene3, "NCBITaxon:6239", symbolTerm, dataProvider, gene3xref); - loadGeneWithXref(gene4, "NCBITaxon:9606", symbolTerm, dataProvider2, gene4xref); - loadAllele(allele1, "GGITestVar1", "NCBITaxon:6239", symbolTerm, dataProvider); - loadAllele(allele2, "GGITestVar2", "NCBITaxon:6239", symbolTerm, dataProvider); - loadMITerm(miTerm1, "Test MITerm 1"); - loadMITerm(miTerm2, "Test MITerm 2"); - loadMITerm(miTerm3, "Test MITerm 3"); - loadMITerm(miTerm4, "Test MITerm 4"); - loadMITerm(miTerm5, "Test MITerm 5"); - loadMITerm(miTerm6, "Test MITerm 6"); - loadMITerm(miTerm7, "Test MITerm 7"); - loadMITerm(defaultAggregationDbTerm, "IMEX"); - loadWbPhenotypeTerm(wbPhenotypeTerm, "Test WBPhenotype term"); + createGenes(List.of(gene1, gene2), "NCBITaxon:6239", symbolTerm, false, dataProvider); + createGeneWithXref(gene3, "NCBITaxon:6239", symbolTerm, false, dataProvider, gene3xref); + createGeneWithXref(gene4, "NCBITaxon:9606", symbolTerm, false, dataProvider2, gene4xref); + createAllele(allele1, "GGITestVar1", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAllele(allele2, "GGITestVar2", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createMiTerm(miTerm1, "Test MITerm 1"); + createMiTerm(miTerm2, "Test MITerm 2"); + createMiTerm(miTerm3, "Test MITerm 3"); + createMiTerm(miTerm4, "Test MITerm 4"); + createMiTerm(miTerm5, "Test MITerm 5"); + createMiTerm(miTerm6, "Test MITerm 6"); + createMiTerm(miTerm7, "Test MITerm 7"); + createMiTerm(defaultAggregationDbTerm, "IMEX"); + createWbPhenotypeTerm(wbPhenotypeTerm, "Test WBPhenotype term"); ResourceDescriptor rd = createResourceDescriptor("WB"); createResourceDescriptorPage("gene/interactions", "http://test.org", rd); } diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index 503f12fd1..38cbf2d79 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -56,7 +56,7 @@ private void loadRequiredEntities() throws Exception { createSoTerm("SO:0001035", "piRNA", false); createSoTerm("SO:0000147", "exon", false); createSoTerm("SO:0000316", "CDS", false); - createGene("WB:WBGene00022276", "NCBITaxon:6239", false, getVocabularyTerm(getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY), "nomenclature_symbol")); + createGene("WB:WBGene00022276", "NCBITaxon:6239", getVocabularyTerm(getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY), "nomenclature_symbol"), false); } @Test diff --git a/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java index a295c0a59..69de7e46c 100644 --- a/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ParalogyBulkUploadFmsITCase.java @@ -53,7 +53,7 @@ private void loadRequiredEntities() throws Exception { Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); - loadGenes(List.of(gene1, gene2), "NCBITaxon:6239", symbolTerm, dataProvider); + createGenes(List.of(gene1, gene2), "NCBITaxon:6239", symbolTerm, false, dataProvider); } @Test diff --git a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java index 3c62cbe04..cb156911f 100644 --- a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java @@ -74,20 +74,20 @@ public void init() { private void loadRequiredEntities() throws Exception { createGoTerm(goTerm, "Test GOTerm", false); - loadExperimentalConditionTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); - loadZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", OntologyConstants.ZECO_AGR_SLIM_SUBSET); - loadZecoTerm(nonSlimZecoTerm, "Test ExperimentalConditionOntologyTerm", null); - loadChemicalTerm(chemicalTerm, "Test ChemicalTerm"); - loadAnatomyTerm(anatomyTerm, "Test AnatomicalTerm"); + createExperimentalConditionOntologyTerm(expCondTerm, "Test ExperimentalConditionOntologyTerm"); + createZecoTerm(zecoTerm, "Test ExperimentalConditionOntologyTerm", false, OntologyConstants.ZECO_AGR_SLIM_SUBSET); + createZecoTerm(nonSlimZecoTerm, "Test ExperimentalConditionOntologyTerm", false); + createChemicalTerm(chemicalTerm, "Test ChemicalTerm"); + createAnatomicalTerm(anatomyTerm, "Test AnatomicalTerm"); Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); - loadGenes(List.of(gene), "NCBITaxon:6239", symbolTerm, dataProvider); - loadAllele(allele, "TestAllele", "NCBITaxon:6239", symbolTerm, dataProvider); - loadAllele(allele2, "TestAllele2", "NCBITaxon:6239", symbolTerm, dataProvider); - loadAffectedGenomicModel(agm, "Test AGM", "NCBITaxon:6239", "strain", dataProvider); - loadAffectedGenomicModel(agm2, "Test AGM2", "NCBITaxon:6239", "strain", dataProvider); - loadMPTerm(mpTerm, "Test PhenotypeTerm"); + createGene(gene, "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAllele(allele, "TestAllele", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAllele(allele2, "TestAllele2", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAffectedGenomicModel(agm, "Test AGM", "NCBITaxon:6239", "strain", false, dataProvider); + createAffectedGenomicModel(agm2, "Test AGM2", "NCBITaxon:6239", "strain", false, dataProvider); + createMpTerm(mpTerm, "Test PhenotypeTerm"); ResourceDescriptor rd = createResourceDescriptor("PMID"); createResourceDescriptorPage("default", "https://www.ncbi.nlm.nih.gov/pubmed/[%s]", rd); } diff --git a/src/test/java/org/alliancegenome/curation_api/VariantBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantBulkUploadITCase.java index e582b39ac..5f598180f 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantBulkUploadITCase.java @@ -59,10 +59,10 @@ public void init() { private final String variantTestFilePath = "src/test/resources/bulk/06_variant/"; private void loadRequiredEntities() throws Exception { - loadSOTerm(variantType, "Test variant type SOTerm"); - loadSOTerm(variantType2, "Second test variant type SOTerm"); - loadSOTerm(sourceGeneralConsequence, "Test source general consequence SOTerm"); - loadSOTerm(sourceGeneralConsequence2, "Second test source general consequence SOTerm"); + createSoTerm(variantType, "Test variant type SOTerm", false); + createSoTerm(variantType2, "Second test variant type SOTerm", false); + createSoTerm(sourceGeneralConsequence, "Test source general consequence SOTerm", false); + createSoTerm(sourceGeneralConsequence2, "Second test source general consequence SOTerm", false); Vocabulary variantStatusVocabulary = getVocabulary(VocabularyConstants.VARIANT_STATUS_VOCABULARY); createVocabularyTerm(variantStatusVocabulary, variantStatus, false); createVocabularyTerm(variantStatusVocabulary, variantStatus2, false); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 16d94af98..bbc1c7844 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -9,7 +9,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map.Entry; -import java.util.regex.Pattern; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; @@ -48,9 +47,12 @@ import org.alliancegenome.curation_api.model.entities.ontology.ExperimentalConditionOntologyTerm; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; import org.alliancegenome.curation_api.model.entities.ontology.MITerm; +import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; import org.alliancegenome.curation_api.model.entities.ontology.MPTerm; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; +import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; import org.alliancegenome.curation_api.model.entities.ontology.WBPhenotypeTerm; import org.alliancegenome.curation_api.model.entities.ontology.ZECOTerm; import org.alliancegenome.curation_api.model.entities.ontology.ZFATerm; @@ -68,8 +70,6 @@ public class BaseITCase { - private static Pattern keyPattern = Pattern.compile("^(.+)\\.([^\\.]+)$"); - public VocabularyTerm addVocabularyTermToSet(String setName, String termName, Vocabulary vocabulary, Boolean obsolete) { VocabularyTermSet set = getVocabularyTermSet(setName); VocabularyTerm term = createVocabularyTerm(vocabulary, termName, false); @@ -171,7 +171,11 @@ public HashMap createCountParams(int total, int failed, int com return map; } - public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, String taxonCurie, String subtypeName, String name, Boolean obsolete) { + public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, String name, String taxonCurie, String subtypeName, Boolean obsolete) throws Exception { + return createAffectedGenomicModel(modEntityId, name, taxonCurie, subtypeName, obsolete, null); + } + + public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, String name, String taxonCurie, String subtypeName, Boolean obsolete, DataProvider dataProvider) { Vocabulary subtypeVocabulary = getVocabulary(VocabularyConstants.AGM_SUBTYPE_VOCABULARY); VocabularyTerm subtype = getVocabularyTerm(subtypeVocabulary, subtypeName); @@ -181,6 +185,7 @@ public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, Strin model.setSubtype(subtype); model.setName(name); model.setObsolete(obsolete); + model.setDataProvider(dataProvider); ObjectResponse response = given(). contentType("application/json"). @@ -192,20 +197,25 @@ public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, Strin extract().body().as(getObjectResponseTypeRefAffectedGenomicModel()); return response.getEntity(); } - - public Allele createAllele(String modEntityId, String taxonCurie, Boolean obsolete, VocabularyTerm symbolNameTerm) { + + public Allele createAllele(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete) { + return createAllele(modEntityId, modEntityId, taxonCurie, symbolNameTerm, obsolete, null); + } + + public Allele createAllele(String modEntityId, String symbol, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { Allele allele = new Allele(); allele.setModEntityId(modEntityId); allele.setTaxon(getNCBITaxonTerm(taxonCurie)); allele.setObsolete(obsolete); allele.setInternal(false); + allele.setDataProvider(dataProvider); + + AlleleSymbolSlotAnnotation alleleSymbol = new AlleleSymbolSlotAnnotation(); + alleleSymbol.setNameType(symbolNameTerm); + alleleSymbol.setDisplayText(symbol); + alleleSymbol.setFormatText(symbol); - AlleleSymbolSlotAnnotation symbol = new AlleleSymbolSlotAnnotation(); - symbol.setNameType(symbolNameTerm); - symbol.setDisplayText(modEntityId); - symbol.setFormatText(modEntityId); - - allele.setAlleleSymbol(symbol); + allele.setAlleleSymbol(alleleSymbol); ObjectResponse response = given(). contentType("application/json"). @@ -235,6 +245,25 @@ public BiologicalEntity createBiologicalEntity(String modEntityId, String taxonC return response.getEntity(); } + public AnatomicalTerm createAnatomicalTerm(String curie, String name) throws Exception { + AnatomicalTerm anatomicalTerm = new AnatomicalTerm(); + anatomicalTerm.setCurie(curie); + anatomicalTerm.setName(name); + anatomicalTerm.setObsolete(false); + anatomicalTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(anatomicalTerm). + when(). + put("/api/anatomicalterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefAnatomicalTerm()); + + return response.getEntity(); + } + public CHEBITerm createChebiTerm(String curie, String name, Boolean obsolete) { CHEBITerm chebiTerm = new CHEBITerm(); chebiTerm.setCurie(curie); @@ -250,6 +279,26 @@ public CHEBITerm createChebiTerm(String curie, String name, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefCHEBITerm()); + + return response.getEntity(); + } + + public ChemicalTerm createChemicalTerm(String curie, String name) throws Exception { + ChemicalTerm chemicalTerm = new ChemicalTerm(); + chemicalTerm.setCurie(curie); + chemicalTerm.setName(name); + chemicalTerm.setObsolete(false); + chemicalTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(chemicalTerm). + when(). + put("/api/chemicalterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefChemicalTerm()); + return response.getEntity(); } @@ -317,10 +366,19 @@ public DataProvider createDataProvider(String organizationAbbreviation, Boolean return response.getEntity(); } - + + public DOTerm createDoTerm(String curie, String name) { + return createDoTerm(curie, name, false); + } + public DOTerm createDoTerm(String curie, Boolean obsolete) { + return createDoTerm(curie, curie, obsolete); + } + + public DOTerm createDoTerm(String curie, String name, Boolean obsolete) { DOTerm doTerm = new DOTerm(); doTerm.setCurie(curie); + doTerm.setName(name); doTerm.setObsolete(obsolete); doTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); @@ -332,6 +390,7 @@ public DOTerm createDoTerm(String curie, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefDOTerm()); + return response.getEntity(); } @@ -373,10 +432,47 @@ public ExperimentalCondition createExperimentalCondition(String uniqueId, String return response.getEntity(); } - public Gene createGene(String modEntityId, String taxonCurie, Boolean obsolete, VocabularyTerm symbolNameTerm) { + public ExperimentalConditionOntologyTerm createExperimentalConditionOntologyTerm(String curie, String name) throws Exception { + ExperimentalConditionOntologyTerm ecTerm = new ExperimentalConditionOntologyTerm(); + ecTerm.setCurie(curie); + ecTerm.setName(name); + ecTerm.setObsolete(false); + ecTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(ecTerm). + when(). + post("/api/experimentalconditionontologyterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefExperimentalConditionOntologyTerm()); + + return response.getEntity(); + } + + public Gene createGene(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete) { + return createGene(modEntityId, taxonCurie, symbolNameTerm, obsolete, null); + } + + public Gene createGene(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { + return createGeneWithXref(modEntityId, taxonCurie, symbolNameTerm, obsolete, dataProvider, null); + } + + public List createGenes(List modEntityIds, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { + List geneList = new ArrayList<>(); + for (String modEntityId : modEntityIds) { + geneList.add(createGene(modEntityId, taxonCurie, symbolNameTerm, obsolete, dataProvider)); + } + + return geneList; + } + + public Gene createGeneWithXref(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider, String xrefCurie) { Gene gene = new Gene(); gene.setModEntityId(modEntityId); gene.setTaxon(getNCBITaxonTerm(taxonCurie)); + gene.setDataProvider(dataProvider); gene.setObsolete(obsolete); GeneSymbolSlotAnnotation symbol = new GeneSymbolSlotAnnotation(); @@ -388,6 +484,13 @@ public Gene createGene(String modEntityId, String taxonCurie, Boolean obsolete, SOTerm geneType = getSoTerm("SO:0001217"); gene.setGeneType(geneType); + + if (StringUtils.isNotBlank(xrefCurie)) { + CrossReference xref = new CrossReference(); + xref.setReferencedCurie(xrefCurie); + xref.setDisplayName(xrefCurie); + gene.setCrossReferences(List.of(xref)); + } ObjectResponse response = given(). contentType("application/json"). @@ -432,11 +535,57 @@ public GOTerm createGoTerm(String curie, String name, Boolean obsolete, GOTerm a return response.getEntity(); } + public MITerm createMiTerm(String curie, String name) throws Exception { + MITerm miTerm = new MITerm(); + miTerm.setCurie(curie); + miTerm.setName(name); + miTerm.setObsolete(false); + miTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(miTerm). + when(). + put("/api/miterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefMITerm()); + + return response.getEntity(); + } + + public MMOTerm createMmoTerm(String curie, String name) throws Exception { + MMOTerm mmoTerm = new MMOTerm(); + mmoTerm.setCurie(curie); + mmoTerm.setName(name); + mmoTerm.setObsolete(false); + mmoTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(mmoTerm). + when(). + put("/api/mmoterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefMMOTerm()); + + return response.getEntity(); + } + + public MPTerm createMpTerm(String curie, String name) { + return createMpTerm(curie, name, false); + } + public MPTerm createMpTerm(String curie, Boolean obsolete) { + return createMpTerm(curie, "Test MPTerm", obsolete); + } + + public MPTerm createMpTerm(String curie, String name, Boolean obsolete) { MPTerm mpTerm = new MPTerm(); mpTerm.setCurie(curie); mpTerm.setObsolete(obsolete); - mpTerm.setName("Test MPTerm"); + mpTerm.setName(name); mpTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); ObjectResponse response = given(). @@ -447,6 +596,7 @@ public MPTerm createMpTerm(String curie, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefMPTerm()); + return response.getEntity(); } @@ -513,13 +663,20 @@ public Person createPerson(String uniqueId) { person = response.getEntity(); return person; } - + + public Reference createReference(String curie, String xrefCurie) { + return createReference(curie, xrefCurie, false); + } + public Reference createReference(String curie, Boolean obsolete) { + return createReference(curie, "PMID:TestXref", obsolete); + } + + public Reference createReference(String curie, String xrefCurie, Boolean obsolete) { Reference reference = new Reference(); reference.setCurie(curie); reference.setObsolete(obsolete); - String xrefCurie = "PMID:TestXref"; CrossReference xref = new CrossReference(); xref.setReferencedCurie(xrefCurie); xref.setDisplayName(xrefCurie); @@ -599,6 +756,44 @@ public SOTerm createSoTerm(String curie, String name, Boolean obsolete) { return response.getEntity(); } + public StageTerm createStageTerm(String curie, String name) throws Exception { + StageTerm stageTerm = new StageTerm(); + stageTerm.setCurie(curie); + stageTerm.setName(name); + stageTerm.setObsolete(false); + stageTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(stageTerm). + when(). + put("/api/stageterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefStageTerm()); + + return response.getEntity(); + } + + public UBERONTerm createUberonTerm(String curie, String name) throws Exception { + UBERONTerm uberonTerm = new UBERONTerm(); + uberonTerm.setCurie(curie); + uberonTerm.setName(name); + uberonTerm.setObsolete(false); + uberonTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(uberonTerm). + when(). + put("/api/uberonterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefUBERONTerm()); + + return response.getEntity(); + } + public Vocabulary createVocabulary(String name, Boolean obsolete) { Vocabulary vocabulary = new Vocabulary(); vocabulary.setName(name); @@ -658,6 +853,29 @@ public void createVocabularyTermSet(String name, Vocabulary vocabulary, List response = RestAssured.given(). + contentType("application/json"). + body(wbTerm). + when(). + put("/api/wbphenotypeterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefWBPhenotypeTerm()); + + return response.getEntity(); + } + + public ZECOTerm createZecoTerm(String curie, String name, Boolean obsolete) { + return createZecoTerm(curie, name, obsolete, null); + } + public ZECOTerm createZecoTerm(String curie, String name, Boolean obsolete, String subset) { ZECOTerm zecoTerm = new ZECOTerm(); zecoTerm.setCurie(curie); @@ -917,6 +1135,11 @@ private TypeRef> getObjectResponseTypeRefA }; } + private TypeRef> getObjectResponseTypeRefAnatomicalTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefBiologicalEntity() { return new TypeRef>() { }; @@ -927,6 +1150,11 @@ private TypeRef> getObjectResponseTypeRefCHEBITerm() { }; } + private TypeRef> getObjectResponseTypeRefChemicalTerm() { + return new TypeRef>() { + }; + } + public TypeRef> getObjectResponseTypeRefConditionRelation() { return new TypeRef>() { }; @@ -967,6 +1195,11 @@ private TypeRef> getObjectResponseTypeRefE }; } + private TypeRef> getObjectResponseTypeRefExperimentalConditionOntologyTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefGene() { return new TypeRef>() { }; @@ -992,6 +1225,16 @@ private TypeRef> getObjectResponseTypeRefLoggedInPerson() }; } + private TypeRef> getObjectResponseTypeRefMITerm() { + return new TypeRef>() { + }; + } + + private TypeRef> getObjectResponseTypeRefMMOTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefMPTerm() { return new TypeRef>() { }; @@ -1032,6 +1275,16 @@ private TypeRef> getObjectResponseTypeRefSOTerm() { }; } + private TypeRef> getObjectResponseTypeRefStageTerm() { + return new TypeRef>() { + }; + } + + private TypeRef> getObjectResponseTypeRefUBERONTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefVariant() { return new TypeRef>() { }; @@ -1047,8 +1300,13 @@ private TypeRef> getObjectResponseTypeRefVocabula }; } + private TypeRef> getObjectResponseTypeRefWBPhenotypeTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefZecoTerm() { - return new TypeRef<>() { + return new TypeRef>() { }; } @@ -1179,328 +1437,4 @@ public ZECOTerm getZecoTerm(String curie) { return response.getEntity(); } - - public void loadAffectedGenomicModel(String modEntityId, String name, String taxonCurie, String subtypeName, DataProvider dataProvider) throws Exception { - Vocabulary subtypeVocabulary = getVocabulary(VocabularyConstants.AGM_SUBTYPE_VOCABULARY); - VocabularyTerm subtype = getVocabularyTerm(subtypeVocabulary, subtypeName); - - AffectedGenomicModel agm = new AffectedGenomicModel(); - agm.setModEntityId(modEntityId); - agm.setTaxon(getNCBITaxonTerm(taxonCurie)); - agm.setName(name); - agm.setSubtype(subtype); - agm.setDataProvider(dataProvider); - RestAssured.given(). - contentType("application/json"). - body(agm). - when(). - post("/api/agm"). - then(). - statusCode(200); - } - - public void loadAllele(String identifier, String symbol, String taxonCurie, VocabularyTerm symbolNameTerm, DataProvider dataProvider) throws Exception { - Allele allele = new Allele(); - allele.setModEntityId(identifier); - allele.setTaxon(getNCBITaxonTerm(taxonCurie)); - allele.setInternal(false); - allele.setDataProvider(dataProvider); - - AlleleSymbolSlotAnnotation alleleSymbol = new AlleleSymbolSlotAnnotation(); - alleleSymbol.setNameType(symbolNameTerm); - alleleSymbol.setDisplayText(symbol); - alleleSymbol.setFormatText(symbol); - - allele.setAlleleSymbol(alleleSymbol); - - RestAssured.given(). - contentType("application/json"). - body(allele). - when(). - post("/api/allele"). - then(). - statusCode(200); - } - - public void loadAnatomyTerm(String curie, String name) throws Exception { - AnatomicalTerm anatomicalTerm = new AnatomicalTerm(); - anatomicalTerm.setCurie(curie); - anatomicalTerm.setName(name); - anatomicalTerm.setObsolete(false); - anatomicalTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(anatomicalTerm). - when(). - put("/api/anatomicalterm"). - then(). - statusCode(200); - } - - public void loadChemicalTerm(String curie, String name) throws Exception { - ChemicalTerm chemicalTerm = new ChemicalTerm(); - chemicalTerm.setCurie(curie); - chemicalTerm.setName(name); - chemicalTerm.setObsolete(false); - chemicalTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(chemicalTerm). - when(). - put("/api/chemicalterm"). - then(). - statusCode(200); - } - - public void loadDOTerm(String curie, String name) throws Exception { - DOTerm doTerm = new DOTerm(); - doTerm.setCurie(curie); - doTerm.setName(name); - doTerm.setObsolete(false); - doTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(doTerm). - when(). - put("/api/doterm"). - then(). - statusCode(200); - } - - public void loadExperimentalConditionTerm(String curie, String name) throws Exception { - ExperimentalConditionOntologyTerm ecTerm = new ExperimentalConditionOntologyTerm(); - ecTerm.setCurie(curie); - ecTerm.setName(name); - ecTerm.setObsolete(false); - ecTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(ecTerm). - when(). - post("/api/experimentalconditionontologyterm"). - then(). - statusCode(200); - } - - public void loadGene(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, DataProvider dataProvider) { - loadGeneWithXref(modEntityId, taxonCurie, symbolNameTerm, dataProvider, null); - } - - public void loadGeneWithXref(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, DataProvider dataProvider, String xrefCurie) { - Gene gene = new Gene(); - gene.setModEntityId(modEntityId); - gene.setTaxon(getNCBITaxonTerm(taxonCurie)); - gene.setDataProvider(dataProvider); - - GeneSymbolSlotAnnotation symbol = new GeneSymbolSlotAnnotation(); - symbol.setNameType(symbolNameTerm); - symbol.setDisplayText(modEntityId); - symbol.setFormatText(modEntityId); - - gene.setGeneSymbol(symbol); - - SOTerm geneType = getSoTerm("SO:0001217"); - gene.setGeneType(geneType); - - if (StringUtils.isNotBlank(xrefCurie)) { - CrossReference xref = new CrossReference(); - xref.setReferencedCurie(xrefCurie); - xref.setDisplayName(xrefCurie); - gene.setCrossReferences(List.of(xref)); - } - - RestAssured.given(). - contentType("application/json"). - body(gene). - when(). - post("/api/gene"). - then(). - statusCode(200); - } - - public void loadGenes(List modEntityIds, String taxonCurie, VocabularyTerm symbolNameTerm, DataProvider dataProvider) throws Exception { - for (String modEntityId : modEntityIds) { - loadGene(modEntityId, taxonCurie, symbolNameTerm, dataProvider); - } - } - - public void loadMITerm(String curie, String name) throws Exception { - MITerm miTerm = new MITerm(); - miTerm.setCurie(curie); - miTerm.setName(name); - miTerm.setObsolete(false); - miTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(miTerm). - when(). - put("/api/miterm"). - then(). - statusCode(200); - } - public void loadMMOTerm(String curie, String name) throws Exception { - MPTerm mpTerm = new MPTerm(); - mpTerm.setCurie(curie); - mpTerm.setName(name); - mpTerm.setObsolete(false); - mpTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(mpTerm). - when(). - put("/api/mmoterm"). - then(). - statusCode(200); - } - - public void loadMPTerm(String curie, String name) throws Exception { - MPTerm mpTerm = new MPTerm(); - mpTerm.setCurie(curie); - mpTerm.setName(name); - mpTerm.setObsolete(false); - mpTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(mpTerm). - when(). - put("/api/mpterm"). - then(). - statusCode(200); - } - - public void loadStageTerm(String curie, String name) throws Exception { - MPTerm mpTerm = new MPTerm(); - mpTerm.setCurie(curie); - mpTerm.setName(name); - mpTerm.setObsolete(false); - mpTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(mpTerm). - when(). - put("/api/stageterm"). - then(). - statusCode(200); - } - - public void loadOrganization(String abbreviation) throws Exception { - Organization organization = new Organization(); - organization.setAbbreviation(abbreviation); - organization.setObsolete(false); - - RestAssured.given(). - contentType("application/json"). - body(organization). - when(). - put("/api/organization"). - then(). - statusCode(200); - } - - public void loadReference(String curie, String xrefCurie) throws Exception { - - CrossReference xref = new CrossReference(); - xref.setReferencedCurie(xrefCurie); - xref.setDisplayName(xrefCurie); - - ObjectResponse response = - RestAssured.given(). - contentType("application/json"). - body(xref). - when(). - post("/api/cross-reference"). - then(). - statusCode(200). - extract().body().as(getObjectResponseTypeRefCrossReference()); - - Reference reference = new Reference(); - reference.setCurie(curie); - reference.setCrossReferences(List.of(response.getEntity())); - reference.setObsolete(false); - - RestAssured.given(). - contentType("application/json"). - body(reference). - when(). - post("/api/reference"). - then(). - statusCode(200); - } - - public void loadSOTerm(String curie, String name) throws Exception { - SOTerm soTerm = new SOTerm(); - soTerm.setCurie(curie); - soTerm.setName(name); - soTerm.setObsolete(false); - soTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(soTerm). - when(). - put("/api/soterm"). - then(). - statusCode(200); - } - - public void loadUberonTerm(String curie, String name) throws Exception { - SOTerm soTerm = new SOTerm(); - soTerm.setCurie(curie); - soTerm.setName(name); - soTerm.setObsolete(false); - soTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(soTerm). - when(). - put("/api/uberonterm"). - then(). - statusCode(200); - } - - public void loadWbPhenotypeTerm(String curie, String name) throws Exception { - WBPhenotypeTerm wbTerm = new WBPhenotypeTerm(); - wbTerm.setCurie(curie); - wbTerm.setName(name); - wbTerm.setObsolete(false); - wbTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(wbTerm). - when(). - put("/api/wbphenotypeterm"). - then(). - statusCode(200); - } - - public void loadZecoTerm(String curie, String name, String subset) throws Exception { - ZECOTerm zecoTerm = new ZECOTerm(); - zecoTerm.setCurie(curie); - zecoTerm.setName(name); - zecoTerm.setObsolete(false); - List subsets = new ArrayList(); - if (subset != null) { - subsets.add(subset); - zecoTerm.setSubsets(subsets); - } - zecoTerm.setSecondaryIdentifiers(List.of(curie + "secondary")); - - RestAssured.given(). - contentType("application/json"). - body(zecoTerm). - when(). - post("/api/zecoterm"). - then(). - statusCode(200); - } } From 224307df1a86b51c4141d0632158fa02c8b01489 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 14:35:30 +0100 Subject: [PATCH 221/342] Update interface --- .../interfaces/base/BaseUpsertControllerInterface.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java index 5a0f46fe9..010bd50ad 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/base/BaseUpsertControllerInterface.java @@ -1,6 +1,5 @@ package org.alliancegenome.curation_api.interfaces.base; -import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; @@ -16,5 +15,5 @@ public interface BaseUpsertControllerInterface Date: Tue, 10 Sep 2024 14:50:58 +0100 Subject: [PATCH 222/342] Throw ValidationException on all methods --- .../crud/BaseUpsertServiceInterface.java | 5 ++--- .../dto/AGMDiseaseAnnotationDTOValidator.java | 2 +- .../dto/AffectedGenomicModelDTOValidator.java | 3 ++- .../validation/dto/AlleleDTOValidator.java | 3 ++- .../dto/AlleleDiseaseAnnotationDTOValidator.java | 3 ++- .../validation/dto/ConstructDTOValidator.java | 3 ++- .../services/validation/dto/GeneDTOValidator.java | 3 ++- .../services/validation/dto/Gff3DtoValidator.java | 15 ++++----------- .../dto/ResourceDescriptorDTOValidator.java | 3 ++- .../validation/dto/VariantDTOValidator.java | 3 ++- .../AlleleGeneAssociationDTOValidator.java | 3 ++- ...tructGenomicEntityAssociationDTOValidator.java | 3 ++- .../AGMPhenotypeAnnotationFmsDTOValidator.java | 3 ++- .../AllelePhenotypeAnnotationFmsDTOValidator.java | 3 ++- .../ExternalDataBaseEntityFmsDTOValidator.java | 3 ++- .../GeneGeneticInteractionFmsDTOValidator.java | 3 ++- .../GeneMolecularInteractionFmsDTOValidator.java | 3 ++- .../GenePhenotypeAnnotationFmsDTOValidator.java | 3 ++- ...xpressionDatasetAnnotationFmsDTOValidator.java | 3 ++- .../dto/fms/ParalogyFmsDTOValidator.java | 3 ++- .../SequenceTargetingReagentFmsDTOValidator.java | 3 ++- 21 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BaseUpsertServiceInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BaseUpsertServiceInterface.java index c94dcc6c2..a45799d43 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BaseUpsertServiceInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/BaseUpsertServiceInterface.java @@ -1,17 +1,16 @@ package org.alliancegenome.curation_api.interfaces.crud; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; -import org.alliancegenome.curation_api.exceptions.KnownIssueValidationException; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; public interface BaseUpsertServiceInterface { - default E upsert(T dto) throws ValidationException, KnownIssueValidationException { + default E upsert(T dto) throws ValidationException { return upsert(dto, null); } - E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException, KnownIssueValidationException; + E upsert(T dto, BackendBulkDataProvider dataProvider) throws ValidationException; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java index 60849db01..b4c687a16 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java @@ -39,7 +39,7 @@ public class AGMDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOValida @Inject AlleleService alleleService; - public AGMDiseaseAnnotation validateAGMDiseaseAnnotationDTO(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException, ObjectValidationException { + public AGMDiseaseAnnotation validateAGMDiseaseAnnotationDTO(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AGMDiseaseAnnotation annotation = new AGMDiseaseAnnotation(); AffectedGenomicModel agm; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AffectedGenomicModelDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AffectedGenomicModelDTOValidator.java index 7be172abf..d7e90003a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AffectedGenomicModelDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AffectedGenomicModelDTOValidator.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.dao.AffectedGenomicModelDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.ingest.dto.AffectedGenomicModelDTO; @@ -25,7 +26,7 @@ public class AffectedGenomicModelDTOValidator extends BaseDTOValidator { private ObjectResponse agmResponse = new ObjectResponse(); - public AffectedGenomicModel validateAffectedGenomicModelDTO(AffectedGenomicModelDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public AffectedGenomicModel validateAffectedGenomicModelDTO(AffectedGenomicModelDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AffectedGenomicModel agm = null; if (StringUtils.isNotBlank(dto.getModEntityId())) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDTOValidator.java index b4c5a1d55..2660db0cd 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDTOValidator.java @@ -11,6 +11,7 @@ import org.alliancegenome.curation_api.dao.ReferenceDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Reference; @@ -79,7 +80,7 @@ public class AlleleDTOValidator extends BaseDTOValidator { private ObjectResponse alleleResponse; @Transactional - public Allele validateAlleleDTO(AlleleDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Allele validateAlleleDTO(AlleleDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { alleleResponse = new ObjectResponse<>(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java index 8baba7e91..ce5040175 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AlleleDiseaseAnnotationDTOValidator.java @@ -8,6 +8,7 @@ import org.alliancegenome.curation_api.dao.AlleleDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; import org.alliancegenome.curation_api.model.entities.Gene; @@ -36,7 +37,7 @@ public class AlleleDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOVal @Inject GeneService geneService; @Inject VocabularyTermService vocabularyTermService; - public AlleleDiseaseAnnotation validateAlleleDiseaseAnnotationDTO(AlleleDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public AlleleDiseaseAnnotation validateAlleleDiseaseAnnotationDTO(AlleleDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { AlleleDiseaseAnnotation annotation = new AlleleDiseaseAnnotation(); Allele allele; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java index c3523d1e2..520135291 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ConstructDTOValidator.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.ConstructDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Construct; import org.alliancegenome.curation_api.model.entities.Reference; import org.alliancegenome.curation_api.model.entities.slotAnnotations.constructSlotAnnotations.ConstructComponentSlotAnnotation; @@ -46,7 +47,7 @@ public class ConstructDTOValidator extends ReagentDTOValidator { private ObjectResponse constructResponse; @Transactional - public Construct validateConstructDTO(ConstructDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Construct validateConstructDTO(ConstructDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { constructResponse = new ObjectResponse<>(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java index fb7fedd13..697c82b0a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/GeneDTOValidator.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.GeneDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneFullNameSlotAnnotation; @@ -51,7 +52,7 @@ public class GeneDTOValidator extends BaseDTOValidator { private ObjectResponse geneResponse; @Transactional - public Gene validateGeneDTO(GeneDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Gene validateGeneDTO(GeneDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { geneResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 565465a2e..1c7584c20 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -20,9 +20,9 @@ import org.alliancegenome.curation_api.dao.ontology.SoTermDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AssemblyComponent; import org.alliancegenome.curation_api.model.entities.CodingSequence; -import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GenomicEntity; @@ -72,7 +72,7 @@ public class Gff3DtoValidator { @Inject VocabularyTermService vocabularyTermService; @Transactional - public void validateExonEntry(Gff3DTO dto, Map attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public void validateExonEntry(Gff3DTO dto, Map attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { Exon exon = null; @@ -106,7 +106,7 @@ public void validateExonEntry(Gff3DTO dto, Map attributes, List< } @Transactional - public void validateCdsEntry(Gff3DTO dto, Map attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public void validateCdsEntry(Gff3DTO dto, Map attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { CodingSequence cds = null; @@ -140,7 +140,7 @@ public void validateCdsEntry(Gff3DTO dto, Map attributes, List attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public void validateTranscriptEntry(Gff3DTO dto, Map attributes, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { if (!Gff3Constants.TRANSCRIPT_TYPES.contains(dto.getType())) { throw new ObjectValidationException(dto, "Invalid Type: " + dto.getType() + " for Transcript Entity"); @@ -411,12 +411,5 @@ private ObjectResponse validateLocationAssoci return associationResponse; } - - private ObjectResponse validateParent(E association, Map attributes) { - ObjectResponse associationResponse = new ObjectResponse(); - - - return associationResponse; - } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ResourceDescriptorDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ResourceDescriptorDTOValidator.java index 1ff2de6d3..3ffdbb6f4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ResourceDescriptorDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/ResourceDescriptorDTOValidator.java @@ -8,6 +8,7 @@ import org.alliancegenome.curation_api.dao.ResourceDescriptorDAO; import org.alliancegenome.curation_api.dao.ResourceDescriptorPageDAO; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; import org.alliancegenome.curation_api.model.ingest.dto.ResourceDescriptorDTO; @@ -29,7 +30,7 @@ public class ResourceDescriptorDTOValidator extends BaseDTOValidator { @Inject ResourceDescriptorPageDAO resourceDescriptorPageDAO; @Inject ResourceDescriptorPageDTOValidator resourceDescriptorPageDtoValidator; - public ResourceDescriptor validateResourceDescriptorDTO(ResourceDescriptorDTO dto) throws ObjectValidationException { + public ResourceDescriptor validateResourceDescriptorDTO(ResourceDescriptorDTO dto) throws ValidationException { ObjectResponse rdResponse = new ObjectResponse(); ResourceDescriptor rd = null; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java index 73df6c086..134bbc2ea 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; @@ -39,7 +40,7 @@ public class VariantDTOValidator extends BaseDTOValidator { private ObjectResponse variantResponse; @Transactional - public Variant validateVariantDTO(VariantDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public Variant validateVariantDTO(VariantDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { variantResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleGeneAssociationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleGeneAssociationDTOValidator.java index eb3f098cc..bfd87c332 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleGeneAssociationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleGeneAssociationDTOValidator.java @@ -8,6 +8,7 @@ import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleGeneAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; @@ -32,7 +33,7 @@ public class AlleleGeneAssociationDTOValidator extends AlleleGenomicEntityAssoci @Inject GeneService geneService; @Inject VocabularyTermService vocabularyTermService; - public AlleleGeneAssociation validateAlleleGeneAssociationDTO(AlleleGeneAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + public AlleleGeneAssociation validateAlleleGeneAssociationDTO(AlleleGeneAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ValidationException { ObjectResponse agaResponse = new ObjectResponse(); List subjectIds = null; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java index 3899fccac..457631890 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.associations.constructAssociations.ConstructGenomicEntityAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Construct; import org.alliancegenome.curation_api.model.entities.GenomicEntity; import org.alliancegenome.curation_api.model.entities.Note; @@ -40,7 +41,7 @@ public class ConstructGenomicEntityAssociationDTOValidator extends EvidenceAssoc private ObjectResponse assocResponse; - public ConstructGenomicEntityAssociation validateConstructGenomicEntityAssociationDTO(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + public ConstructGenomicEntityAssociation validateConstructGenomicEntityAssociationDTO(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ValidationException { assocResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AGMPhenotypeAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AGMPhenotypeAnnotationFmsDTOValidator.java index 1b8763cc2..e421bb32b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AGMPhenotypeAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AGMPhenotypeAnnotationFmsDTOValidator.java @@ -8,6 +8,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Allele; @@ -72,7 +73,7 @@ public AGMPhenotypeAnnotation validatePrimaryAnnotation(AffectedGenomicModel sub } - public List validateInferredOrAssertedEntities(AffectedGenomicModel primaryAnnotationSubject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public List validateInferredOrAssertedEntities(AffectedGenomicModel primaryAnnotationSubject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { ObjectResponse apaResponse = new ObjectResponse(); ObjectResponse refResponse = validateReference(dto); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AllelePhenotypeAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AllelePhenotypeAnnotationFmsDTOValidator.java index 7a22d2fe8..19475c38a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AllelePhenotypeAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/AllelePhenotypeAnnotationFmsDTOValidator.java @@ -8,6 +8,7 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; import org.alliancegenome.curation_api.model.entities.Gene; @@ -69,7 +70,7 @@ public AllelePhenotypeAnnotation validatePrimaryAnnotation(Allele subject, Pheno } - public List validateInferredOrAssertedEntities(Allele primaryAnnotationSubject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public List validateInferredOrAssertedEntities(Allele primaryAnnotationSubject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { ObjectResponse apaResponse = new ObjectResponse(); ObjectResponse refResponse = validateReference(dto); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java index 1c667ac7f..c7c2d34cf 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ExternalDataBaseEntityFmsDTOValidator.java @@ -12,6 +12,7 @@ import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.dao.ExternalDataBaseEntityDAO; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; @@ -38,7 +39,7 @@ public class ExternalDataBaseEntityFmsDTOValidator { @Inject ResourceDescriptorPageService resourceDescriptorPageService; @Transactional - public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO dto) throws ObjectValidationException { + public ExternalDataBaseEntity validateExternalDataBaseEntityFmsDTO(HTPIdFmsDTO dto) throws ValidationException { ObjectResponse externalDBEntityResponse = new ObjectResponse<>(); ExternalDataBaseEntity externalDBEntity = null; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneGeneticInteractionFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneGeneticInteractionFmsDTOValidator.java index 066ec65dc..e2bab6dc8 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneGeneticInteractionFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneGeneticInteractionFmsDTOValidator.java @@ -6,6 +6,7 @@ import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.enums.PsiMiTabPrefixEnum; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GeneGeneticInteraction; @@ -33,7 +34,7 @@ public class GeneGeneticInteractionFmsDTOValidator extends GeneInteractionFmsDTO private ObjectResponse ggiResponse; - public GeneGeneticInteraction validateGeneGeneticInteractionFmsDTO(PsiMiTabDTO dto) throws ObjectValidationException { + public GeneGeneticInteraction validateGeneGeneticInteractionFmsDTO(PsiMiTabDTO dto) throws ValidationException { GeneGeneticInteraction interaction = null; ggiResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneMolecularInteractionFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneMolecularInteractionFmsDTOValidator.java index c60763e62..eea77d460 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneMolecularInteractionFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneMolecularInteractionFmsDTOValidator.java @@ -6,6 +6,7 @@ import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.enums.PsiMiTabPrefixEnum; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GeneMolecularInteraction; import org.alliancegenome.curation_api.model.entities.Reference; @@ -29,7 +30,7 @@ public class GeneMolecularInteractionFmsDTOValidator extends GeneInteractionFmsD private ObjectResponse gmiResponse; - public GeneMolecularInteraction validateGeneMolecularInteractionFmsDTO(PsiMiTabDTO dto) throws ObjectValidationException { + public GeneMolecularInteraction validateGeneMolecularInteractionFmsDTO(PsiMiTabDTO dto) throws ValidationException { GeneMolecularInteraction interaction = null; gmiResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GenePhenotypeAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GenePhenotypeAnnotationFmsDTOValidator.java index cc782f83a..fa1c02c87 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GenePhenotypeAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GenePhenotypeAnnotationFmsDTOValidator.java @@ -3,6 +3,7 @@ import org.alliancegenome.curation_api.dao.GenePhenotypeAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GenePhenotypeAnnotation; import org.alliancegenome.curation_api.model.entities.Reference; @@ -23,7 +24,7 @@ public class GenePhenotypeAnnotationFmsDTOValidator extends PhenotypeAnnotationF @Inject GenomicEntityService genomicEntityService; @Inject PhenotypeAnnotationService phenotypeAnnotationService; - public GenePhenotypeAnnotation validatePrimaryAnnotation(Gene subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ObjectValidationException { + public GenePhenotypeAnnotation validatePrimaryAnnotation(Gene subject, PhenotypeFmsDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { ObjectResponse apaResponse = new ObjectResponse(); GenePhenotypeAnnotation annotation = new GenePhenotypeAnnotation(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java index edfb35334..2a5bf54ea 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -10,6 +10,7 @@ import org.alliancegenome.curation_api.dao.HTPExpressionDatasetAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.ExternalDataBaseEntity; import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.entities.Note; @@ -41,7 +42,7 @@ public class HTPExpressionDatasetAnnotationFmsDTOValidator { @Inject DataProviderService dataProviderService; @Transactional - public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ObjectValidationException { + public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsDTO(HTPExpressionDatasetAnnotationFmsDTO dto, BackendBulkDataProvider backendBulkDataProvider) throws ValidationException { ObjectResponse htpAnnotationResponse = new ObjectResponse<>(); HTPExpressionDatasetAnnotation htpannotation; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java index 68247c5d3..c0c6060f3 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/ParalogyFmsDTOValidator.java @@ -10,6 +10,7 @@ import org.alliancegenome.curation_api.dao.GeneToGeneParalogyDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.GeneToGeneParalogy; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; @@ -36,7 +37,7 @@ public class ParalogyFmsDTOValidator { @Inject VocabularyTermService vocabularyTermService; @Transactional - public GeneToGeneParalogy validateParalogyFmsDTO(ParalogyFmsDTO dto) throws ObjectValidationException { + public GeneToGeneParalogy validateParalogyFmsDTO(ParalogyFmsDTO dto) throws ValidationException { ObjectResponse paralogyResponse = new ObjectResponse(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java index b73581071..f97d98efc 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/SequenceTargetingReagentFmsDTOValidator.java @@ -4,6 +4,7 @@ import org.alliancegenome.curation_api.dao.SequenceTargetingReagentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.SequenceTargetingReagentFmsDTO; @@ -35,7 +36,7 @@ public class SequenceTargetingReagentFmsDTOValidator { @Inject VocabularyTermService vocabularyTermService; - public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ObjectValidationException { + public SequenceTargetingReagent validateSQTRFmsDTO(SequenceTargetingReagentFmsDTO dto, BackendBulkDataProvider beDataProvider) throws ValidationException { ObjectResponse sqtrResponse = new ObjectResponse<>(); SequenceTargetingReagent sqtr; From 1fb50821781c15bd74e9774489435539aa6396a3 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 14:55:30 +0100 Subject: [PATCH 223/342] Remove unused import --- .../PhenotypeAnnotationBulkUploadFmsITCase.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java index cb156911f..65479e72a 100644 --- a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java @@ -3,11 +3,7 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not; - -import java.util.List; - -import org.alliancegenome.curation_api.base.BaseITCase; +import static org.hamcrest.Matchers.not;ome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; From 5cbea26b26d4b6e7854e403a66453cccaff4e5ba Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 10 Sep 2024 14:57:24 +0100 Subject: [PATCH 224/342] Revert unintentional deletion --- .../curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java index 65479e72a..af1b2a9e3 100644 --- a/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/PhenotypeAnnotationBulkUploadFmsITCase.java @@ -3,7 +3,9 @@ import static org.hamcrest.Matchers.hasKey; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.not;ome.curation_api.base.BaseITCase; +import static org.hamcrest.Matchers.not; + +import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; From 02541621298b30d4e4ca8c4c382e041a34330850 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 10 Sep 2024 14:26:42 -0600 Subject: [PATCH 225/342] Added code for flattening associations --- .../model/entities/AGMDiseaseAnnotation.java | 15 +- .../entities/AGMPhenotypeAnnotation.java | 11 +- .../entities/AlleleDiseaseAnnotation.java | 12 +- .../entities/AllelePhenotypeAnnotation.java | 9 +- .../model/entities/Annotation.java | 24 +- .../model/entities/Association.java | 66 +- .../model/entities/DiseaseAnnotation.java | 27 +- .../model/entities/EvidenceAssociation.java | 4 +- .../model/entities/ExpressionAnnotation.java | 7 - .../model/entities/GeneDiseaseAnnotation.java | 8 - .../entities/GeneExpressionAnnotation.java | 20 +- .../entities/GeneGeneticInteraction.java | 7 +- .../model/entities/GeneInteraction.java | 18 +- .../entities/GeneMolecularInteraction.java | 8 +- .../entities/GenePhenotypeAnnotation.java | 6 - .../model/entities/PhenotypeAnnotation.java | 8 +- .../entities/SingleReferenceAssociation.java | 7 - .../AlleleGeneAssociation.java | 8 - .../AlleleGenomicEntityAssociation.java | 7 - ...ingSequenceGenomicLocationAssociation.java | 9 - .../ConstructGenomicEntityAssociation.java | 10 +- .../ExonGenomicLocationAssociation.java | 9 - .../geneAssociations/GeneGeneAssociation.java | 7 - ...quenceTargetingReagentGeneAssociation.java | 17 +- .../TranscriptCodingSequenceAssociation.java | 7 - .../TranscriptExonAssociation.java | 7 - .../TranscriptGeneAssociation.java | 7 - .../TranscriptGenomicLocationAssociation.java | 10 +- .../dto/AGMDiseaseAnnotationDTOValidator.java | 17 +- .../v0.37.0.49__flatten_assocations.sql | 591 ++++++++++++++++++ 30 files changed, 714 insertions(+), 249 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java index 04a191917..eb0d67d60 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java @@ -8,8 +8,6 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; @@ -24,7 +22,6 @@ 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; @@ -35,14 +32,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Schema(name = "AGM_Disease_Annotation", description = "Annotation class representing a agm disease annotation") @JsonTypeName("AGMDiseaseAnnotation") -@OnDelete(action = OnDeleteAction.CASCADE) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) -@Table(indexes = { - @Index(name = "AGMDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id"), - @Index(name = "AGMDiseaseAnnotation_inferredAllele_index", columnList = "inferredAllele_id"), - @Index(name = "AGMDiseaseAnnotation_assertedAllele_index", columnList = "assertedAllele_id"), - @Index(name = "AGMDiseaseAnnotation_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id") -}) public class AGMDiseaseAnnotation extends DiseaseAnnotation { @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) @@ -91,7 +81,10 @@ public class AGMDiseaseAnnotation extends DiseaseAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.SELECT) - @JoinTable(indexes = @Index(name = "agmdiseaseannotation_gene_agmdiseaseannotation_index", columnList = "agmdiseaseannotation_id")) + @JoinTable(indexes = { + @Index(name = "association_agmdiseaseannotation_index", columnList = "agmdiseaseannotation_id"), + @Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id") + }) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java index 605bfdc0e..c81171c25 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java @@ -21,7 +21,6 @@ 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; @@ -33,12 +32,6 @@ @Schema(name = "AGM_Phenotype_Annotation", description = "Annotation class representing a agm phenotype annotation") @JsonTypeName("AGMPhenotypeAnnotation") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) -@Table(indexes = { - @Index(name = "AGMPhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"), - @Index(name = "AGMPhenotypeAnnotation_inferredAllele_index", columnList = "inferredAllele_id"), - @Index(name = "AGMPhenotypeAnnotation_assertedAllele_index", columnList = "assertedAllele_id"), - @Index(name = "AGMPhenotypeAnnotation_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id") -}) public class AGMPhenotypeAnnotation extends PhenotypeAnnotation { @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) @@ -88,8 +81,8 @@ public class AGMPhenotypeAnnotation extends PhenotypeAnnotation { @ManyToMany @Fetch(FetchMode.SELECT) @JoinTable(indexes = { - @Index(name = "agmphenotypeannotation_gene_agmphenotypeannotation_index", columnList = "agmphenotypeannotation_id"), - @Index(name = "agmphenotypeannotation_gene_assertedgenes_index", columnList = "assertedgenes_id") + @Index(name = "association_agmphenotypeannotation_index", columnList = "agmphenotypeannotation_id"), + @Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id") }) @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java index 0be4353c5..7742960fd 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java @@ -8,8 +8,6 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; @@ -24,7 +22,6 @@ 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; @@ -35,12 +32,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Schema(name = "Allele_Disease_Annotation", description = "Annotation class representing a allele disease annotation") @JsonTypeName("AlleleDiseaseAnnotation") -@OnDelete(action = OnDeleteAction.CASCADE) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) -@Table(indexes = { - @Index(name = "AlleleDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id"), - @Index(name = "AlleleDiseaseAnnotation_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id") -}) public class AlleleDiseaseAnnotation extends DiseaseAnnotation { @IndexedEmbedded(includePaths = { @@ -83,8 +75,8 @@ public class AlleleDiseaseAnnotation extends DiseaseAnnotation { @ManyToMany @Fetch(FetchMode.SELECT) @JoinTable(indexes = { - @Index(name = "allelediseaseannotationgene_diseaseannotation_index", columnList = "allelediseaseannotation_id"), - @Index(name = "allelediseaseannotationgene_assertedgenes_index", columnList = "assertedgenes_id") + @Index(name = "association_allelediseaseannotation_index", columnList = "allelediseaseannotation_id"), + @Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id") }) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java index 5fbb7f3d8..2374ee900 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java @@ -21,7 +21,6 @@ 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; @@ -33,10 +32,6 @@ @Schema(name = "Allele_Phenotype_Annotation", description = "Annotation class representing a allele phenotype annotation") @JsonTypeName("AllelePhenotypeAnnotation") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) -@Table(indexes = { - @Index(name = "AllelePhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"), - @Index(name = "AllelePhenotypeAnnotation_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id") -}) public class AllelePhenotypeAnnotation extends PhenotypeAnnotation { @IndexedEmbedded(includePaths = { @@ -79,8 +74,8 @@ public class AllelePhenotypeAnnotation extends PhenotypeAnnotation { @ManyToMany @Fetch(FetchMode.SELECT) @JoinTable(indexes = { - @Index(name = "allelephenotypeannotationgene_phenotypeannotation_index", columnList = "allelephenotypeannotation_id"), - @Index(name = "allelephenotypeannotationgene_assertedgenes_index", columnList = "assertedgenes_id") + @Index(name = "association_allelephenotypeannotation_index", columnList = "allelephenotypeannotation_id"), + @Index(name = "association_assertedgenes_index", columnList = "assertedgenes_id") }) @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java index 2ca9a3fa7..9117376b3 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java @@ -28,8 +28,6 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToMany; -import jakarta.persistence.Table; -import jakarta.persistence.UniqueConstraint; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -40,18 +38,6 @@ @ToString(callSuper = true) @Schema(name = "annotation", description = "POJO that represents an annotation") @AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) -@Table( - indexes = { - @Index(name = "annotation_curie_index", columnList = "curie"), - @Index(name = "annotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "annotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "annotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "annotation_dataprovider_index", columnList = "dataProvider_id") - }, uniqueConstraints = { - @UniqueConstraint(name = "annotation_modentityid_uk", columnNames = "modEntityId"), - @UniqueConstraint(name = "annotation_modinternalid_uk", columnNames = "modInternalId") - } -) public class Annotation extends SingleReferenceAssociation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @@ -86,7 +72,10 @@ public class Annotation extends SingleReferenceAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) - @JoinTable(indexes = { @Index(name = "annotation_conditionrelation_annotation_index", columnList = "annotation_id"), @Index(name = "annotation_conditionrelation_conditionrelations_index", columnList = "conditionrelations_id")}) + @JoinTable(indexes = { + @Index(name = "association_annotation_conditionrelation_index", columnList = "annotation_id"), + @Index(name = "association_annotation_conditionrelations_index", columnList = "conditionrelations_id") + }) private List conditionRelations; @IndexedEmbedded(includePaths = {"freeText", "noteType.name", "references.curie", @@ -96,7 +85,10 @@ public class Annotation extends SingleReferenceAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) - @JoinTable(indexes = { @Index(name = "annotation_note_annotation_index", columnList = "annotation_id"), @Index(name = "annotation_note_relatednotes_index", columnList = "relatednotes_id")}) + @JoinTable(indexes = { + @Index(name = "association_annotation_annotation_index", columnList = "annotation_id"), + @Index(name = "association_relatednotes_index", columnList = "relatednotes_id") + }) private List relatedNotes; @IndexedEmbedded(includePaths = {"sourceOrganization.abbreviation", "sourceOrganization.fullName", "sourceOrganization.shortName", "crossReference.displayName", "crossReference.referencedCurie", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Association.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Association.java index f06fccbc2..2f3c01825 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Association.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Association.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.eclipse.microprofile.openapi.annotations.media.Schema; +import jakarta.persistence.DiscriminatorColumn; import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.Inheritance; @@ -14,16 +15,75 @@ import lombok.EqualsAndHashCode; import lombok.ToString; -@Inheritance(strategy = InheritanceType.JOINED) +@Inheritance(strategy = InheritanceType.SINGLE_TABLE) +@DiscriminatorColumn(name = "AssociationType", length = 96) @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "association", description = "POJO that represents an association") @Table(indexes = { - @Index(name = "association_createdby_index", columnList = "createdBy_id"), - @Index(name = "association_updatedby_index", columnList = "updatedBy_id") + @Index(name = "association_curie_index", columnList = "curie"), + @Index(name = "association_modEntityId_index", columnList = "modEntityId"), + @Index(name = "association_modInternalId_index", columnList = "modInternalId"), + @Index(name = "association_uniqueId_index", columnList = "uniqueid"), + @Index(name = "association_whenexpressedstagename_index ", columnList = "whenexpressedstagename"), + @Index(name = "association_whereexpressedstatement_index", columnList = "whereexpressedstatement"), + @Index(name = "association_interactionId_index", columnList = "interactionid"), + @Index(name = "association_construct_subject_index", columnList = "constructassociationsubject_id"), + @Index(name = "association_construct_object_index", columnList = "constructgenomicentityassociationobject_id"), + @Index(name = "association_relation_index", columnList = "relation_id"), + @Index(name = "association_singlereference_index", columnList = "singleReference_id"), + @Index(name = "association_dataProvider_index", columnList = "dataProvider_id"), + @Index(name = "association_crossreference_index", columnList = "crossreference_id"), + @Index(name = "association_assertedAllele_index", columnList = "assertedAllele_id"), + @Index(name = "association_inferredAllele_index", columnList = "inferredAllele_id"), + @Index(name = "association_inferredGene_index", columnList = "inferredGene_id"), + @Index(name = "association_PhenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id"), + @Index(name = "association_sgdstrainbackground_index", columnList = "sgdstrainbackground_id"), + @Index(name = "association_expressionpattern_index", columnList = "expressionpattern_id"), + @Index(name = "association_expression_annotation_subject_index", columnList = "expressionannotationsubject_id"), + @Index(name = "association_expression_assay_used_index", columnList = "expressionassayused_id"), + @Index(name = "association_sqtr_subject_index", columnList = "sequencetargetingreagentassociationsubject_id"), + @Index(name = "association_sqtr_object_index", columnList = "sequencetargetingreagentgeneassociationobject_id"), + @Index(name = "association_evidencecode_index", columnList = "evidencecode_id"), + @Index(name = "association_relatednote_index", columnList = "relatednote_id"), + @Index(name = "association_geneassociationsubject_index", columnList = "geneassociationsubject_id"), + @Index(name = "association_genegeneassociationobject_index", columnList = "genegeneassociationobject_id"), + @Index(name = "association_transcript_subject_index", columnList = "transcriptassociationsubject_id"), + @Index(name = "association_transcript_gene_object_index", columnList = "transcriptgeneassociationobject_id"), + @Index(name = "association_exon_subject_index", columnList = "exonassociationsubject_id"), + @Index(name = "association_exon_object_index", columnList = "exongenomiclocationassociationobject_id"), + @Index(name = "association_annotationType_index", columnList = "annotationType_id"), + @Index(name = "association_DiseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"), + @Index(name = "association_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"), + @Index(name = "association_geneticSex_index", columnList = "geneticSex_id"), + @Index(name = "association_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"), + @Index(name = "association_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id"), + @Index(name = "association_interactionsource_index", columnList = "interactionsource_id"), + @Index(name = "association_interactiontype_index", columnList = "interactiontype_id"), + @Index(name = "association_interactorarole_index", columnList = "interactorarole_id"), + @Index(name = "association_interactorbrole_index", columnList = "interactorbrole_id"), + @Index(name = "association_interactoratype_index", columnList = "interactoratype_id"), + @Index(name = "association_interactorbtype_index", columnList = "interactorbtype_id"), + @Index(name = "association_interactorageneticperturbarion_index", columnList = "interactorageneticperturbation_id"), + @Index(name = "association_interactorbgeneticperturbarion_index", columnList = "interactorbgeneticperturbation_id"), + @Index(name = "association_alleleassociationsubject_index", columnList = "alleleassociationsubject_id"), + @Index(name = "association_allelegeneassociationobject_index", columnList = "allelegeneassociationobject_id"), + @Index(name = "association_transcript_exon_object_index", columnList = "transcriptexonassociationobject_id"), + @Index(name = "association_transcript_object_index", columnList = "transcriptgenomiclocationassociationobject_id"), + @Index(name = "association_cds_subject_index", columnList = "codingsequenceassociationsubject_id"), + @Index(name = "association_cds_object_index", columnList = "codingsequencegenomiclocationassociationobject_id"), + @Index(name = "association_aggregationdatabase_index", columnList = "aggregationdatabase_id"), + @Index(name = "association_detectionmethod_index", columnList = "detectionmethod_id"), + @Index(name = "association_transcript_cds_object_index", columnList = "transcriptcodingsequenceassociationobject_id"), + + @Index(name = "association_associationtype_index", columnList = "associationtype"), + + @Index(name = "association_createdby_index", columnList = "createdBy_id"), + @Index(name = "association_updatedby_index", columnList = "updatedBy_id") }) + @AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) public class Association extends AuditedObject { 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 d25f6bc63..e4e3e4abb 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 @@ -33,7 +33,6 @@ 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; @@ -46,16 +45,6 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class }) @Schema(name = "Disease_Annotation", description = "Annotation class representing a disease annotation") - -@Table(indexes = { - @Index(name = "DiseaseAnnotation_diseaseAnnotationObject_index", columnList = "diseaseannotationobject_id"), - @Index(name = "DiseaseAnnotation_relation_index", columnList = "relation_id"), - @Index(name = "DiseaseAnnotation_annotationType_index", columnList = "annotationType_id"), - @Index(name = "DiseaseAnnotation_geneticSex_index", columnList = "geneticSex_id"), - @Index(name = "DiseaseAnnotation_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"), - @Index(name = "DiseaseAnnotation_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id") -}) - public abstract class DiseaseAnnotation extends Annotation { @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", @@ -84,8 +73,8 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable(indexes = { - @Index(name = "diseaseannotation_ecoterm_diseaseannotation_index", columnList = "diseaseannotation_id"), - @Index(name = "diseaseannotation_ecoterm_evidencecodes_index", columnList = "evidencecodes_id") + @Index(name = "association_diseaseannotation_diseaseannotation_index", columnList = "diseaseannotation_id"), + @Index(name = "association_diseaseannotation_evidencecodes_index", columnList = "evidencecodes_id") }) private List evidenceCodes; @@ -101,8 +90,8 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @Fetch(FetchMode.SELECT) @JoinTable(indexes = { - @Index(name = "diseaseannotation_gene_diseaseannotation_index", columnList = "diseaseannotation_id"), - @Index(name = "diseaseannotation_gene_with_index", columnList = "with_id") + @Index(name = "association_diseaseannotation_gene_index", columnList = "diseaseannotation_id"), + @Index(name = "association_diseaseannotation_with_index", columnList = "with_id") }) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) private List with; @@ -118,8 +107,8 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable(indexes = { - @Index(name = "diseaseannotation_vocabularyterm_diseaseannotation_index", columnList = "diseaseannotation_id"), - @Index(name = "diseaseannotation_vocabularyterm_diseasequalifiers_index", columnList = "diseasequalifiers_id") + @Index(name = "association_diseaseannotation_vt_diseaseannotation_index", columnList = "diseaseannotation_id"), + @Index(name = "association_diseaseannotation_diseasequalifiers_index", columnList = "diseasequalifiers_id") }) private List diseaseQualifiers; @@ -143,8 +132,8 @@ public abstract class DiseaseAnnotation extends Annotation { @Fetch(FetchMode.SELECT) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable(indexes = { - @Index(name = "diseaseannotation_biologicalentity_diseaseannotation_index", columnList = "diseaseannotation_id"), - @Index(name = "diseaseannotation_biologicalentity_dgms_index", columnList = "diseasegeneticmodifiers_id") + @Index(name = "association_diseaseannotation_BiologicalEntity_index", columnList = "diseaseannotation_id"), + @Index(name = "association_diseaseannotation_dgms_index", columnList = "diseasegeneticmodifiers_id") }) private List diseaseGeneticModifiers; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/EvidenceAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/EvidenceAssociation.java index ca519f252..63a71cc3f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/EvidenceAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/EvidenceAssociation.java @@ -31,8 +31,8 @@ public class EvidenceAssociation extends Association { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.AlleleView.class, View.GeneView.class, View.ConstructView.class, View.GeneInteractionView.class }) @JoinTable(indexes = { - @Index(name = "evidenceassociation_infocontent_evidenceassociation_index", columnList = "evidenceassociation_id"), - @Index(name = "evidenceassociation_infocontent_evidence_index", columnList = "evidence_id") + @Index(name = "association_evidenceassociation_index", columnList = "evidenceassociation_id"), + @Index(name = "association_evidenceassociation_evidence_index", columnList = "evidence_id") }) private List evidence; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java index a1f057ce9..dc8f910eb 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ExpressionAnnotation.java @@ -21,11 +21,9 @@ import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -38,11 +36,6 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class }) @Schema(name = "Expression_Annotation", description = "Annotation class representing an expression annotation") -@Table(indexes = { - @Index(name = "expressionannotation_whenexpressedstagename_index ", columnList = "whenexpressedstagename"), - @Index(name = "expressionannotation_whereexpressedstatement_index", columnList = "whereexpressedstatement"), - @Index(name = "expressionannotation_expressionpattern_index", columnList = "expressionpattern_id") -}) public abstract class ExpressionAnnotation extends Annotation { @IndexedEmbedded(includePaths = {"name", "name_keyword"}) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java index 61754add1..209512ac9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java @@ -4,8 +4,6 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; -import org.hibernate.annotations.OnDelete; -import org.hibernate.annotations.OnDeleteAction; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; @@ -16,9 +14,7 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -29,11 +25,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Schema(name = "Gene_Disease_Annotation", description = "Annotation class representing a gene disease annotation") @JsonTypeName("GeneDiseaseAnnotation") -@OnDelete(action = OnDeleteAction.CASCADE) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) -@Table(indexes = { - @Index(name = "GeneDiseaseAnnotation_DiseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id") -}) public class GeneDiseaseAnnotation extends DiseaseAnnotation { @IndexedEmbedded(includePaths = { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java index 0fa94780c..14c0bc1f7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneExpressionAnnotation.java @@ -1,13 +1,5 @@ package org.alliancegenome.curation_api.model.entities; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonView; -import jakarta.persistence.Entity; -import jakarta.persistence.Index; -import jakarta.persistence.ManyToOne; -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.alliancegenome.curation_api.model.entities.ontology.MMOTerm; @@ -18,6 +10,14 @@ 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.JsonTypeName; +import com.fasterxml.jackson.annotation.JsonView; + +import jakarta.persistence.Entity; +import jakarta.persistence.ManyToOne; +import lombok.Data; +import lombok.EqualsAndHashCode; + @Indexed @Entity @Data @@ -25,10 +25,6 @@ @Schema(name = "Gene_Expression_Annotation", description = "Annotation class representing a gene expression annotation") @JsonTypeName("GeneExpressionAnnotation") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { ExpressionAnnotation.class }) -@Table(indexes = { - @Index(name = "geneexpressionannotation_expression_annotation_subject_index", columnList = "expressionannotationsubject_id"), - @Index(name = "geneexpressionannotation_expression_assay_used_index", columnList = "expressionassayused_id") -}) public class GeneExpressionAnnotation extends ExpressionAnnotation { @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"}) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java index 4e23d0c64..6d0640b6b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java @@ -25,7 +25,6 @@ import jakarta.persistence.Index; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -37,10 +36,6 @@ @EqualsAndHashCode(callSuper = true) @Schema(name = "Gene_Genetic_Interaction", description = "Class representing an interaction between genes") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GeneInteraction.class }) -@Table(indexes = { - @Index(name = "genegeneticinteraction_interactorageneticperturbarion_index", columnList = "interactorageneticperturbation_id"), - @Index(name = "genegeneticinteraction_interactorbgeneticperturbarion_index", columnList = "interactorbgeneticperturbation_id") -}) public class GeneGeneticInteraction extends GeneInteraction { @IndexedEmbedded(includePaths = { @@ -75,6 +70,6 @@ public class GeneGeneticInteraction extends GeneInteraction { @KeywordField(name = "phenotypesOrTraits_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ElementCollection @JsonView({View.FieldsAndLists.class, View.GeneInteractionView.class}) - @JoinTable(indexes = @Index(name = "genegeneticinteraction_phenotypesortraits_interaction_index", columnList = "genegeneticinteraction_id")) + @JoinTable(indexes = @Index(name = "association_genegeneticinteraction_phenotypesortraits_index", columnList = "genegeneticinteraction_id")) private List phenotypesOrTraits; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java index 9cd463267..da9f78329 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java @@ -28,7 +28,6 @@ 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; @@ -39,17 +38,6 @@ @AGRCurationSchemaVersion(min = "2.2.2", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class }) @ToString(callSuper = true) @Schema(name = "Gene_Interaction", description = "Annotation class representing a gene interaction") -@Table(indexes = { - @Index(name = "geneinteraction_interactionId_index", columnList = "interactionid"), - @Index(name = "geneinteraction_uniqueId_index", columnList = "uniqueid"), - @Index(name = "geneinteraction_interactionsource_index", columnList = "interactionsource_id"), - @Index(name = "geneinteraction_interactiontype_index", columnList = "interactiontype_id"), - @Index(name = "geneinteraction_interactorarole_index", columnList = "interactorarole_id"), - @Index(name = "geneinteraction_interactorbrole_index", columnList = "interactorbrole_id"), - @Index(name = "geneinteraction_interactoratype_index", columnList = "interactoratype_id"), - @Index(name = "geneinteraction_interactorbtype_index", columnList = "interactorbtype_id") -}) - public abstract class GeneInteraction extends GeneGeneAssociation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @@ -68,9 +56,9 @@ public abstract class GeneInteraction extends GeneGeneAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JoinTable(indexes = { - @Index(columnList = "geneinteraction_id, crossreferences_id", name = "geneinteraction_crossreference_gi_xref_index"), - @Index(columnList = "geneinteraction_id", name = "geneinteraction_crossreference_geneinteraction_index"), - @Index(columnList = "crossreferences_id", name = "geneinteraction_crossreference_crossreferences_index") + @Index(columnList = "geneinteraction_id, crossreferences_id", name = "association_geneinteraction_crossreference_index"), + @Index(columnList = "geneinteraction_id", name = "association_geneinteraction_geneinteraction_index"), + @Index(columnList = "crossreferences_id", name = "association_geneinteraction_crossreferences_index") }) @JsonView({ View.FieldsAndLists.class, View.GeneInteractionView.class }) private List crossReferences; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneMolecularInteraction.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneMolecularInteraction.java index db8708524..ffaed844e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneMolecularInteraction.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneMolecularInteraction.java @@ -15,9 +15,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -29,10 +27,6 @@ @EqualsAndHashCode(callSuper = true) @Schema(name = "Gene_Molecular_Interaction", description = "Class representing an interaction between gene products") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GeneInteraction.class }) -@Table(indexes = { - @Index(name = "genemolecularinteraction_aggregationdatabase_index", columnList = "aggregationdatabase_id"), - @Index(name = "genemolecularinteraction_detectionmethod_index", columnList = "detectionmethod_id") -}) public class GeneMolecularInteraction extends GeneInteraction { @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", @@ -50,4 +44,4 @@ public class GeneMolecularInteraction extends GeneInteraction { @Fetch(FetchMode.SELECT) @JsonView({ View.FieldsOnly.class }) private MITerm detectionMethod; -} +} \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java index a22dcf91a..3095c001f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java @@ -13,9 +13,7 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -27,10 +25,6 @@ @Schema(name = "Gene_Phenotype_Annotation", description = "Annotation class representing a gene phenotype annotation") @JsonTypeName("GenePhenotypeAnnotation") @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) -@Table(indexes = { - @Index(name = "genephenotypeannotation_phenotypeannotationsubject_index", columnList = "phenotypeannotationsubject_id"), - @Index(name = "genephenotypeannotation_sgdstrainbackground_index", columnList = "sgdstrainbackground_id") -}) public class GenePhenotypeAnnotation extends PhenotypeAnnotation { @IndexedEmbedded(includePaths = { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java index 785411533..44be871a0 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java @@ -29,7 +29,6 @@ import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -42,9 +41,6 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class }) @Schema(name = "Phenotype_Annotation", description = "Annotation class representing a phenotype annotation") -@Table(indexes = { - @Index(name = "phenotypeannotation_relation_index", columnList = "relation_id") -}) public abstract class PhenotypeAnnotation extends Annotation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @@ -58,8 +54,8 @@ public abstract class PhenotypeAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) @JoinTable(indexes = { - @Index(name = "phenotypeannotation_ontologyterm_phenotypeannotation_index", columnList = "phenotypeannotation_id"), - @Index(name = "phenotypeannotation_ontologyterm_phenotypeterms_index", columnList = "phenotypeterms_id") + @Index(name = "association_phenotypeannotation_phenotypeannotation_index", columnList = "phenotypeannotation_id"), + @Index(name = "association_phenotypeannotation_phenotypeterms_index", columnList = "phenotypeterms_id") }) private List phenotypeTerms; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/SingleReferenceAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/SingleReferenceAssociation.java index a75062653..77af76ef1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/SingleReferenceAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/SingleReferenceAssociation.java @@ -11,9 +11,7 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -22,11 +20,6 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @Schema(name = "singleReferenceAssociation", description = "POJO that represents an association supported by a single reference") @AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Association.class }) - -@Table(indexes = { - @Index(name = "singlereferenceassociation_singlereference_index", columnList = "singleReference_id") -}) - public class SingleReferenceAssociation extends Association { @IndexedEmbedded(includePaths = {"curie", "primaryCrossReferenceCurie", "crossReferences.referencedCurie", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java index ca9e0bf8c..74fcbf2bd 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java @@ -16,9 +16,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -29,12 +27,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AlleleGenomicEntityAssociation.class }) @Schema(name = "AlleleGeneAssociation", description = "POJO representing an association between an allele and a gene") -@Table( - indexes = { - @Index(name = "allelegeneassociation_alleleassociationsubject_index", columnList = "alleleassociationsubject_id"), - @Index(name = "allelegeneassociation_allelegeneassociationobject_index", columnList = "allelegeneassociationobject_id") - } -) public class AlleleGeneAssociation extends AlleleGenomicEntityAssociation { @IndexedEmbedded(includePaths = { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGenomicEntityAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGenomicEntityAssociation.java index db25b7827..ec6cef974 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGenomicEntityAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGenomicEntityAssociation.java @@ -16,10 +16,8 @@ import jakarta.persistence.CascadeType; import jakarta.persistence.Entity; -import jakarta.persistence.Index; import jakarta.persistence.ManyToOne; import jakarta.persistence.OneToOne; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -30,11 +28,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "1.9.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "AlleleGenomicEntityAssociation", description = "POJO representing an association between an allele and a genomic entity") -@Table( - indexes = { - @Index(name = "allelegenomicentityassociation_relation_index", columnList = "relation_id") - } -) public class AlleleGenomicEntityAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = { "name", "name_keyword" }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index 322734ab5..3a72b20da 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -25,9 +25,7 @@ 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; @@ -38,13 +36,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { LocationAssociation.class }) @Schema(name = "CodingSequenceGenomicLocationAssociation", description = "POJO representing an association between a CDS and a genomic location") -@Table( - indexes = { - @Index(name = "codingsequencelocationassociation_relation_index", columnList = "relation_id"), - @Index(name = "codingsequencelocationassociation_subject_index", columnList = "codingsequenceassociationsubject_id"), - @Index(name = "codingsequencelocationassociation_object_index", columnList = "codingsequencegenomiclocationassociationobject_id") - } -) public class CodingSequenceGenomicLocationAssociation extends LocationAssociation { @IndexedEmbedded(includePaths = { 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 5ed1f0721..865a69c0a 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 @@ -27,7 +27,6 @@ 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; @@ -38,11 +37,6 @@ @ToString(callSuper = true) @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 = { - @Index(name = "constructgenomicentityassociation_subject_index", columnList = "constructassociationsubject_id"), - @Index(name = "constructgenomicentityassociation_object_index", columnList = "constructgenomicentityassociationobject_id"), - @Index(name = "constructgenomicentityassociation_relation_index", columnList = "relation_id") -}) public class ConstructGenomicEntityAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = { @@ -80,8 +74,8 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.ConstructView.class }) @JoinTable(indexes = { - @Index(name = "cgeassociation_note_cgeassociation_index", columnList = "constructgenomicentityassociation_id"), - @Index(name = "cgeassociation_note_relatednotes_index", columnList = "relatedNotes_id") + @Index(name = "association_cgeassociation_cgeassociation_index", columnList = "constructgenomicentityassociation_id"), + @Index(name = "association_relatednotes_index", columnList = "relatedNotes_id") }) private List relatedNotes; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 7db787478..a1b4989be 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -23,9 +23,7 @@ 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; @@ -36,13 +34,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { LocationAssociation.class }) @Schema(name = "ExonGenomicLocationAssociation", description = "POJO representing an association between an exon and a genomic location") -@Table( - indexes = { - @Index(name = "exonlocationassociation_relation_index", columnList = "relation_id"), - @Index(name = "exonlocationassociation_subject_index", columnList = "exonassociationsubject_id"), - @Index(name = "exonlocationassociation_object_index", columnList = "exongenomiclocationassociationobject_id") - } -) public class ExonGenomicLocationAssociation extends LocationAssociation { @IndexedEmbedded(includePaths = { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGeneAssociation.java index d1dde5333..7d224d958 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/geneAssociations/GeneGeneAssociation.java @@ -14,9 +14,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -27,11 +25,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "GeneGeneAssociation", description = "POJO representing an association between a gene and a gene") -@Table(indexes = { - @Index(name = "genegeneassociation_geneassociationsubject_index", columnList = "geneassociationsubject_id"), - @Index(name = "genegeneassociation_relation_index", columnList = "relation_id"), - @Index(name = "genegeneassociation_genegeneassociationobject_index", columnList = "genegeneassociationobject_id") -}) public class GeneGeneAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"curie", "geneSymbol.displayText", "geneSymbol.formatText", "geneFullName.displayText", "geneFullName.formatText", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java index e4a0f5340..0902b1847 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/sequenceTargetingReagentAssociations/SequenceTargetingReagentGeneAssociation.java @@ -1,10 +1,13 @@ package org.alliancegenome.curation_api.model.entities.associations.sequenceTargetingReagentAssociations; +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.EvidenceAssociation; import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; 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.mapper.pojo.automaticindexing.ReindexOnUpdate; @@ -16,13 +19,6 @@ import jakarta.persistence.Entity; import jakarta.persistence.ManyToOne; - -import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; -import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; -import org.eclipse.microprofile.openapi.annotations.media.Schema; - -import jakarta.persistence.Index; -import jakarta.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -34,13 +30,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.3.1", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "SequenceTargetingReagentGeneAssociation", description = "POJO representing an association between an SQTR and a gene") -@Table( - indexes = { - @Index(name = "sequencetargetingreagentassociation_subject_index", columnList = "sequencetargetingreagentassociationsubject_id"), - @Index(name = "sequencetargetingreagentgeneassociation_relation_index", columnList = "relation_id"), - @Index(name = "sequencetargetingreagentgeneassociation_sequencetargetingreagentgeneassociationobject_index", columnList = "sequencetargetingreagentgeneassociationobject_id") - } -) public class SequenceTargetingReagentGeneAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"name", "synonyms", "secondaryIdentifiers"}) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java index 1e231ea5c..398a4aa99 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptCodingSequenceAssociation.java @@ -16,9 +16,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -29,11 +27,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "TranscriptCodingSequenceAssociation", description = "POJO representing an association between a transcript and a CDS") -@Table(indexes = { - @Index(name = "transcriptcdsassociation_subject_index", columnList = "transcriptassociationsubject_id"), - @Index(name = "transcriptcdsassociation_relation_index", columnList = "relation_id"), - @Index(name = "transcriptcdsassociation_object_index", columnList = "transcriptcodingsequenceassociationobject_id") -}) public class TranscriptCodingSequenceAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java index 0960baeaf..a609e2c96 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptExonAssociation.java @@ -16,9 +16,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -29,11 +27,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "TranscriptExonAssociation", description = "POJO representing an association between a transcript and an exon") -@Table(indexes = { - @Index(name = "transcriptexonassociation_subject_index", columnList = "transcriptassociationsubject_id"), - @Index(name = "transcriptexonassociation_relation_index", columnList = "relation_id"), - @Index(name = "transcriptexonassociation_object_index", columnList = "transcriptexonassociationobject_id") -}) public class TranscriptExonAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java index 8658c7ab1..37d2af97b 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGeneAssociation.java @@ -16,9 +16,7 @@ import com.fasterxml.jackson.annotation.JsonView; 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; @@ -29,11 +27,6 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { EvidenceAssociation.class }) @Schema(name = "TranscriptGeneAssociation", description = "POJO representing an association between a transcript and a gene") -@Table(indexes = { - @Index(name = "transcriptgeneassociation_subject_index", columnList = "transcriptassociationsubject_id"), - @Index(name = "transcriptgeneassociation_relation_index", columnList = "relation_id"), - @Index(name = "transcriptgeneassociation_object_index", columnList = "transcriptgeneassociationobject_id") -}) public class TranscriptGeneAssociation extends EvidenceAssociation { @IndexedEmbedded(includePaths = {"curie", "name", "modEntityId", "modInternalId", diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index bbaa93051..1747fa262 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -25,9 +25,7 @@ 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; @@ -38,13 +36,7 @@ @ToString(callSuper = true) @AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { LocationAssociation.class }) @Schema(name = "TranscriptGenomicLocationAssociation", description = "POJO representing an association between a transcript and a genomic location") -@Table( - indexes = { - @Index(name = "transcriptlocationassociation_relation_index", columnList = "relation_id"), - @Index(name = "transcriptlocationassociation_subject_index", columnList = "transcriptassociationsubject_id"), - @Index(name = "transcriptlocationassociation_object_index", columnList = "transcriptgenomiclocationassociationobject_id") - } -) + public class TranscriptGenomicLocationAssociation extends LocationAssociation { @IndexedEmbedded(includePaths = { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java index b4c687a16..d8812d921 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/AGMDiseaseAnnotationDTOValidator.java @@ -1,14 +1,20 @@ package org.alliancegenome.curation_api.services.validation.dto; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.util.ArrayList; +import java.util.List; + import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.*; +import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.ingest.dto.AGMDiseaseAnnotationDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -22,8 +28,8 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import java.util.ArrayList; -import java.util.List; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; @RequestScoped public class AGMDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOValidator { @@ -40,7 +46,6 @@ public class AGMDiseaseAnnotationDTOValidator extends DiseaseAnnotationDTOValida AlleleService alleleService; public AGMDiseaseAnnotation validateAGMDiseaseAnnotationDTO(AGMDiseaseAnnotationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { - AGMDiseaseAnnotation annotation = new AGMDiseaseAnnotation(); AffectedGenomicModel agm; diff --git a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql new file mode 100644 index 000000000..791fe6677 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql @@ -0,0 +1,591 @@ +CREATE TABLE association_gene ( + agmdiseaseannotation_id bigint, + assertedgenes_id bigint, + allelediseaseannotation_id bigint, + diseaseannotation_id bigint, + with_id bigint, + allelephenotypeannotation_id bigint, + agmphenotypeannotation_id bigint +); + +CREATE TABLE association_biologicalentity ( + diseaseannotation_id bigint NOT NULL, + diseasegeneticmodifiers_id bigint NOT NULL +); + +CREATE TABLE association_conditionrelation ( + annotation_id bigint NOT NULL, + conditionrelations_id bigint NOT NULL +); + +CREATE TABLE association_crossreference ( + geneinteraction_id bigint NOT NULL, + crossreferences_id bigint NOT NULL +); + +CREATE TABLE association_informationcontententity ( + evidenceassociation_id bigint NOT NULL, + evidence_id bigint NOT NULL +); + +CREATE TABLE association_note ( + annotation_id bigint, + relatednotes_id bigint, + constructgenomicentityassociation_id bigint +); + +CREATE TABLE association_ontologyterm ( + diseaseannotation_id bigint, + evidencecodes_id bigint, + phenotypeannotation_id bigint, + phenotypeterms_id bigint +); + +CREATE TABLE association_vocabularyterm ( + diseaseannotation_id bigint NOT NULL, + diseasequalifiers_id bigint NOT NULL +); + +CREATE TABLE association_phenotypesortraits ( + genegeneticinteraction_id bigint, + phenotypesortraits character varying(255) +); + +ALTER TABLE association + ADD COLUMN curie character varying(255), + ADD COLUMN modentityid character varying(255), + ADD COLUMN modinternalid character varying(255), + ADD COLUMN uniqueid character varying(3500), + ADD COLUMN phenotypeannotationobject character varying(255), + ADD COLUMN whenexpressedstagename character varying(2000), + ADD COLUMN whereexpressedstatement character varying(2000), + ADD COLUMN "end" integer, + ADD COLUMN start integer, + ADD COLUMN strand character varying(1), + ADD COLUMN negated boolean DEFAULT false NOT NULL, + ADD COLUMN interactionid character varying(255), + ADD COLUMN phase integer, + ADD COLUMN constructassociationsubject_id bigint, + ADD COLUMN constructgenomicentityassociationobject_id bigint, + ADD COLUMN relation_id bigint, + ADD COLUMN singlereference_id bigint, + ADD COLUMN dataprovider_id bigint, + ADD COLUMN crossreference_id bigint, + ADD COLUMN assertedallele_id bigint, + ADD COLUMN inferredallele_id bigint, + ADD COLUMN inferredgene_id bigint, + ADD COLUMN phenotypeannotationsubject_id bigint, + ADD COLUMN sgdstrainbackground_id bigint, + ADD COLUMN expressionpattern_id bigint, + ADD COLUMN expressionannotationsubject_id bigint, + ADD COLUMN expressionassayused_id bigint, + ADD COLUMN sequencetargetingreagentassociationsubject_id bigint, + ADD COLUMN sequencetargetingreagentgeneassociationobject_id bigint, + ADD COLUMN evidencecode_id bigint, + ADD COLUMN relatednote_id bigint, + ADD COLUMN geneassociationsubject_id bigint, + ADD COLUMN genegeneassociationobject_id bigint, + ADD COLUMN transcriptassociationsubject_id bigint, + ADD COLUMN transcriptgeneassociationobject_id bigint, + ADD COLUMN exonassociationsubject_id bigint, + ADD COLUMN exongenomiclocationassociationobject_id bigint, + ADD COLUMN annotationtype_id bigint, + ADD COLUMN diseaseannotationobject_id bigint, + ADD COLUMN diseasegeneticmodifierrelation_id bigint, + ADD COLUMN geneticsex_id bigint, + ADD COLUMN secondarydataprovider_id bigint, + ADD COLUMN diseaseannotationsubject_id bigint, + ADD COLUMN interactionsource_id bigint, + ADD COLUMN interactiontype_id bigint, + ADD COLUMN interactorarole_id bigint, + ADD COLUMN interactoratype_id bigint, + ADD COLUMN interactorbrole_id bigint, + ADD COLUMN interactorbtype_id bigint, + ADD COLUMN interactorageneticperturbation_id bigint, + ADD COLUMN interactorbgeneticperturbation_id bigint, + ADD COLUMN alleleassociationsubject_id bigint, + ADD COLUMN allelegeneassociationobject_id bigint, + ADD COLUMN transcriptexonassociationobject_id bigint, + ADD COLUMN transcriptgenomiclocationassociationobject_id bigint, + ADD COLUMN codingsequenceassociationsubject_id bigint, + ADD COLUMN codingsequencegenomiclocationassociationobject_id bigint, + ADD COLUMN aggregationdatabase_id bigint, + ADD COLUMN detectionmethod_id bigint, + ADD COLUMN transcriptcodingsequenceassociationobject_id bigint, + ADD COLUMN associationtype character varying(96); + +UPDATE association a SET + associationtype = 'AGMDiseaseAnnotation', + inferredallele_id = b.inferredallele_id, + inferredgene_id = b.inferredgene_id, + assertedallele_id = b.assertedallele_id, + diseaseannotationsubject_id = b.diseaseannotationsubject_id +FROM AGMDiseaseAnnotation b where a.id = b.id; + +INSERT INTO association_gene (agmdiseaseannotation_id, assertedgenes_id) + SELECT agmdiseaseannotation_id, assertedgenes_id FROM agmdiseaseannotation_gene; + +DROP TABLE AGMDiseaseAnnotation_Gene; +DROP TABLE AGMDiseaseAnnotation; + +UPDATE association a SET + associationtype = 'AlleleDiseaseAnnotation', + inferredgene_id = b.inferredgene_id, + diseaseannotationsubject_id = b.diseaseannotationsubject_id +FROM AlleleDiseaseAnnotation b where a.id = b.id; + +INSERT INTO association_gene (allelediseaseannotation_id, assertedgenes_id) + SELECT allelediseaseannotation_id, assertedgenes_id FROM allelediseaseannotation_gene; + +DROP TABLE allelediseaseannotation_gene; +DROP TABLE AlleleDiseaseAnnotation; + +UPDATE association a SET + associationtype = 'GeneDiseaseAnnotation', + sgdstrainbackground_id = b.sgdstrainbackground_id, + diseaseannotationsubject_id = b.diseaseannotationsubject_id +FROM GeneDiseaseAnnotation b WHERE a.id = b.id; + +DROP TABLE GeneDiseaseAnnotation; + +UPDATE association a SET + negated = b.negated, + relation_id = b.relation_id, + diseasegeneticmodifierrelation_id = b.diseasegeneticmodifierrelation_id, + annotationtype_id = b.annotationtype_id, + geneticsex_id = b.geneticsex_id, + secondarydataprovider_id = b.secondarydataprovider_id, + diseaseannotationobject_id = b.diseaseannotationobject_id +FROM DiseaseAnnotation b WHERE a.id = b.id; + +INSERT INTO association_ontologyterm (diseaseannotation_id, evidencecodes_id) + SELECT diseaseannotation_id, evidencecodes_id FROM diseaseannotation_ontologyterm; + +DROP TABLE diseaseannotation_ontologyterm; + +INSERT INTO association_vocabularyterm (diseaseannotation_id, diseasequalifiers_id) + SELECT diseaseannotation_id, diseasequalifiers_id FROM diseaseannotation_vocabularyterm; + +DROP TABLE diseaseannotation_vocabularyterm; + +INSERT INTO association_biologicalentity (diseaseannotation_id, diseasegeneticmodifiers_id) + SELECT diseaseannotation_id, diseasegeneticmodifiers_id FROM diseaseannotation_biologicalentity; + +DROP TABLE diseaseannotation_biologicalentity; + +INSERT INTO association_gene (diseaseannotation_id, with_id) + SELECT diseaseannotation_id, with_id FROM diseaseannotation_gene; + +DROP TABLE diseaseannotation_gene; +DROP TABLE DiseaseAnnotation; + +UPDATE association a SET + associationtype = 'GeneExpressionAnnotation', + expressionannotationsubject_id = b.expressionannotationsubject_id, + expressionassayused_id = b.expressionassayused_id +FROM GeneExpressionAnnotation b WHERE a.id = b.id; + +DROP TABLE GeneExpressionAnnotation; + +UPDATE association a SET + relation_id = b.relation_id, + whenexpressedstagename = b.whenexpressedstagename, + whereexpressedstatement = b.whereexpressedstatement, + expressionpattern_id = b.expressionpattern_id +FROM ExpressionAnnotation b WHERE a.id = b.id; + +DROP TABLE ExpressionAnnotation; + +UPDATE association a SET + associationtype = 'GenePhenotypeAnnotation', + phenotypeannotationsubject_id = b.phenotypeannotationsubject_id, + sgdstrainbackground_id = b.sgdstrainbackground_id +FROM GenePhenotypeAnnotation b WHERE a.id = b.id; + +DROP TABLE GenePhenotypeAnnotation; + +UPDATE association a SET + associationtype = 'AllelePhenotypeAnnotation', + phenotypeannotationsubject_id = b.phenotypeannotationsubject_id, + inferredgene_id = b.inferredgene_id +FROM AllelePhenotypeAnnotation b WHERE a.id = b.id; + +INSERT INTO association_gene (allelephenotypeannotation_id, assertedgenes_id) + SELECT allelephenotypeannotation_id, assertedgenes_id FROM allelephenotypeannotation_gene; + +DROP TABLE allelephenotypeannotation_gene; +DROP TABLE AllelePhenotypeAnnotation; + +UPDATE association a SET + associationtype = 'AGMPhenotypeAnnotation', + phenotypeannotationsubject_id = b.phenotypeannotationsubject_id, + inferredgene_id = b.inferredgene_id, + inferredallele_id = b.inferredallele_id, + assertedallele_id = b.assertedallele_id +FROM AGMPhenotypeAnnotation b WHERE a.id = b.id; + +INSERT INTO association_gene (agmphenotypeannotation_id, assertedgenes_id) + SELECT agmphenotypeannotation_id, assertedgenes_id FROM agmphenotypeannotation_gene; + +DROP TABLE agmphenotypeannotation_gene; +DROP TABLE AGMPhenotypeAnnotation; + +UPDATE association a SET + phenotypeannotationobject = b.phenotypeannotationobject, + crossreference_id = b.crossreference_id, + relation_id = b.relation_id +FROM phenotypeannotation b WHERE a.id = b.id; + +INSERT INTO association_ontologyterm (phenotypeannotation_id, phenotypeterms_id) + SELECT phenotypeannotation_id, phenotypeterms_id FROM phenotypeannotation_ontologyterm; + +DROP TABLE phenotypeannotation_ontologyterm; +DROP TABLE phenotypeannotation; + +UPDATE association a SET + curie = b.curie, + modentityid = b.modentityid, + modinternalid = b.modinternalid, + uniqueid = b.uniqueid, + dataprovider_id = b.dataprovider_id +FROM Annotation b WHERE a.id = b.id; + +INSERT INTO association_conditionrelation (annotation_id, conditionrelations_id) + SELECT annotation_id, conditionrelations_id FROM annotation_conditionrelation; + +DROP TABLE annotation_conditionrelation; + +INSERT INTO association_note (annotation_id, relatednotes_id) + SELECT annotation_id, relatednotes_id FROM annotation_note; + +DROP TABLE annotation_note; + +DROP TABLE annotation; + +UPDATE association a SET + singlereference_id = b.singlereference_id +FROM singlereferenceassociation b WHERE a.id = b.id; + +DROP TABLE singlereferenceassociation; + +UPDATE association a SET + associationtype = 'GeneGeneticInteraction', + interactorageneticperturbation_id = b.interactorageneticperturbation_id, + interactorbgeneticperturbation_id = b.interactorbgeneticperturbation_id +FROM GeneGeneticInteraction b WHERE a.id = b.id; + +INSERT INTO association_phenotypesortraits (genegeneticinteraction_id, phenotypesortraits) + SELECT genegeneticinteraction_id, phenotypesortraits FROM genegeneticinteraction_phenotypesortraits; + +DROP TABLE genegeneticinteraction_phenotypesortraits; + +DROP TABLE GeneGeneticInteraction; + +UPDATE association a SET + associationtype = 'GeneMolecularInteraction', + aggregationdatabase_id = b.aggregationdatabase_id, + detectionmethod_id = b.detectionmethod_id +FROM GeneMolecularInteraction b WHERE a.id = b.id; + +DROP TABLE GeneMolecularInteraction; + +UPDATE association a SET + interactionid = b.interactionid, + uniqueid = b.uniqueid, + interactionsource_id = b.interactionsource_id, + interactiontype_id = b.interactiontype_id, + interactorarole_id = b.interactorarole_id, + interactorbrole_id = b.interactorbrole_id, + interactoratype_id = b.interactoratype_id, + interactorbtype_id = b.interactorbtype_id +FROM GeneInteraction b WHERE a.id = b.id; + +INSERT INTO association_crossreference (geneinteraction_id, crossreferences_id) + SELECT geneinteraction_id, crossreferences_id FROM geneinteraction_crossreference; + +DROP TABLE geneinteraction_crossreference; +DROP TABLE GeneInteraction; + + +UPDATE association a SET + geneassociationsubject_id = b.geneassociationsubject_id, + genegeneassociationobject_id = b.genegeneassociationobject_id, + relation_id = b.relation_id +FROM GeneGeneAssociation b WHERE a.id = b.id; + +DROP TABLE GeneGeneAssociation; + +UPDATE association a SET + associationtype = 'AlleleGeneAssociation', + alleleassociationsubject_id = b.alleleassociationsubject_id, + allelegeneassociationobject_id = b.allelegeneassociationobject_id +FROM AlleleGeneAssociation b WHERE a.id = b.id; + +DROP TABLE AlleleGeneAssociation; + +UPDATE association a SET + relatednote_id = b.relatednote_id, + relation_id = b.relation_id, + evidencecode_id = b.evidencecode_id +FROM AlleleGenomicEntityAssociation b WHERE a.id = b.id; + +DROP TABLE AlleleGenomicEntityAssociation; + +UPDATE association a SET + associationtype = 'ConstructGenomicEntityAssociation', + constructassociationsubject_id = b.constructassociationsubject_id, + relation_id = b.relation_id, + constructgenomicentityassociationobject_id = b.constructgenomicentityassociationobject_id +FROM ConstructGenomicEntityAssociation b WHERE a.id = b.id; + + +INSERT INTO association_note (constructgenomicentityassociation_id, relatednotes_id) + SELECT constructgenomicentityassociation_id, relatednotes_id FROM constructgenomicentityassociation_note; + +DROP TABLE constructgenomicentityassociation_note; +DROP TABLE ConstructGenomicEntityAssociation; + +UPDATE association a SET + associationtype = 'SequenceTargetingReagentGeneAssociation', + relation_id = b.relation_id, + sequencetargetingreagentassociationsubject_id = b.sequencetargetingreagentassociationsubject_id, + sequencetargetingreagentgeneassociationobject_id = b.sequencetargetingreagentgeneassociationobject_id +FROM SequenceTargetingReagentGeneAssociation b WHERE a.id = b.id; + +DROP TABLE SequenceTargetingReagentGeneAssociation; + +INSERT INTO association_informationcontententity (evidenceassociation_id, evidence_id) + SELECT evidenceassociation_id, evidence_id FROM evidenceassociation_informationcontententity; + +DROP TABLE evidenceassociation_informationcontententity; + + +DROP TABLE TranscriptGeneAssociation; +DROP TABLE TranscriptExonAssociation; +DROP TABLE TranscriptCodingSequenceAssociation; +DROP TABLE CodingSequenceGenomicLocationAssociation; +DROP TABLE ExonGenomicLocationAssociation; +DROP TABLE TranscriptGenomicLocationAssociation; +-- Will need to rerun the GFF loads to populate these tables + +DROP TABLE evidenceassociation; + +DELETE FROM association WHERE associationtype is NULL; + +ALTER TABLE association ALTER COLUMN associationtype SET NOT null; + + +CREATE INDEX association_curie_index ON association USING btree (curie); +CREATE INDEX association_modentityid_index ON association USING btree (modentityid); +CREATE INDEX association_modinternalid_index ON association USING btree (modinternalid); +CREATE INDEX association_uniqueid_index ON association USING btree (uniqueid); +CREATE INDEX association_whenexpressedstagename_index ON association USING btree (whenexpressedstagename); +CREATE INDEX association_whereexpressedstatement_index ON association USING btree (whereexpressedstatement); +CREATE INDEX association_interactionid_index ON association USING btree (interactionid); +CREATE INDEX association_construct_subject_index ON association USING btree (constructassociationsubject_id); +CREATE INDEX association_construct_object_index ON association USING btree (constructgenomicentityassociationobject_id); +CREATE INDEX association_relation_index ON association USING btree (relation_id); +CREATE INDEX association_singlereference_index ON association USING btree (singlereference_id); +CREATE INDEX association_dataprovider_index ON association USING btree (dataprovider_id); +CREATE INDEX association_crossreference_index ON association USING btree (crossreference_id); +CREATE INDEX association_assertedallele_index ON association USING btree (assertedallele_id); +CREATE INDEX association_inferredallele_index ON association USING btree (inferredallele_id); +CREATE INDEX association_inferredgene_index ON association USING btree (inferredgene_id); + +CREATE INDEX association_phenotypeannotationsubject_index ON association USING btree (phenotypeannotationsubject_id); + +CREATE INDEX association_sgdstrainbackground_index ON association USING btree (sgdstrainbackground_id); +CREATE INDEX association_expressionpattern_index ON association USING btree (expressionpattern_id); +CREATE INDEX association_expression_annotation_subject_index ON association USING btree (expressionannotationsubject_id); +CREATE INDEX association_expression_assay_used_index ON association USING btree (expressionassayused_id); +CREATE INDEX association_sqtr_subject_index ON association USING btree (sequencetargetingreagentassociationsubject_id); +CREATE INDEX association_sqtr_object_index ON association USING btree (sequencetargetingreagentgeneassociationobject_id); +CREATE INDEX association_evidencecode_index ON association USING btree (evidencecode_id); +CREATE INDEX association_relatednote_index ON association USING btree (relatednote_id); +CREATE INDEX association_geneassociationsubject_index ON association USING btree (geneassociationsubject_id); +CREATE INDEX association_genegeneassociationobject_index ON association USING btree (genegeneassociationobject_id); +CREATE INDEX association_transcript_subject_index ON association USING btree (transcriptassociationsubject_id); +CREATE INDEX association_transcript_gene_object_index ON association USING btree (transcriptgeneassociationobject_id); +CREATE INDEX association_exon_subject_index ON association USING btree (exonassociationsubject_id); +CREATE INDEX association_exon_object_index ON association USING btree (exongenomiclocationassociationobject_id); +CREATE INDEX association_annotationtype_index ON association USING btree (annotationtype_id); +CREATE INDEX association_diseaseannotationobject_index ON association USING btree (diseaseannotationobject_id); +CREATE INDEX association_diseasegeneticmodifierrelation_index ON association USING btree (diseasegeneticmodifierrelation_id); +CREATE INDEX association_geneticsex_index ON association USING btree (geneticsex_id); +CREATE INDEX association_secondarydataprovider_index ON association USING btree (secondarydataprovider_id); +CREATE INDEX association_diseaseannotationsubject_index ON association USING btree (diseaseannotationsubject_id); +CREATE INDEX association_interactionsource_index ON association USING btree (interactionsource_id); +CREATE INDEX association_interactiontype_index ON association USING btree (interactiontype_id); +CREATE INDEX association_interactorarole_index ON association USING btree (interactorarole_id); +CREATE INDEX association_interactoratype_index ON association USING btree (interactoratype_id); +CREATE INDEX association_interactorbrole_index ON association USING btree (interactorbrole_id); +CREATE INDEX association_interactorbtype_index ON association USING btree (interactorbtype_id); +CREATE INDEX association_interactorageneticperturbarion_index ON association USING btree (interactorageneticperturbation_id); +CREATE INDEX association_interactorbgeneticperturbarion_index ON association USING btree (interactorbgeneticperturbation_id); +CREATE INDEX association_alleleassociationsubject_index ON association USING btree (alleleassociationsubject_id); +CREATE INDEX association_allelegeneassociationobject_index ON association USING btree (allelegeneassociationobject_id); +CREATE INDEX association_transcript_exon_object_index ON association USING btree (transcriptexonassociationobject_id); +CREATE INDEX association_transcript_object_index ON association USING btree (transcriptgenomiclocationassociationobject_id); +CREATE INDEX association_cds_subject_index ON association USING btree (codingsequenceassociationsubject_id); +CREATE INDEX association_cds_object_index ON association USING btree (codingsequencegenomiclocationassociationobject_id); +CREATE INDEX association_aggregationdatabase_index ON association USING btree (aggregationdatabase_id); +CREATE INDEX association_detectionmethod_index ON association USING btree (detectionmethod_id); +CREATE INDEX association_transcript_cds_object_index ON association USING btree (transcriptcodingsequenceassociationobject_id); + +CREATE INDEX association_associationtype_index ON association USING btree (associationtype); + +-- association_gene +CREATE INDEX association_assertedgenes_index ON association_gene USING btree (assertedgenes_id); +CREATE INDEX association_agmdiseaseannotation_index ON association_gene USING btree (agmdiseaseannotation_id); +CREATE INDEX association_allelediseaseannotation_index ON association_gene USING btree (allelediseaseannotation_id); +CREATE INDEX association_diseaseannotation_gene_index ON association_gene USING btree (diseaseannotation_id); +CREATE INDEX association_diseaseannotation_with_index ON association_gene USING btree (with_id); +CREATE INDEX association_allelephenotypeannotation_index ON association_gene USING btree (allelephenotypeannotation_id); +CREATE INDEX association_agmphenotypeannotation_index ON association_gene USING btree (agmphenotypeannotation_id); + +-- association_biologicalentity +CREATE INDEX association_diseaseannotation_BiologicalEntity_index ON association_biologicalentity USING btree (diseaseannotation_id); +CREATE INDEX association_diseaseannotation_dgms_index ON association_biologicalentity USING btree (diseasegeneticmodifiers_id); + +-- association_conditionrelation +CREATE INDEX association_annotation_conditionrelation_index ON association_conditionrelation USING btree (annotation_id); +CREATE INDEX association_annotation_conditionrelations_index ON association_conditionrelation USING btree (conditionrelations_id); + +-- association_crossreference +CREATE INDEX association_geneinteraction_crossreference_index ON association_crossreference USING btree (geneinteraction_id, crossreferences_id); +CREATE INDEX association_geneinteraction_crossreferences_index ON association_crossreference USING btree (crossreferences_id); +CREATE INDEX association_geneinteraction_geneinteraction_index ON association_crossreference USING btree (geneinteraction_id); + +-- association_informationcontententity +CREATE INDEX association_evidenceassociation_index ON association_informationcontententity USING btree (evidenceassociation_id); +CREATE INDEX association_evidenceassociation_evidence_index ON association_informationcontententity USING btree (evidence_id); + +-- association_note +CREATE INDEX association_annotation_annotation_index ON association_note USING btree (annotation_id); +CREATE INDEX association_relatednotes_index ON association_note USING btree (relatednotes_id); +CREATE INDEX association_cgeassociation_cgeassociation_index ON association_note USING btree (constructgenomicentityassociation_id); + +-- association_ontologyterm +CREATE INDEX association_diseaseannotation_diseaseannotation_index ON association_ontologyterm USING btree (diseaseannotation_id); +CREATE INDEX association_diseaseannotation_evidencecodes_index ON association_ontologyterm USING btree (evidencecodes_id); +CREATE INDEX association_phenotypeannotation_phenotypeannotation_index ON association_ontologyterm USING btree (phenotypeannotation_id); +CREATE INDEX association_phenotypeannotation_phenotypeterms_index ON association_ontologyterm USING btree (phenotypeterms_id); + +-- association_vocabularyterm +CREATE INDEX association_diseaseannotation_vt_diseaseannotation_index ON association_vocabularyterm USING btree (diseaseannotation_id); +CREATE INDEX association_diseaseannotation_diseasequalifiers_index ON association_vocabularyterm USING btree (diseasequalifiers_id); + +-- association_phenotypesortraits +CREATE INDEX association_genegeneticinteraction_phenotypesortraits_index ON association_phenotypesortraits USING btree (genegeneticinteraction_id); + + +-- FK's + +-- association_gene +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkhav6kkcn2o8ndwa5hv6gmwdaq FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkfoqrp7f7uar43ue42a873aqjk FOREIGN KEY (agmdiseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkc8yg269l93lpu4fna99912d1y FOREIGN KEY (allelediseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkgib9oxtydiwdm5ibh8e14s8om FOREIGN KEY (diseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkeepgwlxwk2cgvs00fdbhuvc6n FOREIGN KEY (with_id) REFERENCES gene(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fk7cqwg0wtuxw2ltm0f4de62bx1 FOREIGN KEY (allelephenotypeannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_gene ADD CONSTRAINT fkjwoi4su8vkylcfor313n7md25 FOREIGN KEY (agmphenotypeannotation_id) REFERENCES association(id); + +-- association_biologicalentity +ALTER TABLE ONLY association_biologicalentity ADD CONSTRAINT fkkikn34sq62h6ajyagxno5bwhc FOREIGN KEY (diseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_biologicalentity ADD CONSTRAINT fkp5pi80ie788coafu1490s8fla FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); + +-- association_conditionrelation +ALTER TABLE ONLY association_conditionrelation ADD CONSTRAINT fkc4spolvq2xj2253q6yg5rdqc9 FOREIGN KEY (annotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_conditionrelation ADD CONSTRAINT fkiuqvgg26wj61xm3peaabj5a4f FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); + +-- association_crossreference +ALTER TABLE ONLY association_crossreference ADD CONSTRAINT fkt7xih7j80e5stq2rr88bbfr9 FOREIGN KEY (geneinteraction_id) REFERENCES association(id); +ALTER TABLE ONLY association_crossreference ADD CONSTRAINT fk6h7jv57hlmwj53to752mxo5ru FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +-- association_informationcontententity +ALTER TABLE ONLY association_informationcontententity ADD CONSTRAINT fkd52dcl4h9urwl8w0s20wkxvob FOREIGN KEY (evidenceassociation_id) REFERENCES association(id); +ALTER TABLE ONLY association_informationcontententity ADD CONSTRAINT fkbgupm60jot5gk9i9q4carypcb FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- association_note +ALTER TABLE ONLY association_note ADD CONSTRAINT fkgemsq21ksrmcdm5btgyna3bqw FOREIGN KEY (annotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_note ADD CONSTRAINT fk6mcmoe71135qpoueb2cjtrrxd FOREIGN KEY (relatednotes_id) REFERENCES note(id); +ALTER TABLE ONLY association_note ADD CONSTRAINT fkm7ao01tj7hlgmqgx9xrp677sv FOREIGN KEY (constructgenomicentityassociation_id) REFERENCES association(id); + +-- association_ontologyterm +ALTER TABLE ONLY association_ontologyterm ADD CONSTRAINT fki4p7fsji03okqpmakl22225jp FOREIGN KEY (diseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_ontologyterm ADD CONSTRAINT fk2vi7xbepfem6fur85he3565el FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); + +-- Phototype Annotation Orphan Cleanup +DELETE FROM association_ontologyterm WHERE phenotypeannotation_id IN ( + SELECT ao.phenotypeannotation_id from association_ontologyterm ao + LEFT JOIN association a ON ao.phenotypeannotation_id = a.id + WHERE ao.phenotypeannotation_id IS NOT NULL AND a.id IS NULL +); + +ALTER TABLE ONLY association_ontologyterm ADD CONSTRAINT fkom7p46wwwv16bkye0gjc2omxp FOREIGN KEY (phenotypeannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_ontologyterm ADD CONSTRAINT fk9hbubr81amn71dtvm86qw9pl7 FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); + +-- association_vocabularyterm +ALTER TABLE ONLY association_vocabularyterm ADD CONSTRAINT fkcfijtoyigdh9b4ss8efnf3jro FOREIGN KEY (diseaseannotation_id) REFERENCES association(id); +ALTER TABLE ONLY association_vocabularyterm ADD CONSTRAINT fkbf73p7v3d72e2fsni076talw4 FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); + +-- association_phenotypesortraits +-- ALTER TABLE ONLY association_phenotypesortraits ADD CONSTRAINT fklufk1y85ki3qeo1ixbko56rol FOREIGN KEY (genegeneticinteraction_id) REFERENCES association(id); + + + +ALTER TABLE ONLY association ADD CONSTRAINT fkgobipxrs66w3ur1w1tk4sl8ac FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkscnsbwmhpug2to0yu6gw895oh FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk1sb2qk5clgbkk2976x13v5bum FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk6p763216qfdincsh6i5aei5kg FOREIGN KEY (singlereference_id) REFERENCES reference(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk3omr7j2o1nneqgyroynbyulqq FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkmm82blif2e7bpb31jn9485ehc FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk6t34ef007ov1vpfk7ulksfy8y FOREIGN KEY (assertedallele_id) REFERENCES allele(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk2t4nhpv4jnk38yn9bd646wrpj FOREIGN KEY (inferredallele_id) REFERENCES allele(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk9ko4u7l6641hlhpn9eeyf8toh FOREIGN KEY (inferredgene_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY association ADD CONSTRAINT fktgpn8b91m1qb178srwe9n8s7 FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY association ADD CONSTRAINT fk3bh18tfrhnab3usyc1naldwde FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; + +ALTER TABLE ONLY association ADD CONSTRAINT fknrw40h3f8fkk01kclygxd86h9 FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); +ALTER TABLE ONLY association ADD CONSTRAINT fknx6o6bclwogm0v4rli1cdrfdv FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkbh4gekhrbpbt4k9yvons42dux FOREIGN KEY (expressionannotationsubject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk7e020acyvcolnnhpb4118tp3w FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkf2q4ns5ogkba5dtowqk3cajo5 FOREIGN KEY (sequencetargetingreagentassociationsubject_id) REFERENCES sequencetargetingreagent(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkjsjeyjo4eljj3xm4ogi5ucyyw FOREIGN KEY (sequencetargetingreagentgeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkidh408kt3t3fim9rbvgw32hw1 FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkcas3usi3dh8j7s57xqrv29hlm FOREIGN KEY (relatednote_id) REFERENCES note(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk8h34l4ktb6ui786lp9y2mfewo FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk7f05186xuynsh72ikqeuhe1pv FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkt8fk74cx4ibjl7c4g2kvmhldf FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkmiewpuidiblk7jcc5usb1jo63 FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkirjv7oatlssgiqoytcqiyhuqi FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkrwjlq6jcmn90cin2o0801oqxj FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY association ADD CONSTRAINT fknpx0xn81d3edht9pss6n7r2yo FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkr70o6q95nap6g7ry2jjxa90ya FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fknk44lwm2xauhs3r22h09us4ji FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fksinpe44rjxl9n6mn7vhanbwlg FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fk554ce408ek9gf44f6db3w4et1 FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); + +-- ALTER TABLE ONLY association ADD CONSTRAINT fkouxa4j6wep8rss3jviti0qibg FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY association ADD CONSTRAINT fk8qyy1fyhm3273j2p57alkp02t FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY association ADD CONSTRAINT fkksi8xjap9hliwoo4j3io09frg FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; + +ALTER TABLE ONLY association ADD CONSTRAINT fkaj9ynw0e9bswh3dth646t834o FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkh8gqvx5c40tlw0a37uff6e9ky FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkapag4jcegsd5rus25ladx3eat FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fks83wq2dpg8csweamyp31roli9 FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkl05py1cdx0304xdev9697uptx FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkqokld7svnht4m6k4t9jnk81gf FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkf2m5olg8hj4awsnr9p12kjvry FOREIGN KEY (interactorageneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +ALTER TABLE ONLY association ADD CONSTRAINT fkpocxhp5klhi10d84xy8wm6yh1 FOREIGN KEY (interactorbgeneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +ALTER TABLE ONLY association ADD CONSTRAINT fkiwqrtab6l4bkwcg6ysfprr0tg FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkik71nx67sxxpfmvly6exwsf4m FOREIGN KEY (allelegeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkfdqmfjd4v0smqmu8hossg5jet FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkeclnm31mpi8i1iy07n0cm003g FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkfgso1aqthy90ltcc6pdo235p1 FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkeot29m2x4peefkgwrqmu36ub1 FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkd6l423ab6u2hfoyjaf85nxt4f FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkkbi83cmvdnis7mdsx966rvdxe FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY association ADD CONSTRAINT fkfk71crh2hl7wuwpmrwvcybnq3 FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); + From eb61cda3e5e5d8785d85a7aefbcdf7be31de0616 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 10 Sep 2024 15:05:19 -0600 Subject: [PATCH 226/342] Updated migration file --- .../v0.37.0.49__flatten_assocations.sql | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql index 791fe6677..7c1bcba14 100644 --- a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql @@ -46,11 +46,6 @@ CREATE TABLE association_vocabularyterm ( diseasequalifiers_id bigint NOT NULL ); -CREATE TABLE association_phenotypesortraits ( - genegeneticinteraction_id bigint, - phenotypesortraits character varying(255) -); - ALTER TABLE association ADD COLUMN curie character varying(255), ADD COLUMN modentityid character varying(255), @@ -274,10 +269,8 @@ UPDATE association a SET interactorbgeneticperturbation_id = b.interactorbgeneticperturbation_id FROM GeneGeneticInteraction b WHERE a.id = b.id; -INSERT INTO association_phenotypesortraits (genegeneticinteraction_id, phenotypesortraits) - SELECT genegeneticinteraction_id, phenotypesortraits FROM genegeneticinteraction_phenotypesortraits; - -DROP TABLE genegeneticinteraction_phenotypesortraits; +-- association_phenotypesortraits +DROP CONSTRAINT genegeneticinteraction_phenotypesortraits_genegeneticinteractio; DROP TABLE GeneGeneticInteraction; @@ -475,10 +468,6 @@ CREATE INDEX association_phenotypeannotation_phenotypeterms_index ON association CREATE INDEX association_diseaseannotation_vt_diseaseannotation_index ON association_vocabularyterm USING btree (diseaseannotation_id); CREATE INDEX association_diseaseannotation_diseasequalifiers_index ON association_vocabularyterm USING btree (diseasequalifiers_id); --- association_phenotypesortraits -CREATE INDEX association_genegeneticinteraction_phenotypesortraits_index ON association_phenotypesortraits USING btree (genegeneticinteraction_id); - - -- FK's -- association_gene @@ -529,8 +518,6 @@ ALTER TABLE ONLY association_ontologyterm ADD CONSTRAINT fk9hbubr81amn71dtvm86qw ALTER TABLE ONLY association_vocabularyterm ADD CONSTRAINT fkcfijtoyigdh9b4ss8efnf3jro FOREIGN KEY (diseaseannotation_id) REFERENCES association(id); ALTER TABLE ONLY association_vocabularyterm ADD CONSTRAINT fkbf73p7v3d72e2fsni076talw4 FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); --- association_phenotypesortraits --- ALTER TABLE ONLY association_phenotypesortraits ADD CONSTRAINT fklufk1y85ki3qeo1ixbko56rol FOREIGN KEY (genegeneticinteraction_id) REFERENCES association(id); From 03953589ae27c73ffa6a803be163607326fee266 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 10 Sep 2024 16:17:01 -0600 Subject: [PATCH 227/342] Fix syntax with constraint --- .../resources/db/migration/v0.37.0.49__flatten_assocations.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql index 7c1bcba14..33a7d4981 100644 --- a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql @@ -270,7 +270,8 @@ UPDATE association a SET FROM GeneGeneticInteraction b WHERE a.id = b.id; -- association_phenotypesortraits -DROP CONSTRAINT genegeneticinteraction_phenotypesortraits_genegeneticinteractio; +ALTER TABLE genegeneticinteraction_phenotypesortraits + DROP CONSTRAINT genegeneticinteraction_phenotypesortraits_genegeneticinteractio; DROP TABLE GeneGeneticInteraction; From 202be7ffe92d7f22935ed6dbf36d365a677689de Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 10 Sep 2024 18:49:07 -0600 Subject: [PATCH 228/342] Added missing indexes and fixed sqtr indexes --- .../entities/SequenceTargetingReagent.java | 4 +- .../v0.37.0.49__flatten_assocations.sql | 74 ++++++++++++++++++- 2 files changed, 75 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java index 6fb8a4510..2256187be 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/SequenceTargetingReagent.java @@ -59,14 +59,14 @@ public class SequenceTargetingReagent extends GenomicEntity { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "synonyms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ElementCollection - @JoinTable(indexes = @Index(name = "sequencetargetingreagent_synonyms_sequencetargetingreagent_index", columnList = "sequencetargetingreagent_id")) + @JoinTable(indexes = @Index(name = "sqtr_synonyms_sqtr_index", columnList = "sequencetargetingreagent_id")) @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentView.class }) private List synonyms; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "secondaryIdentifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @ElementCollection - @JoinTable(indexes = @Index(name = "sequencetargetingreagent_secondaryIdentifiers_sequencetargetingreagent_index", columnList = "sequencetargetingreagent_id")) + @JoinTable(indexes = @Index(name = "sqtr_secondaryIdentifiers_sqtr_index", columnList = "sequencetargetingreagent_id")) @JsonView({ View.FieldsAndLists.class, View.SequenceTargetingReagentView.class }) private List secondaryIdentifiers; diff --git a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql index 33a7d4981..a3b0ab07b 100644 --- a/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.49__flatten_assocations.sql @@ -469,6 +469,9 @@ CREATE INDEX association_phenotypeannotation_phenotypeterms_index ON association CREATE INDEX association_diseaseannotation_vt_diseaseannotation_index ON association_vocabularyterm USING btree (diseaseannotation_id); CREATE INDEX association_diseaseannotation_diseasequalifiers_index ON association_vocabularyterm USING btree (diseasequalifiers_id); +-- genegeneticinteraction_phenotypesortraits +CREATE INDEX association_genegeneticinteraction_phenotypesortraits_index ON genegeneticinteraction_phenotypesortraits USING btree (genegeneticinteraction_id); + -- FK's -- association_gene @@ -521,7 +524,6 @@ ALTER TABLE ONLY association_vocabularyterm ADD CONSTRAINT fkbf73p7v3d72e2fsni07 - ALTER TABLE ONLY association ADD CONSTRAINT fkgobipxrs66w3ur1w1tk4sl8ac FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); ALTER TABLE ONLY association ADD CONSTRAINT fkscnsbwmhpug2to0yu6gw895oh FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); ALTER TABLE ONLY association ADD CONSTRAINT fk1sb2qk5clgbkk2976x13v5bum FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); @@ -534,6 +536,8 @@ ALTER TABLE ONLY association ADD CONSTRAINT fk9ko4u7l6641hlhpn9eeyf8toh FOREIGN -- ALTER TABLE ONLY association ADD CONSTRAINT fktgpn8b91m1qb178srwe9n8s7 FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; -- ALTER TABLE ONLY association ADD CONSTRAINT fk3bh18tfrhnab3usyc1naldwde FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY Association ADD CONSTRAINT fk5dmwn688s6ls0mjo3nhgtli2h FOREIGN KEY (phenotypeAnnotationSubject_id) REFERENCES allele(id) ON DELETE CASCADE; +-- These constraints can't be added as the field points to 3 different objects ALTER TABLE ONLY association ADD CONSTRAINT fknrw40h3f8fkk01kclygxd86h9 FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); ALTER TABLE ONLY association ADD CONSTRAINT fknx6o6bclwogm0v4rli1cdrfdv FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); @@ -558,6 +562,7 @@ ALTER TABLE ONLY association ADD CONSTRAINT fk554ce408ek9gf44f6db3w4et1 FOREIGN -- ALTER TABLE ONLY association ADD CONSTRAINT fkouxa4j6wep8rss3jviti0qibg FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; -- ALTER TABLE ONLY association ADD CONSTRAINT fk8qyy1fyhm3273j2p57alkp02t FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; -- ALTER TABLE ONLY association ADD CONSTRAINT fkksi8xjap9hliwoo4j3io09frg FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +-- These constraints can't be added as the field points to 3 different objects ALTER TABLE ONLY association ADD CONSTRAINT fkaj9ynw0e9bswh3dth646t834o FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); ALTER TABLE ONLY association ADD CONSTRAINT fkh8gqvx5c40tlw0a37uff6e9ky FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); @@ -576,4 +581,71 @@ ALTER TABLE ONLY association ADD CONSTRAINT fkeot29m2x4peefkgwrqmu36ub1 FOREIGN ALTER TABLE ONLY association ADD CONSTRAINT fkd6l423ab6u2hfoyjaf85nxt4f FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); ALTER TABLE ONLY association ADD CONSTRAINT fkkbi83cmvdnis7mdsx966rvdxe FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); ALTER TABLE ONLY association ADD CONSTRAINT fkfk71crh2hl7wuwpmrwvcybnq3 FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); + +ALTER TABLE ONLY genegeneticinteraction_phenotypesortraits ADD CONSTRAINT fklufk1y85ki3qeo1ixbko56rol FOREIGN KEY (genegeneticinteraction_id) REFERENCES association(id); + + +-- Fix sqtr long names; + +DROP INDEX sequencetargetingreagent_secondaryIdentifiers_sequencetargetingreagent_index; +DROP INDEX sequencetargetingreagent_synonyms_sequencetargetingreagent_index; + +CREATE INDEX sqtr_secondaryidentifiers_sqtr_index ON sequencetargetingreagent_secondaryidentifiers USING btree (sequencetargetingreagent_id); +CREATE INDEX sqtr_synonyms_sqtr_index ON sequencetargetingreagent_synonyms USING btree (sequencetargetingreagent_id); + +-- Missing Indexes + +CREATE INDEX biologicalentity_curie_index ON public.biologicalentity USING btree (curie); +CREATE INDEX biologicalentity_modinternalid_index ON public.biologicalentity USING btree (modinternalid); +CREATE INDEX cellularcomponentqualifiers_cellularcomponentqualifiers_index ON public.anatomicalsite_cellularcomponentqualifiers USING btree (cellularcomponentqualifiers_id); +CREATE INDEX informationcontententity_curie_index ON public.informationcontententity USING btree (curie); +CREATE INDEX ontologyterm_curie_index ON public.ontologyterm USING btree (curie); +CREATE INDEX ontologyterm_isa_ancestor_descendant_isancestors_index ON public.ontologyterm_isa_ancestor_descendant USING btree (isaancestors_id); + +-- Missing Constrains + +ALTER TABLE ONLY public.anatomicalsite ADD CONSTRAINT fk4h252bd81x75fwxgyy6wa61u7 FOREIGN KEY (anatomicalstructure_id) REFERENCES public.ontologyterm(id); +ALTER TABLE ONLY public.anatomicalsite ADD CONSTRAINT fk820ik52dv75y8yeeymw9fib0l FOREIGN KEY (anatomicalsubstructure_id) REFERENCES public.ontologyterm(id); +ALTER TABLE ONLY public.anatomicalsite ADD CONSTRAINT fka5b13b9htt6lmwtckr393w62r FOREIGN KEY (updatedby_id) REFERENCES public.person(id); +ALTER TABLE ONLY public.anatomicalsite ADD CONSTRAINT fkbwi9cqjupg87x1fjiea13swda FOREIGN KEY (createdby_id) REFERENCES public.person(id); +ALTER TABLE ONLY public.anatomicalsite ADD CONSTRAINT fkkbkvdh25o66jw9mkimtvt0fjl FOREIGN KEY (cellularcomponentterm_id) REFERENCES public.ontologyterm(id); + +ALTER TABLE ONLY public.expressionpattern ADD CONSTRAINT fkjnwc0l0tjukc7939l5aa3gylu FOREIGN KEY (updatedby_id) REFERENCES public.person(id); +ALTER TABLE ONLY public.expressionpattern ADD CONSTRAINT fksnvyfgvqvdcf49lnklncwjm0t FOREIGN KEY (createdby_id) REFERENCES public.person(id); + +ALTER TABLE ONLY public.temporalcontext ADD CONSTRAINT fkqxng45bjismw8qcc4x3met821 FOREIGN KEY (developmentalstagestart_id) REFERENCES public.ontologyterm(id); +ALTER TABLE ONLY public.temporalcontext ADD CONSTRAINT fks5wnscfpf8l2fxacvo8bdg6rp FOREIGN KEY (createdby_id) REFERENCES public.person(id); +ALTER TABLE ONLY public.temporalcontext ADD CONSTRAINT fk7saeiw0res25be1sekjkebvxp FOREIGN KEY (updatedby_id) REFERENCES public.person(id); +ALTER TABLE ONLY public.temporalcontext ADD CONSTRAINT fksrvvhoclqm33da4boc3dopmxh FOREIGN KEY (developmentalstagestop_id) REFERENCES public.ontologyterm(id); + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 12aaf2bdef6a9c78540d677ebef262ee026cd5e5 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 13 Sep 2024 13:41:16 -0500 Subject: [PATCH 229/342] SCRUM-4429 update data loads page running time --- src/main/cliapp/package-lock.json | 12 ++++++++++++ src/main/cliapp/package.json | 1 + .../dataLoadsPage/DataLoadsComponent.js | 16 ++++++++++------ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/main/cliapp/package-lock.json b/src/main/cliapp/package-lock.json index ed768ebe8..5efdf1652 100644 --- a/src/main/cliapp/package-lock.json +++ b/src/main/cliapp/package-lock.json @@ -31,6 +31,7 @@ "immer": "^9.0.15", "jose": "^4.10.0", "moment": "^2.29.1", + "moment-timezone": "^0.5.45", "primeflex": "3.1.0", "primeicons": "^5.0.0", "primereact": "^10.0.9", @@ -15355,6 +15356,17 @@ "node": "*" } }, + "node_modules/moment-timezone": { + "version": "0.5.45", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.45.tgz", + "integrity": "sha512-HIWmqA86KcmCAhnMAN0wuDOARV/525R2+lOLotuGFzn4HO+FH+/645z2wx0Dt3iDv6/p61SIvKnDstISainhLQ==", + "dependencies": { + "moment": "^2.29.4" + }, + "engines": { + "node": "*" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/src/main/cliapp/package.json b/src/main/cliapp/package.json index f7525ca55..d54b0494e 100644 --- a/src/main/cliapp/package.json +++ b/src/main/cliapp/package.json @@ -31,6 +31,7 @@ "immer": "^9.0.15", "jose": "^4.10.0", "moment": "^2.29.1", + "moment-timezone": "^0.5.45", "primeflex": "3.1.0", "primeicons": "^5.0.0", "primereact": "^10.0.9", diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 1de20b789..3f272ede0 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -20,6 +20,7 @@ import { HistoryDialog } from './HistoryDialog'; import { useQueryClient } from '@tanstack/react-query'; import { SiteContext } from '../layout/SiteContext'; import { LoadingOverlay } from '../../components/LoadingOverlay'; +import moment from 'moment-timezone'; export const DataLoadsComponent = () => { const { authState } = useOktaAuth(); @@ -279,7 +280,7 @@ export const DataLoadsComponent = () => { const loadFileActionBodyTemplate = (rowData, bulkload) => { let ret = []; - console.log(rowData); + // console.log(rowData); if ( !rowData.bulkloadStatus || rowData.bulkloadStatus === 'FINISHED' || @@ -500,10 +501,13 @@ export const DataLoadsComponent = () => { }; const durationTemplate = (rowData) => { - let started = new Date(rowData.loadStarted); - let finished = Date.UTC(); + moment.tz.setDefault('GMT'); + + let started = moment(rowData.loadStarted); + let finished = moment(Date.now()); + if (rowData.loadFinished) { - finished = new Date(rowData.loadFinished); + finished = moment(rowData.loadFinished); } return ( @@ -517,9 +521,9 @@ export const DataLoadsComponent = () => { Duration: )} - {!rowData.loadFinished && rowData.bulkloadStatus !== 'FAILED' && ( + {!rowData.loadFinished && rowData.bulkloadStatus !== 'FAILED' && rowData.bulkloadStatus !== 'STOPPED' && ( <> - Running Time: + Running Time: )} From 68dea4fd3bb2ca3430f197e6660f7a21757985ae Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 13 Sep 2024 23:46:28 +0100 Subject: [PATCH 230/342] Move gene ID to curie map generation --- .../jobs/executors/gff/Gff3CDSExecutor.java | 6 ++-- .../jobs/executors/gff/Gff3ExonExecutor.java | 6 ++-- .../executors/gff/Gff3TranscriptExecutor.java | 11 +++---- .../curation_api/services/Gff3Service.java | 23 ++++++++------- .../helpers/gff3/Gff3AttributesHelper.java | 29 +++++++++++-------- 5 files changed, 40 insertions(+), 35 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java index 81fb9c26a..a8466063d 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3CDSExecutor.java @@ -100,8 +100,6 @@ private boolean runLoad( List associationIdsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF CDS update for " + dataProvider.name(), gffData.size()); @@ -129,7 +127,7 @@ private boolean runLoad( if (assemblyId != null) { countType = "Locations"; try { - gff3Service.loadCDSLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadCDSLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -142,7 +140,7 @@ private boolean runLoad( } countType = "Associations"; try { - gff3Service.loadCDSParentChildAssociations(gff3EntryPair, associationIdsAdded, dataProvider, geneIdCurieMap); + gff3Service.loadCDSParentChildAssociations(gff3EntryPair, associationIdsAdded, dataProvider); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java index ee613ebd7..74454531e 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3ExonExecutor.java @@ -100,8 +100,6 @@ private boolean runLoad( List associationIdsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Exon update for " + dataProvider.name(), gffData.size()); @@ -131,7 +129,7 @@ private boolean runLoad( if (assemblyId != null) { countType = "Locations"; try { - gff3Service.loadExonLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadExonLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -145,7 +143,7 @@ private boolean runLoad( countType = "Associations"; try { - gff3Service.loadExonParentChildAssociations(gff3EntryPair, associationIdsAdded, dataProvider, geneIdCurieMap); + gff3Service.loadExonParentChildAssociations(gff3EntryPair, associationIdsAdded, dataProvider); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java index 4f27aaa3f..d08d391d9 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/gff/Gff3TranscriptExecutor.java @@ -60,6 +60,7 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fmsLoad.getFmsDataSubType()); List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); + Map geneIdCurieMap = gff3Service.getGeneIdCurieMap(gffData, dataProvider); gffData.clear(); @@ -73,7 +74,7 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { addException(bulkLoadFileHistory, new ObjectUpdateExceptionData(null, "GFF Header does not contain assembly", null)); } - boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, entityIdsAdded, locationIdsAdded, associationIdsAdded, dataProvider, assemblyId); + boolean success = runLoad(bulkLoadFileHistory, gffHeaderData, preProcessedTranscriptGffData, geneIdCurieMap, entityIdsAdded, locationIdsAdded, associationIdsAdded, dataProvider, assemblyId); if (success) { runCleanup(transcriptService, bulkLoadFileHistory, dataProvider.name(), transcriptService.getIdsByDataProvider(dataProvider), entityIdsAdded, "GFF transcript"); @@ -93,14 +94,13 @@ private boolean runLoad( BulkLoadFileHistory history, List gffHeaderData, List>> gffData, + Map geneIdCurieMap, List entityIdsAdded, List locationIdsAdded, List associationIdsAdded, BackendBulkDataProvider dataProvider, String assemblyId) { - Map geneIdCurieMap = gff3Service.getIdCurieMap(gffData); - ProcessDisplayHelper ph = new ProcessDisplayHelper(); ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess("GFF Transcript update for " + dataProvider.name(), gffData.size()); @@ -128,7 +128,7 @@ private boolean runLoad( if (assemblyId != null) { countType = "Locations"; try { - gff3Service.loadTranscriptLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId, geneIdCurieMap); + gff3Service.loadTranscriptLocationAssociations(gff3EntryPair, locationIdsAdded, dataProvider, assemblyId); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -162,9 +162,10 @@ public APIResponse runLoadApi(String dataProviderName, String assemblyName, List List idsAdded = new ArrayList<>(); BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); List>> preProcessedTranscriptGffData = Gff3AttributesHelper.getTranscriptGffData(gffData, dataProvider); + Map geneIdCurieMap = gff3Service.getGeneIdCurieMap(gffData, dataProvider); BulkLoadFileHistory history = new BulkLoadFileHistory(); history = bulkLoadFileHistoryDAO.persist(history); - runLoad(history, null, preProcessedTranscriptGffData, idsAdded, idsAdded, idsAdded, dataProvider, assemblyName); + runLoad(history, null, preProcessedTranscriptGffData, geneIdCurieMap, idsAdded, idsAdded, idsAdded, dataProvider, assemblyName); history.finishLoad(); return new LoadHistoryResponce(history); 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 35d51a418..4b41cfec2 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java +++ b/src/main/java/org/alliancegenome/curation_api/services/Gff3Service.java @@ -30,6 +30,7 @@ import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptExonAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGeneAssociationService; import org.alliancegenome.curation_api.services.associations.transcriptAssociations.TranscriptGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.helpers.gff3.Gff3UniqueIdHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; @@ -58,7 +59,7 @@ public class Gff3Service { @Inject Gff3DtoValidator gff3DtoValidator; @Transactional - public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { + public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); if (StringUtils.isBlank(assemblyId)) { @@ -85,7 +86,7 @@ public void loadExonLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { + public void loadCDSLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); if (StringUtils.isBlank(assemblyId)) { @@ -112,7 +113,7 @@ public void loadCDSLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, String assemblyId, Map geneIdCurieMap) throws ValidationException { + 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)) { @@ -140,7 +141,7 @@ public void loadTranscriptLocationAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ValidationException { + public void loadExonParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); if (!StringUtils.equals(gffEntry.getType(), "exon") && !StringUtils.equals(gffEntry.getType(), "noncoding_exon")) { @@ -164,7 +165,7 @@ public void loadExonParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider, Map geneIdCurieMap) throws ValidationException { + public void loadCDSParentChildAssociations(ImmutablePair> gffEntryPair, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { Gff3DTO gffEntry = gffEntryPair.getKey(); Map attributes = gffEntryPair.getValue(); @@ -211,13 +212,15 @@ public void loadGeneParentChildAssociations(ImmutablePair getIdCurieMap(List>> gffData) { + public Map getGeneIdCurieMap(List gffData, BackendBulkDataProvider dataProvider) { Map geneIdCurieMap = new HashMap<>(); - for (ImmutablePair> gffEntryPair : gffData) { - Map attributes = gffEntryPair.getValue(); - if (attributes.containsKey("ID") && attributes.containsKey("gene_id")) { - geneIdCurieMap.put(attributes.get("ID"), attributes.get("gene_id")); + for (Gff3DTO gffEntry : gffData) { + if (gffEntry.getType().contains("gene")) { + 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/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index 2f2c0f51b..4626cd555 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -101,21 +101,26 @@ public static List>> getTranscriptGff private static void processGffEntry(Gff3DTO originalGffEntry, List>> retGffData, BackendBulkDataProvider dataProvider) { Map attributes = getAttributes(originalGffEntry, dataProvider); - if (attributes.containsKey("Parent") && attributes.get("Parent").indexOf(",") > -1) { - for (String parent : attributes.get("Parent").split(",")) { - HashMap attributesCopy = new HashMap<>(); - attributesCopy.putAll(attributes); - String[] parentIdParts = parent.split(":"); - if (parentIdParts.length == 1) { - parent = dataProvider.name() + ':' + parentIdParts[0]; + if (attributes.containsKey("Parent")) { + if (attributes.get("Parent").indexOf(",") > -1) { + for (String parent : attributes.get("Parent").split(",")) { + if (!parent.endsWith("_transposable_element")) { + HashMap attributesCopy = new HashMap<>(); + attributesCopy.putAll(attributes); + String[] parentIdParts = parent.split(":"); + if (parentIdParts.length == 1) { + parent = dataProvider.name() + ':' + parentIdParts[0]; + } + attributesCopy.put("Parent", parent); + retGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); + } + } + } else { + if (attributes.get("Parent").endsWith("_transposable_element")) { + retGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); } - attributesCopy.put("Parent", parent); - retGffData.add(new ImmutablePair<>(originalGffEntry, attributesCopy)); } - } else { - retGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); } - } } From 0885670cb1b59d2c69d2dcacfb1ae26916c6beac Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 13 Sep 2024 23:50:11 +0100 Subject: [PATCH 231/342] Fix boolean logic --- .../services/helpers/gff3/Gff3AttributesHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index 4626cd555..d6d3b9bd1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -116,7 +116,7 @@ private static void processGffEntry(Gff3DTO originalGffEntry, List(originalGffEntry, attributes)); } } From 8c3a5c3442b5e139a2ca6aafe7da6730954fcd63 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Sat, 14 Sep 2024 00:05:31 +0100 Subject: [PATCH 232/342] Return lines without parents for validation --- .../services/helpers/gff3/Gff3AttributesHelper.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java index d6d3b9bd1..7d5872df1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/gff3/Gff3AttributesHelper.java @@ -120,6 +120,8 @@ private static void processGffEntry(Gff3DTO originalGffEntry, List(originalGffEntry, attributes)); } } + } else { + retGffData.add(new ImmutablePair<>(originalGffEntry, attributes)); } } From 18dc4b09a6e41b4b639c45e5925e1c70c2894965 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 16 Sep 2024 10:37:31 -0400 Subject: [PATCH 233/342] removed dropAndCreateSchemaOnStart --- .../org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 50869c7d4..2ba138ce1 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -359,7 +359,7 @@ public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSiz ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); ph.addDisplayHandler(indexProcessDisplayService); ph.startProcess("Mass Index Everything"); - MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) + MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) .monitor(new MassIndexingMonitor() { @Override public void documentsAdded(long increment) { @@ -394,7 +394,7 @@ public void indexingCompleted() { public void reindex(Class objectClass, Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout, Integer typesToIndexInParallel) { Log.debug("Starting Indexing for: " + objectClass); - MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) + MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) .monitor(new MassIndexingMonitor() { ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); From 055ee002c90368c319fc5791a21bfad5c6901459 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 16 Sep 2024 15:58:32 -0400 Subject: [PATCH 234/342] Change in BaseSQLDAO --- .../org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 2ba138ce1..859bc1410 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -480,9 +480,10 @@ public SearchResponse searchByParams(Pagination pagination, Map clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { clause.should(p.match().field(field + "_keyword").matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost + 500)); + } else { + clause.should(p.match().field(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost)); + q.should(clause); } - clause.should(p.match().field(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost)); - q.should(clause); } else { // assume simple query BooleanPredicateClausesStep clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { From bbc7f2995818c5e1417216767b8f19c88963c71c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 16 Sep 2024 17:07:08 -0400 Subject: [PATCH 235/342] Changes to BaseSqlDAO --- .../alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 859bc1410..c328c48c0 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -480,16 +480,17 @@ public SearchResponse searchByParams(Pagination pagination, Map clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { clause.should(p.match().field(field + "_keyword").matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost + 500)); - } else { + } else { clause.should(p.match().field(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost)); - q.should(clause); } + q.should(clause); } else { // assume simple query BooleanPredicateClausesStep clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { clause.should(p.simpleQueryString().fields(field + "_keyword").matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost + 500)); + } else { + clause.should(p.simpleQueryString().fields(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost)); } - clause.should(p.simpleQueryString().fields(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost)); q.should(clause); } innerBoost--; From 15f2ec575e8de5013efe6c9b0d13c0d56f70c048 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 17 Sep 2024 08:49:21 -0400 Subject: [PATCH 236/342] Checkstyle fix --- .../org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index c328c48c0..439da2247 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -480,7 +480,7 @@ public SearchResponse searchByParams(Pagination pagination, Map clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { clause.should(p.match().field(field + "_keyword").matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost + 500)); - } else { + } else { clause.should(p.match().field(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).boost(boost)); } q.should(clause); From 9dc070f1fe20a6c35be0a1404abd5e8ae3aa9eb4 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 17 Sep 2024 08:59:52 -0400 Subject: [PATCH 237/342] Revert "removed dropAndCreateSchemaOnStart" This reverts commit 18dc4b09a6e41b4b639c45e5925e1c70c2894965. --- .../org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 2ba138ce1..50869c7d4 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -359,7 +359,7 @@ public void reindexEverything(Integer batchSizeToLoadObjects, Integer idFetchSiz ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); ph.addDisplayHandler(indexProcessDisplayService); ph.startProcess("Mass Index Everything"); - MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) + MassIndexer indexer = searchSession.massIndexer(annotatedClasses).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) .monitor(new MassIndexingMonitor() { @Override public void documentsAdded(long increment) { @@ -394,7 +394,7 @@ public void indexingCompleted() { public void reindex(Class objectClass, Integer batchSizeToLoadObjects, Integer idFetchSize, Integer limitIndexedObjectsTo, Integer threadsToLoadObjects, Integer transactionTimeout, Integer typesToIndexInParallel) { Log.debug("Starting Indexing for: " + objectClass); - MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) + MassIndexer indexer = searchSession.massIndexer(objectClass).batchSizeToLoadObjects(batchSizeToLoadObjects).idFetchSize(idFetchSize).dropAndCreateSchemaOnStart(true).mergeSegmentsOnFinish(false).typesToIndexInParallel(typesToIndexInParallel).threadsToLoadObjects(threadsToLoadObjects) .monitor(new MassIndexingMonitor() { ProcessDisplayHelper ph = new ProcessDisplayHelper(5000); From 2faef719b7c280786711053f3c65a74fc01ea16c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 17 Sep 2024 12:18:13 -0400 Subject: [PATCH 238/342] Changes in BaseSQLDAO --- .../org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 3c53d2bbb..79a286977 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -488,9 +488,8 @@ public SearchResponse searchByParams(Pagination pagination, Map clause = p.bool(); if (useKeywordFields != null && useKeywordFields) { clause.should(p.simpleQueryString().fields(field + "_keyword").matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost + 500)); - } else { - clause.should(p.simpleQueryString().fields(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost)); } + clause.should(p.simpleQueryString().fields(field).matching(searchFilters.get(filterName).get(field).get("queryString").toString()).defaultOperator(booleanOperator).boost(boost)); q.should(clause); } innerBoost--; From edece552ad0966e5fd73f9a4a820d93cf21a239a Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 19 Sep 2024 16:52:47 +0200 Subject: [PATCH 239/342] SCRUM-4436 improve construct association load performance (#1666) * SCRUM-4436 improve construct association load performance * fix code style suggestions * SCRUM-4436 more code check style fixes * change ApplicationScoped to RequestScoped * move caching of id-modID map from dao to service level * cleanup code --- .../curation_api/dao/ConstructDAO.java | 23 ++++++- .../curation_api/dao/GenomicEntityDAO.java | 21 +++++- .../curation_api/dao/base/BaseSQLDAO.java | 52 +++++++-------- .../services/ConstructService.java | 64 +++++++++++++------ .../services/GenomicEntityService.java | 28 ++++++-- ...structGenomicEntityAssociationService.java | 5 -- ...tGenomicEntityAssociationDTOValidator.java | 9 ++- 7 files changed, 137 insertions(+), 65 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/ConstructDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/ConstructDAO.java index 05ab89cbc..1d588c9ee 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/ConstructDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/ConstructDAO.java @@ -1,15 +1,34 @@ 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.Construct; -import jakarta.enterprise.context.ApplicationScoped; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @ApplicationScoped public class ConstructDAO extends BaseSQLDAO { - + protected ConstructDAO() { super(Construct.class); } + public Map getConstructIdMap() { + Map constructIdMap = new HashMap<>(); + Query q = entityManager.createNativeQuery("SELECT a.id, a.modEntityId, a.modInternalId FROM Reagent as a where exists (select * from construct as g where g.id = a.id)"); + List ids = q.getResultList(); + ids.forEach(record -> { + if (record[1] != null) { + constructIdMap.put((String) record[1], (long) record[0]); + } + if (record[2] != null) { + constructIdMap.put((String) record[2], (long) record[0]); + } + }); + return constructIdMap; + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GenomicEntityDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GenomicEntityDAO.java index 575b00d34..bc6d184da 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/GenomicEntityDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/GenomicEntityDAO.java @@ -1,9 +1,13 @@ 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.GenomicEntity; -import jakarta.enterprise.context.ApplicationScoped; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @ApplicationScoped public class GenomicEntityDAO extends BaseSQLDAO { @@ -12,4 +16,19 @@ protected GenomicEntityDAO() { super(GenomicEntity.class); } + public Map getGenomicEntityIdMap() { + Map genomicEntityIdMap = new HashMap<>(); + Query q = entityManager.createNativeQuery("SELECT a.id, a.modEntityId, a.modInternalId FROM BiologicalEntity as a where exists (select * from genomicentity as g where g.id = a.id)"); + List ids = q.getResultList(); + ids.forEach(record -> { + if (record[1] != null) { + genomicEntityIdMap.put((String) record[1], (long) record[0]); + } + if (record[2] != null) { + genomicEntityIdMap.put((String) record[2], (long) record[0]); + } + }); + return genomicEntityIdMap; + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java index 79a286977..3432ef373 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/base/BaseSQLDAO.java @@ -1,15 +1,14 @@ package org.alliancegenome.curation_api.dao.base; -import static org.reflections.scanners.Scanners.TypesAnnotated; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; - +import io.quarkus.logging.Log; +import jakarta.inject.Inject; +import jakarta.persistence.EntityManager; +import jakarta.persistence.PersistenceException; +import jakarta.persistence.TypedQuery; +import jakarta.persistence.criteria.*; +import jakarta.persistence.metamodel.IdentifiableType; +import jakarta.persistence.metamodel.Metamodel; +import jakarta.transaction.Transactional; import org.alliancegenome.curation_api.exceptions.ApiErrorException; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.input.Pagination; @@ -39,27 +38,20 @@ import org.jboss.logging.Logger.Level; import org.reflections.Reflections; -import io.quarkus.logging.Log; -import jakarta.inject.Inject; -import jakarta.persistence.EntityManager; -import jakarta.persistence.PersistenceException; -import jakarta.persistence.TypedQuery; -import jakarta.persistence.criteria.CriteriaBuilder; -import jakarta.persistence.criteria.CriteriaQuery; -import jakarta.persistence.criteria.Join; -import jakarta.persistence.criteria.JoinType; -import jakarta.persistence.criteria.Path; -import jakarta.persistence.criteria.Predicate; -import jakarta.persistence.criteria.Root; -import jakarta.persistence.metamodel.IdentifiableType; -import jakarta.persistence.metamodel.Metamodel; -import jakarta.transaction.Transactional; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +import static org.reflections.scanners.Scanners.TypesAnnotated; public class BaseSQLDAO extends BaseEntityDAO { - @Inject protected EntityManager entityManager; - @Inject protected SearchSession searchSession; - @Inject protected IndexProcessDisplayService indexProcessDisplayService; + @Inject + protected EntityManager entityManager; + @Inject + protected SearchSession searchSession; + @Inject + protected IndexProcessDisplayService indexProcessDisplayService; protected BaseSQLDAO(Class myClass) { super(myClass); @@ -719,4 +711,8 @@ public E getNewInstance() { return null; } + public E getShallowEntity(Class entityClass, long id) { + return entityManager.getReference(entityClass, id); + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java b/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java index 28a6c076b..5b7dbd368 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ConstructService.java @@ -1,11 +1,10 @@ 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 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.slotAnnotations.constructSlotAnnotations.ConstructComponentSlotAnnotationDAO; @@ -23,22 +22,29 @@ import org.alliancegenome.curation_api.services.validation.dto.ConstructDTOValidator; import org.apache.commons.collections.CollectionUtils; -import io.quarkus.logging.Log; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; -import jakarta.transaction.Transactional; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; @RequestScoped public class ConstructService extends SubmittedObjectCrudService { - @Inject ConstructDAO constructDAO; - @Inject ConstructValidator constructValidator; - @Inject ConstructDTOValidator constructDtoValidator; - @Inject ConstructService constructService; - @Inject PersonService personService; - @Inject ConstructComponentSlotAnnotationDAO constructComponentDAO; - @Inject ConstructGenomicEntityAssociationService constructGenomicEntityAssociationService; + @Inject + ConstructDAO constructDAO; + @Inject + ConstructValidator constructValidator; + @Inject + ConstructDTOValidator constructDtoValidator; + @Inject + ConstructService constructService; + @Inject + PersonService personService; + @Inject + ConstructComponentSlotAnnotationDAO constructComponentDAO; + @Inject + ConstructGenomicEntityAssociationService constructGenomicEntityAssociationService; @Override @PostConstruct @@ -55,7 +61,7 @@ public ObjectResponse getByIdentifier(String identifier) { construct = response.getSingleResult(); } } - return new ObjectResponse(construct); + return new ObjectResponse<>(construct); } @Override @@ -91,7 +97,7 @@ public ObjectResponse deleteById(Long id) { @Transactional public Construct deprecateOrDelete(Long id, Boolean throwApiError, String requestSource, Boolean forceDeprecate) { Construct construct = constructDAO.find(id); - + if (construct != null) { if (forceDeprecate || CollectionUtils.isNotEmpty(construct.getConstructGenomicEntityAssociations())) { if (!construct.getObsolete()) { @@ -125,4 +131,22 @@ public List getConstructIdsByDataProvider(BackendBulkDataProvider dataProv return constructIds; } + + public Map getConstructIdMap() { + if (constructIdMap.size() > 0) { + return constructIdMap; + } + constructIdMap = constructDAO.getConstructIdMap(); + return constructIdMap; + } + + private Map constructIdMap = new HashMap<>(); + + public Long getIdByModID(String modID) { + return getConstructIdMap().get(modID); + } + + public Construct getShallowEntity(Long id) { + return constructDAO.getShallowEntity(Construct.class, id); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java b/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java index b1a21dfd0..a0887dca4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GenomicEntityService.java @@ -1,5 +1,8 @@ package org.alliancegenome.curation_api.services; +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; import org.alliancegenome.curation_api.dao.GenomicEntityDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ValidationException; @@ -7,14 +10,14 @@ import org.alliancegenome.curation_api.model.ingest.dto.GenomicEntityDTO; import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.util.HashMap; +import java.util.Map; @RequestScoped public class GenomicEntityService extends SubmittedObjectCrudService { - @Inject GenomicEntityDAO genomicEntityDAO; + @Inject + GenomicEntityDAO genomicEntityDAO; @Override @PostConstruct @@ -37,4 +40,21 @@ public GenomicEntity deprecateOrDelete(Long id, Boolean throwApiError, String re return null; } + public Map getGenomicEntityIdMap() { + if (genomicEntityIdMap.size() > 0) { + return genomicEntityIdMap; + } + genomicEntityIdMap = genomicEntityDAO.getGenomicEntityIdMap(); + return genomicEntityIdMap; + } + + private Map genomicEntityIdMap = new HashMap<>(); + + public Long getIdByModID(String modID) { + return getGenomicEntityIdMap().get(modID); + } + + public GenomicEntity getShallowEntity(Long id) { + return genomicEntityDAO.getShallowEntity(GenomicEntity.class, id); + } } 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 338ad13fa..7a0098d77 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 @@ -72,11 +72,6 @@ public ObjectResponse validate(ConstructGenom @Transactional public ConstructGenomicEntityAssociation upsert(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider dataProvider) throws ValidationException { ConstructGenomicEntityAssociation association = constructGenomicEntityAssociationDtoValidator.validateConstructGenomicEntityAssociationDTO(dto, dataProvider); - if (association != null) { - addAssociationToConstruct(association); - addAssociationToGenomicEntity(association); - } - return association; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java index 457631890..62f269466 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/constructAssociations/ConstructGenomicEntityAssociationDTOValidator.java @@ -43,15 +43,14 @@ public class ConstructGenomicEntityAssociationDTOValidator extends EvidenceAssoc public ConstructGenomicEntityAssociation validateConstructGenomicEntityAssociationDTO(ConstructGenomicEntityAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ValidationException { - assocResponse = new ObjectResponse(); + assocResponse = new ObjectResponse<>(); Construct construct = null; if (StringUtils.isNotBlank(dto.getConstructIdentifier())) { - ObjectResponse constructResponse = constructService.getByIdentifier(dto.getConstructIdentifier()); - if (constructResponse == null || constructResponse.getEntity() == null) { + construct = constructService.getShallowEntity(constructService.getIdByModID(dto.getConstructIdentifier())); + if (construct == null) { assocResponse.addErrorMessage("construct_identifier", ValidationConstants.INVALID_MESSAGE); } else { - construct = constructResponse.getEntity(); if (beDataProvider != null && !construct.getDataProvider().getSourceOrganization().getAbbreviation().equals(beDataProvider.sourceOrganization)) { assocResponse.addErrorMessage("construct_identifier", ValidationConstants.INVALID_MESSAGE + " for " + beDataProvider.name() + " load"); } @@ -64,7 +63,7 @@ public ConstructGenomicEntityAssociation validateConstructGenomicEntityAssociati if (StringUtils.isBlank(dto.getGenomicEntityIdentifier())) { assocResponse.addErrorMessage("genomic_entity_identifier", ValidationConstants.REQUIRED_MESSAGE); } else { - genomicEntity = genomicEntityService.findByIdentifierString(dto.getGenomicEntityIdentifier()); + genomicEntity = genomicEntityService.getShallowEntity(genomicEntityService.getIdByModID(dto.getGenomicEntityIdentifier())); if (genomicEntity == null) { assocResponse.addErrorMessage("genomic_entity_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getGenomicEntityIdentifier() + ")"); } From 023f56d0ddb96c7c68dfeb081c2d00e4848e6288 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Thu, 12 Sep 2024 11:30:56 +0100 Subject: [PATCH 240/342] SCRUM-3952: change vocabularyterm to ontologyterm after LinkML change --- .../model/entities/AnatomicalSite.java | 9 +- ...neExpressionAnnotationFmsDTOValidator.java | 50 +- .../v0.37.0.50__change_expression_model.sql | 1530 +++++++++++++++++ 3 files changed, 1553 insertions(+), 36 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.50__change_expression_model.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 469969cd5..19a5163dc 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -11,6 +11,7 @@ import org.alliancegenome.curation_api.model.entities.base.AuditedObject; import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.OntologyTerm; import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -55,7 +56,7 @@ public class AnatomicalSite extends AuditedObject { @ManyToOne @JsonView({View.FieldsOnly.class}) private GOTerm cellularComponentTerm; - + //celullar compoent ribbon -- slim @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @@ -79,7 +80,7 @@ public class AnatomicalSite extends AuditedObject { @Index(name = "anatomicalstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), @Index(name = "anatomicalstructurequalifiers_structurequalifiers_index", columnList = "anatomicalstructurequalifiers_id")} ) - private List anatomicalStructureQualifiers; + private List anatomicalStructureQualifiers; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalsubstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @@ -91,7 +92,7 @@ public class AnatomicalSite extends AuditedObject { @Index(name = "anatomicalsubstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), @Index(name = "anatomicalsubstructurequalifiers_qualifiers_index", columnList = "anatomicalsubstructurequalifiers_id")} ) - private List anatomicalSubstructureQualifiers; + private List anatomicalSubstructureQualifiers; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "cellularcomponentqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @@ -103,7 +104,7 @@ public class AnatomicalSite extends AuditedObject { @Index(name = "cellularcomponentqualifiers_anatomicalsite_index", columnList = "anatomicalsite_id"), @Index(name = "cellularcomponentqualifiers_cellularcomponentqualifiers_index", columnList = "cellularcomponentqualifiers_id")} ) - private List cellularComponentQualifiers; + private List cellularComponentQualifiers; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "anatomicalstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index ac2316284..c5354fcdb 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -1,28 +1,15 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; -import java.time.OffsetDateTime; -import java.time.format.DateTimeParseException; -import java.util.ArrayList; -import java.util.List; - +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.GeneExpressionAnnotationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; -import org.alliancegenome.curation_api.model.entities.AnatomicalSite; -import org.alliancegenome.curation_api.model.entities.ExpressionPattern; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.GeneExpressionAnnotation; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.TemporalContext; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; -import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; -import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; -import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; +import org.alliancegenome.curation_api.model.entities.*; +import org.alliancegenome.curation_api.model.entities.ontology.*; import org.alliancegenome.curation_api.model.ingest.dto.fms.GeneExpressionFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.UberonSlimTermDTO; import org.alliancegenome.curation_api.response.ObjectResponse; @@ -32,16 +19,14 @@ import org.alliancegenome.curation_api.services.ReferenceService; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.annotations.GeneExpressionAnnotationUniqueIdHelper; -import org.alliancegenome.curation_api.services.ontology.AnatomicalTermService; -import org.alliancegenome.curation_api.services.ontology.GoTermService; -import org.alliancegenome.curation_api.services.ontology.MmoTermService; -import org.alliancegenome.curation_api.services.ontology.StageTermService; -import org.alliancegenome.curation_api.services.ontology.UberonTermService; +import org.alliancegenome.curation_api.services.ontology.*; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.ObjectUtils; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; +import java.time.OffsetDateTime; +import java.time.format.DateTimeParseException; +import java.util.ArrayList; +import java.util.List; @RequestScoped public class GeneExpressionAnnotationFmsDTOValidator { @@ -57,6 +42,7 @@ public class GeneExpressionAnnotationFmsDTOValidator { @Inject GoTermService goTermService; @Inject UberonTermService uberonTermService; @Inject StageTermService stageTermService; + @Inject OntologyTermService ontologyTermService; public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpressionFmsDTO, BackendBulkDataProvider dataProvider) throws ValidationException { ObjectResponse response = new ObjectResponse<>(); @@ -118,7 +104,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse anatomicalSiteObjectResponse = validateAnatomicalSite(geneExpressionFmsDTO); if (anatomicalSiteObjectResponse.hasErrors()) { - response.addErrorMessage("whereExpressed", anatomicalSiteObjectResponse.errorMessagesString()); + response.addErrorMessage("expressionPattern", anatomicalSiteObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhereExpressedStatement(geneExpressionFmsDTO.getWhereExpressed().getWhereExpressedStatement()); AnatomicalSite anatomicalSite = updateAnatomicalSite(anatomicalSiteObjectResponse, geneExpressionAnnotation); @@ -127,7 +113,7 @@ public GeneExpressionAnnotation validateAnnotation(GeneExpressionFmsDTO geneExpr ObjectResponse temporalContextObjectResponse = validateTemporalContext(geneExpressionFmsDTO); if (temporalContextObjectResponse.hasErrors()) { - response.addErrorMessage("whenExpressed", temporalContextObjectResponse.errorMessagesString()); + response.addErrorMessage("expressionPattern", temporalContextObjectResponse.errorMessagesString()); } else { geneExpressionAnnotation.setWhenExpressedStageName(geneExpressionFmsDTO.getWhenExpressed().getStageName()); TemporalContext temporalContext = updateTemporalContext(temporalContextObjectResponse, geneExpressionAnnotation); @@ -238,9 +224,9 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId())) { String anatomicalstructurequalifiertermId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId(); - VocabularyTerm anatomicalStructureQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS, anatomicalstructurequalifiertermId).getEntity(); + OntologyTerm anatomicalStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalstructurequalifiertermId); if (anatomicalStructureQualifierTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureTermId() + ")"); + response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalstructurequalifiertermId + ")"); } else { anatomicalSite.setAnatomicalStructureQualifiers(List.of(anatomicalStructureQualifierTerm)); } @@ -248,9 +234,9 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId())) { String anatomicalsubstructurequalifierId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId(); - VocabularyTerm anatomicalSubStructureQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS, anatomicalsubstructurequalifierId).getEntity(); + OntologyTerm anatomicalSubStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalsubstructurequalifierId); if (anatomicalSubStructureQualifierTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureTermId() + ")"); + response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalsubstructurequalifierId + ")"); } else { anatomicalSite.setAnatomicalSubstructureQualifiers(List.of(anatomicalSubStructureQualifierTerm)); } @@ -258,9 +244,9 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId())) { String cellularComponentQualifierTermId = geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId(); - VocabularyTerm cellularComponentQualifierTerm = vocabularyTermService.getTermInVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS, cellularComponentQualifierTermId).getEntity(); + OntologyTerm cellularComponentQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(cellularComponentQualifierTermId); if (cellularComponentQualifierTerm == null) { - response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId() + ")"); + response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + cellularComponentQualifierTermId + ")"); } else { anatomicalSite.setCellularComponentQualifiers(List.of(cellularComponentQualifierTerm)); } diff --git a/src/main/resources/db/migration/v0.37.0.50__change_expression_model.sql b/src/main/resources/db/migration/v0.37.0.50__change_expression_model.sql new file mode 100644 index 000000000..f2d31a43d --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.50__change_expression_model.sql @@ -0,0 +1,1530 @@ +DROP TABLE anatomicalsite_anatomicalstructurequalifiers; +DROP TABLE anatomicalsite_anatomicalsubstructurequalifiers; +DROP TABLE anatomicalsite_cellularcomponentqualifiers; + +CREATE TABLE anatomicalsite_anatomicalstructurequalifiers ( + anatomicalsite_id BIGINT, + anatomicalstructurequalifiers_id BIGINT +); + +CREATE TABLE anatomicalsite_anatomicalsubstructurequalifiers ( + anatomicalsite_id BIGINT, + anatomicalsubstructurequalifiers_id BIGINT +); + +CREATE TABLE anatomicalsite_cellularcomponentqualifiers ( + anatomicalsite_id BIGINT, + cellularcomponentqualifiers_id BIGINT +); + +ALTER TABLE anatomicalsite_anatomicalstructurequalifiers + ADD CONSTRAINT anatomicalstructurequalifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +ALTER TABLE anatomicalsite_anatomicalstructurequalifiers + ADD CONSTRAINT anatomicalstructurequalifiers_structurequalifier_fk + FOREIGN KEY (anatomicalstructurequalifiers_id) REFERENCES ontologyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers + ADD CONSTRAINT anatomicalsubstructurequalifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +ALTER TABLE anatomicalsite_anatomicalsubstructurequalifiers + ADD CONSTRAINT anatomicalsubstructurequalifiers_qualifier_fk + FOREIGN KEY (anatomicalsubstructurequalifiers_id) REFERENCES ontologyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +ALTER TABLE anatomicalsite_cellularcomponentqualifiers + ADD CONSTRAINT cellularcomponentqualifiers_anatomicalsite_fk + FOREIGN KEY (anatomicalsite_id) REFERENCES anatomicalsite(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +ALTER TABLE anatomicalsite_cellularcomponentqualifiers + ADD CONSTRAINT cellularcomponentqualifiers_cellularcomponentqualifier_fk + FOREIGN KEY (cellularcomponentqualifiers_id) REFERENCES ontologyterm(id) MATCH SIMPLE ON UPDATE NO ACTION ON DELETE NO ACTION; + +CREATE INDEX anatomicalstructurequalifiers_anatomicalsite_index ON anatomicalsite_anatomicalstructurequalifiers USING btree (anatomicalsite_id); +CREATE INDEX anatomicalstructurequalifiers_structurequalifiers_index ON anatomicalsite_anatomicalstructurequalifiers USING btree (anatomicalstructurequalifiers_id); +CREATE INDEX anatomicalsubstructurequalifiers_anatomicalsite_index ON anatomicalsite_anatomicalsubstructurequalifiers USING btree (anatomicalsite_id); +CREATE INDEX anatomicalsubstructurequalifiers_qualifiers_index ON anatomicalsite_anatomicalsubstructurequalifiers USING btree (anatomicalsubstructurequalifiers_id); +CREATE INDEX cellularcomponentqualifiers_anatomicalsite_index ON anatomicalsite_cellularcomponentqualifiers USING btree (anatomicalsite_id); +CREATE INDEX cellularcomponentqualifiers_qualifiers_index ON anatomicalsite_cellularcomponentqualifiers USING btree (cellularcomponentqualifiers_id); + +DELETE FROM vocabularyterm WHERE vocabulary_id = (SELECT id FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'); +DELETE FROM vocabulary WHERE vocabularylabel = 'cellular_component_qualifiers'; + +INSERT INTO vocabulary (id, name, vocabularylabel) VALUES (nextval('vocabulary_seq'), 'Spatial Expression Qualifier', 'spatial_expression_qualifiers'); + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Anatomical Structure Qualifier', 'anatomical_structure_qualifier', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Anatomical SubStructure Qualifier', 'anatomical_subtructure_qualifier', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Cellular Component Qualifier', 'cellular_component_qualifier', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; + +-- QUALIFIER TERMS +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000099', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000118', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000069', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000058', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000168', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000071', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000128', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000089', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000674', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000109', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000082', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000102', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000051', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000383', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000135', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000120', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000066', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000680', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000170', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000050', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000045', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000093', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000127', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000065', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000131', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000172', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000101', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000110', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000688', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000169', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000027', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000091', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000096', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000319', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000673', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000052', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000678', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000079', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000374', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000059', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000322', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000054', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000036', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000007', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000039', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000074', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000373', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000678', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000095', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000000', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000117', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000037', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000055', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000029', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000081', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000653', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000132', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000684', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000047', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0001001', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000004', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000130', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000066', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000683', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000034', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000088', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000137', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000062', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000100', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000125', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000028', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000323', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000033', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000083', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000049', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000003', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000111', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000124', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000333', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000171', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000077', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000145', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000142', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000056', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000055', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000079', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000063', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000141', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000119', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000032', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000076', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000057', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000090', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000013', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000075', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000199', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000377', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000042', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000078', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000104', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000050', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000379', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000112', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000039', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000058', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000127', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000077', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000046', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000069', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000035', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000121', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'RO:0002325', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000071', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000072', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000073', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000093', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000060', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000080', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000041', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000136', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000086', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000098', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000143', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000133', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000122', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000147', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000067', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000085', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000134', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000320', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000148', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000371', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000064', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000082', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000672', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000064', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000070', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000031', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000048', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000026', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000084', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000103', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000038', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000094', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000097', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000150', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000139', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000123', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000030', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000063', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000084', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000677', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000126', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000167', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000046', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000679', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000087', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000128', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000053', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000115', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000049', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000088', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000056', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000092', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000006', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000092', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000685', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000682', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000005', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000068', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000671', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000040', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000078', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000045', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000067', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000080', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000129', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000053', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000061', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'FBcv:0000070', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'BSPO:0000075', id FROM vocabulary WHERE vocabularylabel = 'spatial_expression_qualifiers'; + +-- ANATOMICAL STRUCTURE QUALIFIERS + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000078' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000109' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000679' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000379' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000683' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000084' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000040' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000092' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000037' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000074' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000079' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000115' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000055' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000374' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000065' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000067' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000030' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000035' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000111' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000172' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000077' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000034' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000653' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000128' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000170' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000000' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000322' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000673' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000099' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000061' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000100' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000110' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000049' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000050' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000056' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000048' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000171' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000141' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000082' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000058' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000070' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000085' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000058' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000082' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000101' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000080' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000063' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000678' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000684' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000383' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000688' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000007' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000006' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000049' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000068' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000136' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000077' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000055' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000671' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000004' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000097' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000062' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000199' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000128' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000169' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000092' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000073' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000319' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000047' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000122' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000069' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000078' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000129' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000070' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000121' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000090' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000112' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000093' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000167' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000083' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000677' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000150' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000132' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000142' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000052' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000071' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000069' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000053' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000053' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000087' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000032' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000064' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000130' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000080' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000371' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000076' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000674' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000029' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000088' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000036' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000072' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000373' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000071' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000075' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000124' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000005' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000057' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000050' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000137' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000117' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000127' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000041' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000091' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000133' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000094' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000685' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000134' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000680' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000103' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000168' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000125' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000038' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000067' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000064' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000039' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000098' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000123' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000104' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000118' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000060' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000323' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000672' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000066' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000046' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000095' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000096' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000026' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000102' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000143' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000033' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000147' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000131' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000148' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000145' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000333' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000139' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000028' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000377' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000119' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000120' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000027' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000127' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000086' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000056' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000003' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000042' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000013' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000063' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000682' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000079' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000054' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000046' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000093' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000088' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000059' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000135' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000084' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0001001' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000066' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000045' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000045' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000031' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000051' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000039' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000081' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000075' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000126' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000089' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='BSPO:0000678' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_structure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000320' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +-- ANATOMICAL SUBSTRUCTURE QUALIFIERS + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000167' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000058' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000059' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000169' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000071' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000054' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000150' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000046' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000653' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000067' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000055' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'anatomical_subtructure_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000063' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +-- CELLULAR COMPONENT QUALIFIERS + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000066' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000167' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000048' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000058' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000170' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000047' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000065' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000653' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000169' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000046' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000055' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000168' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000050' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000063' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000059' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000054' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000053' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='RO:0002325' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000067' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000070' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) +WITH + termset AS (SELECT id FROM vocabularytermset WHERE vocabularylabel = 'cellular_component_qualifier'), + termid AS (SELECT id FROM vocabularyterm WHERE name='FBcv:0000171' AND vocabulary_id = (SELECT id from vocabulary WHERE vocabularylabel= 'spatial_expression_qualifiers')) +SELECT termset.id, termid.id from termset, termid; From 4efba46b08170f8658b69efc96f6d822529054e0 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Thu, 19 Sep 2024 16:12:04 +0100 Subject: [PATCH 241/342] SCRUM-3952: fix integration tests --- .../constants/VocabularyConstants.java | 4 +- ...neExpressionAnnotationFmsDTOValidator.java | 36 ++-- .../ExpressionBulkUploadFmsITCase.java | 30 +++- .../curation_api/base/BaseITCase.java | 160 ++++++++---------- 4 files changed, 115 insertions(+), 115 deletions(-) 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 bd7b2c2a5..6abd953ec 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -69,14 +69,14 @@ private VocabularyConstants() { public static final String GENE_EXPRESSION_VOCABULARY = "gene_expression"; public static final String GENE_EXPRESSION_RELATION_TERM = "is_expressed_in"; - + public static final String TRANSCRIPT_RELATION_VOCABULARY = "transcript_relation"; public static final String TRANSCRIPT_CHILD_TERM = "is_child_of"; public static final String TRANSCRIPT_PARENT_TERM = "is_parent_of"; public static final String STAGE_UBERON_SLIM_TERMS = "stage_uberon_slim_terms"; public static final String ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS = "anatomical_structure_uberon_slim_terms"; - public static final String CELLULAR_COMPONENT_QUALIFIERS = "cellular_component_qualifiers"; + public static final String SPATIAL_EXPRESSION_QUALIFIERS = "spatial_expression_qualifiers"; public static final String HTP_DATASET_CATEGORY_TAGS = "data_set_category_tags"; public static final String HTP_DATASET_NOTE_TYPE_VOCABULARY_TERM_SET = "htp_expression_dataset_note_type"; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index c5354fcdb..2b502a63e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -224,31 +224,37 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId())) { String anatomicalstructurequalifiertermId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId(); - OntologyTerm anatomicalStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalstructurequalifiertermId); - if (anatomicalStructureQualifierTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalstructurequalifiertermId + ")"); - } else { - anatomicalSite.setAnatomicalStructureQualifiers(List.of(anatomicalStructureQualifierTerm)); + if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, anatomicalstructurequalifiertermId) != null) { + OntologyTerm anatomicalStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalstructurequalifiertermId); + if (anatomicalStructureQualifierTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalstructurequalifiertermId + ")"); + } else { + anatomicalSite.setAnatomicalStructureQualifiers(List.of(anatomicalStructureQualifierTerm)); + } } } if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId())) { String anatomicalsubstructurequalifierId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId(); - OntologyTerm anatomicalSubStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalsubstructurequalifierId); - if (anatomicalSubStructureQualifierTerm == null) { - response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalsubstructurequalifierId + ")"); - } else { - anatomicalSite.setAnatomicalSubstructureQualifiers(List.of(anatomicalSubStructureQualifierTerm)); + if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, anatomicalsubstructurequalifierId) != null) { + OntologyTerm anatomicalSubStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalsubstructurequalifierId); + if (anatomicalSubStructureQualifierTerm == null) { + response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalsubstructurequalifierId + ")"); + } else { + anatomicalSite.setAnatomicalSubstructureQualifiers(List.of(anatomicalSubStructureQualifierTerm)); + } } } if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId())) { String cellularComponentQualifierTermId = geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId(); - OntologyTerm cellularComponentQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(cellularComponentQualifierTermId); - if (cellularComponentQualifierTerm == null) { - response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + cellularComponentQualifierTermId + ")"); - } else { - anatomicalSite.setCellularComponentQualifiers(List.of(cellularComponentQualifierTerm)); + if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, cellularComponentQualifierTermId) != null) { + OntologyTerm cellularComponentQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(cellularComponentQualifierTermId); + if (cellularComponentQualifierTerm == null) { + response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + cellularComponentQualifierTermId + ")"); + } else { + anatomicalSite.setCellularComponentQualifiers(List.of(cellularComponentQualifierTerm)); + } } } diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 7a079be7d..ac881ceb1 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -69,6 +69,14 @@ public void init() { public void expressionBulkUploadAllFields() throws Exception { loadRequiredEntities(); checkSuccessfulBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "AF_01_all_fields.json"); +// System.out.println(RestAssured.given().when() +// .header("Content-Type", "application/json") +// .body("{}") +// .post(expressionFindEndpoint) +// .then() +// .statusCode(200) +// .extract().asPrettyString()); + RestAssured.given().when() .header("Content-Type", "application/json") .body("{}") @@ -93,9 +101,9 @@ public void expressionBulkUploadAllFields() throws Exception { .body("results[0].expressionPattern.whereExpressed.cellularComponentTerm.curie", is(cellularComponentTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentRibbonTerm.curie", is(cellularComponentRibbonTermId)) .body("results[0].expressionPattern.whereExpressed.cellularComponentOther", is(false)) - .body("results[0].expressionPattern.whereExpressed.anatomicalStructureQualifiers[0].name", is(anatomicalStructureQualifierTermId)) - .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureQualifiers[0].name", is(anatomicalSubstructureQualifierTermId)) - .body("results[0].expressionPattern.whereExpressed.cellularComponentQualifiers[0].name", is(cellularComponentQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalStructureQualifiers[0].curie", is(anatomicalStructureQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureQualifiers[0].curie", is(anatomicalSubstructureQualifierTermId)) + .body("results[0].expressionPattern.whereExpressed.cellularComponentQualifiers[0].curie", is(cellularComponentQualifierTermId)) .body("results[0].expressionPattern.whereExpressed.anatomicalStructureUberonTerms[0].curie", is(anatomicalStructureUberonTermId1)) .body("results[0].expressionPattern.whereExpressed.anatomicalStructureUberonTerms[1].curie", is(anatomicalStructureUberonTermId2)) .body("results[0].expressionPattern.whereExpressed.anatomicalSubstructureUberonTerms[0].curie", is(anatomicalSubstructureUberonTermId1)) @@ -159,18 +167,24 @@ private void loadRequiredEntities() throws Exception { createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); Vocabulary stageUberonTermVocabulary = getVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS); Vocabulary anatomicalStructureUberonTermVocabulary = getVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS); - Vocabulary cellullarComponentQualififerVocabulary = getVocabulary(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIERS); + Vocabulary spatialExpressionQualififerVocabulary = getVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS); createStageTerm(stageTermId, "StageTermTest"); createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); createAnatomicalTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); - createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); + createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); + + createOntologyTerm(anatomicalStructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); + createOntologyTerm(anatomicalSubstructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); + createOntologyTerm(cellularComponentQualifierTermId, "anatomicalSubstructureQualifierTermId", false); + + createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalStructureQualifierTermId, false); + createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalSubstructureQualifierTermId, false); + createVocabularyTerm(spatialExpressionQualififerVocabulary, cellularComponentQualifierTermId, false); + List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); createGoTerm(cellularComponentTermId, "CellularComponentTermTest", false, isaAncestor); - createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalStructureQualifierTermId, false); - createVocabularyTerm(anatomicalStructureUberonTermVocabulary, anatomicalSubstructureQualifierTermId, false); - createVocabularyTerm(cellullarComponentQualififerVocabulary, cellularComponentQualifierTermId, false); createUberonTerm(anatomicalStructureUberonTermId1, "UberonTermTest1"); createUberonTerm(anatomicalStructureUberonTermId2, "UberonTermTest2"); createUberonTerm(anatomicalSubstructureUberonTermId1, "UberonTermTest3"); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 28fdd7e58..9673c465e 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -1,61 +1,14 @@ package org.alliancegenome.curation_api.base; -import static io.restassured.RestAssured.given; -import static org.hamcrest.Matchers.is; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - +import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; +import io.restassured.response.ValidatableResponse; import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; -import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; -import org.alliancegenome.curation_api.model.entities.Allele; -import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; -import org.alliancegenome.curation_api.model.entities.BiologicalEntity; -import org.alliancegenome.curation_api.model.entities.ConditionRelation; -import org.alliancegenome.curation_api.model.entities.Construct; -import org.alliancegenome.curation_api.model.entities.CrossReference; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.ExperimentalCondition; -import org.alliancegenome.curation_api.model.entities.Gene; -import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; -import org.alliancegenome.curation_api.model.entities.Note; -import org.alliancegenome.curation_api.model.entities.Organization; -import org.alliancegenome.curation_api.model.entities.Person; -import org.alliancegenome.curation_api.model.entities.Reference; -import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; -import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; -import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; -import org.alliancegenome.curation_api.model.entities.Variant; -import org.alliancegenome.curation_api.model.entities.Vocabulary; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; -import org.alliancegenome.curation_api.model.entities.VocabularyTermSet; +import org.alliancegenome.curation_api.model.entities.*; 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.ontology.AnatomicalTerm; -import org.alliancegenome.curation_api.model.entities.ontology.CHEBITerm; -import org.alliancegenome.curation_api.model.entities.ontology.ChemicalTerm; -import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ExperimentalConditionOntologyTerm; -import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.MITerm; -import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.MPTerm; -import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; -import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; -import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; -import org.alliancegenome.curation_api.model.entities.ontology.WBPhenotypeTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ZECOTerm; -import org.alliancegenome.curation_api.model.entities.ontology.ZFATerm; +import org.alliancegenome.curation_api.model.entities.ontology.*; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.constructSlotAnnotations.ConstructSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSymbolSlotAnnotation; @@ -64,9 +17,15 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.apache.commons.lang3.StringUtils; -import io.restassured.RestAssured; -import io.restassured.common.mapper.TypeRef; -import io.restassured.response.ValidatableResponse; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; public class BaseITCase { @@ -115,7 +74,7 @@ public void checkBulkLoadRecordCounts(String endpoint, String filePath, String c body("history.counts." + countType + ".completed", is(expectedCompletedRecords)). body("history.counts." + countType + ".skipped", is(expectedSkippedRecords)); } - + public void checkBulkLoadRecordCounts(String endpoint, String filePath, HashMap> params) throws Exception { String content = Files.readString(Path.of(filePath)); @@ -126,7 +85,7 @@ public void checkBulkLoadRecordCounts(String endpoint, String filePath, HashMap< post(endpoint). then(). statusCode(200); - + for (Entry> entry: params.entrySet()) { resp.body("history.counts." + entry.getKey() + ".total", is(entry.getValue().get("total"))); resp.body("history.counts." + entry.getKey() + ".failed", is(entry.getValue().get("failed"))); @@ -142,19 +101,19 @@ public void checkFailedBulkLoad(String endpoint, String filePath) throws Excepti public void checkSkippedBulkLoad(String endpoint, String filePath) throws Exception { checkBulkLoadRecordCounts(endpoint, filePath, "Records", 1, 0, 0, 1); } - + public void checkSkippedBulkLoad(String endpoint, String filePath, int nrRecords) throws Exception { checkBulkLoadRecordCounts(endpoint, filePath, "Records", nrRecords, 0, 0, nrRecords); } - + public void checkSuccessfulBulkLoad(String endpoint, String filePath) throws Exception { checkSuccessfulBulkLoad(endpoint, filePath, 1); } - + public void checkSuccessfulBulkLoad(String endpoint, String filePath, int nrRecords) throws Exception { checkBulkLoadRecordCounts(endpoint, filePath, "Records", nrRecords, 0, nrRecords, 0); } - + public HashMap createCountParams(int total, int failed, int completed, int skipped) { HashMap map = new HashMap(); map.put("total", total); @@ -167,7 +126,7 @@ public HashMap createCountParams(int total, int failed, int com public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, String name, String taxonCurie, String subtypeName, Boolean obsolete) throws Exception { return createAffectedGenomicModel(modEntityId, name, taxonCurie, subtypeName, obsolete, null); } - + public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, String name, String taxonCurie, String subtypeName, Boolean obsolete, DataProvider dataProvider) { Vocabulary subtypeVocabulary = getVocabulary(VocabularyConstants.AGM_SUBTYPE_VOCABULARY); VocabularyTerm subtype = getVocabularyTerm(subtypeVocabulary, subtypeName); @@ -190,11 +149,11 @@ public AffectedGenomicModel createAffectedGenomicModel(String modEntityId, Strin extract().body().as(getObjectResponseTypeRefAffectedGenomicModel()); return response.getEntity(); } - + public Allele createAllele(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete) { return createAllele(modEntityId, modEntityId, taxonCurie, symbolNameTerm, obsolete, null); } - + public Allele createAllele(String modEntityId, String symbol, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { Allele allele = new Allele(); allele.setModEntityId(modEntityId); @@ -202,7 +161,7 @@ public Allele createAllele(String modEntityId, String symbol, String taxonCurie, allele.setObsolete(obsolete); allele.setInternal(false); allele.setDataProvider(dataProvider); - + AlleleSymbolSlotAnnotation alleleSymbol = new AlleleSymbolSlotAnnotation(); alleleSymbol.setNameType(symbolNameTerm); alleleSymbol.setDisplayText(symbol); @@ -253,7 +212,7 @@ public AnatomicalTerm createAnatomicalTerm(String curie, String name) throws Exc then(). statusCode(200). extract().body().as(getObjectResponseTypeRefAnatomicalTerm()); - + return response.getEntity(); } @@ -272,7 +231,7 @@ public CHEBITerm createChebiTerm(String curie, String name, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefCHEBITerm()); - + return response.getEntity(); } @@ -291,7 +250,7 @@ public ChemicalTerm createChemicalTerm(String curie, String name) throws Excepti then(). statusCode(200). extract().body().as(getObjectResponseTypeRefChemicalTerm()); - + return response.getEntity(); } @@ -359,11 +318,11 @@ public DataProvider createDataProvider(String organizationAbbreviation, Boolean return response.getEntity(); } - + public DOTerm createDoTerm(String curie, String name) { return createDoTerm(curie, name, false); } - + public DOTerm createDoTerm(String curie, Boolean obsolete) { return createDoTerm(curie, curie, obsolete); } @@ -383,7 +342,7 @@ public DOTerm createDoTerm(String curie, String name, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefDOTerm()); - + return response.getEntity(); } @@ -440,27 +399,27 @@ public ExperimentalConditionOntologyTerm createExperimentalConditionOntologyTerm then(). statusCode(200). extract().body().as(getObjectResponseTypeRefExperimentalConditionOntologyTerm()); - + return response.getEntity(); } public Gene createGene(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete) { return createGene(modEntityId, taxonCurie, symbolNameTerm, obsolete, null); } - + public Gene createGene(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { return createGeneWithXref(modEntityId, taxonCurie, symbolNameTerm, obsolete, dataProvider, null); } - + public List createGenes(List modEntityIds, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider) { List geneList = new ArrayList<>(); for (String modEntityId : modEntityIds) { geneList.add(createGene(modEntityId, taxonCurie, symbolNameTerm, obsolete, dataProvider)); } - + return geneList; } - + public Gene createGeneWithXref(String modEntityId, String taxonCurie, VocabularyTerm symbolNameTerm, Boolean obsolete, DataProvider dataProvider, String xrefCurie) { Gene gene = new Gene(); gene.setModEntityId(modEntityId); @@ -477,7 +436,7 @@ public Gene createGeneWithXref(String modEntityId, String taxonCurie, Vocabulary SOTerm geneType = getSoTerm("SO:0001217"); gene.setGeneType(geneType); - + if (StringUtils.isNotBlank(xrefCurie)) { CrossReference xref = new CrossReference(); xref.setReferencedCurie(xrefCurie); @@ -496,6 +455,22 @@ public Gene createGeneWithXref(String modEntityId, String taxonCurie, Vocabulary return response.getEntity(); } + public OntologyTerm createOntologyTerm(String curie, String name, Boolean obsolete) { + OntologyTerm ontologyTerm = new OntologyTerm(); + ontologyTerm.setCurie(curie); + ontologyTerm.setName(name); + ontologyTerm.setObsolete(obsolete); + ObjectResponse response = given(). + contentType("application/json"). + body(ontologyTerm). + when(). + post("/api/ontologyterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefOntologyTerm()); + return response.getEntity(); + } + public GOTerm createGoTerm(String curie, String name, Boolean obsolete) { return createGoTerm(curie, name, obsolete, null, null); } @@ -543,10 +518,10 @@ public MITerm createMiTerm(String curie, String name) throws Exception { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefMITerm()); - + return response.getEntity(); } - + public MMOTerm createMmoTerm(String curie, String name) throws Exception { MMOTerm mmoTerm = new MMOTerm(); mmoTerm.setCurie(curie); @@ -562,14 +537,14 @@ public MMOTerm createMmoTerm(String curie, String name) throws Exception { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefMMOTerm()); - + return response.getEntity(); } - + public MPTerm createMpTerm(String curie, String name) { return createMpTerm(curie, name, false); } - + public MPTerm createMpTerm(String curie, Boolean obsolete) { return createMpTerm(curie, "Test MPTerm", obsolete); } @@ -589,7 +564,7 @@ public MPTerm createMpTerm(String curie, String name, Boolean obsolete) { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefMPTerm()); - + return response.getEntity(); } @@ -656,11 +631,11 @@ public Person createPerson(String uniqueId) { person = response.getEntity(); return person; } - + public Reference createReference(String curie, String xrefCurie) { return createReference(curie, xrefCurie, false); } - + public Reference createReference(String curie, Boolean obsolete) { return createReference(curie, "PMID:TestXref", obsolete); } @@ -764,7 +739,7 @@ public StageTerm createStageTerm(String curie, String name) throws Exception { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefStageTerm()); - + return response.getEntity(); } @@ -783,7 +758,7 @@ public UBERONTerm createUberonTerm(String curie, String name) throws Exception { then(). statusCode(200). extract().body().as(getObjectResponseTypeRefUBERONTerm()); - + return response.getEntity(); } @@ -861,10 +836,10 @@ public WBPhenotypeTerm createWbPhenotypeTerm(String curie, String name) throws E then(). statusCode(200). extract().body().as(getObjectResponseTypeRefWBPhenotypeTerm()); - + return response.getEntity(); } - + public ZECOTerm createZecoTerm(String curie, String name, Boolean obsolete) { return createZecoTerm(curie, name, obsolete, null); } @@ -1128,11 +1103,16 @@ private TypeRef> getObjectResponseTypeRefA }; } + private TypeRef> getObjectResponseTypeRefOntologyTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefAnatomicalTerm() { return new TypeRef>() { }; } - + private TypeRef> getObjectResponseTypeRefBiologicalEntity() { return new TypeRef>() { }; From d28cc2e58e19ea5dff508f2d2ff772f8d31d6bc6 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Thu, 19 Sep 2024 16:16:41 +0100 Subject: [PATCH 242/342] SCRUM-3952: fix indentation and remove commented code --- .../curation_api/ExpressionBulkUploadFmsITCase.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index ac881ceb1..941d50a4f 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -69,14 +69,6 @@ public void init() { public void expressionBulkUploadAllFields() throws Exception { loadRequiredEntities(); checkSuccessfulBulkLoad(expressionBulkPostEndpoint, expressionTestFilePath + "AF_01_all_fields.json"); -// System.out.println(RestAssured.given().when() -// .header("Content-Type", "application/json") -// .body("{}") -// .post(expressionFindEndpoint) -// .then() -// .statusCode(200) -// .extract().asPrettyString()); - RestAssured.given().when() .header("Content-Type", "application/json") .body("{}") @@ -172,15 +164,12 @@ private void loadRequiredEntities() throws Exception { createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); createAnatomicalTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); - createOntologyTerm(anatomicalStructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); createOntologyTerm(anatomicalSubstructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); createOntologyTerm(cellularComponentQualifierTermId, "anatomicalSubstructureQualifierTermId", false); - createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalStructureQualifierTermId, false); createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalSubstructureQualifierTermId, false); createVocabularyTerm(spatialExpressionQualififerVocabulary, cellularComponentQualifierTermId, false); - List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); From 6a499adc41676388dcddb185fc29923341f5c1e1 Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 20 Sep 2024 12:02:55 +0100 Subject: [PATCH 243/342] SCRUM-3952: use vocabulary term sets in test --- .../constants/VocabularyConstants.java | 3 +++ ...neExpressionAnnotationFmsDTOValidator.java | 6 +++--- .../ExpressionBulkUploadFmsITCase.java | 17 +++++++-------- .../curation_api/base/BaseITCase.java | 21 +++++++++++++++++++ 4 files changed, 35 insertions(+), 12 deletions(-) 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 6abd953ec..b9e2e75a2 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -77,6 +77,9 @@ private VocabularyConstants() { public static final String STAGE_UBERON_SLIM_TERMS = "stage_uberon_slim_terms"; public static final String ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS = "anatomical_structure_uberon_slim_terms"; public static final String SPATIAL_EXPRESSION_QUALIFIERS = "spatial_expression_qualifiers"; + public static final String ANATOMICAL_STRUCTURE_QUALIFIER = "anatomical_structure_qualifier"; + 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_NOTE_TYPE_VOCABULARY_TERM_SET = "htp_expression_dataset_note_type"; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java index 2b502a63e..203bd6d5b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/GeneExpressionAnnotationFmsDTOValidator.java @@ -224,7 +224,7 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId())) { String anatomicalstructurequalifiertermId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalStructureQualifierTermId(); - if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, anatomicalstructurequalifiertermId) != null) { + if (vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ANATOMICAL_STRUCTURE_QUALIFIER, anatomicalstructurequalifiertermId) != null) { OntologyTerm anatomicalStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalstructurequalifiertermId); if (anatomicalStructureQualifierTerm == null) { response.addErrorMessage("whereExpressed - anatomicalStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalstructurequalifiertermId + ")"); @@ -236,7 +236,7 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId())) { String anatomicalsubstructurequalifierId = geneExpressionFmsDTO.getWhereExpressed().getAnatomicalSubStructureQualifierTermId(); - if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, anatomicalsubstructurequalifierId) != null) { + if (vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ANATOMICAL_SUBSTRUCTURE_QUALIFIER, anatomicalsubstructurequalifierId) != null) { OntologyTerm anatomicalSubStructureQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(anatomicalsubstructurequalifierId); if (anatomicalSubStructureQualifierTerm == null) { response.addErrorMessage("whereExpressed - anatomicalSubStructureQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + anatomicalsubstructurequalifierId + ")"); @@ -248,7 +248,7 @@ private ObjectResponse validateAnatomicalSite(GeneExpressionFmsD if (!ObjectUtils.isEmpty(geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId())) { String cellularComponentQualifierTermId = geneExpressionFmsDTO.getWhereExpressed().getCellularComponentQualifierTermId(); - if (vocabularyTermService.getTermInVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS, cellularComponentQualifierTermId) != null) { + if (vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIER, cellularComponentQualifierTermId) != null) { OntologyTerm cellularComponentQualifierTerm = ontologyTermService.findByCurieOrSecondaryId(cellularComponentQualifierTermId); if (cellularComponentQualifierTerm == null) { response.addErrorMessage("whereExpressed - cellularComponentQualifierTermId", ValidationConstants.INVALID_MESSAGE + " (" + cellularComponentQualifierTermId + ")"); diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 941d50a4f..629701711 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -7,10 +7,7 @@ import io.restassured.config.RestAssuredConfig; import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; -import org.alliancegenome.curation_api.model.entities.Vocabulary; -import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; import org.junit.jupiter.api.*; @@ -158,18 +155,20 @@ private void loadRequiredEntities() throws Exception { Vocabulary vocabulary2 = createVocabulary(VocabularyConstants.GENE_EXPRESSION_VOCABULARY, false); createVocabularyTerm(vocabulary2, VocabularyConstants.GENE_EXPRESSION_RELATION_TERM, false); Vocabulary stageUberonTermVocabulary = getVocabulary(VocabularyConstants.STAGE_UBERON_SLIM_TERMS); - Vocabulary anatomicalStructureUberonTermVocabulary = getVocabulary(VocabularyConstants.ANATOMICAL_STRUCTURE_UBERON_SLIM_TERMS); Vocabulary spatialExpressionQualififerVocabulary = getVocabulary(VocabularyConstants.SPATIAL_EXPRESSION_QUALIFIERS); + VocabularyTermSet anatatomicalStructureQualifierTermset = getVocabularyTermSet(VocabularyConstants.ANATOMICAL_STRUCTURE_QUALIFIER); + VocabularyTermSet anatatomicalSubstructureQualifierTermset = getVocabularyTermSet(VocabularyConstants.ANATOMICAL_SUBSTRUCTURE_QUALIFIER); + VocabularyTermSet cellularComponentQualifierTermset = getVocabularyTermSet(VocabularyConstants.CELLULAR_COMPONENT_QUALIFIER); createStageTerm(stageTermId, "StageTermTest"); createVocabularyTerm(stageUberonTermVocabulary, stageUberonTermId, false); createAnatomicalTerm(anatomicalStructureTermId, "AnatomicalStructureTermTest"); - createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); + createAnatomicalTerm(anatomicalSubstructureTermId, "AnatomicalSubStructureTermTest"); createOntologyTerm(anatomicalStructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); createOntologyTerm(anatomicalSubstructureQualifierTermId, "anatomicalSubstructureQualifierTermId", false); createOntologyTerm(cellularComponentQualifierTermId, "anatomicalSubstructureQualifierTermId", false); - createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalStructureQualifierTermId, false); - createVocabularyTerm(spatialExpressionQualififerVocabulary, anatomicalSubstructureQualifierTermId, false); - createVocabularyTerm(spatialExpressionQualififerVocabulary, cellularComponentQualifierTermId, false); + createVocabularyTerm(anatatomicalStructureQualifierTermset, anatomicalStructureQualifierTermId, false); + createVocabularyTerm(anatatomicalSubstructureQualifierTermset, anatomicalSubstructureQualifierTermId, false); + createVocabularyTerm(cellularComponentQualifierTermset, cellularComponentQualifierTermId, false); List subsets = new ArrayList(); subsets.add("goslim_agr"); GOTerm isaAncestor = createGoTerm(cellularComponentRibbonTermId, "CellularComponentRibbonTermTest", false, subsets); diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index 9673c465e..fcdad90b2 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -804,6 +804,27 @@ public VocabularyTerm createVocabularyTerm(Vocabulary vocabulary, String name, B return response.getEntity(); } + public VocabularyTerm createVocabularyTerm(VocabularyTermSet vocabularyTermSet, String name, Boolean obsolete) { + VocabularyTerm vocabularyTerm = new VocabularyTerm(); + vocabularyTerm.setName(name); + vocabularyTerm.setVocabulary(vocabularyTermSet.getVocabularyTermSetVocabulary()); + vocabularyTerm.setVocabularyTermSets(List.of(vocabularyTermSet)); + vocabularyTerm.setObsolete(obsolete); + vocabularyTerm.setInternal(false); + + ObjectResponse response = + RestAssured.given(). + contentType("application/json"). + body(vocabularyTerm). + when(). + post("/api/vocabularyterm"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefVocabularyTerm()); + + return response.getEntity(); + } + public void createVocabularyTermSet(String name, Vocabulary vocabulary, List terms) { VocabularyTermSet vocabularyTermSet = new VocabularyTermSet(); vocabularyTermSet.setName(name); From 16c761666eff3b00ae49b382e0ec766443c0f9ea Mon Sep 17 00:00:00 2001 From: Andres Becerra Date: Fri, 20 Sep 2024 14:50:52 +0100 Subject: [PATCH 244/342] SCRUM-3952: increase LinkML version --- .../curation_api/constants/LinkMLSchemaConstants.java | 4 ++-- .../curation_api/model/entities/AnatomicalSite.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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 f668f7188..0d458a37b 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/LinkMLSchemaConstants.java @@ -5,8 +5,8 @@ public class LinkMLSchemaConstants { private LinkMLSchemaConstants() { // Hidden from view, as it is a utility class } - public static final String LATEST_RELEASE = "2.6.1"; + public static final String LATEST_RELEASE = "2.7.0"; public static final String MIN_ONTOLOGY_RELEASE = "1.2.4"; public static final String MAX_ONTOLOGY_RELEASE = LATEST_RELEASE; -} \ No newline at end of file +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java index 19a5163dc..ad8acc703 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AnatomicalSite.java @@ -31,7 +31,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@AGRCurationSchemaVersion(min = "2.6.1", max = LinkMLSchemaConstants.LATEST_RELEASE) +@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE) @Schema(name = "Anatomical_Site", description = "Anatomical part of an expression pattern") @Table(indexes = { @Index(name = "anatomicalsite_anatomicalstructure_index ", columnList = "anatomicalstructure_id"), From 7ef9b2fc2036874781fab0acd8e88824f6a71507 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 9 Sep 2024 09:18:54 -0500 Subject: [PATCH 245/342] SCRUM-3758 replace uniqueIdTemplate --- .../ExperimentalConditionsTable.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index 30f6be110..a96581472 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -24,6 +24,7 @@ import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; +import { IdTemplate } from '../../components/Templates/IdTemplate'; export const ExperimentalConditionsTable = () => { const [errorMessages, setErrorMessages] = useState({}); @@ -73,17 +74,7 @@ export const ExperimentalConditionsTable = () => { ); }; - const uniqueIdBodyTemplate = (rowData) => { - if (rowData) { - return ( - <> - {rowData.uniqueId} - - - ); - } - }; - + //todo: replace const summaryBodyTemplate = (rowData) => { if (rowData) { return ( @@ -95,6 +86,7 @@ export const ExperimentalConditionsTable = () => { } }; + //todo: replace const conditionClassBodyTemplate = (rowData) => { if (rowData?.conditionClass) { return ( @@ -111,6 +103,7 @@ export const ExperimentalConditionsTable = () => { } }; + //todo: replace const conditionIdBodyTemplate = (rowData) => { if (rowData?.conditionId) { return ( @@ -127,6 +120,7 @@ export const ExperimentalConditionsTable = () => { } }; + //todo: replace const conditionGeneOntologyBodyTemplate = (rowData) => { if (rowData?.conditionGeneOntology) { return ( @@ -137,6 +131,7 @@ export const ExperimentalConditionsTable = () => { } }; + //todo: replace const conditionChemicalBodyTemplate = (rowData) => { if (rowData?.conditionChemical) { return ( @@ -146,7 +141,8 @@ export const ExperimentalConditionsTable = () => { ); } }; - + + //todo: replace const conditionAnatomyBodyTemplate = (rowData) => { if (rowData?.conditionAnatomy) { return ( @@ -157,6 +153,7 @@ export const ExperimentalConditionsTable = () => { } }; + //todo: replace const conditionTaxonBodyTemplate = (rowData) => { if (rowData?.conditionTaxon) { return ( @@ -170,12 +167,13 @@ export const ExperimentalConditionsTable = () => { target={`.${'TAXON_NAME_'}${rowData.id}${rowData.conditionTaxon.curie.replace(':', '')}`} content={`${rowData.conditionTaxon.name} (${rowData.conditionTaxon.curie})`} style={{ width: '250px', maxWidth: '450px' }} - /> + /> ); } }; - + + //todo: replace const internalBodyTemplate = (rowData) => { if (rowData && rowData.internal !== null && rowData.internal !== undefined) { return {JSON.stringify(rowData.internal)}; @@ -188,7 +186,7 @@ export const ExperimentalConditionsTable = () => { updatedAnnotations[props.rowIndex].internal = JSON.parse(event.value.name); } }; - + const internalEditor = (props) => { return ( <> @@ -273,7 +271,7 @@ export const ExperimentalConditionsTable = () => { field: 'uniqueId', header: 'Unique ID', sortable: true, - body: uniqueIdBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.uniqueidFilterConfig, }, { @@ -343,6 +341,7 @@ export const ExperimentalConditionsTable = () => { }, { field: 'conditionQuantity', + //todo: replace with number template header: 'Quantity', sortable: true, filterConfig: FILTER_CONFIGS.conditionQuantityFilterConfig, From d5fe32f602ba4ca997de821b34fcf2a8f33bcd42 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 9 Sep 2024 12:02:08 -0500 Subject: [PATCH 246/342] SCRUM-3758 switch NameTemplate to StringTemplate --- .../{NameTemplate.js => StringTemplate.js} | 10 +++++----- ...meTemplate.test.js => StringTemplate.test.js} | 8 ++++---- .../AffectedGenomicModelTable.js | 4 ++-- .../ExperimentalConditionsTable.js | 15 ++------------- .../ontologies/GeneralOntologyComponent.js | 4 ++-- .../src/containers/ontologies/NameTemplate.js | 16 ---------------- .../referencePage/LiteratureReferenceTable.js | 8 ++++---- 7 files changed, 19 insertions(+), 46 deletions(-) rename src/main/cliapp/src/components/Templates/{NameTemplate.js => StringTemplate.js} (50%) rename src/main/cliapp/src/components/Templates/__tests__/{NameTemplate.test.js => StringTemplate.test.js} (59%) delete mode 100644 src/main/cliapp/src/containers/ontologies/NameTemplate.js diff --git a/src/main/cliapp/src/components/Templates/NameTemplate.js b/src/main/cliapp/src/components/Templates/StringTemplate.js similarity index 50% rename from src/main/cliapp/src/components/Templates/NameTemplate.js rename to src/main/cliapp/src/components/Templates/StringTemplate.js index 5511a6b65..76a6cb521 100644 --- a/src/main/cliapp/src/components/Templates/NameTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringTemplate.js @@ -1,17 +1,17 @@ import React from 'react'; import { Tooltip } from 'primereact/tooltip'; -export const NameTemplate = ({ name }) => { +export const StringTemplate = ({ string }) => { const targetClass = `a${global.crypto.randomUUID()}`; - if (!name) return null; + if (!string) return null; return ( <>
- -
+ +
); diff --git a/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/StringTemplate.test.js similarity index 59% rename from src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js rename to src/main/cliapp/src/components/Templates/__tests__/StringTemplate.test.js index ff88d911a..52f1c32d7 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/NameTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/StringTemplate.test.js @@ -1,15 +1,15 @@ import { render } from '@testing-library/react'; -import { NameTemplate } from '../NameTemplate'; +import { StringTemplate } from '../StringTemplate'; import '../../../tools/jest/setupTests'; -describe('NameTemplate', () => { +describe('StringTemplate', () => { it('should return null when value is null', () => { - const { container } = render(); + const { container } = render(); expect(container.firstChild).toBeNull(); }); it('should render the name inside the div', () => { - const result = render(); + const result = render(); expect(result.getByText('test')).toBeInTheDocument(); }); }); diff --git a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js index d5261c541..3a16aa810 100644 --- a/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js +++ b/src/main/cliapp/src/containers/affectedGenomicModelPage/AffectedGenomicModelTable.js @@ -3,7 +3,7 @@ import { GenericDataTable } from '../../components/GenericDataTable/GenericDataT import { Toast } from 'primereact/toast'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; -import { NameTemplate } from '../../components/Templates/NameTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; @@ -49,7 +49,7 @@ export const AffectedGenomicModelTable = () => { { field: 'name', header: 'Name', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.nameFilterConfig, }, diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index a96581472..fe341864d 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -25,6 +25,7 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { IdTemplate } from '../../components/Templates/IdTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; export const ExperimentalConditionsTable = () => { const [errorMessages, setErrorMessages] = useState({}); @@ -74,18 +75,6 @@ export const ExperimentalConditionsTable = () => { ); }; - //todo: replace - const summaryBodyTemplate = (rowData) => { - if (rowData) { - return ( - <> - {rowData.conditionSummary} - - - ); - } - }; - //todo: replace const conditionClassBodyTemplate = (rowData) => { if (rowData?.conditionClass) { @@ -278,7 +267,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionSummary', header: 'Summary', sortable: true, - body: summaryBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionRelationSummaryFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js b/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js index 81074b487..05c5435eb 100644 --- a/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js +++ b/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js @@ -1,6 +1,6 @@ import React, { useRef, useState } from 'react'; import { Toast } from 'primereact/toast'; -import { NameTemplate } from './NameTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { TabView, TabPanel } from 'primereact/tabview'; import { DefinitionTemplate } from './DefinitionTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; @@ -94,7 +94,7 @@ export const GeneralOntologyComponent = ({ name, endpoint, showNamespace, showAb field: 'name', header: 'Name', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.nameFilterConfig, }); if (!hideDefinition) { diff --git a/src/main/cliapp/src/containers/ontologies/NameTemplate.js b/src/main/cliapp/src/containers/ontologies/NameTemplate.js deleted file mode 100644 index c9cb9a460..000000000 --- a/src/main/cliapp/src/containers/ontologies/NameTemplate.js +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { EllipsisTableCell } from '../../components/EllipsisTableCell'; -import { Tooltip } from 'primereact/tooltip'; - -export const NameTemplate = ({ rowData }) => { - return ( - <> - {rowData.name} - - - ); -}; diff --git a/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js b/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js index 6af711f86..8847ae91f 100644 --- a/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js +++ b/src/main/cliapp/src/containers/referencePage/LiteratureReferenceTable.js @@ -7,7 +7,7 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { StringListTemplate } from '../../components/Templates/StringListTemplate'; -import { NameTemplate } from '../../components/Templates/NameTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { SearchService } from '../../service/SearchService'; export const LiteratureReferenceTable = () => { @@ -42,7 +42,7 @@ export const LiteratureReferenceTable = () => { header: 'Title', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.titleFilterConfig, }, { @@ -50,7 +50,7 @@ export const LiteratureReferenceTable = () => { header: 'Abstract', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.abstractFilterConfig, }, { @@ -58,7 +58,7 @@ export const LiteratureReferenceTable = () => { header: 'Citation', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.citationFilterConfig, }, { From 6962dcacf8fa0333cef9f3d253c3046c6177dc64 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 9 Sep 2024 12:30:50 -0500 Subject: [PATCH 247/342] SCRUM-3758 add StringTemplate to ExperimentalConditionsTable --- .../ExperimentalConditionsTable.js | 100 ++---------------- 1 file changed, 6 insertions(+), 94 deletions(-) diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index fe341864d..6e4b0c984 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -8,7 +8,6 @@ import { SearchService } from '../../service/SearchService'; import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; import { EllipsisTableCell } from '../../components/EllipsisTableCell'; import { ExperimentalConditionService } from '../../service/ExperimentalConditionService'; -import { Tooltip } from 'primereact/tooltip'; import { Button } from 'primereact/button'; import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; import { NewConditionForm } from './NewConditionForm'; @@ -75,93 +74,6 @@ export const ExperimentalConditionsTable = () => { ); }; - //todo: replace - const conditionClassBodyTemplate = (rowData) => { - if (rowData?.conditionClass) { - return ( - <> - - {rowData.conditionClass.name} ({rowData.conditionClass.curie}) - - - - ); - } - }; - - //todo: replace - const conditionIdBodyTemplate = (rowData) => { - if (rowData?.conditionId) { - return ( - <> - - {rowData.conditionId.name} ({rowData.conditionId.curie}) - - - - ); - } - }; - - //todo: replace - const conditionGeneOntologyBodyTemplate = (rowData) => { - if (rowData?.conditionGeneOntology) { - return ( - - {rowData.conditionGeneOntology.name} ({rowData.conditionGeneOntology.curie}) - - ); - } - }; - - //todo: replace - const conditionChemicalBodyTemplate = (rowData) => { - if (rowData?.conditionChemical) { - return ( - - {rowData.conditionChemical.name} ({rowData.conditionChemical.curie}) - - ); - } - }; - - //todo: replace - const conditionAnatomyBodyTemplate = (rowData) => { - if (rowData?.conditionAnatomy) { - return ( - - {rowData.conditionAnatomy.name} ({rowData.conditionAnatomy.curie}) - - ); - } - }; - - //todo: replace - const conditionTaxonBodyTemplate = (rowData) => { - if (rowData?.conditionTaxon) { - return ( - <> - - {rowData.conditionTaxon.name} ({rowData.conditionTaxon.curie}) - - - - ); - } - }; - //todo: replace const internalBodyTemplate = (rowData) => { if (rowData && rowData.internal !== null && rowData.internal !== undefined) { @@ -274,7 +186,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionClass.name', header: 'Class', sortable: true, - body: conditionClassBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionClassFilterConfig, editor: (props) => conditionClassEditorTemplate(props, curieAutocompleteFields), }, @@ -282,7 +194,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionId.name', header: 'Condition Term', sortable: true, - body: conditionIdBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionIdFilterConfig, editor: (props) => singleOntologyEditorTemplate( @@ -296,16 +208,16 @@ export const ExperimentalConditionsTable = () => { field: 'conditionGeneOntology.name', header: 'Gene Ontology', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionGeneOntologyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionGeneOntology', 'goterm', curieAutocompleteFields), - body: conditionGeneOntologyBodyTemplate, }, { field: 'conditionChemical.name', header: 'Chemical', sortable: true, - body: conditionChemicalBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionChemicalFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionChemical', 'chemicalterm', curieAutocompleteFields), @@ -314,7 +226,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionAnatomy.name', header: 'Anatomy', sortable: true, - body: conditionAnatomyBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionAnatomyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionAnatomy', 'anatomicalterm', curieAutocompleteFields), @@ -323,7 +235,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionTaxon.name', header: 'Condition Taxon', sortable: true, - body: conditionTaxonBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionTaxonFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionTaxon', 'ncbitaxonterm', curieAutocompleteFields), From b2c8ebe5fab264d1f9c4243aca907abc9c522f84 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 9 Sep 2024 12:43:53 -0500 Subject: [PATCH 248/342] SCRUM-3758 replace internalTemplate with BooleanTemplate in ExConTable --- .../ExperimentalConditionsTable.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index 6e4b0c984..8b7b22ecb 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -6,7 +6,6 @@ import { useMutation } from '@tanstack/react-query'; import { Toast } from 'primereact/toast'; import { SearchService } from '../../service/SearchService'; import { ErrorMessageComponent } from '../../components/Error/ErrorMessageComponent'; -import { EllipsisTableCell } from '../../components/EllipsisTableCell'; import { ExperimentalConditionService } from '../../service/ExperimentalConditionService'; import { Button } from 'primereact/button'; import { TrueFalseDropdown } from '../../components/TrueFalseDropDownSelector'; @@ -25,6 +24,7 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { StringTemplate } from '../../components/Templates/StringTemplate'; +import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; export const ExperimentalConditionsTable = () => { const [errorMessages, setErrorMessages] = useState({}); @@ -74,13 +74,6 @@ export const ExperimentalConditionsTable = () => { ); }; - //todo: replace - const internalBodyTemplate = (rowData) => { - if (rowData && rowData.internal !== null && rowData.internal !== undefined) { - return {JSON.stringify(rowData.internal)}; - } - }; - const onInternalEditorValueChange = (props, event) => { let updatedAnnotations = [...props.props.value]; if (event.value || event.value === '') { @@ -258,7 +251,7 @@ export const ExperimentalConditionsTable = () => { { field: 'internal', header: 'Internal', - body: internalBodyTemplate, + body: (rowData) => , filterConfig: FILTER_CONFIGS.internalFilterConfig, sortable: true, editor: (props) => internalEditor(props), From ee82589a54df8cec60b97a4088c64ef1a83abb25 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 10 Sep 2024 16:08:37 -0500 Subject: [PATCH 249/342] SCRUM-3758 update number formatting throughout site --- .../src/components/EntityCountsComponent.js | 13 ++-- .../GenericDataTable/DataTableFooter.js | 35 +++++++++++ .../GenericDataTable/GenericDataTable.js | 18 +++--- .../components/Templates/NumberTemplate.js | 7 +++ .../__tests__/NumberTemplate.test.js | 63 +++++++++++++++++++ .../dataLoadsPage/DataLoadsComponent.js | 17 +++-- .../ExperimentalConditionsTable.js | 3 +- 7 files changed, 131 insertions(+), 25 deletions(-) create mode 100644 src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js create mode 100644 src/main/cliapp/src/components/Templates/NumberTemplate.js create mode 100644 src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js diff --git a/src/main/cliapp/src/components/EntityCountsComponent.js b/src/main/cliapp/src/components/EntityCountsComponent.js index 998b1cabe..bbedda8e4 100644 --- a/src/main/cliapp/src/components/EntityCountsComponent.js +++ b/src/main/cliapp/src/components/EntityCountsComponent.js @@ -3,6 +3,7 @@ import { DataTable } from 'primereact/datatable'; import { Column } from 'primereact/column'; import { SystemService } from '../service/SystemService'; import { CLASSES } from '../constants/Classes'; +import { NumberTemplate } from './Templates/NumberTemplate'; export const EntityCountsComponent = () => { const [tableData, setTableData] = useState({}); @@ -50,22 +51,22 @@ export const EntityCountsComponent = () => {
- - + }/> + }/>
- - + }/> + }/>
- - + }/> + }/>
diff --git a/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js new file mode 100644 index 000000000..a69093191 --- /dev/null +++ b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js @@ -0,0 +1,35 @@ +import React from 'react'; +import { Paginator } from 'primereact/paginator'; +import { NumberTemplate } from '../Templates/NumberTemplate'; + +export const DataTableFooter = ({ first, rows, totalRecords, onLazyLoad, isInEditMode }) => { + return (!isInEditMode && { + const totalRecordsDisplay = ; + const firstDisplay = ; + const lastDisplay = ; + return ( + <> + Showing {firstDisplay} to {lastDisplay} of {totalRecordsDisplay} + + ); + }, + PageLinks: (options) => { + const pageDisplay = ; + return ( + + ); + } + }} + /> + ); +}; \ No newline at end of file diff --git a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js index db13153ed..fd66e42dc 100644 --- a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js @@ -17,6 +17,7 @@ import { filterColumns, orderColumns, getIdentifier } from '../../utils/utils'; import { useGenericDataTable } from './useGenericDataTable'; import style from './styles.module.scss'; +import { DataTableFooter } from './DataTableFooter'; export const GenericDataTable = (props) => { const { tableName, @@ -309,18 +310,19 @@ export const GenericDataTable = (props) => { columnResizeMode="expand" showGridlines={true} onColumnResizeEnd={handleColumnResizeEnd} - paginator={!isInEditMode} totalRecords={totalRecords} - onPage={onLazyLoad} lazy={true} - first={tableState.first} - paginatorTemplate="CurrentPageReport FirstPageLink PrevPageLink PageLinks NextPageLink LastPageLink RowsPerPageDropdown" - currentPageReportTemplate="Showing {first} to {last} of {totalRecords}" - rows={tableState.rows} - rowsPerPageOptions={[10, 20, 50, 100, 250, 1000]} rowClassName={(props) => getRowClass(props)} loading={fetching} loadingIcon="pi pi-spin pi-spinner" + footer={ + } > {isEditable && ( {
{{exceptionMessage}}
-
+
); }; diff --git a/src/main/cliapp/src/components/Templates/NumberTemplate.js b/src/main/cliapp/src/components/Templates/NumberTemplate.js new file mode 100644 index 000000000..9ae726781 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/NumberTemplate.js @@ -0,0 +1,7 @@ +export const NumberTemplate = ({ number }) => { + //still want to pass through falsy 0 values + const num = new Intl.NumberFormat().format(number); + console.log("totalRecordsDisplay type in component", typeof num); + if (number === null || number === undefined) return; + return new Intl.NumberFormat().format(number); +}; \ No newline at end of file diff --git a/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js new file mode 100644 index 000000000..5bcc86af8 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js @@ -0,0 +1,63 @@ +import { render } from '@testing-library/react'; +import '../../../tools/jest/setupTests'; +import { NumberTemplate } from '../NumberTemplate'; + +describe('NumberTemplate', () => { + + it('should format positive integers correctly', () => { + const number = 12345; + const result = NumberTemplate({ number }); + expect(result).toBe('12,345'); + }); + + it('should format negative integers correctly', () => { + const number = -1000; + const formattedNumber = NumberTemplate({ number }); + + expect(formattedNumber).toBe('-1,000'); + }); + + it('should format positive floating-point numbers correctly', () => { + const number = 1234.56; + const formattedNumber = NumberTemplate({ number }); + + expect(formattedNumber).toBe('1,234.56'); + }); + + it('should format negative floating-point numbers correctly', () => { + const number = -1234.5678; + const formattedNumber = NumberTemplate({ number }); + + expect(formattedNumber).toBe('-1,234.568'); + }); + + it('should return formatted number when input is zero', () => { + const number = 0; + + const result = NumberTemplate({ number }); + + expect(result).toBe('0'); + }); + + it('should handle very large numbers correctly', () => { + const number = 1000000000000000000000000000000; + + const result = NumberTemplate({ number }); + + expect(result).toBe('1,000,000,000,000,000,000,000,000,000,000'); + }); + + it('should handle string representations of numbers correctly', () => { + const number = '1000'; + + const result = NumberTemplate({ number }); + + expect(result).toBe('1,000'); + }); + + it('should return undefined when number is null', () => { + const number = null; + const result = NumberTemplate({ number }); + expect(result).toBeUndefined(); + }); +}); diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 3f272ede0..514471eb1 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -21,6 +21,7 @@ import { useQueryClient } from '@tanstack/react-query'; import { SiteContext } from '../layout/SiteContext'; import { LoadingOverlay } from '../../components/LoadingOverlay'; import moment from 'moment-timezone'; +import { NumberTemplate } from '../../components/Templates/NumberTemplate'; export const DataLoadsComponent = () => { const { authState } = useOktaAuth(); @@ -530,11 +531,7 @@ export const DataLoadsComponent = () => { ); }; - const numberTemplate = (number) => { - //still want to pass through falsy 0 values - if (number === null || number === undefined) return; - return new Intl.NumberFormat().format(number); - }; + const countsTemplate = (rowData) => { let countsArray = []; @@ -545,10 +542,10 @@ export const DataLoadsComponent = () => { return ( - numberTemplate(rowData.completed)} /> - numberTemplate(rowData.failed)} /> - numberTemplate(rowData.skipped)} /> - numberTemplate(rowData.total)} /> + }/> + } /> + } /> + } /> ); }; @@ -573,7 +570,7 @@ export const DataLoadsComponent = () => { numberTemplate(rowData.bulkLoadFile.fileSize)} + body={(rowData) => } /> diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index 8b7b22ecb..6140bd8a1 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -25,6 +25,7 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { StringTemplate } from '../../components/Templates/StringTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; +import { NumberTemplate } from '../../components/Templates/NumberTemplate'; export const ExperimentalConditionsTable = () => { const [errorMessages, setErrorMessages] = useState({}); @@ -235,9 +236,9 @@ export const ExperimentalConditionsTable = () => { }, { field: 'conditionQuantity', - //todo: replace with number template header: 'Quantity', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionQuantityFilterConfig, editor: (props) => freeTextEditor(props, 'conditionQuantity'), }, From 8cd840ce6dfce77505326f66e2753781c5c1570d Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 11 Sep 2024 10:22:33 -0500 Subject: [PATCH 250/342] SCRUM-3758 add DataTableFooter tests --- .../GenericDataTable/DataTableFooter.js | 1 + .../components/Templates/NumberTemplate.js | 2 - .../__tests__/DataTableFooter.test.js | 114 ++++++++++++++++++ 3 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js diff --git a/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js index a69093191..27fcfa26e 100644 --- a/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js +++ b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js @@ -4,6 +4,7 @@ import { NumberTemplate } from '../Templates/NumberTemplate'; export const DataTableFooter = ({ first, rows, totalRecords, onLazyLoad, isInEditMode }) => { return (!isInEditMode && { //still want to pass through falsy 0 values - const num = new Intl.NumberFormat().format(number); - console.log("totalRecordsDisplay type in component", typeof num); if (number === null || number === undefined) return; return new Intl.NumberFormat().format(number); }; \ No newline at end of file diff --git a/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js b/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js new file mode 100644 index 000000000..7b5b688b3 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js @@ -0,0 +1,114 @@ +import { render, fireEvent } from '@testing-library/react'; +import '../../../tools/jest/setupTests'; +import { DataTableFooter } from '../../GenericDataTable/DataTableFooter'; + +describe('DataTableFooter', () => { + + it('should render Paginator component when isInEditMode is false', () => { + const result = render( + { }} + isInEditMode={false} + /> + ); + const paginator = result.queryByTestId('datatable-footer'); + + expect(paginator).toBeInTheDocument(); + }); + + it('should handle totalRecords, first, and last being zero', () => { + const { getByText } = render( + { }} + isInEditMode={false} + /> + ); + expect(getByText('Showing 0 to 0 of 0')).toBeInTheDocument(); + }); + + it('should display formatted totalRecords, first, and last numbers', () => { + const first = 1000; + const rows = 10; + const totalRecords = 2000; + const onLazyLoad = jest.fn(); + const isInEditMode = false; + + const { getByText } = render( + + ); + + const firstDisplay = getByText('Showing 1,001 to 1,010 of 2,000'); + expect(firstDisplay).toBeInTheDocument(); + }); + + it('should show correct rows per page options in dropdown', () => { + const first = 0; + const rows = 10; + const totalRecords = 100; + const onLazyLoad = jest.fn(); + const isInEditMode = false; + + const result = render( + + ); + + const dropdownButton = result.getAllByText('10')[1]; + fireEvent.click(dropdownButton); + + expect(result.getByText('20')).toBeInTheDocument(); + expect(result.getByText('50')).toBeInTheDocument(); + expect(result.getByText('100')).toBeInTheDocument(); + expect(result.getByText('250')).toBeInTheDocument(); + expect(result.getByText('1000')).toBeInTheDocument(); + }); + + it('should handle null or undefined totalRecords, first, and last', () => { + const onLazyLoad = jest.fn(); + + const result = render( + + ); + + expect(result.getByText(/Showing 0 to 0 of/i)).toBeInTheDocument(); + }); + + it('should not render Paginator when isInEditMode is true', () => { + const onLazyLoad = jest.fn(); + const result = render( + + ); + + const paginator = result.queryByTestId('datatable-footer'); + expect(paginator).toBeNull(); + }); +}); From 4318c5514f92a699d9dde6cb471416aebcb41c19 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 24 Sep 2024 11:33:39 -0500 Subject: [PATCH 251/342] SCRUM-3758 update tooltips and other cleanup --- .../src/components/Templates/IdTemplate.js | 2 +- .../Templates/ObjectListTemplate.js | 2 +- .../Templates/OntologyTermTemplate.js | 18 ++--- .../Templates/StringListTemplate.js | 2 +- .../src/components/Templates/TaxonTemplate.js | 23 ------- .../Templates/__tests__/IdTemplate.test.js | 8 --- ...e.test.js => OntologyTermTemplate.test.js} | 25 ++----- .../Templates/__tests__/TaxonTemplate.test.js | 68 ------------------- .../GenomicEntityListTemplate.js | 2 +- .../genomicEntity/GenomicEntityTemplate.js | 2 +- .../reference/SingleReferenceTemplate.js | 2 +- .../AffectedGenomicModelTable.js | 9 ++- .../containers/allelesPage/AllelesTable.js | 11 ++- .../constructsPage/ConstructsTable.js | 5 ++ .../DiseaseAnnotationsTable.js | 7 +- .../ExperimentalConditionsTable.js | 14 ++-- .../GeneGeneticInteractionsTable.js | 14 ++-- .../GeneMolecularInteractionsTable.js | 18 ++--- .../src/containers/genesPage/GenesTable.js | 13 ++-- .../containers/variantsPage/VariantsTable.js | 6 ++ 20 files changed, 87 insertions(+), 164 deletions(-) delete mode 100644 src/main/cliapp/src/components/Templates/TaxonTemplate.js rename src/main/cliapp/src/components/Templates/__tests__/{DiseaseTemplate.test.js => OntologyTermTemplate.test.js} (61%) delete mode 100644 src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js diff --git a/src/main/cliapp/src/components/Templates/IdTemplate.js b/src/main/cliapp/src/components/Templates/IdTemplate.js index 7827776fe..b83828214 100644 --- a/src/main/cliapp/src/components/Templates/IdTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdTemplate.js @@ -10,7 +10,7 @@ export const IdTemplate = ({ id }) => { return ( <> {id} - + ); }; diff --git a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js index 1e43f4465..fb547e228 100644 --- a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js +++ b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js @@ -19,7 +19,7 @@ export const ObjectListTemplate = ({ list, sortMethod, stringTemplate, showBulle
- + diff --git a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js index 51368c50b..9591605f6 100644 --- a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js +++ b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js @@ -1,23 +1,23 @@ import { Tooltip } from 'primereact/tooltip'; import { EllipsisTableCell } from '../EllipsisTableCell'; -export const OntologyTermTemplate = ({ object }) => { - if (!object) return null; +export const OntologyTermTemplate = ({ term }) => { + if (!term) return null; const targetClass = `a${global.crypto.randomUUID()}`; - const textString = getTextString(object); + const textString = getTextString(term); return ( <> {textString} - + ); }; -const getTextString = (object) => { - if (!object.name) return object.curie; - if (!object.curie) return object.name; - if (!object.curie && !object.name) return ''; - return `${object.name} (${object.curie})`; +const getTextString = (term) => { + if (!term.name) return term.curie; + if (!term.curie) return term.name; + if (!term.curie && !term.name) return ''; + return `${term.name} (${term.curie})`; }; diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 5b6c6f253..35e383bd4 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -21,7 +21,7 @@ export const StringListTemplate = ({ list }) => {
- + diff --git a/src/main/cliapp/src/components/Templates/TaxonTemplate.js b/src/main/cliapp/src/components/Templates/TaxonTemplate.js deleted file mode 100644 index 1f0eb7645..000000000 --- a/src/main/cliapp/src/components/Templates/TaxonTemplate.js +++ /dev/null @@ -1,23 +0,0 @@ -import React from 'react'; -import { Tooltip } from 'primereact/tooltip'; -import { EllipsisTableCell } from '../EllipsisTableCell'; - -export const TaxonTemplate = ({ taxon }) => { - if (!taxon) return null; - const targetClass = `a${global.crypto.randomUUID()}`; - const textString = getTextString(taxon); - - return ( - <> - {textString} - - - ); -}; - -const getTextString = (taxon) => { - if (!taxon.name) return taxon.curie; - if (!taxon.curie) return taxon.name; - if (!taxon.curie && !taxon.name) return ''; - return `${taxon.name} (${taxon.curie})`; -}; diff --git a/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js index c375f74df..5d8c21f06 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/IdTemplate.test.js @@ -8,14 +8,6 @@ describe('IdTemplate', () => { expect(container.firstChild).toBeNull(); }); - it('should render Tooltip component with EllipsisTableCell as target and id as content', async () => { - const result = render(); - const divArray = result.getAllByText('123'); - expect(divArray).toHaveLength(1); - fireEvent.mouseEnter(divArray[0]); - expect(await result.findAllByText('123')).toHaveLength(2); - }); - it('should handle id as number', () => { const { getByText } = render(); expect(getByText('123')).toBeInTheDocument(); diff --git a/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/OntologyTermTemplate.test.js similarity index 61% rename from src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js rename to src/main/cliapp/src/components/Templates/__tests__/OntologyTermTemplate.test.js index 811b1454e..4f03eeb93 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/DiseaseTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/OntologyTermTemplate.test.js @@ -9,29 +9,14 @@ describe('OntologyTermTemplate', () => { curie: 'Disease Curie', }; - const result = render(); + const result = render(); const content = result.getByText('Disease Name (Disease Curie)'); expect(content).toBeInTheDocument(); }); - it('should display a tooltip with the name and curie of the disease object when hovering over the EllipsisTableCell component', async () => { - const object = { - name: 'Disease Name', - curie: 'Disease Curie', - }; - - const result = render(); - - const divContentArray = result.getAllByText('Disease Name (Disease Curie)'); - expect(divContentArray).toHaveLength(1); - fireEvent.mouseEnter(divContentArray[0]); - - expect(await result.findAllByText('Disease Name (Disease Curie)')).toHaveLength(2); - }); - it('should return null if the object is falsy', () => { - const result = render(); + const result = render(); expect(result.container.firstChild).toBeNull(); }); @@ -39,7 +24,7 @@ describe('OntologyTermTemplate', () => { it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { const object = {}; - const result = render(); + const result = render(); const ellipsisTableCell = result.container.firstChild; expect(ellipsisTableCell).toHaveTextContent(''); @@ -50,7 +35,7 @@ describe('OntologyTermTemplate', () => { name: 'Disease Name', }; - const result = render(); + const result = render(); const ellipsisTableCell = result.getByText('Disease Name'); expect(ellipsisTableCell).toBeInTheDocument(); @@ -61,7 +46,7 @@ describe('OntologyTermTemplate', () => { curie: 'Disease Curie', }; - const result = render(); + const result = render(); const ellipsisTableCell = result.getByText('Disease Curie'); expect(ellipsisTableCell).toBeInTheDocument(); diff --git a/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js deleted file mode 100644 index b7eb35d47..000000000 --- a/src/main/cliapp/src/components/Templates/__tests__/TaxonTemplate.test.js +++ /dev/null @@ -1,68 +0,0 @@ -import { render, fireEvent } from '@testing-library/react'; -import { TaxonTemplate } from '../TaxonTemplate'; -import '../../../tools/jest/setupTests'; - -describe('TaxonTemplate', () => { - it('should return null when object is null/falsy', () => { - const result = render(); - expect(result.container.firstChild).toBeNull(); - }); - - it('should render an empty EllipsisTableCell component if the object has no name or curie', () => { - const object = {}; - - const result = render(); - - const ellipsisTableCell = result.container.firstChild; - expect(ellipsisTableCell).toHaveTextContent(''); - }); - - it('should render an EllipsisTableCell component with only the name if the object has no curie', () => { - const object = { - name: 'Taxon Name', - }; - - const result = render(); - - const ellipsisTableCell = result.getByText('Taxon Name'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); - - it('should render an EllipsisTableCell component with only the curie if the object has no name', () => { - const object = { - curie: 'Taxon Curie', - }; - - const result = render(); - - const ellipsisTableCell = result.getByText('Taxon Curie'); - expect(ellipsisTableCell).toBeInTheDocument(); - }); - - it('should render the name and curie of the Taxon object in an EllipsisTableCell component', () => { - const object = { - name: 'Taxon Name', - curie: 'Taxon Curie', - }; - - const result = render(); - - const content = result.getByText('Taxon Name (Taxon Curie)'); - expect(content).toBeInTheDocument(); - }); - - it('should display a tooltip with the name and curie of the Taxon object when hovering over the EllipsisTableCell component', async () => { - const object = { - name: 'Taxon Name', - curie: 'Taxon Curie', - }; - - const result = render(); - - const divContentArray = result.getAllByText('Taxon Name (Taxon Curie)'); - expect(divContentArray).toHaveLength(1); - fireEvent.mouseEnter(divContentArray[0]); - - expect(await result.findAllByText('Taxon Name (Taxon Curie)')).toHaveLength(2); - }); -}); diff --git a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js index d63982e03..803fa04a5 100644 --- a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js +++ b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityListTemplate.js @@ -32,7 +32,7 @@ export const GenomicEntityListTemplate = ({ genomicEntities }) => {
- + diff --git a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js index 3d84a7faa..a8730cce4 100644 --- a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js +++ b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js @@ -18,7 +18,7 @@ export const GenomicEntityTemplate = ({ genomicEntity }) => { __html: `${subjectText} (${indentifier})`, }} /> - +
{ __html: refString, }} /> - +
{ const [isInEditMode, setIsInEditMode] = useState(false); @@ -56,6 +56,7 @@ export const AffectedGenomicModelTable = () => { { field: 'subtype.name', header: 'Sub Type', + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.subtypeFilterConfig, }, @@ -63,7 +64,7 @@ export const AffectedGenomicModelTable = () => { field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, }, { @@ -89,6 +90,7 @@ export const AffectedGenomicModelTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { @@ -96,6 +98,7 @@ export const AffectedGenomicModelTable = () => { header: 'Date Updated', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { @@ -103,6 +106,7 @@ export const AffectedGenomicModelTable = () => { header: 'Created By', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { @@ -110,6 +114,7 @@ export const AffectedGenomicModelTable = () => { header: 'Date Created', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js index f23454806..21cdd9ee5 100644 --- a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js +++ b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js @@ -25,7 +25,6 @@ import { BooleanTableEditor } from '../../components/Editors/boolean/BooleanTabl import { TruncatedReferencesTemplate } from '../../components/Templates/reference/TruncatedReferencesTemplate'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; -import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { TextDialogTemplate } from '../../components/Templates/dialog/TextDialogTemplate'; import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialogTemplate'; import { NestedListDialogTemplate } from '../../components/Templates/dialog/NestedListDialogTemplate'; @@ -39,6 +38,8 @@ import { EditMessageTooltip } from '../../components/EditMessageTooltip'; import { getDefaultTableState } from '../../service/TableStateService'; import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; +import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; export const AllelesTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); @@ -1077,7 +1078,6 @@ export const AllelesTable = () => { { field: 'alleleSecondaryIds.secondaryId', header: 'Secondary IDs', - //todo body: (rowData) => ( { { field: 'taxon.name', header: 'Taxon', - body: (rowData) => , sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, editor: (props) => , }, @@ -1201,6 +1201,7 @@ export const AllelesTable = () => { field: 'inCollection.name', header: 'In Collection', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.inCollectionFilterConfig, editor: (props) => , }, @@ -1247,6 +1248,7 @@ export const AllelesTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { @@ -1254,6 +1256,7 @@ export const AllelesTable = () => { header: 'Date Updated', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { @@ -1261,6 +1264,7 @@ export const AllelesTable = () => { header: 'Created By', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { @@ -1268,6 +1272,7 @@ export const AllelesTable = () => { header: 'Date Created', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js b/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js index 5bfc45f21..e440dbeaa 100644 --- a/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js +++ b/src/main/cliapp/src/containers/constructsPage/ConstructsTable.js @@ -16,6 +16,7 @@ import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialog import { StringListTemplate } from '../../components/Templates/StringListTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { TruncatedReferencesTemplate } from '../../components/Templates/reference/TruncatedReferencesTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { SearchService } from '../../service/SearchService'; @@ -257,6 +258,7 @@ export const ConstructsTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: { isInEditMode }, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { @@ -264,6 +266,7 @@ export const ConstructsTable = () => { header: 'Date Updated', sortable: { isInEditMode }, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { @@ -271,6 +274,7 @@ export const ConstructsTable = () => { header: 'Created By', sortable: { isInEditMode }, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { @@ -278,6 +282,7 @@ export const ConstructsTable = () => { header: 'Date Created', sortable: { isInEditMode }, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index ecdc322df..c927c9266 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -24,6 +24,7 @@ import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { NotTemplate } from '../../components/Templates/NotTemplate'; import { CountDialogTemplate } from '../../components/Templates/dialog/CountDialogTemplate'; import { TextDialogTemplate } from '../../components/Templates/dialog/TextDialogTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { NotEditor } from '../../components/Editors/NotEditor'; @@ -1065,7 +1066,7 @@ export const DiseaseAnnotationsTable = () => { { field: 'diseaseAnnotationObject.name', header: 'Disease', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.diseaseAnnotationObjectFilterConfig, editor: (props) => diseaseEditorTemplate(props), @@ -1242,24 +1243,28 @@ export const DiseaseAnnotationsTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { field: 'dateUpdated', header: 'Date Updated', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { field: 'createdBy.uniqueId', header: 'Created By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { field: 'dateCreated', header: 'Date Created', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index 6140bd8a1..a7b91f77e 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -26,6 +26,7 @@ import { IdTemplate } from '../../components/Templates/IdTemplate'; import { StringTemplate } from '../../components/Templates/StringTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { NumberTemplate } from '../../components/Templates/NumberTemplate'; +import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; export const ExperimentalConditionsTable = () => { const [errorMessages, setErrorMessages] = useState({}); @@ -180,7 +181,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionClass.name', header: 'Class', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionClassFilterConfig, editor: (props) => conditionClassEditorTemplate(props, curieAutocompleteFields), }, @@ -188,7 +189,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionId.name', header: 'Condition Term', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionIdFilterConfig, editor: (props) => singleOntologyEditorTemplate( @@ -202,7 +203,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionGeneOntology.name', header: 'Gene Ontology', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionGeneOntologyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionGeneOntology', 'goterm', curieAutocompleteFields), @@ -211,7 +212,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionChemical.name', header: 'Chemical', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionChemicalFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionChemical', 'chemicalterm', curieAutocompleteFields), @@ -220,7 +221,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionAnatomy.name', header: 'Anatomy', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionAnatomyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionAnatomy', 'anatomicalterm', curieAutocompleteFields), @@ -229,7 +230,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionTaxon.name', header: 'Condition Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionTaxonFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionTaxon', 'ncbitaxonterm', curieAutocompleteFields), @@ -246,6 +247,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionFreeText', header: 'Free Text', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionFreeTextFilterConfig, editor: (props) => freeTextEditor(props, 'conditionFreeText'), }, diff --git a/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js b/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js index ab75cd4d4..8c0a138ca 100644 --- a/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js +++ b/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js @@ -12,6 +12,7 @@ import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; import { TruncatedReferencesTemplate } from '../../components/Templates/reference/TruncatedReferencesTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; export const GeneGeneticInteractionsTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); //needs better name @@ -82,6 +83,7 @@ export const GeneGeneticInteractionsTable = () => { field: 'relation.name', header: 'Interaction Relation', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.gmiRelationFilterConfig, }, { @@ -94,42 +96,42 @@ export const GeneGeneticInteractionsTable = () => { { field: 'interactionType.name', header: 'Interaction Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactionTypeFilterConfig, }, { field: 'interactorARole.name', header: 'Interactor A Role', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorARoleFilterConfig, }, { field: 'interactorBRole.name', header: 'Interactor B Role', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorBRoleFilterConfig, }, { field: 'interactorAType.name', header: 'Interactor A Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorATypeFilterConfig, }, { field: 'interactorBType.name', header: 'Interactor B Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorBTypeFilterConfig, }, { field: 'interactionSource.name', header: 'Interaction Source', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactionSourceFilterConfig, }, diff --git a/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js b/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js index 969adaf97..8fd8f2572 100644 --- a/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js +++ b/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js @@ -10,6 +10,7 @@ import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTem import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { TruncatedReferencesTemplate } from '../../components/Templates/reference/TruncatedReferencesTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; import { SearchService } from '../../service/SearchService'; @@ -76,6 +77,7 @@ export const GeneMolecularInteractionsTable = () => { field: 'relation.name', header: 'Interaction Relation', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.gmiRelationFilterConfig, }, { @@ -88,56 +90,56 @@ export const GeneMolecularInteractionsTable = () => { { field: 'interactionType.name', header: 'Interaction Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactionTypeFilterConfig, }, { field: 'interactorARole.name', header: 'Interactor A Role', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorARoleFilterConfig, }, { field: 'interactorBRole.name', header: 'Interactor B Role', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorBRoleFilterConfig, }, { field: 'interactorAType.name', header: 'Interactor A Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorATypeFilterConfig, }, { field: 'interactorBType.name', header: 'Interactor B Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactorBTypeFilterConfig, }, { field: 'interactionSource.name', header: 'Interaction Source', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.interactionSourceFilterConfig, }, { field: 'aggregationDatabase.name', header: 'Aggregation DB', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.aggregationDatabaseFilterConfig, }, { field: 'detectionMethod.name', header: 'Detection Method', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.detectionMethodFilterConfig, }, diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index fc4255259..f7c4a3a5c 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -14,9 +14,10 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { IdTemplate } from '../../components/Templates/IdTemplate'; import { TextDialogTemplate } from '../../components/Templates/dialog/TextDialogTemplate'; import { ListDialogTemplate } from '../../components/Templates/dialog/ListDialogTemplate'; -import { TaxonTemplate } from '../../components/Templates/TaxonTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; import { OntologyTermTemplate } from '../../components/Templates/OntologyTermTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; + import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; import { SearchService } from '../../service/SearchService'; @@ -196,7 +197,7 @@ export const GenesTable = () => { { field: 'geneType.name', header: 'Gene Type', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.geneTypeFilterConfig, }, @@ -204,7 +205,7 @@ export const GenesTable = () => { field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.taxonFilterConfig, }, @@ -231,6 +232,7 @@ export const GenesTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { @@ -238,6 +240,7 @@ export const GenesTable = () => { header: 'Date Updated', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { @@ -245,6 +248,7 @@ export const GenesTable = () => { header: 'Created By', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { @@ -252,6 +256,7 @@ export const GenesTable = () => { header: 'Date Created', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { @@ -272,7 +277,7 @@ export const GenesTable = () => { }, ]; - const DEFAULT_COLUMN_WIDTH = 20; + const DEFAULT_COLUMN_WIDTH = 10; const SEARCH_ENDPOINT = 'gene'; const initialTableState = getDefaultTableState('Genes', columns, DEFAULT_COLUMN_WIDTH); diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index c8bfc26ff..91000c2c4 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -20,6 +20,8 @@ import { FILTER_CONFIGS } from '../../constants/FilterFields'; import { useControlledVocabularyService } from '../../service/useControlledVocabularyService'; import { ControlledVocabularyDropdown } from '../../components/ControlledVocabularySelector'; import { ObjectListTemplate } from '../../components/Templates/ObjectListTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; + import { useGetTableData } from '../../service/useGetTableData'; import { useGetUserSettings } from '../../service/useGetUserSettings'; import { crossReferencesSort } from '../../components/Templates/utils/sortMethods'; @@ -307,6 +309,7 @@ export const VariantsTable = () => { field: 'updatedBy.uniqueId', header: 'Updated By', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.updatedByFilterConfig, }, { @@ -314,6 +317,7 @@ export const VariantsTable = () => { header: 'Date Updated', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dateUpdatedFilterConfig, }, { @@ -321,6 +325,7 @@ export const VariantsTable = () => { header: 'Created By', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.createdByFilterConfig, }, { @@ -328,6 +333,7 @@ export const VariantsTable = () => { header: 'Date Created', sortable: true, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.dataCreatedFilterConfig, }, { From 8bb917e5dded5058e07d89ef5db707d69ca28d89 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 24 Sep 2024 11:57:03 -0500 Subject: [PATCH 252/342] SCRUM-3758 update formatting --- .../src/components/EntityCountsComponent.js | 36 +++- .../GenericDataTable/DataTableFooter.js | 66 +++---- .../GenericDataTable/GenericDataTable.js | 17 +- .../src/components/Templates/IdTemplate.js | 2 +- .../components/Templates/NumberTemplate.js | 8 +- .../Templates/ObjectListTemplate.js | 2 +- .../Templates/OntologyTermTemplate.js | 2 +- .../Templates/StringListTemplate.js | 2 +- .../components/Templates/StringTemplate.js | 2 +- .../__tests__/DataTableFooter.test.js | 167 ++++++++---------- .../GenomicEntityListTemplate.test.js | 17 -- .../__tests__/GenomicEntityTemplate.test.js | 18 -- .../__tests__/NumberTemplate.test.js | 81 +++++---- .../genomicEntity/GenomicEntityTemplate.js | 2 +- .../reference/SingleReferenceTemplate.js | 2 +- .../AffectedGenomicModelTable.js | 2 +- .../containers/allelesPage/AllelesTable.js | 4 +- .../dataLoadsPage/DataLoadsComponent.js | 16 +- .../ExperimentalConditionsTable.js | 14 +- .../GeneGeneticInteractionsTable.js | 2 +- .../GeneMolecularInteractionsTable.js | 2 +- .../src/containers/genesPage/GenesTable.js | 2 +- 22 files changed, 218 insertions(+), 248 deletions(-) diff --git a/src/main/cliapp/src/components/EntityCountsComponent.js b/src/main/cliapp/src/components/EntityCountsComponent.js index bbedda8e4..9302868cb 100644 --- a/src/main/cliapp/src/components/EntityCountsComponent.js +++ b/src/main/cliapp/src/components/EntityCountsComponent.js @@ -51,22 +51,46 @@ export const EntityCountsComponent = () => {
- }/> - }/> + } + /> + } + />
- }/> - }/> + } + /> + } + />
- }/> - }/> + } + /> + } + />
diff --git a/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js index 27fcfa26e..fff69a29c 100644 --- a/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js +++ b/src/main/cliapp/src/components/GenericDataTable/DataTableFooter.js @@ -3,34 +3,38 @@ import { Paginator } from 'primereact/paginator'; import { NumberTemplate } from '../Templates/NumberTemplate'; export const DataTableFooter = ({ first, rows, totalRecords, onLazyLoad, isInEditMode }) => { - return (!isInEditMode && { - const totalRecordsDisplay = ; - const firstDisplay = ; - const lastDisplay = ; - return ( - <> - Showing {firstDisplay} to {lastDisplay} of {totalRecordsDisplay} - - ); - }, - PageLinks: (options) => { - const pageDisplay = ; - return ( - - ); - } - }} - /> - ); -}; \ No newline at end of file + return ( + !isInEditMode && ( + { + const totalRecordsDisplay = ; + const firstDisplay = ; + const lastDisplay = ; + return ( + <> + Showing {firstDisplay} to {lastDisplay} of {totalRecordsDisplay} + + ); + }, + PageLinks: (options) => { + const pageDisplay = ; + return ( + + ); + }, + }} + /> + ) + ); +}; diff --git a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js index fd66e42dc..7a2bfc276 100644 --- a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js @@ -315,13 +315,14 @@ export const GenericDataTable = (props) => { rowClassName={(props) => getRowClass(props)} loading={fetching} loadingIcon="pi pi-spin pi-spinner" - footer={ + footer={ + } > {isEditable && ( @@ -462,6 +463,6 @@ export const GenericDataTable = (props) => {
{{exceptionMessage}}
-
+ ); }; diff --git a/src/main/cliapp/src/components/Templates/IdTemplate.js b/src/main/cliapp/src/components/Templates/IdTemplate.js index b83828214..069c8e9c5 100644 --- a/src/main/cliapp/src/components/Templates/IdTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdTemplate.js @@ -10,7 +10,7 @@ export const IdTemplate = ({ id }) => { return ( <> {id} - + ); }; diff --git a/src/main/cliapp/src/components/Templates/NumberTemplate.js b/src/main/cliapp/src/components/Templates/NumberTemplate.js index dfdaad82c..50752c9d3 100644 --- a/src/main/cliapp/src/components/Templates/NumberTemplate.js +++ b/src/main/cliapp/src/components/Templates/NumberTemplate.js @@ -1,5 +1,5 @@ export const NumberTemplate = ({ number }) => { - //still want to pass through falsy 0 values - if (number === null || number === undefined) return; - return new Intl.NumberFormat().format(number); -}; \ No newline at end of file + //still want to pass through falsy 0 values + if (number === null || number === undefined) return; + return new Intl.NumberFormat().format(number); +}; diff --git a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js index fb547e228..e87db95db 100644 --- a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js +++ b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js @@ -19,7 +19,7 @@ export const ObjectListTemplate = ({ list, sortMethod, stringTemplate, showBulle
- + diff --git a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js index 9591605f6..7f371e6e2 100644 --- a/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js +++ b/src/main/cliapp/src/components/Templates/OntologyTermTemplate.js @@ -10,7 +10,7 @@ export const OntologyTermTemplate = ({ term }) => { return ( <> {textString} - + ); }; diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 35e383bd4..455620d27 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -21,7 +21,7 @@ export const StringListTemplate = ({ list }) => {
- + diff --git a/src/main/cliapp/src/components/Templates/StringTemplate.js b/src/main/cliapp/src/components/Templates/StringTemplate.js index 76a6cb521..a3807eaad 100644 --- a/src/main/cliapp/src/components/Templates/StringTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringTemplate.js @@ -10,7 +10,7 @@ export const StringTemplate = ({ string }) => { className={`overflow-hidden text-overflow-ellipsis ${targetClass}`} dangerouslySetInnerHTML={{ __html: string }} /> - +
diff --git a/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js b/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js index 7b5b688b3..98120e0e5 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/DataTableFooter.test.js @@ -3,112 +3,87 @@ import '../../../tools/jest/setupTests'; import { DataTableFooter } from '../../GenericDataTable/DataTableFooter'; describe('DataTableFooter', () => { + it('should render Paginator component when isInEditMode is false', () => { + const result = render( + {}} isInEditMode={false} /> + ); + const paginator = result.queryByTestId('datatable-footer'); - it('should render Paginator component when isInEditMode is false', () => { - const result = render( - { }} - isInEditMode={false} - /> - ); - const paginator = result.queryByTestId('datatable-footer'); + expect(paginator).toBeInTheDocument(); + }); - expect(paginator).toBeInTheDocument(); - }); + it('should handle totalRecords, first, and last being zero', () => { + const { getByText } = render( + {}} isInEditMode={false} /> + ); + expect(getByText('Showing 0 to 0 of 0')).toBeInTheDocument(); + }); - it('should handle totalRecords, first, and last being zero', () => { - const { getByText } = render( - { }} - isInEditMode={false} - /> - ); - expect(getByText('Showing 0 to 0 of 0')).toBeInTheDocument(); - }); + it('should display formatted totalRecords, first, and last numbers', () => { + const first = 1000; + const rows = 10; + const totalRecords = 2000; + const onLazyLoad = jest.fn(); + const isInEditMode = false; - it('should display formatted totalRecords, first, and last numbers', () => { - const first = 1000; - const rows = 10; - const totalRecords = 2000; - const onLazyLoad = jest.fn(); - const isInEditMode = false; + const { getByText } = render( + + ); - const { getByText } = render( - - ); + const firstDisplay = getByText('Showing 1,001 to 1,010 of 2,000'); + expect(firstDisplay).toBeInTheDocument(); + }); - const firstDisplay = getByText('Showing 1,001 to 1,010 of 2,000'); - expect(firstDisplay).toBeInTheDocument(); - }); + it('should show correct rows per page options in dropdown', () => { + const first = 0; + const rows = 10; + const totalRecords = 100; + const onLazyLoad = jest.fn(); + const isInEditMode = false; - it('should show correct rows per page options in dropdown', () => { - const first = 0; - const rows = 10; - const totalRecords = 100; - const onLazyLoad = jest.fn(); - const isInEditMode = false; + const result = render( + + ); - const result = render( - - ); + const dropdownButton = result.getAllByText('10')[1]; + fireEvent.click(dropdownButton); - const dropdownButton = result.getAllByText('10')[1]; - fireEvent.click(dropdownButton); + expect(result.getByText('20')).toBeInTheDocument(); + expect(result.getByText('50')).toBeInTheDocument(); + expect(result.getByText('100')).toBeInTheDocument(); + expect(result.getByText('250')).toBeInTheDocument(); + expect(result.getByText('1000')).toBeInTheDocument(); + }); - expect(result.getByText('20')).toBeInTheDocument(); - expect(result.getByText('50')).toBeInTheDocument(); - expect(result.getByText('100')).toBeInTheDocument(); - expect(result.getByText('250')).toBeInTheDocument(); - expect(result.getByText('1000')).toBeInTheDocument(); - }); + it('should handle null or undefined totalRecords, first, and last', () => { + const onLazyLoad = jest.fn(); - it('should handle null or undefined totalRecords, first, and last', () => { - const onLazyLoad = jest.fn(); - - const result = render( - - ); - - expect(result.getByText(/Showing 0 to 0 of/i)).toBeInTheDocument(); - }); - - it('should not render Paginator when isInEditMode is true', () => { - const onLazyLoad = jest.fn(); - const result = render( - - ); + const result = render( + + ); - const paginator = result.queryByTestId('datatable-footer'); - expect(paginator).toBeNull(); - }); + expect(result.getByText(/Showing 0 to 0 of/i)).toBeInTheDocument(); + }); + + it('should not render Paginator when isInEditMode is true', () => { + const onLazyLoad = jest.fn(); + const result = render( + + ); + + const paginator = result.queryByTestId('datatable-footer'); + expect(paginator).toBeNull(); + }); }); diff --git a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js index 3e1e92436..e12fdeb75 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityListTemplate.test.js @@ -171,21 +171,4 @@ describe('GenomicEntityListTemplate', () => { expect(genomicEntity2).toBeInTheDocument(); expect(genomicEntity3).toBeInTheDocument(); }); - it('should render genomicEntities and curie in a tooltip when genomicEntity has alleleSymbol', async () => { - const genomicEntities = [ - { alleleSymbol: { displayText: 'Allele Symbol C' }, curie: 'ID1' }, - { alleleSymbol: { displayText: 'Allele Symbol A' }, modEntityId: 'ID2' }, - { alleleSymbol: { displayText: 'Allele Symbol B' }, modInternalId: 'ID3' }, - ]; - - const result = render(); - - let listContentArray = result.getAllByText('Allele Symbol A (ID2)'); - expect(listContentArray).toHaveLength(1); - - fireEvent.mouseEnter(result.container.firstChild); - - //using find... here because it's async and the tooltip is dynamically added - expect(await result.findAllByText('Allele Symbol A (ID2)')).toHaveLength(2); - }); }); diff --git a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js index 6f4c7045c..e4f9f5795 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/GenomicEntityTemplate.test.js @@ -89,24 +89,6 @@ describe('GenomicEntityTemplate', () => { expect(container.firstChild).toBeNull(); }); - it('should render genomicEntity text and id in a tooltip when genomicEntity has geneSymbol', async () => { - const genomicEntity = { - geneSymbol: { - displayText: 'Gene Symbol', - }, - modInternalId: 'ID', - }; - - const result = render(); - - let divContentArray = result.getAllByText('Gene Symbol (ID)'); - expect(divContentArray).toHaveLength(1); - - fireEvent.mouseEnter(divContentArray[0]); - //using find... here because it's async and the tooltip is dynamically added - expect(await result.findAllByText('Gene Symbol (ID)')).toHaveLength(2); - }); - it('should render tags in the HTML', async () => { const genomicEntity = { geneSymbol: { diff --git a/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js b/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js index 5bcc86af8..ec76ab640 100644 --- a/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js +++ b/src/main/cliapp/src/components/Templates/__tests__/NumberTemplate.test.js @@ -3,61 +3,60 @@ import '../../../tools/jest/setupTests'; import { NumberTemplate } from '../NumberTemplate'; describe('NumberTemplate', () => { + it('should format positive integers correctly', () => { + const number = 12345; + const result = NumberTemplate({ number }); + expect(result).toBe('12,345'); + }); - it('should format positive integers correctly', () => { - const number = 12345; - const result = NumberTemplate({ number }); - expect(result).toBe('12,345'); - }); + it('should format negative integers correctly', () => { + const number = -1000; + const formattedNumber = NumberTemplate({ number }); - it('should format negative integers correctly', () => { - const number = -1000; - const formattedNumber = NumberTemplate({ number }); + expect(formattedNumber).toBe('-1,000'); + }); - expect(formattedNumber).toBe('-1,000'); - }); + it('should format positive floating-point numbers correctly', () => { + const number = 1234.56; + const formattedNumber = NumberTemplate({ number }); - it('should format positive floating-point numbers correctly', () => { - const number = 1234.56; - const formattedNumber = NumberTemplate({ number }); + expect(formattedNumber).toBe('1,234.56'); + }); - expect(formattedNumber).toBe('1,234.56'); - }); + it('should format negative floating-point numbers correctly', () => { + const number = -1234.5678; + const formattedNumber = NumberTemplate({ number }); - it('should format negative floating-point numbers correctly', () => { - const number = -1234.5678; - const formattedNumber = NumberTemplate({ number }); + expect(formattedNumber).toBe('-1,234.568'); + }); - expect(formattedNumber).toBe('-1,234.568'); - }); + it('should return formatted number when input is zero', () => { + const number = 0; - it('should return formatted number when input is zero', () => { - const number = 0; + const result = NumberTemplate({ number }); - const result = NumberTemplate({ number }); + expect(result).toBe('0'); + }); - expect(result).toBe('0'); - }); + it('should handle very large numbers correctly', () => { + const number = 1000000000000000000000000000000; - it('should handle very large numbers correctly', () => { - const number = 1000000000000000000000000000000; + const result = NumberTemplate({ number }); - const result = NumberTemplate({ number }); + expect(result).toBe('1,000,000,000,000,000,000,000,000,000,000'); + }); - expect(result).toBe('1,000,000,000,000,000,000,000,000,000,000'); - }); + it('should handle string representations of numbers correctly', () => { + const number = '1000'; - it('should handle string representations of numbers correctly', () => { - const number = '1000'; + const result = NumberTemplate({ number }); - const result = NumberTemplate({ number }); + expect(result).toBe('1,000'); + }); - expect(result).toBe('1,000'); - }); - - it('should return undefined when number is null', () => { - const number = null; - const result = NumberTemplate({ number }); - expect(result).toBeUndefined(); - }); + it('should return undefined when number is null', () => { + const number = null; + const result = NumberTemplate({ number }); + expect(result).toBeUndefined(); + }); }); diff --git a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js index a8730cce4..e3286371d 100644 --- a/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js +++ b/src/main/cliapp/src/components/Templates/genomicEntity/GenomicEntityTemplate.js @@ -18,7 +18,7 @@ export const GenomicEntityTemplate = ({ genomicEntity }) => { __html: `${subjectText} (${indentifier})`, }} /> - +
{ __html: refString, }} /> - +
{ field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js index 21cdd9ee5..a99c8570d 100644 --- a/src/main/cliapp/src/containers/allelesPage/AllelesTable.js +++ b/src/main/cliapp/src/containers/allelesPage/AllelesTable.js @@ -1107,7 +1107,7 @@ export const AllelesTable = () => { field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, editor: (props) => , }, @@ -1201,7 +1201,7 @@ export const AllelesTable = () => { field: 'inCollection.name', header: 'In Collection', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.inCollectionFilterConfig, editor: (props) => , }, diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 514471eb1..4860018d6 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -531,8 +531,6 @@ export const DataLoadsComponent = () => { ); }; - - const countsTemplate = (rowData) => { let countsArray = []; for (let count in rowData.counts) { @@ -542,10 +540,14 @@ export const DataLoadsComponent = () => { return ( - }/> - } /> - } /> - } /> + } + /> + } /> + } /> + } /> ); }; @@ -570,7 +572,7 @@ export const DataLoadsComponent = () => { } + body={(rowData) => } /> diff --git a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js index a7b91f77e..414dd7ee0 100644 --- a/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js +++ b/src/main/cliapp/src/containers/experimentalConditionsPage/ExperimentalConditionsTable.js @@ -82,7 +82,7 @@ export const ExperimentalConditionsTable = () => { updatedAnnotations[props.rowIndex].internal = JSON.parse(event.value.name); } }; - + const internalEditor = (props) => { return ( <> @@ -181,7 +181,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionClass.name', header: 'Class', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionClassFilterConfig, editor: (props) => conditionClassEditorTemplate(props, curieAutocompleteFields), }, @@ -189,7 +189,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionId.name', header: 'Condition Term', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionIdFilterConfig, editor: (props) => singleOntologyEditorTemplate( @@ -203,7 +203,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionGeneOntology.name', header: 'Gene Ontology', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionGeneOntologyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionGeneOntology', 'goterm', curieAutocompleteFields), @@ -212,7 +212,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionChemical.name', header: 'Chemical', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionChemicalFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionChemical', 'chemicalterm', curieAutocompleteFields), @@ -221,7 +221,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionAnatomy.name', header: 'Anatomy', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionAnatomyFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionAnatomy', 'anatomicalterm', curieAutocompleteFields), @@ -230,7 +230,7 @@ export const ExperimentalConditionsTable = () => { field: 'conditionTaxon.name', header: 'Condition Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.conditionTaxonFilterConfig, editor: (props) => singleOntologyEditorTemplate(props, 'conditionTaxon', 'ncbitaxonterm', curieAutocompleteFields), diff --git a/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js b/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js index 8c0a138ca..31be4e215 100644 --- a/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js +++ b/src/main/cliapp/src/containers/geneGeneticInteractionsPage/GeneGeneticInteractionsTable.js @@ -83,7 +83,7 @@ export const GeneGeneticInteractionsTable = () => { field: 'relation.name', header: 'Interaction Relation', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.gmiRelationFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js b/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js index 8fd8f2572..58a0ea749 100644 --- a/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js +++ b/src/main/cliapp/src/containers/geneMolecularInteractionsPage/GeneMolecularInteractionsTable.js @@ -77,7 +77,7 @@ export const GeneMolecularInteractionsTable = () => { field: 'relation.name', header: 'Interaction Relation', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.gmiRelationFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/genesPage/GenesTable.js b/src/main/cliapp/src/containers/genesPage/GenesTable.js index f7c4a3a5c..73caadb6d 100644 --- a/src/main/cliapp/src/containers/genesPage/GenesTable.js +++ b/src/main/cliapp/src/containers/genesPage/GenesTable.js @@ -205,7 +205,7 @@ export const GenesTable = () => { field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filter: true, filterConfig: FILTER_CONFIGS.taxonFilterConfig, }, From b7b509beecb5266d09b5070e4d0ab220145c76a6 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Wed, 25 Sep 2024 12:52:07 -0500 Subject: [PATCH 253/342] SCRUM-3757 update ControlledVocabularyTable body templates --- .../Templates/StringListTemplate.js | 2 +- .../ControlledVocabularyTable.js | 44 ++++--------------- 2 files changed, 10 insertions(+), 36 deletions(-) diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 455620d27..3037b8a8a 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -21,7 +21,7 @@ export const StringListTemplate = ({ list }) => {
- + diff --git a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js index aa5955cf2..383b1177b 100644 --- a/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js +++ b/src/main/cliapp/src/containers/controlledVocabularyPage/ControlledVocabularyTable.js @@ -19,6 +19,9 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { SearchService } from '../../service/SearchService'; import { setNewEntity } from '../../utils/utils'; import { StringListTemplate } from '../../components/Templates/StringListTemplate'; +import { StringTemplate } from '../../components/Templates/StringTemplate'; +import { IdTemplate } from '../../components/Templates/IdTemplate'; +import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; export const ControlledVocabularyTable = () => { const newTermReducer = (state, action) => { @@ -184,41 +187,12 @@ export const ControlledVocabularyTable = () => { ); }; - const nameBodyTemplate = (rowData) => { - if (rowData.name) { - return
{rowData.name}
; - } - }; - - const abbreviationBodyTemplate = (rowData) => { - if (rowData.abbreviation) { - return
{rowData.abbreviation}
; - } - }; - - const vocabularyBodyTemplate = (rowData) => { - if (rowData.vocabulary && rowData.vocabulary.name) { - return
{rowData.vocabulary.name}
; - } - }; - - const definitionBodyTemplate = (rowData) => { - if (rowData.definition) { - return
{rowData.definition}
; - } - }; - - const obsoleteBodyTemplate = (rowData) => { - if (rowData && rowData.obsolete !== null && rowData.obsolete !== undefined) { - return
{JSON.stringify(rowData.obsolete)}
; - } - }; - const columns = [ { field: 'id', header: 'Id', sortable: false, + body: (rowData) => , }, { field: 'name', @@ -226,7 +200,7 @@ export const ControlledVocabularyTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.nameFilterConfig, editor: (props) => nameEditorTemplate(props), - body: nameBodyTemplate, + body: (rowData) => , }, { field: 'abbreviation', @@ -234,7 +208,7 @@ export const ControlledVocabularyTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.abbreviationFilterConfig, editor: (props) => abbreviationEditorTemplate(props), - body: abbreviationBodyTemplate, + body: (rowData) => , }, { field: 'synonyms', @@ -249,7 +223,7 @@ export const ControlledVocabularyTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.vocabularyNameFilterConfig, editor: (props) => vocabularyEditorTemplate(props), - body: vocabularyBodyTemplate, + body: (rowData) => , }, { field: 'definition', @@ -257,7 +231,7 @@ export const ControlledVocabularyTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.definitionFilterConfig, editor: (props) => definitionEditorTemplate(props), - body: definitionBodyTemplate, + body: (rowData) => , }, { field: 'obsolete', @@ -265,7 +239,7 @@ export const ControlledVocabularyTable = () => { sortable: true, filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, editor: (props) => obsoleteEditorTemplate(props), - body: obsoleteBodyTemplate, + body: (rowData) => , }, ]; From 5c97d3627f5fcbc3f8ceac987a961080637c9fea Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 25 Sep 2024 21:31:03 -0500 Subject: [PATCH 254/342] Fix to re-enable downloading of exception messages --- .../cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 4860018d6..a1bb6f96b 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -239,7 +239,7 @@ export const DataLoadsComponent = () => { }*/} - {rowData.failedRecords > 0 && ( + {rowData.counts?.Records?.failed !== undefined && ( - ); - } - }; - const relatedNotesEditor = (props) => { if (props?.rowData?.relatedNotes) { return ( @@ -233,33 +167,36 @@ export const VariantsTable = () => { field: 'curie', header: 'Curie', sortable: { isInEditMode }, + body: (rowData) => , filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { field: 'modEntityId', header: 'MOD Entity ID', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { field: 'modInternalId', header: 'MOD Internal ID', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { field: 'taxon.name', header: 'Taxon', - body: taxonTemplate, sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, editor: (props) => , }, { field: 'variantType.name', header: 'Variant Type', - body: variantTypeTemplate, sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.variantTypeFilterConfig, editor: (props) => , }, @@ -267,22 +204,23 @@ export const VariantsTable = () => { field: 'variantStatus.name', header: 'Variant Status', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.variantStatusFilterConfig, editor: (props) => variantStatusEditor(props), }, { field: 'relatedNotes.freeText', header: 'Related Notes', - body: relatedNotesTemplate, sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, editor: relatedNotesEditor, }, { field: 'sourceGeneralConsequence.name', header: 'Source General Consequence', - body: sourceGeneralConsequenceTemplate, sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.sourceGeneralConsequenceFilterConfig, editor: (props) => , }, @@ -290,6 +228,7 @@ export const VariantsTable = () => { field: 'dataProvider.sourceOrganization.abbreviation', header: 'Data Provider', sortable: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.variantDataProviderFilterConfig, }, { @@ -339,8 +278,8 @@ export const VariantsTable = () => { { field: 'internal', header: 'Internal', - body: internalTemplate, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.internalFilterConfig, sortable: true, editor: (props) => ( @@ -350,8 +289,8 @@ export const VariantsTable = () => { { field: 'obsolete', header: 'Obsolete', - body: obsoleteTemplate, filter: true, + body: (rowData) => , filterConfig: FILTER_CONFIGS.obsoleteFilterConfig, sortable: true, editor: (props) => ( From a53554a26668a4af066e1892280826cc45dc83ec Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 27 Sep 2024 11:39:48 -0500 Subject: [PATCH 274/342] UI formatting --- .../src/components/Templates/IdTemplate.js | 2 +- .../components/Templates/ObjectListTemplate.js | 2 +- .../components/Templates/StringListTemplate.js | 3 +-- .../src/components/Templates/StringTemplate.js | 2 +- .../containers/moleculesPage/MoleculesTable.js | 14 +++++++------- .../ontologies/GeneralOntologyComponent.js | 6 +++--- .../ResourceDescriptorsTable.js | 12 ++++++------ .../ResourceDescriptorPagesTable.js | 8 ++++---- .../src/containers/variantsPage/VariantsTable.js | 16 +++++++++------- .../vocabularyPage/VocabulariesTable.js | 7 +++---- .../VocabularyTermSetTable.js | 12 +++++------- 11 files changed, 41 insertions(+), 43 deletions(-) diff --git a/src/main/cliapp/src/components/Templates/IdTemplate.js b/src/main/cliapp/src/components/Templates/IdTemplate.js index f3139db85..9012d887c 100644 --- a/src/main/cliapp/src/components/Templates/IdTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdTemplate.js @@ -10,7 +10,7 @@ export const IdTemplate = ({ id }) => { return ( <> {id} - + ); }; diff --git a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js index 2bb2ab4e3..1661c28a0 100644 --- a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js +++ b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js @@ -19,7 +19,7 @@ export const ObjectListTemplate = ({ list, sortMethod, stringTemplate, showBulle
- + diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index f6a9518dc..691708d54 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -3,7 +3,6 @@ import { ListTableCell } from '../ListTableCell'; import { Tooltip } from 'primereact/tooltip'; import 'primeflex/primeflex.css'; - export const StringListTemplate = ({ list }) => { if (!list || list.length === 0) return null; @@ -23,7 +22,7 @@ export const StringListTemplate = ({ list }) => {
- + diff --git a/src/main/cliapp/src/components/Templates/StringTemplate.js b/src/main/cliapp/src/components/Templates/StringTemplate.js index 4f2c89d5f..4fcfeccc0 100644 --- a/src/main/cliapp/src/components/Templates/StringTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringTemplate.js @@ -10,7 +10,7 @@ export const StringTemplate = ({ string }) => { className={`overflow-hidden text-overflow-ellipsis ${targetClass}`} dangerouslySetInnerHTML={{ __html: string }} /> - +
diff --git a/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js b/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js index a67923a79..a53fd8d90 100644 --- a/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js +++ b/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js @@ -28,7 +28,7 @@ export const MoleculesTable = () => { header: 'Curie', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { @@ -36,7 +36,7 @@ export const MoleculesTable = () => { header: 'Name', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.nameFilterConfig, }, { @@ -44,7 +44,7 @@ export const MoleculesTable = () => { header: 'InChi', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.inchiFilterConfig, }, { @@ -52,7 +52,7 @@ export const MoleculesTable = () => { header: 'InChiKey', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.inchiKeyFilterConfig, }, { @@ -60,7 +60,7 @@ export const MoleculesTable = () => { header: 'IUPAC', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.iupacFilterConfig, }, { @@ -68,7 +68,7 @@ export const MoleculesTable = () => { header: 'Formula', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.formulaFilterConfig, }, { @@ -76,7 +76,7 @@ export const MoleculesTable = () => { header: 'SMILES', sortable: true, filter: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.smilesFilterConfig, }, ]; diff --git a/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js b/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js index 13d801074..04fa2b632 100644 --- a/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js +++ b/src/main/cliapp/src/containers/ontologies/GeneralOntologyComponent.js @@ -34,7 +34,7 @@ export const GeneralOntologyComponent = ({ name, endpoint, showNamespace, showAb field: 'curie', header: 'Curie', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.curieFilterConfig, }); columns.push({ @@ -74,7 +74,7 @@ export const GeneralOntologyComponent = ({ name, endpoint, showNamespace, showAb columns.push({ field: 'synonyms.name', header: 'Synonyms', - body: (rowData) => synonym?.name)}/>, + body: (rowData) => synonym?.name)} />, sortable: true, filterConfig: FILTER_CONFIGS.ontologySynonymsFilterConfig, }); @@ -82,7 +82,7 @@ export const GeneralOntologyComponent = ({ name, endpoint, showNamespace, showAb field: 'secondaryIdentifiers', header: 'Secondary IDs', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.secondaryIdsFilterConfig, }); columns.push({ diff --git a/src/main/cliapp/src/containers/resourceDescriptorPage/ResourceDescriptorsTable.js b/src/main/cliapp/src/containers/resourceDescriptorPage/ResourceDescriptorsTable.js index 8cfb01bea..dfaa2f640 100644 --- a/src/main/cliapp/src/containers/resourceDescriptorPage/ResourceDescriptorsTable.js +++ b/src/main/cliapp/src/containers/resourceDescriptorPage/ResourceDescriptorsTable.js @@ -27,41 +27,41 @@ export const ResourceDescriptorsTable = () => { field: 'prefix', header: 'Prefix', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.prefixFilterConfig, }, { field: 'name', header: 'Name', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.nameFilterConfig, }, { field: 'synonyms', header: 'Synonyms', - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.synonymsFilterConfig, }, { field: 'idPattern', header: 'ID Pattern', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.idPatternFilterConfig, }, { field: 'idExample', header: 'ID Example', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.idExampleFilterConfig, }, { field: 'defaultUrlTemplate', header: 'Default URL Template', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.defaultUrlTemplateFilterConfig, }, ]; diff --git a/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js b/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js index 6e5543774..f6ec8d312 100644 --- a/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js +++ b/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js @@ -26,28 +26,28 @@ export const ResourceDescriptorPagesTable = () => { field: 'resourceDescriptor.prefix', header: 'Resource Descriptor', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.resourceDescriptorFilterConfig, }, { field: 'name', header: 'Name', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.nameFilterConfig, }, { field: 'urlTemplate', header: 'URL Template', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.urlTemplateFilterConfig, }, { field: 'pageDescription', header: 'Page Description', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.pageDescriptionFilterConfig, }, ]; diff --git a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js index 1293eeac9..36712327f 100644 --- a/src/main/cliapp/src/containers/variantsPage/VariantsTable.js +++ b/src/main/cliapp/src/containers/variantsPage/VariantsTable.js @@ -167,28 +167,28 @@ export const VariantsTable = () => { field: 'curie', header: 'Curie', sortable: { isInEditMode }, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.curieFilterConfig, }, { field: 'modEntityId', header: 'MOD Entity ID', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.modentityidFilterConfig, }, { field: 'modInternalId', header: 'MOD Internal ID', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.modinternalidFilterConfig, }, { field: 'taxon.name', header: 'Taxon', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.taxonFilterConfig, editor: (props) => , }, @@ -196,7 +196,7 @@ export const VariantsTable = () => { field: 'variantType.name', header: 'Variant Type', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.variantTypeFilterConfig, editor: (props) => , }, @@ -212,7 +212,9 @@ export const VariantsTable = () => { field: 'relatedNotes.freeText', header: 'Related Notes', sortable: true, - body: (rowData) => , + body: (rowData) => ( + + ), filterConfig: FILTER_CONFIGS.relatedNotesFilterConfig, editor: relatedNotesEditor, }, @@ -220,7 +222,7 @@ export const VariantsTable = () => { field: 'sourceGeneralConsequence.name', header: 'Source General Consequence', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.sourceGeneralConsequenceFilterConfig, editor: (props) => , }, diff --git a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js index 1c690d083..ca05294e8 100644 --- a/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js +++ b/src/main/cliapp/src/containers/vocabularyPage/VocabulariesTable.js @@ -19,7 +19,6 @@ import { setNewEntity } from '../../utils/utils'; import { StringTemplate } from '../../components/Templates/StringTemplate'; import { BooleanTemplate } from '../../components/Templates/BooleanTemplate'; - export const VocabulariesTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); const [totalRecords, setTotalRecords] = useState(0); @@ -81,7 +80,7 @@ export const VocabulariesTable = () => { field: 'name', header: 'Name', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.nameFilterConfig, editor: (props) => stringEditor(props, 'name'), }, @@ -89,7 +88,7 @@ export const VocabulariesTable = () => { field: 'vocabularyDescription', header: 'Description', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.vocabularyDescriptionFilterConfig, editor: (props) => stringEditor(props, 'vocabularyDescription'), }, @@ -105,7 +104,7 @@ export const VocabulariesTable = () => { field: 'vocabularyLabel', header: 'Label', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.vocabularyLabelFilterConfig, }, ]; diff --git a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js index 8a4aaa2ca..04b9df0b5 100644 --- a/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js +++ b/src/main/cliapp/src/containers/vocabularyTermSetPage/VocabularyTermSetTable.js @@ -28,7 +28,6 @@ import { useGetUserSettings } from '../../service/useGetUserSettings'; import { StringTemplate } from '../../components/Templates/StringTemplate'; import { StringListTemplate } from '../../components/Templates/StringListTemplate'; - export const VocabularyTermSetTable = () => { const [isInEditMode, setIsInEditMode] = useState(false); const [totalRecords, setTotalRecords] = useState(0); @@ -97,7 +96,6 @@ export const VocabularyTermSetTable = () => { ); }; - const onMemberTermsChange = (event, setFieldValue, props) => { multipleAutocompleteOnChange(props, event, 'memberTerms', setFieldValue); }; @@ -169,7 +167,7 @@ export const VocabularyTermSetTable = () => { { field: 'name', header: 'Name', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.nameFilterConfig, editor: (props) => nameEditor(props), @@ -178,7 +176,7 @@ export const VocabularyTermSetTable = () => { field: 'vocabularyTermSetVocabulary.name', header: 'Vocabulary', sortable: true, - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.vocabularyFieldSetFilterConfig, editor: (props) => vocabularyEditorTemplate(props), }, @@ -186,14 +184,14 @@ export const VocabularyTermSetTable = () => { field: 'memberTerms.name', header: 'Member Terms', sortable: true, - body: (rowData) => memberTerm?.name)}/>, + body: (rowData) => memberTerm?.name)} />, filterConfig: FILTER_CONFIGS.vocabularyMemberTermsFilterConfig, editor: (props) => memberTermsEditorTemplate(props), }, { field: 'vocabularyTermSetDescription', header: 'Description', - body: (rowData) => , + body: (rowData) => , sortable: true, filterConfig: FILTER_CONFIGS.vocabularyTermSetDescriptionFilterConfig, editor: (props) => descriptionEditor(props), @@ -201,7 +199,7 @@ export const VocabularyTermSetTable = () => { { field: 'vocabularyLabel', header: 'Label', - body: (rowData) => , + body: (rowData) => , filterConfig: FILTER_CONFIGS.vocabularyLabelFilterConfig, }, ]; From f2da05186b159e7a50adc93fccef72138ed64f29 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 27 Sep 2024 12:12:39 -0500 Subject: [PATCH 275/342] update test --- .../ResourceDescriptorPagesTable.js | 4 +++- .../__tests__/ResourceDescriptorPagesTable.test.js | 8 ++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js b/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js index f6ec8d312..8d182fcfd 100644 --- a/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js +++ b/src/main/cliapp/src/containers/resourceDescriptorPagePage/ResourceDescriptorPagesTable.js @@ -26,7 +26,9 @@ export const ResourceDescriptorPagesTable = () => { field: 'resourceDescriptor.prefix', header: 'Resource Descriptor', sortable: true, - body: (rowData) => , + body: (rowData) => ( + + ), filterConfig: FILTER_CONFIGS.resourceDescriptorFilterConfig, }, { diff --git a/src/main/cliapp/src/containers/resourceDescriptorPagePage/__tests__/ResourceDescriptorPagesTable.test.js b/src/main/cliapp/src/containers/resourceDescriptorPagePage/__tests__/ResourceDescriptorPagesTable.test.js index 4a9c84601..3aa63e60a 100644 --- a/src/main/cliapp/src/containers/resourceDescriptorPagePage/__tests__/ResourceDescriptorPagesTable.test.js +++ b/src/main/cliapp/src/containers/resourceDescriptorPagePage/__tests__/ResourceDescriptorPagesTable.test.js @@ -38,12 +38,12 @@ describe('', () => { it('The table contains correct data', async () => { let result = await renderWithClient(); - const prefixTd = await result.findByText(/ZFIN_prefix/i); - const nameTd = await result.findByText(/ZFIN_name/i); + const resourceDescriptorTd = await result.findByText('ZFIN_prefix (ZFIN_name)'); + const nameTd = await result.findByText('gene/wild_type_expression'); const urlTemplateTd = await result.findByText('https://zfin.org/[%s]/wt-expression'); - const pageDescriptionTd = await result.findByText(/Wild type expression data/i); + const pageDescriptionTd = await result.findByText('Wild type expression data'); await waitFor(() => { - expect(prefixTd).toBeInTheDocument(); + expect(resourceDescriptorTd).toBeInTheDocument(); expect(nameTd).toBeInTheDocument(); expect(urlTemplateTd).toBeInTheDocument(); expect(pageDescriptionTd).toBeInTheDocument(); From 65cba7d6e20e538d4b894d8da2fd3cd9f985c4be Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Mon, 30 Sep 2024 14:12:21 -0500 Subject: [PATCH 276/342] update tooltip css --- src/main/cliapp/src/components/Templates/IdTemplate.js | 3 ++- .../cliapp/src/components/Templates/ObjectListTemplate.js | 2 +- .../cliapp/src/components/Templates/StringListTemplate.js | 4 ++-- src/main/cliapp/src/components/Templates/StringTemplate.js | 3 ++- src/main/cliapp/src/components/Templates/styles.scss | 3 +++ 5 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 src/main/cliapp/src/components/Templates/styles.scss diff --git a/src/main/cliapp/src/components/Templates/IdTemplate.js b/src/main/cliapp/src/components/Templates/IdTemplate.js index 9012d887c..1a847faad 100644 --- a/src/main/cliapp/src/components/Templates/IdTemplate.js +++ b/src/main/cliapp/src/components/Templates/IdTemplate.js @@ -1,5 +1,6 @@ import { EllipsisTableCell } from '../EllipsisTableCell'; import { Tooltip } from 'primereact/tooltip'; +import './styles.scss'; export const IdTemplate = ({ id }) => { if (!id) return null; @@ -10,7 +11,7 @@ export const IdTemplate = ({ id }) => { return ( <> {id} - + ); }; diff --git a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js index 1661c28a0..91546c6e8 100644 --- a/src/main/cliapp/src/components/Templates/ObjectListTemplate.js +++ b/src/main/cliapp/src/components/Templates/ObjectListTemplate.js @@ -19,7 +19,7 @@ export const ObjectListTemplate = ({ list, sortMethod, stringTemplate, showBulle
- + diff --git a/src/main/cliapp/src/components/Templates/StringListTemplate.js b/src/main/cliapp/src/components/Templates/StringListTemplate.js index 691708d54..b025bf0b9 100644 --- a/src/main/cliapp/src/components/Templates/StringListTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringListTemplate.js @@ -1,7 +1,7 @@ import { EllipsisTableCell } from '../EllipsisTableCell'; import { ListTableCell } from '../ListTableCell'; import { Tooltip } from 'primereact/tooltip'; -import 'primeflex/primeflex.css'; +import './styles.scss'; export const StringListTemplate = ({ list }) => { if (!list || list.length === 0) return null; @@ -22,7 +22,7 @@ export const StringListTemplate = ({ list }) => {
- + diff --git a/src/main/cliapp/src/components/Templates/StringTemplate.js b/src/main/cliapp/src/components/Templates/StringTemplate.js index 4fcfeccc0..91e3df857 100644 --- a/src/main/cliapp/src/components/Templates/StringTemplate.js +++ b/src/main/cliapp/src/components/Templates/StringTemplate.js @@ -1,5 +1,6 @@ import React from 'react'; import { Tooltip } from 'primereact/tooltip'; +import './styles.scss'; export const StringTemplate = ({ string }) => { const targetClass = `a${global.crypto.randomUUID()}`; @@ -10,7 +11,7 @@ export const StringTemplate = ({ string }) => { className={`overflow-hidden text-overflow-ellipsis ${targetClass}`} dangerouslySetInnerHTML={{ __html: string }} /> - +
diff --git a/src/main/cliapp/src/components/Templates/styles.scss b/src/main/cliapp/src/components/Templates/styles.scss new file mode 100644 index 000000000..c10eddbc5 --- /dev/null +++ b/src/main/cliapp/src/components/Templates/styles.scss @@ -0,0 +1,3 @@ +.tooltip { + max-width: 25rem; +} \ No newline at end of file From 9f7fc7e01a56644b609603b65b8a3d8af3026de2 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 30 Sep 2024 23:25:44 +0100 Subject: [PATCH 277/342] Pull out DA / PA tables --- .../model/entities/AGMDiseaseAnnotation.java | 24 +- .../entities/AGMPhenotypeAnnotation.java | 18 +- .../entities/AlleleDiseaseAnnotation.java | 23 +- .../entities/AllelePhenotypeAnnotation.java | 18 +- .../model/entities/Annotation.java | 8 +- .../model/entities/DiseaseAnnotation.java | 48 +- .../model/entities/GeneDiseaseAnnotation.java | 17 - .../entities/GeneGeneticInteraction.java | 6 +- .../model/entities/GeneInteraction.java | 4 +- .../entities/GenePhenotypeAnnotation.java | 12 - .../model/entities/PhenotypeAnnotation.java | 25 +- .../ConstructGenomicEntityAssociation.java | 6 +- ...37.0.51__mappersuperclass__assocations.sql | 270 ++------- ...37.0.52__mappersuperclass__assocations.sql | 8 +- ...37.0.53__mappersuperclass__assocations.sql | 100 ++-- ...37.0.54__mappersuperclass__assocations.sql | 403 +++++--------- ...37.0.55__mappersuperclass__assocations.sql | 519 ++++++++---------- 17 files changed, 553 insertions(+), 956 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java index 16e3149e7..873fc46fb 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMDiseaseAnnotation.java @@ -37,24 +37,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) @Table(indexes = { - @Index(name = "AGMDiseaseAnnotation_internal_index", columnList = "internal"), - @Index(name = "AGMDiseaseAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "AGMDiseaseAnnotation_curie_index", columnList = "curie"), - @Index(name = "AGMDiseaseAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "AGMDiseaseAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "AGMDiseaseAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "AGMDiseaseAnnotation_negated_index", columnList = "negated"), - @Index(name = "AGMDiseaseAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "AGMDiseaseAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "AGMDiseaseAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "AGMDiseaseAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "AGMDiseaseAnnotation_annotationType_index", columnList = "annotationType_id"), - @Index(name = "AGMDiseaseAnnotation_diseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"), - @Index(name = "AGMDiseaseAnnotation_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"), - @Index(name = "AGMDiseaseAnnotation_geneticSex_index", columnList = "geneticSex_id"), - @Index(name = "AGMDiseaseAnnotation_relation_index", columnList = "relation_id"), - @Index(name = "AGMDiseaseAnnotation_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"), - @Index(name = "AGMDiseaseAnnotation_assertedAllele_index", columnList = "assertedAllele_id"), @Index(name = "AGMDiseaseAnnotation_diseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id"), @Index(name = "AGMDiseaseAnnotation_inferredAllele_index", columnList = "inferredAllele_id"), @Index(name = "AGMDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id") @@ -104,11 +86,11 @@ public class AGMDiseaseAnnotation extends DiseaseAnnotation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "agmdiseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "assertedgenes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "assertedgenes_id") + @Index(name = "agmdiseaseannotation_gene_agmda_index", columnList = "agmdiseaseannotation_id"), + @Index(name = "agmdiseaseannotation_gene_assertedgenes_index", columnList = "assertedgenes_id") } ) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java index b9a7a792e..a847152f0 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java @@ -36,18 +36,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) @Table(indexes = { - @Index(name = "AGMPhenotypeAnnotation_internal_index", columnList = "internal"), - @Index(name = "AGMPhenotypeAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "AGMPhenotypeAnnotation_curie_index", columnList = "curie"), - @Index(name = "AGMPhenotypeAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "AGMPhenotypeAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "AGMPhenotypeAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "AGMPhenotypeAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "AGMPhenotypeAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "AGMPhenotypeAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "AGMPhenotypeAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "AGMPhenotypeAnnotation_crossReference_index", columnList = "crossReference_id"), - @Index(name = "AGMPhenotypeAnnotation_relation_index", columnList = "relation_id"), @Index(name = "AGMPhenotypeAnnotation_assertedAllele_index", columnList = "assertedAllele_id"), @Index(name = "AGMPhenotypeAnnotation_inferredAllele_index", columnList = "inferredAllele_id"), @Index(name = "AGMPhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"), @@ -104,11 +92,11 @@ public class AGMPhenotypeAnnotation extends PhenotypeAnnotation { @Fetch(FetchMode.SELECT) @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "agmphenotypeannotation_id"), inverseJoinColumns = @JoinColumn(name = "assertedgenes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "assertedgenes_id") + @Index(name = "agmphenotypeannotation_gene_agmpa_index", columnList = "agmphenotypeannotation_id"), + @Index(name = "agmphenotypeannotation_gene_assertedgenes_index", columnList = "assertedgenes_id") } ) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java index 07434aff5..c373723fd 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AlleleDiseaseAnnotation.java @@ -37,23 +37,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) @Table(indexes = { - @Index(name = "AlleleDiseaseAnnotation_internal_index", columnList = "internal"), - @Index(name = "AlleleDiseaseAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "AlleleDiseaseAnnotation_curie_index", columnList = "curie"), - @Index(name = "AlleleDiseaseAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "AlleleDiseaseAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "AlleleDiseaseAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "AlleleDiseaseAnnotation_negated_index", columnList = "negated"), - @Index(name = "AlleleDiseaseAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "AlleleDiseaseAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "AlleleDiseaseAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "AlleleDiseaseAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "AlleleDiseaseAnnotation_annotationType_index", columnList = "annotationType_id"), - @Index(name = "AlleleDiseaseAnnotation_diseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"), - @Index(name = "AlleleDiseaseAnnotation_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"), - @Index(name = "AlleleDiseaseAnnotation_geneticSex_index", columnList = "geneticSex_id"), - @Index(name = "AlleleDiseaseAnnotation_relation_index", columnList = "relation_id"), - @Index(name = "AlleleDiseaseAnnotation_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"), @Index(name = "AlleleDiseaseAnnotation_diseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id"), @Index(name = "AlleleDiseaseAnnotation_inferredGene_index", columnList = "inferredGene_id") }) @@ -101,11 +84,11 @@ public class AlleleDiseaseAnnotation extends DiseaseAnnotation { @Fetch(FetchMode.SELECT) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "allelediseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "assertedgenes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "assertedgenes_id") + @Index(name = "allelediseaseannotation_gene_alleleda_index", columnList = "allelediseaseannotation_id"), + @Index(name = "allelediseaseannotation_gene_assertedgenes_index", columnList = "assertedgenes_id") } ) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java index 4ee671c8d..a20b9b2a0 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java @@ -36,18 +36,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) @Table(indexes = { - @Index(name = "AllelePhenotypeAnnotation_internal_index", columnList = "internal"), - @Index(name = "AllelePhenotypeAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "AllelePhenotypeAnnotation_curie_index", columnList = "curie"), - @Index(name = "AllelePhenotypeAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "AllelePhenotypeAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "AllelePhenotypeAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "AllelePhenotypeAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "AllelePhenotypeAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "AllelePhenotypeAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "AllelePhenotypeAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "AllelePhenotypeAnnotation_crossReference_index", columnList = "crossReference_id"), - @Index(name = "AllelePhenotypeAnnotation_relation_index", columnList = "relation_id"), @Index(name = "AllelePhenotypeAnnotation_inferredGene_index", columnList = "inferredGene_id"), @Index(name = "AllelePhenotypeAnnotation_phenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id") }) @@ -95,11 +83,11 @@ public class AllelePhenotypeAnnotation extends PhenotypeAnnotation { @Fetch(FetchMode.SELECT) @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "allelephenotypeannotation_id"), inverseJoinColumns = @JoinColumn(name = "assertedgenes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "assertedgenes_id") + @Index(name = "allelephenotypeannotation_gene_allelepa_index", columnList = "allelephenotypeannotation_id"), + @Index(name = "allelephenotypeannotation_gene_assertedgenes_index", columnList = "assertedgenes_id") } ) private List assertedGenes; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java index 92246136d..64a8a74b7 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Annotation.java @@ -72,10 +72,10 @@ public class Annotation extends SingleReferenceAssociation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "annotation_id"), inverseJoinColumns = @JoinColumn(name = "conditionRelations_id"), indexes = { - @Index(columnList = "association_id"), + @Index(columnList = "annotation_id"), @Index(columnList = "conditionRelations_id") } ) @@ -89,10 +89,10 @@ public class Annotation extends SingleReferenceAssociation { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "annotation_id"), inverseJoinColumns = @JoinColumn(name = "relatedNotes_id"), indexes = { - @Index(columnList = "association_id"), + @Index(columnList = "annotation_id"), @Index(columnList = "relatedNotes_id") } ) 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 71a332d87..3eff7ddc4 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 @@ -26,12 +26,13 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.persistence.Column; +import jakarta.persistence.Entity; import jakarta.persistence.Index; import jakarta.persistence.JoinColumn; import jakarta.persistence.JoinTable; import jakarta.persistence.ManyToMany; import jakarta.persistence.ManyToOne; -import jakarta.persistence.MappedSuperclass; +import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -42,11 +43,30 @@ @Type(value = AlleleDiseaseAnnotation.class, name = "AlleleDiseaseAnnotation"), @Type(value = GeneDiseaseAnnotation.class, name = "GeneDiseaseAnnotation") }) -@MappedSuperclass +@Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @AGRCurationSchemaVersion(min = "2.2.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"), + @Index(name = "DiseaseAnnotation_obsolete_index", columnList = "obsolete"), + @Index(name = "DiseaseAnnotation_curie_index", columnList = "curie"), + @Index(name = "DiseaseAnnotation_modEntityId_index", columnList = "modEntityId"), + @Index(name = "DiseaseAnnotation_modInternalId_index", columnList = "modInternalId"), + @Index(name = "DiseaseAnnotation_uniqueId_index", columnList = "uniqueId"), + @Index(name = "DiseaseAnnotation_diseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"), + @Index(name = "DiseaseAnnotation_negated_index", columnList = "negated"), + @Index(name = "DiseaseAnnotation_createdBy_index", columnList = "createdBy_id"), + @Index(name = "DiseaseAnnotation_updatedBy_index", columnList = "updatedBy_id"), + @Index(name = "DiseaseAnnotation_singleReference_index", columnList = "singleReference_id"), + @Index(name = "DiseaseAnnotation_dataProvider_index", columnList = "dataProvider_id"), + @Index(name = "DiseaseAnnotation_annotationType_index", columnList = "annotationType_id"), + @Index(name = "DiseaseAnnotation_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"), + @Index(name = "DiseaseAnnotation_geneticSex_index", columnList = "geneticSex_id"), + @Index(name = "DiseaseAnnotation_relation_index", columnList = "relation_id"), + @Index(name = "DiseaseAnnotation_secondaryDataProvider_index", columnList = "secondaryDataProvider_id") +}) public abstract class DiseaseAnnotation extends Annotation { @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", @@ -74,11 +94,11 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "diseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "evidencecodes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "evidencecodes_id") + @Index(name = "diseaseannotation_ontologyterm_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_ontologyterm_evidencecodes_index", columnList = "evidencecodes_id") } ) private List evidenceCodes; @@ -95,11 +115,11 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "diseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "with_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "with_id") + @Index(name = "diseaseannotation_gene_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_gene_with_index", columnList = "with_id") } ) private List with; @@ -115,11 +135,11 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "diseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "diseasequalifiers_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "diseasequalifiers_id") + @Index(name = "diseaseannotation_vocabularyterm_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_vocabularyterm_dq_index", columnList = "diseasequalifiers_id") } ) private List diseaseQualifiers; @@ -142,11 +162,11 @@ public abstract class DiseaseAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "diseaseannotation_id"), inverseJoinColumns = @JoinColumn(name = "diseasegeneticmodifiers_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "diseasegeneticmodifiers_id") + @Index(name = "diseaseannotation_biologicalentity_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_biologicalentity_dgm_index", columnList = "diseasegeneticmodifiers_id") } ) private List diseaseGeneticModifiers; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java index 926adc7b4..3c2617943 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneDiseaseAnnotation.java @@ -30,23 +30,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { DiseaseAnnotation.class }) @Table(indexes = { - @Index(name = "GeneDiseaseAnnotation_internal_index", columnList = "internal"), - @Index(name = "GeneDiseaseAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "GeneDiseaseAnnotation_curie_index", columnList = "curie"), - @Index(name = "GeneDiseaseAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "GeneDiseaseAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "GeneDiseaseAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "GeneDiseaseAnnotation_negated_index", columnList = "negated"), - @Index(name = "GeneDiseaseAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "GeneDiseaseAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "GeneDiseaseAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "GeneDiseaseAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "GeneDiseaseAnnotation_annotationType_index", columnList = "annotationType_id"), - @Index(name = "GeneDiseaseAnnotation_diseaseAnnotationObject_index", columnList = "diseaseAnnotationObject_id"), - @Index(name = "GeneDiseaseAnnotation_diseaseGeneticModifierRelation_index", columnList = "diseaseGeneticModifierRelation_id"), - @Index(name = "GeneDiseaseAnnotation_geneticSex_index", columnList = "geneticSex_id"), - @Index(name = "GeneDiseaseAnnotation_relation_index", columnList = "relation_id"), - @Index(name = "GeneDiseaseAnnotation_secondaryDataProvider_index", columnList = "secondaryDataProvider_id"), @Index(name = "GeneDiseaseAnnotation_diseaseAnnotationSubject_index", columnList = "diseaseAnnotationSubject_id"), @Index(name = "GeneDiseaseAnnotation_sgdStrainBackground_index", columnList = "sgdStrainBackground_id") }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java index 5d2e02f11..00b8a32f9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneGeneticInteraction.java @@ -94,10 +94,10 @@ public class GeneGeneticInteraction extends GeneInteraction { @ElementCollection @JsonView({View.FieldsAndLists.class, View.GeneInteractionView.class}) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "genegeneticinteraction_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "phenotypesOrTraits") + @Index(name = "genegeneticinteraction_phenotypesortraits_interaction_index", columnList = "genegeneticinteraction_id"), + @Index(name = "genegeneticinteraction_phenotypesortraits_pt_index", columnList = "phenotypesOrTraits") } ) private List phenotypesOrTraits; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java index a777fc5ce..ea9482c3d 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GeneInteraction.java @@ -58,10 +58,10 @@ public abstract class GeneInteraction extends GeneGeneAssociation { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.GeneInteractionView.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "geneinteraction_id"), inverseJoinColumns = @JoinColumn(name = "crossReferences_id"), indexes = { - @Index(columnList = "association_id"), + @Index(columnList = "geneinteraction_id"), @Index(columnList = "crossReferences_id") } ) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java index ee2270dfd..fa1469d80 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java @@ -29,18 +29,6 @@ @AGRCurationSchemaVersion(min = "2.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { PhenotypeAnnotation.class }) @Table(indexes = { - @Index(name = "GenePhenotypeAnnotation_internal_index", columnList = "internal"), - @Index(name = "GenePhenotypeAnnotation_obsolete_index", columnList = "obsolete"), - @Index(name = "GenePhenotypeAnnotation_curie_index", columnList = "curie"), - @Index(name = "GenePhenotypeAnnotation_modEntityId_index", columnList = "modEntityId"), - @Index(name = "GenePhenotypeAnnotation_modInternalId_index", columnList = "modInternalId"), - @Index(name = "GenePhenotypeAnnotation_uniqueId_index", columnList = "uniqueId"), - @Index(name = "GenePhenotypeAnnotation_createdBy_index", columnList = "createdBy_id"), - @Index(name = "GenePhenotypeAnnotation_updatedBy_index", columnList = "updatedBy_id"), - @Index(name = "GenePhenotypeAnnotation_singleReference_index", columnList = "singleReference_id"), - @Index(name = "GenePhenotypeAnnotation_dataProvider_index", columnList = "dataProvider_id"), - @Index(name = "GenePhenotypeAnnotation_crossReference_index", columnList = "crossReference_id"), - @Index(name = "GenePhenotypeAnnotation_relation_index", columnList = "relation_id"), @Index(name = "GenePhenotypeAnnotation_phenotypeAnnotationSubject_index", columnList = "phenotypeAnnotationSubject_id"), @Index(name = "GenePhenotypeAnnotation_sgdStrainBackground_index", columnList = "sgdStrainBackground_id") }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java index 29cee35e8..1019690d9 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java @@ -23,13 +23,14 @@ 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.ManyToMany; import jakarta.persistence.ManyToOne; -import jakarta.persistence.MappedSuperclass; import jakarta.persistence.OneToOne; +import jakarta.persistence.Table; import jakarta.persistence.Transient; import lombok.Data; import lombok.EqualsAndHashCode; @@ -37,11 +38,25 @@ @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = AGMPhenotypeAnnotation.class, name = "AGMPhenotypeAnnotation"), @Type(value = AllelePhenotypeAnnotation.class, name = "AllelePhenotypeAnnotation"), @Type(value = GenePhenotypeAnnotation.class, name = "GenePhenotypeAnnotation") }) -@MappedSuperclass +@Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @AGRCurationSchemaVersion(min = "2.2.3", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { Annotation.class }) @Schema(name = "Phenotype_Annotation", description = "Annotation class representing a phenotype annotation") +@Table(indexes = { + @Index(name = "PhenotypeAnnotation_internal_index", columnList = "internal"), + @Index(name = "PhenotypeAnnotation_obsolete_index", columnList = "obsolete"), + @Index(name = "PhenotypeAnnotation_curie_index", columnList = "curie"), + @Index(name = "PhenotypeAnnotation_modEntityId_index", columnList = "modEntityId"), + @Index(name = "PhenotypeAnnotation_modInternalId_index", columnList = "modInternalId"), + @Index(name = "PhenotypeAnnotation_uniqueId_index", columnList = "uniqueId"), + @Index(name = "PhenotypeAnnotation_createdBy_index", columnList = "createdBy_id"), + @Index(name = "PhenotypeAnnotation_updatedBy_index", columnList = "updatedBy_id"), + @Index(name = "PhenotypeAnnotation_singleReference_index", columnList = "singleReference_id"), + @Index(name = "PhenotypeAnnotation_dataProvider_index", columnList = "dataProvider_id"), + @Index(name = "PhenotypeAnnotation_crossReference_index", columnList = "crossReference_id"), + @Index(name = "PhenotypeAnnotation_relation_index", columnList = "relation_id") +}) public abstract class PhenotypeAnnotation extends Annotation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @@ -55,11 +70,11 @@ public abstract class PhenotypeAnnotation extends Annotation { @ManyToMany @JsonView({ View.FieldsAndLists.class, View.PhenotypeAnnotationView.class, View.ForPublic.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "phenotypeannotation_id"), inverseJoinColumns = @JoinColumn(name = "phenotypeTerms_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "phenotypeTerms_id") + @Index(name = "phenotypeannotation_ontologyterm_pa_index", columnList = "phenotypeannotation_id"), + @Index(name = "phenotypeannotation_ontologyterm_phenotypeterms_index", columnList = "phenotypeTerms_id") } ) private List phenotypeTerms; 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 716a244c1..b848b3b0c 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 @@ -86,11 +86,11 @@ public class ConstructGenomicEntityAssociation extends EvidenceAssociation { @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsAndLists.class, View.ConstructView.class }) @JoinTable( - joinColumns = @JoinColumn(name = "association_id"), + joinColumns = @JoinColumn(name = "constructgenomicentityassociation_id"), inverseJoinColumns = @JoinColumn(name = "relatedNotes_id"), indexes = { - @Index(columnList = "association_id"), - @Index(columnList = "relatedNotes_id") + @Index(name = "constructgeassociation_note_cgea_index", columnList = "constructgenomicentityassociation_id"), + @Index(name = "constructgeassociation_note_relatednotes_index", columnList = "relatedNotes_id") } ) private List relatedNotes; diff --git a/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql index c021ceca8..4041ac263 100644 --- a/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql @@ -1,186 +1,39 @@ CREATE TABLE agmdiseaseannotation ( id bigint PRIMARY KEY, - 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, - curie character varying(255), - modentityid character varying(255), - modinternalid character varying(255), - uniqueid character varying(3500), - negated boolean DEFAULT false NOT NULL, - createdby_id bigint, - updatedby_id bigint, - singlereference_id bigint, - dataprovider_id bigint, - annotationtype_id bigint, diseaseannotationobject_id bigint, - diseasegeneticmodifierrelation_id bigint, - geneticsex_id bigint, - relation_id bigint, - secondarydataprovider_id bigint, assertedallele_id bigint, diseaseannotationsubject_id bigint, inferredallele_id bigint, inferredgene_id bigint ); -CREATE TABLE agmdiseaseannotation_biologicalentity ( - association_id bigint NOT NULL, - diseasegeneticmodifiers_id bigint NOT NULL -); - -CREATE TABLE agmdiseaseannotation_conditionrelation ( - association_id bigint NOT NULL, - conditionrelations_id bigint NOT NULL -); - CREATE TABLE agmdiseaseannotation_gene ( - association_id bigint NOT NULL, - assertedgenes_id bigint, - with_id bigint -); - -CREATE TABLE agmdiseaseannotation_note ( - association_id bigint NOT NULL, - relatednotes_id bigint NOT NULL -); - -CREATE TABLE agmdiseaseannotation_ontologyterm ( - association_id bigint NOT NULL, - evidencecodes_id bigint NOT NULL -); - -CREATE SEQUENCE agmdiseaseannotation_seq - START WITH 1 - INCREMENT BY 50 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -CREATE TABLE agmdiseaseannotation_vocabularyterm ( - association_id bigint NOT NULL, - diseasequalifiers_id bigint NOT NULL -); + agmdiseaseannotation_id bigint NOT NULL, + assertedgenes_id bigint + ); CREATE TABLE agmphenotypeannotation ( id bigint PRIMARY KEY, - 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, - curie character varying(255), - modentityid character varying(255), - modinternalid character varying(255), - uniqueid character varying(3500), - phenotypeannotationobject character varying(255), - createdby_id bigint, - updatedby_id bigint, - singlereference_id bigint, - dataprovider_id bigint, - crossreference_id bigint, - relation_id bigint, assertedallele_id bigint, inferredallele_id bigint, inferredgene_id bigint, phenotypeannotationsubject_id bigint ); -CREATE TABLE agmphenotypeannotation_conditionrelation ( - association_id bigint NOT NULL, - conditionrelations_id bigint NOT NULL -); - CREATE TABLE agmphenotypeannotation_gene ( - association_id bigint NOT NULL, + agmphenotypeannotation_id bigint NOT NULL, assertedgenes_id bigint NOT NULL ); - -CREATE TABLE agmphenotypeannotation_note ( - association_id bigint NOT NULL, - relatednotes_id bigint NOT NULL -); - -CREATE TABLE agmphenotypeannotation_ontologyterm ( - association_id bigint NOT NULL, - phenotypeterms_id bigint NOT NULL -); - -CREATE SEQUENCE agmphenotypeannotation_seq - START WITH 1 - INCREMENT BY 50 - NO MINVALUE - NO MAXVALUE - CACHE 1; - CREATE TABLE allelediseaseannotation ( id bigint PRIMARY KEY, - 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, - curie character varying(255), - modentityid character varying(255), - modinternalid character varying(255), - uniqueid character varying(3500), - negated boolean DEFAULT false NOT NULL, - createdby_id bigint, - updatedby_id bigint, - singlereference_id bigint, - dataprovider_id bigint, - annotationtype_id bigint, - diseaseannotationobject_id bigint, - diseasegeneticmodifierrelation_id bigint, - geneticsex_id bigint, - relation_id bigint, - secondarydataprovider_id bigint, diseaseannotationsubject_id bigint, inferredgene_id bigint ); -CREATE TABLE allelediseaseannotation_biologicalentity ( - association_id bigint NOT NULL, - diseasegeneticmodifiers_id bigint NOT NULL -); - -CREATE TABLE allelediseaseannotation_conditionrelation ( - association_id bigint NOT NULL, - conditionrelations_id bigint NOT NULL -); - CREATE TABLE allelediseaseannotation_gene ( - association_id bigint NOT NULL, - assertedgenes_id bigint, - with_id bigint -); - -CREATE TABLE allelediseaseannotation_note ( - association_id bigint NOT NULL, - relatednotes_id bigint NOT NULL -); - -CREATE TABLE allelediseaseannotation_ontologyterm ( - association_id bigint NOT NULL, - evidencecodes_id bigint NOT NULL -); - -CREATE SEQUENCE allelediseaseannotation_seq - START WITH 1 - INCREMENT BY 50 - NO MINVALUE - NO MAXVALUE - CACHE 1; - -CREATE TABLE allelediseaseannotation_vocabularyterm ( - association_id bigint NOT NULL, - diseasequalifiers_id bigint NOT NULL + allelediseaseannotation_id bigint NOT NULL, + assertedgenes_id bigint ); CREATE TABLE allelegeneassociation ( @@ -214,54 +67,15 @@ CREATE SEQUENCE allelegeneassociation_seq CREATE TABLE allelephenotypeannotation ( id bigint PRIMARY KEY, - 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, - curie character varying(255), - modentityid character varying(255), - modinternalid character varying(255), - uniqueid character varying(3500), - phenotypeannotationobject character varying(255), - createdby_id bigint, - updatedby_id bigint, - singlereference_id bigint, - dataprovider_id bigint, - crossreference_id bigint, - relation_id bigint, inferredgene_id bigint, phenotypeannotationsubject_id bigint ); -CREATE TABLE allelephenotypeannotation_conditionrelation ( - association_id bigint NOT NULL, - conditionrelations_id bigint NOT NULL -); - CREATE TABLE allelephenotypeannotation_gene ( - association_id bigint NOT NULL, + allelephenotypeannotation_id bigint NOT NULL, assertedgenes_id bigint NOT NULL ); -CREATE TABLE allelephenotypeannotation_note ( - association_id bigint NOT NULL, - relatednotes_id bigint NOT NULL -); - -CREATE TABLE allelephenotypeannotation_ontologyterm ( - association_id bigint NOT NULL, - phenotypeterms_id bigint NOT NULL -); - -CREATE SEQUENCE allelephenotypeannotation_seq - START WITH 1 - INCREMENT BY 50 - NO MINVALUE - NO MAXVALUE - CACHE 1; - CREATE TABLE codingsequencegenomiclocationassociation ( id bigint PRIMARY KEY, datecreated timestamp(6) with time zone, @@ -314,7 +128,7 @@ CREATE TABLE constructgenomicentityassociation_informationcontententity ( ); CREATE TABLE constructgenomicentityassociation_note ( - association_id bigint NOT NULL, + constructgenomicentityassociation_id bigint NOT NULL, relatednotes_id bigint NOT NULL ); @@ -355,7 +169,7 @@ CREATE SEQUENCE exongenomiclocationassociation_seq NO MAXVALUE CACHE 1; -CREATE TABLE genediseaseannotation ( +CREATE TABLE diseaseannotation ( id bigint PRIMARY KEY, datecreated timestamp(6) with time zone, dateupdated timestamp(6) with time zone, @@ -367,55 +181,59 @@ CREATE TABLE genediseaseannotation ( modentityid character varying(255), modinternalid character varying(255), uniqueid character varying(3500), + diseaseannotationobject_id bigint, negated boolean DEFAULT false NOT NULL, createdby_id bigint, updatedby_id bigint, singlereference_id bigint, dataprovider_id bigint, annotationtype_id bigint, - diseaseannotationobject_id bigint, diseasegeneticmodifierrelation_id bigint, geneticsex_id bigint, relation_id bigint, - secondarydataprovider_id bigint, + secondarydataprovider_id bigint +); + +CREATE TABLE genediseaseannotation ( + id bigint PRIMARY KEY, diseaseannotationsubject_id bigint, sgdstrainbackground_id bigint ); -CREATE TABLE genediseaseannotation_biologicalentity ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_biologicalentity ( + diseaseannotation_id bigint NOT NULL, diseasegeneticmodifiers_id bigint NOT NULL ); -CREATE TABLE genediseaseannotation_conditionrelation ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_conditionrelation ( + annotation_id bigint NOT NULL, conditionrelations_id bigint NOT NULL ); -CREATE TABLE genediseaseannotation_gene ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_gene ( + diseaseannotation_id bigint NOT NULL, with_id bigint NOT NULL ); -CREATE TABLE genediseaseannotation_note ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_note ( + annotation_id bigint NOT NULL, relatednotes_id bigint NOT NULL ); -CREATE TABLE genediseaseannotation_ontologyterm ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_ontologyterm ( + diseaseannotation_id bigint NOT NULL, evidencecodes_id bigint NOT NULL ); -CREATE SEQUENCE genediseaseannotation_seq +CREATE SEQUENCE diseaseannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; -CREATE TABLE genediseaseannotation_vocabularyterm ( - association_id bigint NOT NULL, +CREATE TABLE diseaseannotation_vocabularyterm ( + diseaseannotation_id bigint NOT NULL, diseasequalifiers_id bigint NOT NULL ); @@ -444,12 +262,12 @@ CREATE TABLE geneexpressionannotation ( ); CREATE TABLE geneexpressionannotation_conditionrelation ( - association_id bigint NOT NULL, + annotation_id bigint NOT NULL, conditionrelations_id bigint NOT NULL ); CREATE TABLE geneexpressionannotation_note ( - association_id bigint NOT NULL, + annotation_id bigint NOT NULL, relatednotes_id bigint NOT NULL ); @@ -479,7 +297,7 @@ CREATE TABLE genegeneticinteraction ( ); CREATE TABLE genegeneticinteraction_crossreference ( - association_id bigint NOT NULL, + geneinteraction_id bigint NOT NULL, crossreferences_id bigint NOT NULL ); @@ -491,7 +309,7 @@ CREATE TABLE genegeneticinteraction_informationcontententity ( DROP TABLE IF EXISTS genegeneticinteraction_phenotypesortraits; CREATE TABLE genegeneticinteraction_phenotypesortraits ( - association_id bigint NOT NULL, + genegeneticinteraction_id bigint NOT NULL, phenotypesortraits character varying(255) ); @@ -528,7 +346,7 @@ CREATE TABLE genemolecularinteraction ( ); CREATE TABLE genemolecularinteraction_crossreference ( - association_id bigint NOT NULL, + geneinteraction_id bigint NOT NULL, crossreferences_id bigint NOT NULL ); @@ -544,7 +362,7 @@ CREATE SEQUENCE genemolecularinteraction_seq NO MAXVALUE CACHE 1; -CREATE TABLE genephenotypeannotation ( +CREATE TABLE phenotypeannotation ( id bigint PRIMARY KEY, datecreated timestamp(6) with time zone, dateupdated timestamp(6) with time zone, @@ -562,27 +380,31 @@ CREATE TABLE genephenotypeannotation ( singlereference_id bigint, dataprovider_id bigint, crossreference_id bigint, - relation_id bigint, + relation_id bigint +); + +CREATE TABLE genephenotypeannotation ( + id bigint PRIMARY KEY, phenotypeannotationsubject_id bigint, sgdstrainbackground_id bigint ); -CREATE TABLE genephenotypeannotation_conditionrelation ( - association_id bigint NOT NULL, +CREATE TABLE phenotypeannotation_conditionrelation ( + annotation_id bigint NOT NULL, conditionrelations_id bigint NOT NULL ); -CREATE TABLE genephenotypeannotation_note ( - association_id bigint NOT NULL, +CREATE TABLE phenotypeannotation_note ( + annotation_id bigint NOT NULL, relatednotes_id bigint NOT NULL ); -CREATE TABLE genephenotypeannotation_ontologyterm ( - association_id bigint NOT NULL, +CREATE TABLE phenotypeannotation_ontologyterm ( + phenotypeannotation_id bigint NOT NULL, phenotypeterms_id bigint NOT NULL ); -CREATE SEQUENCE genephenotypeannotation_seq +CREATE SEQUENCE phenotypeannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE diff --git a/src/main/resources/db/migration/v0.37.0.52__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.52__mappersuperclass__assocations.sql index 7897f0cee..fc91a99ef 100644 --- a/src/main/resources/db/migration/v0.37.0.52__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.52__mappersuperclass__assocations.sql @@ -1,16 +1,12 @@ -SELECT setval( 'agmdiseaseannotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); -SELECT setval( 'AGMPhenotypeAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); -SELECT setval( 'AlleleDiseaseAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'AlleleGeneAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); -SELECT setval( 'AllelePhenotypeAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); +SELECT setval( 'PhenotypeAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'CodingSequenceGenomicLocationAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'ConstructGenomicEntityAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'ExonGenomicLocationAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); -SELECT setval( 'GeneDiseaseAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); +SELECT setval( 'DiseaseAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'GeneGeneticInteraction_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'GeneMolecularInteraction_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); -SELECT setval( 'GenePhenotypeAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'SequenceTargetingReagentGeneAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'TranscriptCodingSequenceAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); SELECT setval( 'TranscriptExonAssociation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM Association) ); diff --git a/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql index 2c04221c7..0a4bfbd10 100644 --- a/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql @@ -1,4 +1,4 @@ -INSERT INTO agmdiseaseannotation +INSERT INTO diseaseannotation SELECT id, datecreated, dateupdated, @@ -20,27 +20,31 @@ INSERT INTO agmdiseaseannotation diseasegeneticmodifierrelation_id, geneticsex_id, relation_id, - secondarydataprovider_id, + secondarydataprovider_id FROM Association WHERE AssociationType = 'AGMDiseaseAnnotation'; + + +INSERT INTO agmdiseaseannotation + SELECT id, assertedallele_id, diseaseannotationsubject_id, inferredallele_id, inferredgene_id FROM Association WHERE AssociationType = 'AGMDiseaseAnnotation'; -INSERT INTO agmdiseaseannotation_biologicalentity +INSERT INTO diseaseannotation_biologicalentity SELECT ab.diseaseannotation_id, ab.diseasegeneticmodifiers_id FROM association_biologicalentity ab, Association a WHERE ab.diseaseannotation_id = a.id AND a.associationtype = 'AGMDiseaseAnnotation'; DELETE FROM association_biologicalentity WHERE diseaseannotation_id IN (SELECT id FROM agmdiseaseannotation); -INSERT INTO agmdiseaseannotation_conditionrelation +INSERT INTO diseaseannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'AGMDiseaseAnnotation'; DELETE FROM association_conditionrelation WHERE annotation_id IN (SELECT id FROM agmdiseaseannotation); -INSERT INTO agmdiseaseannotation_gene (association_id, assertedgenes_id) +INSERT INTO agmdiseaseannotation_gene (agmdiseaseannotation_id, assertedgenes_id) SELECT agmdiseaseannotation_id, assertedgenes_id @@ -48,21 +52,21 @@ INSERT INTO agmdiseaseannotation_gene (association_id, assertedgenes_id) DELETE from association_gene WHERE agmdiseaseannotation_id IN (SELECT id FROM agmdiseaseannotation); -INSERT INTO agmdiseaseannotation_note +INSERT INTO diseaseannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'AGMDiseaseAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM agmdiseaseannotation); -INSERT INTO agmdiseaseannotation_ontologyterm +INSERT INTO diseaseannotation_ontologyterm SELECT ao.diseaseannotation_id, ao.evidencecodes_id FROM association_ontologyterm ao, Association a WHERE ao.diseaseannotation_id = a.id AND a.associationtype = 'AGMDiseaseAnnotation'; DELETE FROM association_ontologyterm WHERE diseaseannotation_id IN (SELECT id FROM agmdiseaseannotation); -INSERT INTO agmdiseaseannotation_vocabularyterm +INSERT INTO diseaseannotation_vocabularyterm SELECT av.diseaseannotation_id, av.diseasequalifiers_id FROM association_vocabularyterm av, Association a WHERE av.diseaseannotation_id = a.id AND a.associationtype = 'AGMDiseaseAnnotation'; @@ -71,7 +75,7 @@ DELETE FROM association_vocabularyterm WHERE diseaseannotation_id IN (SELECT id DELETE FROM Association WHERE AssociationType = 'AGMDiseaseAnnotation'; -INSERT INTO agmphenotypeannotation +INSERT INTO phenotypeannotation SELECT id, datecreated, @@ -90,13 +94,17 @@ INSERT INTO agmphenotypeannotation singlereference_id, dataprovider_id, crossreference_id, - relation_id, + relation_id FROM Association WHERE AssociationType = 'AGMPhenotypeAnnotation'; + +INSERT INTO agmphenotypeannotation + SELECT + id, assertedallele_id, inferredallele_id, inferredgene_id, phenotypeannotationsubject_id FROM Association WHERE AssociationType = 'AGMPhenotypeAnnotation'; -INSERT INTO agmphenotypeannotation_conditionrelation +INSERT INTO phenotypeannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'AGMPhenotypeAnnotation'; @@ -111,14 +119,14 @@ INSERT INTO agmphenotypeannotation_gene DELETE from association_gene WHERE agmphenotypeannotation_id IN (SELECT id FROM agmphenotypeannotation); -INSERT INTO agmphenotypeannotation_note +INSERT INTO phenotypeannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'AGMPhenotypeAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM agmphenotypeannotation); -INSERT INTO agmphenotypeannotation_ontologyterm +INSERT INTO phenotypeannotation_ontologyterm SELECT ao.phenotypeannotation_id, ao.phenotypeterms_id FROM association_ontologyterm ao, Association a WHERE ao.phenotypeannotation_id = a.id AND a.associationtype = 'AGMPhenotypeAnnotation'; @@ -127,7 +135,7 @@ DELETE FROM association_ontologyterm WHERE phenotypeannotation_id IN (SELECT id DELETE FROM Association WHERE AssociationType = 'AGMPhenotypeAnnotation'; -INSERT INTO allelediseaseannotation +INSERT INTO diseaseannotation SELECT id, datecreated, @@ -150,25 +158,29 @@ INSERT INTO allelediseaseannotation diseasegeneticmodifierrelation_id, geneticsex_id, relation_id, - secondarydataprovider_id, + secondarydataprovider_id FROM Association WHERE AssociationType = 'AlleleDiseaseAnnotation'; + +INSERT INTO allelediseaseannotation + SELECT + id, diseaseannotationsubject_id, inferredgene_id FROM Association WHERE AssociationType = 'AlleleDiseaseAnnotation'; -INSERT INTO allelediseaseannotation_biologicalentity +INSERT INTO diseaseannotation_biologicalentity SELECT ab.diseaseannotation_id, ab.diseasegeneticmodifiers_id FROM association_biologicalentity ab, Association a WHERE ab.diseaseannotation_id = a.id AND a.associationtype = 'AlleleDiseaseAnnotation'; DELETE FROM association_biologicalentity WHERE diseaseannotation_id IN (SELECT id FROM allelediseaseannotation); -INSERT INTO allelediseaseannotation_conditionrelation +INSERT INTO diseaseannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'AlleleDiseaseAnnotation'; DELETE FROM association_conditionrelation WHERE annotation_id IN (SELECT id FROM allelediseaseannotation); -INSERT INTO allelediseaseannotation_gene (association_id, assertedgenes_id) +INSERT INTO allelediseaseannotation_gene (allelediseaseannotation_id, assertedgenes_id) SELECT allelediseaseannotation_id, assertedgenes_id @@ -176,21 +188,21 @@ INSERT INTO allelediseaseannotation_gene (association_id, assertedgenes_id) DELETE from association_gene WHERE allelediseaseannotation_id IN (SELECT id FROM allelediseaseannotation); -INSERT INTO allelediseaseannotation_note +INSERT INTO diseaseannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'AlleleDiseaseAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM allelediseaseannotation); -INSERT INTO allelediseaseannotation_ontologyterm +INSERT INTO diseaseannotation_ontologyterm SELECT ao.diseaseannotation_id, ao.evidencecodes_id FROM association_ontologyterm ao, Association a WHERE ao.diseaseannotation_id = a.id AND a.associationtype = 'AlleleDiseaseAnnotation'; DELETE FROM association_ontologyterm WHERE diseaseannotation_id IN (SELECT id FROM allelediseaseannotation); -INSERT INTO allelediseaseannotation_vocabularyterm +INSERT INTO diseaseannotation_vocabularyterm SELECT av.diseaseannotation_id, av.diseasequalifiers_id FROM association_vocabularyterm av, Association a WHERE av.diseaseannotation_id = a.id AND a.associationtype = 'AlleleDiseaseAnnotation'; @@ -225,7 +237,7 @@ DELETE FROM association_informationcontententity WHERE evidenceassociation_id IN DELETE FROM Association WHERE AssociationType = 'AlleleGeneAssociation'; -INSERT INTO allelephenotypeannotation +INSERT INTO phenotypeannotation SELECT id, datecreated, @@ -244,11 +256,15 @@ INSERT INTO allelephenotypeannotation singlereference_id, dataprovider_id, crossreference_id, - relation_id, + relation_id FROM Association WHERE AssociationType = 'AllelePhenotypeAnnotation'; + +INSERT INTO allelephenotypeannotation + SELECT + id, inferredgene_id, phenotypeannotationsubject_id FROM Association WHERE AssociationType = 'AllelePhenotypeAnnotation'; -INSERT INTO allelephenotypeannotation_conditionrelation +INSERT INTO phenotypeannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'AllelePhenotypeAnnotation'; @@ -263,14 +279,14 @@ INSERT INTO allelephenotypeannotation_gene DELETE from association_gene WHERE allelephenotypeannotation_id IN (SELECT id FROM allelephenotypeannotation); -INSERT INTO allelephenotypeannotation_note +INSERT INTO phenotypeannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'AllelePhenotypeAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM allelephenotypeannotation); -INSERT INTO allelephenotypeannotation_ontologyterm +INSERT INTO phenotypeannotation_ontologyterm SELECT ao.phenotypeannotation_id, ao.phenotypeterms_id FROM association_ontologyterm ao, Association a WHERE ao.phenotypeannotation_id = a.id AND a.associationtype = 'AllelePhenotypeAnnotation'; @@ -388,25 +404,29 @@ INSERT INTO genediseaseannotation diseasegeneticmodifierrelation_id, geneticsex_id, relation_id, - secondarydataprovider_id, + secondarydataprovider_id FROM Association WHERE AssociationType = 'GeneDiseaseAnnotation'; + +INSERT INTO genediseaseannotation + SELECT + id, diseaseannotationsubject_id, sgdstrainbackground_id FROM Association WHERE AssociationType = 'GeneDiseaseAnnotation'; -INSERT INTO genediseaseannotation_biologicalentity +INSERT INTO diseaseannotation_biologicalentity SELECT ab.diseaseannotation_id, ab.diseasegeneticmodifiers_id FROM association_biologicalentity ab, Association a WHERE ab.diseaseannotation_id = a.id AND a.associationtype = 'GeneDiseaseAnnotation'; DELETE FROM association_biologicalentity WHERE diseaseannotation_id IN (SELECT id FROM genediseaseannotation); -INSERT INTO genediseaseannotation_conditionrelation +INSERT INTO diseaseannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'GeneDiseaseAnnotation'; DELETE FROM association_conditionrelation WHERE annotation_id IN (SELECT id FROM genediseaseannotation); -INSERT INTO genediseaseannotation_gene (association_id, with_id) +INSERT INTO diseaseannotation_gene (diseaseannotation_id, with_id) SELECT diseaseannotation_id, with_id @@ -414,21 +434,21 @@ INSERT INTO genediseaseannotation_gene (association_id, with_id) DELETE from association_gene WHERE diseaseannotation_id IN (SELECT id FROM genediseaseannotation); -INSERT INTO genediseaseannotation_note +INSERT INTO diseaseannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'GeneDiseaseAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM genediseaseannotation); -INSERT INTO genediseaseannotation_ontologyterm +INSERT INTO diseaseannotation_ontologyterm SELECT ao.diseaseannotation_id, ao.evidencecodes_id FROM association_ontologyterm ao, Association a WHERE ao.diseaseannotation_id = a.id AND a.associationtype = 'GeneDiseaseAnnotation'; DELETE FROM association_ontologyterm WHERE diseaseannotation_id IN (SELECT id FROM genediseaseannotation); -INSERT INTO genediseaseannotation_vocabularyterm +INSERT INTO diseaseannotation_vocabularyterm SELECT av.diseaseannotation_id, av.diseasequalifiers_id FROM association_vocabularyterm av, Association a WHERE av.diseaseannotation_id = a.id AND a.associationtype = 'GeneDiseaseAnnotation'; @@ -559,7 +579,7 @@ DELETE FROM association_informationcontententity WHERE evidenceassociation_id IN DELETE FROM Association WHERE AssociationType = 'GeneMolecularInteraction'; -INSERT INTO genephenotypeannotation +INSERT INTO phenotypeannotation SELECT id, datecreated, @@ -578,25 +598,29 @@ INSERT INTO genephenotypeannotation singlereference_id, dataprovider_id, crossreference_id, - relation_id, + relation_id FROM Association WHERE AssociationType = 'GenePhenotypeAnnotation'; + +INSERT INTO genephenotypeannotation + SELECT + id, phenotypeannotationsubject_id, sgdstrainbackground_id FROM Association WHERE AssociationType = 'GenePhenotypeAnnotation'; -INSERT INTO genephenotypeannotation_conditionrelation +INSERT INTO phenotypeannotation_conditionrelation SELECT ac.annotation_id, ac.conditionrelations_id FROM association_conditionrelation ac, Association a WHERE ac.annotation_id = a.id AND a.associationtype = 'GenePhenotypeAnnotation'; DELETE FROM association_conditionrelation WHERE annotation_id IN (SELECT id FROM genephenotypeannotation); -INSERT INTO genephenotypeannotation_note +INSERT INTO phenotypeannotation_note SELECT an.annotation_id, an.relatednotes_id FROM association_note an, Association a WHERE an.annotation_id = a.id AND a.associationtype = 'GenePhenotypeAnnotation'; DELETE FROM association_note WHERE annotation_id IN (SELECT id FROM genephenotypeannotation); -INSERT INTO genephenotypeannotation_ontologyterm +INSERT INTO phenotypeannotation_ontologyterm SELECT ao.phenotypeannotation_id, ao.phenotypeterms_id FROM association_ontologyterm ao, Association a WHERE ao.phenotypeannotation_id = a.id AND a.associationtype = 'GenePhenotypeAnnotation'; diff --git a/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql index 876678f20..34b549027 100644 --- a/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql @@ -1,111 +1,79 @@ -CREATE INDEX agmdiseaseannotation_annotationtype_index ON agmdiseaseannotation USING btree (annotationtype_id); +CREATE INDEX diseaseannotation_annotationtype_index ON diseaseannotation USING btree (annotationtype_id); CREATE INDEX agmdiseaseannotation_assertedallele_index ON agmdiseaseannotation USING btree (assertedallele_id); -CREATE INDEX agmdiseaseannotation_createdby_index ON agmdiseaseannotation USING btree (createdby_id); -CREATE INDEX agmdiseaseannotation_curie_index ON agmdiseaseannotation USING btree (curie); -CREATE INDEX agmdiseaseannotation_dataprovider_index ON agmdiseaseannotation USING btree (dataprovider_id); -CREATE INDEX agmdiseaseannotation_diseaseannotationobject_index ON agmdiseaseannotation USING btree (diseaseannotationobject_id); +CREATE INDEX diseaseannotation_createdby_index ON diseaseannotation USING btree (createdby_id); +CREATE INDEX diseaseannotation_curie_index ON diseaseannotation USING btree (curie); +CREATE INDEX diseaseannotation_dataprovider_index ON diseaseannotation USING btree (dataprovider_id); +CREATE INDEX diseaseannotation_diseaseannotationobject_index ON diseaseannotation USING btree (diseaseannotationobject_id); CREATE INDEX agmdiseaseannotation_diseaseannotationsubject_index ON agmdiseaseannotation USING btree (diseaseannotationsubject_id); -CREATE INDEX agmdiseaseannotation_diseasegeneticmodifierrelation_index ON agmdiseaseannotation USING btree (diseasegeneticmodifierrelation_id); -CREATE INDEX agmdiseaseannotation_geneticsex_index ON agmdiseaseannotation USING btree (geneticsex_id); +CREATE INDEX diseaseannotation_diseasegeneticmodifierrelation_index ON diseaseannotation USING btree (diseasegeneticmodifierrelation_id); +CREATE INDEX diseaseannotation_geneticsex_index ON diseaseannotation USING btree (geneticsex_id); CREATE INDEX agmdiseaseannotation_inferredallele_index ON agmdiseaseannotation USING btree (inferredallele_id); CREATE INDEX agmdiseaseannotation_inferredgene_index ON agmdiseaseannotation USING btree (inferredgene_id); -CREATE INDEX agmdiseaseannotation_internal_index ON agmdiseaseannotation USING btree (internal); -CREATE INDEX agmdiseaseannotation_modentityid_index ON agmdiseaseannotation USING btree (modentityid); -CREATE INDEX agmdiseaseannotation_modinternalid_index ON agmdiseaseannotation USING btree (modinternalid); -CREATE INDEX agmdiseaseannotation_negated_index ON agmdiseaseannotation USING btree (negated); -CREATE INDEX agmdiseaseannotation_obsolete_index ON agmdiseaseannotation USING btree (obsolete); -CREATE INDEX agmdiseaseannotation_relation_index ON agmdiseaseannotation USING btree (relation_id); -CREATE INDEX agmdiseaseannotation_secondarydataprovider_index ON agmdiseaseannotation USING btree (secondarydataprovider_id); -CREATE INDEX agmdiseaseannotation_singlereference_index ON agmdiseaseannotation USING btree (singlereference_id); -CREATE INDEX agmdiseaseannotation_uniqueid_index ON agmdiseaseannotation USING btree (uniqueid); -CREATE INDEX agmdiseaseannotation_updatedby_index ON agmdiseaseannotation USING btree (updatedby_id); +CREATE INDEX diseaseannotation_internal_index ON diseaseannotation USING btree (internal); +CREATE INDEX diseaseannotation_modentityid_index ON diseaseannotation USING btree (modentityid); +CREATE INDEX diseaseannotation_modinternalid_index ON diseaseannotation USING btree (modinternalid); +CREATE INDEX diseaseannotation_negated_index ON diseaseannotation USING btree (negated); +CREATE INDEX diseaseannotation_obsolete_index ON diseaseannotation USING btree (obsolete); +CREATE INDEX diseaseannotation_relation_index ON diseaseannotation USING btree (relation_id); +CREATE INDEX diseaseannotation_secondarydataprovider_index ON diseaseannotation USING btree (secondarydataprovider_id); +CREATE INDEX diseaseannotation_singlereference_index ON diseaseannotation USING btree (singlereference_id); +CREATE INDEX diseaseannotation_uniqueid_index ON diseaseannotation USING btree (uniqueid); +CREATE INDEX diseaseannotation_updatedby_index ON diseaseannotation USING btree (updatedby_id); -CREATE INDEX idxfm9hjt2cp5opepuhro41rko11 ON agmdiseaseannotation_biologicalentity USING btree (association_id); -CREATE INDEX idx2q76899x3i9nmfrpk1s4gqaa5 ON agmdiseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); +-- CREATE INDEX idxfm9hjt2cp5opepuhro41rko11 ON diseaseannotation_biologicalentity USING btree (annotation_id); +-- CREATE INDEX idx2q76899x3i9nmfrpk1s4gqaa5 ON diseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); -CREATE INDEX idx7ckisymg9glquxs8ckv58o4wa ON agmdiseaseannotation_conditionrelation USING btree (association_id); -CREATE INDEX idx6ie2uykt18gbauf5t26c9gw4p ON agmdiseaseannotation_conditionrelation USING btree (conditionrelations_id); +-- CREATE INDEX idx7ckisymg9glquxs8ckv58o4wa ON diseaseannotation_conditionrelation USING btree (annotation_id); +-- CREATE INDEX idx6ie2uykt18gbauf5t26c9gw4p ON diseaseannotation_conditionrelation USING btree (conditionrelations_id); -CREATE INDEX idx3s76vpljgsx07k1ggvfl0syp ON agmdiseaseannotation_gene USING btree (assertedgenes_id); -CREATE INDEX idxkvf72io0gj5fp23ao008q283k ON agmdiseaseannotation_gene USING btree (association_id); -CREATE INDEX idxe78i8xpvroa23syyg1eqp3d0k ON agmdiseaseannotation_gene USING btree (with_id); +CREATE INDEX agmdiseaseannotation_gene_assertedgenes_index ON agmdiseaseannotation_gene USING btree (assertedgenes_id); +CREATE INDEX agmdiseaseannotation_gene_agmda_index ON agmdiseaseannotation_gene USING btree (agmdiseaseannotation_id); +CREATE INDEX diseaseannotation_gene_da_index ON diseaseannotation_gene USING btree (diseaseannotation_id); +CREATE INDEX diseaseannotation_gene_with_index ON diseaseannotation_gene USING btree (with_id); -CREATE INDEX idxn2ac81velbbenm2oce4xqkyy0 ON agmdiseaseannotation_note USING btree (association_id); -CREATE INDEX idx6kkpigf83ojt26fiqg2w1dy1p ON agmdiseaseannotation_note USING btree (relatednotes_id); +-- CREATE INDEX idxn2ac81velbbenm2oce4xqkyy0 ON diseaseannotation_note USING btree (annotation_id); +-- CREATE INDEX idx6kkpigf83ojt26fiqg2w1dy1p ON diseaseannotation_note USING btree (relatednotes_id); -CREATE INDEX idxoimanxnlnh4w94q7wfy4botmr ON agmdiseaseannotation_ontologyterm USING btree (association_id); -CREATE INDEX idxrrrc3fh4ubf75r6fyv9syms4u ON agmdiseaseannotation_ontologyterm USING btree (evidencecodes_id); +CREATE INDEX diseaseannotation_ontologyterm_da_index ON diseaseannotation_ontologyterm USING btree (diseaseannotation_id); +CREATE INDEX diseaseannotation_ontologyterm_evidencecodes_index ON diseaseannotation_ontologyterm USING btree (evidencecodes_id); -CREATE INDEX idx34lopnjoyj5oi6o2kr5g0hcpx ON agmdiseaseannotation_vocabularyterm USING btree (association_id); -CREATE INDEX idxkkfpqscjy9qej3x21ej6oniip ON agmdiseaseannotation_vocabularyterm USING btree (diseasequalifiers_id); +CREATE INDEX diseaseannotation_vocabularyterm_da_index ON diseaseannotation_vocabularyterm USING btree (diseaseannotation_id); +CREATE INDEX diseaseannotation_vocabularyterm_dq_index ON diseaseannotation_vocabularyterm USING btree (diseasequalifiers_id); CREATE INDEX agmphenotypeannotation_assertedallele_index ON agmphenotypeannotation USING btree (assertedallele_id); -CREATE INDEX agmphenotypeannotation_createdby_index ON agmphenotypeannotation USING btree (createdby_id); -CREATE INDEX agmphenotypeannotation_crossreference_index ON agmphenotypeannotation USING btree (crossreference_id); -CREATE INDEX agmphenotypeannotation_curie_index ON agmphenotypeannotation USING btree (curie); -CREATE INDEX agmphenotypeannotation_dataprovider_index ON agmphenotypeannotation USING btree (dataprovider_id); +CREATE INDEX phenotypeannotation_createdby_index ON phenotypeannotation USING btree (createdby_id); +CREATE INDEX phenotypeannotation_crossreference_index ON phenotypeannotation USING btree (crossreference_id); +CREATE INDEX phenotypeannotation_curie_index ON phenotypeannotation USING btree (curie); +CREATE INDEX phenotypeannotation_dataprovider_index ON phenotypeannotation USING btree (dataprovider_id); CREATE INDEX agmphenotypeannotation_inferredallele_index ON agmphenotypeannotation USING btree (inferredallele_id); CREATE INDEX agmphenotypeannotation_inferredgene_index ON agmphenotypeannotation USING btree (inferredgene_id); -CREATE INDEX agmphenotypeannotation_internal_index ON agmphenotypeannotation USING btree (internal); -CREATE INDEX agmphenotypeannotation_modentityid_index ON agmphenotypeannotation USING btree (modentityid); -CREATE INDEX agmphenotypeannotation_modinternalid_index ON agmphenotypeannotation USING btree (modinternalid); -CREATE INDEX agmphenotypeannotation_obsolete_index ON agmphenotypeannotation USING btree (obsolete); +CREATE INDEX phenotypeannotation_internal_index ON phenotypeannotation USING btree (internal); +CREATE INDEX phenotypeannotation_modentityid_index ON phenotypeannotation USING btree (modentityid); +CREATE INDEX phenotypeannotation_modinternalid_index ON phenotypeannotation USING btree (modinternalid); +CREATE INDEX phenotypeannotation_obsolete_index ON phenotypeannotation USING btree (obsolete); CREATE INDEX agmphenotypeannotation_phenotypeannotationsubject_index ON agmphenotypeannotation USING btree (phenotypeannotationsubject_id); -CREATE INDEX agmphenotypeannotation_relation_index ON agmphenotypeannotation USING btree (relation_id); -CREATE INDEX agmphenotypeannotation_singlereference_index ON agmphenotypeannotation USING btree (singlereference_id); -CREATE INDEX agmphenotypeannotation_uniqueid_index ON agmphenotypeannotation USING btree (uniqueid); -CREATE INDEX agmphenotypeannotation_updatedby_index ON agmphenotypeannotation USING btree (updatedby_id); +CREATE INDEX phenotypeannotation_relation_index ON phenotypeannotation USING btree (relation_id); +CREATE INDEX phenotypeannotation_singlereference_index ON phenotypeannotation USING btree (singlereference_id); +CREATE INDEX phenotypeannotation_uniqueid_index ON phenotypeannotation USING btree (uniqueid); +CREATE INDEX phenotypeannotation_updatedby_index ON phenotypeannotation USING btree (updatedby_id); -CREATE INDEX idx4p03xofye2drhcxfv4wh5btvj ON agmphenotypeannotation_conditionrelation USING btree (association_id); -CREATE INDEX idx84beulwvg0hkmudmow0dlsxv7 ON agmphenotypeannotation_conditionrelation USING btree (conditionrelations_id); +-- CREATE INDEX idx4p03xofye2drhcxfv4wh5btvj ON phenotypeannotation_conditionrelation USING btree (annotation_id); +-- CREATE INDEX idx84beulwvg0hkmudmow0dlsxv7 ON phenotypeannotation_conditionrelation USING btree (conditionrelations_id); -CREATE INDEX idxi915qncqnpclsyq0ki2qgvpe2 ON agmphenotypeannotation_gene USING btree (assertedgenes_id); -CREATE INDEX idxrkudpfv7bukgfyq52lpqoy71f ON agmphenotypeannotation_gene USING btree (association_id); +CREATE INDEX agmphenotypeannotation_gene_assertedgenes_index ON agmphenotypeannotation_gene USING btree (assertedgenes_id); +CREATE INDEX agmphenotypeannotation_gene_agmpa_index ON agmphenotypeannotation_gene USING btree (agmphenotypeannotation_id); -CREATE INDEX idxrgqdq9ngi6fi44kqb6l6gqn1s ON agmphenotypeannotation_note USING btree (association_id); -CREATE INDEX idxit2xg2ed815njy85kl3hgsjwu ON agmphenotypeannotation_note USING btree (relatednotes_id); +-- CREATE INDEX idxrgqdq9ngi6fi44kqb6l6gqn1s ON phenotypeannotation_note USING btree (annotation_id); +-- CREATE INDEX idxit2xg2ed815njy85kl3hgsjwu ON phenotypeannotation_note USING btree (relatednotes_id); -CREATE INDEX idxh31el0byd6ow9ly8a8aji9nev ON agmphenotypeannotation_ontologyterm USING btree (phenotypeterms_id); -CREATE INDEX idxmajx55xmyj71xjr0kh6fgv1p8 ON agmphenotypeannotation_ontologyterm USING btree (association_id); +CREATE INDEX phenotypeannotation_ontologyterm_phenotypeterms_index ON phenotypeannotation_ontologyterm USING btree (phenotypeterms_id); +CREATE INDEX phenotypeannotation_ontologyterm_pa_index ON phenotypeannotation_ontologyterm USING btree (phenotypeannotation_id); -CREATE INDEX allelediseaseannotation_annotationtype_index ON allelediseaseannotation USING btree (annotationtype_id); -CREATE INDEX allelediseaseannotation_createdby_index ON allelediseaseannotation USING btree (createdby_id); -CREATE INDEX allelediseaseannotation_curie_index ON allelediseaseannotation USING btree (curie); -CREATE INDEX allelediseaseannotation_dataprovider_index ON allelediseaseannotation USING btree (dataprovider_id); -CREATE INDEX allelediseaseannotation_diseaseannotationobject_index ON allelediseaseannotation USING btree (diseaseannotationobject_id); CREATE INDEX allelediseaseannotation_diseaseannotationsubject_index ON allelediseaseannotation USING btree (diseaseannotationsubject_id); -CREATE INDEX allelediseaseannotation_diseasegeneticmodifierrelation_index ON allelediseaseannotation USING btree (diseasegeneticmodifierrelation_id); -CREATE INDEX allelediseaseannotation_geneticsex_index ON allelediseaseannotation USING btree (geneticsex_id); CREATE INDEX allelediseaseannotation_inferredgene_index ON allelediseaseannotation USING btree (inferredgene_id); -CREATE INDEX allelediseaseannotation_internal_index ON allelediseaseannotation USING btree (internal); -CREATE INDEX allelediseaseannotation_modentityid_index ON allelediseaseannotation USING btree (modentityid); -CREATE INDEX allelediseaseannotation_modinternalid_index ON allelediseaseannotation USING btree (modinternalid); -CREATE INDEX allelediseaseannotation_negated_index ON allelediseaseannotation USING btree (negated); -CREATE INDEX allelediseaseannotation_obsolete_index ON allelediseaseannotation USING btree (obsolete); -CREATE INDEX allelediseaseannotation_relation_index ON allelediseaseannotation USING btree (relation_id); -CREATE INDEX allelediseaseannotation_secondarydataprovider_index ON allelediseaseannotation USING btree (secondarydataprovider_id); -CREATE INDEX allelediseaseannotation_singlereference_index ON allelediseaseannotation USING btree (singlereference_id); -CREATE INDEX allelediseaseannotation_uniqueid_index ON allelediseaseannotation USING btree (uniqueid); -CREATE INDEX allelediseaseannotation_updatedby_index ON allelediseaseannotation USING btree (updatedby_id); -CREATE INDEX idxkwi0hmi5is7j11kba9a3wcy9w ON allelediseaseannotation_biologicalentity USING btree (association_id); -CREATE INDEX idxfm4pv5tjr8rs97jq7b2b0yqhp ON allelediseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); - -CREATE INDEX idxhi5g56wq41id4f59mta1v0p2s ON allelediseaseannotation_conditionrelation USING btree (association_id); -CREATE INDEX idx947m3fd883uabr629ws4fy4re ON allelediseaseannotation_conditionrelation USING btree (conditionrelations_id); - -CREATE INDEX idxaxj2yecc9hy8f6rn6fej18kcv ON allelediseaseannotation_gene USING btree (assertedgenes_id); -CREATE INDEX idxofo1cyfmfs4jol9c5gp012o4a ON allelediseaseannotation_gene USING btree (association_id); -CREATE INDEX idxesohht66qle9l8d748nfrx35a ON allelediseaseannotation_gene USING btree (with_id); - -CREATE INDEX idxfvf61jlaic8nkjquoycsswmsq ON allelediseaseannotation_note USING btree (association_id); -CREATE INDEX idxdnlqnaqcuoku49wa7hweqqh3h ON allelediseaseannotation_note USING btree (relatednotes_id); - -CREATE INDEX idxbi31t44lvo24mkv1mfnc4fcw3 ON allelediseaseannotation_ontologyterm USING btree (association_id); -CREATE INDEX idxb1r481lvh5q5wlg5rtf3j5q45 ON allelediseaseannotation_ontologyterm USING btree (evidencecodes_id); - -CREATE INDEX idx2jc8npk4fjmm80hh9f0y1v3he ON allelediseaseannotation_vocabularyterm USING btree (association_id); -CREATE INDEX idxgcp0ghpx8rv5njry59gfqswxx ON allelediseaseannotation_vocabularyterm USING btree (diseasequalifiers_id); +CREATE INDEX allelediseaseannotation_gene_assertedgenes_index ON allelediseaseannotation_gene USING btree (assertedgenes_id); +CREATE INDEX allelediseaseannotation_gene_alleleda_index ON allelediseaseannotation_gene USING btree (allelediseaseannotation_id); CREATE INDEX allelegeneassociation_alleleassociationsubject_index ON allelegeneassociation USING btree (alleleassociationsubject_id); CREATE INDEX allelegeneassociation_allelegeneassociationobject_index ON allelegeneassociation USING btree (allelegeneassociationobject_id); @@ -117,112 +85,56 @@ CREATE INDEX allelegeneassociation_relatednote_index ON allelegeneassociation US CREATE INDEX allelegeneassociation_relation_index ON allelegeneassociation USING btree (relation_id); CREATE INDEX allelegeneassociation_updatedby_index ON allelegeneassociation USING btree (updatedby_id); -CREATE INDEX idx9u4cqfbtajokovj1quacsvld2 ON allelegeneassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxp3na9i2xw0ea9igcwx1jdpc9g ON allelegeneassociation_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idx9u4cqfbtajokovj1quacsvld2 ON allelegeneassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxp3na9i2xw0ea9igcwx1jdpc9g ON allelegeneassociation_informationcontententity USING btree (evidence_id); -CREATE INDEX allelephenotypeannotation_createdby_index ON allelephenotypeannotation USING btree (createdby_id); -CREATE INDEX allelephenotypeannotation_crossreference_index ON allelephenotypeannotation USING btree (crossreference_id); -CREATE INDEX allelephenotypeannotation_curie_index ON allelephenotypeannotation USING btree (curie); -CREATE INDEX allelephenotypeannotation_dataprovider_index ON allelephenotypeannotation USING btree (dataprovider_id); CREATE INDEX allelephenotypeannotation_inferredgene_index ON allelephenotypeannotation USING btree (inferredgene_id); -CREATE INDEX allelephenotypeannotation_internal_index ON allelephenotypeannotation USING btree (internal); -CREATE INDEX allelephenotypeannotation_modentityid_index ON allelephenotypeannotation USING btree (modentityid); -CREATE INDEX allelephenotypeannotation_modinternalid_index ON allelephenotypeannotation USING btree (modinternalid); -CREATE INDEX allelephenotypeannotation_obsolete_index ON allelephenotypeannotation USING btree (obsolete); CREATE INDEX allelephenotypeannotation_phenotypeannotationsubject_index ON allelephenotypeannotation USING btree (phenotypeannotationsubject_id); -CREATE INDEX allelephenotypeannotation_relation_index ON allelephenotypeannotation USING btree (relation_id); -CREATE INDEX allelephenotypeannotation_singlereference_index ON allelephenotypeannotation USING btree (singlereference_id); -CREATE INDEX allelephenotypeannotation_uniqueid_index ON allelephenotypeannotation USING btree (uniqueid); -CREATE INDEX allelephenotypeannotation_updatedby_index ON allelephenotypeannotation USING btree (updatedby_id); - -CREATE INDEX idxakkdw3451v7usrsb8ouvj9hj0 ON allelephenotypeannotation_conditionrelation USING btree (association_id); -CREATE INDEX idxdse642c7dlmvdbb97jj49kc84 ON allelephenotypeannotation_conditionrelation USING btree (conditionrelations_id); - -CREATE INDEX idxdsw5skx7e6ym959jxqmvfyknq ON allelephenotypeannotation_gene USING btree (assertedgenes_id); -CREATE INDEX idxrbk9a9lt5bhdxgyo7cm0fnvik ON allelephenotypeannotation_gene USING btree (association_id); - -CREATE INDEX idxp5r4an1hcil06mlvcvvps4wsl ON allelephenotypeannotation_note USING btree (association_id); -CREATE INDEX idx2qw6k7xxxrqtfi6vc01j7cds3 ON allelephenotypeannotation_note USING btree (relatednotes_id); - -CREATE INDEX idxd2k2tyjqcfql4wvi41d41sokj ON allelephenotypeannotation_ontologyterm USING btree (association_id); -CREATE INDEX idxo9k3yyl9npw9jfsb2ocv7m7kx ON allelephenotypeannotation_ontologyterm USING btree (phenotypeterms_id); - -CREATE INDEX idxebg770w4q4fayk1vpfucdu1xy ON codingsequencegenomiclocationassociation USING btree (codingsequenceassociationsubject_id); -CREATE INDEX idxbmljoyqmk4cdd3os0dumc9bgp ON codingsequencegenomiclocationassociation USING btree (codingsequencegenomiclocationassociationobject_id); -CREATE INDEX idx6khftnwxcrifhid51ffnd054g ON codingsequencegenomiclocationassociation USING btree (createdby_id); -CREATE INDEX idxhfv6me8h9mleiytvoytio0nsi ON codingsequencegenomiclocationassociation USING btree (internal); -CREATE INDEX idxgrky8raqexv45mq83suvekrdo ON codingsequencegenomiclocationassociation USING btree (obsolete); -CREATE INDEX idxa5wjxifv7vi0y5ltgdnp5ep9t ON codingsequencegenomiclocationassociation USING btree (phase); -CREATE INDEX idxkr58i2vv5784vl6osva8shi9e ON codingsequencegenomiclocationassociation USING btree (relation_id); -CREATE INDEX idxr0bkeewpnaajqi1xds5c7j1oc ON codingsequencegenomiclocationassociation USING btree (strand); -CREATE INDEX idxsb0mnawmi55r20kcipnykm41q ON codingsequencegenomiclocationassociation USING btree (updatedby_id); - -CREATE INDEX idxp4b569h2wevn6yxgv6veonxfr ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (association_id); -CREATE INDEX idxp0ldc7a577pft5v9959muhdh5 ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (evidence_id); - -CREATE INDEX idxvsibphiuleew24wjckpfxeae ON constructgenomicentityassociation USING btree (internal); -CREATE INDEX idx8myuo0a6hx59vxfhlbrcn8ujk ON constructgenomicentityassociation USING btree (constructassociationsubject_id); -CREATE INDEX idxevduykusoc08mycbrmn4o7dnq ON constructgenomicentityassociation USING btree (constructgenomicentityassociationobject_id); -CREATE INDEX idxch64a8ot2vv6i0rue8khyjb3m ON constructgenomicentityassociation USING btree (createdby_id); -CREATE INDEX idxi6hc4krcrxpsrrwj728vd2wpx ON constructgenomicentityassociation USING btree (obsolete); -CREATE INDEX idxsoyddowolab2mrp5eaxj57yar ON constructgenomicentityassociation USING btree (relation_id); -CREATE INDEX idxevh4c07xjfxyylj7ck2dtn6jh ON constructgenomicentityassociation USING btree (updatedby_id); - -CREATE INDEX idxg5fxj3nedebt3cw93uxptf7om ON constructgenomicentityassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxb9tloa39yyvirjvacah10hfd5 ON constructgenomicentityassociation_informationcontententity USING btree (evidence_id); - -CREATE INDEX idxh3oudw9wb9wfvjewxywysi1ey ON constructgenomicentityassociation_note USING btree (association_id); -CREATE INDEX idxj3o4mwvqgbj57m6k22cm49j4r ON constructgenomicentityassociation_note USING btree (relatednotes_id); - -CREATE INDEX idxhgjuh3b5r08q54fwecp64k3a4 ON exongenomiclocationassociation USING btree (createdby_id); -CREATE INDEX idx82dedqro7ri1f8g558icrjxc6 ON exongenomiclocationassociation USING btree (exonassociationsubject_id); -CREATE INDEX idx53jvdw533s5e082xlj0sx7p7x ON exongenomiclocationassociation USING btree (exongenomiclocationassociationobject_id); -CREATE INDEX idx2knwxko11qkxvr98w7l76wlgi ON exongenomiclocationassociation USING btree (internal); -CREATE INDEX idxo923wv3e7dg9e2flm08ghwiig ON exongenomiclocationassociation USING btree (obsolete); -CREATE INDEX idx5ufu3a6guayhxy2cg6crxde2i ON exongenomiclocationassociation USING btree (relation_id); -CREATE INDEX idxdwfj56lqtx86brdvwafjqo8nn ON exongenomiclocationassociation USING btree (strand); -CREATE INDEX idxd12130inhcxcp1dbks190955j ON exongenomiclocationassociation USING btree (updatedby_id); - -CREATE INDEX idxtaunnvner3uu6vfarcb9kv0o1 ON exongenomiclocationassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxbugjixb2a6vb0xuho653me8as ON exongenomiclocationassociation_informationcontententity USING btree (evidence_id); - -CREATE INDEX genediseaseannotation_annotationtype_index ON genediseaseannotation USING btree (annotationtype_id); -CREATE INDEX genediseaseannotation_createdby_index ON genediseaseannotation USING btree (createdby_id); -CREATE INDEX genediseaseannotation_curie_index ON genediseaseannotation USING btree (curie); -CREATE INDEX genediseaseannotation_dataprovider_index ON genediseaseannotation USING btree (dataprovider_id); -CREATE INDEX genediseaseannotation_diseaseannotationobject_index ON genediseaseannotation USING btree (diseaseannotationobject_id); -CREATE INDEX genediseaseannotation_diseaseannotationsubject_index ON genediseaseannotation USING btree (diseaseannotationsubject_id); -CREATE INDEX genediseaseannotation_diseasegeneticmodifierrelation_index ON genediseaseannotation USING btree (diseasegeneticmodifierrelation_id); -CREATE INDEX genediseaseannotation_geneticsex_index ON genediseaseannotation USING btree (geneticsex_id); -CREATE INDEX genediseaseannotation_internal_index ON genediseaseannotation USING btree (internal); -CREATE INDEX genediseaseannotation_modentityid_index ON genediseaseannotation USING btree (modentityid); -CREATE INDEX genediseaseannotation_modinternalid_index ON genediseaseannotation USING btree (modinternalid); -CREATE INDEX genediseaseannotation_negated_index ON genediseaseannotation USING btree (negated); -CREATE INDEX genediseaseannotation_obsolete_index ON genediseaseannotation USING btree (obsolete); -CREATE INDEX genediseaseannotation_relation_index ON genediseaseannotation USING btree (relation_id); -CREATE INDEX genediseaseannotation_secondarydataprovider_index ON genediseaseannotation USING btree (secondarydataprovider_id); -CREATE INDEX genediseaseannotation_sgdstrainbackground_index ON genediseaseannotation USING btree (sgdstrainbackground_id); -CREATE INDEX genediseaseannotation_singlereference_index ON genediseaseannotation USING btree (singlereference_id); -CREATE INDEX genediseaseannotation_uniqueid_index ON genediseaseannotation USING btree (uniqueid); -CREATE INDEX genediseaseannotation_updatedby_index ON genediseaseannotation USING btree (updatedby_id); - -CREATE INDEX idxjeh9y20kiqhxc79hounhdq8f6 ON genediseaseannotation_biologicalentity USING btree (association_id); -CREATE INDEX idxnagxqk14lxkm1vw1wn4bknssg ON genediseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); -CREATE INDEX idxqkla5i9l82m9p5y9a6api863h ON genediseaseannotation_conditionrelation USING btree (association_id); -CREATE INDEX idxg92dtnhnsxebexy9bccosflb6 ON genediseaseannotation_conditionrelation USING btree (conditionrelations_id); +CREATE INDEX allelephenotypeannotation_gene_assertedgenes_index ON allelephenotypeannotation_gene USING btree (assertedgenes_id); +CREATE INDEX allelephenotypeannotation_gene_allelepa_index ON allelephenotypeannotation_gene USING btree (allelephenotypeannotation_id); + +-- CREATE INDEX idxebg770w4q4fayk1vpfucdu1xy ON codingsequencegenomiclocationassociation USING btree (codingsequenceassociationsubject_id); +-- CREATE INDEX idxbmljoyqmk4cdd3os0dumc9bgp ON codingsequencegenomiclocationassociation USING btree (codingsequencegenomiclocationassociationobject_id); +-- CREATE INDEX idx6khftnwxcrifhid51ffnd054g ON codingsequencegenomiclocationassociation USING btree (createdby_id); +-- CREATE INDEX idxhfv6me8h9mleiytvoytio0nsi ON codingsequencegenomiclocationassociation USING btree (internal); +-- CREATE INDEX idxgrky8raqexv45mq83suvekrdo ON codingsequencegenomiclocationassociation USING btree (obsolete); +-- CREATE INDEX idxa5wjxifv7vi0y5ltgdnp5ep9t ON codingsequencegenomiclocationassociation USING btree (phase); +-- CREATE INDEX idxkr58i2vv5784vl6osva8shi9e ON codingsequencegenomiclocationassociation USING btree (relation_id); +-- CREATE INDEX idxr0bkeewpnaajqi1xds5c7j1oc ON codingsequencegenomiclocationassociation USING btree (strand); +-- CREATE INDEX idxsb0mnawmi55r20kcipnykm41q ON codingsequencegenomiclocationassociation USING btree (updatedby_id); + +-- CREATE INDEX idxp4b569h2wevn6yxgv6veonxfr ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (association_id); +-- CREATE INDEX idxp0ldc7a577pft5v9959muhdh5 ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (evidence_id); + +-- CREATE INDEX idxvsibphiuleew24wjckpfxeae ON constructgenomicentityassociation USING btree (internal); +-- CREATE INDEX idx8myuo0a6hx59vxfhlbrcn8ujk ON constructgenomicentityassociation USING btree (constructassociationsubject_id); +-- CREATE INDEX idxevduykusoc08mycbrmn4o7dnq ON constructgenomicentityassociation USING btree (constructgenomicentityassociationobject_id); +-- CREATE INDEX idxch64a8ot2vv6i0rue8khyjb3m ON constructgenomicentityassociation USING btree (createdby_id); +-- CREATE INDEX idxi6hc4krcrxpsrrwj728vd2wpx ON constructgenomicentityassociation USING btree (obsolete); +-- CREATE INDEX idxsoyddowolab2mrp5eaxj57yar ON constructgenomicentityassociation USING btree (relation_id); +-- CREATE INDEX idxevh4c07xjfxyylj7ck2dtn6jh ON constructgenomicentityassociation USING btree (updatedby_id); + +-- CREATE INDEX idxg5fxj3nedebt3cw93uxptf7om ON constructgenomicentityassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxb9tloa39yyvirjvacah10hfd5 ON constructgenomicentityassociation_informationcontententity USING btree (evidence_id); + +CREATE INDEX constructgeassociation_note_cgea_index ON constructgenomicentityassociation_note USING btree (constructgenomicentityassociation_id); +CREATE INDEX constructgeassociation_note_relatednotes_index ON constructgenomicentityassociation_note USING btree (relatednotes_id); + +-- CREATE INDEX idxhgjuh3b5r08q54fwecp64k3a4 ON exongenomiclocationassociation USING btree (createdby_id); +-- CREATE INDEX idx82dedqro7ri1f8g558icrjxc6 ON exongenomiclocationassociation USING btree (exonassociationsubject_id); +-- CREATE INDEX idx53jvdw533s5e082xlj0sx7p7x ON exongenomiclocationassociation USING btree (exongenomiclocationassociationobject_id); +-- CREATE INDEX idx2knwxko11qkxvr98w7l76wlgi ON exongenomiclocationassociation USING btree (internal); +-- CREATE INDEX idxo923wv3e7dg9e2flm08ghwiig ON exongenomiclocationassociation USING btree (obsolete); +-- CREATE INDEX idx5ufu3a6guayhxy2cg6crxde2i ON exongenomiclocationassociation USING btree (relation_id); +-- CREATE INDEX idxdwfj56lqtx86brdvwafjqo8nn ON exongenomiclocationassociation USING btree (strand); +-- CREATE INDEX idxd12130inhcxcp1dbks190955j ON exongenomiclocationassociation USING btree (updatedby_id); + +-- CREATE INDEX idxtaunnvner3uu6vfarcb9kv0o1 ON exongenomiclocationassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxbugjixb2a6vb0xuho653me8as ON exongenomiclocationassociation_informationcontententity USING btree (evidence_id); -CREATE INDEX idxoq5yfgp5v7n0xagmgr0sj99lb ON genediseaseannotation_gene USING btree (association_id); -CREATE INDEX idx77us55vceq3g3jjrg9r6lsmer ON genediseaseannotation_gene USING btree (with_id); - -CREATE INDEX idx23muxx77utkabuwdnxfyblse0 ON genediseaseannotation_note USING btree (association_id); -CREATE INDEX idxp1sx9wg4x5r33mggresvspdgv ON genediseaseannotation_note USING btree (relatednotes_id); - -CREATE INDEX idx3epu6h5p8x2304x6mij8tyklx ON genediseaseannotation_ontologyterm USING btree (association_id); -CREATE INDEX idxl1o7i0c5y70m9kr9it6xvaubn ON genediseaseannotation_ontologyterm USING btree (evidencecodes_id); - -CREATE INDEX idxncrqkmbo3sfv1ixwu51ueon4b ON genediseaseannotation_vocabularyterm USING btree (association_id); -CREATE INDEX idxnkf114aqn7u3ggn9seti2ey2y ON genediseaseannotation_vocabularyterm USING btree (diseasequalifiers_id); +CREATE INDEX genediseaseannotation_diseaseannotationsubject_index ON genediseaseannotation USING btree (diseaseannotationsubject_id); +CREATE INDEX genediseaseannotation_sgdstrainbackground_index ON genediseaseannotation USING btree (sgdstrainbackground_id); CREATE INDEX geneexpressionannotation_createdby_index ON geneexpressionannotation USING btree (createdby_id); CREATE INDEX geneexpressionannotation_curie_index ON geneexpressionannotation USING btree (curie); @@ -239,11 +151,11 @@ CREATE INDEX geneexpressionannotation_singlereference_index ON geneexpressionann CREATE INDEX geneexpressionannotation_uniqueid_index ON geneexpressionannotation USING btree (uniqueid); CREATE INDEX geneexpressionannotation_updatedby_index ON geneexpressionannotation USING btree (updatedby_id); -CREATE INDEX idxa1uthowkvl1bch1namofq466f ON geneexpressionannotation_conditionrelation USING btree (association_id); -CREATE INDEX idxrcptfqy2xuw35xeer5ilrqtc1 ON geneexpressionannotation_conditionrelation USING btree (conditionrelations_id); +-- CREATE INDEX idxa1uthowkvl1bch1namofq466f ON geneexpressionannotation_conditionrelation USING btree (annotation_id); +-- CREATE INDEX idxrcptfqy2xuw35xeer5ilrqtc1 ON geneexpressionannotation_conditionrelation USING btree (conditionrelations_id); -CREATE INDEX idx87c6fqrsecyifcktu92y7jde4 ON geneexpressionannotation_note USING btree (association_id); -CREATE INDEX idxm4mig223w5vb6bpjubkd5xuac ON geneexpressionannotation_note USING btree (relatednotes_id); +-- CREATE INDEX idx87c6fqrsecyifcktu92y7jde4 ON geneexpressionannotation_note USING btree (annotation_id); +-- CREATE INDEX idxm4mig223w5vb6bpjubkd5xuac ON geneexpressionannotation_note USING btree (relatednotes_id); CREATE INDEX genegeneticinteraction_createdby_index ON genegeneticinteraction USING btree (createdby_id); CREATE INDEX genegeneticinteraction_geneassociationsubject_index ON genegeneticinteraction USING btree (geneassociationsubject_id); @@ -263,14 +175,14 @@ CREATE INDEX genegeneticinteraction_relation_index ON genegeneticinteraction USI CREATE INDEX genegeneticinteraction_uniqueid_index ON genegeneticinteraction USING btree (uniqueid); CREATE INDEX genegeneticinteraction_updatedby_index ON genegeneticinteraction USING btree (updatedby_id); -CREATE INDEX idxlyqi995di8uvyll25qqmvvsnq ON genegeneticinteraction_crossreference USING btree (association_id); -CREATE INDEX idxolfx2gsnlx0vyvpv85ba3s1my ON genegeneticinteraction_crossreference USING btree (crossreferences_id); +-- CREATE INDEX idxlyqi995di8uvyll25qqmvvsnq ON genegeneticinteraction_crossreference USING btree (geneinteraction_id); +-- CREATE INDEX idxolfx2gsnlx0vyvpv85ba3s1my ON genegeneticinteraction_crossreference USING btree (crossreferences_id); -CREATE INDEX idxiwxeu6vppndg2hl252knhgcm2 ON genegeneticinteraction_informationcontententity USING btree (association_id); -CREATE INDEX idx3l5ew8bcu7dqbqu2gux877rqp ON genegeneticinteraction_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idxiwxeu6vppndg2hl252knhgcm2 ON genegeneticinteraction_informationcontententity USING btree (association_id); +-- CREATE INDEX idx3l5ew8bcu7dqbqu2gux877rqp ON genegeneticinteraction_informationcontententity USING btree (evidence_id); -CREATE INDEX idx8erit2819gi1uof54xpq7c4ia ON genegeneticinteraction_phenotypesortraits USING btree (association_id); -CREATE INDEX idxkldmr3gvvv2elnbkilyuvtbsv ON genegeneticinteraction_phenotypesortraits USING btree (phenotypesortraits); +CREATE INDEX genegeneticinteraction_phenotypesortraits_interaction_index ON genegeneticinteraction_phenotypesortraits USING btree (genegeneticinteraction_id); +CREATE INDEX genegeneticinteraction_phenotypesortraits_pt_index ON genegeneticinteraction_phenotypesortraits USING btree (phenotypesortraits); CREATE INDEX genemolecularinteraction_aggregationdatabase_index ON genemolecularinteraction USING btree (aggregationdatabase_id); CREATE INDEX genemolecularinteraction_createdby_index ON genemolecularinteraction USING btree (createdby_id); @@ -290,35 +202,14 @@ CREATE INDEX genemolecularinteraction_relation_index ON genemolecularinteraction CREATE INDEX genemolecularinteraction_uniqueid_index ON genemolecularinteraction USING btree (uniqueid); CREATE INDEX genemolecularinteraction_updatedby_index ON genemolecularinteraction USING btree (updatedby_id); -CREATE INDEX idx7lx7isr6eb5w0w5in5vsncutg ON genemolecularinteraction_crossreference USING btree (crossreferences_id); -CREATE INDEX idx7wsd79wrsj6s8e33ij89a3eg8 ON genemolecularinteraction_crossreference USING btree (association_id); +-- CREATE INDEX idx7lx7isr6eb5w0w5in5vsncutg ON genemolecularinteraction_crossreference USING btree (crossreferences_id); +-- CREATE INDEX idx7wsd79wrsj6s8e33ij89a3eg8 ON genemolecularinteraction_crossreference USING btree (geneinteraction_id); -CREATE INDEX idxcuc2oxltucskw9yld02sck6kk ON genemolecularinteraction_informationcontententity USING btree (association_id); -CREATE INDEX idxqdpatuorfp3xeoa2ogmg20x1q ON genemolecularinteraction_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idxcuc2oxltucskw9yld02sck6kk ON genemolecularinteraction_informationcontententity USING btree (association_id); +-- CREATE INDEX idxqdpatuorfp3xeoa2ogmg20x1q ON genemolecularinteraction_informationcontententity USING btree (evidence_id); -CREATE INDEX genephenotypeannotation_createdby_index ON genephenotypeannotation USING btree (createdby_id); -CREATE INDEX genephenotypeannotation_crossreference_index ON genephenotypeannotation USING btree (crossreference_id); -CREATE INDEX genephenotypeannotation_curie_index ON genephenotypeannotation USING btree (curie); -CREATE INDEX genephenotypeannotation_dataprovider_index ON genephenotypeannotation USING btree (dataprovider_id); -CREATE INDEX genephenotypeannotation_internal_index ON genephenotypeannotation USING btree (internal); -CREATE INDEX genephenotypeannotation_modentityid_index ON genephenotypeannotation USING btree (modentityid); -CREATE INDEX genephenotypeannotation_modinternalid_index ON genephenotypeannotation USING btree (modinternalid); -CREATE INDEX genephenotypeannotation_obsolete_index ON genephenotypeannotation USING btree (obsolete); CREATE INDEX genephenotypeannotation_phenotypeannotationsubject_index ON genephenotypeannotation USING btree (phenotypeannotationsubject_id); -CREATE INDEX genephenotypeannotation_relation_index ON genephenotypeannotation USING btree (relation_id); CREATE INDEX genephenotypeannotation_sgdstrainbackground_index ON genephenotypeannotation USING btree (sgdstrainbackground_id); -CREATE INDEX genephenotypeannotation_singlereference_index ON genephenotypeannotation USING btree (singlereference_id); -CREATE INDEX genephenotypeannotation_uniqueid_index ON genephenotypeannotation USING btree (uniqueid); -CREATE INDEX genephenotypeannotation_updatedby_index ON genephenotypeannotation USING btree (updatedby_id); - -CREATE INDEX idxkfgsd0u371pph821s9aau68lv ON genephenotypeannotation_conditionrelation USING btree (association_id); -CREATE INDEX idx8ryt4br4hcumua9tljy5d6a3c ON genephenotypeannotation_conditionrelation USING btree (conditionrelations_id); - -CREATE INDEX idxi0xq22an9lyiv9cdhw1r3hkt6 ON genephenotypeannotation_note USING btree (association_id); -CREATE INDEX idx7w57lxopma8j5cv2enc1sw2cr ON genephenotypeannotation_note USING btree (relatednotes_id); - -CREATE INDEX idxewcqh5tp5y85t8cipw3yvhkrm ON genephenotypeannotation_ontologyterm USING btree (association_id); -CREATE INDEX idxffs8c41hve7srb9sfhjrsr29g ON genephenotypeannotation_ontologyterm USING btree (phenotypeterms_id); CREATE INDEX sqtrgeneassociation_createdby_index ON sequencetargetingreagentgeneassociation USING btree (createdby_id); CREATE INDEX sqtrgeneassociation_internal_index ON sequencetargetingreagentgeneassociation USING btree (internal); @@ -328,30 +219,30 @@ CREATE INDEX sqtrgeneassociation_sqtrassociationsubject_index ON sequencetargeti CREATE INDEX sqtrgeneassociation_sqtrgeneassociationobject_index ON sequencetargetingreagentgeneassociation USING btree (sequencetargetingreagentgeneassociationobject_id); CREATE INDEX sqtrgeneassociation_updatedby_index ON sequencetargetingreagentgeneassociation USING btree (updatedby_id); -CREATE INDEX idx3qy7to4cavfvoj89fkux971yb ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (association_id); -CREATE INDEX idxeo9v38oy64ff8lbhb656yl532 ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (evidence_id); +-- CREATE INDEX idx3qy7to4cavfvoj89fkux971yb ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (association_id); +-- CREATE INDEX idxeo9v38oy64ff8lbhb656yl532 ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (evidence_id); -CREATE INDEX idxon9k4nqnwlav7ammge7obyshm ON transcriptcodingsequenceassociation USING btree (createdby_id); -CREATE INDEX idxf95tn5xv2nugt594ch7kggtex ON transcriptcodingsequenceassociation USING btree (internal); -CREATE INDEX idxd7d7oeub6eclirxmjpmc7ibot ON transcriptcodingsequenceassociation USING btree (obsolete); -CREATE INDEX idxio6g2jejebbjqugso2ge8cncf ON transcriptcodingsequenceassociation USING btree (relation_id); -CREATE INDEX idxptss0twuhfg2ibqnb8vai4v2v ON transcriptcodingsequenceassociation USING btree (transcriptassociationsubject_id); -CREATE INDEX idx8jsnbfbebppm2memg9yywpea6 ON transcriptcodingsequenceassociation USING btree (transcriptcodingsequenceassociationobject_id); -CREATE INDEX idxe31s0f5w54vnjhxeysi3g1oy0 ON transcriptcodingsequenceassociation USING btree (updatedby_id); +-- CREATE INDEX idxon9k4nqnwlav7ammge7obyshm ON transcriptcodingsequenceassociation USING btree (createdby_id); +-- CREATE INDEX idxf95tn5xv2nugt594ch7kggtex ON transcriptcodingsequenceassociation USING btree (internal); +-- CREATE INDEX idxd7d7oeub6eclirxmjpmc7ibot ON transcriptcodingsequenceassociation USING btree (obsolete); +-- CREATE INDEX idxio6g2jejebbjqugso2ge8cncf ON transcriptcodingsequenceassociation USING btree (relation_id); +-- CREATE INDEX idxptss0twuhfg2ibqnb8vai4v2v ON transcriptcodingsequenceassociation USING btree (transcriptassociationsubject_id); +-- CREATE INDEX idx8jsnbfbebppm2memg9yywpea6 ON transcriptcodingsequenceassociation USING btree (transcriptcodingsequenceassociationobject_id); +-- CREATE INDEX idxe31s0f5w54vnjhxeysi3g1oy0 ON transcriptcodingsequenceassociation USING btree (updatedby_id); -CREATE INDEX idxl4jg4t2dlkjivgea1lta3l9xm ON transcriptcodingsequenceassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxmbtwtvy0731b13p3dhoni3ywd ON transcriptcodingsequenceassociation_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idxl4jg4t2dlkjivgea1lta3l9xm ON transcriptcodingsequenceassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxmbtwtvy0731b13p3dhoni3ywd ON transcriptcodingsequenceassociation_informationcontententity USING btree (evidence_id); -CREATE INDEX idxfdeljm7108w0j2nbrrme945ur ON transcriptexonassociation USING btree (createdby_id); -CREATE INDEX idxrig5300vc2ppesjckdkpv219m ON transcriptexonassociation USING btree (internal); -CREATE INDEX idxfmwe55e0r89q00xqlvi4v7sm0 ON transcriptexonassociation USING btree (obsolete); -CREATE INDEX idxm76icxt2r2qs52o4wpiexpb39 ON transcriptexonassociation USING btree (relation_id); -CREATE INDEX idxdct5af7efyqufibj1rjrvieam ON transcriptexonassociation USING btree (transcriptassociationsubject_id); -CREATE INDEX idxhpo9wefgxyoasohcctnr0qev3 ON transcriptexonassociation USING btree (transcriptexonassociationobject_id); -CREATE INDEX idx29575n6x9yueygvw1mj9exc2g ON transcriptexonassociation USING btree (updatedby_id); +-- CREATE INDEX idxfdeljm7108w0j2nbrrme945ur ON transcriptexonassociation USING btree (createdby_id); +-- CREATE INDEX idxrig5300vc2ppesjckdkpv219m ON transcriptexonassociation USING btree (internal); +-- CREATE INDEX idxfmwe55e0r89q00xqlvi4v7sm0 ON transcriptexonassociation USING btree (obsolete); +-- CREATE INDEX idxm76icxt2r2qs52o4wpiexpb39 ON transcriptexonassociation USING btree (relation_id); +-- CREATE INDEX idxdct5af7efyqufibj1rjrvieam ON transcriptexonassociation USING btree (transcriptassociationsubject_id); +-- CREATE INDEX idxhpo9wefgxyoasohcctnr0qev3 ON transcriptexonassociation USING btree (transcriptexonassociationobject_id); +-- CREATE INDEX idx29575n6x9yueygvw1mj9exc2g ON transcriptexonassociation USING btree (updatedby_id); -CREATE INDEX idxf124air9olggpyrs5i3rgkbkj ON transcriptexonassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxgg4iqmx96raypy761sn4h99ns ON transcriptexonassociation_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idxf124air9olggpyrs5i3rgkbkj ON transcriptexonassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxgg4iqmx96raypy761sn4h99ns ON transcriptexonassociation_informationcontententity USING btree (evidence_id); CREATE INDEX transcriptgeneassociation_createdby_index ON transcriptgeneassociation USING btree (createdby_id); CREATE INDEX transcriptgeneassociation_internal_index ON transcriptgeneassociation USING btree (internal); @@ -361,21 +252,21 @@ CREATE INDEX transcriptgeneassociation_transcriptassociationsubject_index ON tra CREATE INDEX transcriptgeneassociation_transcriptgeneassociationobject_index ON transcriptgeneassociation USING btree (transcriptgeneassociationobject_id); CREATE INDEX transcriptgeneassociation_updatedby_index ON transcriptgeneassociation USING btree (updatedby_id); -CREATE INDEX idxnu079dovpg7bfrb6uawgtscqs ON transcriptgeneassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxis18nw3pj2ru6wlejbwotqsv9 ON transcriptgeneassociation_informationcontententity USING btree (evidence_id); - -CREATE INDEX idxaicr23temspg10v3f22k52ssd ON transcriptgenomiclocationassociation USING btree (createdby_id); -CREATE INDEX idxd06sc5p3gc11brcoxwp7ppbmr ON transcriptgenomiclocationassociation USING btree (internal); -CREATE INDEX idxgrqw9lxw4l1whho97aose6qh5 ON transcriptgenomiclocationassociation USING btree (obsolete); -CREATE INDEX idxii7jvungodeeudebo6c4kebny ON transcriptgenomiclocationassociation USING btree (phase); -CREATE INDEX idxtqvg5149lyo8q1oof4hhd7mmw ON transcriptgenomiclocationassociation USING btree (relation_id); -CREATE INDEX idx9yipaclxcmb82h69o4k5q3utt ON transcriptgenomiclocationassociation USING btree (strand); -CREATE INDEX idx4yukrngwb6ipj72wujbxa87bb ON transcriptgenomiclocationassociation USING btree (transcriptassociationsubject_id); -CREATE INDEX idxgo4p2kepo9x83moktih7gurb0 ON transcriptgenomiclocationassociation USING btree (transcriptgenomiclocationassociationobject_id); -CREATE INDEX idx1fpq38gqgxatnm69ge6purjbc ON transcriptgenomiclocationassociation USING btree (updatedby_id); - -CREATE INDEX idx5bqn8a8osk6oy4514gpf8xs3 ON transcriptgenomiclocationassociation_informationcontententity USING btree (evidence_id); -CREATE INDEX idxghedmb4mmore7js1d3ni9thpn ON transcriptgenomiclocationassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxnu079dovpg7bfrb6uawgtscqs ON transcriptgeneassociation_informationcontententity USING btree (association_id); +-- CREATE INDEX idxis18nw3pj2ru6wlejbwotqsv9 ON transcriptgeneassociation_informationcontententity USING btree (evidence_id); + +-- CREATE INDEX idxaicr23temspg10v3f22k52ssd ON transcriptgenomiclocationassociation USING btree (createdby_id); +-- CREATE INDEX idxd06sc5p3gc11brcoxwp7ppbmr ON transcriptgenomiclocationassociation USING btree (internal); +-- CREATE INDEX idxgrqw9lxw4l1whho97aose6qh5 ON transcriptgenomiclocationassociation USING btree (obsolete); +-- CREATE INDEX idxii7jvungodeeudebo6c4kebny ON transcriptgenomiclocationassociation USING btree (phase); +-- CREATE INDEX idxtqvg5149lyo8q1oof4hhd7mmw ON transcriptgenomiclocationassociation USING btree (relation_id); +-- CREATE INDEX idx9yipaclxcmb82h69o4k5q3utt ON transcriptgenomiclocationassociation USING btree (strand); +-- CREATE INDEX idx4yukrngwb6ipj72wujbxa87bb ON transcriptgenomiclocationassociation USING btree (transcriptassociationsubject_id); +-- CREATE INDEX idxgo4p2kepo9x83moktih7gurb0 ON transcriptgenomiclocationassociation USING btree (transcriptgenomiclocationassociationobject_id); +-- CREATE INDEX idx1fpq38gqgxatnm69ge6purjbc ON transcriptgenomiclocationassociation USING btree (updatedby_id); + +-- CREATE INDEX idx5bqn8a8osk6oy4514gpf8xs3 ON transcriptgenomiclocationassociation_informationcontententity USING btree (evidence_id); +-- CREATE INDEX idxghedmb4mmore7js1d3ni9thpn ON transcriptgenomiclocationassociation_informationcontententity USING btree (association_id); -- Missing Index diff --git a/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql index e54eb4e25..def9d5a7d 100644 --- a/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql @@ -1,301 +1,218 @@ -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk2kkuby8cha4mi979rfrufh8ms FOREIGN KEY (assertedallele_id) REFERENCES allele(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk2umyg0v10hgtljwjbpond8jrc FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk37dsmk0slmfxeeibjqkqkixda FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk60is9ul76u2gwwt3kri70nw8 FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk7ahiuo64x1a5hxracbvlagdt FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk8gxsa86awg2oqv0vs8s7jb7fw FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk8jli70oa2ilrdlttpla0ds4di FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkcovck6ip7rxrud0twr4kid8f3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkg7mtotyaq0cs501cll3bk45hr FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkhh9as28mwsysbjgx6hwt622wr FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkjl650wl0c24o9tq3hkbggxhwy FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkjpqd4ps8pjklagy0wq6u6ljk1 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkk64jxju84kxfc90ok6uor1wv2 FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkmipqq6lp7u6rr7gif932q4vca FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); - -ALTER TABLE ONLY agmdiseaseannotation_biologicalentity ADD CONSTRAINT fkg694iaaw2ydb0cdslugifj8l5 FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); -ALTER TABLE ONLY agmdiseaseannotation_biologicalentity ADD CONSTRAINT fkhqcbm1d8ou0qqre8snp6cg5u7 FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); - -ALTER TABLE ONLY agmdiseaseannotation_conditionrelation ADD CONSTRAINT fkabtdvl6g81qdhi5cw77tnhlvl FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); -ALTER TABLE ONLY agmdiseaseannotation_conditionrelation ADD CONSTRAINT fkrgr1hx0oqqa2966t1730c8a0l FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); - -ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkbif35stv5wbi5uh9n0kdmou0q FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); -ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkcch8h6dw4rft9d68a0yn6se6e FOREIGN KEY (with_id) REFERENCES gene(id); -ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkeyw19j24y6nwrxkqk9gad9eli FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - -ALTER TABLE ONLY agmdiseaseannotation_note ADD CONSTRAINT fk7vskf61fs1ti0kk05bm4ywcg6 FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); -ALTER TABLE ONLY agmdiseaseannotation_note ADD CONSTRAINT fkr55esx6lfo1f4u9eem1iwfkgx FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY agmdiseaseannotation_ontologyterm ADD CONSTRAINT fkhldp7usikdqpabhs8k6e7tqm6 FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY agmdiseaseannotation_ontologyterm ADD CONSTRAINT fktbnis09ieoxxxn0uac17y4tqj FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); - -ALTER TABLE ONLY agmdiseaseannotation_vocabularyterm ADD CONSTRAINT fk7tkcolewth9efu38upga0s8fr FOREIGN KEY (association_id) REFERENCES agmdiseaseannotation(id); -ALTER TABLE ONLY agmdiseaseannotation_vocabularyterm ADD CONSTRAINT fkrj9u5k77j4lljg6bw7qo1y20w FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fk22g2vuw5nph0qq41xtij396e3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fk7plbgonr9g4yoefd1k5t0b1ap FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkf0v97kcpydfiqiyvl3uh3rc90 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkk86dqfob7lotkw7yuxd5dkaln FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkkblpivg8a4flg0t34evh25w8v FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkl1478mporoblxqjhqwma373ge FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkn1pb5j9be6lbvv8cwykecqjr9 FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkn9jqg4yu2l1fq57f9k7egtawo FOREIGN KEY (assertedallele_id) REFERENCES allele(id); -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkry48ahelheguy1pbu5dccxo2c FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; -ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fksf5ja292y4tqljav1jrqeg60b FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY agmphenotypeannotation_conditionrelation ADD CONSTRAINT fk707208iqski5px893183pk8f3 FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); -ALTER TABLE ONLY agmphenotypeannotation_conditionrelation ADD CONSTRAINT fk7g3pjr9xu3425uylbk5v7ijje FOREIGN KEY (association_id) REFERENCES agmphenotypeannotation(id); - -ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fk3bh3w7dbey6cmvnjveqrcmw3p FOREIGN KEY (association_id) REFERENCES agmphenotypeannotation(id); -ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fks0f8p72jth9vtbquhyir7wpbh FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - -ALTER TABLE ONLY agmphenotypeannotation_note ADD CONSTRAINT fkm35y1lsuyeoa4wsvw0s7fa8ge FOREIGN KEY (association_id) REFERENCES agmphenotypeannotation(id); -ALTER TABLE ONLY agmphenotypeannotation_note ADD CONSTRAINT fkswu81d1c6sq3b654gow81kpdc FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY agmphenotypeannotation_ontologyterm ADD CONSTRAINT fkkcbaa7jit2qom15cggnbiw45b FOREIGN KEY (association_id) REFERENCES agmphenotypeannotation(id); -ALTER TABLE ONLY agmphenotypeannotation_ontologyterm ADD CONSTRAINT fkjxjka3d3dapimmtx0dy0okela FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); - -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fk42ltpt92iwcgrcvsx385p40pj FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fk7hkgbbyd5jadc48u1eni1fn7 FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fk8m4n3t9g0m0tfaenq42amdkwy FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkfffivtd2k2wonukc72nwnpomc FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkfis6g4qua1wjxsobv3398u8l5 FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkh4r54eorp2fnd2obo645vw8re FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fknj79ev10ouw1yary8lo3dpnqo FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fko7hnqo0kyxuppl70d9uhd01vl FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkoc7ltgyt521kcoykk39i6xuj5 FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkqeqofi8sivg0j670gwpg5yvpp FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fks31cr9r8ljjv3c775f6bqwpw2 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fktp2an4byav09yi71drrvtyjum FOREIGN KEY (inferredgene_id) REFERENCES gene(id); - -ALTER TABLE ONLY allelediseaseannotation_biologicalentity ADD CONSTRAINT fkccm3v2woslqydwlv72lp3vx09 FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); -ALTER TABLE ONLY allelediseaseannotation_biologicalentity ADD CONSTRAINT fkf7n8yi30vh2g4xr4ty7rut36b FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); - -ALTER TABLE ONLY allelediseaseannotation_conditionrelation ADD CONSTRAINT fkdi2ictyxqiy8n8txrcpo1tkcl FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); -ALTER TABLE ONLY allelediseaseannotation_conditionrelation ADD CONSTRAINT fkn8emvy8ykt02ba1vhdqrayi7c FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); - -ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fk6ogbd2pywnhgiry1udwepkmtb FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); -ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fkfsapico38pk6ubspimgsjn4a5 FOREIGN KEY (with_id) REFERENCES gene(id); -ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fkkqvw9ea43v28gre268o3si6ay FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); - -ALTER TABLE ONLY allelediseaseannotation_note ADD CONSTRAINT fke6j1lk9gvp4d1ujt0eq7gxpv2 FOREIGN KEY (relatednotes_id) REFERENCES note(id); -ALTER TABLE ONLY allelediseaseannotation_note ADD CONSTRAINT fkmgq0kr71emrafr30h83rf2f56 FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); - -ALTER TABLE ONLY allelediseaseannotation_ontologyterm ADD CONSTRAINT fkb5bevp4fqns7j142jlkkv3vkj FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); -ALTER TABLE ONLY allelediseaseannotation_ontologyterm ADD CONSTRAINT fkto9gfo88e6h0hu903w6u4sfuu FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); - -ALTER TABLE ONLY allelediseaseannotation_vocabularyterm ADD CONSTRAINT fk6g35a17r6un4jgayjlr8ianq2 FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelediseaseannotation_vocabularyterm ADD CONSTRAINT fkfbis46u2ip7c7xs2b39v8n5d8 FOREIGN KEY (association_id) REFERENCES allelediseaseannotation(id); - -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fk6p0nk2n01ab2ksjrdlyq25h4y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkao3pmku9d1lh67ptuiq2t08wr FOREIGN KEY (allelegeneassociationobject_id) REFERENCES gene(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fki6gdp1pjjtirs1v3k47oluqc3 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkjhasohfaw7s26ogq5eg772rf0 FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fko082oqtvkx9k55nm67vas3n1k FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkqn4egk0drms9hxcekff8gam6q FOREIGN KEY (relatednote_id) REFERENCES note(id); -ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fktho8ivna95vaox70mtry5cwwj FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); - -ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkemd3tife09j5ur86mf0elsjr9 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); -ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkj6e0pl03cm27tahbt289e5h3f FOREIGN KEY (association_id) REFERENCES allelegeneassociation(id); - -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk101brljqqqmm4n02rtvlbse5 FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk1nd47lkg6wge7vtkdf61m9dqj FOREIGN KEY (inferredgene_id) REFERENCES gene(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk229u0i4c687jymh0fnd477ajq FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk42cguk3r5h43w7533h5daync2 FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk49apxime31ari75ylx5dgfg3v FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fkbqvnnkft2o1qbt80wx5gf9vqe FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fkg0srqxfsmbh36t2oi242nlgwc FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fkmurlgsm5dsodxtj3rg2dccrcs FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; - -ALTER TABLE ONLY allelephenotypeannotation_conditionrelation ADD CONSTRAINT fk9qt748e11jcsk27v8huk1d81u FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); -ALTER TABLE ONLY allelephenotypeannotation_conditionrelation ADD CONSTRAINT fknlx29g363lg7vfcgu8oyf9my3 FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); - -ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkdqeeeahsm84hjksl8593fbo6v FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); -ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkp6gsx4q1q2d5ct5kpumhbd94y FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - -ALTER TABLE ONLY allelephenotypeannotation_note ADD CONSTRAINT fk1jpugur8ys3h6xxnf8efakprb FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); -ALTER TABLE ONLY allelephenotypeannotation_note ADD CONSTRAINT fkl1wvmkkdgr5tdl78u7nvb5xsj FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY allelephenotypeannotation_ontologyterm ADD CONSTRAINT fkqhv6onfy2edcrm5khqvfgojs5 FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); -ALTER TABLE ONLY allelephenotypeannotation_ontologyterm ADD CONSTRAINT fkrwlge742entlnkle2g9rj3mne FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); - -ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk4efucyh5rpl0g0fpdti9y0qda FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk6q7qkw2peq0erl2n4cni6kbyb FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); -ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkbdlaouhol3v1law37h2q9ifaw FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkipqt0lqrx61hgek3pmt679xoj FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); -ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fklkt1u6mvqb5im061x5437amin FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fkm4es4h50h4511egeuoyfyxk0v FOREIGN KEY (association_id) REFERENCES codingsequencegenomiclocationassociation(id); -ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fksugal77n5hdh385dgpdx9tdmc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - -ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk5me06it1f8io7h4mktk6431b2 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk9i7kbfdcy5hn6ws7xxf5kh0h2 FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); -ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkei5227y3hjt2t6vsduwaqnnk7 FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkjg9e0tx4lynyaolbllcc3vg02 FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); -ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkpa6wqqg7gmm5d2nqdcml13aj3 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fka63t5u6e2c4dtcuwkwrhc8u9q FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); -ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fkf95vn8pjy50619o0y7iefyxo9 FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); - -ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fk9whd0ahcjprqnj131koir30wf FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); -ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fkg64353f5upaidhljoj6m1yuc9 FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk3c0ysdo5k8nmm0u6evjr1hdjo FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk5gbibcffgcyxc4ecwwl6jqks6 FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fka0ne6k6iyq1rp73ij2s5upbfw FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkj36y7gfpojdgw0cei8p09uv5j FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); -ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkrhqru9jlmpeb9hllrbyonmndh FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); - -ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkr5x4yhyie8e2cxetmuls112a3 FOREIGN KEY (association_id) REFERENCES exongenomiclocationassociation(id); -ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkti351r4r2wp3cm7e5f3qn894g FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fk230r383qgr3s3y77me480n02w FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fk4k2s1b7glrbvk1751x2jp40qy FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fk56ujtsnv32ped0i923pbw7nvr FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fk5ju06d2elbol4e5rn216bwu8h FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fk5sgdwglijf43tnomai4weganh FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkiciy6a2x78onye45ax0f6ipqv FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkiwlsm7bc6tqyfjn9x7oyes0l1 FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkpslxu551f5mb4y838s36fopnd FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkq3305m88m8kjyl7ugujlb25mh FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkq452h9xivcnjug7llpg47x9vu FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkrb70ercqcvrw29rfkivta704o FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; -ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fktpww72cuubetd08y0ansac6gw FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); - -ALTER TABLE ONLY genediseaseannotation_biologicalentity ADD CONSTRAINT fk997a8tmb3lgecgctpcytjfowr FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); -ALTER TABLE ONLY genediseaseannotation_biologicalentity ADD CONSTRAINT fkecpmsmvm8crgl8tucp7f1ncfd FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); - -ALTER TABLE ONLY genediseaseannotation_conditionrelation ADD CONSTRAINT fk41jvy0lvt457rvgxvqocsggcd FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); -ALTER TABLE ONLY genediseaseannotation_conditionrelation ADD CONSTRAINT fk41webdj74tx200uh994mgq4jx FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); - -ALTER TABLE ONLY genediseaseannotation_gene ADD CONSTRAINT fkoqp2d0qlbfft9lh6udxnuilva FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); -ALTER TABLE ONLY genediseaseannotation_gene ADD CONSTRAINT fktqcxe6wwrywdse3cm1ao4rnf FOREIGN KEY (with_id) REFERENCES gene(id); - -ALTER TABLE ONLY genediseaseannotation_note ADD CONSTRAINT fketxyiuqpuuvd7cymffkstds9d FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); -ALTER TABLE ONLY genediseaseannotation_note ADD CONSTRAINT fkt7sfpmi1cxfkls5s3bpyenlie FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY genediseaseannotation_ontologyterm ADD CONSTRAINT fk2y3hmiucnqgko7ljoujcf9gtn FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genediseaseannotation_ontologyterm ADD CONSTRAINT fk8gau68rht88pm0s63ckb92ayv FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); - -ALTER TABLE ONLY genediseaseannotation_vocabularyterm ADD CONSTRAINT fkhb4982srkc5qrhnsrvxc0t2ux FOREIGN KEY (association_id) REFERENCES genediseaseannotation(id); -ALTER TABLE ONLY genediseaseannotation_vocabularyterm ADD CONSTRAINT fkhovnk1srpjjuod10f68cejegw FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk17ng0qvlftfcfwrvr1yhrnh9h FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk2xe5vtnm2sba1a8legviqpytj FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk5gdi65gt84d6ieu34ncu33ftf FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkgx41eka7b0e065kwo23n5fs5q FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fklaj7vmfvdk90xkn6qadgfxwdr FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fknrlc59ffsxn8bc4h8kwj7mgu4 FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkny440x2v8wufob980onb8vexv FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkpmfpi2pglpegd8c5ssqh2uv1w FOREIGN KEY (expressionannotationsubject_id) REFERENCES gene(id); - -ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fk967wi9o53ibvsoww5pxr7y3y2 FOREIGN KEY (association_id) REFERENCES geneexpressionannotation(id); -ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fkqlyp0tmp9kowr3fasiq4lfgp FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); - -ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fk555k6362tmne0w4km2e2khn9a FOREIGN KEY (association_id) REFERENCES geneexpressionannotation(id); -ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fko3gm56s7kyef1fp07fwq69lw4 FOREIGN KEY (relatednotes_id) REFERENCES note(id); - -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk223kijupg28b6mm86feo17r87 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk71xgxcnjkufiafwbavyr6m2ka FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkb68mw5p0eril3ff6nfa47vqh8 FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcnm6fb1eihhe5nuj2wiaksd8f FOREIGN KEY (interactorbgeneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcsuqi3l8tradsactj8t52khud FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkd70w7xi4ml95h5banj5vy2lqc FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkfxq8sixxwkb1jv7rh18yvwi53 FOREIGN KEY (interactorageneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkh2fp3yothl234yu9kitgspfpd FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkhj6l8tygpxpab2moqx4h4pef7 FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkj4fphalc7tmgy8sp7e0qsm5sx FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkkr3yyhywq1px02gnli02eynvs FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fklov5kqhbymgrnmifgy1sdf09l FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); -ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkpgava8ud39i9a1bbioqm8s6hy FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); - -ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fkgkf3r1nb1c4nk32xex79psi42 FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); -ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fksog88v596kgbud929oeonf92s FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); - -ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgpv0m4gscumstbs8y3ek9sp2k FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); -ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgutrng68vtdhwr1qlx92ml715 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - -ALTER TABLE ONLY genegeneticinteraction_phenotypesortraits ADD CONSTRAINT fk428xqcrj9euixb8jryhqqjc4g FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); - -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fk1jgic74kl1c0g8b00li2x9uta FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkafjwyp0cf3pqof2ri7yirj07a FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkc2ts1psdlxv1q5pt4bykdgx2x FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkgmt12207c9ll4jj2ev9tb7ltr FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkhfosavsr0c588aoyt243idi6s FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkk9kl5bdcfebb9nn8ux6hv84vn FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkl11owt2vsvjj6gfctjg0wm5ee FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkob42y8ggn4tqr5dj8wp5jarvc FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkpf8prdftq2o1ayen1c8w3kbrj FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkr8u0gn70cc7va4q0yt8o0wh6p FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fks6m85gh445ieytj9n665rr9eg FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksjxeqrdby7udc1v71xcawbehr FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); -ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksqnn5xdoniaory4upnkkk2iry FOREIGN KEY (updatedby_id) REFERENCES person(id); - -ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fkmnlia9wqktsqf6n0nce2q2l9 FOREIGN KEY (association_id) REFERENCES genemolecularinteraction(id); -ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fk6rdt433qfoib1q26sbxbpt489 FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); - -ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fk7u6wpv1juxshjv1noyshkrtla FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); -ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fkooo9u7pkb7yar3qlbdb9k1l87 FOREIGN KEY (association_id) REFERENCES genemolecularinteraction(id); - -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fk8e6wa7h1d64pvueh9ng7gpksc FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkbuqi03vioqtwqen2i9ugemqye FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkca9jnh4snsv4whcxfhiuv3o5f FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkdvj438fmosypfu23ye94uv8xb FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkfwoaro9y8jb8ld9h5pkgfs0px FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkmv9qr19e1qpktumygwwh4529v FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fknbwaxf7q90q37uiuckxtsjl27 FOREIGN KEY (singlereference_id) REFERENCES reference(id); -ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkrirgjcbqkye098mm2rlmwtkiw FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY genephenotypeannotation_conditionrelation ADD CONSTRAINT fk3gowvbi5oxp5e2c2h1ctmym1b FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); -ALTER TABLE ONLY genephenotypeannotation_conditionrelation ADD CONSTRAINT fkecdfrx4xcidcao5u5t7gy6kna FOREIGN KEY (association_id) REFERENCES genephenotypeannotation(id); - -ALTER TABLE ONLY genephenotypeannotation_note ADD CONSTRAINT fk7v0xrmd5k8x0yvhj3sxcagsao FOREIGN KEY (relatednotes_id) REFERENCES note(id); -ALTER TABLE ONLY genephenotypeannotation_note ADD CONSTRAINT fkqq8853dx3cr8e1oi7j86j5rl9 FOREIGN KEY (association_id) REFERENCES genephenotypeannotation(id); - -ALTER TABLE ONLY genephenotypeannotation_ontologyterm ADD CONSTRAINT fk3br051cdktiitm6sdqglxyyk9 FOREIGN KEY (association_id) REFERENCES genephenotypeannotation(id); -ALTER TABLE ONLY genephenotypeannotation_ontologyterm ADD CONSTRAINT fkip82aeh1egcbkry0t10gnkqjv FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); - -ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk4oywb4vxq460mph6qqfucrklc FOREIGN KEY (sequencetargetingreagentassociationsubject_id) REFERENCES sequencetargetingreagent(id); -ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk7h8rchplqiu7rji3t751d16fb FOREIGN KEY (sequencetargetingreagentgeneassociationobject_id) REFERENCES gene(id); -ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkaxs3aj4tdrywqpf6sfrk824rn FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkf34iyy9myqed615lvm21exrp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkp1m5va6abm32twxddmcxl50xb FOREIGN KEY (createdby_id) REFERENCES person(id); - -ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fke9vquysmfh3c4lkcfmajh5hj8 FOREIGN KEY (association_id) REFERENCES sequencetargetingreagentgeneassociation(id); -ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fkfib30x859rb0p83hlojly8ghc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - -ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk13y1vlql0xt9moj0ulf4nsdj7 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4n6xdc24lo3rymynnjmjg98yb FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4wsw77bry9naicli7b6jxqqq8 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); -ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkjlfma6v1oit4atwbwelo6b3uw FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); -ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkpos4jj7u82aojox7pssksgkjx FOREIGN KEY (createdby_id) REFERENCES person(id); - -ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fk7i7m32cuet11t71r7arbao3yy FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); -ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fkk6mgowf6uq7nw8cxa2huj8h67 FOREIGN KEY (association_id) REFERENCES transcriptcodingsequenceassociation(id); - -ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fka00ut46dje2rc4qtbryl8as7b FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkdmwvnm7xnfh3qo8k0f3933opr FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); -ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkfbxqumoil00tmd67mawmscdt7 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkoug4l2bpj2ineapkwnopxcld4 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); -ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkruqduw01ixripbq0jsy6bvj8d FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - -ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkgdasgw5u791fn92fdkskn51w3 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); -ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkiii0hpbot3mksbdyesqj38ust FOREIGN KEY (association_id) REFERENCES transcriptexonassociation(id); - -ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3dbarf3ebsa6kjvu3j8wv5s99 FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); -ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3j11pvym3scjrw7889oos21rd FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); -ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkdbaufd0xuh8vql7po8vityjnd FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkii8alynjje87mims76rjvhubp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkk1vrpkcc7j2edjvfbidq5fil6 FOREIGN KEY (createdby_id) REFERENCES person(id); - -ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fk4j4tyh9wjrr4xcaau05thvmrl FOREIGN KEY (association_id) REFERENCES transcriptgeneassociation(id); -ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fkrfpiqj508x62wbmf8hn6c2iq6 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - -ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk2xsh4isfa05148kxx4b44sx22 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk68ctcfo18ki8aecl8nwoe5iy7 FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk7x6dki5ye5bo7q8l7q4spliwn FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); -ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fko9x0yg7fso9wrakgkjgik5jf8 FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fksrry8iu0efl589u9e36028k00 FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); - -ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fk5byb2ffc3nvu6iroggtof0p96 FOREIGN KEY (association_id) REFERENCES transcriptgenomiclocationassociation(id); -ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fkf72x535nil1ng129s1sg13lko FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk2kkuby8cha4mi979rfrufh8ms FOREIGN KEY (assertedallele_id) REFERENCES allele(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk2umyg0v10hgtljwjbpond8jrc FOREIGN KEY (singlereference_id) REFERENCES reference(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk37dsmk0slmfxeeibjqkqkixda FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk60is9ul76u2gwwt3kri70nw8 FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk7ahiuo64x1a5hxracbvlagdt FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk8gxsa86awg2oqv0vs8s7jb7fw FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk8jli70oa2ilrdlttpla0ds4di FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkcovck6ip7rxrud0twr4kid8f3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkg7mtotyaq0cs501cll3bk45hr FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkhh9as28mwsysbjgx6hwt622wr FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkjl650wl0c24o9tq3hkbggxhwy FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkjpqd4ps8pjklagy0wq6u6ljk1 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkk64jxju84kxfc90ok6uor1wv2 FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +-- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkmipqq6lp7u6rr7gif932q4vca FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); + +-- ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT fkg694iaaw2ydb0cdslugifj8l5 FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); +-- ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT fkhqcbm1d8ou0qqre8snp6cg5u7 FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); + +-- ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT fkabtdvl6g81qdhi5cw77tnhlvl FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); +-- ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT fkrgr1hx0oqqa2966t1730c8a0l FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); + +-- ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT fkbif35stv5wbi5uh9n0kdmou0q FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); +-- ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT fkcch8h6dw4rft9d68a0yn6se6e FOREIGN KEY (with_id) REFERENCES gene(id); +-- ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkbif35stv5wbi5uh9n0kdmou0q FOREIGN KEY (agmdiseaseannotation_id) REFERENCES agmdiseaseannotation(id); +-- ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkeyw19j24y6nwrxkqk9gad9eli FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT fk7vskf61fs1ti0kk05bm4ywcg6 FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); +-- ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT fkr55esx6lfo1f4u9eem1iwfkgx FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +-- ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT fkhldp7usikdqpabhs8k6e7tqm6 FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT fktbnis09ieoxxxn0uac17y4tqj FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); + +-- ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT fk7tkcolewth9efu38upga0s8fr FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); +-- ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT fkrj9u5k77j4lljg6bw7qo1y20w FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); + +-- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fk22g2vuw5nph0qq41xtij396e3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fk7plbgonr9g4yoefd1k5t0b1ap FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); +-- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkf0v97kcpydfiqiyvl3uh3rc90 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkk86dqfob7lotkw7yuxd5dkaln FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkkblpivg8a4flg0t34evh25w8v FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkl1478mporoblxqjhqwma373ge FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkn1pb5j9be6lbvv8cwykecqjr9 FOREIGN KEY (singlereference_id) REFERENCES reference(id); +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkn9jqg4yu2l1fq57f9k7egtawo FOREIGN KEY (assertedallele_id) REFERENCES allele(id); +-- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkry48ahelheguy1pbu5dccxo2c FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fksf5ja292y4tqljav1jrqeg60b FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +-- ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT fk707208iqski5px893183pk8f3 FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); +-- ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT fk7g3pjr9xu3425uylbk5v7ijje FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); + +-- ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fk3bh3w7dbey6cmvnjveqrcmw3p FOREIGN KEY (agmphenotypeannotation_id) REFERENCES agmphenotypeannotation(id); +-- ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fks0f8p72jth9vtbquhyir7wpbh FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT fkm35y1lsuyeoa4wsvw0s7fa8ge FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); +-- ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT fkswu81d1c6sq3b654gow81kpdc FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +-- ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT fkkcbaa7jit2qom15cggnbiw45b FOREIGN KEY (phenotypeannotation_id) REFERENCES phenotypeannotation(id); +-- ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT fkjxjka3d3dapimmtx0dy0okela FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); + +-- ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkqeqofi8sivg0j670gwpg5yvpp FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fktp2an4byav09yi71drrvtyjum FOREIGN KEY (inferredgene_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fk6ogbd2pywnhgiry1udwepkmtb FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); +-- ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fkkqvw9ea43v28gre268o3si6ay FOREIGN KEY (allelediseaseannotation_id) REFERENCES allelediseaseannotation(id); + +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fk6p0nk2n01ab2ksjrdlyq25h4y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkao3pmku9d1lh67ptuiq2t08wr FOREIGN KEY (allelegeneassociationobject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fki6gdp1pjjtirs1v3k47oluqc3 FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkjhasohfaw7s26ogq5eg772rf0 FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fko082oqtvkx9k55nm67vas3n1k FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkqn4egk0drms9hxcekff8gam6q FOREIGN KEY (relatednote_id) REFERENCES note(id); +-- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fktho8ivna95vaox70mtry5cwwj FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); + +-- ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkemd3tife09j5ur86mf0elsjr9 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkj6e0pl03cm27tahbt289e5h3f FOREIGN KEY (association_id) REFERENCES allelegeneassociation(id); + +-- ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk1nd47lkg6wge7vtkdf61m9dqj FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +-- ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fkmurlgsm5dsodxtj3rg2dccrcs FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; + +-- ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkdqeeeahsm84hjksl8593fbo6v FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); +-- ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkp6gsx4q1q2d5ct5kpumhbd94y FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk4efucyh5rpl0g0fpdti9y0qda FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk6q7qkw2peq0erl2n4cni6kbyb FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +-- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkbdlaouhol3v1law37h2q9ifaw FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkipqt0lqrx61hgek3pmt679xoj FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); +-- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fklkt1u6mvqb5im061x5437amin FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +-- ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fkm4es4h50h4511egeuoyfyxk0v FOREIGN KEY (association_id) REFERENCES codingsequencegenomiclocationassociation(id); +-- ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fksugal77n5hdh385dgpdx9tdmc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk5me06it1f8io7h4mktk6431b2 FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk9i7kbfdcy5hn6ws7xxf5kh0h2 FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); +-- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkei5227y3hjt2t6vsduwaqnnk7 FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkjg9e0tx4lynyaolbllcc3vg02 FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); +-- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkpa6wqqg7gmm5d2nqdcml13aj3 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +-- ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fka63t5u6e2c4dtcuwkwrhc8u9q FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fkf95vn8pjy50619o0y7iefyxo9 FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); + +-- ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fk9whd0ahcjprqnj131koir30wf FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); +-- ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fkg64353f5upaidhljoj6m1yuc9 FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +-- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk3c0ysdo5k8nmm0u6evjr1hdjo FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk5gbibcffgcyxc4ecwwl6jqks6 FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fka0ne6k6iyq1rp73ij2s5upbfw FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkj36y7gfpojdgw0cei8p09uv5j FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); +-- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkrhqru9jlmpeb9hllrbyonmndh FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +-- ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkr5x4yhyie8e2cxetmuls112a3 FOREIGN KEY (association_id) REFERENCES exongenomiclocationassociation(id); +-- ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkti351r4r2wp3cm7e5f3qn894g FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkrb70ercqcvrw29rfkivta704o FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fktpww72cuubetd08y0ansac6gw FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); + +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk17ng0qvlftfcfwrvr1yhrnh9h FOREIGN KEY (singlereference_id) REFERENCES reference(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk2xe5vtnm2sba1a8legviqpytj FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk5gdi65gt84d6ieu34ncu33ftf FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkgx41eka7b0e065kwo23n5fs5q FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fklaj7vmfvdk90xkn6qadgfxwdr FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fknrlc59ffsxn8bc4h8kwj7mgu4 FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkny440x2v8wufob980onb8vexv FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +-- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkpmfpi2pglpegd8c5ssqh2uv1w FOREIGN KEY (expressionannotationsubject_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fk967wi9o53ibvsoww5pxr7y3y2 FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); +-- ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fkqlyp0tmp9kowr3fasiq4lfgp FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); + +-- ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fk555k6362tmne0w4km2e2khn9a FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); +-- ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fko3gm56s7kyef1fp07fwq69lw4 FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk223kijupg28b6mm86feo17r87 FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk71xgxcnjkufiafwbavyr6m2ka FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkb68mw5p0eril3ff6nfa47vqh8 FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcnm6fb1eihhe5nuj2wiaksd8f FOREIGN KEY (interactorbgeneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcsuqi3l8tradsactj8t52khud FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkd70w7xi4ml95h5banj5vy2lqc FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkfxq8sixxwkb1jv7rh18yvwi53 FOREIGN KEY (interactorageneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkh2fp3yothl234yu9kitgspfpd FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkhj6l8tygpxpab2moqx4h4pef7 FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkj4fphalc7tmgy8sp7e0qsm5sx FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkkr3yyhywq1px02gnli02eynvs FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fklov5kqhbymgrnmifgy1sdf09l FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkpgava8ud39i9a1bbioqm8s6hy FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); + +-- ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fkgkf3r1nb1c4nk32xex79psi42 FOREIGN KEY (geneinteraction_id) REFERENCES genegeneticinteraction(id); +-- ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fksog88v596kgbud929oeonf92s FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +-- ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgpv0m4gscumstbs8y3ek9sp2k FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); +-- ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgutrng68vtdhwr1qlx92ml715 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- ALTER TABLE ONLY genegeneticinteraction_phenotypesortraits ADD CONSTRAINT fk428xqcrj9euixb8jryhqqjc4g FOREIGN KEY (genegeneticinteraction_id) REFERENCES genegeneticinteraction(id); + +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fk1jgic74kl1c0g8b00li2x9uta FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkafjwyp0cf3pqof2ri7yirj07a FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkc2ts1psdlxv1q5pt4bykdgx2x FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkgmt12207c9ll4jj2ev9tb7ltr FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkhfosavsr0c588aoyt243idi6s FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkk9kl5bdcfebb9nn8ux6hv84vn FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkl11owt2vsvjj6gfctjg0wm5ee FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkob42y8ggn4tqr5dj8wp5jarvc FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkpf8prdftq2o1ayen1c8w3kbrj FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkr8u0gn70cc7va4q0yt8o0wh6p FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fks6m85gh445ieytj9n665rr9eg FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksjxeqrdby7udc1v71xcawbehr FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksqnn5xdoniaory4upnkkk2iry FOREIGN KEY (updatedby_id) REFERENCES person(id); + +-- ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fkmnlia9wqktsqf6n0nce2q2l9 FOREIGN KEY (geneinteraction_id) REFERENCES genemolecularinteraction(id); +-- ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fk6rdt433qfoib1q26sbxbpt489 FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +-- ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fk7u6wpv1juxshjv1noyshkrtla FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fkooo9u7pkb7yar3qlbdb9k1l87 FOREIGN KEY (association_id) REFERENCES genemolecularinteraction(id); + +-- ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fk8e6wa7h1d64pvueh9ng7gpksc FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); +-- ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkca9jnh4snsv4whcxfhiuv3o5f FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; + +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk4oywb4vxq460mph6qqfucrklc FOREIGN KEY (sequencetargetingreagentassociationsubject_id) REFERENCES sequencetargetingreagent(id); +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk7h8rchplqiu7rji3t751d16fb FOREIGN KEY (sequencetargetingreagentgeneassociationobject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkaxs3aj4tdrywqpf6sfrk824rn FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkf34iyy9myqed615lvm21exrp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkp1m5va6abm32twxddmcxl50xb FOREIGN KEY (createdby_id) REFERENCES person(id); + +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fke9vquysmfh3c4lkcfmajh5hj8 FOREIGN KEY (association_id) REFERENCES sequencetargetingreagentgeneassociation(id); +-- ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fkfib30x859rb0p83hlojly8ghc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk13y1vlql0xt9moj0ulf4nsdj7 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4n6xdc24lo3rymynnjmjg98yb FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4wsw77bry9naicli7b6jxqqq8 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +-- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkjlfma6v1oit4atwbwelo6b3uw FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); +-- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkpos4jj7u82aojox7pssksgkjx FOREIGN KEY (createdby_id) REFERENCES person(id); + +-- ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fk7i7m32cuet11t71r7arbao3yy FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fkk6mgowf6uq7nw8cxa2huj8h67 FOREIGN KEY (association_id) REFERENCES transcriptcodingsequenceassociation(id); + +-- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fka00ut46dje2rc4qtbryl8as7b FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkdmwvnm7xnfh3qo8k0f3933opr FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); +-- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkfbxqumoil00tmd67mawmscdt7 FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkoug4l2bpj2ineapkwnopxcld4 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +-- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkruqduw01ixripbq0jsy6bvj8d FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +-- ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkgdasgw5u791fn92fdkskn51w3 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +-- ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkiii0hpbot3mksbdyesqj38ust FOREIGN KEY (association_id) REFERENCES transcriptexonassociation(id); + +-- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3dbarf3ebsa6kjvu3j8wv5s99 FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); +-- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3j11pvym3scjrw7889oos21rd FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +-- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkdbaufd0xuh8vql7po8vityjnd FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkii8alynjje87mims76rjvhubp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkk1vrpkcc7j2edjvfbidq5fil6 FOREIGN KEY (createdby_id) REFERENCES person(id); + +-- ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fk4j4tyh9wjrr4xcaau05thvmrl FOREIGN KEY (association_id) REFERENCES transcriptgeneassociation(id); +-- ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fkrfpiqj508x62wbmf8hn6c2iq6 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +-- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk2xsh4isfa05148kxx4b44sx22 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +-- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk68ctcfo18ki8aecl8nwoe5iy7 FOREIGN KEY (updatedby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk7x6dki5ye5bo7q8l7q4spliwn FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +-- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fko9x0yg7fso9wrakgkjgik5jf8 FOREIGN KEY (createdby_id) REFERENCES person(id); +-- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fksrry8iu0efl589u9e36028k00 FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +-- ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fk5byb2ffc3nvu6iroggtof0p96 FOREIGN KEY (association_id) REFERENCES transcriptgenomiclocationassociation(id); +-- ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fkf72x535nil1ng129s1sg13lko FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); From 2de412e144ce6cc46c6ca9e1e671434d0769e997 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 1 Oct 2024 09:58:57 -0500 Subject: [PATCH 278/342] add row highligting to entity counts table --- .../src/components/EntityCountsComponent.js | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/cliapp/src/components/EntityCountsComponent.js b/src/main/cliapp/src/components/EntityCountsComponent.js index 9302868cb..7cd9ad915 100644 --- a/src/main/cliapp/src/components/EntityCountsComponent.js +++ b/src/main/cliapp/src/components/EntityCountsComponent.js @@ -45,11 +45,27 @@ export const EntityCountsComponent = () => { return {rowData.name}; }; + const ROW_HIGHLIGHT_IGNORE = ['Disease Annotations', 'Literature References', 'Bulk Loads / Failed Loads']; + + const getRowClass = (rowData) => { + if (ROW_HIGHLIGHT_IGNORE.includes(rowData.name)) return; + + if (rowData?.dbCount !== rowData.esCount) { + return 'bg-gray-500 text-white'; + } + }; + return ( <>
- + getRowClass(rowData)} + > {
- + getRowClass(rowData)} + > {
- + getRowClass(rowData)} + > Date: Tue, 1 Oct 2024 22:16:32 +0100 Subject: [PATCH 279/342] Fixes --- .../model/entities/DiseaseAnnotation.java | 3 + .../model/entities/PhenotypeAnnotation.java | 3 + ...37.0.51__mappersuperclass__assocations.sql | 3 +- ...37.0.53__mappersuperclass__assocations.sql | 2 +- ...37.0.54__mappersuperclass__assocations.sql | 184 ++++---- ...37.0.55__mappersuperclass__assocations.sql | 436 +++++++++--------- .../ExpressionBulkUploadFmsITCase.java | 1 - 7 files changed, 318 insertions(+), 314 deletions(-) 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 3eff7ddc4..5a25d0a73 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 @@ -28,6 +28,8 @@ 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; @@ -37,6 +39,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; +@Inheritance(strategy = InheritanceType.JOINED) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = AGMDiseaseAnnotation.class, name = "AGMDiseaseAnnotation"), diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java index 1019690d9..3c9fcbeb8 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/PhenotypeAnnotation.java @@ -25,6 +25,8 @@ import jakarta.persistence.CascadeType; 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; @@ -35,6 +37,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; +@Inheritance(strategy = InheritanceType.JOINED) @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = AGMPhenotypeAnnotation.class, name = "AGMPhenotypeAnnotation"), @Type(value = AllelePhenotypeAnnotation.class, name = "AllelePhenotypeAnnotation"), @Type(value = GenePhenotypeAnnotation.class, name = "GenePhenotypeAnnotation") }) diff --git a/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql index 4041ac263..fb077c04b 100644 --- a/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.51__mappersuperclass__assocations.sql @@ -1,6 +1,5 @@ CREATE TABLE agmdiseaseannotation ( id bigint PRIMARY KEY, - diseaseannotationobject_id bigint, assertedallele_id bigint, diseaseannotationsubject_id bigint, inferredallele_id bigint, @@ -181,13 +180,13 @@ CREATE TABLE diseaseannotation ( modentityid character varying(255), modinternalid character varying(255), uniqueid character varying(3500), - diseaseannotationobject_id bigint, negated boolean DEFAULT false NOT NULL, createdby_id bigint, updatedby_id bigint, singlereference_id bigint, dataprovider_id bigint, annotationtype_id bigint, + diseaseannotationobject_id bigint, diseasegeneticmodifierrelation_id bigint, geneticsex_id bigint, relation_id bigint, diff --git a/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql index 0a4bfbd10..5b1e5ab9c 100644 --- a/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.53__mappersuperclass__assocations.sql @@ -381,7 +381,7 @@ DELETE FROM association_informationcontententity WHERE evidenceassociation_id IN DELETE FROM Association WHERE AssociationType = 'ExonGenomicLocationAssociation'; -INSERT INTO genediseaseannotation +INSERT INTO diseaseannotation SELECT id, datecreated, diff --git a/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql index 34b549027..49dc7a470 100644 --- a/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.54__mappersuperclass__assocations.sql @@ -20,19 +20,19 @@ CREATE INDEX diseaseannotation_singlereference_index ON diseaseannotation USING CREATE INDEX diseaseannotation_uniqueid_index ON diseaseannotation USING btree (uniqueid); CREATE INDEX diseaseannotation_updatedby_index ON diseaseannotation USING btree (updatedby_id); --- CREATE INDEX idxfm9hjt2cp5opepuhro41rko11 ON diseaseannotation_biologicalentity USING btree (annotation_id); --- CREATE INDEX idx2q76899x3i9nmfrpk1s4gqaa5 ON diseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); +CREATE INDEX diseaseannotation_biologicalentity_da_index ON diseaseannotation_biologicalentity USING btree (diseaseannotation_id); +CREATE INDEX diseaseannotation_biologicalentity_dgm_index ON diseaseannotation_biologicalentity USING btree (diseasegeneticmodifiers_id); --- CREATE INDEX idx7ckisymg9glquxs8ckv58o4wa ON diseaseannotation_conditionrelation USING btree (annotation_id); --- CREATE INDEX idx6ie2uykt18gbauf5t26c9gw4p ON diseaseannotation_conditionrelation USING btree (conditionrelations_id); +CREATE INDEX idxtehx15lof8bcxrcc1ccpfoov2 ON diseaseannotation_conditionrelation USING btree (annotation_id); +CREATE INDEX idxk8n3raw0up98oyn0dbhq1o2fv ON diseaseannotation_conditionrelation USING btree (conditionrelations_id); CREATE INDEX agmdiseaseannotation_gene_assertedgenes_index ON agmdiseaseannotation_gene USING btree (assertedgenes_id); CREATE INDEX agmdiseaseannotation_gene_agmda_index ON agmdiseaseannotation_gene USING btree (agmdiseaseannotation_id); CREATE INDEX diseaseannotation_gene_da_index ON diseaseannotation_gene USING btree (diseaseannotation_id); CREATE INDEX diseaseannotation_gene_with_index ON diseaseannotation_gene USING btree (with_id); --- CREATE INDEX idxn2ac81velbbenm2oce4xqkyy0 ON diseaseannotation_note USING btree (annotation_id); --- CREATE INDEX idx6kkpigf83ojt26fiqg2w1dy1p ON diseaseannotation_note USING btree (relatednotes_id); +CREATE INDEX idxes81on0evcu8cyfdei59wupb0 ON diseaseannotation_note USING btree (annotation_id); +CREATE INDEX idxf3o1apeoj9un48jw6qmiihpjc ON diseaseannotation_note USING btree (relatednotes_id); CREATE INDEX diseaseannotation_ontologyterm_da_index ON diseaseannotation_ontologyterm USING btree (diseaseannotation_id); CREATE INDEX diseaseannotation_ontologyterm_evidencecodes_index ON diseaseannotation_ontologyterm USING btree (evidencecodes_id); @@ -57,14 +57,14 @@ CREATE INDEX phenotypeannotation_singlereference_index ON phenotypeannotation US CREATE INDEX phenotypeannotation_uniqueid_index ON phenotypeannotation USING btree (uniqueid); CREATE INDEX phenotypeannotation_updatedby_index ON phenotypeannotation USING btree (updatedby_id); --- CREATE INDEX idx4p03xofye2drhcxfv4wh5btvj ON phenotypeannotation_conditionrelation USING btree (annotation_id); --- CREATE INDEX idx84beulwvg0hkmudmow0dlsxv7 ON phenotypeannotation_conditionrelation USING btree (conditionrelations_id); +CREATE INDEX idxfsppmvsmvokcuh3liqina4xc2 ON phenotypeannotation_conditionrelation USING btree (annotation_id); +CREATE INDEX idx5d01e5hfm2ur0a8kliqgosyw ON phenotypeannotation_conditionrelation USING btree (conditionrelations_id); CREATE INDEX agmphenotypeannotation_gene_assertedgenes_index ON agmphenotypeannotation_gene USING btree (assertedgenes_id); CREATE INDEX agmphenotypeannotation_gene_agmpa_index ON agmphenotypeannotation_gene USING btree (agmphenotypeannotation_id); --- CREATE INDEX idxrgqdq9ngi6fi44kqb6l6gqn1s ON phenotypeannotation_note USING btree (annotation_id); --- CREATE INDEX idxit2xg2ed815njy85kl3hgsjwu ON phenotypeannotation_note USING btree (relatednotes_id); +CREATE INDEX idxs9iwgydguom8kb44l92ves8ay ON phenotypeannotation_note USING btree (annotation_id); +CREATE INDEX idxcr11ebjoa76c90wp9ymoeryav ON phenotypeannotation_note USING btree (relatednotes_id); CREATE INDEX phenotypeannotation_ontologyterm_phenotypeterms_index ON phenotypeannotation_ontologyterm USING btree (phenotypeterms_id); CREATE INDEX phenotypeannotation_ontologyterm_pa_index ON phenotypeannotation_ontologyterm USING btree (phenotypeannotation_id); @@ -85,8 +85,8 @@ CREATE INDEX allelegeneassociation_relatednote_index ON allelegeneassociation US CREATE INDEX allelegeneassociation_relation_index ON allelegeneassociation USING btree (relation_id); CREATE INDEX allelegeneassociation_updatedby_index ON allelegeneassociation USING btree (updatedby_id); --- CREATE INDEX idx9u4cqfbtajokovj1quacsvld2 ON allelegeneassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxp3na9i2xw0ea9igcwx1jdpc9g ON allelegeneassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idx9u4cqfbtajokovj1quacsvld2 ON allelegeneassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxp3na9i2xw0ea9igcwx1jdpc9g ON allelegeneassociation_informationcontententity USING btree (evidence_id); CREATE INDEX allelephenotypeannotation_inferredgene_index ON allelephenotypeannotation USING btree (inferredgene_id); CREATE INDEX allelephenotypeannotation_phenotypeannotationsubject_index ON allelephenotypeannotation USING btree (phenotypeannotationsubject_id); @@ -94,44 +94,44 @@ CREATE INDEX allelephenotypeannotation_phenotypeannotationsubject_index ON allel CREATE INDEX allelephenotypeannotation_gene_assertedgenes_index ON allelephenotypeannotation_gene USING btree (assertedgenes_id); CREATE INDEX allelephenotypeannotation_gene_allelepa_index ON allelephenotypeannotation_gene USING btree (allelephenotypeannotation_id); --- CREATE INDEX idxebg770w4q4fayk1vpfucdu1xy ON codingsequencegenomiclocationassociation USING btree (codingsequenceassociationsubject_id); --- CREATE INDEX idxbmljoyqmk4cdd3os0dumc9bgp ON codingsequencegenomiclocationassociation USING btree (codingsequencegenomiclocationassociationobject_id); --- CREATE INDEX idx6khftnwxcrifhid51ffnd054g ON codingsequencegenomiclocationassociation USING btree (createdby_id); --- CREATE INDEX idxhfv6me8h9mleiytvoytio0nsi ON codingsequencegenomiclocationassociation USING btree (internal); --- CREATE INDEX idxgrky8raqexv45mq83suvekrdo ON codingsequencegenomiclocationassociation USING btree (obsolete); --- CREATE INDEX idxa5wjxifv7vi0y5ltgdnp5ep9t ON codingsequencegenomiclocationassociation USING btree (phase); --- CREATE INDEX idxkr58i2vv5784vl6osva8shi9e ON codingsequencegenomiclocationassociation USING btree (relation_id); --- CREATE INDEX idxr0bkeewpnaajqi1xds5c7j1oc ON codingsequencegenomiclocationassociation USING btree (strand); --- CREATE INDEX idxsb0mnawmi55r20kcipnykm41q ON codingsequencegenomiclocationassociation USING btree (updatedby_id); - --- CREATE INDEX idxp4b569h2wevn6yxgv6veonxfr ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (association_id); --- CREATE INDEX idxp0ldc7a577pft5v9959muhdh5 ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (evidence_id); - --- CREATE INDEX idxvsibphiuleew24wjckpfxeae ON constructgenomicentityassociation USING btree (internal); --- CREATE INDEX idx8myuo0a6hx59vxfhlbrcn8ujk ON constructgenomicentityassociation USING btree (constructassociationsubject_id); --- CREATE INDEX idxevduykusoc08mycbrmn4o7dnq ON constructgenomicentityassociation USING btree (constructgenomicentityassociationobject_id); --- CREATE INDEX idxch64a8ot2vv6i0rue8khyjb3m ON constructgenomicentityassociation USING btree (createdby_id); --- CREATE INDEX idxi6hc4krcrxpsrrwj728vd2wpx ON constructgenomicentityassociation USING btree (obsolete); --- CREATE INDEX idxsoyddowolab2mrp5eaxj57yar ON constructgenomicentityassociation USING btree (relation_id); --- CREATE INDEX idxevh4c07xjfxyylj7ck2dtn6jh ON constructgenomicentityassociation USING btree (updatedby_id); - --- CREATE INDEX idxg5fxj3nedebt3cw93uxptf7om ON constructgenomicentityassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxb9tloa39yyvirjvacah10hfd5 ON constructgenomicentityassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idxl9e4a6sp66j64ijkjv0bkih00 ON codingsequencegenomiclocationassociation USING btree (codingsequenceassociationsubject_id); +CREATE INDEX idxra2iufgb07uc25aelolsnf3by ON codingsequencegenomiclocationassociation USING btree (codingsequencegenomiclocationassociationobject_id); +CREATE INDEX idxkmsyqr54idykm7nuoi32k7ruk ON codingsequencegenomiclocationassociation USING btree (createdby_id); +CREATE INDEX idx7g9txdnm3bwk5bxn7wlhskfng ON codingsequencegenomiclocationassociation USING btree (internal); +CREATE INDEX idxsv2u8tq3qdw6nubs1ar8v63hm ON codingsequencegenomiclocationassociation USING btree (obsolete); +CREATE INDEX idxtark2ners5x44tsu59ewaer2d ON codingsequencegenomiclocationassociation USING btree (phase); +CREATE INDEX idxqbpw668oh0k8odryloou00h3k ON codingsequencegenomiclocationassociation USING btree (relation_id); +CREATE INDEX idx6hn6om3p991ntu7alvh1ryuji ON codingsequencegenomiclocationassociation USING btree (strand); +CREATE INDEX idx3wrew2y9txskknyf8ej3gkh4k ON codingsequencegenomiclocationassociation USING btree (updatedby_id); + +CREATE INDEX idx9x4hjxaf5yi68uyhxx0goxp6g ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (association_id); +CREATE INDEX idxsp0jo6nxvd8pdbtyn4pcbag3f ON CodingSequenceGenomicLocationAssociation_InformationContentEntity USING btree (evidence_id); + +CREATE INDEX idxvsibphiuleew24wjckpfxeae ON constructgenomicentityassociation USING btree (internal); +CREATE INDEX idx8myuo0a6hx59vxfhlbrcn8ujk ON constructgenomicentityassociation USING btree (constructassociationsubject_id); +CREATE INDEX idxevduykusoc08mycbrmn4o7dnq ON constructgenomicentityassociation USING btree (constructgenomicentityassociationobject_id); +CREATE INDEX idxch64a8ot2vv6i0rue8khyjb3m ON constructgenomicentityassociation USING btree (createdby_id); +CREATE INDEX idxi6hc4krcrxpsrrwj728vd2wpx ON constructgenomicentityassociation USING btree (obsolete); +CREATE INDEX idxsoyddowolab2mrp5eaxj57yar ON constructgenomicentityassociation USING btree (relation_id); +CREATE INDEX idxevh4c07xjfxyylj7ck2dtn6jh ON constructgenomicentityassociation USING btree (updatedby_id); + +CREATE INDEX idxg5fxj3nedebt3cw93uxptf7om ON constructgenomicentityassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxb9tloa39yyvirjvacah10hfd5 ON constructgenomicentityassociation_informationcontententity USING btree (evidence_id); CREATE INDEX constructgeassociation_note_cgea_index ON constructgenomicentityassociation_note USING btree (constructgenomicentityassociation_id); CREATE INDEX constructgeassociation_note_relatednotes_index ON constructgenomicentityassociation_note USING btree (relatednotes_id); --- CREATE INDEX idxhgjuh3b5r08q54fwecp64k3a4 ON exongenomiclocationassociation USING btree (createdby_id); --- CREATE INDEX idx82dedqro7ri1f8g558icrjxc6 ON exongenomiclocationassociation USING btree (exonassociationsubject_id); --- CREATE INDEX idx53jvdw533s5e082xlj0sx7p7x ON exongenomiclocationassociation USING btree (exongenomiclocationassociationobject_id); --- CREATE INDEX idx2knwxko11qkxvr98w7l76wlgi ON exongenomiclocationassociation USING btree (internal); --- CREATE INDEX idxo923wv3e7dg9e2flm08ghwiig ON exongenomiclocationassociation USING btree (obsolete); --- CREATE INDEX idx5ufu3a6guayhxy2cg6crxde2i ON exongenomiclocationassociation USING btree (relation_id); --- CREATE INDEX idxdwfj56lqtx86brdvwafjqo8nn ON exongenomiclocationassociation USING btree (strand); --- CREATE INDEX idxd12130inhcxcp1dbks190955j ON exongenomiclocationassociation USING btree (updatedby_id); +CREATE INDEX idxhgjuh3b5r08q54fwecp64k3a4 ON exongenomiclocationassociation USING btree (createdby_id); +CREATE INDEX idx82dedqro7ri1f8g558icrjxc6 ON exongenomiclocationassociation USING btree (exonassociationsubject_id); +CREATE INDEX idx53jvdw533s5e082xlj0sx7p7x ON exongenomiclocationassociation USING btree (exongenomiclocationassociationobject_id); +CREATE INDEX idx2knwxko11qkxvr98w7l76wlgi ON exongenomiclocationassociation USING btree (internal); +CREATE INDEX idxo923wv3e7dg9e2flm08ghwiig ON exongenomiclocationassociation USING btree (obsolete); +CREATE INDEX idx5ufu3a6guayhxy2cg6crxde2i ON exongenomiclocationassociation USING btree (relation_id); +CREATE INDEX idxdwfj56lqtx86brdvwafjqo8nn ON exongenomiclocationassociation USING btree (strand); +CREATE INDEX idxd12130inhcxcp1dbks190955j ON exongenomiclocationassociation USING btree (updatedby_id); --- CREATE INDEX idxtaunnvner3uu6vfarcb9kv0o1 ON exongenomiclocationassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxbugjixb2a6vb0xuho653me8as ON exongenomiclocationassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idxtaunnvner3uu6vfarcb9kv0o1 ON exongenomiclocationassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxbugjixb2a6vb0xuho653me8as ON exongenomiclocationassociation_informationcontententity USING btree (evidence_id); CREATE INDEX genediseaseannotation_diseaseannotationsubject_index ON genediseaseannotation USING btree (diseaseannotationsubject_id); CREATE INDEX genediseaseannotation_sgdstrainbackground_index ON genediseaseannotation USING btree (sgdstrainbackground_id); @@ -151,11 +151,11 @@ CREATE INDEX geneexpressionannotation_singlereference_index ON geneexpressionann CREATE INDEX geneexpressionannotation_uniqueid_index ON geneexpressionannotation USING btree (uniqueid); CREATE INDEX geneexpressionannotation_updatedby_index ON geneexpressionannotation USING btree (updatedby_id); --- CREATE INDEX idxa1uthowkvl1bch1namofq466f ON geneexpressionannotation_conditionrelation USING btree (annotation_id); --- CREATE INDEX idxrcptfqy2xuw35xeer5ilrqtc1 ON geneexpressionannotation_conditionrelation USING btree (conditionrelations_id); +CREATE INDEX idx1yl81g2efybjh19332kp0v80l ON geneexpressionannotation_conditionrelation USING btree (annotation_id); +CREATE INDEX idxrcptfqy2xuw35xeer5ilrqtc1 ON geneexpressionannotation_conditionrelation USING btree (conditionrelations_id); --- CREATE INDEX idx87c6fqrsecyifcktu92y7jde4 ON geneexpressionannotation_note USING btree (annotation_id); --- CREATE INDEX idxm4mig223w5vb6bpjubkd5xuac ON geneexpressionannotation_note USING btree (relatednotes_id); +CREATE INDEX idxa4a6b8jwiqomyvkmrx1wsadh6 ON geneexpressionannotation_note USING btree (annotation_id); +CREATE INDEX idxm4mig223w5vb6bpjubkd5xuac ON geneexpressionannotation_note USING btree (relatednotes_id); CREATE INDEX genegeneticinteraction_createdby_index ON genegeneticinteraction USING btree (createdby_id); CREATE INDEX genegeneticinteraction_geneassociationsubject_index ON genegeneticinteraction USING btree (geneassociationsubject_id); @@ -175,11 +175,11 @@ CREATE INDEX genegeneticinteraction_relation_index ON genegeneticinteraction USI CREATE INDEX genegeneticinteraction_uniqueid_index ON genegeneticinteraction USING btree (uniqueid); CREATE INDEX genegeneticinteraction_updatedby_index ON genegeneticinteraction USING btree (updatedby_id); --- CREATE INDEX idxlyqi995di8uvyll25qqmvvsnq ON genegeneticinteraction_crossreference USING btree (geneinteraction_id); --- CREATE INDEX idxolfx2gsnlx0vyvpv85ba3s1my ON genegeneticinteraction_crossreference USING btree (crossreferences_id); +CREATE INDEX idx785n3i90n4wijv5sqk4as6kvx ON genegeneticinteraction_crossreference USING btree (geneinteraction_id); +CREATE INDEX idxolfx2gsnlx0vyvpv85ba3s1my ON genegeneticinteraction_crossreference USING btree (crossreferences_id); --- CREATE INDEX idxiwxeu6vppndg2hl252knhgcm2 ON genegeneticinteraction_informationcontententity USING btree (association_id); --- CREATE INDEX idx3l5ew8bcu7dqbqu2gux877rqp ON genegeneticinteraction_informationcontententity USING btree (evidence_id); +CREATE INDEX idxiwxeu6vppndg2hl252knhgcm2 ON genegeneticinteraction_informationcontententity USING btree (association_id); +CREATE INDEX idx3l5ew8bcu7dqbqu2gux877rqp ON genegeneticinteraction_informationcontententity USING btree (evidence_id); CREATE INDEX genegeneticinteraction_phenotypesortraits_interaction_index ON genegeneticinteraction_phenotypesortraits USING btree (genegeneticinteraction_id); CREATE INDEX genegeneticinteraction_phenotypesortraits_pt_index ON genegeneticinteraction_phenotypesortraits USING btree (phenotypesortraits); @@ -202,11 +202,11 @@ CREATE INDEX genemolecularinteraction_relation_index ON genemolecularinteraction CREATE INDEX genemolecularinteraction_uniqueid_index ON genemolecularinteraction USING btree (uniqueid); CREATE INDEX genemolecularinteraction_updatedby_index ON genemolecularinteraction USING btree (updatedby_id); --- CREATE INDEX idx7lx7isr6eb5w0w5in5vsncutg ON genemolecularinteraction_crossreference USING btree (crossreferences_id); --- CREATE INDEX idx7wsd79wrsj6s8e33ij89a3eg8 ON genemolecularinteraction_crossreference USING btree (geneinteraction_id); +CREATE INDEX idx7lx7isr6eb5w0w5in5vsncutg ON genemolecularinteraction_crossreference USING btree (crossreferences_id); +CREATE INDEX idxod8u9onkd3pi9r4p1h1by4cl0 ON genemolecularinteraction_crossreference USING btree (geneinteraction_id); --- CREATE INDEX idxcuc2oxltucskw9yld02sck6kk ON genemolecularinteraction_informationcontententity USING btree (association_id); --- CREATE INDEX idxqdpatuorfp3xeoa2ogmg20x1q ON genemolecularinteraction_informationcontententity USING btree (evidence_id); +CREATE INDEX idxcuc2oxltucskw9yld02sck6kk ON genemolecularinteraction_informationcontententity USING btree (association_id); +CREATE INDEX idxqdpatuorfp3xeoa2ogmg20x1q ON genemolecularinteraction_informationcontententity USING btree (evidence_id); CREATE INDEX genephenotypeannotation_phenotypeannotationsubject_index ON genephenotypeannotation USING btree (phenotypeannotationsubject_id); CREATE INDEX genephenotypeannotation_sgdstrainbackground_index ON genephenotypeannotation USING btree (sgdstrainbackground_id); @@ -219,30 +219,30 @@ CREATE INDEX sqtrgeneassociation_sqtrassociationsubject_index ON sequencetargeti CREATE INDEX sqtrgeneassociation_sqtrgeneassociationobject_index ON sequencetargetingreagentgeneassociation USING btree (sequencetargetingreagentgeneassociationobject_id); CREATE INDEX sqtrgeneassociation_updatedby_index ON sequencetargetingreagentgeneassociation USING btree (updatedby_id); --- CREATE INDEX idx3qy7to4cavfvoj89fkux971yb ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (association_id); --- CREATE INDEX idxeo9v38oy64ff8lbhb656yl532 ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (evidence_id); +CREATE INDEX idxicqsm49w1cwo7kqlp15vr2643 ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (association_id); +CREATE INDEX idx3rr3mmw2hmnwvlx3u7lsgehh ON sequencetargetingreagentgeneassociation_informationcontententit USING btree (evidence_id); --- CREATE INDEX idxon9k4nqnwlav7ammge7obyshm ON transcriptcodingsequenceassociation USING btree (createdby_id); --- CREATE INDEX idxf95tn5xv2nugt594ch7kggtex ON transcriptcodingsequenceassociation USING btree (internal); --- CREATE INDEX idxd7d7oeub6eclirxmjpmc7ibot ON transcriptcodingsequenceassociation USING btree (obsolete); --- CREATE INDEX idxio6g2jejebbjqugso2ge8cncf ON transcriptcodingsequenceassociation USING btree (relation_id); --- CREATE INDEX idxptss0twuhfg2ibqnb8vai4v2v ON transcriptcodingsequenceassociation USING btree (transcriptassociationsubject_id); --- CREATE INDEX idx8jsnbfbebppm2memg9yywpea6 ON transcriptcodingsequenceassociation USING btree (transcriptcodingsequenceassociationobject_id); --- CREATE INDEX idxe31s0f5w54vnjhxeysi3g1oy0 ON transcriptcodingsequenceassociation USING btree (updatedby_id); +CREATE INDEX idxon9k4nqnwlav7ammge7obyshm ON transcriptcodingsequenceassociation USING btree (createdby_id); +CREATE INDEX idxf95tn5xv2nugt594ch7kggtex ON transcriptcodingsequenceassociation USING btree (internal); +CREATE INDEX idxd7d7oeub6eclirxmjpmc7ibot ON transcriptcodingsequenceassociation USING btree (obsolete); +CREATE INDEX idxio6g2jejebbjqugso2ge8cncf ON transcriptcodingsequenceassociation USING btree (relation_id); +CREATE INDEX idxptss0twuhfg2ibqnb8vai4v2v ON transcriptcodingsequenceassociation USING btree (transcriptassociationsubject_id); +CREATE INDEX idx8jsnbfbebppm2memg9yywpea6 ON transcriptcodingsequenceassociation USING btree (transcriptcodingsequenceassociationobject_id); +CREATE INDEX idxe31s0f5w54vnjhxeysi3g1oy0 ON transcriptcodingsequenceassociation USING btree (updatedby_id); --- CREATE INDEX idxl4jg4t2dlkjivgea1lta3l9xm ON transcriptcodingsequenceassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxmbtwtvy0731b13p3dhoni3ywd ON transcriptcodingsequenceassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idxl4jg4t2dlkjivgea1lta3l9xm ON transcriptcodingsequenceassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxmbtwtvy0731b13p3dhoni3ywd ON transcriptcodingsequenceassociation_informationcontententity USING btree (evidence_id); --- CREATE INDEX idxfdeljm7108w0j2nbrrme945ur ON transcriptexonassociation USING btree (createdby_id); --- CREATE INDEX idxrig5300vc2ppesjckdkpv219m ON transcriptexonassociation USING btree (internal); --- CREATE INDEX idxfmwe55e0r89q00xqlvi4v7sm0 ON transcriptexonassociation USING btree (obsolete); --- CREATE INDEX idxm76icxt2r2qs52o4wpiexpb39 ON transcriptexonassociation USING btree (relation_id); --- CREATE INDEX idxdct5af7efyqufibj1rjrvieam ON transcriptexonassociation USING btree (transcriptassociationsubject_id); --- CREATE INDEX idxhpo9wefgxyoasohcctnr0qev3 ON transcriptexonassociation USING btree (transcriptexonassociationobject_id); --- CREATE INDEX idx29575n6x9yueygvw1mj9exc2g ON transcriptexonassociation USING btree (updatedby_id); +CREATE INDEX idxfdeljm7108w0j2nbrrme945ur ON transcriptexonassociation USING btree (createdby_id); +CREATE INDEX idxrig5300vc2ppesjckdkpv219m ON transcriptexonassociation USING btree (internal); +CREATE INDEX idxfmwe55e0r89q00xqlvi4v7sm0 ON transcriptexonassociation USING btree (obsolete); +CREATE INDEX idxm76icxt2r2qs52o4wpiexpb39 ON transcriptexonassociation USING btree (relation_id); +CREATE INDEX idxdct5af7efyqufibj1rjrvieam ON transcriptexonassociation USING btree (transcriptassociationsubject_id); +CREATE INDEX idxhpo9wefgxyoasohcctnr0qev3 ON transcriptexonassociation USING btree (transcriptexonassociationobject_id); +CREATE INDEX idx29575n6x9yueygvw1mj9exc2g ON transcriptexonassociation USING btree (updatedby_id); --- CREATE INDEX idxf124air9olggpyrs5i3rgkbkj ON transcriptexonassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxgg4iqmx96raypy761sn4h99ns ON transcriptexonassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idxf124air9olggpyrs5i3rgkbkj ON transcriptexonassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxgg4iqmx96raypy761sn4h99ns ON transcriptexonassociation_informationcontententity USING btree (evidence_id); CREATE INDEX transcriptgeneassociation_createdby_index ON transcriptgeneassociation USING btree (createdby_id); CREATE INDEX transcriptgeneassociation_internal_index ON transcriptgeneassociation USING btree (internal); @@ -252,21 +252,21 @@ CREATE INDEX transcriptgeneassociation_transcriptassociationsubject_index ON tra CREATE INDEX transcriptgeneassociation_transcriptgeneassociationobject_index ON transcriptgeneassociation USING btree (transcriptgeneassociationobject_id); CREATE INDEX transcriptgeneassociation_updatedby_index ON transcriptgeneassociation USING btree (updatedby_id); --- CREATE INDEX idxnu079dovpg7bfrb6uawgtscqs ON transcriptgeneassociation_informationcontententity USING btree (association_id); --- CREATE INDEX idxis18nw3pj2ru6wlejbwotqsv9 ON transcriptgeneassociation_informationcontententity USING btree (evidence_id); - --- CREATE INDEX idxaicr23temspg10v3f22k52ssd ON transcriptgenomiclocationassociation USING btree (createdby_id); --- CREATE INDEX idxd06sc5p3gc11brcoxwp7ppbmr ON transcriptgenomiclocationassociation USING btree (internal); --- CREATE INDEX idxgrqw9lxw4l1whho97aose6qh5 ON transcriptgenomiclocationassociation USING btree (obsolete); --- CREATE INDEX idxii7jvungodeeudebo6c4kebny ON transcriptgenomiclocationassociation USING btree (phase); --- CREATE INDEX idxtqvg5149lyo8q1oof4hhd7mmw ON transcriptgenomiclocationassociation USING btree (relation_id); --- CREATE INDEX idx9yipaclxcmb82h69o4k5q3utt ON transcriptgenomiclocationassociation USING btree (strand); --- CREATE INDEX idx4yukrngwb6ipj72wujbxa87bb ON transcriptgenomiclocationassociation USING btree (transcriptassociationsubject_id); --- CREATE INDEX idxgo4p2kepo9x83moktih7gurb0 ON transcriptgenomiclocationassociation USING btree (transcriptgenomiclocationassociationobject_id); --- CREATE INDEX idx1fpq38gqgxatnm69ge6purjbc ON transcriptgenomiclocationassociation USING btree (updatedby_id); - --- CREATE INDEX idx5bqn8a8osk6oy4514gpf8xs3 ON transcriptgenomiclocationassociation_informationcontententity USING btree (evidence_id); --- CREATE INDEX idxghedmb4mmore7js1d3ni9thpn ON transcriptgenomiclocationassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxnu079dovpg7bfrb6uawgtscqs ON transcriptgeneassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxis18nw3pj2ru6wlejbwotqsv9 ON transcriptgeneassociation_informationcontententity USING btree (evidence_id); + +CREATE INDEX idxaicr23temspg10v3f22k52ssd ON transcriptgenomiclocationassociation USING btree (createdby_id); +CREATE INDEX idxd06sc5p3gc11brcoxwp7ppbmr ON transcriptgenomiclocationassociation USING btree (internal); +CREATE INDEX idxgrqw9lxw4l1whho97aose6qh5 ON transcriptgenomiclocationassociation USING btree (obsolete); +CREATE INDEX idxii7jvungodeeudebo6c4kebny ON transcriptgenomiclocationassociation USING btree (phase); +CREATE INDEX idxtqvg5149lyo8q1oof4hhd7mmw ON transcriptgenomiclocationassociation USING btree (relation_id); +CREATE INDEX idx9yipaclxcmb82h69o4k5q3utt ON transcriptgenomiclocationassociation USING btree (strand); +CREATE INDEX idx4yukrngwb6ipj72wujbxa87bb ON transcriptgenomiclocationassociation USING btree (transcriptassociationsubject_id); +CREATE INDEX idxgo4p2kepo9x83moktih7gurb0 ON transcriptgenomiclocationassociation USING btree (transcriptgenomiclocationassociationobject_id); +CREATE INDEX idx1fpq38gqgxatnm69ge6purjbc ON transcriptgenomiclocationassociation USING btree (updatedby_id); + +CREATE INDEX idx5bqn8a8osk6oy4514gpf8xs3 ON transcriptgenomiclocationassociation_informationcontententity USING btree (evidence_id); +CREATE INDEX idxghedmb4mmore7js1d3ni9thpn ON transcriptgenomiclocationassociation_informationcontententity USING btree (association_id); -- Missing Index diff --git a/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql b/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql index def9d5a7d..77ce34dcd 100644 --- a/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql +++ b/src/main/resources/db/migration/v0.37.0.55__mappersuperclass__assocations.sql @@ -1,218 +1,218 @@ --- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk2kkuby8cha4mi979rfrufh8ms FOREIGN KEY (assertedallele_id) REFERENCES allele(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk2umyg0v10hgtljwjbpond8jrc FOREIGN KEY (singlereference_id) REFERENCES reference(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk37dsmk0slmfxeeibjqkqkixda FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fk60is9ul76u2gwwt3kri70nw8 FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk7ahiuo64x1a5hxracbvlagdt FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk8gxsa86awg2oqv0vs8s7jb7fw FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fk8jli70oa2ilrdlttpla0ds4di FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkcovck6ip7rxrud0twr4kid8f3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkg7mtotyaq0cs501cll3bk45hr FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkhh9as28mwsysbjgx6hwt622wr FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkjl650wl0c24o9tq3hkbggxhwy FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT fkjpqd4ps8pjklagy0wq6u6ljk1 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkk64jxju84kxfc90ok6uor1wv2 FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); --- ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT fkmipqq6lp7u6rr7gif932q4vca FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); - --- ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT fkg694iaaw2ydb0cdslugifj8l5 FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); --- ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT fkhqcbm1d8ou0qqre8snp6cg5u7 FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); - --- ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT fkabtdvl6g81qdhi5cw77tnhlvl FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); --- ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT fkrgr1hx0oqqa2966t1730c8a0l FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); - --- ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT fkbif35stv5wbi5uh9n0kdmou0q FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); --- ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT fkcch8h6dw4rft9d68a0yn6se6e FOREIGN KEY (with_id) REFERENCES gene(id); --- ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkbif35stv5wbi5uh9n0kdmou0q FOREIGN KEY (agmdiseaseannotation_id) REFERENCES agmdiseaseannotation(id); --- ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT fkeyw19j24y6nwrxkqk9gad9eli FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - --- ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT fk7vskf61fs1ti0kk05bm4ywcg6 FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); --- ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT fkr55esx6lfo1f4u9eem1iwfkgx FOREIGN KEY (relatednotes_id) REFERENCES note(id); - --- ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT fkhldp7usikdqpabhs8k6e7tqm6 FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT fktbnis09ieoxxxn0uac17y4tqj FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); - --- ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT fk7tkcolewth9efu38upga0s8fr FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); --- ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT fkrj9u5k77j4lljg6bw7qo1y20w FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); - --- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fk22g2vuw5nph0qq41xtij396e3 FOREIGN KEY (inferredallele_id) REFERENCES allele(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fk7plbgonr9g4yoefd1k5t0b1ap FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); --- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkf0v97kcpydfiqiyvl3uh3rc90 FOREIGN KEY (inferredgene_id) REFERENCES gene(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkk86dqfob7lotkw7yuxd5dkaln FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkkblpivg8a4flg0t34evh25w8v FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkl1478mporoblxqjhqwma373ge FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkn1pb5j9be6lbvv8cwykecqjr9 FOREIGN KEY (singlereference_id) REFERENCES reference(id); --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fkn9jqg4yu2l1fq57f9k7egtawo FOREIGN KEY (assertedallele_id) REFERENCES allele(id); --- ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT fkry48ahelheguy1pbu5dccxo2c FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; --- ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT fksf5ja292y4tqljav1jrqeg60b FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - --- ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT fk707208iqski5px893183pk8f3 FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); --- ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT fk7g3pjr9xu3425uylbk5v7ijje FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); - --- ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fk3bh3w7dbey6cmvnjveqrcmw3p FOREIGN KEY (agmphenotypeannotation_id) REFERENCES agmphenotypeannotation(id); --- ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT fks0f8p72jth9vtbquhyir7wpbh FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - --- ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT fkm35y1lsuyeoa4wsvw0s7fa8ge FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); --- ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT fkswu81d1c6sq3b654gow81kpdc FOREIGN KEY (relatednotes_id) REFERENCES note(id); - --- ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT fkkcbaa7jit2qom15cggnbiw45b FOREIGN KEY (phenotypeannotation_id) REFERENCES phenotypeannotation(id); --- ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT fkjxjka3d3dapimmtx0dy0okela FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); - --- ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fkqeqofi8sivg0j670gwpg5yvpp FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; --- ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT fktp2an4byav09yi71drrvtyjum FOREIGN KEY (inferredgene_id) REFERENCES gene(id); - --- ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fk6ogbd2pywnhgiry1udwepkmtb FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); --- ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT fkkqvw9ea43v28gre268o3si6ay FOREIGN KEY (allelediseaseannotation_id) REFERENCES allelediseaseannotation(id); - --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fk6p0nk2n01ab2ksjrdlyq25h4y FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkao3pmku9d1lh67ptuiq2t08wr FOREIGN KEY (allelegeneassociationobject_id) REFERENCES gene(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fki6gdp1pjjtirs1v3k47oluqc3 FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkjhasohfaw7s26ogq5eg772rf0 FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fko082oqtvkx9k55nm67vas3n1k FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fkqn4egk0drms9hxcekff8gam6q FOREIGN KEY (relatednote_id) REFERENCES note(id); --- ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT fktho8ivna95vaox70mtry5cwwj FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); - --- ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkemd3tife09j5ur86mf0elsjr9 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); --- ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT fkj6e0pl03cm27tahbt289e5h3f FOREIGN KEY (association_id) REFERENCES allelegeneassociation(id); - --- ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fk1nd47lkg6wge7vtkdf61m9dqj FOREIGN KEY (inferredgene_id) REFERENCES gene(id); --- ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT fkmurlgsm5dsodxtj3rg2dccrcs FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; - --- ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkdqeeeahsm84hjksl8593fbo6v FOREIGN KEY (association_id) REFERENCES allelephenotypeannotation(id); --- ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT fkp6gsx4q1q2d5ct5kpumhbd94y FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); - --- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk4efucyh5rpl0g0fpdti9y0qda FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fk6q7qkw2peq0erl2n4cni6kbyb FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); --- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkbdlaouhol3v1law37h2q9ifaw FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fkipqt0lqrx61hgek3pmt679xoj FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); --- ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT fklkt1u6mvqb5im061x5437amin FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - --- ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fkm4es4h50h4511egeuoyfyxk0v FOREIGN KEY (association_id) REFERENCES codingsequencegenomiclocationassociation(id); --- ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT fksugal77n5hdh385dgpdx9tdmc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - --- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk5me06it1f8io7h4mktk6431b2 FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fk9i7kbfdcy5hn6ws7xxf5kh0h2 FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); --- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkei5227y3hjt2t6vsduwaqnnk7 FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkjg9e0tx4lynyaolbllcc3vg02 FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); --- ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT fkpa6wqqg7gmm5d2nqdcml13aj3 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - --- ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fka63t5u6e2c4dtcuwkwrhc8u9q FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); --- ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT fkf95vn8pjy50619o0y7iefyxo9 FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); - --- ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fk9whd0ahcjprqnj131koir30wf FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); --- ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT fkg64353f5upaidhljoj6m1yuc9 FOREIGN KEY (relatednotes_id) REFERENCES note(id); - --- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk3c0ysdo5k8nmm0u6evjr1hdjo FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fk5gbibcffgcyxc4ecwwl6jqks6 FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fka0ne6k6iyq1rp73ij2s5upbfw FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkj36y7gfpojdgw0cei8p09uv5j FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); --- ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT fkrhqru9jlmpeb9hllrbyonmndh FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); - --- ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkr5x4yhyie8e2cxetmuls112a3 FOREIGN KEY (association_id) REFERENCES exongenomiclocationassociation(id); --- ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT fkti351r4r2wp3cm7e5f3qn894g FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - --- ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fkrb70ercqcvrw29rfkivta704o FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; --- ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT fktpww72cuubetd08y0ansac6gw FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); - --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk17ng0qvlftfcfwrvr1yhrnh9h FOREIGN KEY (singlereference_id) REFERENCES reference(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk2xe5vtnm2sba1a8legviqpytj FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fk5gdi65gt84d6ieu34ncu33ftf FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkgx41eka7b0e065kwo23n5fs5q FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fklaj7vmfvdk90xkn6qadgfxwdr FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fknrlc59ffsxn8bc4h8kwj7mgu4 FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkny440x2v8wufob980onb8vexv FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); --- ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT fkpmfpi2pglpegd8c5ssqh2uv1w FOREIGN KEY (expressionannotationsubject_id) REFERENCES gene(id); - --- ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fk967wi9o53ibvsoww5pxr7y3y2 FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); --- ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT fkqlyp0tmp9kowr3fasiq4lfgp FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); - --- ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fk555k6362tmne0w4km2e2khn9a FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); --- ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT fko3gm56s7kyef1fp07fwq69lw4 FOREIGN KEY (relatednotes_id) REFERENCES note(id); - --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk223kijupg28b6mm86feo17r87 FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fk71xgxcnjkufiafwbavyr6m2ka FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkb68mw5p0eril3ff6nfa47vqh8 FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcnm6fb1eihhe5nuj2wiaksd8f FOREIGN KEY (interactorbgeneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkcsuqi3l8tradsactj8t52khud FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkd70w7xi4ml95h5banj5vy2lqc FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkfxq8sixxwkb1jv7rh18yvwi53 FOREIGN KEY (interactorageneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkh2fp3yothl234yu9kitgspfpd FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkhj6l8tygpxpab2moqx4h4pef7 FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkj4fphalc7tmgy8sp7e0qsm5sx FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkkr3yyhywq1px02gnli02eynvs FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fklov5kqhbymgrnmifgy1sdf09l FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); --- ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT fkpgava8ud39i9a1bbioqm8s6hy FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); - --- ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fkgkf3r1nb1c4nk32xex79psi42 FOREIGN KEY (geneinteraction_id) REFERENCES genegeneticinteraction(id); --- ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT fksog88v596kgbud929oeonf92s FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); - --- ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgpv0m4gscumstbs8y3ek9sp2k FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); --- ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT fkgutrng68vtdhwr1qlx92ml715 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - --- ALTER TABLE ONLY genegeneticinteraction_phenotypesortraits ADD CONSTRAINT fk428xqcrj9euixb8jryhqqjc4g FOREIGN KEY (genegeneticinteraction_id) REFERENCES genegeneticinteraction(id); - --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fk1jgic74kl1c0g8b00li2x9uta FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkafjwyp0cf3pqof2ri7yirj07a FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkc2ts1psdlxv1q5pt4bykdgx2x FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkgmt12207c9ll4jj2ev9tb7ltr FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkhfosavsr0c588aoyt243idi6s FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkk9kl5bdcfebb9nn8ux6hv84vn FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkl11owt2vsvjj6gfctjg0wm5ee FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkob42y8ggn4tqr5dj8wp5jarvc FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkpf8prdftq2o1ayen1c8w3kbrj FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fkr8u0gn70cc7va4q0yt8o0wh6p FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fks6m85gh445ieytj9n665rr9eg FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksjxeqrdby7udc1v71xcawbehr FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); --- ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT fksqnn5xdoniaory4upnkkk2iry FOREIGN KEY (updatedby_id) REFERENCES person(id); - --- ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fkmnlia9wqktsqf6n0nce2q2l9 FOREIGN KEY (geneinteraction_id) REFERENCES genemolecularinteraction(id); --- ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT fk6rdt433qfoib1q26sbxbpt489 FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); - --- ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fk7u6wpv1juxshjv1noyshkrtla FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); --- ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT fkooo9u7pkb7yar3qlbdb9k1l87 FOREIGN KEY (association_id) REFERENCES genemolecularinteraction(id); - --- ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fk8e6wa7h1d64pvueh9ng7gpksc FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); --- ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT fkca9jnh4snsv4whcxfhiuv3o5f FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; - --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk4oywb4vxq460mph6qqfucrklc FOREIGN KEY (sequencetargetingreagentassociationsubject_id) REFERENCES sequencetargetingreagent(id); --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fk7h8rchplqiu7rji3t751d16fb FOREIGN KEY (sequencetargetingreagentgeneassociationobject_id) REFERENCES gene(id); --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkaxs3aj4tdrywqpf6sfrk824rn FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkf34iyy9myqed615lvm21exrp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT fkp1m5va6abm32twxddmcxl50xb FOREIGN KEY (createdby_id) REFERENCES person(id); - --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fke9vquysmfh3c4lkcfmajh5hj8 FOREIGN KEY (association_id) REFERENCES sequencetargetingreagentgeneassociation(id); --- ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT fkfib30x859rb0p83hlojly8ghc FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - --- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk13y1vlql0xt9moj0ulf4nsdj7 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4n6xdc24lo3rymynnjmjg98yb FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fk4wsw77bry9naicli7b6jxqqq8 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); --- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkjlfma6v1oit4atwbwelo6b3uw FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); --- ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT fkpos4jj7u82aojox7pssksgkjx FOREIGN KEY (createdby_id) REFERENCES person(id); - --- ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fk7i7m32cuet11t71r7arbao3yy FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); --- ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT fkk6mgowf6uq7nw8cxa2huj8h67 FOREIGN KEY (association_id) REFERENCES transcriptcodingsequenceassociation(id); - --- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fka00ut46dje2rc4qtbryl8as7b FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkdmwvnm7xnfh3qo8k0f3933opr FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); --- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkfbxqumoil00tmd67mawmscdt7 FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkoug4l2bpj2ineapkwnopxcld4 FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); --- ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT fkruqduw01ixripbq0jsy6bvj8d FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); - --- ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkgdasgw5u791fn92fdkskn51w3 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); --- ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT fkiii0hpbot3mksbdyesqj38ust FOREIGN KEY (association_id) REFERENCES transcriptexonassociation(id); - --- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3dbarf3ebsa6kjvu3j8wv5s99 FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); --- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fk3j11pvym3scjrw7889oos21rd FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); --- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkdbaufd0xuh8vql7po8vityjnd FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkii8alynjje87mims76rjvhubp FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT fkk1vrpkcc7j2edjvfbidq5fil6 FOREIGN KEY (createdby_id) REFERENCES person(id); - --- ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fk4j4tyh9wjrr4xcaau05thvmrl FOREIGN KEY (association_id) REFERENCES transcriptgeneassociation(id); --- ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT fkrfpiqj508x62wbmf8hn6c2iq6 FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); - --- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk2xsh4isfa05148kxx4b44sx22 FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); --- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk68ctcfo18ki8aecl8nwoe5iy7 FOREIGN KEY (updatedby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fk7x6dki5ye5bo7q8l7q4spliwn FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); --- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fko9x0yg7fso9wrakgkjgik5jf8 FOREIGN KEY (createdby_id) REFERENCES person(id); --- ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT fksrry8iu0efl589u9e36028k00 FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); - --- ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fk5byb2ffc3nvu6iroggtof0p96 FOREIGN KEY (association_id) REFERENCES transcriptgenomiclocationassociation(id); --- ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT fkf72x535nil1ng129s1sg13lko FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT agmdiseaseannotation_assertedallele_id_fk FOREIGN KEY (assertedallele_id) REFERENCES allele(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_singlereference_id_fk FOREIGN KEY (singlereference_id) REFERENCES reference(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_geneticsex_id_fk FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT agmdiseaseannotation_dasubject_id_fk FOREIGN KEY (diseaseannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_dgmrelation_id_fk FOREIGN KEY (diseasegeneticmodifierrelation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_annotationtype_id_fk FOREIGN KEY (annotationtype_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT agmdiseaseannotation_inferredallele_id_fk FOREIGN KEY (inferredallele_id) REFERENCES allele(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_secondarydataprovider_id_fk FOREIGN KEY (secondarydataprovider_id) REFERENCES dataprovider(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY agmdiseaseannotation ADD CONSTRAINT agmdiseaseannotation_inferredgene_id_fk FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +ALTER TABLE ONLY diseaseannotation ADD CONSTRAINT diseaseannotation_daobject_id_fk FOREIGN KEY (diseaseannotationobject_id) REFERENCES ontologyterm(id); + +ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT diseaseannotation_biologicalentity_dgm_id_fk FOREIGN KEY (diseasegeneticmodifiers_id) REFERENCES biologicalentity(id); +ALTER TABLE ONLY diseaseannotation_biologicalentity ADD CONSTRAINT diseaseannotation_biologicalentity_da_id_fk FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); + +ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT diseaseannotation_conditionrelation_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); +ALTER TABLE ONLY diseaseannotation_conditionrelation ADD CONSTRAINT diseaseannotation_conditionrelation_cr_id_fk FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); + +ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT diseaseannotation_gene_diseaseannotation_id_fk FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); +ALTER TABLE ONLY diseaseannotation_gene ADD CONSTRAINT diseaseannotation_gene_with_id_fk FOREIGN KEY (with_id) REFERENCES gene(id); +ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT agmdiseaseannotation_gene_agmdiseaseannotation_id_fk FOREIGN KEY (agmdiseaseannotation_id) REFERENCES agmdiseaseannotation(id); +ALTER TABLE ONLY agmdiseaseannotation_gene ADD CONSTRAINT agmdiseaseannotation_gene_assertedgenes_id_fk FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT diseaseannotation_note_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES diseaseannotation(id); +ALTER TABLE ONLY diseaseannotation_note ADD CONSTRAINT diseaseannotation_note_relatednotes_id_fku9eem1iwfkgx FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT diseaseannotation_ontologyterm_evidencecodes_id_fk FOREIGN KEY (evidencecodes_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY diseaseannotation_ontologyterm ADD CONSTRAINT diseaseannotation_ontologyterm_diseaseannotation_id_fk FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); + +ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT diseaseannotation_vocabularyterm_diseaseannotation_id_fk FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation(id); +ALTER TABLE ONLY diseaseannotation_vocabularyterm ADD CONSTRAINT diseaseannotation_vocabularyterm_diseasequalifiers_id_fk FOREIGN KEY (diseasequalifiers_id) REFERENCES vocabularyterm(id); + +ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT agmphenotypeannotation_inferredallele_id_fk FOREIGN KEY (inferredallele_id) REFERENCES allele(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_crossreference_id_fk FOREIGN KEY (crossreference_id) REFERENCES crossreference(id); +ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT agmphenotypeannotation_inferredgene_id_fk FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_singlereference_id_fk FOREIGN KEY (singlereference_id) REFERENCES reference(id); +ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT agmphenotypeannotation_assertedallele_id_fk FOREIGN KEY (assertedallele_id) REFERENCES allele(id); +ALTER TABLE ONLY agmphenotypeannotation ADD CONSTRAINT agmphenotypeannotation_pasubject_id_fk FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES affectedgenomicmodel(id) ON DELETE CASCADE; +ALTER TABLE ONLY phenotypeannotation ADD CONSTRAINT phenotypeannotation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT phenotypeannotation_conditionrelation_cr_id_fk FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); +ALTER TABLE ONLY phenotypeannotation_conditionrelation ADD CONSTRAINT phenotypeannotation_conditionrelation_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); + +ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT agmphenotypeannotation_gene_agmpa_id_fk FOREIGN KEY (agmphenotypeannotation_id) REFERENCES agmphenotypeannotation(id); +ALTER TABLE ONLY agmphenotypeannotation_gene ADD CONSTRAINT agmphenotypeannotation_gene_assertedgenes_id_fk FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT phenotypeannotation_note_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES phenotypeannotation(id); +ALTER TABLE ONLY phenotypeannotation_note ADD CONSTRAINT phenotypeannotation_note_relatednotes_id_fk FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT phenotypeannotation_ontologyterm_pa_id_fk FOREIGN KEY (phenotypeannotation_id) REFERENCES phenotypeannotation(id); +ALTER TABLE ONLY phenotypeannotation_ontologyterm ADD CONSTRAINT phenotypeannotation_ontologyterm_phenotypeterms_id_fk FOREIGN KEY (phenotypeterms_id) REFERENCES ontologyterm(id); + +ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT allelediseaseannotation_dasubject_id_fk FOREIGN KEY (diseaseannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; +ALTER TABLE ONLY allelediseaseannotation ADD CONSTRAINT allelediseaseannotation_inferredgene_id_fk FOREIGN KEY (inferredgene_id) REFERENCES gene(id); + +ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT allelediseaseannotation_gene_assertedgenes_id FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); +ALTER TABLE ONLY allelediseaseannotation_gene ADD CONSTRAINT allelediseaseannotation_gene_ada_id FOREIGN KEY (allelediseaseannotation_id) REFERENCES allelediseaseannotation(id); + +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_agaobject_id_fk FOREIGN KEY (allelegeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_evidencecode_id_fk FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note(id); +ALTER TABLE ONLY allelegeneassociation ADD CONSTRAINT allelegeneassociation_aasubject_id_fk FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); + +ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT allelegeneassociation_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY allelegeneassociation_informationcontententity ADD CONSTRAINT allelegeneassociation_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES allelegeneassociation(id); + +ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT allelephenotypeannotation_inferredgene_id_fk FOREIGN KEY (inferredgene_id) REFERENCES gene(id); +ALTER TABLE ONLY allelephenotypeannotation ADD CONSTRAINT allelephenotypeannotation_pasubject_id_fk FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES allele(id) ON DELETE CASCADE; + +ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT allelephenotypeannotation_gene_allelephenotypeannotation_id_fk FOREIGN KEY (allelephenotypeannotation_id) REFERENCES allelephenotypeannotation(id); +ALTER TABLE ONLY allelephenotypeannotation_gene ADD CONSTRAINT allelephenotypeannotation_gene_assertedgenes_id_fk FOREIGN KEY (assertedgenes_id) REFERENCES gene(id); + +ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT cdsglassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT cdsglassociation_cdsglaobject_id_fk FOREIGN KEY (codingsequencegenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT cdsglassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT cdsglassociation_cdsglsubject_id_fk FOREIGN KEY (codingsequenceassociationsubject_id) REFERENCES codingsequence(id); +ALTER TABLE ONLY codingsequencegenomiclocationassociation ADD CONSTRAINT cdsglassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT cdsgla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES codingsequencegenomiclocationassociation(id); +ALTER TABLE ONLY CodingSequenceGenomicLocationAssociation_InformationContentEntity ADD CONSTRAINT cdsgla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT constructgenomicentityassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT constructgenomicentityassociation_cgeaobject_id_fk FOREIGN KEY (constructgenomicentityassociationobject_id) REFERENCES genomicentity(id); +ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT constructgenomicentityassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT constructgenomicentityassociation_casubject_id_fk FOREIGN KEY (constructassociationsubject_id) REFERENCES construct(id); +ALTER TABLE ONLY constructgenomicentityassociation ADD CONSTRAINT constructgenomicentityassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT cgea_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY constructgenomicentityassociation_informationcontententity ADD CONSTRAINT cgea_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES constructgenomicentityassociation(id); + +ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT cgea_note_cgeassociation_id_fk FOREIGN KEY (constructgenomicentityassociation_id) REFERENCES constructgenomicentityassociation(id); +ALTER TABLE ONLY constructgenomicentityassociation_note ADD CONSTRAINT cgea_note_relatednotes_id_fk FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_easubject_id_fk FOREIGN KEY (exonassociationsubject_id) REFERENCES exon(id); +ALTER TABLE ONLY exongenomiclocationassociation ADD CONSTRAINT exongenomiclocationassociation_eglaobject_id_fk FOREIGN KEY (exongenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT exongla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES exongenomiclocationassociation(id); +ALTER TABLE ONLY exongenomiclocationassociation_informationcontententity ADD CONSTRAINT exongla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT genediseaseannotation_dasubject_id_fk FOREIGN KEY (diseaseannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; +ALTER TABLE ONLY genediseaseannotation ADD CONSTRAINT genediseaseannotation_sgdstrainbackground_id_fk FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); + +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_singlereference_id_fk FOREIGN KEY (singlereference_id) REFERENCES reference(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_expressionpattern_id_fk FOREIGN KEY (expressionpattern_id) REFERENCES expressionpattern(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_expressionassayused_id_fk FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); +ALTER TABLE ONLY geneexpressionannotation ADD CONSTRAINT geneexpressionannotation_easubject_id_fk FOREIGN KEY (expressionannotationsubject_id) REFERENCES gene(id); + +ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT gea_conditionrelation_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); +ALTER TABLE ONLY geneexpressionannotation_conditionrelation ADD CONSTRAINT gea_conditionrelation_conditionrelations_id_fk FOREIGN KEY (conditionrelations_id) REFERENCES conditionrelation(id); + +ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT geneexpressionannotation_note_annotation_id_fk FOREIGN KEY (annotation_id) REFERENCES geneexpressionannotation(id); +ALTER TABLE ONLY geneexpressionannotation_note ADD CONSTRAINT geneexpressionannotation_note_relatednotes_id_fk FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactiontype_id_fk FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactorbtype_id_fk FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactorbgeneticperturbation_id_fk FOREIGN KEY (interactorbgeneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactorbrole_id_fk FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactorageneticperturbation_id_fk FOREIGN KEY (interactorageneticperturbation_id) REFERENCES allele(id) ON DELETE CASCADE; +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactorarole_id_fk FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactoratype_id_fk FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_interactionsource_id_fk FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_gasubject_id_fk FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); +ALTER TABLE ONLY genegeneticinteraction ADD CONSTRAINT genegeneticinteraction_ggaobject_id_fk FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); + +ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT genegeneticinteraction_xref_geneinteraction_id_fk FOREIGN KEY (geneinteraction_id) REFERENCES genegeneticinteraction(id); +ALTER TABLE ONLY genegeneticinteraction_crossreference ADD CONSTRAINT genegeneticinteraction_xref_crossreferences_id_fk FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT genegeneticinteraction_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES genegeneticinteraction(id); +ALTER TABLE ONLY genegeneticinteraction_informationcontententity ADD CONSTRAINT genegeneticinteraction_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +ALTER TABLE ONLY genegeneticinteraction_phenotypesortraits ADD CONSTRAINT genegeneticinteraction_phenotypesortraits_ggi_id_fk FOREIGN KEY (genegeneticinteraction_id) REFERENCES genegeneticinteraction(id); + +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactorarole_id FOREIGN KEY (interactorarole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactorbtype_id FOREIGN KEY (interactorbtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_relation_id FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactiontype_id FOREIGN KEY (interactiontype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_gasubject_id FOREIGN KEY (geneassociationsubject_id) REFERENCES gene(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_detectionmethod_id FOREIGN KEY (detectionmethod_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactorbrole_id FOREIGN KEY (interactorbrole_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactionsource_id FOREIGN KEY (interactionsource_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_interactoratype_id FOREIGN KEY (interactoratype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_aggregationdatabase_id FOREIGN KEY (aggregationdatabase_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_createdby_id FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_ggaobject_id FOREIGN KEY (genegeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY genemolecularinteraction ADD CONSTRAINT genemolecularinteraction_updatedby_id FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT genemolecularinteraction_xref_geneinteraction_id_fk FOREIGN KEY (geneinteraction_id) REFERENCES genemolecularinteraction(id); +ALTER TABLE ONLY genemolecularinteraction_crossreference ADD CONSTRAINT genemolecularinteraction_xref_crossreferences_id_fk FOREIGN KEY (crossreferences_id) REFERENCES crossreference(id); + +ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT genemolecularinteraction_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY genemolecularinteraction_informationcontententity ADD CONSTRAINT genemolecularinteraction_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES genemolecularinteraction(id); + +ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT genephenotypeannotation_sgdstrainbackground_id_fk FOREIGN KEY (sgdstrainbackground_id) REFERENCES affectedgenomicmodel(id); +ALTER TABLE ONLY genephenotypeannotation ADD CONSTRAINT genephenotypeannotation_pasubject_id_fk FOREIGN KEY (phenotypeannotationsubject_id) REFERENCES gene(id) ON DELETE CASCADE; + +ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT sequencetargetingreagentgeneassociation_sqtrasubject_id FOREIGN KEY (sequencetargetingreagentassociationsubject_id) REFERENCES sequencetargetingreagent(id); +ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT sequencetargetingreagentgeneassociation_sqtragobject_id FOREIGN KEY (sequencetargetingreagentgeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT sequencetargetingreagentgeneassociation_updatedby_id FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT sequencetargetingreagentgeneassociation_relation_id FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY sequencetargetingreagentgeneassociation ADD CONSTRAINT sequencetargetingreagentgeneassociation_createdby_id FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT sqtrga_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES sequencetargetingreagentgeneassociation(id); +ALTER TABLE ONLY sequencetargetingreagentgeneassociation_informationcontententit ADD CONSTRAINT sqtrga_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_tasubject_id_fk FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_tcdsaobject_id_fk FOREIGN KEY (transcriptcodingsequenceassociationobject_id) REFERENCES codingsequence(id); +ALTER TABLE ONLY transcriptcodingsequenceassociation ADD CONSTRAINT transcriptcodingsequenceassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT transcriptcdsassociation_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY transcriptcodingsequenceassociation_informationcontententity ADD CONSTRAINT transcriptcdsassociation_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES transcriptcodingsequenceassociation(id); + +ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_teaobject_id_fk FOREIGN KEY (transcriptexonassociationobject_id) REFERENCES exon(id); +ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_tasubject_id_fk FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE ONLY transcriptexonassociation ADD CONSTRAINT transcriptexonassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); + +ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT transcriptexonassociation_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +ALTER TABLE ONLY transcriptexonassociation_informationcontententity ADD CONSTRAINT transcriptexonassociation_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES transcriptexonassociation(id); + +ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_tgaobject_id_fk FOREIGN KEY (transcriptgeneassociationobject_id) REFERENCES gene(id); +ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_tasubject_id_fk FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY transcriptgeneassociation ADD CONSTRAINT transcriptgeneassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT transcriptgeneassoc_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES transcriptgeneassociation(id); +ALTER TABLE ONLY transcriptgeneassociation_informationcontententity ADD CONSTRAINT transcriptgeneassoc_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgla_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgla_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgla_tasubject_id_fk FOREIGN KEY (transcriptassociationsubject_id) REFERENCES transcript(id); +ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgla_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY transcriptgenomiclocationassociation ADD CONSTRAINT transcriptgla_tglaobject_id_fk FOREIGN KEY (transcriptgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); + +ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT transcriptgla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES transcriptgenomiclocationassociation(id); +ALTER TABLE ONLY transcriptgenomiclocationassociation_informationcontententity ADD CONSTRAINT transcriptgla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); diff --git a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java index 629701711..9d9d9ab02 100644 --- a/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/ExpressionBulkUploadFmsITCase.java @@ -74,7 +74,6 @@ public void expressionBulkUploadAllFields() throws Exception { .statusCode(200) .body("totalResults", is(1)) .body("results", hasSize(1)) - .body("results[0].type", is("GeneExpressionAnnotation")) .body("results[0].dateCreated", is("2024-01-17T15:31:34Z")) .body("results[0].dataProvider.sourceOrganization.abbreviation", is("ZFIN")) .body("results[0].expressionAnnotationSubject.modEntityId", is(gene)) From fed5e469002caa0f803b29b4def3e0729d268309 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Tue, 1 Oct 2024 16:27:04 -0500 Subject: [PATCH 280/342] update action column width to fix width bug --- .../GenericDataTable/GenericDataTable.js | 18 +++++++++--------- .../GenericDataTable/styles.module.scss | 3 --- .../components/GenericDataTable/styles.scss | 9 +++++++++ 3 files changed, 18 insertions(+), 12 deletions(-) delete mode 100644 src/main/cliapp/src/components/GenericDataTable/styles.module.scss create mode 100644 src/main/cliapp/src/components/GenericDataTable/styles.scss diff --git a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js index 7a2bfc276..36c3bb13a 100644 --- a/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js +++ b/src/main/cliapp/src/components/GenericDataTable/GenericDataTable.js @@ -16,7 +16,7 @@ import { EntityDetailsAction } from '../Actions/EntityDetailsAction'; import { filterColumns, orderColumns, getIdentifier } from '../../utils/utils'; import { useGenericDataTable } from './useGenericDataTable'; -import style from './styles.module.scss'; +import './styles.scss'; import { DataTableFooter } from './DataTableFooter'; export const GenericDataTable = (props) => { const { @@ -329,13 +329,13 @@ export const GenericDataTable = (props) => { )} {deletionEnabled && ( @@ -345,10 +345,10 @@ export const GenericDataTable = (props) => { body={(props) => deleteAction(props, isInEditMode)} filterElement={rowEditorFilterNameHeader} showFilterMenu={false} - className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 action-column ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 max-w-3rem sticky" + headerClassName="surface-0 action-column sticky" /> )} {duplicationEnabled && ( @@ -361,10 +361,10 @@ export const GenericDataTable = (props) => { )} showFilterMenu={false} - className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 action-column ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 max-w-3rem sticky" + headerClassName="surface-0 action-column sticky" /> )} {hasDetails && ( @@ -373,10 +373,10 @@ export const GenericDataTable = (props) => { editor={(props) => } body={(props) => } showFilterMenu={false} - className={`text-center p-0 max-w-3rem ${isEditable ? 'visible' : 'hidden'}`} + className={`text-center p-0 action-column ${isEditable ? 'visible' : 'hidden'}`} bodyStyle={{ textAlign: 'center' }} frozen - headerClassName="surface-0 max-w-3rem sticky" + headerClassName="surface-0 action-column sticky" /> )} {columnList} diff --git a/src/main/cliapp/src/components/GenericDataTable/styles.module.scss b/src/main/cliapp/src/components/GenericDataTable/styles.module.scss deleted file mode 100644 index 7b574f220..000000000 --- a/src/main/cliapp/src/components/GenericDataTable/styles.module.scss +++ /dev/null @@ -1,3 +0,0 @@ -.rowEditorColumn{ - min-width : 6rem !important; -} \ No newline at end of file diff --git a/src/main/cliapp/src/components/GenericDataTable/styles.scss b/src/main/cliapp/src/components/GenericDataTable/styles.scss new file mode 100644 index 000000000..856773f60 --- /dev/null +++ b/src/main/cliapp/src/components/GenericDataTable/styles.scss @@ -0,0 +1,9 @@ +.row-editor-column{ + min-width : 6rem !important; + width : 6rem !important; +} + +.action-column{ + min-width : 3rem !important; + width : 3rem !important; +} \ No newline at end of file From 967183e6d907ba8633734f67e78546894de43a19 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 3 Oct 2024 18:10:17 +0100 Subject: [PATCH 281/342] Add missing sequence --- .../db/migration/v0.37.0.57__add_missing_sequence.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql diff --git a/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql new file mode 100644 index 000000000..356d73c60 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql @@ -0,0 +1,3 @@ + +SELECT setval( 'GeneExpressionAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM GeneExpressionAnnotation) ); + From 6dfe1d7578800c9124a65dbbed1b5711528d9680 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 3 Oct 2024 18:43:38 +0100 Subject: [PATCH 282/342] Need to create the sequence before setting --- .../db/migration/v0.37.0.57__add_missing_sequence.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql index 356d73c60..3a5374623 100644 --- a/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql +++ b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql @@ -1,3 +1,9 @@ - +CREATE SEQUENCE geneexpressionannotation_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + SELECT setval( 'GeneExpressionAnnotation_seq', (SELECT (((MAX(id) + 50) / 50) * 50) FROM GeneExpressionAnnotation) ); From 2d621a8312406ab25669dd0e5155e5c6ebf8570b Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 3 Oct 2024 18:53:30 +0100 Subject: [PATCH 283/342] Add IF NOT EXISTS clause --- .../resources/db/migration/v0.37.0.57__add_missing_sequence.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql index 3a5374623..293032f41 100644 --- a/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql +++ b/src/main/resources/db/migration/v0.37.0.57__add_missing_sequence.sql @@ -1,4 +1,4 @@ -CREATE SEQUENCE geneexpressionannotation_seq +CREATE SEQUENCE IF NOT EXISTS geneexpressionannotation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE From 232640059808d88b951e020b38f32c93aa7688e5 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 8 Oct 2024 23:58:39 -0500 Subject: [PATCH 284/342] RGD load and category tag validation change --- .../HTPExpressionDatasetAnnotation.java | 3 ++ .../model/entities/ResourceDescriptor.java | 3 ++ ...ssionDatasetAnnotationFmsDTOValidator.java | 28 +++++++++++++++---- .../db/migration/v0.37.0.58__htp_tags_fix.sql | 13 +++++++++ 4 files changed, 41 insertions(+), 6 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.58__htp_tags_fix.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index 77d69d8e6..0ebb8ddef 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -9,6 +9,8 @@ import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import org.hibernate.search.engine.backend.types.Aggregable; import org.hibernate.search.engine.backend.types.Projectable; import org.hibernate.search.engine.backend.types.Searchable; @@ -87,6 +89,7 @@ public class HTPExpressionDatasetAnnotation extends AuditedObject { @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany + @OnDelete(action = OnDeleteAction.CASCADE) @JsonView({ View.FieldsAndLists.class }) @JoinTable(name = "htpexpressiondatasetannotation_categorytags", indexes = { @Index(name = "htpdatasetannotation_htpdatasetid_index", columnList = "htpexpressiondatasetannotation_id"), @Index(name = "htpdatasetannotation_categorytags_index", columnList = "categorytags_id")}) List categoryTags; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/ResourceDescriptor.java b/src/main/java/org/alliancegenome/curation_api/model/entities/ResourceDescriptor.java index f1a5e0b6c..434faa2c1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/ResourceDescriptor.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/ResourceDescriptor.java @@ -7,6 +7,8 @@ import org.alliancegenome.curation_api.model.entities.base.AuditedObject; 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; @@ -61,6 +63,7 @@ public class ResourceDescriptor extends AuditedObject { @KeywordField(name = "synoynyms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES) @ElementCollection @JoinTable(indexes = @Index(columnList = "resourcedescriptor_id")) + @Fetch(FetchMode.JOIN) @JsonView({ View.ResourceDescriptorView.class, View.FieldsAndLists.class }) private List synonyms; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java index 2a5bf54ea..60733d14c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/HTPExpressionDatasetAnnotationFmsDTOValidator.java @@ -15,6 +15,7 @@ import org.alliancegenome.curation_api.model.entities.HTPExpressionDatasetAnnotation; import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.input.Pagination; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.ingest.dto.fms.HTPExpressionDatasetAnnotationFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.PublicationFmsDTO; @@ -117,18 +118,33 @@ public HTPExpressionDatasetAnnotation validateHTPExpressionDatasetAnnotationFmsD } if (CollectionUtils.isNotEmpty(dto.getCategoryTags())) { - List categoryTags = new ArrayList<>(); + Map categoryTags = new HashMap<>(); for (String categoryTag : dto.getCategoryTags()) { if (StringUtils.isNotEmpty(categoryTag)) { - VocabularyTerm tag = vocabularyTermService.getTermInVocabulary(VocabularyConstants.HTP_DATASET_CATEGORY_TAGS, categoryTag).getEntity(); - if (tag == null) { + Map params = new HashMap<>(); + params.put("name", categoryTag); + params.put("query_operator", "or"); + params.put("synonyms", categoryTag); + SearchResponse searchResponse = vocabularyTermService.findByParams(new Pagination(), params); + boolean added = false; + if (searchResponse.getTotalResults() > 0) { + for (VocabularyTerm tag : searchResponse.getResults()) { + if (tag.getVocabulary().getName().equals("Data Set Category Tags") && (tag.getName().equals(categoryTag) || tag.getSynonyms().contains(categoryTag))) { + if (categoryTags.containsKey(categoryTag)) { + htpAnnotationResponse.addErrorMessage("categoryTags", ValidationConstants.INVALID_MESSAGE + " Multiple Tags found in the Vocabulary " + " (" + categoryTag + ")"); + } else { + categoryTags.put(categoryTag, tag); + added = true; + } + } + } + } + if (!added) { htpAnnotationResponse.addErrorMessage("categoryTags", ValidationConstants.INVALID_MESSAGE + " (" + categoryTag + ")"); - } else { - categoryTags.add(tag); } } } - htpannotation.setCategoryTags(categoryTags); + htpannotation.setCategoryTags(new ArrayList<>(categoryTags.values())); } else { htpAnnotationResponse.addErrorMessage("categoryTags", ValidationConstants.REQUIRED_MESSAGE); } diff --git a/src/main/resources/db/migration/v0.37.0.58__htp_tags_fix.sql b/src/main/resources/db/migration/v0.37.0.58__htp_tags_fix.sql new file mode 100644 index 000000000..2d48e8687 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.58__htp_tags_fix.sql @@ -0,0 +1,13 @@ +DELETE FROM htpexpressiondatasetannotation_categorytags WHERE categorytags_id IN (SELECT id FROM vocabularyterm WHERE name = 'strain study'); +DELETE FROM vocabularyterm_synonyms WHERE vocabularyterm_id IN (SELECT id FROM vocabularyterm WHERE name = 'strain study'); + +DELETE FROM vocabularyterm WHERE name = 'strain study'; + +DELETE FROM vocabularyterm_synonyms WHERE vocabularyterm_id IN (SELECT id FROM vocabularyterm WHERE name = 'anatomical structure'); +DELETE FROM vocabularyterm_synonyms WHERE vocabularyterm_id IN (SELECT id FROM vocabularyterm WHERE name = 'chemical stimulus'); + +INSERT INTO vocabularyterm_synonyms (vocabularyterm_id, synonyms) SELECT id, 'tissue type study' FROM vocabularyterm WHERE name = 'anatomical structure'; +INSERT INTO vocabularyterm_synonyms (vocabularyterm_id, synonyms) SELECT id, 'tissue specific' FROM vocabularyterm WHERE name = 'anatomical structure'; + +INSERT INTO vocabularyterm_synonyms (vocabularyterm_id, synonyms) SELECT id, 'chemical stimulus study' FROM vocabularyterm WHERE name = 'chemical stimulus'; +INSERT INTO vocabularyterm_synonyms (vocabularyterm_id, synonyms) SELECT id, 'response to chemical' FROM vocabularyterm WHERE name = 'chemical stimulus'; \ No newline at end of file From b88d446d0ccc99e9715d294722940f032ea4c8c5 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 13 Sep 2024 15:18:55 -0500 Subject: [PATCH 285/342] HTP entities creation --- .../model/entities/BioSampleAge.java | 11 +++ .../entities/BioSampleGenomicInformation.java | 15 ++++ .../HTPExpressionDatasetAnnotation.java | 3 +- .../HTPExpressionDatasetSampleAnnotation.java | 89 +++++++++++++++++++ .../entities/MicroarraySampleDetails.java | 7 ++ 5 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java 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 new file mode 100644 index 000000000..c700428ac --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleAge.java @@ -0,0 +1,11 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; + +public class BioSampleAge extends AuditedObject { + + private TemporalContext stage; + + private String age; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java new file mode 100644 index 000000000..fa935cddb --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; + +public class BioSampleGenomicInformation extends AuditedObject { + + private Allele bioSampleAllele; + + private AffectedGenomicModel bioSampleAgm; + + private VocabularyTerm bioSampleAgmType; + + private String bioSampleText; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java index 0ebb8ddef..c0956e3ed 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetAnnotation.java @@ -28,12 +28,13 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; + @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "HTPExpressionDatasetAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetAnnotation") -@AGRCurationSchemaVersion(min = "2.6.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@AGRCurationSchemaVersion(min = "2.6.2", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table(indexes = { @Index(name = "htpdatasetannotation_htpExpressionDataset_index", columnList = "htpExpressionDataset_id"), @Index(name = "htpdatasetannotation_relatednote_index", columnList = "relatednote_id"), 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 new file mode 100644 index 000000000..407da4391 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/HTPExpressionDatasetSampleAnnotation.java @@ -0,0 +1,89 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; + +import java.util.List; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; +import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; +import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; +import org.alliancegenome.curation_api.model.entities.ontology.OBITerm; +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; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "HTPExpressionDatasetSampleAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetSampleAnnotation") +@AGRCurationSchemaVersion(min = "2.6.2", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private ExternalDataBaseEntity htpExpressionSample; + + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String htpExpressionSampleTitle; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsAndLists.class) + private OBITerm htpExpressionSampleType; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsAndLists.class) + private MMOTerm expressionAssayUsed; + + @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" + }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + DataProvider dataProvider; + + private VocabularyTerm geneticSex; + + private List htpExpressionSampleLocations; + + private Note relatedNotes; + + private VocabularyTerm sequencingFormat; + + private NCBITaxonTerm taxon; + + private String abundance; + + private String assemblyVersions; + + private List datasetIds; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java new file mode 100644 index 000000000..23862227d --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java @@ -0,0 +1,7 @@ +package org.alliancegenome.curation_api.model.entities; + +import org.alliancegenome.curation_api.model.entities.base.AuditedObject; + +public class MicroarraySampleDetails extends AuditedObject { + +} From 32597aa8d10b580531127a30098fdb872dc67271 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 3 Oct 2024 19:04:07 -0500 Subject: [PATCH 286/342] Complete java model for HTPDatasample --- .../model/entities/BioSampleAge.java | 44 +++++- .../entities/BioSampleGenomicInformation.java | 52 ++++++- .../HTPExpressionDatasetSampleAnnotation.java | 135 +++++++++++++----- .../entities/MicroarraySampleDetails.java | 37 ++++- 4 files changed, 227 insertions(+), 41 deletions(-) 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 c700428ac..e6b924a76 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 @@ -1,11 +1,51 @@ package org.alliancegenome.curation_api.model.entities; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; +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; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "BioSampleAge", description = "POJO that represents the BioSampleAge") +@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@Table(indexes = { + @Index(name = "biosampleage_stage_index", columnList = "stage_id") +}) public class BioSampleAge extends AuditedObject { - private TemporalContext stage; + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private TemporalContext stage; + + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "age_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String age; - private String age; + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "whenexpressedstagename_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String whenExpressedStageName; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java index fa935cddb..c315beb9e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java @@ -1,15 +1,57 @@ package org.alliancegenome.curation_api.model.entities; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; +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.Indexed; +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 org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import com.fasterxml.jackson.annotation.JsonView; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "BioSampleGenomicInformation", description = "POJO that represents the BioSampleGenomicInformation") +@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@Indexed public class BioSampleGenomicInformation extends AuditedObject { - - private Allele bioSampleAllele; - private AffectedGenomicModel bioSampleAgm; + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsOnly.class) + private Allele bioSampleAllele; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsOnly.class) + private AffectedGenomicModel bioSampleAgm; - private VocabularyTerm bioSampleAgmType; + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm bioSampleAgmType; - private String bioSampleText; + @JsonView(View.FieldsOnly.class) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "biosampletext_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String bioSampleText; } 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 407da4391..ad94b3ca3 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 @@ -6,12 +6,13 @@ import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; -import org.alliancegenome.curation_api.model.entities.base.SubmittedObject; import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; import org.alliancegenome.curation_api.model.entities.ontology.OBITerm; 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; @@ -33,35 +34,54 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString(callSuper = true) @Schema(name = "HTPExpressionDatasetSampleAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetSampleAnnotation") -@AGRCurationSchemaVersion(min = "2.6.2", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@Table(indexes = { + @Index(name = "htpdatasetsampleannotation_htpExpressionSample_index", columnList = "htpExpressionSample_id"), + @Index(name = "htpdatasetsampleannotation_dataprovider_index", columnList = "dataprovider_id"), + @Index(name = "htpdatasetsampleannotation_createdby_index", columnList = "createdby_id"), + @Index(name = "htpdatasetsampleannotation_updatedby_index", columnList = "updatedby_id") +}) public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includeDepth = 1) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) - private ExternalDataBaseEntity htpExpressionSample; + private ExternalDataBaseEntity htpExpressionSample; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsOnly.class) + private OBITerm htpExpressionSampleType; - @JsonView({ View.FieldsOnly.class }) - @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "name_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - private String htpExpressionSampleTitle; - - @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", - "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) - @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) - @ManyToOne - @JsonView(View.FieldsAndLists.class) - private OBITerm htpExpressionSampleType; - - @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", - "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) - @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) - @ManyToOne - @JsonView(View.FieldsAndLists.class) - private MMOTerm expressionAssayUsed; - - @IndexedEmbedded(includePaths = { + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "abbreviation", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "abbreviation_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView(View.FieldsAndLists.class) + private MMOTerm expressionAssayUsed; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private BioSampleAge htpExpressionSampleAge; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private BioSampleGenomicInformation genomicInformation; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsOnly.class }) + private MicroarraySampleDetails microarraySampleDetails; + + @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" }) @@ -70,20 +90,69 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JsonView({ View.FieldsOnly.class }) DataProvider dataProvider; - private VocabularyTerm geneticSex; + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm geneticSex; - private List htpExpressionSampleLocations; + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private VocabularyTerm sequencingFormat; - private Note relatedNotes; + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @JoinTable(indexes = { + @Index(name = "htpdatasample_anatomicalsite_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id"), + @Index(name = "htpdatasample_anatomicalsite_samplelocations_index", columnList = "htpexpressionsamplelocations_id") + }) + @JsonView({ View.FieldsAndLists.class }) + @Fetch(FetchMode.JOIN) + private List htpExpressionSampleLocations; - private VocabularyTerm sequencingFormat; + @IndexedEmbedded(includePaths = {"freeText", "freeText_keyword"}) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class, View.AlleleView.class }) + @JoinTable(indexes = { + @Index(name = "htpdatasample_note_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id"), + @Index(name = "htpdatasample_note_relatednotes_index", columnList = "relatednotes_id")}) + private List relatedNotes; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private NCBITaxonTerm taxon; - private NCBITaxonTerm taxon; + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "htpexpressionsampletitle_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String htpExpressionSampleTitle; - private String abundance; + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "abundance_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String abundance; - private String assemblyVersions; + @JsonView({ View.FieldsOnly.class }) + @ElementCollection + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "assemblyversions_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JoinTable(indexes = @Index(name = "htpdatasample_assemblyversions_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id")) + private List assemblyVersions; + + @IndexedEmbedded(includeDepth = 1) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @Fetch(FetchMode.JOIN) + @JoinTable(indexes = { + @Index(name = "htpdatasample_externaldatabaseentity_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id"), + @Index(name = "htpdatasample_externaldatabaseentity_datasetids_index", columnList = "datasetids_id") + }) + @JsonView({ View.FieldsAndLists.class }) + private List datasetIds; - private List datasetIds; - } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java index 23862227d..94559ae15 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java @@ -1,7 +1,42 @@ package org.alliancegenome.curation_api.model.entities; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; import org.alliancegenome.curation_api.model.entities.base.AuditedObject; +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.mapping.definition.annotation.FullTextField; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.GenericField; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.KeywordField; +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import com.fasterxml.jackson.annotation.JsonView; + +import jakarta.persistence.*; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Entity +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@Schema(name = "MicroarraySampleDetails", description = "POJO that represents the MicroarraySampleDetails") +@AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) +@Indexed public class MicroarraySampleDetails extends AuditedObject { - + + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "channelid_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + private String channelId; + + @JsonView({ View.FieldsOnly.class }) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer channelNumber; + } From 6cf92b3d9c2e956480ff186103767492245e2a75 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 4 Oct 2024 15:56:39 -0500 Subject: [PATCH 287/342] Changing backend bulkload type from HTPDATASETSAMPLE to HTPDATASAMPLE --- .../cliapp/src/service/DataLoadService.js | 1 + .../constants/VocabularyConstants.java | 2 +- .../enums/BackendBulkLoadType.java | 1 + .../v0.37.0.58__htpdatasample_tables.sql | 289 ++++++++++++++++++ 4 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index b0917e7f3..d940d8723 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -87,6 +87,7 @@ export class DataLoadService extends BaseAuthService { 'GFF_CDS', 'GFF_TRANSCRIPT', 'HTPDATASET', + 'HTPDATASETSAMPLE', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 b9e2e75a2..ba358d238 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -83,5 +83,5 @@ private VocabularyConstants() { public static final String HTP_DATASET_CATEGORY_TAGS = "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"; } 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 45350c869..7075a5a09 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -32,6 +32,7 @@ public enum BackendBulkLoadType { SEQUENCE_TARGETING_REAGENT("json"), EXPRESSION("json"), HTPDATASET("json"), + HTPDATASAMPLE("json"), ; public String fileExtension; diff --git a/src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql b/src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql new file mode 100644 index 000000000..51f2ee4c3 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql @@ -0,0 +1,289 @@ +-- To create bulk loads + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'HTP Expression Dataset Sample Annotation Bulk Loads'); + +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'FB HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'ZFIN HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'MGI HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'RGD HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'SGD HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) +SELECT nextval('bulkload_seq'), 'HTPDATASAMPLE', 'WB HTP Expression Dataset Sample Annotation Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE backendbulkloadtype = 'HTPDATASAMPLE'; + +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'FB' FROM bulkload WHERE name = 'FB HTP Expression Dataset Sample Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'MGI' FROM bulkload WHERE name = 'MGI HTP Expression Dataset Sample Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'RGD' FROM bulkload WHERE name = 'RGD HTP Expression Dataset Sample Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'SGD' FROM bulkload WHERE name = 'SGD HTP Expression Dataset Sample Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'WB' FROM bulkload WHERE name = 'WB HTP Expression Dataset Sample Annotation Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) +SELECT id, 'HTPDATASAMPLE', 'ZFIN' FROM bulkload WHERE name = 'ZFIN HTP Expression Dataset Sample Annotation Load'; + +-- To create tables for HTP Expression Dataset Sample Annotation + +CREATE TABLE biosampleage ( + 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, + age character varying(255), + whenexpressedstagename character varying(255), + createdby_id bigint, + updatedby_id bigint, + stage_id bigint +); + +CREATE SEQUENCE biosampleage_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +CREATE TABLE biosamplegenomicinformation ( + 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, + biosampletext character varying(255), + createdby_id bigint, + updatedby_id bigint, + biosampleagm_id bigint, + biosampleagmtype_id bigint, + biosampleallele_id bigint +); + +CREATE SEQUENCE biosamplegenomicinformation_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +CREATE TABLE htpexpressiondatasetsampleannotation ( + 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, + abundance character varying(255), + htpexpressionsampletitle character varying(255), + createdby_id bigint, + updatedby_id bigint, + dataprovider_id bigint, + expressionassayused_id bigint, + geneticsex_id bigint, + genomicinformation_id bigint, + htpexpressionsample_id bigint, + htpexpressionsampleage_id bigint, + htpexpressionsampletype_id bigint, + microarraysampledetails_id bigint, + sequencingformat_id bigint, + taxon_id bigint +); + +CREATE TABLE htpexpressiondatasetsampleannotation_anatomicalsite ( + htpexpressiondatasetsampleannotation_id bigint NOT NULL, + htpexpressionsamplelocations_id bigint NOT NULL +); + +CREATE TABLE htpexpressiondatasetsampleannotation_assemblyversions ( + htpexpressiondatasetsampleannotation_id bigint NOT NULL, + assemblyversions character varying(255) +); + +CREATE TABLE htpexpressiondatasetsampleannotation_externaldatabaseentity ( + htpexpressiondatasetsampleannotation_id bigint NOT NULL, + datasetids_id bigint NOT NULL +); + +CREATE TABLE htpexpressiondatasetsampleannotation_note ( + htpexpressiondatasetsampleannotation_id bigint NOT NULL, + relatednotes_id bigint NOT NULL +); + +CREATE SEQUENCE htpexpressiondatasetsampleannotation_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +CREATE TABLE microarraysampledetails ( + 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, + channelid character varying(255), + channelnumber integer, + createdby_id bigint, + updatedby_id bigint +); + +CREATE SEQUENCE microarraysampledetails_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +ALTER TABLE biosampleage + ADD CONSTRAINT biosampleage_pkey PRIMARY KEY (id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT biosamplegenomicinformation_pkey PRIMARY KEY (id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpexpressiondatasetsampleannotation_pkey PRIMARY KEY (id); + +ALTER TABLE microarraysampledetails + ADD CONSTRAINT microarraysampledetails_pkey PRIMARY KEY (id); + +ALTER TABLE htpexpressiondatasetsampleannotation_note + ADD CONSTRAINT htpdatasample_relatednotes_id_uk UNIQUE (relatednotes_id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_microarraysampledetails_id_uk UNIQUE (microarraysampledetails_id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_htpexpressionsample_id_uk UNIQUE (htpexpressionsample_id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_htpexpressionsampleage_id_uk UNIQUE (htpexpressionsampleage_id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasameple_genomicinformation_id_uk UNIQUE (genomicinformation_id); + +CREATE INDEX biosampleage_stage_index ON biosampleage USING btree (stage_id); + +CREATE INDEX htpdatasample_anatomicalsite_htpdatasample_index ON htpexpressiondatasetsampleannotation_anatomicalsite USING btree (htpexpressiondatasetsampleannotation_id); + +CREATE INDEX htpdatasample_anatomicalsite_samplelocations_index ON htpexpressiondatasetsampleannotation_anatomicalsite USING btree (htpexpressionsamplelocations_id); + +CREATE INDEX htpdatasample_assemblyversions_htpdatasample_index ON htpexpressiondatasetsampleannotation_assemblyversions USING btree (htpexpressiondatasetsampleannotation_id); + +CREATE INDEX htpdatasample_externaldatabaseentity_datasetids_index ON htpexpressiondatasetsampleannotation_externaldatabaseentity USING btree (datasetids_id); + +CREATE INDEX htpdatasample_externaldatabaseentity_htpdatasample_index ON htpexpressiondatasetsampleannotation_externaldatabaseentity USING btree (htpexpressiondatasetsampleannotation_id); + +CREATE INDEX htpdatasample_note_htpdatasample_index ON htpexpressiondatasetsampleannotation_note USING btree (htpexpressiondatasetsampleannotation_id); + +CREATE INDEX htpdatasample_note_relatednotes_index ON htpexpressiondatasetsampleannotation_note USING btree (relatednotes_id); + +CREATE INDEX htpdatasetsampleannotation_createdby_index ON htpexpressiondatasetsampleannotation USING btree (createdby_id); + +CREATE INDEX htpdatasetsampleannotation_dataprovider_index ON htpexpressiondatasetsampleannotation USING btree (dataprovider_id); + +CREATE INDEX htpdatasetsampleannotation_htpexpressionsample_index ON htpexpressiondatasetsampleannotation USING btree (htpexpressionsample_id); + +CREATE INDEX htpdatasetsampleannotation_updatedby_index ON htpexpressiondatasetsampleannotation USING btree (updatedby_id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT biosamplegenomicinfo_biosampleagmtype_id_fk FOREIGN KEY (biosampleagmtype_id) REFERENCES vocabularyterm(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_sequencingformat_id_fk FOREIGN KEY (sequencingformat_id) REFERENCES vocabularyterm(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_microarraysampledetails_id_fk FOREIGN KEY (microarraysampledetails_id) REFERENCES microarraysampledetails(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_externaldatabaseentity + ADD CONSTRAINT htpdatasample_externaldbentity_htpdatasample_id_fk FOREIGN KEY (htpexpressiondatasetsampleannotation_id) REFERENCES htpexpressiondatasetsampleannotation(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_dataprovider_id_fk FOREIGN KEY (dataprovider_id) REFERENCES dataprovider(id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT biosamplegenomicinformation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_genomicinformation_id_fk FOREIGN KEY (genomicinformation_id) REFERENCES biosamplegenomicinformation(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_geneticsex_id_fk FOREIGN KEY (geneticsex_id) REFERENCES vocabularyterm(id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT htpdatasample_biosampleagm_id_fk FOREIGN KEY (biosampleagm_id) REFERENCES affectedgenomicmodel(id); + +ALTER TABLE microarraysampledetails + ADD CONSTRAINT microarraysampledetails_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_anatomicalsite + ADD CONSTRAINT htpdatasample_anatomicalsite_htpdatasample_id_fk FOREIGN KEY (htpexpressiondatasetsampleannotation_id) REFERENCES htpexpressiondatasetsampleannotation(id); + +ALTER TABLE biosampleage + ADD CONSTRAINT biosampleage_stage_id_fk FOREIGN KEY (stage_id) REFERENCES temporalcontext(id); + +ALTER TABLE biosampleage + ADD CONSTRAINT biosampleage_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_htpexpressionsampleage_id_fk FOREIGN KEY (htpexpressionsampleage_id) REFERENCES biosampleage(id); + +ALTER TABLE biosampleage + ADD CONSTRAINT biosampleage_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_anatomicalsite + ADD CONSTRAINT htpdatasample_anatomicalsite_htpsamplelocations_id_fk FOREIGN KEY (htpexpressionsamplelocations_id) REFERENCES anatomicalsite(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_expressionassayused_id_fk FOREIGN KEY (expressionassayused_id) REFERENCES ontologyterm(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_taxon_id_fk FOREIGN KEY (taxon_id) REFERENCES ontologyterm(id); + +ALTER TABLE microarraysampledetails + ADD CONSTRAINT microarraysampledetails_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_htpexpressionsample_id_fk FOREIGN KEY (htpexpressionsample_id) REFERENCES externaldatabaseentity(id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT biosamplegenomicinformation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_note + ADD CONSTRAINT htpdatasample_note_relatednotes_id_fk FOREIGN KEY (relatednotes_id) REFERENCES note(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_htpexpressionsampletype_id_fk FOREIGN KEY (htpexpressionsampletype_id) REFERENCES ontologyterm(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_note + ADD CONSTRAINT htpdatasample_note_htpdatasample_id_fk FOREIGN KEY (htpexpressiondatasetsampleannotation_id) REFERENCES htpexpressiondatasetsampleannotation(id); + +ALTER TABLE htpexpressiondatasetsampleannotation + ADD CONSTRAINT htpdatasample_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_assemblyversions + ADD CONSTRAINT htpdatasample_assemblyversions_htpdatasample_id FOREIGN KEY (htpexpressiondatasetsampleannotation_id) REFERENCES htpexpressiondatasetsampleannotation(id); + +ALTER TABLE biosamplegenomicinformation + ADD CONSTRAINT biosamplegenomicinformation_biosampleallele_id_fk FOREIGN KEY (biosampleallele_id) REFERENCES allele(id); + +ALTER TABLE htpexpressiondatasetsampleannotation_externaldatabaseentity + ADD CONSTRAINT htpdatasample_externaldbentity_datasetids_id_fk FOREIGN KEY (datasetids_id) REFERENCES externaldatabaseentity(id); \ No newline at end of file From 457b29ee28bcacd6fd2f2ef6e88a508359f8f8eb Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Fri, 4 Oct 2024 16:01:12 -0500 Subject: [PATCH 288/342] Checkstyle fix --- .../model/entities/MicroarraySampleDetails.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java index 94559ae15..0546dea73 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/MicroarraySampleDetails.java @@ -30,13 +30,13 @@ @Indexed public class MicroarraySampleDetails extends AuditedObject { - @JsonView({ View.FieldsOnly.class }) - @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @JsonView({ View.FieldsOnly.class }) + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "channelid_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") - private String channelId; + private String channelId; - @JsonView({ View.FieldsOnly.class }) - @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) - private Integer channelNumber; + @JsonView({ View.FieldsOnly.class }) + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + private Integer channelNumber; } From 001c0d4bf911bdabe4d8029be776e47d1dab6b35 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 9 Oct 2024 18:31:51 -0500 Subject: [PATCH 289/342] Changes to HTPdatasample model --- .../curation_api/model/entities/BioSampleAge.java | 2 +- .../entities/BioSampleGenomicInformation.java | 12 +++++++++--- .../HTPExpressionDatasetSampleAnnotation.java | 14 ++++++++------ ...es.sql => v0.37.0.59__htpdatasample_tables.sql} | 0 4 files changed, 18 insertions(+), 10 deletions(-) rename src/main/resources/db/migration/{v0.37.0.58__htpdatasample_tables.sql => v0.37.0.59__htpdatasample_tables.sql} (100%) 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 e6b924a76..139e7d928 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 @@ -32,7 +32,7 @@ }) public class BioSampleAge extends AuditedObject { - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"age","age_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java index c315beb9e..14d0f2a38 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java @@ -31,19 +31,25 @@ @Indexed public class BioSampleGenomicInformation extends AuditedObject { - @IndexedEmbedded(includeDepth = 1) + @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" + }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView(View.FieldsOnly.class) private Allele bioSampleAllele; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"name", "name_keyword", "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView(View.FieldsOnly.class) private AffectedGenomicModel bioSampleAgm; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) 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 ad94b3ca3..c8b1c3b31 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 @@ -63,19 +63,21 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JsonView(View.FieldsAndLists.class) private MMOTerm expressionAssayUsed; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"age", "whenExpressedStageName", "age_keyword", "whenExpressedStageName_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) private BioSampleAge htpExpressionSampleAge; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"bioSampleAllele.curie","bioSampleAllele.modInternalId","bioSampleAllele.modEntityId","bioSampleAllele.modEntityId_keyword", + "bioSampleAllele.modInternalId_keyword","bioSampleAgm.curie","bioSampleAgm.modInternalId","bioSampleAgm.modEntityId","bioSampleAgm.modInternalId_keyword", + "bioSampleAgm.modEntityId_keyword","bioSampleAllele.curie_keyword","bioSampleAgm.curie_keyword","bioSampleText","bioSampleText_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) private BioSampleGenomicInformation genomicInformation; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"channelId","channelId_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) @@ -90,13 +92,13 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JsonView({ View.FieldsOnly.class }) DataProvider dataProvider; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) private VocabularyTerm geneticSex; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) @@ -121,7 +123,7 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @Index(name = "htpdatasample_note_relatednotes_index", columnList = "relatednotes_id")}) private List relatedNotes; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"name", "curie", "name_keyword", "curie_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) diff --git a/src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql b/src/main/resources/db/migration/v0.37.0.59__htpdatasample_tables.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.58__htpdatasample_tables.sql rename to src/main/resources/db/migration/v0.37.0.59__htpdatasample_tables.sql From 6793280ff3daa8b1ec0f00b543534bf12518ad1e Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 9 Oct 2024 18:38:02 -0500 Subject: [PATCH 290/342] Checkstyle fix --- .../curation_api/model/entities/BioSampleAge.java | 2 +- .../entities/HTPExpressionDatasetSampleAnnotation.java | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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 139e7d928..d359e8e83 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 @@ -32,7 +32,7 @@ }) public class BioSampleAge extends AuditedObject { - @IndexedEmbedded(includePaths = {"age","age_keyword"}) + @IndexedEmbedded(includePaths = {"age", "age_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class }) 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 c8b1c3b31..7d190b8d8 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 @@ -69,9 +69,10 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JsonView({ View.FieldsOnly.class }) private BioSampleAge htpExpressionSampleAge; - @IndexedEmbedded(includePaths = {"bioSampleAllele.curie","bioSampleAllele.modInternalId","bioSampleAllele.modEntityId","bioSampleAllele.modEntityId_keyword", - "bioSampleAllele.modInternalId_keyword","bioSampleAgm.curie","bioSampleAgm.modInternalId","bioSampleAgm.modEntityId","bioSampleAgm.modInternalId_keyword", - "bioSampleAgm.modEntityId_keyword","bioSampleAllele.curie_keyword","bioSampleAgm.curie_keyword","bioSampleText","bioSampleText_keyword"}) + @IndexedEmbedded(includePaths = {"bioSampleAllele.curie", "bioSampleAllele.modInternalId", "bioSampleAllele.modEntityId","bioSampleAllele.modEntityId_keyword", + "bioSampleAllele.modInternalId_keyword", "bioSampleAgm.curie", "bioSampleAgm.modInternalId", "bioSampleAgm.modEntityId", "bioSampleAgm.modInternalId_keyword", + "bioSampleAgm.modEntityId_keyword", "bioSampleAllele.curie_keyword", "bioSampleAgm.curie_keyword", "bioSampleText", "bioSampleText_keyword" + }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) From 3eaccb66dfe820ddf7234bcce353aba440d65966 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 9 Oct 2024 18:40:08 -0500 Subject: [PATCH 291/342] Checkstyle fix --- .../entities/HTPExpressionDatasetSampleAnnotation.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 7d190b8d8..973a42dc2 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 @@ -69,16 +69,16 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JsonView({ View.FieldsOnly.class }) private BioSampleAge htpExpressionSampleAge; - @IndexedEmbedded(includePaths = {"bioSampleAllele.curie", "bioSampleAllele.modInternalId", "bioSampleAllele.modEntityId","bioSampleAllele.modEntityId_keyword", + @IndexedEmbedded(includePaths = {"bioSampleAllele.curie", "bioSampleAllele.modInternalId", "bioSampleAllele.modEntityId", "bioSampleAllele.modEntityId_keyword", "bioSampleAllele.modInternalId_keyword", "bioSampleAgm.curie", "bioSampleAgm.modInternalId", "bioSampleAgm.modEntityId", "bioSampleAgm.modInternalId_keyword", "bioSampleAgm.modEntityId_keyword", "bioSampleAllele.curie_keyword", "bioSampleAgm.curie_keyword", "bioSampleText", "bioSampleText_keyword" - }) + }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) private BioSampleGenomicInformation genomicInformation; - @IndexedEmbedded(includePaths = {"channelId","channelId_keyword"}) + @IndexedEmbedded(includePaths = {"channelId", "channelId_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) From b79d2feb60cd407e51f10898d3f87aae7bca4092 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Wed, 9 Oct 2024 18:59:59 -0500 Subject: [PATCH 292/342] Added code to loop through all the loads in counts and check for failed --- .../cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index d51feb9d3..eddbf09f1 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -239,7 +239,7 @@ export const DataLoadsComponent = () => { }*/} - {rowData.counts?.Records?.failed !== undefined && rowData.counts?.Records?.failed > 0 && ( + { rowData.counts && Object.values(rowData.counts).some( (field) => field.failed !== undefined && field.failed > 0 ) && ( - )} + {rowData.counts && + Object.values(rowData.counts).some((field) => field.failed !== undefined && field.failed > 0) && ( + + )} ); }; From f29bc51ba6f46a1d6374fa4a4bc89f8265d35891 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 10 Oct 2024 18:13:15 -0500 Subject: [PATCH 295/342] Changed HTPDATASETSAMPLE to HTPDATASAMPLE in Dataload Service --- src/main/cliapp/src/service/DataLoadService.js | 2 +- .../entities/HTPExpressionDatasetSampleAnnotation.java | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index d940d8723..5a295142b 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -87,7 +87,7 @@ export class DataLoadService extends BaseAuthService { 'GFF_CDS', 'GFF_TRANSCRIPT', 'HTPDATASET', - 'HTPDATASETSAMPLE', + 'HTPDATASAMPLE', 'INTERACTION-GEN', 'INTERACTION-MOL', 'MOLECULE', 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 973a42dc2..2e39745e2 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 @@ -43,7 +43,8 @@ }) public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded( includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", + "curie_keyword", "preferredCrossReference.referencedCurie_keyword", "secondaryIdentifiers_keyword" }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JsonView({ View.FieldsOnly.class }) @@ -147,7 +148,8 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JoinTable(indexes = @Index(name = "htpdatasample_assemblyversions_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id")) private List assemblyVersions; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded( includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", + "curie_keyword", "preferredCrossReference.referencedCurie_keyword", "secondaryIdentifiers_keyword" }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @Fetch(FetchMode.JOIN) From 16ce4c5f4970f0d6d60d67c13f93348a0576cd4c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Thu, 10 Oct 2024 18:17:32 -0500 Subject: [PATCH 296/342] Checkstyle fix --- .../model/entities/HTPExpressionDatasetSampleAnnotation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 2e39745e2..9fc22e363 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 @@ -43,7 +43,7 @@ }) public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { - @IndexedEmbedded( includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", + @IndexedEmbedded(includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", "curie_keyword", "preferredCrossReference.referencedCurie_keyword", "secondaryIdentifiers_keyword" }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @@ -148,7 +148,7 @@ public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { @JoinTable(indexes = @Index(name = "htpdatasample_assemblyversions_htpdatasample_index", columnList = "htpexpressiondatasetsampleannotation_id")) private List assemblyVersions; - @IndexedEmbedded( includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", + @IndexedEmbedded(includePaths = {"curie", "preferredCrossReference.referencedCurie", "secondaryIdentifiers", "curie_keyword", "preferredCrossReference.referencedCurie_keyword", "secondaryIdentifiers_keyword" }) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany From 3d3e7bd58c6140e215f8abd8a533c8ca55bd037b Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Mon, 14 Oct 2024 12:22:37 -0400 Subject: [PATCH 297/342] Updated schedule for purging --- .../curation_api/dao/loads/BulkLoadFileExceptionDAO.java | 2 ++ .../java/org/alliancegenome/curation_api/jobs/JobScheduler.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java index a6a30618f..08d4628cf 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java @@ -3,6 +3,7 @@ import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileException; +import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; import jakarta.persistence.Query; @@ -13,6 +14,7 @@ protected BulkLoadFileExceptionDAO() { } public void cleanUpTwoWeekOldExceptions() { + Log.info("Deleting Old Bulk Exceptions: \"DELETE FROM BulkLoadFileException WHERE dbdatecreated < NOW() - INTERVAL '14 days'\""); Query jpqlQuery = entityManager.createNativeQuery("DELETE FROM BulkLoadFileException WHERE dbdatecreated < NOW() - INTERVAL '14 days'"); jpqlQuery.executeUpdate(); } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java index 94484d143..f121192d3 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/JobScheduler.java @@ -185,7 +185,7 @@ public void pendingFileJobs(@ObservesAsync PendingLoadJobEvent event) { } } - @Scheduled(cron = "0 0 0 ? * SAT") + @Scheduled(cron = "0 0 0 ? * *") public void cleanUpFileExceptions() { bulkLoadFileExceptionDAO.cleanUpTwoWeekOldExceptions(); } From 42368f73cd15475b6b9fddf0257aa04bfe54a13c Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 14 Oct 2024 16:47:52 -0500 Subject: [PATCH 298/342] Adding new indexes for htpdatasample --- .../entities/BioSampleGenomicInformation.java | 5 ++++ .../HTPExpressionDatasetSampleAnnotation.java | 16 +++++++++---- ...0.60__htpdatasample_adding_new_indexes.sql | 24 +++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java index 14d0f2a38..5725ba9ab 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java @@ -29,6 +29,11 @@ @Schema(name = "BioSampleGenomicInformation", description = "POJO that represents the BioSampleGenomicInformation") @AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Indexed +@Table(indexes = { + @Index(name = "biosamplegenomicinfo_bioSampleAllele", columnList = "bioSampleAllele_id"), + @Index(name = "biosamplegenomicinfo_bioSampleAgm", columnList = "bioSampleAgm_id"), + @Index(name = "biosamplegenomicinfo_bioSampleAgmType", columnList = "bioSampleAgmType_id") +}) public class BioSampleGenomicInformation extends AuditedObject { @IndexedEmbedded(includePaths = { 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 9fc22e363..4941d6d84 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 @@ -36,10 +36,18 @@ @Schema(name = "HTPExpressionDatasetSampleAnnotation", description = "POJO that represents the HighThroughputExpressionDatasetSampleAnnotation") @AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Table(indexes = { - @Index(name = "htpdatasetsampleannotation_htpExpressionSample_index", columnList = "htpExpressionSample_id"), - @Index(name = "htpdatasetsampleannotation_dataprovider_index", columnList = "dataprovider_id"), - @Index(name = "htpdatasetsampleannotation_createdby_index", columnList = "createdby_id"), - @Index(name = "htpdatasetsampleannotation_updatedby_index", columnList = "updatedby_id") + @Index(name = "htpdatasample_htpExpressionSample_index", columnList = "htpExpressionSample_id"), + @Index(name = "htpdatasample_htpExpressionSampleType_index", columnList = "htpExpressionSampleType_id"), + @Index(name = "htpdatasample_expressionAssayUsed_index", columnList = "expressionAssayUsed_id"), + @Index(name = "htpdatasample_htpExpressionSampleAge_index", columnList = "htpExpressionSampleAge_id"), + @Index(name = "htpdatasample_genomicInformation_index", columnList = "genomicInformation_id"), + @Index(name = "htpdatasample_microarraySampleDetails_index", columnList = "microarraySampleDetails_id"), + @Index(name = "htpdatasample_geneticSex_index", columnList = "geneticSex_id"), + @Index(name = "htpdatasample_sequencingFormat_index", columnList = "sequencingFormat_id"), + @Index(name = "htpdatasample_taxon_index", columnList = "taxon_id"), + @Index(name = "htpdatasample_dataprovider_index", columnList = "dataprovider_id"), + @Index(name = "htpdatasample_createdby_index", columnList = "createdby_id"), + @Index(name = "htpdatasample_updatedby_index", columnList = "updatedby_id") }) public class HTPExpressionDatasetSampleAnnotation extends AuditedObject { diff --git a/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql b/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql new file mode 100644 index 000000000..3335e126f --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql @@ -0,0 +1,24 @@ +--Renaming existing indexes +ALTER INDEX htpdatasetsampleannotation_createdby_index RENAME TO htpdatasample_createdby_index; +ALTER INDEX htpdatasetsampleannotation_updatedby_index RENAME TO htpdatasample_updatedby_index; +ALTER INDEX htpdatasetsampleannotation_dataprovider_index RENAME TO htpdatasample_dataprovider_index; +ALTER INDEX htpdatasetsampleannotation_htpexpressionsample_index RENAME TO htpdatasample_htpexpressionsample_index; + +--Creating new indexes +CREATE INDEX htpdatasample_htpExpressionSampleType_index ON htpexpressiondatasetsampleannotation USING btree (htpExpressionSampleType_id); +CREATE INDEX htpdatasample_expressionAssayUsed_index ON htpexpressiondatasetsampleannotation USING btree (expressionAssayUsed_id); +CREATE INDEX htpdatasample_htpExpressionSampleAge_index ON htpexpressiondatasetsampleannotation USING btree (htpExpressionSampleAge_id); +CREATE INDEX htpdatasample_genomicInformation_index ON htpexpressiondatasetsampleannotation USING btree (genomicInformation_id); +CREATE INDEX htpdatasample_microarraySampleDetails_index ON htpexpressiondatasetsampleannotation USING btree (microarraySampleDetails_id); +CREATE INDEX htpdatasample_geneticSex_index ON htpexpressiondatasetsampleannotation USING btree (geneticSex_id); +CREATE INDEX htpdatasample_sequencingFormat_index ON htpexpressiondatasetsampleannotation USING btree (sequencingFormat_id); +CREATE INDEX htpdatasample_taxon_index ON htpexpressiondatasetsampleannotation USING btree (taxon_id); + +CREATE INDEX biosamplegenomicinfo_bioSampleAllele ON biosamplegenomicinformation USING btree (bioSampleAllele_id); +CREATE INDEX biosamplegenomicinfo_bioSampleAgm ON biosamplegenomicinformation USING btree (bioSampleAgm_id); +CREATE INDEX biosamplegenomicinfo_bioSampleAgmType ON biosamplegenomicinformation USING btree (bioSampleAgmType_id); + +--Adding 3 new htp category tags +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'bulk RNA-seq', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'single cell RNA-seq', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'spatial RNA-seq', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; \ No newline at end of file From aea2179669498458fc52371bd808af7be932de18 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Tue, 15 Oct 2024 09:14:15 -0500 Subject: [PATCH 299/342] Added _index to biosamplegenomicinfo indexes --- .../model/entities/BioSampleGenomicInformation.java | 6 +++--- .../v0.37.0.60__htpdatasample_adding_new_indexes.sql | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java index 5725ba9ab..986e06e92 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/BioSampleGenomicInformation.java @@ -30,9 +30,9 @@ @AGRCurationSchemaVersion(min = "2.7.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AuditedObject.class }) @Indexed @Table(indexes = { - @Index(name = "biosamplegenomicinfo_bioSampleAllele", columnList = "bioSampleAllele_id"), - @Index(name = "biosamplegenomicinfo_bioSampleAgm", columnList = "bioSampleAgm_id"), - @Index(name = "biosamplegenomicinfo_bioSampleAgmType", columnList = "bioSampleAgmType_id") + @Index(name = "biosamplegenomicinfo_bioSampleAllele_index", columnList = "bioSampleAllele_id"), + @Index(name = "biosamplegenomicinfo_bioSampleAgm_index", columnList = "bioSampleAgm_id"), + @Index(name = "biosamplegenomicinfo_bioSampleAgmType_index", columnList = "bioSampleAgmType_id") }) public class BioSampleGenomicInformation extends AuditedObject { diff --git a/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql b/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql index 3335e126f..262d935e4 100644 --- a/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql +++ b/src/main/resources/db/migration/v0.37.0.60__htpdatasample_adding_new_indexes.sql @@ -14,9 +14,9 @@ CREATE INDEX htpdatasample_geneticSex_index ON htpexpressiondatasetsampleannotat CREATE INDEX htpdatasample_sequencingFormat_index ON htpexpressiondatasetsampleannotation USING btree (sequencingFormat_id); CREATE INDEX htpdatasample_taxon_index ON htpexpressiondatasetsampleannotation USING btree (taxon_id); -CREATE INDEX biosamplegenomicinfo_bioSampleAllele ON biosamplegenomicinformation USING btree (bioSampleAllele_id); -CREATE INDEX biosamplegenomicinfo_bioSampleAgm ON biosamplegenomicinformation USING btree (bioSampleAgm_id); -CREATE INDEX biosamplegenomicinfo_bioSampleAgmType ON biosamplegenomicinformation USING btree (bioSampleAgmType_id); +CREATE INDEX biosamplegenomicinfo_bioSampleAllele_index ON biosamplegenomicinformation USING btree (bioSampleAllele_id); +CREATE INDEX biosamplegenomicinfo_bioSampleAgm_index ON biosamplegenomicinformation USING btree (bioSampleAgm_id); +CREATE INDEX biosamplegenomicinfo_bioSampleAgmType_index ON biosamplegenomicinformation USING btree (bioSampleAgmType_id); --Adding 3 new htp category tags INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'bulk RNA-seq', id FROM vocabulary WHERE vocabularylabel = 'data_set_category_tags'; From e0b316bd8080d969ed189143187a7d98fe2aec74 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Tue, 15 Oct 2024 13:55:24 -0400 Subject: [PATCH 300/342] Added transactional --- .../curation_api/dao/loads/BulkLoadFileExceptionDAO.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java index 08d4628cf..d4008becd 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/loads/BulkLoadFileExceptionDAO.java @@ -6,6 +6,7 @@ import io.quarkus.logging.Log; import jakarta.enterprise.context.ApplicationScoped; import jakarta.persistence.Query; +import jakarta.transaction.Transactional; @ApplicationScoped public class BulkLoadFileExceptionDAO extends BaseSQLDAO { @@ -13,6 +14,7 @@ protected BulkLoadFileExceptionDAO() { super(BulkLoadFileException.class); } + @Transactional public void cleanUpTwoWeekOldExceptions() { Log.info("Deleting Old Bulk Exceptions: \"DELETE FROM BulkLoadFileException WHERE dbdatecreated < NOW() - INTERVAL '14 days'\""); Query jpqlQuery = entityManager.createNativeQuery("DELETE FROM BulkLoadFileException WHERE dbdatecreated < NOW() - INTERVAL '14 days'"); From 97222e8985c7f15d0e71a16b85e622a643cff16b Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Tue, 8 Oct 2024 11:13:10 +0200 Subject: [PATCH 301/342] SCRUM-4118 load of expression atlas records into postgres --- .../cliapp/src/service/DataLoadService.js | 2 +- .../curation_api/dao/DataProviderDAO.java | 27 +++-- .../enums/BackendBulkLoadType.java | 1 + .../crud/ExpressionAtlasCrudInterface.java | 29 +++++ .../jobs/executors/BulkLoadJobExecutor.java | 4 +- .../executors/ExpressionAtlasExecutor.java | 104 ++++++++++++++++++ .../model/entities/CrossReference.java | 2 +- .../services/DataProviderService.java | 76 ++++++++++--- .../validation/DataProviderValidator.java | 5 + .../base/AuditedObjectValidator.java | 31 +++--- .../v0.37.0.60__expression_atlas-load.sql | 87 +++++++++++++++ 11 files changed, 325 insertions(+), 43 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java create mode 100644 src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 5a295142b..e09331deb 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -96,7 +96,7 @@ export class DataLoadService extends BaseAuthService { 'PARALOGY', 'SEQUENCE_TARGETING_REAGENT', ], - BulkURLLoad: ['ONTOLOGY', 'GENE', 'ALLELE', 'AGM', 'DISEASE_ANNOTATION', 'RESOURCE_DESCRIPTOR'], + BulkURLLoad: ['ONTOLOGY', 'GENE', 'ALLELE', 'AGM', 'DISEASE_ANNOTATION', 'RESOURCE_DESCRIPTOR', 'EXPRESSION_ATLAS'], BulkManualLoad: [ 'FULL_INGEST', 'DISEASE_ANNOTATION', diff --git a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index c3222d924..1d131bf8b 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -1,35 +1,37 @@ package org.alliancegenome.curation_api.dao; -import java.util.HashMap; - +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.model.input.Pagination; import org.alliancegenome.curation_api.response.SearchResponse; -import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Inject; -import jakarta.transaction.Transactional; +import java.util.HashMap; +import java.util.List; @ApplicationScoped public class DataProviderDAO extends BaseSQLDAO { - @Inject CrossReferenceDAO crossReferenceDAO; - + @Inject + CrossReferenceDAO crossReferenceDAO; + private HashMap dataProviderCache = new HashMap<>(); protected DataProviderDAO() { super(DataProvider.class); } - + @Transactional public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { if (dataProviderCache.containsKey(sourceOrganization.getAbbreviation())) { return dataProviderCache.get(sourceOrganization.getAbbreviation()); } - + HashMap params = new HashMap<>(); params.put("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); params.put("crossReference.referencedCurie", sourceOrganization.getAbbreviation()); @@ -58,4 +60,11 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { return null; } + + public List getAllDataProvider(HashMap params) { + Pagination pagination = new Pagination(); + pagination.setLimit(10_000_000); + SearchResponse orgResponse = findByParams(pagination, params); + return orgResponse.getResults(); + } } 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 7075a5a09..fdcd38ddc 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -27,6 +27,7 @@ public enum BackendBulkLoadType { GFF_TRANSCRIPT("gff"), INTERACTION_MOL("tsv"), + EXPRESSION_ATLAS("tsv"), INTERACTION_GEN("tsv"), PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java new file mode 100644 index 000000000..64364e34b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java @@ -0,0 +1,29 @@ +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.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.interfaces.base.crud.BaseCreateControllerInterface; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.Transcript; +import org.alliancegenome.curation_api.model.ingest.dto.CrossReferenceDTO; +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 java.util.List; + +@Path("/expression-atlas") +@Tag(name = "CRUD - Expression Atlas") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface ExpressionAtlasCrudInterface extends BaseCreateControllerInterface { + + @POST + @Path("/bulk/{dataProvider}_{assemblyName}/transcripts") + @JsonView(View.FieldsAndLists.class) + APIResponse updateExpressionAtlas(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List crossRefData); + +} 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 b1c877a80..2b9f00659 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 @@ -60,6 +60,7 @@ public class BulkLoadJobExecutor { @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor; + @Inject ExpressionAtlasExecutor expressionAtlasExecutor; public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) throws Exception { @@ -120,7 +121,6 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th resourceDescriptorExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION) { geneExpressionExecutor.execLoad(bulkLoadFileHistory); - } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON) { gff3ExonExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS) { @@ -129,6 +129,8 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th gff3TranscriptExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.HTPDATASET) { htpExpressionDatasetAnnotationExecutor.execLoad(bulkLoadFileHistory); + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION_ATLAS) { + expressionAtlasExecutor.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 new file mode 100644 index 000000000..93590bcd8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java @@ -0,0 +1,104 @@ +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 org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.DataProvider; +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.entities.bulkloads.BulkURLLoad; +import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.OrganizationService; +import org.alliancegenome.curation_api.services.ResourceDescriptorPageService; +import org.alliancegenome.curation_api.services.ResourceDescriptorService; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; + +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@JBossLog +@ApplicationScoped +public class ExpressionAtlasExecutor extends LoadFileExecutor { + + @Inject + AGMDiseaseAnnotationDAO agmDiseaseAnnotationDAO; + @Inject + DataProviderService service; + @Inject + ResourceDescriptorPageService resourceDescriptorPageService; + @Inject + ResourceDescriptorService resourceDescriptorService; + @Inject + OrganizationService organizationService; + + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException { + + String url = ((BulkURLLoad) bulkLoadFileHistory.getBulkLoad()).getBulkloadUrl(); + + XmlMapper mapper = new XmlMapper(); + URL src = new URL(url); + Urlset urlset = mapper.readValue(src, Urlset.class); + List accessionUrlList = urlset.url.stream().map(UrlElement::getLoc).toList(); + List accessions = accessionUrlList.stream().map(sUrl -> sUrl.substring(sUrl.lastIndexOf("/") + 1)).toList(); +/* + String loc = accessionUrlList.get(0); + String defaultUrlTemplate = loc.substring(0, loc.lastIndexOf("/")); +*/ + + String name = bulkLoadFileHistory.getBulkLoad().getName(); + String dataProviderName = name.substring(0, name.indexOf(" ")); + + Organization organization = organizationService.getByAbbr(dataProviderName).getEntity(); + ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor("ENSEMBL", "expression_atlas"); + + List dataProviderIdsBefore = new ArrayList<>(); + dataProviderIdsBefore.addAll(service.getDataProviderMap(organization, page).values().stream().map(DataProvider::getId).toList()); + dataProviderIdsBefore.removeIf(Objects::isNull); + + List dataProviderIdsLoaded = new ArrayList<>(); + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess(name, accessions.size()); + accessions.forEach(accession -> { + CrossReference reference = new CrossReference(); + reference.setReferencedCurie(accession); + reference.setResourceDescriptorPage(page); + DataProvider provider = new DataProvider(); + provider.setSourceOrganization(organization); + provider.setCrossReference(reference); + dataProviderIdsLoaded.add(service.upsert(provider).getEntity().getId()); + ph.progressProcess(); + }); + runCleanup(service, bulkLoadFileHistory, dataProviderName, dataProviderIdsBefore, dataProviderIdsLoaded, "Atlas Load Type"); + ph.finishProcess(); + bulkLoadFileHistory.setCount(accessions.size()); + updateHistory(bulkLoadFileHistory); + + bulkLoadFileHistory.finishLoad(); + updateHistory(bulkLoadFileHistory); + updateExceptions(bulkLoadFileHistory); + } + +} + +class Urlset { + @JacksonXmlElementWrapper(useWrapping = false) + public List url = new ArrayList<>(); +} + +class UrlElement { + public String loc; + public String changefreq; + + public String getLoc() { + return loc; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/CrossReference.java b/src/main/java/org/alliancegenome/curation_api/model/entities/CrossReference.java index 58da2a1a1..982ea293f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/CrossReference.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/CrossReference.java @@ -60,7 +60,7 @@ public class CrossReference extends AuditedObject { private ResourceDescriptorPage resourceDescriptorPage; public String getPrefix() { - if (referencedCurie.indexOf(":") == -1) { + if (!referencedCurie.contains(":")) { return referencedCurie; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index 9796e9092..7a8b8f7d5 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -1,29 +1,35 @@ 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.DataProviderDAO; import org.alliancegenome.curation_api.dao.OrganizationDAO; -import org.alliancegenome.curation_api.model.entities.AllianceMember; -import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.Person; +import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.DataProviderValidator; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; -import jakarta.transaction.Transactional; +import java.util.HashMap; +import java.util.List; +import java.util.Objects; @RequestScoped public class DataProviderService extends BaseEntityCrudService { @Inject - @AuthenticatedUser protected Person authenticatedPerson; - @Inject PersonService personService; - @Inject DataProviderDAO dataProviderDAO; - @Inject OrganizationDAO organizationDAO; - @Inject DataProviderValidator dataProviderValidator; + @AuthenticatedUser + protected Person authenticatedPerson; + @Inject + PersonService personService; + @Inject + DataProviderDAO dataProviderDAO; + @Inject + OrganizationDAO organizationDAO; + @Inject + DataProviderValidator dataProviderValidator; @Override @PostConstruct @@ -44,21 +50,55 @@ public DataProvider createAffiliatedModDataProvider() { public DataProvider getAllianceDataProvider() { return getDefaultDataProvider("Alliance"); } - + @Transactional public DataProvider getDefaultDataProvider(String sourceOrganizationAbbreviation) { return dataProviderDAO.getOrCreateDataProvider(organizationDAO.getOrCreateOrganization(sourceOrganizationAbbreviation)); } @Transactional - public ObjectResponse upsert(DataProvider uiEntity) { - ObjectResponse response = dataProviderValidator.validateDataProvider(uiEntity, null, true); - if (response.getEntity() == null) { - return response; + public ObjectResponse upsert(DataProvider entity) { + DataProvider dbEntity = getDataProvider(entity.getSourceOrganization(), entity.getCrossReference().getReferencedCurie(), entity.getCrossReference().getResourceDescriptorPage()); + //ObjectResponse response = dataProviderValidator.validateDataProvider(entity); + if (dbEntity == null) { + dataProviderDAO.persist(entity); + return new ObjectResponse<>(entity); + } + return new ObjectResponse<>(dbEntity); + } + + // + HashMap dataProviderMap = new HashMap<>(); + + private DataProvider getDataProvider(Organization sourceOrganization, String crossReferenceCurie, ResourceDescriptorPage page) { + if (dataProviderMap.size() > 0) { + return dataProviderMap.get(crossReferenceCurie); } - return new ObjectResponse(response.getEntity()); + populateDataProviderMap(sourceOrganization, page); + return dataProviderMap.get(crossReferenceCurie); } + private void populateDataProviderMap(Organization sourceOrganization, ResourceDescriptorPage page) { + HashMap params = new HashMap<>(); + params.put("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); + params.put("crossReference.resourceDescriptorPage.name", page.getName()); + List allOrgProvider = dataProviderDAO.getAllDataProvider(params); + allOrgProvider.stream() + .filter(dataProvider -> dataProvider.getCrossReference() != null && Objects.equals(dataProvider.getCrossReference().getResourceDescriptorPage().getId(), page.getId())) + .forEach(dataProvider -> { + dataProviderMap.put(dataProvider.getCrossReference().getReferencedCurie(), dataProvider); + }); + } + + public HashMap getDataProviderMap(Organization sourceOrganization, ResourceDescriptorPage page) { + if (dataProviderMap.size() > 0) { + return dataProviderMap; + } + populateDataProviderMap(sourceOrganization, page); + return dataProviderMap; + } + + public ObjectResponse validate(DataProvider uiEntity) { return dataProviderValidator.validateDataProvider(uiEntity, null, true); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java index 8132d9541..ad06818c5 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java @@ -111,4 +111,9 @@ private Organization validateSourceOrganization(DataProvider uiEntity, DataProvi return sourceOrganization; } + + public ObjectResponse validateDataProvider(DataProvider entity) { + + return null; + } } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java index a20a97f83..a8a50896c 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java @@ -1,8 +1,6 @@ package org.alliancegenome.curation_api.services.validation.base; -import java.time.OffsetDateTime; -import java.util.List; - +import jakarta.inject.Inject; import org.alliancegenome.curation_api.auth.AuthenticatedUser; import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Person; @@ -12,14 +10,17 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import jakarta.inject.Inject; +import java.time.OffsetDateTime; +import java.util.List; public class AuditedObjectValidator { @Inject - @AuthenticatedUser protected Person authenticatedPerson; + @AuthenticatedUser + protected Person authenticatedPerson; - @Inject PersonService personService; + @Inject + PersonService personService; public ObjectResponse response; @@ -41,21 +42,25 @@ public E validateAuditedObjectFields(E uiEntity, E dbEntity, Boolean newEntity) dbEntity.setDateCreated(uiEntity.getDateCreated()); } + String oktaEmail = authenticatedPerson.getOktaEmail(); if (uiEntity.getCreatedBy() != null) { Person createdBy = personService.fetchByUniqueIdOrCreate(uiEntity.getCreatedBy().getUniqueId()); createdBy.getEmails().size(); createdBy.getOldEmails().size(); dbEntity.setCreatedBy(createdBy); } else if (newEntity) { - Person createdBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); - createdBy.getEmails().size(); - createdBy.getOldEmails().size(); - dbEntity.setCreatedBy(createdBy); + if (oktaEmail != null) { + Person createdBy = personService.findPersonByOktaEmail(oktaEmail); + createdBy.getEmails().size(); + createdBy.getOldEmails().size(); + dbEntity.setCreatedBy(createdBy); + } } - Person updatedBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); - dbEntity.setUpdatedBy(updatedBy); - + if (oktaEmail != null) { + Person updatedBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); + dbEntity.setUpdatedBy(updatedBy); + } dbEntity.setDateUpdated(OffsetDateTime.now()); return dbEntity; diff --git a/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql b/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql new file mode 100644 index 000000000..7af4a2f21 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql @@ -0,0 +1,87 @@ +insert into bulkloadgroup (id, name, internal, obsolete, dbdatecreated) +values (nextval('bulkloadgroup_seq'), 'Expression Atlas Load', false, false, now()); + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','ZFIN Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','SGD Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','WB Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','MGI Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','FB Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','RGD Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +insert into bulkload (id, backendbulkloadtype, name, internal, obsolete, group_id, dbdatecreated, bulkloadstatus) +select nextval('bulkload_seq'), 'EXPRESSION_ATLAS','HUMAN Expression Atlas', false, false, id, now(), 'STOPPED' +from bulkloadgroup where name = 'Expression Atlas Load'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'ZFIN Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'SGD Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'MGI Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'WB Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'FB Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'RGD Expression Atlas'; + +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) +SELECT id, '0 0 22 ? * SUN-THU', true FROM bulkload WHERE name = 'HUMAN Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Danio_rerio/sitemap.xml?allEntries=true' +from bulkload where name = 'ZFIN Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Saccharomyces_cerevisiae/sitemap.xml?allEntries=true' +from bulkload where name = 'SGD Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Caenorhabditis_elegans/sitemap.xml?allEntries=true' +from bulkload where name = 'WB Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Mus_musculus/sitemap.xml?allEntries=true' +from bulkload where name = 'MGI Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Drosophila_melanogaster/sitemap.xml?allEntries=true' +from bulkload where name = 'FB Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Rattus_norvegicus/sitemap.xml?allEntries=true' +from bulkload where name = 'RGD Expression Atlas'; + +insert into bulkurlload (id, bulkloadurl) +select id, 'https://www.ebi.ac.uk/gxa/species/Homo_sapiens/sitemap.xml?allEntries=true' +from bulkload where name = 'HUMAN Expression Atlas'; + + +insert into resourcedescriptorpage (id, name, urltemplate, pagedescription, resourcedescriptor_id) +select nextval('resourcedescriptorpage_seq'), 'expression_atlas', 'http://www.ebi.ac.uk/gxa/genes/[%s]', 'Expression Atlas', id +from resourcedescriptor where prefix = 'ENSEMBL'; + +insert into organization (id, abbreviation, fullname) +VALUES (nextval('organization_seq'),'HUMAN','Human'); From d3e5cc631fd564d7f23115ba33f85d9e629f697c Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Wed, 9 Oct 2024 17:28:20 +0200 Subject: [PATCH 302/342] SCRUM-4118 include gene-crossreference association --- .../curation_api/dao/CrossReferenceDAO.java | 48 ++++++++++++++++++- .../executors/ExpressionAtlasExecutor.java | 39 +++++++++------ .../bulkloads/BulkLoadFileHistory.java | 12 +++-- .../services/CrossReferenceService.java | 27 ++++++----- .../services/DataProviderService.java | 35 +++++++++++++- 5 files changed, 129 insertions(+), 32 deletions(-) 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 4bd4398bc..e74e14e58 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java @@ -1,9 +1,16 @@ package org.alliancegenome.curation_api.dao; +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.persistence.Query; +import jakarta.persistence.TypedQuery; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; -import jakarta.enterprise.context.ApplicationScoped; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @ApplicationScoped public class CrossReferenceDAO extends BaseSQLDAO { @@ -11,4 +18,43 @@ public class CrossReferenceDAO extends BaseSQLDAO { protected CrossReferenceDAO() { super(CrossReference.class); } + + public Map getGenesWithCrossRefs(ResourceDescriptorPage page) { + String sql = """ + select gc.genomicentity_id, cr.referencedcurie from genomicentity_crossreference as gc, crossreference as cr + where gc.crossreferences_id = cr.id AND cr.resourcedescriptorpage_id = :pageID + """; + Query query = entityManager.createNativeQuery(sql); + query.setParameter("pageID", page.getId()); + List objects = query.getResultList(); + Map ensemblGeneMap = new HashMap<>(); + objects.forEach(object -> { + ensemblGeneMap.put((String) object[1], (Long) object[0]); + }); + return ensemblGeneMap; + } + + public Gene getGeneByCrossRef(String referencedCurie) { + String sql = """ + select distinct gene from Gene gene, CrossReference as cc + where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie + """; + TypedQuery query = entityManager.createQuery(sql, Gene.class); + query.setParameter("refCurie", referencedCurie); + return query.getSingleResult(); + + } + + + public Integer persistAccessionGeneAssociated(Long crossReferenceID, Long geneID) { + String sql = """ + insert into genomicentity_crossreference (crossreferences_id,genomicentity_id) + VALUES (:crossRef, :geneID) + """; + Query query = entityManager.createNativeQuery(sql); + query.setParameter("crossRef", crossReferenceID); + query.setParameter("geneID", geneID); + int update = query.executeUpdate(); + return update; + } } 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 93590bcd8..d49b6e5e2 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 @@ -5,17 +5,17 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import lombok.extern.jbosslog.JBossLog; -import org.alliancegenome.curation_api.dao.AGMDiseaseAnnotationDAO; +import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; 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.entities.bulkloads.BulkURLLoad; +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.services.ResourceDescriptorPageService; -import org.alliancegenome.curation_api.services.ResourceDescriptorService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import java.io.IOException; @@ -24,20 +24,22 @@ import java.util.List; import java.util.Objects; +import static org.alliancegenome.curation_api.services.DataProviderService.getFullReferencedCurie; + @JBossLog @ApplicationScoped public class ExpressionAtlasExecutor extends LoadFileExecutor { - @Inject - AGMDiseaseAnnotationDAO agmDiseaseAnnotationDAO; @Inject DataProviderService service; @Inject - ResourceDescriptorPageService resourceDescriptorPageService; + CrossReferenceService crossReferenceService; @Inject - ResourceDescriptorService resourceDescriptorService; + ResourceDescriptorPageService resourceDescriptorPageService; @Inject OrganizationService organizationService; + @Inject + CrossReferenceDAO crossReferenceDAO; public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException { @@ -47,7 +49,9 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException URL src = new URL(url); Urlset urlset = mapper.readValue(src, Urlset.class); List accessionUrlList = urlset.url.stream().map(UrlElement::getLoc).toList(); - List accessions = accessionUrlList.stream().map(sUrl -> sUrl.substring(sUrl.lastIndexOf("/") + 1)).toList(); + List accessions = accessionUrlList.stream() + .map(sUrl -> sUrl.substring(sUrl.lastIndexOf("/") + 1)) + .toList(); /* String loc = accessionUrlList.get(0); String defaultUrlTemplate = loc.substring(0, loc.lastIndexOf("/")); @@ -57,10 +61,10 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException String dataProviderName = name.substring(0, name.indexOf(" ")); Organization organization = organizationService.getByAbbr(dataProviderName).getEntity(); - ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor("ENSEMBL", "expression_atlas"); + ResourceDescriptorPage ensemblGenePage = resourceDescriptorPageService.getPageForResourceDescriptor("ENSEMBL", "expression_atlas"); - List dataProviderIdsBefore = new ArrayList<>(); - dataProviderIdsBefore.addAll(service.getDataProviderMap(organization, page).values().stream().map(DataProvider::getId).toList()); + List dataProviderIdsBefore = + new ArrayList<>(service.getDataProviderMap(organization, ensemblGenePage).values().stream().map(DataProvider::getId).toList()); dataProviderIdsBefore.removeIf(Objects::isNull); List dataProviderIdsLoaded = new ArrayList<>(); @@ -69,17 +73,24 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException ph.startProcess(name, accessions.size()); accessions.forEach(accession -> { CrossReference reference = new CrossReference(); - reference.setReferencedCurie(accession); - reference.setResourceDescriptorPage(page); + reference.setReferencedCurie(getFullReferencedCurie(accession)); + reference.setDisplayName(accession); + reference.setResourceDescriptorPage(ensemblGenePage); DataProvider provider = new DataProvider(); provider.setSourceOrganization(organization); provider.setCrossReference(reference); - dataProviderIdsLoaded.add(service.upsert(provider).getEntity().getId()); + DataProvider entity = service.upsert(provider).getEntity(); + if (entity != null) { + dataProviderIdsLoaded.add(entity.getId()); + bulkLoadFileHistory.incrementCompleted(); + } else { + bulkLoadFileHistory.incrementSkipped(); + } ph.progressProcess(); }); + bulkLoadFileHistory.setTotalCount(accessions.size()); runCleanup(service, bulkLoadFileHistory, dataProviderName, dataProviderIdsBefore, dataProviderIdsLoaded, "Atlas Load Type"); ph.finishProcess(); - bulkLoadFileHistory.setCount(accessions.size()); updateHistory(bulkLoadFileHistory); bulkLoadFileHistory.finishLoad(); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java index efcba3ade..ca460a27f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/bulkloads/BulkLoadFileHistory.java @@ -40,7 +40,7 @@ public class BulkLoadFileHistory extends AuditedObject { private static final String COUNT_TYPE = "Records"; - + @JsonView({ View.FieldsOnly.class }) private LocalDateTime loadStarted = LocalDateTime.now(); @@ -84,13 +84,13 @@ public BulkLoadFileHistory(Integer count) { public BulkLoadFileHistory() { loadStarted = LocalDateTime.now(); } - + @Transient public void finishLoad() { loadFinished = LocalDateTime.now(); } - - + + @Transient public void addCounts2(BulkLoadFileHistory history) { for (Entry entry: history.getCounts().entrySet()) { @@ -144,6 +144,10 @@ public void incrementSkipped(String countType) { getProcessCount(countType).incrementSkipped(); } @Transient + public void setTotalCount(long total) { + getProcessCount(COUNT_TYPE).setTotal(total); + } + @Transient public double getErrorRate() { return getErrorRate(COUNT_TYPE); } 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 1b5263011..eff5ba8d7 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/CrossReferenceService.java @@ -1,10 +1,9 @@ package org.alliancegenome.curation_api.services; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; @@ -13,16 +12,18 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; -import jakarta.transaction.Transactional; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; @RequestScoped public class CrossReferenceService extends BaseEntityCrudService { - @Inject CrossReferenceDAO crossReferenceDAO; - @Inject ResourceDescriptorPageService resourceDescriptorPageService; + @Inject + CrossReferenceDAO crossReferenceDAO; + @Inject + ResourceDescriptorPageService resourceDescriptorPageService; @Override @PostConstruct @@ -104,4 +105,8 @@ public String getCrossReferenceUniqueId(CrossReference xref) { } return StringUtils.join(List.of(xref.getReferencedCurie(), xref.getResourceDescriptorPage().getId()), "|"); } + + public Map getGenomicEntityCrossRefMap(ResourceDescriptorPage page) { + return crossReferenceDAO.getGenesWithCrossRefs(page); + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index 7a8b8f7d5..51ecd6f0d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -5,15 +5,18 @@ import jakarta.inject.Inject; import jakarta.transaction.Transactional; import org.alliancegenome.curation_api.auth.AuthenticatedUser; +import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.dao.DataProviderDAO; import org.alliancegenome.curation_api.dao.OrganizationDAO; import org.alliancegenome.curation_api.model.entities.*; 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.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Objects; @RequestScoped @@ -27,6 +30,10 @@ public class DataProviderService extends BaseEntityCrudService upsert(DataProvider entity) { - DataProvider dbEntity = getDataProvider(entity.getSourceOrganization(), entity.getCrossReference().getReferencedCurie(), entity.getCrossReference().getResourceDescriptorPage()); - //ObjectResponse response = dataProviderValidator.validateDataProvider(entity); + String referencedCurie = entity.getCrossReference().getReferencedCurie(); + // find associated gene + Long geneID = getAssociatedGeneId(referencedCurie); + // if no gene found skip (= don't import) the accession + if (geneID == null) { + return new ObjectResponse<>(); + } + + DataProvider dbEntity = getDataProvider(entity.getSourceOrganization(), referencedCurie, entity.getCrossReference().getResourceDescriptorPage()); if (dbEntity == null) { dataProviderDAO.persist(entity); + Integer update = crossReferenceDAO.persistAccessionGeneAssociated(entity.getCrossReference().getId(), geneID); return new ObjectResponse<>(entity); } return new ObjectResponse<>(dbEntity); } + @NotNull + public static String getFullReferencedCurie(String localReferencedCurie) { + return RESOURCE_DESCRIPTOR_PREFIX + ":" + localReferencedCurie; + } + + Map accessionGeneMap = new HashMap<>(); + public static String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; + + private Long getAssociatedGeneId(String fullReferencedCurie) { + if (accessionGeneMap.size() == 0) { + ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor(RESOURCE_DESCRIPTOR_PREFIX, "default"); + accessionGeneMap = crossReferenceDAO.getGenesWithCrossRefs(page); + } + return accessionGeneMap.get(fullReferencedCurie); + } + // HashMap dataProviderMap = new HashMap<>(); From 25ba7f6d19a62386c43429686ecb2ef8f859029c Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Wed, 9 Oct 2024 19:46:24 +0200 Subject: [PATCH 303/342] add logic to load FB --- .../crud/DataProviderCrudController.java | 4 +-- .../curation_api/dao/GeneDAO.java | 17 ++++++++++ .../executors/ExpressionAtlasExecutor.java | 31 +++++++++--------- .../services/DataProviderService.java | 32 +++++++++++++------ 4 files changed, 57 insertions(+), 27 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java index 0165bd9e2..dfb9928e6 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java @@ -25,12 +25,12 @@ protected void init() { @Override public ObjectResponse update(DataProvider entity) { - return dataProviderService.upsert(entity); + return dataProviderService.insertExpressionAtlasDataProvider(entity); } @Override public ObjectResponse create(DataProvider entity) { - return dataProviderService.upsert(entity); + return dataProviderService.insertExpressionAtlasDataProvider(entity); } public ObjectResponse validate(DataProvider entity) { diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java index 179d52cf8..af8ed6e2a 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java @@ -4,9 +4,11 @@ import java.util.List; import java.util.Map; +import jakarta.persistence.Query; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.dao.orthology.GeneToGeneOrthologyDAO; import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.Species; import org.apache.commons.collections.CollectionUtils; import jakarta.enterprise.context.ApplicationScoped; @@ -109,4 +111,19 @@ public List findReferencingGeneExpressionAnnotations(Long geneId) { params.put("expressionAnnotationSubject.id", geneId); return geneExpressionAnnotationDAO.findIdsByParams(params); } + + public Map getAllGeneIdsPerSpecies(Species species) { + String sql = """ + select g.id, be.modentityid from biologicalentity as be, gene as g + where taxon_id = :ID AND be.id = g.id; + """; + Query query = entityManager.createNativeQuery(sql); + query.setParameter("ID", species.getTaxon().getId()); + 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/jobs/executors/ExpressionAtlasExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/ExpressionAtlasExecutor.java index d49b6e5e2..2297dc923 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 @@ -5,18 +5,17 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; import lombok.extern.jbosslog.JBossLog; -import org.alliancegenome.curation_api.dao.CrossReferenceDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; 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.entities.bulkloads.BulkURLLoad; -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.services.ResourceDescriptorPageService; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; +import org.jetbrains.annotations.NotNull; import java.io.IOException; import java.net.URL; @@ -33,13 +32,9 @@ public class ExpressionAtlasExecutor extends LoadFileExecutor { @Inject DataProviderService service; @Inject - CrossReferenceService crossReferenceService; - @Inject ResourceDescriptorPageService resourceDescriptorPageService; @Inject OrganizationService organizationService; - @Inject - CrossReferenceDAO crossReferenceDAO; public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException { @@ -52,10 +47,6 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException List accessions = accessionUrlList.stream() .map(sUrl -> sUrl.substring(sUrl.lastIndexOf("/") + 1)) .toList(); -/* - String loc = accessionUrlList.get(0); - String defaultUrlTemplate = loc.substring(0, loc.lastIndexOf("/")); -*/ String name = bulkLoadFileHistory.getBulkLoad().getName(); String dataProviderName = name.substring(0, name.indexOf(" ")); @@ -72,14 +63,11 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException ph.addDisplayHandler(loadProcessDisplayService); ph.startProcess(name, accessions.size()); accessions.forEach(accession -> { - CrossReference reference = new CrossReference(); - reference.setReferencedCurie(getFullReferencedCurie(accession)); - reference.setDisplayName(accession); - reference.setResourceDescriptorPage(ensemblGenePage); + CrossReference reference = getCrossReference(ensemblGenePage, accession, organization); DataProvider provider = new DataProvider(); provider.setSourceOrganization(organization); provider.setCrossReference(reference); - DataProvider entity = service.upsert(provider).getEntity(); + DataProvider entity = service.insertExpressionAtlasDataProvider(provider).getEntity(); if (entity != null) { dataProviderIdsLoaded.add(entity.getId()); bulkLoadFileHistory.incrementCompleted(); @@ -98,6 +86,19 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException updateExceptions(bulkLoadFileHistory); } + @NotNull + private static CrossReference getCrossReference(ResourceDescriptorPage ensemblGenePage, String accession, Organization organization) { + CrossReference reference = new CrossReference(); + if (organization.getAbbreviation().equals("FB")) { + reference.setReferencedCurie(accession); + } else { + reference.setReferencedCurie(getFullReferencedCurie(accession)); + } + reference.setDisplayName(accession); + reference.setResourceDescriptorPage(ensemblGenePage); + return reference; + } + } class Urlset { diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index 51ecd6f0d..c13f67280 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -5,9 +5,7 @@ import jakarta.inject.Inject; import jakarta.transaction.Transactional; import org.alliancegenome.curation_api.auth.AuthenticatedUser; -import org.alliancegenome.curation_api.dao.CrossReferenceDAO; -import org.alliancegenome.curation_api.dao.DataProviderDAO; -import org.alliancegenome.curation_api.dao.OrganizationDAO; +import org.alliancegenome.curation_api.dao.*; import org.alliancegenome.curation_api.model.entities.*; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; @@ -26,7 +24,7 @@ public class DataProviderService extends BaseEntityCrudService upsert(DataProvider entity) { + public ObjectResponse insertExpressionAtlasDataProvider(DataProvider entity) { String referencedCurie = entity.getCrossReference().getReferencedCurie(); // find associated gene - Long geneID = getAssociatedGeneId(referencedCurie); + Long geneID = getAssociatedGeneId(referencedCurie, entity.getSourceOrganization()); // if no gene found skip (= don't import) the accession if (geneID == null) { return new ObjectResponse<>(); @@ -76,7 +76,9 @@ public ObjectResponse upsert(DataProvider entity) { DataProvider dbEntity = getDataProvider(entity.getSourceOrganization(), referencedCurie, entity.getCrossReference().getResourceDescriptorPage()); if (dbEntity == null) { dataProviderDAO.persist(entity); - Integer update = crossReferenceDAO.persistAccessionGeneAssociated(entity.getCrossReference().getId(), geneID); + if (!entity.getSourceOrganization().getAbbreviation().equals("FB")) { + Integer update = crossReferenceDAO.persistAccessionGeneAssociated(entity.getCrossReference().getId(), geneID); + } return new ObjectResponse<>(entity); } return new ObjectResponse<>(dbEntity); @@ -89,11 +91,21 @@ public static String getFullReferencedCurie(String localReferencedCurie) { Map accessionGeneMap = new HashMap<>(); public static String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; + public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default"; - private Long getAssociatedGeneId(String fullReferencedCurie) { + private Long getAssociatedGeneId(String fullReferencedCurie, Organization sourceOrganization) { if (accessionGeneMap.size() == 0) { - ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor(RESOURCE_DESCRIPTOR_PREFIX, "default"); - accessionGeneMap = crossReferenceDAO.getGenesWithCrossRefs(page); + if (sourceOrganization.getAbbreviation().equals("FB")) { + Map map = new HashMap<>(); + map.put("displayName", sourceOrganization.getAbbreviation()); + Species species = speciesDAO.findByParams(map).getSingleResult(); + accessionGeneMap = geneDAO.getAllGeneIdsPerSpecies(species); + fullReferencedCurie = "FB:" + fullReferencedCurie; + return accessionGeneMap.get(fullReferencedCurie); + } else { + ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor(RESOURCE_DESCRIPTOR_PREFIX, RESOURCE_DESCRIPTOR_PAGE_NAME); + accessionGeneMap = crossReferenceDAO.getGenesWithCrossRefs(page); + } } return accessionGeneMap.get(fullReferencedCurie); } From 83c11971f380e0475df46b48b04cde2baee3239f Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 10 Oct 2024 13:59:47 +0200 Subject: [PATCH 304/342] refactor FB,SGD hard-coded logic --- .../alliancegenome/curation_api/dao/GeneDAO.java | 9 +++++++-- .../jobs/executors/ExpressionAtlasExecutor.java | 2 +- .../services/DataProviderService.java | 15 +++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java index af8ed6e2a..723785ac5 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/GeneDAO.java @@ -114,8 +114,12 @@ public List findReferencingGeneExpressionAnnotations(Long geneId) { public Map getAllGeneIdsPerSpecies(Species species) { String sql = """ - select g.id, be.modentityid from biologicalentity as be, gene as g - where taxon_id = :ID AND be.id = g.id; + select g.id, be.modentityid, s.displaytext + from biologicalentity as be, gene as g, slotannotation as s + where be.taxon_id = :ID + AND be.id = g.id + AND s.singlegene_id = g.id + AND s.slotannotationtype = 'GeneSymbolSlotAnnotation' """; Query query = entityManager.createNativeQuery(sql); query.setParameter("ID", species.getTaxon().getId()); @@ -123,6 +127,7 @@ public Map getAllGeneIdsPerSpecies(Species species) { Map ensemblGeneMap = new HashMap<>(); objects.forEach(object -> { ensemblGeneMap.put((String) object[1], (Long) object[0]); + ensemblGeneMap.put((String) object[2], (Long) object[0]); }); return ensemblGeneMap; } 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 2297dc923..d614bfb7c 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 @@ -89,7 +89,7 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) throws IOException @NotNull private static CrossReference getCrossReference(ResourceDescriptorPage ensemblGenePage, String accession, Organization organization) { CrossReference reference = new CrossReference(); - if (organization.getAbbreviation().equals("FB")) { + if (List.of("FB", "SGD").contains(organization.getAbbreviation())) { reference.setReferencedCurie(accession); } else { reference.setReferencedCurie(getFullReferencedCurie(accession)); diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index c13f67280..fd1da3145 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -74,10 +74,11 @@ public ObjectResponse insertExpressionAtlasDataProvider(DataProvid } DataProvider dbEntity = getDataProvider(entity.getSourceOrganization(), referencedCurie, entity.getCrossReference().getResourceDescriptorPage()); + // we only create new records, no updates if (dbEntity == null) { dataProviderDAO.persist(entity); - if (!entity.getSourceOrganization().getAbbreviation().equals("FB")) { - Integer update = crossReferenceDAO.persistAccessionGeneAssociated(entity.getCrossReference().getId(), geneID); + if (!List.of("FB", "SGD").contains(entity.getSourceOrganization().getAbbreviation())) { + crossReferenceDAO.persistAccessionGeneAssociated(entity.getCrossReference().getId(), geneID); } return new ObjectResponse<>(entity); } @@ -94,14 +95,16 @@ public static String getFullReferencedCurie(String localReferencedCurie) { public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default"; private Long getAssociatedGeneId(String fullReferencedCurie, Organization sourceOrganization) { + String orgAbbreviation = sourceOrganization.getAbbreviation(); + if (orgAbbreviation.equals("FB")) { + fullReferencedCurie = orgAbbreviation + ":" + fullReferencedCurie; + } if (accessionGeneMap.size() == 0) { - if (sourceOrganization.getAbbreviation().equals("FB")) { + if (List.of("FB", "SGD").contains(orgAbbreviation)) { Map map = new HashMap<>(); - map.put("displayName", sourceOrganization.getAbbreviation()); + map.put("displayName", orgAbbreviation); Species species = speciesDAO.findByParams(map).getSingleResult(); accessionGeneMap = geneDAO.getAllGeneIdsPerSpecies(species); - fullReferencedCurie = "FB:" + fullReferencedCurie; - return accessionGeneMap.get(fullReferencedCurie); } else { ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor(RESOURCE_DESCRIPTOR_PREFIX, RESOURCE_DESCRIPTOR_PAGE_NAME); accessionGeneMap = crossReferenceDAO.getGenesWithCrossRefs(page); From d832f022dda7b5c7d1a35e43164165cb10ddcacb Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 10 Oct 2024 14:12:44 +0200 Subject: [PATCH 305/342] fix checkstyle issues --- .../controllers/crud/DataProviderCrudController.java | 11 +++++------ .../curation_api/dao/CrossReferenceDAO.java | 8 ++++---- .../interfaces/crud/ExpressionAtlasCrudInterface.java | 5 +---- .../curation_api/services/DataProviderService.java | 10 +++++++++- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java index dfb9928e6..00b25012f 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/DataProviderCrudController.java @@ -1,5 +1,8 @@ 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.DataProviderDAO; import org.alliancegenome.curation_api.interfaces.crud.DataProviderCrudInterface; @@ -7,10 +10,6 @@ import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.DataProviderService; -import jakarta.annotation.PostConstruct; -import jakarta.enterprise.context.RequestScoped; -import jakarta.inject.Inject; - @RequestScoped public class DataProviderCrudController extends BaseEntityCrudController implements DataProviderCrudInterface { @@ -25,12 +24,12 @@ protected void init() { @Override public ObjectResponse update(DataProvider entity) { - return dataProviderService.insertExpressionAtlasDataProvider(entity); + return dataProviderService.upsert(entity); } @Override public ObjectResponse create(DataProvider entity) { - return dataProviderService.insertExpressionAtlasDataProvider(entity); + return dataProviderService.upsert(entity); } public ObjectResponse validate(DataProvider entity) { 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 e74e14e58..cc48d84ea 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java @@ -21,8 +21,8 @@ protected CrossReferenceDAO() { public Map getGenesWithCrossRefs(ResourceDescriptorPage page) { String sql = """ - select gc.genomicentity_id, cr.referencedcurie from genomicentity_crossreference as gc, crossreference as cr - where gc.crossreferences_id = cr.id AND cr.resourcedescriptorpage_id = :pageID + select gc.genomicentity_id, cr.referencedcurie from genomicentity_crossreference as gc, crossreference as cr + where gc.crossreferences_id = cr.id AND cr.resourcedescriptorpage_id = :pageID """; Query query = entityManager.createNativeQuery(sql); query.setParameter("pageID", page.getId()); @@ -36,8 +36,8 @@ public Map getGenesWithCrossRefs(ResourceDescriptorPage page) { public Gene getGeneByCrossRef(String referencedCurie) { String sql = """ - select distinct gene from Gene gene, CrossReference as cc - where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie + select distinct gene from Gene gene, CrossReference as cc + where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie """; TypedQuery query = entityManager.createQuery(sql, Gene.class); query.setParameter("refCurie", referencedCurie); diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java index 64364e34b..0541efab8 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/ExpressionAtlasCrudInterface.java @@ -3,12 +3,9 @@ import com.fasterxml.jackson.annotation.JsonView; import jakarta.ws.rs.*; import jakarta.ws.rs.core.MediaType; -import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; import org.alliancegenome.curation_api.interfaces.base.crud.BaseCreateControllerInterface; import org.alliancegenome.curation_api.model.entities.CrossReference; -import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.model.ingest.dto.CrossReferenceDTO; -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; @@ -25,5 +22,5 @@ public interface ExpressionAtlasCrudInterface extends BaseCreateControllerInterf @Path("/bulk/{dataProvider}_{assemblyName}/transcripts") @JsonView(View.FieldsAndLists.class) APIResponse updateExpressionAtlas(@PathParam("dataProvider") String dataProvider, @PathParam("assemblyName") String assemblyName, List crossRefData); - + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index fd1da3145..b78887093 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -91,7 +91,7 @@ public static String getFullReferencedCurie(String localReferencedCurie) { } Map accessionGeneMap = new HashMap<>(); - public static String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; + public static final String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default"; private Long getAssociatedGeneId(String fullReferencedCurie, Organization sourceOrganization) { @@ -144,6 +144,14 @@ public HashMap getDataProviderMap(Organization sourceOrgan return dataProviderMap; } + @Transactional + public ObjectResponse upsert(DataProvider uiEntity) { + ObjectResponse response = dataProviderValidator.validateDataProvider(uiEntity, null, true); + if (response.getEntity() == null) { + return response; + } + return new ObjectResponse<>(response.getEntity()); + } public ObjectResponse validate(DataProvider uiEntity) { return dataProviderValidator.validateDataProvider(uiEntity, null, true); From 212be662642c5f0f7a6c0646669f6bea051a20c1 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 10 Oct 2024 14:26:01 +0200 Subject: [PATCH 306/342] fix checkstyle issues --- .../org/alliancegenome/curation_api/dao/CrossReferenceDAO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 cc48d84ea..74c8c5888 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java @@ -37,7 +37,7 @@ public Map getGenesWithCrossRefs(ResourceDescriptorPage page) { public Gene getGeneByCrossRef(String referencedCurie) { String sql = """ select distinct gene from Gene gene, CrossReference as cc - where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie + where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie """; TypedQuery query = entityManager.createQuery(sql, Gene.class); query.setParameter("refCurie", referencedCurie); From e2899779aad393992879aac1a2aa546cc1cef6dd Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 10 Oct 2024 15:37:43 +0200 Subject: [PATCH 307/342] fix suggested changes --- .../curation_api/dao/CrossReferenceDAO.java | 12 ------------ .../curation_api/dao/DataProviderDAO.java | 6 +++++- .../executors/ExpressionAtlasExecutor.java | 4 ++-- .../services/DataProviderService.java | 19 ++++++++----------- .../validation/DataProviderValidator.java | 5 ----- 5 files changed, 15 insertions(+), 31 deletions(-) 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 74c8c5888..6ca69087d 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java @@ -34,18 +34,6 @@ public Map getGenesWithCrossRefs(ResourceDescriptorPage page) { return ensemblGeneMap; } - public Gene getGeneByCrossRef(String referencedCurie) { - String sql = """ - select distinct gene from Gene gene, CrossReference as cc - where cc member of gene.crossReferences AND cc.referencedCurie = :refCurie - """; - TypedQuery query = entityManager.createQuery(sql, Gene.class); - query.setParameter("refCurie", referencedCurie); - return query.getSingleResult(); - - } - - 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/DataProviderDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java index 1d131bf8b..bbef29e34 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/DataProviderDAO.java @@ -7,6 +7,7 @@ import org.alliancegenome.curation_api.model.entities.CrossReference; import org.alliancegenome.curation_api.model.entities.DataProvider; import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; import org.alliancegenome.curation_api.model.input.Pagination; import org.alliancegenome.curation_api.response.SearchResponse; @@ -61,7 +62,10 @@ public DataProvider getOrCreateDataProvider(Organization sourceOrganization) { return null; } - public List getAllDataProvider(HashMap params) { + public List getAllDataProvider(Organization sourceOrganization, ResourceDescriptorPage page) { + HashMap params = new HashMap<>(); + params.put("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); + params.put("crossReference.resourceDescriptorPage.name", page.getName()); Pagination pagination = new Pagination(); pagination.setLimit(10_000_000); SearchResponse orgResponse = findByParams(pagination, params); 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 d614bfb7c..b8bbb4e25 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 @@ -23,7 +23,7 @@ import java.util.List; import java.util.Objects; -import static org.alliancegenome.curation_api.services.DataProviderService.getFullReferencedCurie; +import static org.alliancegenome.curation_api.services.DataProviderService.RESOURCE_DESCRIPTOR_PREFIX; @JBossLog @ApplicationScoped @@ -92,7 +92,7 @@ private static CrossReference getCrossReference(ResourceDescriptorPage ensemblGe if (List.of("FB", "SGD").contains(organization.getAbbreviation())) { reference.setReferencedCurie(accession); } else { - reference.setReferencedCurie(getFullReferencedCurie(accession)); + reference.setReferencedCurie(RESOURCE_DESCRIPTOR_PREFIX + ":" + accession); } reference.setDisplayName(accession); reference.setResourceDescriptorPage(ensemblGenePage); diff --git a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java index b78887093..f19f2e68f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/DataProviderService.java @@ -20,6 +20,13 @@ @RequestScoped public class DataProviderService extends BaseEntityCrudService { + public static final String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; + public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default"; + // + Map accessionGeneMap = new HashMap<>(); + HashMap dataProviderMap = new HashMap<>(); + + @Inject @AuthenticatedUser protected Person authenticatedPerson; @@ -90,10 +97,6 @@ public static String getFullReferencedCurie(String localReferencedCurie) { return RESOURCE_DESCRIPTOR_PREFIX + ":" + localReferencedCurie; } - Map accessionGeneMap = new HashMap<>(); - public static final String RESOURCE_DESCRIPTOR_PREFIX = "ENSEMBL"; - public static final String RESOURCE_DESCRIPTOR_PAGE_NAME = "default"; - private Long getAssociatedGeneId(String fullReferencedCurie, Organization sourceOrganization) { String orgAbbreviation = sourceOrganization.getAbbreviation(); if (orgAbbreviation.equals("FB")) { @@ -113,9 +116,6 @@ private Long getAssociatedGeneId(String fullReferencedCurie, Organization source return accessionGeneMap.get(fullReferencedCurie); } - // - HashMap dataProviderMap = new HashMap<>(); - private DataProvider getDataProvider(Organization sourceOrganization, String crossReferenceCurie, ResourceDescriptorPage page) { if (dataProviderMap.size() > 0) { return dataProviderMap.get(crossReferenceCurie); @@ -125,10 +125,7 @@ private DataProvider getDataProvider(Organization sourceOrganization, String cro } private void populateDataProviderMap(Organization sourceOrganization, ResourceDescriptorPage page) { - HashMap params = new HashMap<>(); - params.put("sourceOrganization.abbreviation", sourceOrganization.getAbbreviation()); - params.put("crossReference.resourceDescriptorPage.name", page.getName()); - List allOrgProvider = dataProviderDAO.getAllDataProvider(params); + List allOrgProvider = dataProviderDAO.getAllDataProvider(sourceOrganization, page); allOrgProvider.stream() .filter(dataProvider -> dataProvider.getCrossReference() != null && Objects.equals(dataProvider.getCrossReference().getResourceDescriptorPage().getId(), page.getId())) .forEach(dataProvider -> { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java index ad06818c5..8132d9541 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/DataProviderValidator.java @@ -111,9 +111,4 @@ private Organization validateSourceOrganization(DataProvider uiEntity, DataProvi return sourceOrganization; } - - public ObjectResponse validateDataProvider(DataProvider entity) { - - return null; - } } \ No newline at end of file From d55852f7cf910971c2f9384e4dd6a4f1936c8680 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 10 Oct 2024 15:39:08 +0200 Subject: [PATCH 308/342] remove unused imports --- .../org/alliancegenome/curation_api/dao/CrossReferenceDAO.java | 2 -- 1 file changed, 2 deletions(-) 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 6ca69087d..162d95391 100644 --- a/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java +++ b/src/main/java/org/alliancegenome/curation_api/dao/CrossReferenceDAO.java @@ -2,10 +2,8 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.persistence.Query; -import jakarta.persistence.TypedQuery; import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; import org.alliancegenome.curation_api.model.entities.CrossReference; -import org.alliancegenome.curation_api.model.entities.Gene; import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; import java.util.HashMap; From 85ac85c37b74979ed8572a2c92aa7b0f46d02315 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Fri, 11 Oct 2024 16:22:04 +0200 Subject: [PATCH 309/342] cleanup --- .../services/validation/base/AuditedObjectValidator.java | 3 +-- .../db/migration/v0.37.0.60__expression_atlas-load.sql | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java index a8a50896c..88931238a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java @@ -58,8 +58,7 @@ public E validateAuditedObjectFields(E uiEntity, E dbEntity, Boolean newEntity) } if (oktaEmail != null) { - Person updatedBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); - dbEntity.setUpdatedBy(updatedBy); + dbEntity.setUpdatedBy(authenticatedPerson); } dbEntity.setDateUpdated(OffsetDateTime.now()); diff --git a/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql b/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql index 7af4a2f21..c8d8391de 100644 --- a/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql +++ b/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql @@ -78,10 +78,5 @@ insert into bulkurlload (id, bulkloadurl) select id, 'https://www.ebi.ac.uk/gxa/species/Homo_sapiens/sitemap.xml?allEntries=true' from bulkload where name = 'HUMAN Expression Atlas'; - -insert into resourcedescriptorpage (id, name, urltemplate, pagedescription, resourcedescriptor_id) -select nextval('resourcedescriptorpage_seq'), 'expression_atlas', 'http://www.ebi.ac.uk/gxa/genes/[%s]', 'Expression Atlas', id -from resourcedescriptor where prefix = 'ENSEMBL'; - insert into organization (id, abbreviation, fullname) VALUES (nextval('organization_seq'),'HUMAN','Human'); From a895a57dde35fb1d8f094392ebc7d793dbad05a2 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Fri, 11 Oct 2024 20:05:54 +0200 Subject: [PATCH 310/342] revert changes in AuditedObjectValidator --- .../base/AuditedObjectValidator.java | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java index 88931238a..a20a97f83 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/base/AuditedObjectValidator.java @@ -1,6 +1,8 @@ package org.alliancegenome.curation_api.services.validation.base; -import jakarta.inject.Inject; +import java.time.OffsetDateTime; +import java.util.List; + import org.alliancegenome.curation_api.auth.AuthenticatedUser; import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Person; @@ -10,17 +12,14 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import java.time.OffsetDateTime; -import java.util.List; +import jakarta.inject.Inject; public class AuditedObjectValidator { @Inject - @AuthenticatedUser - protected Person authenticatedPerson; + @AuthenticatedUser protected Person authenticatedPerson; - @Inject - PersonService personService; + @Inject PersonService personService; public ObjectResponse response; @@ -42,24 +41,21 @@ public E validateAuditedObjectFields(E uiEntity, E dbEntity, Boolean newEntity) dbEntity.setDateCreated(uiEntity.getDateCreated()); } - String oktaEmail = authenticatedPerson.getOktaEmail(); if (uiEntity.getCreatedBy() != null) { Person createdBy = personService.fetchByUniqueIdOrCreate(uiEntity.getCreatedBy().getUniqueId()); createdBy.getEmails().size(); createdBy.getOldEmails().size(); dbEntity.setCreatedBy(createdBy); } else if (newEntity) { - if (oktaEmail != null) { - Person createdBy = personService.findPersonByOktaEmail(oktaEmail); - createdBy.getEmails().size(); - createdBy.getOldEmails().size(); - dbEntity.setCreatedBy(createdBy); - } + Person createdBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); + createdBy.getEmails().size(); + createdBy.getOldEmails().size(); + dbEntity.setCreatedBy(createdBy); } - if (oktaEmail != null) { - dbEntity.setUpdatedBy(authenticatedPerson); - } + Person updatedBy = personService.findPersonByOktaEmail(authenticatedPerson.getOktaEmail()); + dbEntity.setUpdatedBy(updatedBy); + dbEntity.setDateUpdated(OffsetDateTime.now()); return dbEntity; From d57dc03951e8c959bfb9ef98c48337fb5ee588f7 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 17 Oct 2024 12:22:58 +0200 Subject: [PATCH 311/342] rename FB script as it collides with newer one. --- ...ssion_atlas-load.sql => v0.37.0.61__expression_atlas-load.sql} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/main/resources/db/migration/{v0.37.0.60__expression_atlas-load.sql => v0.37.0.61__expression_atlas-load.sql} (100%) diff --git a/src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql b/src/main/resources/db/migration/v0.37.0.61__expression_atlas-load.sql similarity index 100% rename from src/main/resources/db/migration/v0.37.0.60__expression_atlas-load.sql rename to src/main/resources/db/migration/v0.37.0.61__expression_atlas-load.sql From b7ef60ea1726b30f0cd076c5c1069664aa8e17a2 Mon Sep 17 00:00:00 2001 From: Christian Pich Date: Thu, 17 Oct 2024 16:41:30 +0200 Subject: [PATCH 312/342] fix UI code style --- src/main/cliapp/src/service/DataLoadService.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index e09331deb..9d8355f71 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -96,7 +96,15 @@ export class DataLoadService extends BaseAuthService { 'PARALOGY', 'SEQUENCE_TARGETING_REAGENT', ], - BulkURLLoad: ['ONTOLOGY', 'GENE', 'ALLELE', 'AGM', 'DISEASE_ANNOTATION', 'RESOURCE_DESCRIPTOR', 'EXPRESSION_ATLAS'], + BulkURLLoad: [ + 'ONTOLOGY', + 'GENE', + 'ALLELE', + 'AGM', + 'DISEASE_ANNOTATION', + 'RESOURCE_DESCRIPTOR', + 'EXPRESSION_ATLAS', + ], BulkManualLoad: [ 'FULL_INGEST', 'DISEASE_ANNOTATION', From 552296798e3af0ef041f6c5c70dbb0ed47deae51 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Mon, 21 Oct 2024 10:19:08 +0100 Subject: [PATCH 313/342] Initial commit of variant FMS loading code --- .../constants/EntityFieldConstants.java | 9 +- .../constants/LinkMLSchemaConstants.java | 2 +- .../constants/VocabularyConstants.java | 3 + .../crud/AssemblyComponentCrudController.java | 35 +++ .../crud/VariantCrudController.java | 10 + .../AlleleVariantAssociationDAO.java | 15 ++ ...dVariantGenomicLocationAssociationDAO.java | 15 ++ .../enums/BackendBulkLoadType.java | 1 + .../crud/AssemblyComponentCrudInterface.java | 18 ++ .../interfaces/crud/VariantCrudInterface.java | 6 + .../jobs/executors/BulkLoadJobExecutor.java | 5 +- .../jobs/executors/VariantFmsExecutor.java | 155 ++++++++++++ .../curation_api/model/entities/Allele.java | 14 +- .../curation_api/model/entities/Variant.java | 20 +- .../AlleleGeneAssociation.java | 2 +- .../AlleleVariantAssociation.java | 64 +++++ ...ingSequenceGenomicLocationAssociation.java | 2 +- .../ExonGenomicLocationAssociation.java | 2 +- .../TranscriptGenomicLocationAssociation.java | 2 +- ...atedVariantGenomicLocationAssociation.java | 38 +++ .../VariantGenomicLocationAssociation.java | 97 ++++++++ .../VariantLocationAssociation.java | 76 ++++++ .../model/ingest/dto/IngestDTO.java | 5 + .../AlleleVariantAssociationDTO.java | 22 ++ .../model/ingest/dto/fms/VariantFmsDTO.java | 26 ++ .../ingest/dto/fms/VariantIngestFmsDTO.java | 15 ++ .../ingest/dto/fms/VariantNoteFmsDTO.java | 15 ++ .../curation_api/services/AlleleService.java | 1 + .../services/AssemblyComponentService.java | 11 + .../curation_api/services/VariantService.java | 8 +- .../AlleleVariantAssociationService.java | 175 +++++++++++++ ...iantGenomicLocationAssociationService.java | 126 ++++++++++ .../variants/HgvsIdentifierHelper.java | 59 +++++ .../AlleleVariantAssociationValidator.java | 146 +++++++++++ .../validation/dto/Gff3DtoValidator.java | 6 +- .../validation/dto/VariantDTOValidator.java | 3 + .../AlleleVariantAssociationDTOValidator.java | 123 ++++++++++ .../dto/fms/VariantFmsDTOValidator.java | 230 ++++++++++++++++++ ...d_variant_genomic_location_association.sql | 144 +++++++++++ .../curation_api/VariantFmsITCase.java | 101 ++++++++ .../curation_api/base/BaseITCase.java | 31 ++- .../bulk/fms/10_variant/AF_01_all_fields.json | 48 ++++ 42 files changed, 1864 insertions(+), 22 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/AssemblyComponentCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/alleleAssociations/AlleleVariantAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/dao/associations/variantAssociations/CuratedVariantGenomicLocationAssociationDAO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/AssemblyComponentCrudInterface.java create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/associations/alleleAssociations/AlleleVariantAssociationDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantIngestFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantNoteFmsDTO.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/associations/alleleAssociations/AlleleVariantAssociationValidator.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleVariantAssociationDTOValidator.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java create mode 100644 src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql create mode 100644 src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java create mode 100644 src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json 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 46a0e2c44..09ac6c7d1 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -19,6 +19,7 @@ private EntityFieldConstants() { 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 VARIANT_ASSOCIATION_SUBJECT = "variantAssociationSubject"; public static final String SQTR_ASSOCIATION_SUBJECT = "sequenceTargetingReagentAssociationSubject"; public static final String TRANSCRIPT_ASSOCIATION_SUBJECT = "transcriptAssociationSubject"; @@ -30,6 +31,7 @@ private EntityFieldConstants() { 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 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; @@ -38,9 +40,10 @@ private EntityFieldConstants() { public static final String TRANSCRIPT_ASSOCIATION_SUBJECT_TAXON = TRANSCRIPT_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 + ".name"; - public static final String EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "exon" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; - public static final String TRANSCRIPT_GENOMIC_LOCATION_ASSOCIATION_OBJECT = "transcript" + GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name"; + 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 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; 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 0d458a37b..4c54350c0 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.7.0"; + public static final String LATEST_RELEASE = "2.8.0"; 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/VocabularyConstants.java b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java index b9e2e75a2..800a38c89 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/VocabularyConstants.java @@ -27,6 +27,9 @@ private VocabularyConstants() { public static final String ALLELE_RELATION_VOCABULARY = "allele_relation"; public static final String ALLELE_GENE_RELATION_VOCABULARY_TERM_SET = "allele_gene_relation"; + public static final String ALLELE_VARIANT_RELATION_VOCABULARY_TERM_SET = "allele_variant_relation"; + + public static final String LOCATION_ASSOCIATION_RELATION_VOCABULARY = "location_association_relation"; public static final String FULL_NAME_TYPE_TERM_SET = "full_name_type"; public static final String SYSTEMATIC_NAME_TYPE_TERM_SET = "systematic_name_type"; diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/AssemblyComponentCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/AssemblyComponentCrudController.java new file mode 100644 index 000000000..ae8512aff --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/AssemblyComponentCrudController.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.AssemblyComponentDAO; +import org.alliancegenome.curation_api.interfaces.crud.AssemblyComponentCrudInterface; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.AssemblyComponentService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class AssemblyComponentCrudController extends BaseEntityCrudController implements AssemblyComponentCrudInterface { + + @Inject AssemblyComponentService assemblyComponentService; + + @Override + @PostConstruct + protected void init() { + setService(assemblyComponentService); + } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return assemblyComponentService.getByIdentifier(identifierString); + } + + @Override + public ObjectResponse deleteByIdentifier(String identifierString) { + return assemblyComponentService.deleteByIdentifier(identifierString); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/VariantCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/VariantCrudController.java index 36c0ce36f..ca68a6a88 100644 --- a/src/main/java/org/alliancegenome/curation_api/controllers/crud/VariantCrudController.java +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/VariantCrudController.java @@ -6,8 +6,10 @@ import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.interfaces.crud.VariantCrudInterface; import org.alliancegenome.curation_api.jobs.executors.VariantExecutor; +import org.alliancegenome.curation_api.jobs.executors.VariantFmsExecutor; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.services.VariantService; @@ -23,6 +25,9 @@ public class VariantCrudController extends SubmittedObjectCrudController variantD return variantExecutor.runLoadApi(variantService, dataProvider, variantData); } + @Override + public APIResponse updateFmsVariants(String dataProvider, List variantData) { + return variantFmsExecutor.runLoadApi(dataProvider, variantData); + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/alleleAssociations/AlleleVariantAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/alleleAssociations/AlleleVariantAssociationDAO.java new file mode 100644 index 000000000..fc672aefb --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/alleleAssociations/AlleleVariantAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.alleleAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class AlleleVariantAssociationDAO extends BaseSQLDAO { + + protected AlleleVariantAssociationDAO() { + super(AlleleVariantAssociation.class); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/dao/associations/variantAssociations/CuratedVariantGenomicLocationAssociationDAO.java b/src/main/java/org/alliancegenome/curation_api/dao/associations/variantAssociations/CuratedVariantGenomicLocationAssociationDAO.java new file mode 100644 index 000000000..cc93da69f --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/dao/associations/variantAssociations/CuratedVariantGenomicLocationAssociationDAO.java @@ -0,0 +1,15 @@ +package org.alliancegenome.curation_api.dao.associations.variantAssociations; + +import org.alliancegenome.curation_api.dao.base.BaseSQLDAO; +import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; + +import jakarta.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class CuratedVariantGenomicLocationAssociationDAO extends BaseSQLDAO { + + protected CuratedVariantGenomicLocationAssociationDAO() { + super(CuratedVariantGenomicLocationAssociation.class); + } + +} 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 45350c869..810c28e22 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -18,6 +18,7 @@ public enum BackendBulkLoadType { ALLELE_ASSOCIATION("json"), CONSTRUCT_ASSOCIATION("json"), VARIANT("json"), + VARIATION("json"), // FMS variants as opposed to direct submission for VARIANT // GFF all from the same file but split out GFF("gff"), // For Database entries diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/AssemblyComponentCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/AssemblyComponentCrudInterface.java new file mode 100644 index 000000000..8681ec9e3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/AssemblyComponentCrudInterface.java @@ -0,0 +1,18 @@ +package org.alliancegenome.curation_api.interfaces.crud; + +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/assemblycomponent") +@Tag(name = "CRUD - AssemblyComponent") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface AssemblyComponentCrudInterface extends BaseSubmittedObjectCrudInterface { + +} diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java index b8e76f289..b6d6afbf3 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java @@ -7,6 +7,7 @@ import org.alliancegenome.curation_api.interfaces.base.BaseUpsertControllerInterface; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; @@ -38,6 +39,11 @@ public interface VariantCrudInterface extends BaseSubmittedObjectCrudInterface alleleData); + @POST + @Path("/bulk/{dataProvider}/fmsvariants") + @JsonView(View.FieldsAndLists.class) + APIResponse updateFmsVariants(@PathParam("dataProvider") String dataProvider, List alleleData); + @Override @GET @JsonView(View.VariantView.class) 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 b1c877a80..b66adeabb 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 @@ -54,7 +54,7 @@ public class BulkLoadJobExecutor { @Inject ParalogyExecutor paralogyExecutor; @Inject GeneExpressionExecutor geneExpressionExecutor; @Inject SequenceTargetingReagentExecutor sqtrExecutor; - + @Inject VariantFmsExecutor variantFmsExecutor; @Inject Gff3ExonExecutor gff3ExonExecutor; @Inject Gff3CDSExecutor gff3CDSExecutor; @Inject Gff3TranscriptExecutor gff3TranscriptExecutor; @@ -120,7 +120,8 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th resourceDescriptorExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.EXPRESSION) { geneExpressionExecutor.execLoad(bulkLoadFileHistory); - + } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.VARIATION) { + variantFmsExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON) { gff3ExonExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS) { diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java new file mode 100644 index 000000000..ce2d82972 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java @@ -0,0 +1,155 @@ +package org.alliancegenome.curation_api.jobs.executors; + +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.ObjectUpdateException; +import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; +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.model.ingest.dto.fms.VariantFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantIngestFmsDTO; +import org.alliancegenome.curation_api.response.APIResponse; +import org.alliancegenome.curation_api.response.LoadHistoryResponce; +import org.alliancegenome.curation_api.services.VariantService; +import org.alliancegenome.curation_api.services.associations.alleleAssociations.AlleleVariantAssociationService; +import org.alliancegenome.curation_api.services.associations.variantAssociations.CuratedVariantGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; +import org.alliancegenome.curation_api.services.validation.dto.fms.VariantFmsDTOValidator; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.ImmutablePair; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.inject.Inject; + +@ApplicationScoped +public class VariantFmsExecutor extends LoadFileExecutor { + + @Inject VariantService variantService; + @Inject CuratedVariantGenomicLocationAssociationService curatedVariantGenomicLocationAssociationService; + @Inject AlleleVariantAssociationService alleleVariantAssociationService; + @Inject VariantFmsDTOValidator variantFmsDtoValidator; + + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { + try { + BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); + + VariantIngestFmsDTO variantData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), VariantIngestFmsDTO.class); + bulkLoadFileHistory.getBulkLoadFile().setRecordCount(variantData.getData().size()); + + AGRCurationSchemaVersion version = CuratedVariantGenomicLocationAssociation.class.getAnnotation(AGRCurationSchemaVersion.class); + bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); + if (variantData.getMetaData() != null && StringUtils.isNotBlank(variantData.getMetaData().getRelease())) { + bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(variantData.getMetaData().getRelease()); + } + + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(fms.getFmsDataSubType()); + + List entityIdsAdded = new ArrayList<>(); + List locationIdsAdded = new ArrayList<>(); + List associationIdsAdded = new ArrayList<>(); + + bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); + + bulkLoadFileHistory.setCount(variantData.getData().size()); + updateHistory(bulkLoadFileHistory); + + boolean success = runLoad(bulkLoadFileHistory, variantData.getData(), entityIdsAdded, locationIdsAdded, associationIdsAdded, dataProvider); + if (success) { + runCleanup(variantService, bulkLoadFileHistory, dataProvider.name(), variantService.getIdsByDataProvider(dataProvider.name()), entityIdsAdded, "variant"); + runCleanup(curatedVariantGenomicLocationAssociationService, bulkLoadFileHistory, dataProvider.name(), curatedVariantGenomicLocationAssociationService.getIdsByDataProvider(dataProvider), locationIdsAdded, "curated variant genomic location association"); + runCleanup(alleleVariantAssociationService, bulkLoadFileHistory, dataProvider.name(), alleleVariantAssociationService.getAssociationsByDataProvider(dataProvider), associationIdsAdded, "allele variant association"); + } + bulkLoadFileHistory.finishLoad(); + updateHistory(bulkLoadFileHistory); + updateExceptions(bulkLoadFileHistory); + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad( + BulkLoadFileHistory history, + List data, + List entityIdsAdded, + List locationIdsAdded, + List associationIdsAdded, + BackendBulkDataProvider dataProvider) { + + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + ph.startProcess("Variant update for " + dataProvider.name(), data.size()); + + history.setCount("Entities", data.size()); + history.setCount("Locations", data.size()); + history.setCount("Associations", data.size()); + updateHistory(history); + + String countType = null; + for (VariantFmsDTO dto : data) { + countType = "Entities"; + Variant variant = null; + try { + variant = variantFmsDtoValidator.validateVariant(dto, entityIdsAdded, dataProvider); + history.incrementCompleted(countType); + } catch (ObjectUpdateException e) { + history.incrementFailed(countType); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(countType); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + countType = "Locations"; + try { + variantFmsDtoValidator.validateCuratedVariantGenomicLocationAssociation(dto, locationIdsAdded, variant); + history.incrementCompleted(countType); + } catch (ObjectUpdateException e) { + history.incrementFailed(countType); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(countType); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + countType = "Associations"; + try { + variantFmsDtoValidator.validateAlleleVariantAssociation(dto, associationIdsAdded, variant); + history.incrementCompleted(countType); + } catch (ObjectUpdateException e) { + history.incrementFailed(countType); + addException(history, e.getData()); + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(countType); + addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); + } + } + + updateHistory(history); + ph.finishProcess(); + + return true; + } + + public APIResponse runLoadApi(String dataProviderName, List gffData) { + List idsAdded = new ArrayList<>(); + BackendBulkDataProvider dataProvider = BackendBulkDataProvider.valueOf(dataProviderName); + BulkLoadFileHistory history = new BulkLoadFileHistory(); + history = bulkLoadFileHistoryDAO.persist(history); + runLoad(history, gffData, idsAdded, idsAdded, idsAdded, dataProvider); + history.finishLoad(); + + return new LoadHistoryResponce(history); + } +} 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 6033c5acc..d5d9a1bbc 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 @@ -6,6 +6,7 @@ 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.slotAnnotations.alleleSlotAnnotations.AlleleDatabaseStatusSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleFullNameSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleFunctionalImpactSlotAnnotation; @@ -52,7 +53,7 @@ @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @ToString( exclude = { - "alleleGeneAssociations", "alleleDiseaseAnnotations", "alleleMutationTypes", "alleleSymbol", "alleleFullName", "alleleSynonyms", + "alleleGeneAssociations", "alleleVariantAssociations", "alleleDiseaseAnnotations", "alleleMutationTypes", "alleleSymbol", "alleleFullName", "alleleSynonyms", "alleleSecondaryIds", "alleleInheritanceModes", "alleleFunctionalImpacts", "alleleGermlineTransmissionStatus", "alleleDatabaseStatus", "alleleNomenclatureEvents" }, @@ -191,6 +192,17 @@ public class Allele extends GenomicEntity { @JsonView({ View.FieldsAndLists.class, View.AlleleDetailView.class }) private List alleleGeneAssociations; + @IndexedEmbedded( + includePaths = { + "alleleVariantAssociationObject.curie", "alleleGeneAssociationObject.curie_keyword", + "alleleVariantAssociationObject.modEntityId", "alleleVariantAssociationObject.modEntityId_keyword", + "alleleVariantAssociationObject.modInternalId", "alleleVariantAssociationObject.modInternalId_keyword" + } + ) + @OneToMany(mappedBy = "alleleAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class, View.AlleleDetailView.class }) + private List alleleVariantAssociations; + @IndexedEmbedded(includePaths = {"freeText", "freeText_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @OneToMany(cascade = CascadeType.ALL, orphanRemoval = true) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java index ea95566ea..75297056c 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java @@ -4,6 +4,8 @@ import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; +import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.hibernate.annotations.Fetch; @@ -30,7 +32,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@ToString(exclude = { }, callSuper = true) +@ToString(exclude = { "curatedVariantGenomicLocations", "alleleVariantAssociations" }, callSuper = true) @AGRCurationSchemaVersion(min = "1.10.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { GenomicEntity.class }) @Table(indexes = { @Index(name = "variant_varianttype_index", columnList = "varianttype_id"), @@ -70,5 +72,21 @@ public class Variant extends GenomicEntity { @Index(name = "variant_note_relatednotes_index", columnList = "relatedNotes_id") }) private List relatedNotes; + + @IndexedEmbedded( + includePaths = { + "variantGenomicLocationAssociationObject.curie", "variantGenomicLocationAssociationObject.curie_keyword", + "variantGenomicLocationAssociationObject.modEntityId", "variantGenomicLocationAssociationObject.modEntityId_keyword", + "variantGenomicLocationAssociationObject.modInternalId", "variantGenomicLocationAssociationObject.modInternalId_keyword", + "start", "end" + } + ) + @OneToMany(mappedBy = "variantAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class }) + private List curatedVariantGenomicLocations; + + @OneToMany(mappedBy = "alleleVariantAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) + @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class }) + private List alleleVariantAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java index ed1f2edfd..57897898c 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleGeneAssociation.java @@ -50,7 +50,7 @@ public class AlleleGeneAssociation extends AlleleGenomicEntityAssociation { "alleleFullName.formatText_keyword", "modEntityId", "modEntityId_keyword", "modInternalId", "modInternalId_keyword" }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("alleleGeneAssociations") + @JsonIgnoreProperties({"alleleGeneAssociations", "alleleVariantAssociations"}) @Fetch(FetchMode.JOIN) private Allele alleleAssociationSubject; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java new file mode 100644 index 000000000..a70ac37c3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java @@ -0,0 +1,64 @@ +package org.alliancegenome.curation_api.model.entities.associations.alleleAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.Variant; +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.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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +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.2.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AlleleGenomicEntityAssociation.class }) +@Schema(name = "AlleleVariantAssociation", description = "POJO representing an association between an allele and a gene") + +@Table(indexes = { + @Index(name = "AlleleVariantAssociation_internal_index", columnList = "internal"), + @Index(name = "AlleleVariantAssociation_obsolete_index", columnList = "obsolete"), + @Index(name = "AlleleVariantAssociation_createdBy_index", columnList = "createdBy_id"), + @Index(name = "AlleleVariantAssociation_updatedBy_index", columnList = "updatedBy_id"), + @Index(name = "AlleleVariantAssociation_evidenceCode_index", columnList = "evidencecode_id"), + @Index(name = "AlleleVariantAssociation_relatedNote_index", columnList = "relatedNote_id"), + @Index(name = "AlleleVariantAssociation_relation_index", columnList = "relation_id"), + @Index(name = "AlleleVariantAssociation_alleleAssociationSubject_index", columnList = "alleleAssociationSubject_id"), + @Index(name = "AlleleVariantAssociation_alleleVariantAssociationObject_index", columnList = "alleleVariantAssociationObject_id") +}) + +public class AlleleVariantAssociation extends AlleleGenomicEntityAssociation { + + @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" }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties({"alleleGeneAssociations", "alleleVariantAssociations"}) + @Fetch(FetchMode.JOIN) + private Allele alleleAssociationSubject; + + @IndexedEmbedded(includePaths = { "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class, View.AlleleView.class }) + @JsonIgnoreProperties({ "alleleVariantAssociations", "constructGenomicEntityAssociations" }) + private Variant alleleVariantAssociationObject; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java index 22bb5f67e..3d3bb1330 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/codingSequenceAssociations/CodingSequenceGenomicLocationAssociation.java @@ -80,7 +80,7 @@ public class CodingSequenceGenomicLocationAssociation extends LocationAssociatio private Integer phase; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "phenotypeAnnotationObject_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @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/exonAssociations/ExonGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java index 7edd3af86..43bf25182 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/exonAssociations/ExonGenomicLocationAssociation.java @@ -71,7 +71,7 @@ public class ExonGenomicLocationAssociation extends LocationAssociation { private AssemblyComponent exonGenomicLocationAssociationObject; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "phenotypeAnnotationObject_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @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/transcriptAssociations/TranscriptGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java index ee98b6c88..6fc08ca74 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/transcriptAssociations/TranscriptGenomicLocationAssociation.java @@ -83,7 +83,7 @@ public class TranscriptGenomicLocationAssociation extends LocationAssociation { private Integer phase; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") - @KeywordField(name = "phenotypeAnnotationObject_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @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 new file mode 100644 index 000000000..6a4c098e6 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/CuratedVariantGenomicLocationAssociation.java @@ -0,0 +1,38 @@ +package org.alliancegenome.curation_api.model.entities.associations.variantAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.eclipse.microprofile.openapi.annotations.media.Schema; + +import jakarta.persistence.Entity; +import jakarta.persistence.Index; +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 = { VariantGenomicLocationAssociation.class }) +@Schema(name = "CuratedVariantGenomicLocationAssociation", description = "POJO representing an association between a variant and a curated genomic location") + +@Table(indexes = { + @Index(name = "cvgla_internal_index", columnList = "internal"), + @Index(name = "cvgla_obsolete_index", columnList = "obsolete"), + @Index(name = "cvgla_hgvs_index", columnList = "hgvs"), + @Index(name = "cvgla_createdby_index", columnList = "createdBy_id"), + @Index(name = "cvgla_updatedby_index", columnList = "updatedBy_id"), + @Index(name = "cvgla_relation_index", columnList = "relation_id"), + @Index(name = "cvgla_dnamutationtype_index", columnList = "dnaMutationType_id"), + @Index(name = "cvgla_genelocalizationtype_index", columnList = "geneLocalizationType_id"), + @Index(name = "cvgla_consequence_index", columnList = "consequence_id"), + @Index(name = "cvgla_curatedconsequence_index", columnList = "curatedConsequence_id"), + @Index(name = "cvgla_variantassociationsubject_index", columnList = "variantassociationsubject_id"), + @Index(name = "cvgla_vglaobject_index", columnList = "variantgenomiclocationassociationobject_id") +}) + +public class CuratedVariantGenomicLocationAssociation extends VariantGenomicLocationAssociation { + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java new file mode 100644 index 000000000..506299681 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java @@ -0,0 +1,97 @@ +package org.alliancegenome.curation_api.model.entities.associations.variantAssociations; + +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.Exon; +import org.alliancegenome.curation_api.model.entities.LocationAssociation; +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.annotations.Fetch; +import org.hibernate.annotations.FetchMode; +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.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.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonView; + +import jakarta.persistence.Column; +import jakarta.persistence.ManyToOne; +import jakarta.persistence.MappedSuperclass; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@MappedSuperclass +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { VariantLocationAssociation.class }) +@Schema(name = "VariantGenomicLocationAssociation", description = "POJO representing an association between a variant and a genomic location") +public abstract class VariantGenomicLocationAssociation extends VariantLocationAssociation { + + @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 variantGenomicLocationAssociationObject; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "variationStrand_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @Column(length = 1) + private String variationStrand; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @JsonView({ View.FieldsOnly.class }) + private Integer numberAdditionalDnaBasePairs; + + @GenericField(projectable = Projectable.YES, sortable = Sortable.YES) + @JsonView({ View.FieldsOnly.class }) + private Integer numberRemovedDnaBasePairs; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "paddedBase_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @Column(length = 1) + private String paddedBase; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "insertedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @Column(length = 1000) + private String insertedSequence; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "deletedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + @Column(length = 1000) + private String deletedSequence; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm dnaMutationType; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm geneLocalizationType; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java new file mode 100644 index 000000000..bd1811500 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java @@ -0,0 +1,76 @@ +package org.alliancegenome.curation_api.model.entities.associations.variantAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.model.entities.LocationAssociation; +import org.alliancegenome.curation_api.model.entities.Variant; +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.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.ManyToOne; +import jakarta.persistence.MappedSuperclass; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@MappedSuperclass +@Data +@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) +@ToString(callSuper = true) +@AGRCurationSchemaVersion(min = "2.4.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { LocationAssociation.class }) +@Schema(name = "VariantLocationAssociation", description = "POJO representing an association between a variant and a location") +public abstract class VariantLocationAssociation extends LocationAssociation { + + @IndexedEmbedded(includePaths = { + "curie", "curie_keyword", "modEntityId", "modEntityId_keyword", + "modInternalId", "modInternalId_keyword", "name", "name_keyword" + }) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + @JsonIgnoreProperties("curatedVariantGenomicLocations") + @Fetch(FetchMode.JOIN) + private Variant variantAssociationSubject; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "hgvs_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String hgvs; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "referenceSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String referenceSequence; + + @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") + @KeywordField(name = "variantSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") + @JsonView({ View.FieldsOnly.class }) + private String variantSequence; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm consequence; + + @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", + "curie_keyword", "name_keyword", "secondaryIdentifiers_keyword", "synonyms.name_keyword", "namespace_keyword" }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToOne + @JsonView({ View.FieldsOnly.class }) + private SOTerm curatedConsequence; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/IngestDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/IngestDTO.java index e745081c7..8599fd9de 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/IngestDTO.java +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/IngestDTO.java @@ -3,6 +3,7 @@ import java.util.List; import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleGeneAssociationDTO; +import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleVariantAssociationDTO; import org.alliancegenome.curation_api.model.ingest.dto.associations.constructAssociations.ConstructGenomicEntityAssociationDTO; import org.alliancegenome.curation_api.view.View; @@ -58,6 +59,10 @@ public class IngestDTO { @JsonProperty("allele_gene_association_ingest_set") private List alleleGeneAssociationIngestSet; + @JsonView({ View.FieldsAndLists.class }) + @JsonProperty("allele_variant_association_ingest_set") + private List alleleVariantAssociationIngestSet; + @JsonView({ View.FieldsAndLists.class }) @JsonProperty("construct_genomic_entity_association_ingest_set") private List constructGenomicEntityAssociationIngestSet; diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/associations/alleleAssociations/AlleleVariantAssociationDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/associations/alleleAssociations/AlleleVariantAssociationDTO.java new file mode 100644 index 000000000..b01e6332b --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/associations/alleleAssociations/AlleleVariantAssociationDTO.java @@ -0,0 +1,22 @@ +package org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations; + +import org.alliancegenome.curation_api.constants.LinkMLSchemaConstants; +import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; +import org.alliancegenome.curation_api.view.View; + +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonView; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +@AGRCurationSchemaVersion(min = "2.0.0", max = LinkMLSchemaConstants.LATEST_RELEASE, dependencies = { AlleleGenomicEntityAssociationDTO.class }, submitted = true) +public class AlleleVariantAssociationDTO extends AlleleGenomicEntityAssociationDTO { + + @JsonView({ View.FieldsOnly.class }) + @JsonProperty("variant_identifier") + private String variantIdentifier; + +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantFmsDTO.java new file mode 100644 index 000000000..3614eedd3 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantFmsDTO.java @@ -0,0 +1,26 @@ +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 VariantFmsDTO extends BaseDTO { + private String alleleId; + private String assembly; + private String chromosome; + private Integer start; + private Integer end; + private String sequenceOfReferenceAccessionNumber; + private String genomicReferenceSequence; + private String genomicVariantSequence; + private String type; + private String consequence; + private List notes; + private List references; + private List crossReferences; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantIngestFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantIngestFmsDTO.java new file mode 100644 index 000000000..008caf726 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantIngestFmsDTO.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 VariantIngestFmsDTO extends BaseDTO { + private MetaDataFmsDTO metaData; + private List data; +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantNoteFmsDTO.java b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantNoteFmsDTO.java new file mode 100644 index 000000000..34a2117bd --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/VariantNoteFmsDTO.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 VariantNoteFmsDTO extends BaseDTO { + private String note; + private List references; +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java b/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java index ac0457877..f16ff0f67 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AlleleService.java @@ -85,6 +85,7 @@ public Allele deprecateOrDelete(Long id, Boolean throwApiError, String requestSo if (forceDeprecate || alleleDAO.hasReferencingDiseaseAnnotationIds(id) || alleleDAO.hasReferencingPhenotypeAnnotations(id) || CollectionUtils.isNotEmpty(allele.getAlleleGeneAssociations()) + || CollectionUtils.isNotEmpty(allele.getAlleleVariantAssociations()) || CollectionUtils.isNotEmpty(allele.getConstructGenomicEntityAssociations())) { if (!allele.getObsolete()) { allele.setUpdatedBy(personService.fetchByUniqueIdOrCreate(requestSource)); diff --git a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java index cb9849442..23b3c397e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java @@ -2,12 +2,14 @@ import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.AssemblyComponentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.helpers.UniqueIdGeneratorHelper; @@ -78,4 +80,13 @@ private AssemblyComponent findAssemblyComponentOrCreateDB(String name, String as return assemblyComponentDAO.persist(assemblyComponent); } + public ObjectResponse deleteByIdentifier(String identifierString) { + AssemblyComponent assemblyComponent = findByAlternativeFields(List.of("modEntityId", "modInternalId"), identifierString); + if (assemblyComponent != null) { + assemblyComponentDAO.remove(assemblyComponent.getId()); + } + ObjectResponse ret = new ObjectResponse<>(assemblyComponent); + return ret; + } + } diff --git a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java index 9b720b5fe..b0d0dab68 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java @@ -11,13 +11,14 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; import org.alliancegenome.curation_api.exceptions.ValidationException; -import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; import org.alliancegenome.curation_api.services.validation.VariantValidator; import org.alliancegenome.curation_api.services.validation.dto.VariantDTOValidator; +import org.apache.commons.collections.CollectionUtils; import io.quarkus.logging.Log; import jakarta.annotation.PostConstruct; @@ -64,7 +65,8 @@ public Variant upsert(VariantDTO dto, BackendBulkDataProvider dataProvider) thro public Variant deprecateOrDelete(Long id, Boolean throwApiError, String requestSource, Boolean forceDeprecate) { Variant variant = variantDAO.find(id); if (variant != null) { - if (forceDeprecate || variantDAO.hasReferencingDiseaseAnnotationIds(id)) { + if (forceDeprecate || variantDAO.hasReferencingDiseaseAnnotationIds(id) + || CollectionUtils.isNotEmpty(variant.getAlleleVariantAssociations())) { if (!variant.getObsolete()) { variant.setUpdatedBy(personService.fetchByUniqueIdOrCreate(requestSource)); variant.setDateUpdated(OffsetDateTime.now()); @@ -79,7 +81,7 @@ public Variant deprecateOrDelete(Long id, Boolean throwApiError, String requestS } else { String errorMessage = "Could not find Variant with id: " + id; if (throwApiError) { - ObjectResponse response = new ObjectResponse<>(); + ObjectResponse response = new ObjectResponse<>(); response.addErrorMessage("id", errorMessage); throw new ApiErrorException(response); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java new file mode 100644 index 000000000..adf650992 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java @@ -0,0 +1,175 @@ +package org.alliancegenome.curation_api.services.associations.alleleAssociations; + +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.AlleleDAO; +import org.alliancegenome.curation_api.dao.GeneDAO; +import org.alliancegenome.curation_api.dao.NoteDAO; +import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.associations.alleleAssociations.AlleleVariantAssociationValidator; +import org.alliancegenome.curation_api.services.validation.dto.associations.alleleAssociations.AlleleVariantAssociationDTOValidator; + +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 AlleleVariantAssociationService extends BaseEntityCrudService { + + @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; + @Inject AlleleVariantAssociationValidator alleleVariantAssociationValidator; + @Inject AlleleVariantAssociationDTOValidator alleleVariantAssociationDtoValidator; + @Inject AlleleDAO alleleDAO; + @Inject NoteDAO noteDAO; + @Inject GeneDAO geneDAO; + @Inject PersonService personService; + @Inject PersonDAO personDAO; + + @Override + @PostConstruct + protected void init() { + setSQLDao(alleleVariantAssociationDAO); + } + + @Transactional + public ObjectResponse upsert(AlleleVariantAssociation uiEntity) { + AlleleVariantAssociation dbEntity = alleleVariantAssociationValidator.validateAlleleVariantAssociation(uiEntity, true, true); + if (dbEntity == null) { + return null; + } + dbEntity = alleleVariantAssociationDAO.persist(dbEntity); + addAssociationToAllele(dbEntity); + addAssociationToVariant(dbEntity); + return new ObjectResponse(dbEntity); + } + + public ObjectResponse validate(AlleleVariantAssociation uiEntity) { + AlleleVariantAssociation aga = alleleVariantAssociationValidator.validateAlleleVariantAssociation(uiEntity, true, false); + return new ObjectResponse(aga); + } + + public List getAssociationsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.ALLELE_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + List associationIds = alleleVariantAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public AlleleVariantAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + AlleleVariantAssociation association = alleleVariantAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find AlleleVariantAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return alleleVariantAssociationDAO.persist(association); + } + return association; + } + + Long noteId = null; + if (association.getRelatedNote() != null) { + noteId = association.getRelatedNote().getId(); + } + alleleVariantAssociationDAO.remove(association.getId()); + if (noteId != null) { + noteDAO.remove(noteId); + } + + return null; + } + + public ObjectResponse getAssociation(Long alleleId, String relationName, Long geneId) { + AlleleVariantAssociation association = null; + + Map params = new HashMap<>(); + params.put("alleleAssociationSubject.id", alleleId); + params.put("relation.name", relationName); + params.put("alleleVariantAssociationObject.id", geneId); + + SearchResponse resp = alleleVariantAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + + public void addAssociationToAllele(AlleleVariantAssociation association) { + Allele allele = association.getAlleleAssociationSubject(); + List currentAssociations = allele.getAlleleVariantAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + allele.setAlleleVariantAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (AlleleVariantAssociation aga : currentAssociations) { + currentAssociationIds.add(aga.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + } + + public void addAssociationToVariant(AlleleVariantAssociation association) { + Variant variant = association.getAlleleVariantAssociationObject(); + List currentAssociations = variant.getAlleleVariantAssociations(); + if (currentAssociations == null) { + currentAssociations = new ArrayList<>(); + variant.setAlleleVariantAssociations(currentAssociations); + } + + List currentAssociationIds = new ArrayList<>(); + for (AlleleVariantAssociation ava : currentAssociations) { + currentAssociationIds.add(ava.getId()); + } + + if (!currentAssociationIds.contains(association.getId())) { + currentAssociations.add(association); + } + + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java new file mode 100644 index 000000000..f7db87280 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java @@ -0,0 +1,126 @@ +package org.alliancegenome.curation_api.services.associations.variantAssociations; + +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 org.alliancegenome.curation_api.constants.EntityFieldConstants; +import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.associations.variantAssociations.CuratedVariantGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; +import org.alliancegenome.curation_api.services.validation.dto.fms.VariantFmsDTOValidator; +import org.apache.commons.lang.StringUtils; + +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 CuratedVariantGenomicLocationAssociationService extends BaseEntityCrudService { + + @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; + @Inject VariantFmsDTOValidator variantFmsDtoValidator; + @Inject PersonDAO personDAO; + @Inject PersonService personService; + + @Override + @PostConstruct + protected void init() { + setSQLDao(curatedVariantGenomicLocationAssociationDAO); + } + + + public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { + Map params = new HashMap<>(); + params.put(EntityFieldConstants.VARIANT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); + if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { + params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + } + List associationIds = curatedVariantGenomicLocationAssociationDAO.findIdsByParams(params); + associationIds.removeIf(Objects::isNull); + + return associationIds; + } + + @Override + @Transactional + public CuratedVariantGenomicLocationAssociation deprecateOrDelete(Long id, Boolean throwApiError, String loadDescription, Boolean deprecate) { + CuratedVariantGenomicLocationAssociation association = curatedVariantGenomicLocationAssociationDAO.find(id); + + if (association == null) { + String errorMessage = "Could not find CuratedVariantGenomicLocationAssociation with id: " + id; + if (throwApiError) { + ObjectResponse response = new ObjectResponse<>(); + response.addErrorMessage("id", errorMessage); + throw new ApiErrorException(response); + } + log.error(errorMessage); + return null; + } + if (deprecate) { + if (!association.getObsolete()) { + association.setObsolete(true); + if (authenticatedPerson.getId() != null) { + association.setUpdatedBy(personDAO.find(authenticatedPerson.getId())); + } else { + association.setUpdatedBy(personService.fetchByUniqueIdOrCreate(loadDescription)); + } + association.setDateUpdated(OffsetDateTime.now()); + return curatedVariantGenomicLocationAssociationDAO.persist(association); + } + return association; + } + + curatedVariantGenomicLocationAssociationDAO.remove(association.getId()); + + return null; + } + + public ObjectResponse getLocationAssociation(Long exonId, Long assemblyComponentId) { + CuratedVariantGenomicLocationAssociation association = null; + + Map params = new HashMap<>(); + params.put(EntityFieldConstants.VARIANT_ASSOCIATION_SUBJECT + ".id", exonId); + params.put(EntityFieldConstants.VARIANT_GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".id", assemblyComponentId); + + SearchResponse resp = curatedVariantGenomicLocationAssociationDAO.findByParams(params); + if (resp != null && resp.getSingleResult() != null) { + association = resp.getSingleResult(); + } + + ObjectResponse response = new ObjectResponse<>(); + response.setEntity(association); + + return response; + } + + public void addAssociationToSubject(CuratedVariantGenomicLocationAssociation association) { + Variant variant = association.getVariantAssociationSubject(); + + List currentSubjectAssociations = variant.getCuratedVariantGenomicLocations(); + if (currentSubjectAssociations == null) { + currentSubjectAssociations = new ArrayList<>(); + } + + List currentSubjectAssociationIds = currentSubjectAssociations.stream() + .map(CuratedVariantGenomicLocationAssociation::getId).collect(Collectors.toList()); + + if (!currentSubjectAssociationIds.contains(association.getId())) { + currentSubjectAssociations.add(association); + } + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java new file mode 100644 index 000000000..426221ad5 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java @@ -0,0 +1,59 @@ +package org.alliancegenome.curation_api.services.helpers.variants; + +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; +import org.apache.commons.lang3.StringUtils; + +public abstract class HgvsIdentifierHelper { + + public static String getHgvsIdentifier(VariantFmsDTO dto) { + String start = ""; + if (dto.getStart() != null) { + start = Integer.toString(dto.getStart()); + } + + String end = ""; + if (dto.getEnd() != null) { + end = Integer.toString(dto.getEnd()); + } + + String varSeq = StringUtils.isBlank(dto.getGenomicVariantSequence()) ? "" : dto.getGenomicVariantSequence(); + String refSeq = StringUtils.isBlank(dto.getGenomicReferenceSequence()) ? "" : dto.getGenomicReferenceSequence(); + + String chrAccession = ""; + if (StringUtils.isNotBlank(dto.getSequenceOfReferenceAccessionNumber())) { + String[] accessionParts = dto.getSequenceOfReferenceAccessionNumber().split(":"); + if (accessionParts.length == 2) { + chrAccession = accessionParts[1]; + } else { + chrAccession = dto.getSequenceOfReferenceAccessionNumber(); + } + } + + String hgvs = chrAccession + ":g." + start; + switch(dto.getType()) { + case "SO:1000002": // point mutation + hgvs = hgvs + refSeq + ">" + varSeq; + break; + case "SO:1000008": // substitution + hgvs = hgvs + refSeq + ">" + varSeq; + break; + case "SO:0000667": // insertion + hgvs = hgvs + "_" + end + "ins" + varSeq; + break; + case "SO:0000159": // deletion + hgvs = hgvs + "_" + end + "del"; + break; + case "SO:0002007": // MNV + hgvs = hgvs + "_" + end + "delins" + varSeq; + break; + case "SO:1000032": // delin + hgvs = hgvs + "_" + end + "delins" + varSeq; + break; + default: + hgvs = null; + } + + return hgvs; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/associations/alleleAssociations/AlleleVariantAssociationValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/alleleAssociations/AlleleVariantAssociationValidator.java new file mode 100644 index 000000000..541fe5bb8 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/associations/alleleAssociations/AlleleVariantAssociationValidator.java @@ -0,0 +1,146 @@ +package org.alliancegenome.curation_api.services.validation.associations.alleleAssociations; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.VariantDAO; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; +import org.alliancegenome.curation_api.exceptions.ApiErrorException; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.apache.commons.lang3.ObjectUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class AlleleVariantAssociationValidator extends AlleleGenomicEntityAssociationValidator { + + @Inject VariantDAO variantDAO; + @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; + @Inject VocabularyTermService vocabularyTermService; + + private String errorMessage; + + public ObjectResponse validateAlleleVariantAssociation(AlleleVariantAssociation uiEntity) { + AlleleVariantAssociation variantAssociation = validateAlleleVariantAssociation(uiEntity, false, false); + response.setEntity(variantAssociation); + return response; + } + + public AlleleVariantAssociation validateAlleleVariantAssociation(AlleleVariantAssociation uiEntity, Boolean throwError, Boolean validateAllele) { + response = new ObjectResponse<>(uiEntity); + errorMessage = "Could not create/update Allele Variant Association: [" + uiEntity.getId() + "]"; + + Long id = uiEntity.getId(); + AlleleVariantAssociation dbEntity = null; + if (id != null) { + dbEntity = alleleVariantAssociationDAO.find(id); + if (dbEntity == null) { + addMessageResponse("Could not find Allele Variant Association with ID: [" + id + "]"); + throw new ApiErrorException(response); + } + } else { + dbEntity = new AlleleVariantAssociation(); + } + + dbEntity = (AlleleVariantAssociation) validateAlleleGenomicEntityAssociationFields(uiEntity, dbEntity); + + if (validateAllele) { + Allele subject = validateSubject(uiEntity, dbEntity); + dbEntity.setAlleleAssociationSubject(subject); + } + + Variant object = validateObject(uiEntity, dbEntity); + dbEntity.setAlleleVariantAssociationObject(object); + + VocabularyTerm relation = validateRelation(uiEntity, dbEntity); + dbEntity.setRelation(relation); + + if (response.hasErrors()) { + if (throwError) { + response.setErrorMessage(errorMessage); + throw new ApiErrorException(response); + } else { + return null; + } + } + + return dbEntity; + } + + private Allele validateSubject(AlleleVariantAssociation uiEntity, AlleleVariantAssociation dbEntity) { + String field = "alleleAssociationSubject"; + if (ObjectUtils.isEmpty(uiEntity.getAlleleAssociationSubject())) { + addMessageResponse(field, ValidationConstants.REQUIRED_MESSAGE); + return null; + } + + Allele subjectEntity = null; + if (uiEntity.getAlleleAssociationSubject().getId() != null) { + subjectEntity = alleleDAO.find(uiEntity.getAlleleAssociationSubject().getId()); + } + if (subjectEntity == null) { + addMessageResponse(field, ValidationConstants.INVALID_MESSAGE); + return null; + } + + if (subjectEntity.getObsolete() && (dbEntity.getAlleleAssociationSubject() == null || !subjectEntity.getId().equals(dbEntity.getAlleleAssociationSubject().getId()))) { + addMessageResponse(field, ValidationConstants.OBSOLETE_MESSAGE); + return null; + } + + return subjectEntity; + + } + + private Variant validateObject(AlleleVariantAssociation uiEntity, AlleleVariantAssociation dbEntity) { + String field = "alleleVariantAssociationObject"; + if (ObjectUtils.isEmpty(uiEntity.getAlleleVariantAssociationObject())) { + addMessageResponse(field, ValidationConstants.REQUIRED_MESSAGE); + return null; + } + + Variant objectEntity = null; + if (uiEntity.getAlleleVariantAssociationObject().getId() != null) { + objectEntity = variantDAO.find(uiEntity.getAlleleVariantAssociationObject().getId()); + } + if (objectEntity == null) { + addMessageResponse(field, ValidationConstants.INVALID_MESSAGE); + return null; + } + + if (objectEntity.getObsolete() && (dbEntity.getAlleleVariantAssociationObject() == null || !objectEntity.getId().equals(dbEntity.getAlleleVariantAssociationObject().getId()))) { + addMessageResponse(field, ValidationConstants.OBSOLETE_MESSAGE); + return null; + } + + return objectEntity; + + } + + private VocabularyTerm validateRelation(AlleleVariantAssociation uiEntity, AlleleVariantAssociation dbEntity) { + String field = "relation"; + if (uiEntity.getRelation() == null) { + addMessageResponse(field, ValidationConstants.REQUIRED_MESSAGE); + return null; + } + + VocabularyTerm relation = vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ALLELE_VARIANT_RELATION_VOCABULARY_TERM_SET, uiEntity.getRelation().getName()).getEntity(); + + if (relation == null) { + addMessageResponse(field, ValidationConstants.INVALID_MESSAGE); + return null; + } + + if (relation.getObsolete() && (dbEntity.getRelation() == null || !relation.getName().equals(dbEntity.getRelation().getName()))) { + addMessageResponse(field, ValidationConstants.OBSOLETE_MESSAGE); + return null; + } + + return relation; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java index 1c7584c20..430cec249 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/Gff3DtoValidator.java @@ -200,7 +200,7 @@ public CodingSequenceGenomicLocationAssociation validateCdsLocation(Gff3DTO gffE assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assemblyId, dataProvider.canonicalTaxonCurie, dataProvider); Map params = new HashMap<>(); params.put(EntityFieldConstants.CODING_SEQUENCE_ASSOCIATION_SUBJECT + ".id", cds.getId()); - params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); + params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name", assemblyComponent.getName()); params.put(EntityFieldConstants.CODING_SEQUENCE_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assemblyId); SearchResponse locationSearchResponse = cdsLocationDAO.findByParams(params); if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { @@ -228,7 +228,7 @@ public ExonGenomicLocationAssociation validateExonLocation(Gff3DTO gffEntry, Exo assemblyComponent = assemblyComponentService.fetchOrCreate(gffEntry.getSeqId(), assemblyId, dataProvider.canonicalTaxonCurie, dataProvider); Map params = new HashMap<>(); params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT + ".id", exon.getId()); - params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT, assemblyComponent.getName()); + params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT + ".name", assemblyComponent.getName()); params.put(EntityFieldConstants.EXON_GENOMIC_LOCATION_ASSOCIATION_OBJECT_ASSEMBLY, assemblyId); SearchResponse locationSearchResponse = exonLocationDAO.findByParams(params); if (locationSearchResponse != null && locationSearchResponse.getSingleResult() != null) { @@ -381,7 +381,7 @@ public TranscriptExonAssociation validateTranscriptExonAssociation(Gff3DTO gffEn private ObjectResponse validateLocationAssociation(E association, Gff3DTO dto, AssemblyComponent assemblyComponent) { ObjectResponse associationResponse = new ObjectResponse(); - association.setRelation(vocabularyTermService.getTermInVocabulary("location_association_relation", "located_on").getEntity()); + association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.LOCATION_ASSOCIATION_RELATION_VOCABULARY, "located_on").getEntity()); if (assemblyComponent == null) { associationResponse.addErrorMessage("SeqId", ValidationConstants.REQUIRED_MESSAGE); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java index 134bbc2ea..e92a91372 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Objects; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; @@ -15,10 +16,12 @@ import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.notes.NoteIdentityHelper; +import org.alliancegenome.curation_api.services.helpers.variants.HgvsIdentifierHelper; import org.alliancegenome.curation_api.services.ontology.SoTermService; import org.alliancegenome.curation_api.services.validation.dto.base.BaseDTOValidator; import org.apache.commons.collections.CollectionUtils; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleVariantAssociationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleVariantAssociationDTOValidator.java new file mode 100644 index 000000000..48728f2fe --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/associations/alleleAssociations/AlleleVariantAssociationDTOValidator.java @@ -0,0 +1,123 @@ +package org.alliancegenome.curation_api.services.validation.dto.associations.alleleAssociations; + +import java.util.HashMap; +import java.util.List; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleGenomicEntityAssociation; +import org.alliancegenome.curation_api.model.ingest.dto.associations.alleleAssociations.AlleleVariantAssociationDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.AlleleService; +import org.alliancegenome.curation_api.services.VariantService; +import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class AlleleVariantAssociationDTOValidator extends AlleleGenomicEntityAssociationDTOValidator { + + @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; + @Inject AlleleService alleleService; + @Inject VariantService variantService; + @Inject VocabularyTermService vocabularyTermService; + + public AlleleVariantAssociation validateAlleleVariantAssociationDTO(AlleleVariantAssociationDTO dto, BackendBulkDataProvider beDataProvider) throws ValidationException { + ObjectResponse agaResponse = new ObjectResponse(); + + List subjectIds = null; + if (StringUtils.isBlank(dto.getAlleleIdentifier())) { + agaResponse.addErrorMessage("allele_identifier", ValidationConstants.REQUIRED_MESSAGE); + } else { + subjectIds = alleleService.findIdsByIdentifierString(dto.getAlleleIdentifier()); + if (subjectIds == null || subjectIds.size() != 1) { + agaResponse.addErrorMessage("allele_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAlleleIdentifier() + ")"); + } + } + + List objectIds = null; + if (StringUtils.isBlank(dto.getVariantIdentifier())) { + agaResponse.addErrorMessage("variant_identifier", ValidationConstants.REQUIRED_MESSAGE); + } else { + objectIds = variantService.findIdsByIdentifierString(dto.getVariantIdentifier()); + if (objectIds == null || objectIds.size() != 1) { + agaResponse.addErrorMessage("variant_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getVariantIdentifier() + ")"); + } + } + + AlleleVariantAssociation association = null; + if (subjectIds != null && subjectIds.size() == 1 && objectIds != null || objectIds.size() == 1 && StringUtils.isNotBlank(dto.getRelationName())) { + HashMap params = new HashMap<>(); + + params.put("alleleAssociationSubject.id", subjectIds.get(0)); + params.put("relation.name", dto.getRelationName()); + params.put("alleleVariantAssociationObject.id", objectIds.get(0)); + + SearchResponse searchResponse = alleleVariantAssociationDAO.findByParams(params); + if (searchResponse != null && searchResponse.getResults().size() == 1) { + association = searchResponse.getSingleResult(); + } + } + + if (association == null) { + association = new AlleleVariantAssociation(); + } + + VocabularyTerm relation = null; + if (StringUtils.isNotEmpty(dto.getRelationName())) { + relation = vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ALLELE_VARIANT_RELATION_VOCABULARY_TERM_SET, dto.getRelationName()).getEntity(); + if (relation == null) { + agaResponse.addErrorMessage("relation_name", ValidationConstants.INVALID_MESSAGE + " (" + dto.getRelationName() + ")"); + } + } else { + agaResponse.addErrorMessage("relation_name", ValidationConstants.REQUIRED_MESSAGE); + } + association.setRelation(relation); + + if (association.getAlleleAssociationSubject() == null && !StringUtils.isBlank(dto.getAlleleIdentifier())) { + + Allele subject = alleleService.findByIdentifierString(dto.getAlleleIdentifier()); + if (subject == null) { + agaResponse.addErrorMessage("allele_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAlleleIdentifier() + ")"); + } else if (beDataProvider != null && !subject.getDataProvider().getSourceOrganization().getAbbreviation().equals(beDataProvider.sourceOrganization)) { + agaResponse.addErrorMessage("allele_identifier", ValidationConstants.INVALID_MESSAGE + " for " + beDataProvider.name() + " load (" + dto.getAlleleIdentifier() + ")"); + } else { + association.setAlleleAssociationSubject(subject); + } + } + + if (association.getAlleleVariantAssociationObject() == null && !StringUtils.isBlank(dto.getVariantIdentifier())) { + + Variant object = variantService.findByIdentifierString(dto.getVariantIdentifier()); + if (object == null) { + agaResponse.addErrorMessage("variant_identifier", ValidationConstants.INVALID_MESSAGE + " (" + dto.getVariantIdentifier() + ")"); + } else if (beDataProvider != null && !object.getDataProvider().getSourceOrganization().getAbbreviation().equals(beDataProvider.sourceOrganization)) { + agaResponse.addErrorMessage("variant_identifier", ValidationConstants.INVALID_MESSAGE + " for " + beDataProvider.name() + " load (" + dto.getVariantIdentifier() + ")"); + } else { + association.setAlleleVariantAssociationObject(object); + } + } + + ObjectResponse ageaResponse = validateAlleleGenomicEntityAssociationDTO(association, dto); + agaResponse.addErrorMessages(ageaResponse.getErrorMessages()); + association = (AlleleVariantAssociation) ageaResponse.getEntity(); + + if (agaResponse.hasErrors()) { + throw new ObjectValidationException(dto, agaResponse.errorMessagesString()); + } + + association = alleleVariantAssociationDAO.persist(association); + return association; + } +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java new file mode 100644 index 000000000..c11fc2d2f --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -0,0 +1,230 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import java.util.List; +import java.util.Objects; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.VariantDAO; +import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; +import org.alliancegenome.curation_api.dao.associations.variantAssociations.CuratedVariantGenomicLocationAssociationDAO; +import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.exceptions.ObjectValidationException; +import org.alliancegenome.curation_api.exceptions.ValidationException; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; +import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; +import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.response.SearchResponse; +import org.alliancegenome.curation_api.services.AlleleService; +import org.alliancegenome.curation_api.services.AssemblyComponentService; +import org.alliancegenome.curation_api.services.DataProviderService; +import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.alliancegenome.curation_api.services.VocabularyTermSetService; +import org.alliancegenome.curation_api.services.associations.alleleAssociations.AlleleVariantAssociationService; +import org.alliancegenome.curation_api.services.associations.variantAssociations.CuratedVariantGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.variants.HgvsIdentifierHelper; +import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; +import org.alliancegenome.curation_api.services.ontology.SoTermService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; +import jakarta.transaction.Transactional; + +@RequestScoped +public class VariantFmsDTOValidator { + + @Inject VariantDAO variantDAO; + @Inject AlleleService alleleService; + @Inject AssemblyComponentService assemblyComponentService; + @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; + CuratedVariantGenomicLocationAssociationService curatedVariantGenomicLocationAssociationService; + @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; + @Inject AlleleVariantAssociationService alleleVariantAssociationService; + @Inject SoTermService soTermService; + @Inject DataProviderService dataProviderService; + @Inject NcbiTaxonTermService ncbiTaxonTermService; + @Inject VocabularyTermService vocabularyTermService; + @Inject VocabularyTermSetService vocabularyTermSetService; + + @Transactional + public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { + + ObjectResponse variantResponse = new ObjectResponse(); + Variant variant = new Variant(); + + if (dto.getStart() == null) { + variantResponse.addErrorMessage("start", ValidationConstants.REQUIRED_MESSAGE); + } + + if (dto.getEnd() == null) { + variantResponse.addErrorMessage("end", ValidationConstants.REQUIRED_MESSAGE); + } + + if (StringUtils.isBlank(dto.getSequenceOfReferenceAccessionNumber())) { + variantResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.REQUIRED_MESSAGE); + } + + SOTerm soTerm = null; + if (StringUtils.isBlank(dto.getType())) { + variantResponse.addErrorMessage("type", ValidationConstants.REQUIRED_MESSAGE); + } else if (Objects.equals(dto.getType(), "SO:1000002") || Objects.equals(dto.getType(), "SO:1000008") || + Objects.equals(dto.getType(), "SO:0000667") || Objects.equals(dto.getType(), "SO:0000159") || + Objects.equals(dto.getType(), "SO:0002007") || Objects.equals(dto.getType(), "SO:1000032")) { + soTerm = soTermService.findByCurieOrSecondaryId(dto.getType()); + if (soTerm == null) { + variantResponse.addErrorMessage("type", ValidationConstants.INVALID_MESSAGE + " (" + dto.getType() + ")"); + } else { + if (StringUtils.isBlank(dto.getGenomicReferenceSequence()) && !Objects.equals(dto.getType(), "SO:0000159") + && !Objects.equals(dto.getType(), "SO:1000032")) { + variantResponse.addErrorMessage("genomicReferenceSequence", ValidationConstants.REQUIRED_MESSAGE + " for variant type " + dto.getType()); + } + if (StringUtils.isBlank(dto.getGenomicVariantSequence()) && !Objects.equals(dto.getType(), "SO:0000667") + && !Objects.equals(dto.getType(), "SO:1000032")) { + variantResponse.addErrorMessage("genomicReferenceSequence", ValidationConstants.REQUIRED_MESSAGE + " for variant type " + dto.getType()); + } + } + } else { + variantResponse.addErrorMessage("type", ValidationConstants.INVALID_MESSAGE + " for FMS submissions (" + dto.getType() + ")"); + } + + String hgvs = HgvsIdentifierHelper.getHgvsIdentifier(dto); + String modInternalId = "var_" + hgvs; + + if (StringUtils.isNotBlank(hgvs) && !variantResponse.hasErrors()) { + SearchResponse searchResponse = variantDAO.findByField("modInternalId", modInternalId); + if (searchResponse != null && searchResponse.getSingleResult() != null) { + variant = searchResponse.getSingleResult(); + } + } + + variant.setModInternalId(modInternalId); + variant.setVariantType(soTerm); + variant.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.name())); + variant.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + + + if (variantResponse.hasErrors()) { + variantResponse.convertErrorMessagesToMap(); + throw new ObjectValidationException(dto, variantResponse.errorMessagesString()); + } + + variant = variantDAO.persist(variant); + if (variant != null) { + idsAdded.add(variant.getId()); + } + + return variant; + } + + @Transactional + public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, List idsAdded, Variant variant) throws ValidationException { + + CuratedVariantGenomicLocationAssociation association = new CuratedVariantGenomicLocationAssociation(); + ObjectResponse cvglaResponse = new ObjectResponse(); + AssemblyComponent chromosome = null; + + + if (dto.getStart() == null) { + cvglaResponse.addErrorMessage("start", ValidationConstants.REQUIRED_MESSAGE); + } + + if (dto.getEnd() == null) { + cvglaResponse.addErrorMessage("end", ValidationConstants.REQUIRED_MESSAGE); + } + + if (StringUtils.isBlank(dto.getSequenceOfReferenceAccessionNumber())) { + cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.REQUIRED_MESSAGE); + } else { + chromosome = assemblyComponentService.getByIdentifier(dto.getSequenceOfReferenceAccessionNumber()).getEntity(); + if (chromosome == null) { + cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.INVALID_MESSAGE + " (" + + dto.getSequenceOfReferenceAccessionNumber() + ")"); + } + } + + String hgvs = HgvsIdentifierHelper.getHgvsIdentifier(dto); + + if (StringUtils.isNotBlank(hgvs) && !cvglaResponse.hasErrors() && CollectionUtils.isNotEmpty(variant.getCuratedVariantGenomicLocations())) { + for (CuratedVariantGenomicLocationAssociation existingLocationAssociation : variant.getCuratedVariantGenomicLocations()) { + if (Objects.equals(hgvs, existingLocationAssociation.getHgvs())) { + association = existingLocationAssociation; + break; + } + } + } + + association.setHgvs(hgvs); + association.setVariantAssociationSubject(variant); + association.setVariantGenomicLocationAssociationObject(chromosome); + association.setStart(dto.getStart()); + association.setEnd(dto.getEnd()); + association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.LOCATION_ASSOCIATION_RELATION_VOCABULARY, "located_on").getEntity()); + if (StringUtils.isNotBlank(dto.getGenomicReferenceSequence())) { + association.setReferenceSequence(dto.getGenomicReferenceSequence()); + } + if (StringUtils.isNotBlank(dto.getGenomicVariantSequence())) { + association.setVariantSequence(dto.getGenomicVariantSequence()); + } + + if (cvglaResponse.hasErrors()) { + throw new ObjectValidationException(dto, cvglaResponse.errorMessagesString()); + } + + association = curatedVariantGenomicLocationAssociationDAO.persist(association); + if (association != null) { + idsAdded.add(association.getId()); + curatedVariantGenomicLocationAssociationService.addAssociationToSubject(association); + } + + } + + @Transactional + public void validateAlleleVariantAssociation(VariantFmsDTO dto, List idsAdded, Variant variant) throws ValidationException { + + AlleleVariantAssociation association = new AlleleVariantAssociation(); + ObjectResponse avaResponse = new ObjectResponse(); + + if (variant == null) { + avaResponse.addErrorMessage("variant", ValidationConstants.INVALID_MESSAGE); + } + if (StringUtils.isBlank(dto.getAlleleId())) { + avaResponse.addErrorMessage("alleleId", ValidationConstants.REQUIRED_MESSAGE); + } else { + if (CollectionUtils.isNotEmpty(variant.getAlleleVariantAssociations())) { + for (AlleleVariantAssociation existingAssociation : variant.getAlleleVariantAssociations()) { + if (Objects.equals(dto.getAlleleId(), existingAssociation.getAlleleAssociationSubject().getModEntityId())) { + association = existingAssociation; + break; + } + } + } + + if (association.getId() == null) { + Allele allele = alleleService.findByIdentifierString(dto.getAlleleId()); + if (allele == null) { + avaResponse.addErrorMessage("alleleId", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAlleleId() + ")"); + } else { + association.setAlleleAssociationSubject(allele); + } + } + } + + association.setAlleleVariantAssociationObject(variant); + association.setRelation(vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ALLELE_VARIANT_RELATION_VOCABULARY_TERM_SET, "has_variant").getEntity()); + + + association = alleleVariantAssociationDAO.persist(association); + if (association != null) { + idsAdded.add(association.getId()); + alleleVariantAssociationService.addAssociationToAllele(association); + alleleVariantAssociationService.addAssociationToVariant(association); + } + } +} diff --git a/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql new file mode 100644 index 000000000..001b95b99 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql @@ -0,0 +1,144 @@ +CREATE TABLE curatedvariantgenomiclocationassociation ( + id bigint PRIMARY KEY, + 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, + "end" integer, + start integer, + phase integer, + variationstrand character varying(1), + hgvs character varying(255), + paddedbase character varying(1), + insertedsequence character varying(1000), + deletedsequence character varying(1000), + numberadditionaldnabasepairs integer, + numberremoveddnabasepairs integer, + createdby_id bigint, + updatedby_id bigint, + relation_id bigint, + variantassociationsubject_id bigint, + variantgenomiclocationassociationobject_id bigint, + dnamutationtype_id bigint, + genelocalizationtype_id bigint, + consequence_id bigint, + curatedconsequence_id bigint, + referencesequence character varying(1000), + variantsequence character varying(1000) +); + +CREATE TABLE CuratedVariantGenomicLocationAssociation_InformationContentEntity ( + association_id bigint NOT NULL, + evidence_id bigint NOT NULL +); + +CREATE SEQUENCE curatedvariantgenomiclocationassociation_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +CREATE INDEX cvgla_internal_index ON curatedvariantgenomiclocationassociation USING btree (internal); +CREATE INDEX cvgla_obsolete_index ON curatedvariantgenomiclocationassociation USING btree (obsolete); +CREATE INDEX cvgla_hgvs_index ON curatedvariantgenomiclocationassociation USING btree (hgvs); +CREATE INDEX cvgla_createdby_index ON curatedvariantgenomiclocationassociation USING btree (createdby_id); +CREATE INDEX cvgla_updatedby_index ON curatedvariantgenomiclocationassociation USING btree (updatedby_id); +CREATE INDEX cvgla_relation_index ON curatedvariantgenomiclocationassociation USING btree (relation_id); +CREATE INDEX cvgla_consequence_index ON curatedvariantgenomiclocationassociation USING btree (consequence_id); +CREATE INDEX cvgla_curatedconsequence_index ON curatedvariantgenomiclocationassociation USING btree (curatedconsequence_id); +CREATE INDEX cvgla_dnamutationtype_index ON curatedvariantgenomiclocationassociation USING btree (dnamutationtype_id); +CREATE INDEX cvgla_genelocalizationtype_index ON curatedvariantgenomiclocationassociation USING btree (genelocalizationtype_id); +CREATE INDEX cvgla_variantassociationsubject_index ON curatedvariantgenomiclocationassociation USING btree (variantassociationsubject_id); +CREATE INDEX cvgla_vglaobject_index ON curatedvariantgenomiclocationassociation USING btree (variantgenomiclocationassociationobject_id); + +CREATE INDEX idxf6ue9897y96ts14v3cxil0rr3 ON curatedvariantgenomiclocationassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxf71i1k78crgfhf7pnaewvc1ia ON curatedvariantgenomiclocationassociation_informationcontententity USING btree (evidence_id); + +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_variantassociationsubject_id_fk FOREIGN KEY (variantassociationsubject_id) REFERENCES variant(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_variantgenomiclocationassociationobject_id_fk FOREIGN KEY (variantgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_dnamutationtype_id_fk FOREIGN KEY (dnamutationtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_genelocalizationtype_id_fk FOREIGN KEY (genelocalizationtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_curatedconsequence_id_fk FOREIGN KEY (curatedconsequence_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_consequence_id_fk FOREIGN KEY (consequence_id) REFERENCES ontologyterm(id); + + +ALTER TABLE ONLY curatedvariantgenomiclocationassociation_informationcontententity ADD CONSTRAINT cvgla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES curatedvariantgenomiclocationassociation(id); +ALTER TABLE ONLY curatedvariantgenomiclocationassociation_informationcontententity ADD CONSTRAINT cvgla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +CREATE TABLE allelevariantassociation ( + id bigint PRIMARY KEY, + 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, + createdby_id bigint, + updatedby_id bigint, + alleleassociationsubject_id bigint, + allelevariantassociationobject_id bigint, + relation_id bigint, + evidencecode_id bigint, + relatednote_id bigint +); + +CREATE TABLE allelevariantassociation_informationcontententity ( + association_id bigint NOT NULL, + evidence_id bigint NOT NULL +); + +CREATE SEQUENCE allelevariantassociation_seq + START WITH 1 + INCREMENT BY 50 + NO MINVALUE + NO MAXVALUE + CACHE 1; + +CREATE INDEX allelevariantassociation_internal_index ON allelevariantassociation USING btree (internal); +CREATE INDEX allelevariantassociation_obsolete_index ON allelevariantassociation USING btree (obsolete); +CREATE INDEX allelevariantassociation_createdby_index ON allelevariantassociation USING btree (createdby_id); +CREATE INDEX allelevariantassociation_updatedby_index ON allelevariantassociation USING btree (updatedby_id); +CREATE INDEX allelevariantassociation_relation_index ON allelevariantassociation USING btree (relation_id); +CREATE INDEX allelevariantassociation_evidencecode_index ON allelevariantassociation USING btree (evidencecode_id); +CREATE INDEX allelevariantassociation_relatednote_index ON allelevariantassociation USING btree (relatednote_id); +CREATE INDEX allelevariantassociation_alleleassociationsubject_index ON allelevariantassociation USING btree (alleleassociationsubject_id); +CREATE INDEX allelevariantassociation_allelevariantassociationobject_index ON allelevariantassociation USING btree (allelevariantassociationobject_id); + + +CREATE INDEX idxlptd4iugnh74h5rnm4rhwwmgt ON allelevariantassociation_informationcontententity USING btree (association_id); +CREATE INDEX idxfkin7xx0kjoew8umur1riadtv ON allelevariantassociation_informationcontententity USING btree (evidence_id); + +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_evidencecode_id_fk FOREIGN KEY (evidencecode_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_relatednote_id_fk FOREIGN KEY (relatednote_id) REFERENCES note(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_aasubject_id_fk FOREIGN KEY (alleleassociationsubject_id) REFERENCES allele(id); +ALTER TABLE ONLY allelevariantassociation ADD CONSTRAINT allelevariantassociation_avaobject_id_fk FOREIGN KEY (allelevariantassociationobject_id) REFERENCES variant(id); + +ALTER TABLE ONLY allelevariantassociation_informationcontententity ADD CONSTRAINT allelevariantassociation_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES allelevariantassociation(id); +ALTER TABLE ONLY allelevariantassociation_informationcontententity ADD CONSTRAINT allelevariantassociation_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); + +INSERT INTO vocabularytermset (id, name, vocabularylabel, vocabularytermsetvocabulary_id) + SELECT nextval('vocabularytermset_seq'), 'Allele Variant Association Relation', 'allele_variant_relation', id FROM vocabulary WHERE vocabularylabel = 'allele_relation'; + +INSERT INTO vocabularyterm (id, name, vocabulary_id) SELECT nextval('vocabularyterm_seq'), 'has_variant', id FROM vocabulary WHERE vocabularylabel = 'allele_relation'; + +INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms_id) + WITH + t1 AS ( + SELECT id FROM vocabularytermset WHERE vocabularylabel = 'allele_variant_relation' + ), + t2 AS ( + SELECT id FROM vocabularyterm WHERE name = 'has_variant' AND vocabulary_id = ( + SELECT id FROM vocabulary WHERE vocabularylabel = 'allele_relation' + ) + ) + SELECT t1.id, t2.id FROM t1,t2; + \ No newline at end of file diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java new file mode 100644 index 000000000..122fbe834 --- /dev/null +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -0,0 +1,101 @@ +package org.alliancegenome.curation_api; + +import static org.hamcrest.Matchers.hasSize; +import static org.hamcrest.Matchers.is; + +import java.util.HashMap; + +import org.alliancegenome.curation_api.base.BaseITCase; +import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.model.entities.DataProvider; +import org.alliancegenome.curation_api.model.entities.Vocabulary; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.resources.TestContainerResource; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Order; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.api.TestMethodOrder; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusIntegrationTest; +import io.restassured.RestAssured; +import io.restassured.config.HttpClientConfig; +import io.restassured.config.RestAssuredConfig; + +@QuarkusIntegrationTest +@QuarkusTestResource(TestContainerResource.Initializer.class) +@TestMethodOrder(MethodOrderer.OrderAnnotation.class) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +@DisplayName("610 - Variant data bulk upload - FMS") +@Order(610) +public class VariantFmsITCase extends BaseITCase { + + // These tests require: GeneBulkUploadITCase and VocabularyTermITCase + + @BeforeEach + public void init() { + RestAssured.config = RestAssuredConfig.config() + .httpClient(HttpClientConfig.httpClientConfig() + .setParam("http.socket.timeout", 100000) + .setParam("http.connection.timeout", 100000)); + } + + private final String variantFmsTestFilePath = "src/test/resources/bulk/fms/10_variant/"; + private final String variantFmsBulkPostEndpoint = "/api/variant/bulk/WB/fmsvariants"; + private final String variantGetEndpoint = "/api/variant/"; + private final String allele = "WB:AlleleWithVar1"; + private final String assemblyComponent = "RefSeq:NC_001.1"; + private final String variantId = "var"; + + private void loadRequiredEntities() throws Exception { + createSoTerm("SO:1000002", "substitution", false); + createSoTerm("SO:0000667", "insertion", false); + createSoTerm("SO:0002007", "MNV", false); + createSoTerm("SO:1000008", "point_mutation", false); + createSoTerm("SO:0000159", "deletion", false); + createSoTerm("SO:1000032", "delins", false); + createSoTerm("SO:0001587", "stop_gained", false); + Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); + VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); + DataProvider dataProvider = createDataProvider("WB", false); + createAllele(allele, "TestAlleleWithVariant", "NCBITaxon:6239", symbolTerm, false, dataProvider); + createAssemblyComponent(assemblyComponent, "Test1", dataProvider); + + } + + @Test + @Order(1) + public void variantFmsBulkUpload() throws Exception { + loadRequiredEntities(); + + HashMap> params = new HashMap<>(); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); + + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "AF_01_all_fields.json", params); + + RestAssured.given(). + when(). + get(variantGetEndpoint + variantId). + then(). + statusCode(200). + body("entity.modInternalId", is(variantId)). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). + body("entity.transcriptType.curie", is("SO:0000234")). + body("entity.curatedVariantGenomicLocationAssociations", hasSize(1)). + body("entity.curatedVariantGenomicLocationAssociations[0].relation.name", is("located_on")). + body("entity.curatedVariantGenomicLocationAssociations[0].variantGenomicLocationAssociationObject.name", is("Test1")). + body("entity.curatedVariantGenomicLocationAssociations[0].start", is(1)). + body("entity.curatedVariantGenomicLocationAssociations[0].end", is(1000)). + body("entity.alleleVariantAssociations", hasSize(1)). + body("entity.alleleVariantAssociations[0].relation.name", is("has_variant")). + body("entity.alleleVariantAssociations[0].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar1")); + + } + +} diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index fcdad90b2..a2ebf8f1b 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -215,6 +215,24 @@ public AnatomicalTerm createAnatomicalTerm(String curie, String name) throws Exc return response.getEntity(); } + + public AssemblyComponent createAssemblyComponent(String modEntityId, String name, DataProvider dataProvider) throws Exception { + AssemblyComponent assemblyComponent = new AssemblyComponent(); + assemblyComponent.setModEntityId(modEntityId); + assemblyComponent.setName(name); + assemblyComponent.setDataProvider(dataProvider); + + ObjectResponse response = RestAssured.given(). + contentType("application/json"). + body(assemblyComponent). + when(). + put("/api/assemblycomponent"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefAssemblyComponent()); + + return response.getEntity(); + } public CHEBITerm createChebiTerm(String curie, String name, Boolean obsolete) { CHEBITerm chebiTerm = new CHEBITerm(); @@ -1124,13 +1142,13 @@ private TypeRef> getObjectResponseTypeRefA }; } - private TypeRef> getObjectResponseTypeRefOntologyTerm() { - return new TypeRef>() { + private TypeRef> getObjectResponseTypeRefAnatomicalTerm() { + return new TypeRef>() { }; } - private TypeRef> getObjectResponseTypeRefAnatomicalTerm() { - return new TypeRef>() { + private TypeRef> getObjectResponseTypeRefAssemblyComponent() { + return new TypeRef>() { }; } @@ -1244,6 +1262,11 @@ public TypeRef> getObjectResponseTypeRefNote() { }; } + private TypeRef> getObjectResponseTypeRefOntologyTerm() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefOrganization() { return new TypeRef>() { }; diff --git a/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json new file mode 100644 index 000000000..3fefc3b5e --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_001.1", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "WB:WBVar00252636", + "pages": [ + "allele" + ] + } + ] + } +] + From 34e8c2ce9e1542dcb06c07e06549614c668cf887 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Tue, 22 Oct 2024 00:35:12 +0100 Subject: [PATCH 314/342] Various fixes --- .../interfaces/crud/VariantCrudInterface.java | 2 +- .../curation_api/model/entities/Variant.java | 4 +- .../AlleleVariantAssociation.java | 2 +- ...atedVariantGenomicLocationAssociation.java | 3 +- .../VariantLocationAssociation.java | 5 +- .../services/CodingSequenceService.java | 10 ++- .../curation_api/services/ExonService.java | 8 +++ .../services/TranscriptService.java | 9 +-- .../services/base/BaseEntityCrudService.java | 2 +- .../dto/fms/VariantFmsDTOValidator.java | 2 +- .../curation_api/view/View.java | 3 + ...d_variant_genomic_location_association.sql | 64 +++++++++---------- .../curation_api/VariantFmsITCase.java | 14 ++-- 13 files changed, 72 insertions(+), 56 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java index b6d6afbf3..3aeb1ecf9 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java @@ -46,7 +46,7 @@ public interface VariantCrudInterface extends BaseSubmittedObjectCrudInterface getByIdentifier(@PathParam("identifierString") String identifierString); diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java b/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java index 75297056c..fd9e50323 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/Variant.java @@ -82,11 +82,11 @@ public class Variant extends GenomicEntity { } ) @OneToMany(mappedBy = "variantAssociationSubject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class }) + @JsonView({ View.FieldsAndLists.class, View.VariantView.class }) private List curatedVariantGenomicLocations; @OneToMany(mappedBy = "alleleVariantAssociationObject", cascade = CascadeType.ALL, orphanRemoval = true) - @JsonView({ View.FieldsAndLists.class, View.GeneDetailView.class }) + @JsonView({ View.FieldsAndLists.class, View.VariantDetailView.class }) private List alleleVariantAssociations; } diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java index a70ac37c3..4293c5b57 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/alleleAssociations/AlleleVariantAssociation.java @@ -59,6 +59,6 @@ public class AlleleVariantAssociation extends AlleleGenomicEntityAssociation { @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToOne @JsonView({ View.FieldsOnly.class, View.AlleleView.class }) - @JsonIgnoreProperties({ "alleleVariantAssociations", "constructGenomicEntityAssociations" }) + @JsonIgnoreProperties({ "alleleVariantAssociations", "constructGenomicEntityAssociations", "curatedVariantGenomicLocations" }) private Variant alleleVariantAssociationObject; } 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 6a4c098e6..82508a178 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 @@ -31,7 +31,8 @@ @Index(name = "cvgla_curatedconsequence_index", columnList = "curatedConsequence_id"), @Index(name = "cvgla_variantassociationsubject_index", columnList = "variantassociationsubject_id"), @Index(name = "cvgla_vglaobject_index", columnList = "variantgenomiclocationassociationobject_id") -}) + }, name = "CuratedVariantGenomicLocation" +) public class CuratedVariantGenomicLocationAssociation extends VariantGenomicLocationAssociation { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java index bd1811500..4d6ac9fae 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonView; +import jakarta.persistence.Column; import jakarta.persistence.ManyToOne; import jakarta.persistence.MappedSuperclass; import lombok.Data; @@ -41,7 +42,7 @@ public abstract class VariantLocationAssociation extends LocationAssociation { }) @ManyToOne @JsonView({ View.FieldsOnly.class }) - @JsonIgnoreProperties("curatedVariantGenomicLocations") + @JsonIgnoreProperties({"curatedVariantGenomicLocations", "alleleVariantAssociations"}) @Fetch(FetchMode.JOIN) private Variant variantAssociationSubject; @@ -53,11 +54,13 @@ public abstract class VariantLocationAssociation extends LocationAssociation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "referenceSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) + @Column(length = 1000) private String referenceSequence; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "variantSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) + @Column(length = 1000) private String variantSequence; @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", 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 879737409..a196e4c39 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.CodingSequence; +import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; @@ -42,8 +43,15 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { return ids; } + @Override + public ObjectResponse getByIdentifier(String identifier) { + CodingSequence object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId", "uniqueId"), identifier); + ObjectResponse ret = new ObjectResponse(object); + return ret; + } + public ObjectResponse deleteByIdentifier(String identifierString) { - CodingSequence codingSequence = findByAlternativeFields(List.of("modEntityId", "modInternalId", "uniqueId"), identifierString); + CodingSequence codingSequence = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId", "uniqueId"), identifierString); if (codingSequence != null) { codingSequenceDAO.remove(codingSequence.getId()); } 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 f65601743..c97c5934a 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java @@ -9,6 +9,7 @@ import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.Exon; +import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.apache.commons.lang.StringUtils; @@ -40,6 +41,13 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { return ids; } + @Override + public ObjectResponse getByIdentifier(String identifier) { + Exon object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId", "uniqueId"), identifier); + ObjectResponse ret = new ObjectResponse(object); + return ret; + } + public ObjectResponse deleteByIdentifier(String identifierString) { Exon exon = findByAlternativeFields(List.of("modEntityId", "modInternalId", "uniqueId"), identifierString); if (exon != 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 9cf7b422b..abc9f8fbf 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/TranscriptService.java @@ -42,15 +42,8 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { return ids; } - @Override - public ObjectResponse getByIdentifier(String identifier) { - Transcript object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId"), identifier); - ObjectResponse ret = new ObjectResponse(object); - return ret; - } - public ObjectResponse deleteByIdentifier(String identifierString) { - Transcript transcript = findByAlternativeFields(List.of("modEntityId", "modInternalId"), identifierString); + Transcript transcript = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId"), identifierString); if (transcript != null) { transcriptDAO.remove(transcript.getId()); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/base/BaseEntityCrudService.java b/src/main/java/org/alliancegenome/curation_api/services/base/BaseEntityCrudService.java index 32f1c52c2..1f46bc312 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/base/BaseEntityCrudService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/base/BaseEntityCrudService.java @@ -65,7 +65,7 @@ public ObjectResponse getByCurie(String curie) { } public ObjectResponse getByIdentifier(String identifier) { - E object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId", "uniqueId"), identifier); + E object = findByAlternativeFields(List.of("curie", "modEntityId", "modInternalId"), identifier); ObjectResponse ret = new ObjectResponse(object); return ret; } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index c11fc2d2f..13a2d149e 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -44,7 +44,7 @@ public class VariantFmsDTOValidator { @Inject AlleleService alleleService; @Inject AssemblyComponentService assemblyComponentService; @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; - CuratedVariantGenomicLocationAssociationService curatedVariantGenomicLocationAssociationService; + @Inject CuratedVariantGenomicLocationAssociationService curatedVariantGenomicLocationAssociationService; @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; @Inject AlleleVariantAssociationService alleleVariantAssociationService; @Inject SoTermService soTermService; diff --git a/src/main/java/org/alliancegenome/curation_api/view/View.java b/src/main/java/org/alliancegenome/curation_api/view/View.java index 24dc2fbc4..4cfb53a03 100644 --- a/src/main/java/org/alliancegenome/curation_api/view/View.java +++ b/src/main/java/org/alliancegenome/curation_api/view/View.java @@ -105,6 +105,9 @@ public static class VariantUpdate extends GeneView { public static class VariantCreate extends GeneView { } + + public static class VariantDetailView extends VariantView { + } public static class GeneInteractionView extends FieldsOnly { } diff --git a/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql index 001b95b99..753bdc8b6 100644 --- a/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.58__curated_variant_genomic_location_association.sql @@ -1,4 +1,4 @@ -CREATE TABLE curatedvariantgenomiclocationassociation ( +CREATE TABLE curatedvariantgenomiclocation ( id bigint PRIMARY KEY, datecreated timestamp(6) with time zone, dateupdated timestamp(6) with time zone, @@ -29,47 +29,47 @@ CREATE TABLE curatedvariantgenomiclocationassociation ( variantsequence character varying(1000) ); -CREATE TABLE CuratedVariantGenomicLocationAssociation_InformationContentEntity ( +CREATE TABLE curatedvariantgenomiclocation_informationcontententity ( association_id bigint NOT NULL, evidence_id bigint NOT NULL ); -CREATE SEQUENCE curatedvariantgenomiclocationassociation_seq +CREATE SEQUENCE curatedvariantgenomiclocation_seq START WITH 1 INCREMENT BY 50 NO MINVALUE NO MAXVALUE CACHE 1; -CREATE INDEX cvgla_internal_index ON curatedvariantgenomiclocationassociation USING btree (internal); -CREATE INDEX cvgla_obsolete_index ON curatedvariantgenomiclocationassociation USING btree (obsolete); -CREATE INDEX cvgla_hgvs_index ON curatedvariantgenomiclocationassociation USING btree (hgvs); -CREATE INDEX cvgla_createdby_index ON curatedvariantgenomiclocationassociation USING btree (createdby_id); -CREATE INDEX cvgla_updatedby_index ON curatedvariantgenomiclocationassociation USING btree (updatedby_id); -CREATE INDEX cvgla_relation_index ON curatedvariantgenomiclocationassociation USING btree (relation_id); -CREATE INDEX cvgla_consequence_index ON curatedvariantgenomiclocationassociation USING btree (consequence_id); -CREATE INDEX cvgla_curatedconsequence_index ON curatedvariantgenomiclocationassociation USING btree (curatedconsequence_id); -CREATE INDEX cvgla_dnamutationtype_index ON curatedvariantgenomiclocationassociation USING btree (dnamutationtype_id); -CREATE INDEX cvgla_genelocalizationtype_index ON curatedvariantgenomiclocationassociation USING btree (genelocalizationtype_id); -CREATE INDEX cvgla_variantassociationsubject_index ON curatedvariantgenomiclocationassociation USING btree (variantassociationsubject_id); -CREATE INDEX cvgla_vglaobject_index ON curatedvariantgenomiclocationassociation USING btree (variantgenomiclocationassociationobject_id); - -CREATE INDEX idxf6ue9897y96ts14v3cxil0rr3 ON curatedvariantgenomiclocationassociation_informationcontententity USING btree (association_id); -CREATE INDEX idxf71i1k78crgfhf7pnaewvc1ia ON curatedvariantgenomiclocationassociation_informationcontententity USING btree (evidence_id); - -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_variantassociationsubject_id_fk FOREIGN KEY (variantassociationsubject_id) REFERENCES variant(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_variantgenomiclocationassociationobject_id_fk FOREIGN KEY (variantgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_dnamutationtype_id_fk FOREIGN KEY (dnamutationtype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_genelocalizationtype_id_fk FOREIGN KEY (genelocalizationtype_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_curatedconsequence_id_fk FOREIGN KEY (curatedconsequence_id) REFERENCES ontologyterm(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation ADD CONSTRAINT cvgla_consequence_id_fk FOREIGN KEY (consequence_id) REFERENCES ontologyterm(id); - - -ALTER TABLE ONLY curatedvariantgenomiclocationassociation_informationcontententity ADD CONSTRAINT cvgla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES curatedvariantgenomiclocationassociation(id); -ALTER TABLE ONLY curatedvariantgenomiclocationassociation_informationcontententity ADD CONSTRAINT cvgla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); +CREATE INDEX cvgla_internal_index ON curatedvariantgenomiclocation USING btree (internal); +CREATE INDEX cvgla_obsolete_index ON curatedvariantgenomiclocation USING btree (obsolete); +CREATE INDEX cvgla_hgvs_index ON curatedvariantgenomiclocation USING btree (hgvs); +CREATE INDEX cvgla_createdby_index ON curatedvariantgenomiclocation USING btree (createdby_id); +CREATE INDEX cvgla_updatedby_index ON curatedvariantgenomiclocation USING btree (updatedby_id); +CREATE INDEX cvgla_relation_index ON curatedvariantgenomiclocation USING btree (relation_id); +CREATE INDEX cvgla_consequence_index ON curatedvariantgenomiclocation USING btree (consequence_id); +CREATE INDEX cvgla_curatedconsequence_index ON curatedvariantgenomiclocation USING btree (curatedconsequence_id); +CREATE INDEX cvgla_dnamutationtype_index ON curatedvariantgenomiclocation USING btree (dnamutationtype_id); +CREATE INDEX cvgla_genelocalizationtype_index ON curatedvariantgenomiclocation USING btree (genelocalizationtype_id); +CREATE INDEX cvgla_variantassociationsubject_index ON curatedvariantgenomiclocation USING btree (variantassociationsubject_id); +CREATE INDEX cvgla_vglaobject_index ON curatedvariantgenomiclocation USING btree (variantgenomiclocationassociationobject_id); + +CREATE INDEX idxf6ue9897y96ts14v3cxil0rr3 ON curatedvariantgenomiclocation_informationcontententity USING btree (association_id); +CREATE INDEX idxf71i1k78crgfhf7pnaewvc1ia ON curatedvariantgenomiclocation_informationcontententity USING btree (evidence_id); + +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_createdby_id_fk FOREIGN KEY (createdby_id) REFERENCES person(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_updatedby_id_fk FOREIGN KEY (updatedby_id) REFERENCES person(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_relation_id_fk FOREIGN KEY (relation_id) REFERENCES vocabularyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_variantassociationsubject_id_fk FOREIGN KEY (variantassociationsubject_id) REFERENCES variant(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_variantgenomiclocationassociationobject_id_fk FOREIGN KEY (variantgenomiclocationassociationobject_id) REFERENCES assemblycomponent(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_dnamutationtype_id_fk FOREIGN KEY (dnamutationtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_genelocalizationtype_id_fk FOREIGN KEY (genelocalizationtype_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_curatedconsequence_id_fk FOREIGN KEY (curatedconsequence_id) REFERENCES ontologyterm(id); +ALTER TABLE ONLY curatedvariantgenomiclocation ADD CONSTRAINT cvgla_consequence_id_fk FOREIGN KEY (consequence_id) REFERENCES ontologyterm(id); + + +ALTER TABLE ONLY curatedvariantgenomiclocation_informationcontententity ADD CONSTRAINT cvgla_ice_association_id_fk FOREIGN KEY (association_id) REFERENCES curatedvariantgenomiclocation(id); +ALTER TABLE ONLY curatedvariantgenomiclocation_informationcontententity ADD CONSTRAINT cvgla_ice_evidence_id_fk FOREIGN KEY (evidence_id) REFERENCES informationcontententity(id); CREATE TABLE allelevariantassociation ( id bigint PRIMARY KEY, diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index 122fbe834..19196aa0a 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -48,7 +48,7 @@ public void init() { private final String variantGetEndpoint = "/api/variant/"; private final String allele = "WB:AlleleWithVar1"; private final String assemblyComponent = "RefSeq:NC_001.1"; - private final String variantId = "var"; + private final String variantId = "var_NC_001.1:g.1A>T"; private void loadRequiredEntities() throws Exception { createSoTerm("SO:1000002", "substitution", false); @@ -86,12 +86,12 @@ public void variantFmsBulkUpload() throws Exception { body("entity.modInternalId", is(variantId)). body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). - body("entity.transcriptType.curie", is("SO:0000234")). - body("entity.curatedVariantGenomicLocationAssociations", hasSize(1)). - body("entity.curatedVariantGenomicLocationAssociations[0].relation.name", is("located_on")). - body("entity.curatedVariantGenomicLocationAssociations[0].variantGenomicLocationAssociationObject.name", is("Test1")). - body("entity.curatedVariantGenomicLocationAssociations[0].start", is(1)). - body("entity.curatedVariantGenomicLocationAssociations[0].end", is(1000)). + body("entity.variantType.curie", is("SO:1000002")). + body("entity.curatedVariantGenomicLocations", hasSize(1)). + body("entity.curatedVariantGenomicLocations[0].relation.name", is("located_on")). + body("entity.curatedVariantGenomicLocations[0].variantGenomicLocationAssociationObject.name", is("Test1")). + body("entity.curatedVariantGenomicLocations[0].start", is(1)). + body("entity.curatedVariantGenomicLocations[0].end", is(1000)). body("entity.alleleVariantAssociations", hasSize(1)). body("entity.alleleVariantAssociations[0].relation.name", is("has_variant")). body("entity.alleleVariantAssociations[0].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar1")); From b01eccce61aea82b2ecec163db1276a4daa9eb9d Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 23 Oct 2024 18:36:40 +0100 Subject: [PATCH 315/342] Add fields to variant --- .../model/entities/DiseaseAnnotation.java | 3 +- .../model/entities/GenomicEntity.java | 2 +- .../helpers/notes/NoteIdentityHelper.java | 19 ++++ .../fms/CrossReferenceFmsDTOValidator.java | 70 ++++++++++++++ .../dto/fms/VariantFmsDTOValidator.java | 93 ++++++++++++++++++- .../dto/fms/VariantNoteFmsDTOValidator.java | 74 +++++++++++++++ .../curation_api/VariantFmsITCase.java | 14 ++- .../bulk/fms/10_variant/AF_01_all_fields.json | 4 +- 8 files changed, 270 insertions(+), 9 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java create mode 100644 src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantNoteFmsDTOValidator.java 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 5a25d0a73..9dda98fb0 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 @@ -160,7 +160,8 @@ public abstract class DiseaseAnnotation extends Annotation { @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) private DataProvider secondaryDataProvider; - @IndexedEmbedded(includeDepth = 1) + @IndexedEmbedded(includePaths = {"symbol", "name", "curie", "modEntityId", "modInternalId", + "symbol_keyword", "name_keyword", "curie_keyword", "modEntityId_keyword", "modInternalId_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) @ManyToMany @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) 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 c4e973e04..3bc9a17c8 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 @@ -37,7 +37,7 @@ 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 }) + @JsonView({ View.FieldsAndLists.class, View.AlleleView.class, View.GeneView.class, View.AffectedGenomicModelView.class, View.VariantView.class }) private List crossReferences; diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/notes/NoteIdentityHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/notes/NoteIdentityHelper.java index aa272f31e..1067f4bb0 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/notes/NoteIdentityHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/notes/NoteIdentityHelper.java @@ -1,5 +1,6 @@ package org.alliancegenome.curation_api.services.helpers.notes; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.stream.Collectors; @@ -7,6 +8,8 @@ import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Reference; import org.alliancegenome.curation_api.model.ingest.dto.NoteDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.PublicationRefFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantNoteFmsDTO; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; @@ -54,4 +57,20 @@ public static String noteDtoIdentity(NoteDTO note) { return identity; } + + public static String variantNoteFmsDtoIdentity(VariantNoteFmsDTO note) { + String identity = StringUtils.isBlank(note.getNote()) ? "" : note.getNote(); + List referenceCuries = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(note.getReferences())) { + for (PublicationRefFmsDTO publicationDto : note.getReferences()) { + if (StringUtils.isNotBlank(publicationDto.getPublicationId())) { + referenceCuries.add(publicationDto.getPublicationId()); + } + } + Collections.sort(referenceCuries); + identity = identity + "|" + StringUtils.join(referenceCuries, ":"); + } + + return identity; + } } \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java new file mode 100644 index 000000000..2b60fea8d --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java @@ -0,0 +1,70 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import java.util.ArrayList; +import java.util.List; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; +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.ResourceDescriptorPageService; +import org.alliancegenome.curation_api.services.ResourceDescriptorService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class CrossReferenceFmsDTOValidator { + + @Inject ResourceDescriptorService resourceDescriptorService; + @Inject ResourceDescriptorPageService resourceDescriptorPageService; + + public ObjectResponse> validateCrossReferenceFmsDTO(CrossReferenceFmsDTO dto) { + + ObjectResponse> crResponse = new ObjectResponse<>(); + List xrefList = new ArrayList<>(); + List pageNames = List.of("default"); + + if (CollectionUtils.isNotEmpty(dto.getPages())) { + pageNames = dto.getPages(); + } + + for (String pageName : pageNames) { + CrossReference xref = new CrossReference(); + + if (StringUtils.isBlank(dto.getId())) { + crResponse.addErrorMessage("id", ValidationConstants.REQUIRED_MESSAGE); + } else { + String[] idParts = dto.getId().split(":"); + ResourceDescriptor resourceDescriptor = null; + if (idParts.length == 2) { + ObjectResponse rdResponse = resourceDescriptorService.getByPrefixOrSynonym(idParts[0]); + if (rdResponse != null) { + resourceDescriptor = rdResponse.getEntity(); + } + } + if (resourceDescriptor == null) { + crResponse.addErrorMessage("id", ValidationConstants.INVALID_MESSAGE + " (" + dto.getId() + ")"); + } else { + xref.setReferencedCurie(dto.getId()); + xref.setDisplayName(dto.getId()); + ResourceDescriptorPage page = resourceDescriptorPageService.getPageForResourceDescriptor(idParts[0], pageName); + if (page == null) { + crResponse.addErrorMessage("pages", ValidationConstants.INVALID_MESSAGE + " (" + page + ")"); + } + xref.setResourceDescriptorPage(page); + xrefList.add(xref); + } + } + } + + crResponse.setEntity(xrefList); + + return crResponse; + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index 13a2d149e..09c18bc67 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -1,10 +1,12 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.NoteDAO; import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; import org.alliancegenome.curation_api.dao.associations.variantAssociations.CuratedVariantGenomicLocationAssociationDAO; @@ -13,20 +15,25 @@ import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.Note; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.entities.associations.alleleAssociations.AlleleVariantAssociation; import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; +import org.alliancegenome.curation_api.model.ingest.dto.fms.CrossReferenceFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.AlleleService; import org.alliancegenome.curation_api.services.AssemblyComponentService; +import org.alliancegenome.curation_api.services.CrossReferenceService; import org.alliancegenome.curation_api.services.DataProviderService; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.VocabularyTermSetService; import org.alliancegenome.curation_api.services.associations.alleleAssociations.AlleleVariantAssociationService; import org.alliancegenome.curation_api.services.associations.variantAssociations.CuratedVariantGenomicLocationAssociationService; +import org.alliancegenome.curation_api.services.helpers.notes.NoteIdentityHelper; import org.alliancegenome.curation_api.services.helpers.variants.HgvsIdentifierHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.ontology.SoTermService; @@ -41,6 +48,7 @@ public class VariantFmsDTOValidator { @Inject VariantDAO variantDAO; + @Inject NoteDAO noteDAO; @Inject AlleleService alleleService; @Inject AssemblyComponentService assemblyComponentService; @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; @@ -52,6 +60,9 @@ public class VariantFmsDTOValidator { @Inject NcbiTaxonTermService ncbiTaxonTermService; @Inject VocabularyTermService vocabularyTermService; @Inject VocabularyTermSetService vocabularyTermSetService; + @Inject CrossReferenceFmsDTOValidator crossReferenceFmsDtoValidator; + @Inject CrossReferenceService crossReferenceService; + @Inject VariantNoteFmsDTOValidator variantNoteFmsDtoValidator; @Transactional public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { @@ -71,14 +82,14 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu variantResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.REQUIRED_MESSAGE); } - SOTerm soTerm = null; + SOTerm variantType = null; if (StringUtils.isBlank(dto.getType())) { variantResponse.addErrorMessage("type", ValidationConstants.REQUIRED_MESSAGE); } else if (Objects.equals(dto.getType(), "SO:1000002") || Objects.equals(dto.getType(), "SO:1000008") || Objects.equals(dto.getType(), "SO:0000667") || Objects.equals(dto.getType(), "SO:0000159") || Objects.equals(dto.getType(), "SO:0002007") || Objects.equals(dto.getType(), "SO:1000032")) { - soTerm = soTermService.findByCurieOrSecondaryId(dto.getType()); - if (soTerm == null) { + variantType = soTermService.findByCurieOrSecondaryId(dto.getType()); + if (variantType == null) { variantResponse.addErrorMessage("type", ValidationConstants.INVALID_MESSAGE + " (" + dto.getType() + ")"); } else { if (StringUtils.isBlank(dto.getGenomicReferenceSequence()) && !Objects.equals(dto.getType(), "SO:0000159") @@ -105,11 +116,74 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu } variant.setModInternalId(modInternalId); - variant.setVariantType(soTerm); + variant.setVariantType(variantType); variant.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.name())); variant.setTaxon(ncbiTaxonTermService.getByCurie(dataProvider.canonicalTaxonCurie).getEntity()); + SOTerm consequence = null; + if (StringUtils.isNotBlank(dto.getConsequence())) { + consequence = soTermService.findByCurieOrSecondaryId(dto.getConsequence()); + if (consequence == null) { + variantResponse.addErrorMessage("consequence", ValidationConstants.INVALID_MESSAGE + " (" + dto.getConsequence() + ")"); + } + } + variant.setSourceGeneralConsequence(consequence); + + List validatedXrefs = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(dto.getCrossReferences())) { + for (CrossReferenceFmsDTO xrefDto : dto.getCrossReferences()) { + ObjectResponse> xrefResponse = crossReferenceFmsDtoValidator.validateCrossReferenceFmsDTO(xrefDto); + if (xrefResponse.hasErrors()) { + variantResponse.addErrorMessage("cross_references", xrefResponse.errorMessagesString()); + break; + } else { + validatedXrefs.addAll(xrefResponse.getEntity()); + } + } + } + List xrefs = crossReferenceService.getUpdatedXrefList(validatedXrefs, variant.getCrossReferences()); + if (variant.getCrossReferences() != null) { + variant.getCrossReferences().clear(); + } + if (xrefs != null) { + if (variant.getCrossReferences() == null) { + variant.setCrossReferences(new ArrayList<>()); + } + variant.getCrossReferences().addAll(xrefs); + } + + if (variant.getRelatedNotes() != null) { + variant.getRelatedNotes().clear(); + } + List validatedNotes = new ArrayList(); + List noteIdentities = new ArrayList(); + Boolean allNotesValid = true; + if (CollectionUtils.isNotEmpty(dto.getNotes())) { + for (int ix = 0; ix < dto.getNotes().size(); ix++) { + ObjectResponse noteResponse = variantNoteFmsDtoValidator.validateVariantNoteFmsDTO(dto.getNotes().get(ix)); + if (noteResponse.hasErrors()) { + allNotesValid = false; + variantResponse.addErrorMessages("notes", ix, noteResponse.getErrorMessages()); + } else { + String noteIdentity = NoteIdentityHelper.variantNoteFmsDtoIdentity(dto.getNotes().get(ix)); + if (!noteIdentities.contains(noteIdentity)) { + noteIdentities.add(noteIdentity); + validatedNotes.add(noteDAO.persist(noteResponse.getEntity())); + } + } + } + } + if (!allNotesValid) { + variantResponse.convertMapToErrorMessages("notes"); + } + if (CollectionUtils.isNotEmpty(validatedNotes) && allNotesValid) { + if (variant.getRelatedNotes() == null) { + variant.setRelatedNotes(new ArrayList<>()); + } + variant.getRelatedNotes().addAll(validatedNotes); + } + if (variantResponse.hasErrors()) { variantResponse.convertErrorMessagesToMap(); throw new ObjectValidationException(dto, variantResponse.errorMessagesString()); @@ -173,6 +247,10 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, association.setVariantSequence(dto.getGenomicVariantSequence()); } + if (variant == null) { + cvglaResponse.addErrorMessage("variant", ValidationConstants.INVALID_MESSAGE); + } + if (cvglaResponse.hasErrors()) { throw new ObjectValidationException(dto, cvglaResponse.errorMessagesString()); } @@ -219,6 +297,13 @@ public void validateAlleleVariantAssociation(VariantFmsDTO dto, List idsAd association.setAlleleVariantAssociationObject(variant); association.setRelation(vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.ALLELE_VARIANT_RELATION_VOCABULARY_TERM_SET, "has_variant").getEntity()); + if (variant == null) { + avaResponse.addErrorMessage("variant", ValidationConstants.INVALID_MESSAGE); + } + + if (avaResponse.hasErrors()) { + throw new ObjectValidationException(dto, avaResponse.errorMessagesString()); + } association = alleleVariantAssociationDAO.persist(association); if (association != null) { diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantNoteFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantNoteFmsDTOValidator.java new file mode 100644 index 000000000..3cf356ba5 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantNoteFmsDTOValidator.java @@ -0,0 +1,74 @@ +package org.alliancegenome.curation_api.services.validation.dto.fms; + +import java.util.ArrayList; +import java.util.List; + +import org.alliancegenome.curation_api.constants.ValidationConstants; +import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.ReferenceDAO; +import org.alliancegenome.curation_api.model.entities.Note; +import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.ingest.dto.fms.PublicationRefFmsDTO; +import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantNoteFmsDTO; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.PersonService; +import org.alliancegenome.curation_api.services.ReferenceService; +import org.alliancegenome.curation_api.services.VocabularyTermService; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; + +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class VariantNoteFmsDTOValidator { + + @Inject ReferenceDAO referenceDAO; + @Inject ReferenceService referenceService; + @Inject PersonService personService; + @Inject VocabularyTermService vocabularyTermService; + + public ObjectResponse validateVariantNoteFmsDTO(VariantNoteFmsDTO dto) { + Note note = new Note(); + ObjectResponse noteResponse = new ObjectResponse<>(); + + if (StringUtils.isBlank(dto.getNote())) { + noteResponse.addErrorMessage("note", ValidationConstants.REQUIRED_MESSAGE); + } + note.setFreeText(dto.getNote()); + + VocabularyTerm noteType = vocabularyTermService.getTermInVocabularyTermSet(VocabularyConstants.VARIANT_NOTE_TYPES_VOCABULARY_TERM_SET, "comment").getEntity(); + if (noteType == null) { + noteResponse.addErrorMessage("note_type", ValidationConstants.INVALID_MESSAGE + " (comment)"); + } + note.setNoteType(noteType); + + if (CollectionUtils.isNotEmpty(dto.getReferences())) { + List noteReferences = new ArrayList<>(); + for (PublicationRefFmsDTO publicationDto : dto.getReferences()) { + if (StringUtils.isBlank(publicationDto.getPublicationId())) { + noteResponse.addErrorMessage("references - publicationId", ValidationConstants.REQUIRED_MESSAGE); + } else { + Reference reference = null; + reference = referenceService.retrieveFromDbOrLiteratureService(publicationDto.getPublicationId()); + if (reference == null) { + noteResponse.addErrorMessage("evidence_curies", ValidationConstants.INVALID_MESSAGE + " (" + publicationDto.getPublicationId() + ")"); + break; + } + noteReferences.add(reference); + } + } + note.setReferences(noteReferences); + } else { + note.setReferences(null); + } + + note.setInternal(false); + + noteResponse.setEntity(note); + + return noteResponse; + } + +} diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index 19196aa0a..3ac799d83 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -3,6 +3,7 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; +import java.time.OffsetDateTime; import java.util.HashMap; import org.alliancegenome.curation_api.base.BaseITCase; @@ -49,6 +50,7 @@ public void init() { private final String allele = "WB:AlleleWithVar1"; private final String assemblyComponent = "RefSeq:NC_001.1"; private final String variantId = "var_NC_001.1:g.1A>T"; + private final String reference = "AGRKB:000000001"; private void loadRequiredEntities() throws Exception { createSoTerm("SO:1000002", "substitution", false); @@ -87,6 +89,7 @@ public void variantFmsBulkUpload() throws Exception { body("entity.taxon.curie", is("NCBITaxon:6239")). body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). body("entity.variantType.curie", is("SO:1000002")). + body("entity.sourceGeneralConsequence.curie", is("SO:0001587")). body("entity.curatedVariantGenomicLocations", hasSize(1)). body("entity.curatedVariantGenomicLocations[0].relation.name", is("located_on")). body("entity.curatedVariantGenomicLocations[0].variantGenomicLocationAssociationObject.name", is("Test1")). @@ -94,7 +97,16 @@ public void variantFmsBulkUpload() throws Exception { body("entity.curatedVariantGenomicLocations[0].end", is(1000)). body("entity.alleleVariantAssociations", hasSize(1)). body("entity.alleleVariantAssociations[0].relation.name", is("has_variant")). - body("entity.alleleVariantAssociations[0].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar1")); + body("entity.alleleVariantAssociations[0].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar1")). + body("entity.relatedNotes", hasSize(1)). + body("entity.relatedNotes[0].internal", is(false)). + body("entity.relatedNotes[0].freeText", is("This is a test note.")). + body("entity.relatedNotes[0].noteType.name", is("comment")). + body("entity.relatedNotes[0].references[0].curie", is(reference)). + body("entity.crossReferences", hasSize(1)). + body("entity.crossReferences[0].referencedCurie", is("TEST:WBVar00252636")). + body("entity.crossReferences[0].displayName", is("TEST:WBVar00252636")). + body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage")); } diff --git a/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json index 3fefc3b5e..88605926d 100644 --- a/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json +++ b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json @@ -37,9 +37,9 @@ ], "crossReferences": [ { - "id": "WB:WBVar00252636", + "id": "TEST:WBVar00252636", "pages": [ - "allele" + "homepage" ] } ] From acba1db975c8347a1ecfce59b9b8891064c88b9c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Wed, 23 Oct 2024 23:37:01 +0100 Subject: [PATCH 316/342] Backend code to split disease genetic modifiers --- .../model/entities/DiseaseAnnotation.java | 54 +++- .../annotations/AnnotationUniqueIdHelper.java | 12 +- .../DiseaseAnnotationValidator.java | 114 +++++++-- .../dto/DiseaseAnnotationDTOValidator.java | 22 +- ...7.0.62__disease_genetic_modifier_split.sql | 73 ++++++ .../DiseaseAnnotationBulkUploadITCase.java | 60 +++-- .../curation_api/DiseaseAnnotationITCase.java | 234 ++++++++++++------ .../AF_01_all_fields_gene_annotation.json | 4 +- .../AF_02_all_fields_allele_annotation.json | 4 +- .../AF_03_all_fields_agm_annotation.json | 4 +- ...except_default_fields_gene_annotation.json | 4 +- ...cept_default_fields_allele_annotation.json | 4 +- ..._except_default_fields_agm_annotation.json | 4 +- 13 files changed, 471 insertions(+), 122 deletions(-) create mode 100644 src/main/resources/db/migration/v0.37.0.62__disease_genetic_modifier_split.sql 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 5a25d0a73..0c45e17f0 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 @@ -160,19 +160,63 @@ public abstract class DiseaseAnnotation extends Annotation { @JsonView({ View.FieldsOnly.class, View.ForPublic.class }) private DataProvider secondaryDataProvider; - @IndexedEmbedded(includeDepth = 1) + @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" + }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) + @JoinTable( + name = "diseaseannotation_modifiergene", + joinColumns = @JoinColumn(name = "diseaseannotation_id"), + inverseJoinColumns = @JoinColumn(name = "diseasegeneticmodifiergenes_id"), + indexes = { + @Index(name = "diseaseannotation_modifiergene_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_modifiergene_dgmg_index", columnList = "diseasegeneticmodifiergenes_id") + } + ) + 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" + }) + @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) + @ManyToMany + @JsonView({ View.FieldsAndLists.class, View.DiseaseAnnotation.class, View.ForPublic.class }) + @JoinTable( + name = "diseaseannotation_modifierallele", + joinColumns = @JoinColumn(name = "diseaseannotation_id"), + inverseJoinColumns = @JoinColumn(name = "diseasegeneticmodifieralleles_id"), + indexes = { + @Index(name = "diseaseannotation_modifierallele_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_modifierallele_dgma_index", columnList = "diseasegeneticmodifieralleles_id") + } + ) + private List diseaseGeneticModifierAlleles; + + @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 }) @JoinTable( + name = "diseaseannotation_modifieragm", joinColumns = @JoinColumn(name = "diseaseannotation_id"), - inverseJoinColumns = @JoinColumn(name = "diseasegeneticmodifiers_id"), + inverseJoinColumns = @JoinColumn(name = "diseasegeneticmodifieragms_id"), indexes = { - @Index(name = "diseaseannotation_biologicalentity_da_index", columnList = "diseaseannotation_id"), - @Index(name = "diseaseannotation_biologicalentity_dgm_index", columnList = "diseasegeneticmodifiers_id") + @Index(name = "diseaseannotation_modifieragm_da_index", columnList = "diseaseannotation_id"), + @Index(name = "diseaseannotation_modifieragm_dgma_index", columnList = "diseasegeneticmodifieragms_id") } ) - private List diseaseGeneticModifiers; + private List diseaseGeneticModifierAgms; @IndexedEmbedded(includePaths = {"name", "name_keyword"}) @IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW) diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/annotations/AnnotationUniqueIdHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/annotations/AnnotationUniqueIdHelper.java index a16a88d12..55482f8c5 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/annotations/AnnotationUniqueIdHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/annotations/AnnotationUniqueIdHelper.java @@ -132,7 +132,17 @@ public static String getDiseaseAnnotationUniqueId(DiseaseAnnotation annotation) uniqueId.add(gda.getSgdStrainBackground().getIdentifier()); } } - uniqueId.addSubmittedObjectList(annotation.getDiseaseGeneticModifiers()); + List geneticModifiers = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(annotation.getDiseaseGeneticModifierGenes())) { + geneticModifiers.addAll(annotation.getDiseaseGeneticModifierGenes()); + } + if (CollectionUtils.isNotEmpty(annotation.getDiseaseGeneticModifierAlleles())) { + geneticModifiers.addAll(annotation.getDiseaseGeneticModifierAlleles()); + } + if (CollectionUtils.isNotEmpty(annotation.getDiseaseGeneticModifierAgms())) { + geneticModifiers.addAll(annotation.getDiseaseGeneticModifierAgms()); + } + uniqueId.addSubmittedObjectList(geneticModifiers); return uniqueId.getUniqueId(); } diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java index d0fdbb4da..ff2edd521 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/DiseaseAnnotationValidator.java @@ -7,11 +7,13 @@ import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.dao.BiologicalEntityDAO; +import org.alliancegenome.curation_api.dao.AffectedGenomicModelDAO; +import org.alliancegenome.curation_api.dao.AlleleDAO; import org.alliancegenome.curation_api.dao.DiseaseAnnotationDAO; import org.alliancegenome.curation_api.dao.GeneDAO; import org.alliancegenome.curation_api.dao.ontology.EcoTermDAO; -import org.alliancegenome.curation_api.model.entities.BiologicalEntity; +import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; +import org.alliancegenome.curation_api.model.entities.Allele; import org.alliancegenome.curation_api.model.entities.DataProvider; import org.alliancegenome.curation_api.model.entities.DiseaseAnnotation; import org.alliancegenome.curation_api.model.entities.Gene; @@ -35,7 +37,8 @@ public class DiseaseAnnotationValidator extends AnnotationValidator { @Inject EcoTermDAO ecoTermDAO; @Inject DoTermService doTermService; @Inject GeneDAO geneDAO; - @Inject BiologicalEntityDAO biologicalEntityDAO; + @Inject AlleleDAO alleleDAO; + @Inject AffectedGenomicModelDAO agmDAO; @Inject VocabularyTermService vocabularyTermService; @Inject DiseaseAnnotationDAO diseaseAnnotationDAO; @Inject DataProviderService dataProviderService; @@ -177,33 +180,103 @@ public DataProvider validateSecondaryDataProvider(DiseaseAnnotation uiEntity, Di return validatedDataProvider; } - public List validateDiseaseGeneticModifiers(DiseaseAnnotation uiEntity, DiseaseAnnotation dbEntity) { - if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifiers())) { + public List validateDiseaseGeneticModifierGenes(DiseaseAnnotation uiEntity, DiseaseAnnotation dbEntity) { + if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierGenes())) { return null; } if (uiEntity.getDiseaseGeneticModifierRelation() == null) { - addMessageResponse("diseaseGeneticModifiers", ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation"); + addMessageResponse("diseaseGeneticModifierGenes", ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation"); return null; } - List validModifiers = new ArrayList<>(); + List validModifiers = new ArrayList<>(); List previousIds = new ArrayList<>(); - if (CollectionUtils.isNotEmpty(dbEntity.getDiseaseGeneticModifiers())) { - previousIds = dbEntity.getDiseaseGeneticModifiers().stream().map(BiologicalEntity::getId).collect(Collectors.toList()); + if (CollectionUtils.isNotEmpty(dbEntity.getDiseaseGeneticModifierGenes())) { + previousIds = dbEntity.getDiseaseGeneticModifierGenes().stream().map(Gene::getId).collect(Collectors.toList()); } - for (BiologicalEntity modifier : uiEntity.getDiseaseGeneticModifiers()) { - BiologicalEntity diseaseGeneticModifier = null; + for (Gene modifier : uiEntity.getDiseaseGeneticModifierGenes()) { + Gene diseaseGeneticModifier = null; if (modifier.getId() != null) { - diseaseGeneticModifier = biologicalEntityDAO.find(modifier.getId()); + diseaseGeneticModifier = geneDAO.find(modifier.getId()); } if (diseaseGeneticModifier == null) { - addMessageResponse("diseaseGeneticModifiers", ValidationConstants.INVALID_MESSAGE); + addMessageResponse("diseaseGeneticModifierGenes", ValidationConstants.INVALID_MESSAGE); return null; } if (diseaseGeneticModifier.getObsolete() && !previousIds.contains(diseaseGeneticModifier.getId())) { - addMessageResponse("diseaseGeneticModifiers", ValidationConstants.OBSOLETE_MESSAGE); + addMessageResponse("diseaseGeneticModifierGenes", ValidationConstants.OBSOLETE_MESSAGE); + return null; + } + validModifiers.add(diseaseGeneticModifier); + } + + return validModifiers; + } + + public List validateDiseaseGeneticModifierAgms(DiseaseAnnotation uiEntity, DiseaseAnnotation dbEntity) { + if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierGenes())) { + return null; + } + + if (uiEntity.getDiseaseGeneticModifierRelation() == null) { + addMessageResponse("diseaseGeneticModifierAgms", ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation"); + return null; + } + + List validModifiers = new ArrayList<>(); + List previousIds = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(dbEntity.getDiseaseGeneticModifierAlleles())) { + previousIds = dbEntity.getDiseaseGeneticModifierAlleles().stream().map(Allele::getId).collect(Collectors.toList()); + } + for (AffectedGenomicModel modifier : uiEntity.getDiseaseGeneticModifierAgms()) { + AffectedGenomicModel diseaseGeneticModifier = null; + if (modifier.getId() != null) { + diseaseGeneticModifier = agmDAO.find(modifier.getId()); + } + if (diseaseGeneticModifier == null) { + addMessageResponse("diseaseGeneticModifierAgms", ValidationConstants.INVALID_MESSAGE); + return null; + } + + if (diseaseGeneticModifier.getObsolete() && !previousIds.contains(diseaseGeneticModifier.getId())) { + addMessageResponse("diseaseGeneticModifierAgms", ValidationConstants.OBSOLETE_MESSAGE); + return null; + } + validModifiers.add(diseaseGeneticModifier); + } + + return validModifiers; + } + + public List validateDiseaseGeneticModifierAlleles(DiseaseAnnotation uiEntity, DiseaseAnnotation dbEntity) { + if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierGenes())) { + return null; + } + + if (uiEntity.getDiseaseGeneticModifierRelation() == null) { + addMessageResponse("diseaseGeneticModifierAlleles", ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation"); + return null; + } + + List validModifiers = new ArrayList<>(); + List previousIds = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(dbEntity.getDiseaseGeneticModifierAlleles())) { + previousIds = dbEntity.getDiseaseGeneticModifierAlleles().stream().map(Allele::getId).collect(Collectors.toList()); + } + for (Allele modifier : uiEntity.getDiseaseGeneticModifierAlleles()) { + Allele diseaseGeneticModifier = null; + if (modifier.getId() != null) { + diseaseGeneticModifier = alleleDAO.find(modifier.getId()); + } + if (diseaseGeneticModifier == null) { + addMessageResponse("diseaseGeneticModifierAlleles", ValidationConstants.INVALID_MESSAGE); + return null; + } + + if (diseaseGeneticModifier.getObsolete() && !previousIds.contains(diseaseGeneticModifier.getId())) { + addMessageResponse("diseaseGeneticModifierAlleles", ValidationConstants.OBSOLETE_MESSAGE); return null; } validModifiers.add(diseaseGeneticModifier); @@ -218,8 +291,9 @@ public VocabularyTerm validateDiseaseGeneticModifierRelation(DiseaseAnnotation u return null; } - if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifiers())) { - addMessageResponse(field, ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifiers"); + if (CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierGenes()) && CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierAlleles()) + && CollectionUtils.isEmpty(uiEntity.getDiseaseGeneticModifierAgms())) { + addMessageResponse(field, ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierGenes / diseaseGeneticModifierAlleles / diseaseGeneticModifierAgms"); return null; } @@ -322,9 +396,13 @@ public DiseaseAnnotation validateCommonDiseaseAnnotationFields(DiseaseAnnotation DataProvider secondaryDataProvider = validateSecondaryDataProvider(uiEntity, dbEntity); dbEntity.setSecondaryDataProvider(secondaryDataProvider); - List diseaseGeneticModifiers = validateDiseaseGeneticModifiers(uiEntity, dbEntity); + List diseaseGeneticModifierGenes = validateDiseaseGeneticModifierGenes(uiEntity, dbEntity); + List diseaseGeneticModifierAlleles = validateDiseaseGeneticModifierAlleles(uiEntity, dbEntity); + List diseaseGeneticModifierAgms = validateDiseaseGeneticModifierAgms(uiEntity, dbEntity); VocabularyTerm dgmRelation = validateDiseaseGeneticModifierRelation(uiEntity, dbEntity); - dbEntity.setDiseaseGeneticModifiers(diseaseGeneticModifiers); + dbEntity.setDiseaseGeneticModifierGenes(diseaseGeneticModifierGenes); + dbEntity.setDiseaseGeneticModifierAlleles(diseaseGeneticModifierAlleles); + dbEntity.setDiseaseGeneticModifierAgms(diseaseGeneticModifierAgms); dbEntity.setDiseaseGeneticModifierRelation(dgmRelation); List diseaseQualifiers = validateDiseaseQualifiers(uiEntity, dbEntity); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java index 5d327504b..59f6552fb 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/DiseaseAnnotationDTOValidator.java @@ -135,20 +135,34 @@ public ObjectRespo if (diseaseGeneticModifierRelation == null) { daResponse.addErrorMessage("disease_genetic_modifier_relation_name", ValidationConstants.INVALID_MESSAGE + " (" + dto.getDiseaseGeneticModifierRelationName() + ")"); } - List diseaseGeneticModifiers = new ArrayList<>(); + List diseaseGeneticModifierGenes = new ArrayList<>(); + List diseaseGeneticModifierAlleles = new ArrayList<>(); + List diseaseGeneticModifierAgms = new ArrayList<>(); for (String modifierIdentifier : dto.getDiseaseGeneticModifierIdentifiers()) { BiologicalEntity diseaseGeneticModifier = biologicalEntityService.findByIdentifierString(modifierIdentifier); if (diseaseGeneticModifier == null) { daResponse.addErrorMessage("disease_genetic_modifier_identifiers", ValidationConstants.INVALID_MESSAGE + " (" + modifierIdentifier + ")"); } else { - diseaseGeneticModifiers.add(diseaseGeneticModifier); + if (diseaseGeneticModifier instanceof Gene) { + diseaseGeneticModifierGenes.add((Gene) diseaseGeneticModifier); + } else if (diseaseGeneticModifier instanceof Allele) { + diseaseGeneticModifierAlleles.add((Allele) diseaseGeneticModifier); + } else if (diseaseGeneticModifier instanceof AffectedGenomicModel) { + diseaseGeneticModifierAgms.add((AffectedGenomicModel) diseaseGeneticModifier); + } else { + daResponse.addErrorMessage("disease_genetic_modifier_identifiers", ValidationConstants.INVALID_MESSAGE + " (" + modifierIdentifier + ")"); + } } } - annotation.setDiseaseGeneticModifiers(diseaseGeneticModifiers); + annotation.setDiseaseGeneticModifierGenes(diseaseGeneticModifierGenes); + annotation.setDiseaseGeneticModifierAlleles(diseaseGeneticModifierAlleles); + annotation.setDiseaseGeneticModifierAgms(diseaseGeneticModifierAgms); annotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); } } else { - annotation.setDiseaseGeneticModifiers(null); + annotation.setDiseaseGeneticModifierGenes(null); + annotation.setDiseaseGeneticModifierAlleles(null); + annotation.setDiseaseGeneticModifierAgms(null); annotation.setDiseaseGeneticModifierRelation(null); } diff --git a/src/main/resources/db/migration/v0.37.0.62__disease_genetic_modifier_split.sql b/src/main/resources/db/migration/v0.37.0.62__disease_genetic_modifier_split.sql new file mode 100644 index 000000000..ea06da0a3 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.62__disease_genetic_modifier_split.sql @@ -0,0 +1,73 @@ +CREATE TABLE diseaseannotation_modifieragm ( + diseaseannotation_id bigint NOT NUlL, + diseasegeneticmodifieragms_id bigint NOT NULL + ); + +ALTER TABLE diseaseannotation_modifieragm + ADD CONSTRAINT diseaseannotation_modifieragm_diseaseannotation_id_fk + FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation (id); + +ALTER TABLE diseaseannotation_modifieragm + ADD CONSTRAINT diseaseannotation_modifieragm_dgmagms_id_fk + FOREIGN KEY (diseasegeneticmodifieragms_id) REFERENCES affectedgenomicmodel (id); + +INSERT INTO diseaseannotation_modifieragm (diseaseannotation_id, diseasegeneticmodifieragms_id) + SELECT diseaseannotation_id, diseasegeneticmodifiers_id + FROM diseaseannotation_biologicalentity + WHERE diseasegeneticmodifiers_id IN (SELECT id FROM affectedgenomicmodel); + +CREATE INDEX diseaseannotation_modifieragm_da_index ON diseaseannotation_modifieragm + USING btree (diseaseannotation_id); + +CREATE INDEX diseaseannotation_modifieragm_dgma_index ON diseaseannotation_modifieragm + USING btree (diseasegeneticmodifieragms_id); + +CREATE TABLE diseaseannotation_modifierallele ( + diseaseannotation_id bigint NOT NUlL, + diseasegeneticmodifieralleles_id bigint NOT NULL + ); + +ALTER TABLE diseaseannotation_modifierallele + ADD CONSTRAINT diseaseannotation_modifierallele_diseaseannotation_id_fk + FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation (id); + +ALTER TABLE diseaseannotation_modifierallele + ADD CONSTRAINT diseaseannotation_modifierallele_dgmalleles_id_fk + FOREIGN KEY (diseasegeneticmodifieralleles_id) REFERENCES allele (id); + +INSERT INTO diseaseannotation_modifierallele (diseaseannotation_id, diseasegeneticmodifieralleles_id) + SELECT diseaseannotation_id, diseasegeneticmodifiers_id + FROM diseaseannotation_biologicalentity + WHERE diseasegeneticmodifiers_id IN (SELECT id FROM allele); + +CREATE INDEX diseaseannotation_modifierallele_da_index ON diseaseannotation_modifierallele + USING btree (diseaseannotation_id); + +CREATE INDEX diseaseannotation_modifierallele_dgma_index ON diseaseannotation_modifierallele + USING btree (diseasegeneticmodifieralleles_id); + +CREATE TABLE diseaseannotation_modifiergene( + diseaseannotation_id bigint NOT NUlL, + diseasegeneticmodifiergenes_id bigint NOT NULL + ); + +ALTER TABLE diseaseannotation_modifiergene + ADD CONSTRAINT diseaseannotation_modifiergene_diseaseannotation_id_fk + FOREIGN KEY (diseaseannotation_id) REFERENCES diseaseannotation (id); + +ALTER TABLE diseaseannotation_modifiergene + ADD CONSTRAINT diseaseannotation_modifiergene_dgmgenes_id_fk + FOREIGN KEY (diseasegeneticmodifiergenes_id) REFERENCES gene (id); + +INSERT INTO diseaseannotation_modifiergene (diseaseannotation_id, diseasegeneticmodifiergenes_id) + SELECT diseaseannotation_id, diseasegeneticmodifiers_id + FROM diseaseannotation_biologicalentity + WHERE diseasegeneticmodifiers_id IN (SELECT id FROM gene); + +CREATE INDEX diseaseannotation_modifiergene_da_index ON diseaseannotation_modifiergene + USING btree (diseaseannotation_id); + +CREATE INDEX diseaseannotation_modifiergene_dgmg_index ON diseaseannotation_modifiergene + USING btree (diseasegeneticmodifiergenes_id); + +DROP TABLE diseaseannotation_biologicalentity; \ No newline at end of file diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java index 98edcd16d..ef51d1025 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java @@ -201,7 +201,7 @@ public void geneDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:Gene0002|SGD:AGM0001")). + body("entity.uniqueId", is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002|SGD:AGM0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(gene)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(alleleAndGeneRelation)). @@ -233,7 +233,9 @@ public void geneDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm:Test GOTerm:Test ChemicalTerm:Caenorhabditis elegans:Some amount:Free text")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene2)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene)). @@ -281,7 +283,7 @@ public void alleleDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Allele0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:Gene0002")). + body("entity.uniqueId", is("DATEST:Allele0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002")). body("entity.diseaseAnnotationSubject.modEntityId", is(allele)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(alleleAndGeneRelation)). @@ -313,7 +315,9 @@ public void alleleDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm:Test GOTerm:Test ChemicalTerm:Caenorhabditis elegans:Some amount:Free text")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene2)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene)). @@ -362,7 +366,7 @@ public void agmDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:AGM0001|is_model_of|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:Gene0002")). + body("entity.uniqueId", is("DATEST:AGM0001|is_model_of|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002")). body("entity.diseaseAnnotationSubject.modEntityId", is(agm)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(agmRelation)). @@ -394,7 +398,9 @@ public void agmDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm:Test GOTerm:Test ChemicalTerm:Caenorhabditis elegans:Some amount:Free text")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene2)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene)). @@ -445,7 +451,7 @@ public void geneDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception body("entity.createdBy.uniqueId", is("DATEST:Person0002")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-20T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-19T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Gene0002|is_marker_for|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:Gene0001|SGD:AGM0002")). + body("entity.uniqueId", is("DATEST:Gene0002|is_marker_for|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001|SGD:AGM0002")). body("entity.diseaseAnnotationSubject.modEntityId", is(gene2)). body("entity.diseaseAnnotationObject.curie", is(doTerm2)). body("entity.relation.name", is(geneRelation)). @@ -477,7 +483,9 @@ public void geneDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm2)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text 2")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm 2:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm 2:Test GOTerm 2:Test ChemicalTerm 2:Homo sapiens:Some amount 2:Free text 2")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene2)). @@ -525,7 +533,7 @@ public void alleleDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exceptio body("entity.createdBy.uniqueId", is("DATEST:Person0002")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-20T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-19T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Allele0002|is_implicated_in|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:Gene0001")). + body("entity.uniqueId", is("DATEST:Allele0002|is_implicated_in|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(allele2)). body("entity.diseaseAnnotationObject.curie", is(doTerm2)). body("entity.relation.name", is(alleleAndGeneRelation)). @@ -557,7 +565,9 @@ public void alleleDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exceptio body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm2)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text 2")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm 2:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm 2:Test GOTerm 2:Test ChemicalTerm 2:Homo sapiens:Some amount 2:Free text 2")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene2)). @@ -606,7 +616,7 @@ public void agmDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0002")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-20T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-19T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:AGM0002|is_exacerbated_model_of|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:Gene0001")). + body("entity.uniqueId", is("DATEST:AGM0002|is_exacerbated_model_of|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(agm2)). body("entity.diseaseAnnotationObject.curie", is(doTerm2)). body("entity.relation.name", is(agmRelation2)). @@ -638,7 +648,9 @@ public void agmDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception { body("entity.conditionRelations[0].conditions[0].conditionChemical.curie", is(chemicalTerm2)). body("entity.conditionRelations[0].conditions[0].conditionFreeText", is("Free text 2")). body("entity.conditionRelations[0].conditions[0].conditionSummary", is("Test ExperimentalConditionOntologyTerm 2:Test ExperimentalConditionOntologyTerm:Test AnatomicalTerm 2:Test GOTerm 2:Test ChemicalTerm 2:Homo sapiens:Some amount 2:Free text 2")). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(gene)). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm)). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele)). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene)). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2)). body("entity.with", hasSize(1)). body("entity.with[0].modEntityId", is(withGene2)). @@ -817,7 +829,9 @@ public void geneDiseaseAnnotationUpdateMissingNonRequiredFieldsLevel1() throws E body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). @@ -845,7 +859,9 @@ public void alleleDiseaseAnnotationUpdateMissingNonRequiredFieldsLevel1() throws body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). @@ -874,7 +890,9 @@ public void agmDiseaseAnnotationUpdateMissingNonRequiredFieldsLevel1() throws Ex body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). @@ -943,7 +961,9 @@ public void geneDiseaseAnnotationUpdateEmptyNonRequiredFieldsLevel1() throws Exc body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). @@ -971,7 +991,9 @@ public void alleleDiseaseAnnotationUpdateEmptyNonRequiredFieldsLevel1() throws E body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). @@ -1000,7 +1022,9 @@ public void agmDiseaseAnnotationUpdateEmptyNonRequiredFieldsLevel1() throws Exce body("entity", not(hasKey("geneticSex"))). body("entity", not(hasKey("secondaryDataProvider"))). body("entity", not(hasKey("conditionRelations"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("with"))). body("entity", not(hasKey("relatedNotes"))). diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java index 58fd93d20..9efcb43e0 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationITCase.java @@ -238,7 +238,9 @@ public void createGeneDiseaseAnnotation() throws Exception { diseaseAnnotation.setAnnotationType(annotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier)); diseaseAnnotation.setGeneticSex(geneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele2)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene2)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); RestAssured.given(). @@ -253,7 +255,7 @@ public void createGeneDiseaseAnnotation() throws Exception { get("/api/gene-disease-annotation/findBy/" + GENE_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("GENE:da0001|is_implicated_in|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|SGD:da0001|SGD:da0002")). + body("entity.uniqueId", is("GENE:da0001|is_implicated_in|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|SGD:da0001|ALLELE:da0002|GENE:da0002|SGD:da0002")). body("entity.modEntityId", is(GENE_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(gene.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm.getCurie())). @@ -268,7 +270,9 @@ public void createGeneDiseaseAnnotation() throws Exception { body("entity.dateCreated", is(datetime.toString())). body("entity.geneticSex.name", is(geneticSex.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2.getModEntityId())). body("entity.annotationType.name", is(annotationType.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier.getName())). body("entity.with[0].modEntityId", is(withGene.getModEntityId())). @@ -307,7 +311,9 @@ public void createAlleleDiseaseAnnotation() { diseaseAnnotation.setAnnotationType(annotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier)); diseaseAnnotation.setGeneticSex(geneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele2)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene2)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(gene); diseaseAnnotation.setAssertedGenes(List.of(gene2)); @@ -324,7 +330,7 @@ public void createAlleleDiseaseAnnotation() { get("/api/allele-disease-annotation/findBy/" + ALLELE_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("ALLELE:da0001|is_implicated_in|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|SGD:da0002")). + body("entity.uniqueId", is("ALLELE:da0001|is_implicated_in|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|ALLELE:da0002|GENE:da0002|SGD:da0002")). body("entity.modEntityId", is(ALLELE_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(allele.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm.getCurie())). @@ -339,7 +345,9 @@ public void createAlleleDiseaseAnnotation() { body("entity.dateCreated", is(datetime.toString())). body("entity.geneticSex.name", is(geneticSex.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2.getModEntityId())). body("entity.annotationType.name", is(annotationType.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier.getName())). body("entity.with[0].modEntityId", is(withGene.getModEntityId())). @@ -380,7 +388,9 @@ public void createAgmDiseaseAnnotation() { diseaseAnnotation.setAnnotationType(annotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier)); diseaseAnnotation.setGeneticSex(geneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm2)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele2)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene2)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(gene); diseaseAnnotation.setAssertedGenes(List.of(gene2)); @@ -399,7 +409,7 @@ public void createAgmDiseaseAnnotation() { get("/api/agm-disease-annotation/findBy/" + AGM_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("SGD:da0001|is_model_of|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|SGD:da0002")). + body("entity.uniqueId", is("SGD:da0001|is_model_of|false|DOID:da0001|AGRKB:100000005|ECO:da00001|HGNC:1|has_condition|ZECO:da001|severity|ameliorated_by|ALLELE:da0002|GENE:da0002|SGD:da0002")). body("entity.modEntityId", is(AGM_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(agm.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm.getCurie())). @@ -414,7 +424,9 @@ public void createAgmDiseaseAnnotation() { body("entity.dateCreated", is(datetime.toString())). body("entity.geneticSex.name", is(geneticSex.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm2.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele2.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene2.getModEntityId())). body("entity.annotationType.name", is(annotationType.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier.getName())). body("entity.with[0].modEntityId", is(withGene.getModEntityId())). @@ -458,7 +470,9 @@ public void editGeneDiseaseAnnotation() { diseaseAnnotation.setAnnotationType(annotationType2); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier2)); diseaseAnnotation.setGeneticSex(geneticSex2); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation2); Note editedNote = diseaseAnnotation.getRelatedNotes().get(0); @@ -487,7 +501,7 @@ public void editGeneDiseaseAnnotation() { get("/api/gene-disease-annotation/findBy/" + GENE_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("GENE:da0002|is_marker_for|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|SGD:da0002|SGD:da0001")). + body("entity.uniqueId", is("GENE:da0002|is_marker_for|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|SGD:da0002|ALLELE:da0001|GENE:da0001|SGD:da0001")). body("entity.modEntityId", is(GENE_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(gene2.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm2.getCurie())). @@ -502,7 +516,9 @@ public void editGeneDiseaseAnnotation() { body("entity.dateCreated", is(datetime2.toString())). body("entity.geneticSex.name", is(geneticSex2.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene.getModEntityId())). body("entity.annotationType.name", is(annotationType2.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier2.getName())). body("entity.with[0].modEntityId", is(withGene2.getModEntityId())). @@ -540,7 +556,9 @@ public void editAlleleDiseaseAnnotation() { diseaseAnnotation.setAnnotationType(annotationType2); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier2)); diseaseAnnotation.setGeneticSex(geneticSex2); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation2); diseaseAnnotation.setInferredGene(gene2); diseaseAnnotation.setAssertedGenes(List.of(gene)); @@ -571,7 +589,7 @@ public void editAlleleDiseaseAnnotation() { get("/api/allele-disease-annotation/findBy/" + ALLELE_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("ALLELE:da0002|is_implicated_in|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|SGD:da0001")). + body("entity.uniqueId", is("ALLELE:da0002|is_implicated_in|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|ALLELE:da0001|GENE:da0001|SGD:da0001")). body("entity.modEntityId", is(ALLELE_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(allele2.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm2.getCurie())). @@ -586,7 +604,9 @@ public void editAlleleDiseaseAnnotation() { body("entity.dateCreated", is(datetime2.toString())). body("entity.geneticSex.name", is(geneticSex2.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene.getModEntityId())). body("entity.annotationType.name", is(annotationType2.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier2.getName())). body("entity.with[0].modEntityId", is(withGene2.getModEntityId())). @@ -627,7 +647,9 @@ public void editAgmDiseaseAnnotation() { diseaseAnnotation.setAnnotationType(annotationType2); diseaseAnnotation.setDiseaseQualifiers(List.of(diseaseQualifier2)); diseaseAnnotation.setGeneticSex(geneticSex2); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation2); diseaseAnnotation.setInferredGene(gene2); diseaseAnnotation.setAssertedGenes(List.of(gene)); @@ -660,7 +682,7 @@ public void editAgmDiseaseAnnotation() { get("/api/agm-disease-annotation/findBy/" + AGM_DISEASE_ANNOTATION). then(). statusCode(200). - body("entity.uniqueId", is("SGD:da0002|is_exacerbated_model_of|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|SGD:da0001")). + body("entity.uniqueId", is("SGD:da0002|is_exacerbated_model_of|true|DOID:da0002|AGRKB:100000006|ECO:da00002|HGNC:2|induced_by|ZECO:da002|onset|exacerbated_by|ALLELE:da0001|GENE:da0001|SGD:da0001")). body("entity.modEntityId", is(AGM_DISEASE_ANNOTATION)). body("entity.diseaseAnnotationSubject.modEntityId", is(agm2.getModEntityId())). body("entity.diseaseAnnotationObject.curie", is(doTerm2.getCurie())). @@ -675,7 +697,9 @@ public void editAgmDiseaseAnnotation() { body("entity.dateCreated", is(datetime2.toString())). body("entity.geneticSex.name", is(geneticSex2.getName())). body("entity.diseaseGeneticModifierRelation.name", is(diseaseGeneticModifierRelation2.getName())). - body("entity.diseaseGeneticModifiers[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAgms[0].modEntityId", is(agm.getModEntityId())). + body("entity.diseaseGeneticModifierAlleles[0].modEntityId", is(allele.getModEntityId())). + body("entity.diseaseGeneticModifierGenes[0].modEntityId", is(gene.getModEntityId())). body("entity.annotationType.name", is(annotationType2.getName())). body("entity.diseaseQualifiers[0].name", is(diseaseQualifier2.getName())). body("entity.with[0].modEntityId", is(withGene2.getModEntityId())). @@ -1232,7 +1256,9 @@ public void createGeneDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); ConditionRelation newRelation = new ConditionRelation(); @@ -1254,7 +1280,7 @@ public void createGeneDiseaseAnnotationWithInvalidFields() { post("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(16))). + body("errorMessages", is(aMapWithSize(18))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1267,7 +1293,9 @@ public void createGeneDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.conditionRelations", is(String.join(" | ", List.of( "conditionRelationType - " + ValidationConstants.INVALID_MESSAGE, @@ -1295,7 +1323,9 @@ public void createAlleleDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); diseaseAnnotation.setInferredGene(nonPersistedGene); diseaseAnnotation.setAssertedGenes(List.of(nonPersistedGene)); @@ -1319,7 +1349,7 @@ public void createAlleleDiseaseAnnotationWithInvalidFields() { post("/api/allele-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(17))). + body("errorMessages", is(aMapWithSize(19))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1331,7 +1361,9 @@ public void createAlleleDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.INVALID_MESSAGE)). @@ -1361,7 +1393,9 @@ public void createAgmDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); diseaseAnnotation.setInferredGene(nonPersistedGene); diseaseAnnotation.setAssertedGenes(List.of(nonPersistedGene)); @@ -1387,7 +1421,7 @@ public void createAgmDiseaseAnnotationWithInvalidFields() { post("/api/agm-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(19))). + body("errorMessages", is(aMapWithSize(21))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1399,7 +1433,9 @@ public void createAgmDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.INVALID_MESSAGE)). @@ -1432,7 +1468,9 @@ public void editGeneDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); ConditionRelation editedRelation = diseaseAnnotation.getConditionRelations().get(0); @@ -1453,7 +1491,7 @@ public void editGeneDiseaseAnnotationWithInvalidFields() { put("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(16))). + body("errorMessages", is(aMapWithSize(18))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1466,7 +1504,9 @@ public void editGeneDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.conditionRelations", is(String.join(" | ", List.of( "conditionRelationType - " + ValidationConstants.INVALID_MESSAGE, @@ -1494,7 +1534,9 @@ public void editAlleleDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); diseaseAnnotation.setInferredGene(nonPersistedGene); diseaseAnnotation.setAssertedGenes(List.of(nonPersistedGene)); @@ -1517,7 +1559,7 @@ public void editAlleleDiseaseAnnotationWithInvalidFields() { put("/api/allele-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(17))). + body("errorMessages", is(aMapWithSize(19))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1529,7 +1571,9 @@ public void editAlleleDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.INVALID_MESSAGE)). @@ -1559,7 +1603,9 @@ public void editAgmDiseaseAnnotationWithInvalidFields() { diseaseAnnotation.setAnnotationType(diseaseQualifier); diseaseAnnotation.setDiseaseQualifiers(List.of(geneticSex)); diseaseAnnotation.setGeneticSex(annotationType); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(nonPersistedAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(nonPersistedAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(nonPersistedGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(agmRelation); diseaseAnnotation.setInferredGene(nonPersistedGene); diseaseAnnotation.setAssertedGenes(List.of(nonPersistedGene)); @@ -1584,7 +1630,7 @@ public void editAgmDiseaseAnnotationWithInvalidFields() { put("/api/agm-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(19))). + body("errorMessages", is(aMapWithSize(21))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.INVALID_MESSAGE)). @@ -1596,7 +1642,9 @@ public void editAgmDiseaseAnnotationWithInvalidFields() { body("errorMessages.annotationType", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.INVALID_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.INVALID_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.INVALID_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.INVALID_MESSAGE)). @@ -1628,7 +1676,9 @@ public void createGeneDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); ConditionRelation newRelation = new ConditionRelation(); @@ -1650,7 +1700,7 @@ public void createGeneDiseaseAnnotationWithObsoleteFields() { post("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(16))). + body("errorMessages", is(aMapWithSize(18))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1663,7 +1713,9 @@ public void createGeneDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.conditionRelations", is(String.join(" | ", List.of( "conditionRelationType - " + ValidationConstants.OBSOLETE_MESSAGE, @@ -1688,7 +1740,9 @@ public void createAlleleDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(obsoleteGene); diseaseAnnotation.setAssertedGenes(List.of(obsoleteGene)); @@ -1712,7 +1766,7 @@ public void createAlleleDiseaseAnnotationWithObsoleteFields() { post("/api/allele-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(17))). + body("errorMessages", is(aMapWithSize(19))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1724,7 +1778,9 @@ public void createAlleleDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1751,7 +1807,9 @@ public void createAgmDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(obsoleteGene); diseaseAnnotation.setAssertedGenes(List.of(obsoleteGene)); @@ -1777,7 +1835,7 @@ public void createAgmDiseaseAnnotationWithObsoleteFields() { post("/api/agm-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(19))). + body("errorMessages", is(aMapWithSize(21))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1789,7 +1847,9 @@ public void createAgmDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1821,7 +1881,9 @@ public void editGeneDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); ConditionRelation editedRelation = diseaseAnnotation.getConditionRelations().get(0); @@ -1841,7 +1903,7 @@ public void editGeneDiseaseAnnotationWithObsoleteFields() { put("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(16))). + body("errorMessages", is(aMapWithSize(18))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1854,7 +1916,9 @@ public void editGeneDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.conditionRelations", is(String.join(" | ", List.of( "conditionRelationType - " + ValidationConstants.OBSOLETE_MESSAGE, @@ -1879,7 +1943,9 @@ public void editAlleleDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(obsoleteGene); diseaseAnnotation.setAssertedGenes(List.of(obsoleteGene)); @@ -1901,7 +1967,7 @@ public void editAlleleDiseaseAnnotationWithObsoleteFields() { put("/api/allele-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(17))). + body("errorMessages", is(aMapWithSize(19))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1913,7 +1979,9 @@ public void editAlleleDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1940,7 +2008,9 @@ public void editAgmDiseaseAnnotationWithObsoleteFields() { diseaseAnnotation.setAnnotationType(obsoleteAnnotationType); diseaseAnnotation.setDiseaseQualifiers(List.of(obsoleteDiseaseQualifier)); diseaseAnnotation.setGeneticSex(obsoleteGeneticSex); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(obsoleteAgm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(obsoleteAllele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(obsoleteGene)); diseaseAnnotation.setDiseaseGeneticModifierRelation(obsoleteDiseaseGeneticModifierRelation); diseaseAnnotation.setInferredGene(obsoleteGene); diseaseAnnotation.setAssertedGenes(List.of(obsoleteGene)); @@ -1964,7 +2034,7 @@ public void editAgmDiseaseAnnotationWithObsoleteFields() { put("/api/agm-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(19))). + body("errorMessages", is(aMapWithSize(21))). body("errorMessages.diseaseAnnotationSubject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseAnnotationObject", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.relation", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -1976,7 +2046,9 @@ public void editAgmDiseaseAnnotationWithObsoleteFields() { body("errorMessages.annotationType", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseQualifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.geneticSex", is(ValidationConstants.OBSOLETE_MESSAGE)). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.OBSOLETE_MESSAGE)). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.inferredGene", is(ValidationConstants.OBSOLETE_MESSAGE)). body("errorMessages.assertedGenes", is(ValidationConstants.OBSOLETE_MESSAGE)). @@ -2043,7 +2115,9 @@ public void createDiseaseAnnotationWithMissingDependentFields() { diseaseAnnotation.setSingleReference(reference); diseaseAnnotation.setDataProvider(dataProvider); - diseaseAnnotation.setDiseaseGeneticModifiers(List.of(allele)); + diseaseAnnotation.setDiseaseGeneticModifierAgms(List.of(agm)); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(List.of(allele)); + diseaseAnnotation.setDiseaseGeneticModifierGenes(List.of(gene)); RestAssured.given(). contentType("application/json"). @@ -2052,10 +2126,14 @@ public void createDiseaseAnnotationWithMissingDependentFields() { post("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(1))). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")); - - diseaseAnnotation.setDiseaseGeneticModifiers(null); + body("errorMessages", is(aMapWithSize(3))). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")); + + diseaseAnnotation.setDiseaseGeneticModifierAgms(null); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(null); + diseaseAnnotation.setDiseaseGeneticModifierGenes(null); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); RestAssured.given(). @@ -2066,7 +2144,7 @@ public void createDiseaseAnnotationWithMissingDependentFields() { then(). statusCode(400). body("errorMessages", is(aMapWithSize(1))). - body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifiers")); + body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierGenes / diseaseGeneticModifierAlleles / diseaseGeneticModifierAgms")); } @@ -2083,11 +2161,15 @@ public void editDiseaseAnnotationWithMissingDependentFields() { put("/api/gene-disease-annotation"). then(). statusCode(400). - body("errorMessages", is(aMapWithSize(1))). - body("errorMessages.diseaseGeneticModifiers", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")); + body("errorMessages", is(aMapWithSize(3))). + body("errorMessages.diseaseGeneticModifierAgms", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")). + body("errorMessages.diseaseGeneticModifierAlleles", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")). + body("errorMessages.diseaseGeneticModifierGenes", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierRelation")); diseaseAnnotation.setDiseaseGeneticModifierRelation(diseaseGeneticModifierRelation); - diseaseAnnotation.setDiseaseGeneticModifiers(null); + diseaseAnnotation.setDiseaseGeneticModifierAgms(null); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(null); + diseaseAnnotation.setDiseaseGeneticModifierGenes(null); RestAssured.given(). contentType("application/json"). @@ -2097,7 +2179,7 @@ public void editDiseaseAnnotationWithMissingDependentFields() { then(). statusCode(400). body("errorMessages", is(aMapWithSize(1))). - body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifiers")); + body("errorMessages.diseaseGeneticModifierRelation", is(ValidationConstants.DEPENDENCY_MESSAGE_PREFIX + "diseaseGeneticModifierGenes / diseaseGeneticModifierAlleles / diseaseGeneticModifierAgms")); } @@ -2226,7 +2308,9 @@ public void editGeneDiseaseAnnotationWithNullNonRequiredFieldsLevel() { diseaseAnnotation.setAnnotationType(null); diseaseAnnotation.setDiseaseQualifiers(null); diseaseAnnotation.setGeneticSex(null); - diseaseAnnotation.setDiseaseGeneticModifiers(null); + diseaseAnnotation.setDiseaseGeneticModifierAgms(null); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(null); + diseaseAnnotation.setDiseaseGeneticModifierGenes(null); diseaseAnnotation.setDiseaseGeneticModifierRelation(null); diseaseAnnotation.setConditionRelations(null); diseaseAnnotation.setRelatedNotes(null); @@ -2251,7 +2335,9 @@ public void editGeneDiseaseAnnotationWithNullNonRequiredFieldsLevel() { body("entity", not(hasKey("annotationType"))). body("entity", not(hasKey("diseaseQualifiers"))). body("entity", not(hasKey("geneticSex"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("conditionRelations"))). body("entity", not(hasKey("relatedNotes"))); @@ -2267,7 +2353,9 @@ public void editAlleleDiseaseAnnotationWithNullNonRequiredFieldsLevel() { diseaseAnnotation.setAnnotationType(null); diseaseAnnotation.setDiseaseQualifiers(null); diseaseAnnotation.setGeneticSex(null); - diseaseAnnotation.setDiseaseGeneticModifiers(null); + diseaseAnnotation.setDiseaseGeneticModifierAgms(null); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(null); + diseaseAnnotation.setDiseaseGeneticModifierGenes(null); diseaseAnnotation.setDiseaseGeneticModifierRelation(null); diseaseAnnotation.setConditionRelations(null); diseaseAnnotation.setRelatedNotes(null); @@ -2293,7 +2381,9 @@ public void editAlleleDiseaseAnnotationWithNullNonRequiredFieldsLevel() { body("entity", not(hasKey("annotationType"))). body("entity", not(hasKey("diseaseQualifiers"))). body("entity", not(hasKey("geneticSex"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("conditionRelations"))). body("entity", not(hasKey("relatedNotes"))). @@ -2311,7 +2401,9 @@ public void editAgmDiseaseAnnotationWithNullNonRequiredFieldsLevel() { diseaseAnnotation.setAnnotationType(null); diseaseAnnotation.setDiseaseQualifiers(null); diseaseAnnotation.setGeneticSex(null); - diseaseAnnotation.setDiseaseGeneticModifiers(null); + diseaseAnnotation.setDiseaseGeneticModifierAgms(null); + diseaseAnnotation.setDiseaseGeneticModifierAlleles(null); + diseaseAnnotation.setDiseaseGeneticModifierGenes(null); diseaseAnnotation.setDiseaseGeneticModifierRelation(null); diseaseAnnotation.setConditionRelations(null); diseaseAnnotation.setRelatedNotes(null); @@ -2339,7 +2431,9 @@ public void editAgmDiseaseAnnotationWithNullNonRequiredFieldsLevel() { body("entity", not(hasKey("annotationType"))). body("entity", not(hasKey("diseaseQualifiers"))). body("entity", not(hasKey("geneticSex"))). - body("entity", not(hasKey("diseaseGeneticModifiers"))). + body("entity", not(hasKey("diseaseGeneticModifierAgms"))). + body("entity", not(hasKey("diseaseGeneticModifierAlleles"))). + body("entity", not(hasKey("diseaseGeneticModifierGenes"))). body("entity", not(hasKey("diseaseGeneticModifierRelation"))). body("entity", not(hasKey("conditionRelations"))). body("entity", not(hasKey("relatedNotes"))). diff --git a/src/test/resources/bulk/04_disease_annotation/AF_01_all_fields_gene_annotation.json b/src/test/resources/bulk/04_disease_annotation/AF_01_all_fields_gene_annotation.json index 34b0a2b0e..34eaac35a 100644 --- a/src/test/resources/bulk/04_disease_annotation/AF_01_all_fields_gene_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/AF_01_all_fields_gene_annotation.json @@ -73,7 +73,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0002" + "DATEST:Gene0002", + "DATEST:Allele0002", + "DATEST:AGM0002" ], "disease_genetic_modifier_relation_name": "ameliorated_by", "with_gene_identifiers": [ diff --git a/src/test/resources/bulk/04_disease_annotation/AF_02_all_fields_allele_annotation.json b/src/test/resources/bulk/04_disease_annotation/AF_02_all_fields_allele_annotation.json index e9eb039a5..30b884705 100644 --- a/src/test/resources/bulk/04_disease_annotation/AF_02_all_fields_allele_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/AF_02_all_fields_allele_annotation.json @@ -73,7 +73,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0002" + "DATEST:Gene0002", + "DATEST:Allele0002", + "DATEST:AGM0002" ], "disease_genetic_modifier_relation_name": "ameliorated_by", "with_gene_identifiers": [ diff --git a/src/test/resources/bulk/04_disease_annotation/AF_03_all_fields_agm_annotation.json b/src/test/resources/bulk/04_disease_annotation/AF_03_all_fields_agm_annotation.json index abcb54cc5..86b0bd796 100644 --- a/src/test/resources/bulk/04_disease_annotation/AF_03_all_fields_agm_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/AF_03_all_fields_agm_annotation.json @@ -73,7 +73,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0002" + "DATEST:Gene0002", + "DATEST:Allele0002", + "DATEST:AGM0002" ], "disease_genetic_modifier_relation_name": "ameliorated_by", "with_gene_identifiers": [ diff --git a/src/test/resources/bulk/04_disease_annotation/UD_01_update_all_except_default_fields_gene_annotation.json b/src/test/resources/bulk/04_disease_annotation/UD_01_update_all_except_default_fields_gene_annotation.json index 9c54c14e4..bd50ea07d 100644 --- a/src/test/resources/bulk/04_disease_annotation/UD_01_update_all_except_default_fields_gene_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/UD_01_update_all_except_default_fields_gene_annotation.json @@ -66,7 +66,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0001" + "DATEST:Gene0001", + "DATEST:Allele0001", + "DATEST:AGM0001" ], "disease_genetic_modifier_relation_name": "exacerbated_by", "with_gene_identifiers": [ diff --git a/src/test/resources/bulk/04_disease_annotation/UD_02_update_all_except_default_fields_allele_annotation.json b/src/test/resources/bulk/04_disease_annotation/UD_02_update_all_except_default_fields_allele_annotation.json index ffd5920ad..c661fb381 100644 --- a/src/test/resources/bulk/04_disease_annotation/UD_02_update_all_except_default_fields_allele_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/UD_02_update_all_except_default_fields_allele_annotation.json @@ -66,7 +66,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0001" + "DATEST:Gene0001", + "DATEST:Allele0001", + "DATEST:AGM0001" ], "disease_genetic_modifier_relation_name": "exacerbated_by", "with_gene_identifiers": [ diff --git a/src/test/resources/bulk/04_disease_annotation/UD_03_update_all_except_default_fields_agm_annotation.json b/src/test/resources/bulk/04_disease_annotation/UD_03_update_all_except_default_fields_agm_annotation.json index f0cc1fe3f..b8836be43 100644 --- a/src/test/resources/bulk/04_disease_annotation/UD_03_update_all_except_default_fields_agm_annotation.json +++ b/src/test/resources/bulk/04_disease_annotation/UD_03_update_all_except_default_fields_agm_annotation.json @@ -66,7 +66,9 @@ } ], "disease_genetic_modifier_identifiers": [ - "DATEST:Gene0001" + "DATEST:Gene0001", + "DATEST:Allele0001", + "DATEST:AGM0001" ], "disease_genetic_modifier_relation_name": "exacerbated_by", "with_gene_identifiers": [ From b37c7700c6f3fc1389caa2559b1708f6025d1f8e Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 24 Oct 2024 11:59:16 +0100 Subject: [PATCH 317/342] Update UI for diseaseGeneticModifier split --- .../GeneticModifierAgmsAdditionalFieldData.js | 16 ++ ...neticModifierAllelesAdditionalFieldData.js | 20 +++ ...GeneticModifierGenesAdditionalFieldData.js | 20 +++ .../GeneticModifiersAdditionalFieldData.js | 33 ---- src/main/cliapp/src/constants/FilterFields.js | 37 +++- src/main/cliapp/src/constants/SortFields.js | 4 +- .../DiseaseAnnotationsTable.js | 162 +++++++++++++++--- .../NewAnnotationForm.js | 134 +++++++++++++-- .../__tests__/DiseaseAnnotationsTable.test.js | 6 + .../mockData/mockData.js | 4 +- .../useNewAnnotationReducer.js | 12 +- .../cliapp/src/service/TableStateService.js | 24 ++- 12 files changed, 378 insertions(+), 94 deletions(-) create mode 100644 src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js create mode 100644 src/main/cliapp/src/components/FieldData/GeneticModifierAllelesAdditionalFieldData.js create mode 100644 src/main/cliapp/src/components/FieldData/GeneticModifierGenesAdditionalFieldData.js delete mode 100644 src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js new file mode 100644 index 000000000..07c196dd9 --- /dev/null +++ b/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js @@ -0,0 +1,16 @@ +import React from 'react'; +import { getIdentifier } from '../../utils/utils'; + +export function GeneticModifierAgmsAdditionalFieldData({ fieldData }) { + let ret = []; + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + if (getIdentifier(fieldData[i]) !== '') { + ret.push( +
+ ); + } + } + } + return ret; +} diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifierAllelesAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifierAllelesAdditionalFieldData.js new file mode 100644 index 000000000..8db528abf --- /dev/null +++ b/src/main/cliapp/src/components/FieldData/GeneticModifierAllelesAdditionalFieldData.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { getIdentifier } from '../../utils/utils'; + +export function GeneticModifierAllelesAdditionalFieldData({ fieldData }) { + let ret = []; + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + if (getIdentifier(fieldData[i]) !== '') { + ret.push( +
+ ); + } + } + } + return ret; +} diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifierGenesAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifierGenesAdditionalFieldData.js new file mode 100644 index 000000000..174ebf8c1 --- /dev/null +++ b/src/main/cliapp/src/components/FieldData/GeneticModifierGenesAdditionalFieldData.js @@ -0,0 +1,20 @@ +import React from 'react'; +import { getIdentifier } from '../../utils/utils'; + +export function GeneticModifierGenesAdditionalFieldData({ fieldData }) { + let ret = []; + if (fieldData && fieldData.length > 0) { + for (let i = 0; i < fieldData.length; i++) { + if (getIdentifier(fieldData[i]) !== '') { + ret.push( +
+ ); + } + } + } + return ret; +} diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js deleted file mode 100644 index fd0d27684..000000000 --- a/src/main/cliapp/src/components/FieldData/GeneticModifiersAdditionalFieldData.js +++ /dev/null @@ -1,33 +0,0 @@ -import React from 'react'; -import { getIdentifier } from '../../utils/utils'; - -export function GeneticModifiersAdditionalFieldData({ fieldData }) { - let ret = []; - if (fieldData && fieldData.length > 0) { - for (let i = 0; i < fieldData.length; i++) { - if (getIdentifier(fieldData[i]) !== '') { - if (fieldData[i]['type'] === 'Gene') - ret.push( -
- ); - else if (fieldData[i]['type'] === 'Allele') - ret.push( -
- ); - else if (fieldData[i]['type'] === 'AffectedGenomicModel') - ret.push( -
- ); - } - } - } - return ret; -} diff --git a/src/main/cliapp/src/constants/FilterFields.js b/src/main/cliapp/src/constants/FilterFields.js index b75e08beb..818749be8 100644 --- a/src/main/cliapp/src/constants/FilterFields.js +++ b/src/main/cliapp/src/constants/FilterFields.js @@ -326,14 +326,33 @@ export const FIELD_SETS = Object.freeze({ filterName: 'geneSystematicNameFilter', fields: ['geneSystematicName.displayText', 'geneSystematicName.formatText'], }, - geneticModifiersFieldSet: { - filterName: 'geneticModifiersFilter', + geneticModifierAgmsFieldSet: { + filterName: 'geneticModifierAgmsFilter', fields: [ - 'diseaseGeneticModifiers.symbol', - 'diseaseGeneticModifiers.name', - 'diseaseGeneticModifiers.curie', - 'diseaseGeneticModifiers.modEntityId', - 'diseaseGeneticModifiers.modInternalId', + 'diseaseGeneticModifierAgms.name', + 'diseaseGeneticModifierAgms.curie', + 'diseaseGeneticModifierAgms.modEntityId', + 'diseaseGeneticModifierAgms.modInternalId', + ], + }, + geneticModifierAllelesFieldSet: { + filterName: 'geneticModifierAllelesFilter', + fields: [ + 'diseaseGeneticModifierAlleles.alleleSymbol.displayText', + 'diseaseGeneticModifierAlleles.alleleSymbol.formatText', + 'diseaseGeneticModifierAlleles.curie', + 'diseaseGeneticModifierAlleles.modEntityId', + 'diseaseGeneticModifierAlleles.modInternalId', + ], + }, + geneticModifierGenesFieldSet: { + filterName: 'geneticModifierGenesFilter', + fields: [ + 'diseaseGeneticModifierGenes.geneSymbol.displayText', + 'diseaseGeneticModifierGenes.geneSymbol.formatText', + 'diseaseGeneticModifierGenes.curie', + 'diseaseGeneticModifierGenes.modEntityId', + 'diseaseGeneticModifierGenes.modInternalId', ], }, geneticModifierRelationFieldSet: { @@ -793,7 +812,9 @@ export const FILTER_CONFIGS = Object.freeze({ geneSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSynonymsFieldSet] }, geneSystematicNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSystematicNameFieldSet] }, geneTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneTypeFieldSet] }, - geneticModifiersFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifiersFieldSet] }, + geneticModifierAgmsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierAgmsFieldSet] }, + geneticModifierAllelesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierAllelesFieldSet] }, + geneticModifierGenesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierGenesFieldSet] }, idExampleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idExampleFieldSet] }, idPatternFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idPatternFieldSet] }, inchiFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inchiFieldSet] }, diff --git a/src/main/cliapp/src/constants/SortFields.js b/src/main/cliapp/src/constants/SortFields.js index 4e7f7ed92..a9fe4ed27 100644 --- a/src/main/cliapp/src/constants/SortFields.js +++ b/src/main/cliapp/src/constants/SortFields.js @@ -19,7 +19,9 @@ export const SORT_FIELDS = Object.freeze([ 'sgdStrainBackground.name', 'annotationType.name', 'diseaseGeneticModifierRelation.name', - 'diseaseGeneticModifiers.symbol', + 'diseaseGeneticModifierAgms.name', + 'diseaseGeneticModifierAlleles.alleleSymbol.displayText', + 'diseaseGeneticModifierGenes.geneSymbol.displayText', 'inferredGene.geneSymbol.displayText', 'assertedGenes.geneSymbol.displayText', 'inferredAllele.alleleSymbol.displayText', diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index c927c9266..94aa32221 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -627,11 +627,116 @@ export const DiseaseAnnotationsTable = () => { ); }; - const onGeneticModifiersValueChange = (event, setFieldValue, props) => { - multipleAutocompleteOnChange(props, event, 'diseaseGeneticModifiers', setFieldValue); + const onGeneticModifierAgmsValueChange = (event, setFieldValue, props) => { + multipleAutocompleteOnChange(props, event, 'diseaseGeneticModifierAgms', setFieldValue); }; - const geneticModifiersSearch = (event, setFiltered, setInputValue) => { + const geneticModifierAgmsSearch = (event, setFiltered, setInputValue) => { + const autocompleteFields = [ + 'name', + 'curie', + 'modEntityId', + 'modInternalId', + 'crossReferences.referencedCurie', + ]; + const endpoint = 'agm'; + const filterName = 'geneticModifierAgmsFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); + setInputValue(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); + }; + + const geneticModifierAgmsEditorTemplate = (props) => { + return ( + <> + ( + + )} + onValueChangeHandler={onGeneticModifierAgmsValueChange} + /> + + + + ); + }; + + const onGeneticModifierAllelesValueChange = (event, setFieldValue, props) => { + multipleAutocompleteOnChange(props, event, 'diseaseGeneticModifierAlleles', setFieldValue); + }; + + const geneticModifierAllelesSearch = (event, setFiltered, setInputValue) => { + const autocompleteFields = [ + 'alleleSymbol.formatText', + 'alleleFullName.formatText', + 'alleleFullName.displayText', + 'alleleSynonyms.formatText', + 'alleleSynonyms.displayText', + 'curie', + 'modEntityId', + 'modInternalId', + 'crossReferences.referencedCurie', + 'alleleSecondaryIds.secondaryId', + ]; + const endpoint = 'allele'; + const filterName = 'geneticModifierAllelesFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); + setInputValue(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); + }; + + const geneticModifierAllelesEditorTemplate = (props) => { + return ( + <> + ( + + )} + onValueChangeHandler={onGeneticModifierAllelesValueChange} + /> + + + + ); + }; + + const onGeneticModifierGenesValueChange = (event, setFieldValue, props) => { + multipleAutocompleteOnChange(props, event, 'diseaseGeneticModifierGenes', setFieldValue); + }; + + const geneticModifierGenesSearch = (event, setFiltered, setInputValue) => { const autocompleteFields = [ 'geneSymbol.formatText', 'geneSymbol.displayText', @@ -642,33 +747,26 @@ export const DiseaseAnnotationsTable = () => { 'geneSystematicName.formatText', 'geneSystematicName.displayText', 'geneSecondaryIds.secondaryId', - 'alleleSymbol.formatText', - 'alleleFullName.formatText', - 'alleleFullName.displayText', - 'alleleSynonyms.formatText', - 'alleleSynonyms.displayText', - 'name', 'curie', 'modEntityId', 'modInternalId', 'crossReferences.referencedCurie', - 'alleleSecondaryIds.secondaryId', ]; - const endpoint = 'biologicalentity'; - const filterName = 'geneticModifiersFilter'; + const endpoint = 'gene'; + const filterName = 'geneticModifierGenesFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setInputValue(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); }; - const geneticModifiersEditorTemplate = (props) => { + const geneticModifierGenesEditorTemplate = (props) => { return ( <> ( { query={query} /> )} - onValueChangeHandler={onGeneticModifiersValueChange} + onValueChangeHandler={onGeneticModifierGenesValueChange} /> ); @@ -1190,12 +1288,28 @@ export const DiseaseAnnotationsTable = () => { editor: (props) => geneticModifierRelationEditor(props), }, { - field: 'diseaseGeneticModifiers.symbol', - header: 'Genetic Modifiers', - body: (rowData) => , + field: 'diseaseGeneticModifierAgms.name', + header: 'Genetic Modifier AGMs', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.geneticModifierAgmsFilterConfig, + editor: (props) => geneticModifierAgmsEditorTemplate(props), + }, + { + field: 'diseaseGeneticModifierAlleles.alleleSymbol.displayText', + header: 'Genetic Modifier Alleles', + body: (rowData) => , + sortable: true, + filterConfig: FILTER_CONFIGS.geneticModifierAllelesFilterConfig, + editor: (props) => geneticModifierAllelesEditorTemplate(props), + }, + { + field: 'diseaseGeneticModifierGenes.geneSymbol.displayText', + header: 'Genetic Modifier Genes', + body: (rowData) => , sortable: true, - filterConfig: FILTER_CONFIGS.geneticModifiersFilterConfig, - editor: (props) => geneticModifiersEditorTemplate(props), + filterConfig: FILTER_CONFIGS.geneticModifierGenesFilterConfig, + editor: (props) => geneticModifierGenesEditorTemplate(props), }, { field: 'inferredGene.geneSymbol.displayText', diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js index 8f54d5921..42894c5bd 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js @@ -36,7 +36,9 @@ import { SGDStrainBackgroundAdditionalFieldData } from '../../components/FieldDa import { AssertedGenesAdditionalFieldData } from '../../components/FieldData/AssertedGenesAdditionalFieldData'; import { EvidenceCodesAdditionalFieldData } from '../../components/FieldData/EvidenceCodesAdditionalFieldData'; import { WithAdditionalFieldData } from '../../components/FieldData/WithAdditionalFieldData'; -import { GeneticModifiersAdditionalFieldData } from '../../components/FieldData/GeneticModifiersAdditionalFieldData'; +import { GeneticModifierAgmsAdditionalFieldData } from '../../components/FieldData/GeneticModifierAgmsAdditionalFieldData'; +import { GeneticModifierAllelesAdditionalFieldData } from '../../components/FieldData/GeneticModifierAllelesAdditionalFieldData'; +import { GeneticModifierGenesAdditionalFieldData } from '../../components/FieldData/GeneticModifierGenesAdditionalFieldData'; import ErrorBoundary from '../../components/Error/ErrorBoundary'; import { ConfirmButton } from '../../components/ConfirmButton'; import { getDefaultFormState, getModFormFields } from '../../service/TableStateService'; @@ -94,7 +96,9 @@ export const NewAnnotationForm = ({ 'SGD Strain Background', 'Annotation Type', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Internal', ]; const oktaToken = JSON.parse(localStorage.getItem('okta-token-storage')); @@ -232,23 +236,51 @@ export const NewAnnotationForm = ({ autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered, otherFilters); }; - const geneticModifiersSearch = (event, setFiltered, setQuery) => { + const geneticModifierAgmsSearch = (event, setFiltered, setQuery) => { + const autocompleteFields = [ + 'modEntityId', + 'modInternalId', + 'name', + 'curie', + 'crossReferences.referencedCurie', + ]; + const endpoint = 'agm'; + const filterName = 'geneticModifierAgmsFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); + setQuery(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); + }; + + const geneticModifierAllelesSearch = (event, setFiltered, setQuery) => { const autocompleteFields = [ - 'geneSymbol.displayText', - 'geneFullName.displayText', 'alleleSymbol.displayText', 'alleleFullName.displayText', 'modEntityId', 'modInternalId', - 'name', 'curie', 'crossReferences.referencedCurie', 'alleleSecondaryIds.secondaryId', - 'geneSynonyms.displayText', 'alleleSynonyms.displayText', ]; - const endpoint = 'biologicalentity'; - const filterName = 'geneticModifiersFilter'; + const endpoint = 'allele'; + const filterName = 'geneticModifierAllelesFilter'; + const filter = buildAutocompleteFilter(event, autocompleteFields); + setQuery(event.query); + autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); + }; + + const geneticModifierGenesSearch = (event, setFiltered, setQuery) => { + const autocompleteFields = [ + 'geneSymbol.displayText', + 'geneFullName.displayText', + 'modEntityId', + 'modInternalId', + 'curie', + 'crossReferences.referencedCurie', + 'geneSynonyms.displayText', + ]; + const endpoint = 'gene'; + const filterName = 'geneticModifierGenesFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); setQuery(event.query); autocompleteSearch(searchService, endpoint, filterName, filter, setFiltered); @@ -1027,18 +1059,84 @@ export const NewAnnotationForm = ({ )} - {selectedFormFields?.includes('Genetic Modifiers') && ( + {selectedFormFields?.includes('Genetic Modifier AGMs') && ( + <> +
+
+ +
+
+ ( + + )} + onValueChangeHandler={onArrayFieldChange} + classNames={classNames({ 'p-invalid': submitted && errorMessages.diseaseGeneticModifierAgms })} + /> +
+
+ + +
+
+ + )} + + {selectedFormFields?.includes('Genetic Modifier Alleles') && ( + <> +
+
+ +
+
+ ( + + )} + onValueChangeHandler={onArrayFieldChange} + classNames={classNames({ 'p-invalid': submitted && errorMessages.diseaseGeneticModifierAlleles })} + /> +
+
+ + +
+
+ + )} + + {selectedFormFields?.includes('Genetic Modifier Genes') && ( <>
- +
( )} onValueChangeHandler={onArrayFieldChange} - classNames={classNames({ 'p-invalid': submitted && errorMessages.diseaseGeneticModifiers })} + classNames={classNames({ 'p-invalid': submitted && errorMessages.diseaseGeneticModifierGenes })} />
- - + +
diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js index 7d332cfd8..2fd3cb844 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/__tests__/DiseaseAnnotationsTable.test.js @@ -59,6 +59,9 @@ describe('', () => { const geneticSexTd = await result.findByText('genetic sex test'); const sgdStrainBackgroundTd = await result.findByText('SGD Strain Background test (sgd test curie)'); const diseaseGeneticModifierRelationTd = await result.findByText('disease genetic modifier relation test'); + const diseaseGeneticModifierAgmsTd = await result.findByText('DGM AGM test (WB:DGM1)'); + const diseaseGeneticModifierAllelesTd = await result.findByText('DGM Allele test (WB:DGM2)'); + const diseaseGeneticModifierGenesTd = await result.findByText('DGM Gene test (WB:DGM3)'); const secondaryDataProviderTd = await result.findByText('test provider'); const updatedByCreatedByArray = await result.findAllByText('MGI:curation_staff'); @@ -85,6 +88,9 @@ describe('', () => { expect(sgdStrainBackgroundTd).toBeInTheDocument(); expect(diseaseQualifiersTd).toBeInTheDocument(); expect(diseaseGeneticModifierRelationTd).toBeInTheDocument(); + expect(diseaseGeneticModifierAgmsTd).toBeInTheDocument(); + expect(diseaseGeneticModifierAllelesTd).toBeInTheDocument(); + expect(diseaseGeneticModifierGenesTd).toBeInTheDocument(); expect(secondaryDataProviderTd).toBeInTheDocument(); expect(updatedByCreatedByArray.length).toEqual(2); expect(dateUpdatedDateCreatedArray.length).toEqual(2); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js index 7cc7b0344..bdda33efa 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js @@ -58,7 +58,9 @@ export const data = { curie: 'sgd test curie', name: 'SGD Strain Background test', }, - diseaseGeneticModifiers: [{ symbol: 'disease genetic modifier test' }], + diseaseGeneticModifierAgms: [{ name: 'DGM AGM test', modEntityId: 'WB:DGM1' }], + diseaseGeneticModifierAlleles: [{ modEntityId: 'WB:DGM2', alleleSymbol: { displayText: 'DGM Allele test' }}], + diseaseGeneticModifierGenes: [{ modEntityId: 'WB:DGM3', geneSymbol: { displayText: 'DGM Gene test' }}], diseaseQualifiers: [{ name: 'disease qualifiers test' }], dateCreated: '2017-06-08T14:15:35Z', dateUpdated: '2017-06-08T14:15:35Z', diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js index 78bc721e9..6c2a2b0b3 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/useNewAnnotationReducer.js @@ -26,7 +26,9 @@ const DEFAULT_ANNOTATION = { sgdStrainBackground: null, annotationType: null, diseaseGeneticModifierRelation: null, - diseaseGeneticModifiers: [], + diseaseGeneticModifierAgm: [], + diseaseGeneticModifierAlleles: [], + diseaseGeneticModifierGenes: [], internal: false, }; const initialNewAnnotationState = { @@ -68,8 +70,12 @@ const buildAnnotation = (rowData) => { diseaseGeneticModifierRelation: global.structuredClone(rowData.diseaseGeneticModifierRelation) || DEFAULT_ANNOTATION.diseaseGeneticModifierRelation, - diseaseGeneticModifiers: - global.structuredClone(rowData.diseaseGeneticModifiers) || DEFAULT_ANNOTATION.diseaseGeneticModifiers, + diseaseGeneticModifierAgms: + global.structuredClone(rowData.diseaseGeneticModifierAgms) || DEFAULT_ANNOTATION.diseaseGeneticModifierAgms, + diseaseGeneticModifierAlleles: + global.structuredClone(rowData.diseaseGeneticModifierAlleles) || DEFAULT_ANNOTATION.diseaseGeneticModifierAlleles, + diseaseGeneticModifierGenes: + global.structuredClone(rowData.diseaseGeneticModifierGenes) || DEFAULT_ANNOTATION.diseaseGeneticModifierGenes, internal: rowData.internal || DEFAULT_ANNOTATION.internal, }; }; diff --git a/src/main/cliapp/src/service/TableStateService.js b/src/main/cliapp/src/service/TableStateService.js index 29a5c812e..9d7529b70 100644 --- a/src/main/cliapp/src/service/TableStateService.js +++ b/src/main/cliapp/src/service/TableStateService.js @@ -123,7 +123,9 @@ const modTableSettings = { 'Experimental Conditions', 'Genetic Sex', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Data Provider', 'Updated By', 'Date Updated', @@ -143,7 +145,9 @@ const modTableSettings = { 'Experimental Conditions', 'Genetic Sex', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Asserted Genes', ], filters: { @@ -176,7 +180,9 @@ const modTableSettings = { 'Evidence Code', 'Inferred Gene', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Related Notes', 'Data Provider', 'Updated By', @@ -193,7 +199,9 @@ const modTableSettings = { 'Evidence Code', 'Related Notes', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', ], filters: { dataProviderFilter: { @@ -360,7 +368,9 @@ const modTableSettings = { 'SGD Strain Background', 'Annotation Type', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Inferred Gene', 'Asserted Genes', 'Inferred Allele', @@ -387,7 +397,9 @@ const modTableSettings = { 'SGD Strain Background', 'Annotation Type', 'Genetic Modifier Relation', - 'Genetic Modifiers', + 'Genetic Modifier AGMs', + 'Genetic Modifier Alleles', + 'Genetic Modifier Genes', 'Internal', ], filters: { From a0bf163364e749a7bc99b841b2ba84bc6509a03c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 24 Oct 2024 12:05:16 +0100 Subject: [PATCH 318/342] Split long lines --- .../DiseaseAnnotationBulkUploadITCase.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java index ef51d1025..2ed4efb54 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java @@ -201,7 +201,8 @@ public void geneDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002|SGD:AGM0001")). + body("entity.uniqueId", + is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002|SGD:AGM0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(gene)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(alleleAndGeneRelation)). @@ -283,7 +284,8 @@ public void alleleDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Allele0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002")). + body("entity.uniqueId", + is("DATEST:Allele0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002")). body("entity.diseaseAnnotationSubject.modEntityId", is(allele)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(alleleAndGeneRelation)). @@ -451,7 +453,8 @@ public void geneDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception body("entity.createdBy.uniqueId", is("DATEST:Person0002")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-20T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-19T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:Gene0002|is_marker_for|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001|SGD:AGM0002")). + body("entity.uniqueId", + is("DATEST:Gene0002|is_marker_for|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001|SGD:AGM0002")). body("entity.diseaseAnnotationSubject.modEntityId", is(gene2)). body("entity.diseaseAnnotationObject.curie", is(doTerm2)). body("entity.relation.name", is(geneRelation)). @@ -616,7 +619,8 @@ public void agmDiseaseAnnotationBulkUploadUpdateCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0002")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-20T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-19T22:10:12Z").toString())). - body("entity.uniqueId", is("DATEST:AGM0002|is_exacerbated_model_of|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001")). + body("entity.uniqueId", + is("DATEST:AGM0002|is_exacerbated_model_of|false|DATEST:Disease0002|AGRKB:000000021|DATEST:Evidence0002|HGNC:0002|induced_by|DATEST:ExpCondTerm0003|DATEST:ExpCondTerm0001|DATEST:AnatomyTerm0002|DATEST:ChemicalTerm0002|DATEST:GOTerm0002|NCBITaxon:9606|Some amount 2|Free text 2|severity|exacerbated_by|DATEST:AGM0001|DATEST:Allele0001|DATEST:Gene0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(agm2)). body("entity.diseaseAnnotationObject.curie", is(doTerm2)). body("entity.relation.name", is(agmRelation2)). From 25d427c479bce95d7466b2feb350768242daaf78 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 24 Oct 2024 12:08:32 +0100 Subject: [PATCH 319/342] Split long string --- .../curation_api/DiseaseAnnotationBulkUploadITCase.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java index 2ed4efb54..bda9fcd2a 100644 --- a/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/DiseaseAnnotationBulkUploadITCase.java @@ -201,8 +201,8 @@ public void geneDiseaseAnnotationBulkUploadCheckFields() throws Exception { body("entity.createdBy.uniqueId", is("DATEST:Person0001")). body("entity.dateUpdated", is(OffsetDateTime.parse("2022-03-10T22:10:12Z").toString())). body("entity.dateCreated", is(OffsetDateTime.parse("2022-03-09T22:10:12Z").toString())). - body("entity.uniqueId", - is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002|SGD:AGM0001")). + body("entity.uniqueId", is("DATEST:Gene0001|is_implicated_in|true|DATEST:Disease0001|AGRKB:000000002|DATEST:Evidence0001|HGNC:0001|" + + "exacerbated_by|DATEST:ExpCondTerm0001|DATEST:ExpCondTerm0002|DATEST:AnatomyTerm0001|DATEST:ChemicalTerm0001|DATEST:GOTerm0001|NCBITaxon:6239|Some amount|Free text|susceptibility|ameliorated_by|DATEST:AGM0002|DATEST:Allele0002|DATEST:Gene0002|SGD:AGM0001")). body("entity.diseaseAnnotationSubject.modEntityId", is(gene)). body("entity.diseaseAnnotationObject.curie", is(doTerm)). body("entity.relation.name", is(alleleAndGeneRelation)). From ae87c79036fe2b82edbdfc3d203cbdce1fe6de5f Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Thu, 24 Oct 2024 12:11:06 +0100 Subject: [PATCH 320/342] Prettify UI code --- .../GeneticModifierAgmsAdditionalFieldData.js | 4 +-- src/main/cliapp/src/constants/FilterFields.js | 15 ++++++++--- .../DiseaseAnnotationsTable.js | 8 +----- .../NewAnnotationForm.js | 27 +++++++++++-------- .../mockData/mockData.js | 4 +-- 5 files changed, 32 insertions(+), 26 deletions(-) diff --git a/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js b/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js index 07c196dd9..dbec8d1b9 100644 --- a/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js +++ b/src/main/cliapp/src/components/FieldData/GeneticModifierAgmsAdditionalFieldData.js @@ -6,9 +6,7 @@ export function GeneticModifierAgmsAdditionalFieldData({ fieldData }) { if (fieldData && fieldData.length > 0) { for (let i = 0; i < fieldData.length; i++) { if (getIdentifier(fieldData[i]) !== '') { - ret.push( -
- ); + ret.push(
); } } } diff --git a/src/main/cliapp/src/constants/FilterFields.js b/src/main/cliapp/src/constants/FilterFields.js index 818749be8..acc2a8c70 100644 --- a/src/main/cliapp/src/constants/FilterFields.js +++ b/src/main/cliapp/src/constants/FilterFields.js @@ -812,9 +812,18 @@ export const FILTER_CONFIGS = Object.freeze({ geneSynonymsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSynonymsFieldSet] }, geneSystematicNameFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneSystematicNameFieldSet] }, geneTypeFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneTypeFieldSet] }, - geneticModifierAgmsFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierAgmsFieldSet] }, - geneticModifierAllelesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierAllelesFieldSet] }, - geneticModifierGenesFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.geneticModifierGenesFieldSet] }, + geneticModifierAgmsFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.geneticModifierAgmsFieldSet], + }, + geneticModifierAllelesFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.geneticModifierAllelesFieldSet], + }, + geneticModifierGenesFilterConfig: { + filterComponentType: 'input', + fieldSets: [FIELD_SETS.geneticModifierGenesFieldSet], + }, idExampleFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idExampleFieldSet] }, idPatternFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.idPatternFieldSet] }, inchiFilterConfig: { filterComponentType: 'input', fieldSets: [FIELD_SETS.inchiFieldSet] }, diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js index 94aa32221..e7217070e 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/DiseaseAnnotationsTable.js @@ -632,13 +632,7 @@ export const DiseaseAnnotationsTable = () => { }; const geneticModifierAgmsSearch = (event, setFiltered, setInputValue) => { - const autocompleteFields = [ - 'name', - 'curie', - 'modEntityId', - 'modInternalId', - 'crossReferences.referencedCurie', - ]; + const autocompleteFields = ['name', 'curie', 'modEntityId', 'modInternalId', 'crossReferences.referencedCurie']; const endpoint = 'agm'; const filterName = 'geneticModifierAgmsFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js index 42894c5bd..0ebad9548 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/NewAnnotationForm.js @@ -237,13 +237,7 @@ export const NewAnnotationForm = ({ }; const geneticModifierAgmsSearch = (event, setFiltered, setQuery) => { - const autocompleteFields = [ - 'modEntityId', - 'modInternalId', - 'name', - 'curie', - 'crossReferences.referencedCurie', - ]; + const autocompleteFields = ['modEntityId', 'modInternalId', 'name', 'curie', 'crossReferences.referencedCurie']; const endpoint = 'agm'; const filterName = 'geneticModifierAgmsFilter'; const filter = buildAutocompleteFilter(event, autocompleteFields); @@ -1085,7 +1079,10 @@ export const NewAnnotationForm = ({ />
- +
@@ -1118,8 +1115,13 @@ export const NewAnnotationForm = ({ />
- - + +
@@ -1151,7 +1153,10 @@ export const NewAnnotationForm = ({ />
- +
diff --git a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js index bdda33efa..aa2992b83 100644 --- a/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js +++ b/src/main/cliapp/src/containers/diseaseAnnotationsPage/mockData/mockData.js @@ -59,8 +59,8 @@ export const data = { name: 'SGD Strain Background test', }, diseaseGeneticModifierAgms: [{ name: 'DGM AGM test', modEntityId: 'WB:DGM1' }], - diseaseGeneticModifierAlleles: [{ modEntityId: 'WB:DGM2', alleleSymbol: { displayText: 'DGM Allele test' }}], - diseaseGeneticModifierGenes: [{ modEntityId: 'WB:DGM3', geneSymbol: { displayText: 'DGM Gene test' }}], + diseaseGeneticModifierAlleles: [{ modEntityId: 'WB:DGM2', alleleSymbol: { displayText: 'DGM Allele test' } }], + diseaseGeneticModifierGenes: [{ modEntityId: 'WB:DGM3', geneSymbol: { displayText: 'DGM Gene test' } }], diseaseQualifiers: [{ name: 'disease qualifiers test' }], dateCreated: '2017-06-08T14:15:35Z', dateUpdated: '2017-06-08T14:15:35Z', From 7ab260a383396b80b61082898699e56b5e9d79cf Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Thu, 24 Oct 2024 09:13:58 -0500 Subject: [PATCH 321/342] SCRUM-4440 add biogrid orc load --- pom.xml | 5 + .../cliapp/src/service/DataLoadService.js | 1 + .../enums/BackendBulkLoadType.java | 1 + .../jobs/executors/BiogridOrcExecutor.java | 99 +++++++++++++++++++ .../jobs/executors/BulkLoadJobExecutor.java | 4 + .../jobs/util/CsvSchemaBuilder.java | 26 +++++ .../ingest/dto/fms/BiogridOrcFmsDTO.java | 29 ++++++ .../v0.37.0.63__biogrid_orcs_load.sql | 41 ++++++++ 8 files changed, 206 insertions(+) create mode 100644 src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java create mode 100644 src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.java create mode 100644 src/main/resources/db/migration/v0.37.0.63__biogrid_orcs_load.sql diff --git a/pom.xml b/pom.xml index f6128b88b..ba3d5cc72 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,11 @@ commons-collections4 4.4 + + org.apache.commons + commons-compress + 1.27.1 + commons-collections commons-collections diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 9d8355f71..9dfd89e99 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -95,6 +95,7 @@ export class DataLoadService extends BaseAuthService { 'PHENOTYPE', 'PARALOGY', 'SEQUENCE_TARGETING_REAGENT', + 'BIOGRID-ORCS', ], BulkURLLoad: [ 'ONTOLOGY', 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 fdcd38ddc..81c8f21f1 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/BackendBulkLoadType.java @@ -29,6 +29,7 @@ public enum BackendBulkLoadType { INTERACTION_MOL("tsv"), EXPRESSION_ATLAS("tsv"), INTERACTION_GEN("tsv"), + BIOGRID_ORCS("tsv"), PARALOGY("json"), SEQUENCE_TARGETING_REAGENT("json"), EXPRESSION("json"), 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 new file mode 100644 index 000000000..b90f3f015 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/BiogridOrcExecutor.java @@ -0,0 +1,99 @@ +package org.alliancegenome.curation_api.jobs.executors; + +import java.io.FileInputStream; +import java.util.HashSet; +import java.util.List; +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.jobs.util.CsvSchemaBuilder; +import org.alliancegenome.curation_api.model.entities.bulkloads.BulkLoadFileHistory; +import org.alliancegenome.curation_api.model.ingest.dto.fms.BiogridOrcFmsDTO; +import org.alliancegenome.curation_api.util.ProcessDisplayHelper; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; + +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; + +@ApplicationScoped +public class BiogridOrcExecutor extends LoadFileExecutor { + + public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { + try (TarArchiveInputStream tarInputStream = new TarArchiveInputStream( + new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())))) { + TarArchiveEntry tarEntry; + + Set biogridIds = new HashSet<>(); + + while ((tarEntry = tarInputStream.getNextEntry()) != null) { + + CsvMapper csvMapper = new CsvMapper(); + CsvSchema biogridOrcFmsSchema = CsvSchemaBuilder.biogridOrcFmsSchema(); + String regexPattern = "BIOGRID-ORCS-SCREEN_(\\d+)-1.1.16.screen.tab.txt"; + Pattern pattern = Pattern.compile(regexPattern); + + Matcher matcher = pattern.matcher(tarEntry.getName()); + + if (tarEntry.isDirectory() || !matcher.matches()) { + continue; + } + + MappingIterator it = csvMapper + .enable(CsvParser.Feature.INSERT_NULLS_FOR_MISSING_COLUMNS) + .readerFor(BiogridOrcFmsDTO.class) + .with(biogridOrcFmsSchema) + .readValues(tarInputStream.readAllBytes()); + + List biogridData = it.readAll(); + runLoad(bulkLoadFileHistory, biogridData, biogridIds); + + } + } catch (Exception e) { + failLoad(bulkLoadFileHistory, e); + e.printStackTrace(); + } + } + + private boolean runLoad(BulkLoadFileHistory history, List biogridList, Set biogridIds) { + ProcessDisplayHelper ph = new ProcessDisplayHelper(); + ph.addDisplayHandler(loadProcessDisplayService); + if (CollectionUtils.isNotEmpty(biogridList)) { + String loadMessage = biogridList.get(0).getClass().getSimpleName() + " update"; + ph.startProcess(loadMessage, biogridList.size()); + + updateHistory(history); + for (BiogridOrcFmsDTO biogridOrcFmsDTO : biogridList) { + try { + if (biogridOrcFmsDTO.getIdentifierType().equals("ENTREZ_GENE")) { + String identifier = "NCBI_Gene:" + biogridOrcFmsDTO.getIdentifierId(); + biogridIds.add(identifier); + history.incrementCompleted(); + } else { + history.incrementSkipped(); + + } + } catch (Exception e) { + e.printStackTrace(); + history.incrementFailed(); + addException(history, + new ObjectUpdateExceptionData(biogridOrcFmsDTO, e.getMessage(), e.getStackTrace())); + } + ph.progressProcess(); + } + updateHistory(history); + updateExceptions(history); + ph.finishProcess(); + } + + return true; + } +} \ 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 2b9f00659..b86cc2d15 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 @@ -62,6 +62,8 @@ public class BulkLoadJobExecutor { @Inject HTPExpressionDatasetAnnotationExecutor htpExpressionDatasetAnnotationExecutor; @Inject ExpressionAtlasExecutor expressionAtlasExecutor; + @Inject BiogridOrcExecutor biogridOrcExecutor; + public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) throws Exception { BackendBulkLoadType loadType = bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType(); @@ -131,6 +133,8 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th 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 { 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/util/CsvSchemaBuilder.java b/src/main/java/org/alliancegenome/curation_api/jobs/util/CsvSchemaBuilder.java index 677f4579c..28c4bfca0 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 @@ -59,6 +59,32 @@ public static CsvSchema psiMiTabSchema() { return schema; } + + public static CsvSchema biogridOrcFmsSchema() { + CsvSchema schema = CsvSchema.builder() + .setColumnSeparator('\t') + .setArrayElementSeparator("|") + .setAllowComments(true) + .setNullValue("-") + .disableQuoteChar() + .addColumn("screenId") + .addColumn("identifierId") + .addColumn("identifierType") + .addColumn("officialSymbol") + .addColumn("aliases") + .addColumn("organismId") + .addColumn("organismOfficial") + .addColumn("score1") + .addColumn("score2") + .addColumn("score3") + .addColumn("score4") + .addColumn("score5") + .addColumn("hit") + .addColumn("source") + .build(); + + return schema; + } public static CsvSchema gff3Schema() { CsvSchema schema = CsvSchema.builder() 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 new file mode 100644 index 000000000..6742ac634 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/model/ingest/dto/fms/BiogridOrcFmsDTO.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.CrossReferenceDTO; +import org.alliancegenome.curation_api.model.ingest.dto.base.BaseDTO; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = true) +public class BiogridOrcFmsDTO extends BaseDTO { + private Integer screenId; + private String identifierId; + private String identifierType; + private String officialSymbol; + private String aliases; + private Integer organismId; + private String organismOfficial; + private Double score1; + private Double score2; + private Double score3; + private Double score4; + private Double score5; + private String hit; + private String source; + private List crossReferenceDtos; +} diff --git a/src/main/resources/db/migration/v0.37.0.63__biogrid_orcs_load.sql b/src/main/resources/db/migration/v0.37.0.63__biogrid_orcs_load.sql new file mode 100644 index 000000000..fd5ee1266 --- /dev/null +++ b/src/main/resources/db/migration/v0.37.0.63__biogrid_orcs_load.sql @@ -0,0 +1,41 @@ +-- Create bulk loads + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'File Management System (FMS) Biogrid Orcs Loads'); +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'FB Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'HUMAN Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'MGI Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'RGD Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'SGD Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'WB Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'XBXL Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'XBXT Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'BIOGRID_ORCS', 'ZFIN Biogrid Orcs Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Biogrid Orcs Loads'; +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) + SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'BIOGRID_ORCS'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'FB' FROM bulkload WHERE name = 'FB Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'HUMAN' FROM bulkload WHERE name = 'HUMAN Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'MGI' FROM bulkload WHERE name = 'MGI Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'RGD' FROM bulkload WHERE name = 'RGD Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'SGD' FROM bulkload WHERE name = 'SGD Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'WB' FROM bulkload WHERE name = 'WB Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'XBSL' FROM bulkload WHERE name = 'XBXL Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'XBXT' FROM bulkload WHERE name = 'XBXT Biogrid Orcs Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'BIOGRID-ORCS', 'ZFIN' FROM bulkload WHERE name = 'ZFIN Biogrid Orcs Load'; \ No newline at end of file From aff259d1fe62bcf78d63c5a43ddf25f500b06c17 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Thu, 24 Oct 2024 12:41:44 -0400 Subject: [PATCH 322/342] Forgot to observe async all the events after the refactor --- .../curation_api/websocket/IndexProcessingWebsocket.java | 4 ++-- .../curation_api/websocket/LoadProcessingWebsocket.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java b/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java index 9636125de..2e140c837 100644 --- a/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java +++ b/src/main/java/org/alliancegenome/curation_api/websocket/IndexProcessingWebsocket.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import jakarta.inject.Inject; import jakarta.websocket.OnClose; import jakarta.websocket.OnError; @@ -66,7 +66,7 @@ public void message(String message, Session session) { // session.getOpenSessions().forEach(s -> s.getAsyncRemote().sendText(message)); } - public void observeProcessingEvent(@Observes IndexProcessingEvent event) { + public void observeProcessingEvent(@ObservesAsync IndexProcessingEvent event) { this.event = event; //Log.info(sessions); for (Entry sessionEntry : sessions.entrySet()) { diff --git a/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java b/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java index 8eb808095..5a9b7f6b1 100644 --- a/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java +++ b/src/main/java/org/alliancegenome/curation_api/websocket/LoadProcessingWebsocket.java @@ -9,7 +9,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.enterprise.event.Observes; +import jakarta.enterprise.event.ObservesAsync; import jakarta.inject.Inject; import jakarta.websocket.OnClose; import jakarta.websocket.OnError; @@ -59,7 +59,7 @@ public void message(String message, Session session) { // session.getOpenSessions().forEach(s -> s.getAsyncRemote().sendText(message)); } - public void observeProcessingEvent(@Observes LoadProcessingEvent event) { + public void observeProcessingEvent(@ObservesAsync LoadProcessingEvent event) { //Log.info(sessions); //Log.info(event); for (Entry sessionEntry : sessions.entrySet()) { From 9f6b722cbb2b642af10fd26969287fc1f60636ac Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 08:12:52 +0100 Subject: [PATCH 323/342] Use enum for chromosome accessions --- .../dataLoadsPage/DataLoadsComponent.js | 5 +- .../cliapp/src/service/DataLoadService.js | 3 +- .../crud/GenomeAssemblyCrudController.java | 35 ++++ .../enums/ChromosomeAccessionEnum.java | 161 ++++++++++++++++++ .../crud/GenomeAssemblyCrudInterface.java | 18 ++ .../jobs/executors/BulkLoadJobExecutor.java | 4 +- .../model/entities/AssemblyComponent.java | 5 + .../model/entities/DiseaseAnnotation.java | 2 +- .../services/AssemblyComponentService.java | 7 +- .../services/CodingSequenceService.java | 1 - .../curation_api/services/ExonService.java | 1 - .../services/GenomeAssemblyService.java | 11 ++ .../curation_api/services/VariantService.java | 1 - .../dto/fms/VariantFmsDTOValidator.java | 20 ++- ..._variant_genomic_location_association.sql} | 36 ++++ .../curation_api/Gff3BulkUploadITCase.java | 4 + .../curation_api/VariantFmsITCase.java | 11 +- .../curation_api/base/BaseITCase.java | 159 +++++++++++------ .../bulk/fms/10_variant/AF_01_all_fields.json | 2 +- 19 files changed, 419 insertions(+), 67 deletions(-) create mode 100644 src/main/java/org/alliancegenome/curation_api/controllers/crud/GenomeAssemblyCrudController.java create mode 100644 src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java create mode 100644 src/main/java/org/alliancegenome/curation_api/interfaces/crud/GenomeAssemblyCrudInterface.java rename src/main/resources/db/migration/{v0.37.0.62__curated_variant_genomic_location_association.sql => v0.37.0.63__curated_variant_genomic_location_association.sql} (74%) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index 25a8ccf93..c0784d2e3 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -84,7 +84,10 @@ export const DataLoadsComponent = () => { 'GeneDTO', 'AlleleDTO', 'AffectedGenomicModelDTO', + // 'VariantDTO', 'ConstructDTO', + 'AlleleGeneAssociationDTO', + 'ConstructGenomicEntityAssociationDTO' ], ], ['DISEASE_ANNOTATION', ['GeneDiseaseAnnotationDTO', 'AlleleDiseaseAnnotationDTO', 'AGMDiseaseAnnotationDTO']], @@ -94,7 +97,7 @@ export const DataLoadsComponent = () => { ['GENE', ['GeneDTO']], ['ALLELE', ['AlleleDTO']], ['AGM', ['AffectedGenomicModelDTO']], - ['VARIANT', ['VariantDTO']], + // ['VARIANT', ['VariantDTO']], ['CONSTRUCT', ['ConstructDTO']], ['ALLELE_ASSOCIATION', ['AlleleGeneAssociationDTO']], ['CONSTRUCT_ASSOCIATION', ['ConstructGenomicEntityAssociationDTO']], diff --git a/src/main/cliapp/src/service/DataLoadService.js b/src/main/cliapp/src/service/DataLoadService.js index 9d8355f71..33715182f 100644 --- a/src/main/cliapp/src/service/DataLoadService.js +++ b/src/main/cliapp/src/service/DataLoadService.js @@ -95,6 +95,7 @@ export class DataLoadService extends BaseAuthService { 'PHENOTYPE', 'PARALOGY', 'SEQUENCE_TARGETING_REAGENT', + 'VARIATION' ], BulkURLLoad: [ 'ONTOLOGY', @@ -114,7 +115,7 @@ export class DataLoadService extends BaseAuthService { 'GENE', 'ALLELE', 'AGM', - 'VARIANT', + // 'VARIANT', 'CONSTRUCT', 'ALLELE_ASSOCIATION', 'CONSTRUCT_ASSOCIATION', diff --git a/src/main/java/org/alliancegenome/curation_api/controllers/crud/GenomeAssemblyCrudController.java b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GenomeAssemblyCrudController.java new file mode 100644 index 000000000..176f72c29 --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/controllers/crud/GenomeAssemblyCrudController.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.GenomeAssemblyDAO; +import org.alliancegenome.curation_api.interfaces.crud.GenomeAssemblyCrudInterface; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.response.ObjectResponse; +import org.alliancegenome.curation_api.services.GenomeAssemblyService; + +import jakarta.annotation.PostConstruct; +import jakarta.enterprise.context.RequestScoped; +import jakarta.inject.Inject; + +@RequestScoped +public class GenomeAssemblyCrudController extends BaseEntityCrudController implements GenomeAssemblyCrudInterface { + + @Inject GenomeAssemblyService genomeAssemblyService; + + @Override + @PostConstruct + protected void init() { + setService(genomeAssemblyService); + } + + @Override + public ObjectResponse getByIdentifier(String identifierString) { + return genomeAssemblyService.getByIdentifier(identifierString); + } + + @Override + public ObjectResponse deleteByIdentifier(String identifierString) { + return genomeAssemblyService.deleteByIdentifier(identifierString); + } + +} diff --git a/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java new file mode 100644 index 000000000..1b936d27d --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java @@ -0,0 +1,161 @@ +package org.alliancegenome.curation_api.enums; + +public enum ChromosomeAccessionEnum { + + FB_2L("2L", "RefSeq:NT_033779.5", "R6"), + FB_2R("2R", "RefSeq:NT_033778.4", "R6"), + FB_3L("3L", "RefSeq:NT_037436.4", "R6"), + FB_3R("3R", "RefSeq:NT_033777.3", "R6"), + FB_4("4", "RefSeq:NC_004353.4", "R6"), + FB_X("X", "RefSeq:NC_004354.4", "R6"), + FB_Y("Y", "RefSeq:NC_024512.1", "R6"), + FB_MT("mitochondrion_genome", "RefSeq:NC_024511.2", "R6"), + FB_US("Unmapped_Scaffold_8_D1580_D1567", "RefSeq:NW_007931083.1", "R6"), + FB_211000022278279("211000022278279", "RefSeq:NW_007931104.1", "R6"), + FB_211000022278436("211000022278436", "RefSeq:NW_001845431.1", "R6"), + FB_211000022278449("211000022278449", "RefSeq:NW_001845819.1", "R6"), + FB_211000022278760("211000022278760", "RefSeq:NW_001846712.1", "R6"), + FB_211000022279165("211000022279165", "RefSeq:NW_001846812.1", "R6"), + FB_211000022279188("211000022279188", "RefSeq:NW_001845284.1", "R6"), + FB_211000022279264("211000022279264", "RefSeq:NW_001847227.1", "R6"), + FB_211000022279392("211000022279392", "RefSeq:NW_001846198.1", "R6"), + FB_211000022279681("211000022279681", "RefSeq:NW_001845031.1", "R6"), + FB_211000022280328("211000022280328", "RefSeq:NW_001844935.1", "R6"), + FB_211000022280341("211000022280341", "RefSeq:NW_001846187.1", "R6"), + FB_211000022280347("211000022280347", "RefSeq:NW_001845870.1", "R6"), + FB_211000022280481("211000022280481", "RefSeq:NW_001845220.1", "R6"), + FB_211000022280494("211000022280494", "RefSeq:NW_001845164.1", "R6"), + FB_211000022280703("211000022280703", "RefSeq:NW_001845199.1", "R6"), + FB_RDNA("rDNA", "RefSeq:NW_007931121.1", "R6"), + MGI_1("1", "RefSeq:NC_000067.6", "GRCm39"), + MGI_2("2", "RefSeq:NC_000068.7", "GRCm39"), + MGI_3("3", "RefSeq:NC_000069.6", "GRCm39"), + MGI_4("4", "RefSeq:NC_000070.6", "GRCm39"), + MGI_5("5", "RefSeq:NC_000071.6", "GRCm39"), + MGI_6("6", "RefSeq:NC_000072.6", "GRCm39"), + MGI_7("7", "RefSeq:NC_000073.6", "GRCm39"), + MGI_8("8", "RefSeq:NC_000074.6", "GRCm39"), + MGI_9("9", "RefSeq:NC_000075.6", "GRCm39"), + MGI_10("10", "RefSeq:NC_000076.6", "GRCm39"), + MGI_11("11", "RefSeq:NC_000077.6", "GRCm39"), + MGI_12("12", "RefSeq:NC_000078.6", "GRCm39"), + MGI_13("13", "RefSeq:NC_000079.6", "GRCm39"), + MGI_14("14", "RefSeq:NC_000080.6", "GRCm39"), + MGI_15("15", "RefSeq:NC_000081.6", "GRCm39"), + MGI_16("16", "RefSeq:NC_000082.6", "GRCm39"), + MGI_17("17", "RefSeq:NC_000083.6", "GRCm39"), + MGI_18("18", "RefSeq:NC_000084.6", "GRCm39"), + MGI_19("19", "RefSeq:NC_000085.6", "GRCm39"), + MGI_X("X", "RefSeq:NC_000086.7", "GRCm39"), + MGI_Y("Y", "RefSeq:NC_000087.7", "GRCm39"), + MGI_MT("MT", "RefSeq:NC_005089.1", "GRCm39"), + RGD_1("1", "RefSeq:NC_005100.4", "mRatBN7.2"), + RGD_2("2", "RefSeq:NC_005101.4", "mRatBN7.2"), + RGD_3("3", "RefSeq:NC_005102.4", "mRatBN7.2"), + RGD_4("4", "RefSeq:NC_005103.4", "mRatBN7.2"), + RGD_5("5", "RefSeq:NC_005104.4", "mRatBN7.2"), + RGD_6("6", "RefSeq:NC_005105.4", "mRatBN7.2"), + RGD_7("7", "RefSeq:NC_005106.4", "mRatBN7.2"), + RGD_8("8", "RefSeq:NC_005107.4", "mRatBN7.2"), + RGD_9("9", "RefSeq:NC_005108.4", "mRatBN7.2"), + RGD_10("10", "RefSeq:NC_005109.4", "mRatBN7.2"), + RGD_11("11", "RefSeq:NC_005110.4", "mRatBN7.2"), + RGD_12("12", "RefSeq:NC_005111.4", "mRatBN7.2"), + RGD_13("13", "RefSeq:NC_005112.4", "mRatBN7.2"), + RGD_14("14", "RefSeq:NC_005113.4", "mRatBN7.2"), + RGD_15("15", "RefSeq:NC_005114.4", "mRatBN7.2"), + RGD_16("16", "RefSeq:NC_005115.4", "mRatBN7.2"), + RGD_17("17", "RefSeq:NC_005116.4", "mRatBN7.2"), + RGD_18("18", "RefSeq:NC_005117.4", "mRatBN7.2"), + RGD_19("19", "RefSeq:NC_005118.4", "mRatBN7.2"), + RGD_20("20", "RefSeq:NC_005119.4", "mRatBN7.2"), + RGD_X("X", "RefSeq:NC_005120.4", "mRatBN7.2"), + RGD_Y("Y", "RefSeq:NC_024475.1", "mRatBN7.2"), + RGD_MT("MT", "RefSeq:NC_001665.2", "mRatBN7.2"), + SGD_I("chrI", "RefSeq:NC_001133.9", "R64-4-1"), + SGD_II("chrII", "RefSeq:NC_001134.8", "R64-4-1"), + SGD_III("chrIII", "RefSeq:NC_001135.5", "R64-4-1"), + SGD_IV("chrIV", "RefSeq:NC_001136.10", "R64-4-1"), + SGD_V("chrV", "RefSeq:NC_001137.3", "R64-4-1"), + SGD_VI("chrVI", "RefSeq:NC_001138.5", "R64-4-1"), + SGD_VII("chrVII", "RefSeq:NC_001139.9", "R64-4-1"), + SGD_VIII("chrVIII", "RefSeq:NC_001140.6", "R64-4-1"), + SGD_IX("chrIX", "RefSeq:NC_001141.2", "R64-4-1"), + SGD_X("chrX", "RefSeq:NC_001142.9", "R64-4-1"), + SGD_XI("chrXI", "RefSeq:NC_001143.9", "R64-4-1"), + SGD_XII("chrXII", "RefSeq:NC_001144.5", "R64-4-1"), + SGD_XIII("chrXIII", "RefSeq:NC_001145.3", "R64-4-1"), + SGD_XIV("chrXIV", "RefSeq:NC_001146.8", "R64-4-1"), + SGD_XV("chrXV", "RefSeq:NC_001147.6", "R64-4-1"), + SGD_XVI("chrXVI", "RefSeq:NC_001148.4", "R64-4-1"), + SGD_MT("chrmt", "RefSeq:NC_001224.1", "R64-4-1"), + WB_I("I", "RefSeq:NC_003279.8", "WBcel235"), + WB_II("II", "RefSeq:NC_003280.10", "WBcel235"), + WB_III("III", "RefSeq:NC_003281.10", "WBcel235"), + WB_IV("IV", "RefSeq:NC_003282.8", "WBcel235"), + WB_V("V", "RefSeq:NC_003283.11", "WBcel235"), + WB_X("X", "RefSeq:NC_003284.9", "WBcel235"), + WB_MT("MtDNA", "RefSeq:NC_001328.1", "WBcel235"), + ZFIN_1("1", "RefSeq:NC_007112.7", "GRCz11"), + ZFIN_2("2", "RefSeq:NC_007113.7", "GRCz11"), + ZFIN_3("3", "RefSeq:NC_007114.7", "GRCz11"), + ZFIN_4("4", "RefSeq:NC_007115.7", "GRCz11"), + ZFIN_5("5", "RefSeq:NC_007116.7", "GRCz11"), + ZFIN_6("6", "RefSeq:NC_007117.7", "GRCz11"), + ZFIN_7("7", "RefSeq:NC_007118.7", "GRCz11"), + ZFIN_8("8", "RefSeq:NC_007119.7", "GRCz11"), + ZFIN_9("9", "RefSeq:NC_007120.7", "GRCz11"), + ZFIN_10("10", "RefSeq:NC_007121.7", "GRCz11"), + ZFIN_11("11", "RefSeq:NC_007122.7", "GRCz11"), + ZFIN_12("12", "RefSeq:NC_007123.7", "GRCz11"), + ZFIN_13("13", "RefSeq:NC_007124.7", "GRCz11"), + ZFIN_14("14", "RefSeq:NC_007125.7", "GRCz11"), + ZFIN_15("15", "RefSeq:NC_007126.7", "GRCz11"), + ZFIN_16("16", "RefSeq:NC_007127.7", "GRCz11"), + ZFIN_17("17", "RefSeq:NC_007128.7", "GRCz11"), + ZFIN_18("18", "RefSeq:NC_007129.7", "GRCz11"), + ZFIN_19("19", "RefSeq:NC_007130.7", "GRCz11"), + ZFIN_20("20", "RefSeq:NC_007131.7", "GRCz11"), + ZFIN_21("21", "RefSeq:NC_007132.7", "GRCz11"), + ZFIN_22("22", "RefSeq:NC_007133.7", "GRCz11"), + ZFIN_23("23", "RefSeq:NC_007134.7", "GRCz11"), + ZFIN_24("24", "RefSeq:NC_007135.7", "GRCz11"), + ZFIN_25("25", "RefSeq:NC_007136.7", "GRCz11"), + ZFIN_MT("MT", "RefSeq:NC_002333.2", "GRCz11"); + + + public String chromosomeName; + public String accession; + public String assemblyIdentifier; + + private ChromosomeAccessionEnum(String chromosomeName, String accession, String assemblyName) { + this.chromosomeName = chromosomeName; + this.accession = accession; + this.assemblyIdentifier = assemblyName; + } + + public static ChromosomeAccessionEnum getChromosomeAccessionEnum(String chromosomeAccession) { + if (chromosomeAccession == null) { + return null; + } + for (ChromosomeAccessionEnum chromosome : values()) { + if (chromosomeAccession.equals(chromosome.accession)) { + return chromosome; + } + } + return null; + } + + public static String getChromosomeAccession(String chromosomeName, String assemblyIdentifier) { + if (chromosomeName == null || assemblyIdentifier == null) { + return null; + } + for (ChromosomeAccessionEnum chromosome : values()) { + if (chromosomeName.equals(chromosome.chromosomeName) && + assemblyIdentifier.equals(chromosome.assemblyIdentifier)) { + return chromosome.accession; + } + } + return null; + } +} \ No newline at end of file diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GenomeAssemblyCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GenomeAssemblyCrudInterface.java new file mode 100644 index 000000000..ece1b03ca --- /dev/null +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/GenomeAssemblyCrudInterface.java @@ -0,0 +1,18 @@ +package org.alliancegenome.curation_api.interfaces.crud; + +import org.alliancegenome.curation_api.interfaces.base.BaseSubmittedObjectCrudInterface; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.eclipse.microprofile.openapi.annotations.tags.Tag; + +import jakarta.ws.rs.Consumes; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/genomeassembly") +@Tag(name = "CRUD - GenomeAssembly") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) +public interface GenomeAssemblyCrudInterface extends BaseSubmittedObjectCrudInterface { + +} 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 25ca8f05b..24abd03b0 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 @@ -83,7 +83,8 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th constructExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == VARIANT || loadType == FULL_INGEST) { - variantExecutor.execLoad(bulkLoadFileHistory, cleanUp); + // TODO: re-enable once accepting direct submissions of variants by DQMs again and FMS load turned off + // variantExecutor.execLoad(bulkLoadFileHistory, cleanUp); } if (loadType == ALLELE_DISEASE_ANNOTATION || loadType == DISEASE_ANNOTATION || loadType == FULL_INGEST) { alleleDiseaseAnnotationExecutor.execLoad(bulkLoadFileHistory, cleanUp); @@ -123,7 +124,6 @@ public void process(BulkLoadFileHistory bulkLoadFileHistory, Boolean cleanUp) th geneExpressionExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.VARIATION) { variantFmsExecutor.execLoad(bulkLoadFileHistory); - } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_EXON) { gff3ExonExecutor.execLoad(bulkLoadFileHistory); } else if (bulkLoadFileHistory.getBulkLoad().getBackendBulkLoadType() == BackendBulkLoadType.GFF_CDS) { diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index a0a58a63e..7446d8643 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -4,9 +4,14 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; 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; 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 9dda98fb0..44c8fb3ad 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 @@ -49,7 +49,7 @@ @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) -@AGRCurationSchemaVersion(min = "2.2.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"), diff --git a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java index 23b3c397e..e944e140d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/AssemblyComponentService.java @@ -8,7 +8,9 @@ import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.AssemblyComponentDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.enums.ChromosomeAccessionEnum; import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; @@ -74,9 +76,12 @@ private AssemblyComponent findAssemblyComponentOrCreateDB(String name, String as } AssemblyComponent assemblyComponent = new AssemblyComponent(); assemblyComponent.setName(name); - assemblyComponent.setGenomeAssembly(genomeAssemblyService.getOrCreate(assemblyId, dataProvider)); + GenomeAssembly genomeAssembly = genomeAssemblyService.getOrCreate(assemblyId, dataProvider); + assemblyComponent.setGenomeAssembly(genomeAssembly); assemblyComponent.setTaxon(ncbiTaxonTermService.getByCurie(taxonCurie).getEntity()); assemblyComponent.setDataProvider(dataProviderService.getDefaultDataProvider(dataProvider.sourceOrganization)); + String modEntityId = ChromosomeAccessionEnum.getChromosomeAccession(name, assemblyId); + assemblyComponent.setModEntityId(modEntityId); return assemblyComponentDAO.persist(assemblyComponent); } 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 a196e4c39..badc7798b 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/CodingSequenceService.java @@ -9,7 +9,6 @@ import org.alliancegenome.curation_api.dao.CodingSequenceDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.CodingSequence; -import org.alliancegenome.curation_api.model.entities.Exon; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.validation.dto.Gff3DtoValidator; 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 c97c5934a..d5cbfddda 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/ExonService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/ExonService.java @@ -9,7 +9,6 @@ import org.alliancegenome.curation_api.dao.ExonDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.Exon; -import org.alliancegenome.curation_api.model.entities.Transcript; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java b/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java index f7956839b..c6ed5b6eb 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/GenomeAssemblyService.java @@ -1,12 +1,14 @@ package org.alliancegenome.curation_api.services; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.dao.GenomeAssemblyDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.base.BaseEntityCrudService; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; @@ -52,5 +54,14 @@ public GenomeAssembly getOrCreate(String assemblyName, BackendBulkDataProvider d return null; } } + + public ObjectResponse deleteByIdentifier(String identifierString) { + GenomeAssembly assembly = findByAlternativeFields(List.of("modEntityId", "modInternalId"), identifierString); + if (assembly != null) { + genomeAssemblyDAO.remove(assembly.getId()); + } + ObjectResponse ret = new ObjectResponse<>(assembly); + return ret; + } } diff --git a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java index b0d0dab68..7c8a8b754 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/VariantService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/VariantService.java @@ -13,7 +13,6 @@ import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Variant; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; -import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.services.base.SubmittedObjectCrudService; import org.alliancegenome.curation_api.services.validation.VariantValidator; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index 09c18bc67..af061472d 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -1,16 +1,21 @@ package org.alliancegenome.curation_api.services.validation.dto.fms; import java.util.ArrayList; +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.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; +import org.alliancegenome.curation_api.dao.AssemblyComponentDAO; import org.alliancegenome.curation_api.dao.NoteDAO; import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; import org.alliancegenome.curation_api.dao.associations.variantAssociations.CuratedVariantGenomicLocationAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; +import org.alliancegenome.curation_api.enums.ChromosomeAccessionEnum; import org.alliancegenome.curation_api.exceptions.ObjectValidationException; import org.alliancegenome.curation_api.exceptions.ValidationException; import org.alliancegenome.curation_api.model.entities.Allele; @@ -26,7 +31,6 @@ import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.AlleleService; -import org.alliancegenome.curation_api.services.AssemblyComponentService; import org.alliancegenome.curation_api.services.CrossReferenceService; import org.alliancegenome.curation_api.services.DataProviderService; import org.alliancegenome.curation_api.services.VocabularyTermService; @@ -40,6 +44,7 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import io.quarkus.logging.Log; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.transaction.Transactional; @@ -50,7 +55,7 @@ public class VariantFmsDTOValidator { @Inject VariantDAO variantDAO; @Inject NoteDAO noteDAO; @Inject AlleleService alleleService; - @Inject AssemblyComponentService assemblyComponentService; + @Inject AssemblyComponentDAO assemblyComponentDAO; @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; @Inject CuratedVariantGenomicLocationAssociationService curatedVariantGenomicLocationAssociationService; @Inject AlleleVariantAssociationDAO alleleVariantAssociationDAO; @@ -216,7 +221,16 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, if (StringUtils.isBlank(dto.getSequenceOfReferenceAccessionNumber())) { cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.REQUIRED_MESSAGE); } else { - chromosome = assemblyComponentService.getByIdentifier(dto.getSequenceOfReferenceAccessionNumber()).getEntity(); + ChromosomeAccessionEnum cae = ChromosomeAccessionEnum.getChromosomeAccessionEnum(dto.getSequenceOfReferenceAccessionNumber()); + if (cae != null) { + Map params = new HashMap<>(); + params.put("name", cae.chromosomeName); + params.put("genomeAssembly.modEntityId", cae.assemblyIdentifier); + SearchResponse acResponse = assemblyComponentDAO.findByParams(params); + if (acResponse != null) { + chromosome = acResponse.getSingleResult(); + } + } if (chromosome == null) { cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.INVALID_MESSAGE + " (" + dto.getSequenceOfReferenceAccessionNumber() + ")"); diff --git a/src/main/resources/db/migration/v0.37.0.62__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.63__curated_variant_genomic_location_association.sql similarity index 74% rename from src/main/resources/db/migration/v0.37.0.62__curated_variant_genomic_location_association.sql rename to src/main/resources/db/migration/v0.37.0.63__curated_variant_genomic_location_association.sql index 753bdc8b6..7273d6a60 100644 --- a/src/main/resources/db/migration/v0.37.0.62__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.63__curated_variant_genomic_location_association.sql @@ -141,4 +141,40 @@ INSERT INTO vocabularytermset_vocabularyterm (vocabularytermsets_id, memberterms ) ) SELECT t1.id, t2.id FROM t1,t2; + +DELETE FROM bulkloadfileexception WHERE bulkloadfilehistory_id IN (SELECT id FROM bulkloadfilehistory WHERE bulkload_id IN (SELECT id FROM bulkload WHERE backendbulkloadtype = 'VARIANT')); +DELETE FROM bulkloadfilehistory WHERE bulkload_id IN (SELECT id FROM bulkload WHERE backendbulkloadtype = 'VARIANT'); +DELETE FROM bulkloadfile WHERE id NOT IN (SELECT DISTINCT bulkloadfile_id FROM bulkloadfilehistory); +DELETE FROM bulkmanualload WHERE id IN (SELECT id FROM bulkload WHERE backendbulkloadtype = 'VARIANT'); +DELETE FROM bulkload WHERE backendbulkloadtype = 'VARIANT'; +DELETE FROM bulkloadgroup WHERE name = 'Direct (LinkML) DQM Variant Loads'; + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'Variant Bulk Loads'); +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'FB Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) + SELECT nextval('bulkload_seq'), 'VARIATION', 'ZFIN Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; +INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) + SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'VARIATION'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'FB' FROM bulkload WHERE name = 'FB Variant Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'MGI' FROM bulkload WHERE name = 'MGI Variant Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'RGD' FROM bulkload WHERE name = 'RGD Variant Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'SGD' FROM bulkload WHERE name = 'SGD Variant Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'WB' FROM bulkload WHERE name = 'WB Variant Load'; +INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) + SELECT id, 'VARIATION', 'ZFIN' FROM bulkload WHERE name = 'ZFIN Variant Load'; + \ No newline at end of file diff --git a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java index c84652fba..13f5ae5a9 100644 --- a/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/Gff3BulkUploadITCase.java @@ -84,6 +84,7 @@ public void gff3DataBulkUploadTranscriptEntity() throws Exception { body("entity.transcriptGenomicLocationAssociations", hasSize(1)). body("entity.transcriptGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("I")). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.modEntityId", is("RefSeq:NC_003279.8")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.transcriptGenomicLocationAssociations[0].start", is(1)). body("entity.transcriptGenomicLocationAssociations[0].end", is(1000)). @@ -117,6 +118,7 @@ public void gff3DataBulkUploadExonEntity() throws Exception { body("entity.exonGenomicLocationAssociations", hasSize(1)). body("entity.exonGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.name", is("I")). + body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.modEntityId", is("RefSeq:NC_003279.8")). body("entity.exonGenomicLocationAssociations[0].exonGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.exonGenomicLocationAssociations[0].start", is(1)). body("entity.exonGenomicLocationAssociations[0].end", is(100)). @@ -154,6 +156,7 @@ public void gff3DataBulkUploadCodingSequenceEntity() throws Exception { body("entity.codingSequenceGenomicLocationAssociations", hasSize(1)). body("entity.codingSequenceGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.name", is("I")). + body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.modEntityId", is("RefSeq:NC_003279.8")). body("entity.codingSequenceGenomicLocationAssociations[0].codingSequenceGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.codingSequenceGenomicLocationAssociations[0].start", is(10)). body("entity.codingSequenceGenomicLocationAssociations[0].end", is(100)). @@ -195,6 +198,7 @@ public void gff3DataBulkUploadUpdateTranscriptEntity() throws Exception { body("entity.transcriptGenomicLocationAssociations", hasSize(1)). body("entity.transcriptGenomicLocationAssociations[0].relation.name", is("located_on")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.name", is("II")). + body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.modEntityId", is("RefSeq:NC_003280.10")). body("entity.transcriptGenomicLocationAssociations[0].transcriptGenomicLocationAssociationObject.taxon.curie", is("NCBITaxon:6239")). body("entity.transcriptGenomicLocationAssociations[0].start", is(2)). body("entity.transcriptGenomicLocationAssociations[0].end", is(2000)). diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index 3ac799d83..a1750d8e9 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -3,12 +3,12 @@ import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; -import java.time.OffsetDateTime; import java.util.HashMap; import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.model.entities.DataProvider; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; @@ -48,8 +48,8 @@ public void init() { private final String variantFmsBulkPostEndpoint = "/api/variant/bulk/WB/fmsvariants"; private final String variantGetEndpoint = "/api/variant/"; private final String allele = "WB:AlleleWithVar1"; - private final String assemblyComponent = "RefSeq:NC_001.1"; - private final String variantId = "var_NC_001.1:g.1A>T"; + private final String assemblyComponent = "RefSeq:NC_003279.8"; + private final String variantId = "var_NC_003279.8:g.1A>T"; private final String reference = "AGRKB:000000001"; private void loadRequiredEntities() throws Exception { @@ -64,7 +64,7 @@ private void loadRequiredEntities() throws Exception { VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); createAllele(allele, "TestAlleleWithVariant", "NCBITaxon:6239", symbolTerm, false, dataProvider); - createAssemblyComponent(assemblyComponent, "Test1", dataProvider); + //createAssemblyComponent(assemblyComponent, "I", getGenomeAssembly("WBcel235"), dataProvider); } @@ -91,8 +91,9 @@ public void variantFmsBulkUpload() throws Exception { body("entity.variantType.curie", is("SO:1000002")). body("entity.sourceGeneralConsequence.curie", is("SO:0001587")). body("entity.curatedVariantGenomicLocations", hasSize(1)). + body("entity.curatedVariantGenomicLocations[0].hgvs", is("NC_003279.8:g.1A>T")). body("entity.curatedVariantGenomicLocations[0].relation.name", is("located_on")). - body("entity.curatedVariantGenomicLocations[0].variantGenomicLocationAssociationObject.name", is("Test1")). + body("entity.curatedVariantGenomicLocations[0].variantGenomicLocationAssociationObject.name", is("I")). body("entity.curatedVariantGenomicLocations[0].start", is(1)). body("entity.curatedVariantGenomicLocations[0].end", is(1000)). body("entity.alleleVariantAssociations", hasSize(1)). diff --git a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java index a2ebf8f1b..34bb40b0a 100644 --- a/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/base/BaseITCase.java @@ -1,14 +1,64 @@ package org.alliancegenome.curation_api.base; -import io.restassured.RestAssured; -import io.restassured.common.mapper.TypeRef; -import io.restassured.response.ValidatableResponse; +import static io.restassured.RestAssured.given; +import static org.hamcrest.Matchers.is; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map.Entry; + import org.alliancegenome.curation_api.constants.OntologyConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; -import org.alliancegenome.curation_api.model.entities.*; +import org.alliancegenome.curation_api.model.entities.AGMDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.AGMPhenotypeAnnotation; +import org.alliancegenome.curation_api.model.entities.AffectedGenomicModel; +import org.alliancegenome.curation_api.model.entities.Allele; +import org.alliancegenome.curation_api.model.entities.AlleleDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.AllelePhenotypeAnnotation; +import org.alliancegenome.curation_api.model.entities.AssemblyComponent; +import org.alliancegenome.curation_api.model.entities.BiologicalEntity; +import org.alliancegenome.curation_api.model.entities.ConditionRelation; +import org.alliancegenome.curation_api.model.entities.Construct; +import org.alliancegenome.curation_api.model.entities.CrossReference; +import org.alliancegenome.curation_api.model.entities.DataProvider; +import org.alliancegenome.curation_api.model.entities.ExperimentalCondition; +import org.alliancegenome.curation_api.model.entities.Gene; +import org.alliancegenome.curation_api.model.entities.GeneDiseaseAnnotation; +import org.alliancegenome.curation_api.model.entities.GenomeAssembly; +import org.alliancegenome.curation_api.model.entities.Note; +import org.alliancegenome.curation_api.model.entities.Organization; +import org.alliancegenome.curation_api.model.entities.Person; +import org.alliancegenome.curation_api.model.entities.Reference; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptor; +import org.alliancegenome.curation_api.model.entities.ResourceDescriptorPage; +import org.alliancegenome.curation_api.model.entities.SequenceTargetingReagent; +import org.alliancegenome.curation_api.model.entities.Variant; +import org.alliancegenome.curation_api.model.entities.Vocabulary; +import org.alliancegenome.curation_api.model.entities.VocabularyTerm; +import org.alliancegenome.curation_api.model.entities.VocabularyTermSet; 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.ontology.*; +import org.alliancegenome.curation_api.model.entities.ontology.AnatomicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.CHEBITerm; +import org.alliancegenome.curation_api.model.entities.ontology.ChemicalTerm; +import org.alliancegenome.curation_api.model.entities.ontology.DOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ECOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ExperimentalConditionOntologyTerm; +import org.alliancegenome.curation_api.model.entities.ontology.GOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.MITerm; +import org.alliancegenome.curation_api.model.entities.ontology.MMOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.MPTerm; +import org.alliancegenome.curation_api.model.entities.ontology.NCBITaxonTerm; +import org.alliancegenome.curation_api.model.entities.ontology.OntologyTerm; +import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.StageTerm; +import org.alliancegenome.curation_api.model.entities.ontology.UBERONTerm; +import org.alliancegenome.curation_api.model.entities.ontology.WBPhenotypeTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ZECOTerm; +import org.alliancegenome.curation_api.model.entities.ontology.ZFATerm; import org.alliancegenome.curation_api.model.entities.slotAnnotations.alleleSlotAnnotations.AlleleSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.constructSlotAnnotations.ConstructSymbolSlotAnnotation; import org.alliancegenome.curation_api.model.entities.slotAnnotations.geneSlotAnnotations.GeneSymbolSlotAnnotation; @@ -17,15 +67,9 @@ import org.alliancegenome.curation_api.response.SearchResponse; import org.apache.commons.lang3.StringUtils; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map.Entry; - -import static io.restassured.RestAssured.given; -import static org.hamcrest.Matchers.is; +import io.restassured.RestAssured; +import io.restassured.common.mapper.TypeRef; +import io.restassured.response.ValidatableResponse; public class BaseITCase { @@ -180,23 +224,6 @@ public Allele createAllele(String modEntityId, String symbol, String taxonCurie, return response.getEntity(); } - public BiologicalEntity createBiologicalEntity(String modEntityId, String taxonCurie) { - BiologicalEntity bioEntity = new BiologicalEntity(); - bioEntity.setModEntityId(modEntityId); - bioEntity.setTaxon(getNCBITaxonTerm(taxonCurie)); - - ObjectResponse response = given(). - contentType("application/json"). - body(bioEntity). - when(). - post("/api/biologicalentity"). - then(). - statusCode(200). - extract().body().as(getObjectResponseTypeRefBiologicalEntity()); - - return response.getEntity(); - } - public AnatomicalTerm createAnatomicalTerm(String curie, String name) throws Exception { AnatomicalTerm anatomicalTerm = new AnatomicalTerm(); anatomicalTerm.setCurie(curie); @@ -216,11 +243,12 @@ public AnatomicalTerm createAnatomicalTerm(String curie, String name) throws Exc return response.getEntity(); } - public AssemblyComponent createAssemblyComponent(String modEntityId, String name, DataProvider dataProvider) throws Exception { + public AssemblyComponent createAssemblyComponent(String modEntityId, String name, GenomeAssembly assembly, DataProvider dataProvider) throws Exception { AssemblyComponent assemblyComponent = new AssemblyComponent(); assemblyComponent.setModEntityId(modEntityId); assemblyComponent.setName(name); assemblyComponent.setDataProvider(dataProvider); + assemblyComponent.setGenomeAssembly(assembly); ObjectResponse response = RestAssured.given(). contentType("application/json"). @@ -234,6 +262,23 @@ public AssemblyComponent createAssemblyComponent(String modEntityId, String name return response.getEntity(); } + public BiologicalEntity createBiologicalEntity(String modEntityId, String taxonCurie) { + BiologicalEntity bioEntity = new BiologicalEntity(); + bioEntity.setModEntityId(modEntityId); + bioEntity.setTaxon(getNCBITaxonTerm(taxonCurie)); + + ObjectResponse response = given(). + contentType("application/json"). + body(bioEntity). + when(). + post("/api/biologicalentity"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefBiologicalEntity()); + + return response.getEntity(); + } + public CHEBITerm createChebiTerm(String curie, String name, Boolean obsolete) { CHEBITerm chebiTerm = new CHEBITerm(); chebiTerm.setCurie(curie); @@ -723,6 +768,23 @@ public ResourceDescriptorPage createResourceDescriptorPage(String name, String u return response.getEntity(); } + public SequenceTargetingReagent createSequenceTargetingReagent(String modEntityId, Boolean obsolete, String name) { + SequenceTargetingReagent sqtr = new SequenceTargetingReagent(); + sqtr.setModEntityId(modEntityId); + sqtr.setObsolete(obsolete); + sqtr.setName(name); + + ObjectResponse response = given(). + contentType("application/json"). + body(sqtr). + when(). + post("/api/sqtr"). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefSequenceTargetingReagent()); + return response.getEntity(); + } + public SOTerm createSoTerm(String curie, String name, Boolean obsolete) { SOTerm term = new SOTerm(); term.setCurie(curie); @@ -1047,23 +1109,6 @@ public SequenceTargetingReagent getSequenceTargetingReagent(String identifier) { return res.getEntity(); } - public SequenceTargetingReagent createSequenceTargetingReagent(String modEntityId, Boolean obsolete, String name) { - SequenceTargetingReagent sqtr = new SequenceTargetingReagent(); - sqtr.setModEntityId(modEntityId); - sqtr.setObsolete(obsolete); - sqtr.setName(name); - - ObjectResponse response = given(). - contentType("application/json"). - body(sqtr). - when(). - post("/api/sqtr"). - then(). - statusCode(200). - extract().body().as(getObjectResponseTypeRefSequenceTargetingReagent()); - return response.getEntity(); - } - public GeneDiseaseAnnotation getGeneDiseaseAnnotation(String uniqueId) { ObjectResponse res = RestAssured.given(). when(). @@ -1074,6 +1119,17 @@ public GeneDiseaseAnnotation getGeneDiseaseAnnotation(String uniqueId) { return res.getEntity(); } + + public GenomeAssembly getGenomeAssembly(String modEntityId) throws Exception { + ObjectResponse response = RestAssured.given(). + when(). + get("/api/genomeassembly/" + modEntityId). + then(). + statusCode(200). + extract().body().as(getObjectResponseTypeRefGenomeAssembly()); + + return response.getEntity(); + } public MPTerm getMpTerm(String curie) { ObjectResponse response = RestAssured.given(). @@ -1217,6 +1273,11 @@ private TypeRef> getObjectResponseTypeRefGene() { }; } + private TypeRef> getObjectResponseTypeRefGenomeAssembly() { + return new TypeRef>() { + }; + } + private TypeRef> getObjectResponseTypeRefSequenceTargetingReagent() { return new TypeRef>() { }; diff --git a/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json index 88605926d..08ab80653 100644 --- a/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json +++ b/src/test/resources/bulk/fms/10_variant/AF_01_all_fields.json @@ -1,7 +1,7 @@ [ { "alleleId": "WB:AlleleWithVar1", - "sequenceOfReferenceAccessionNumber": "RefSeq:NC_001.1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", "start": 1, "end": 1000, "genomicReferenceSequence": "A", From e64457bc81f3c3298d1cb38d05735da3db4bc0af Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 09:18:21 +0100 Subject: [PATCH 324/342] Fix migration --- ..._curated_variant_genomic_location_association.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index 7273d6a60..3c9685d3b 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -151,17 +151,17 @@ DELETE FROM bulkloadgroup WHERE name = 'Direct (LinkML) DQM Variant Loads'; INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'Variant Bulk Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'FB Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'FB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'ZFIN Phenotype Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'ZFIN Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'VARIATION'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) From 6fa58213561ef8166d9727e286a3cfd91d856f12 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 13:38:44 +0100 Subject: [PATCH 325/342] Integration tests --- .../interfaces/crud/VariantCrudInterface.java | 2 +- .../AlleleVariantAssociationService.java | 4 +- .../variants/HgvsIdentifierHelper.java | 46 ++++---- .../dto/fms/VariantFmsDTOValidator.java | 26 ++--- .../curation_api/VariantFmsITCase.java | 108 +++++++++++++++++- ...equence_of_reference_accession_number.json | 48 ++++++++ .../bulk/fms/10_variant/ER_02_empty_type.json | 48 ++++++++ ...R_03_empty_genomic_reference_sequence.json | 48 ++++++++ .../ER_04_empty_genomic_variant_sequence.json | 48 ++++++++ .../fms/10_variant/ER_05_empty_allele_id.json | 48 ++++++++ .../fms/10_variant/IV_01_invalid_type.json | 48 ++++++++ ...V_02_invalid_type_for_fms_submissions.json | 48 ++++++++ .../10_variant/IV_03_invalid_consequence.json | 48 ++++++++ ...equence_of_reference_accession_number.json | 48 ++++++++ .../10_variant/IV_05_invalid_allele_id.json | 48 ++++++++ .../bulk/fms/10_variant/MR_01_no_start.json | 47 ++++++++ .../bulk/fms/10_variant/MR_02_no_end.json | 47 ++++++++ ...equence_of_reference_accession_number.json | 47 ++++++++ .../bulk/fms/10_variant/MR_04_no_type.json | 47 ++++++++ .../MR_05_no_genomic_reference_sequence.json | 47 ++++++++ .../MR_06_no_genomic_variant_sequence.json | 47 ++++++++ .../fms/10_variant/MR_07_no_allele_id.json | 47 ++++++++ .../fms/10_variant/UD_01_update_variant.json | 48 ++++++++ 23 files changed, 1003 insertions(+), 40 deletions(-) create mode 100644 src/test/resources/bulk/fms/10_variant/ER_01_empty_sequence_of_reference_accession_number.json create mode 100644 src/test/resources/bulk/fms/10_variant/ER_02_empty_type.json create mode 100644 src/test/resources/bulk/fms/10_variant/ER_03_empty_genomic_reference_sequence.json create mode 100644 src/test/resources/bulk/fms/10_variant/ER_04_empty_genomic_variant_sequence.json create mode 100644 src/test/resources/bulk/fms/10_variant/ER_05_empty_allele_id.json create mode 100644 src/test/resources/bulk/fms/10_variant/IV_01_invalid_type.json create mode 100644 src/test/resources/bulk/fms/10_variant/IV_02_invalid_type_for_fms_submissions.json create mode 100644 src/test/resources/bulk/fms/10_variant/IV_03_invalid_consequence.json create mode 100644 src/test/resources/bulk/fms/10_variant/IV_04_invalid_sequence_of_reference_accession_number.json create mode 100644 src/test/resources/bulk/fms/10_variant/IV_05_invalid_allele_id.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_01_no_start.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_02_no_end.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_03_no_sequence_of_reference_accession_number.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_04_no_type.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_05_no_genomic_reference_sequence.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_06_no_genomic_variant_sequence.json create mode 100644 src/test/resources/bulk/fms/10_variant/MR_07_no_allele_id.json create mode 100644 src/test/resources/bulk/fms/10_variant/UD_01_update_variant.json diff --git a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java index 3aeb1ecf9..786743f55 100644 --- a/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java +++ b/src/main/java/org/alliancegenome/curation_api/interfaces/crud/VariantCrudInterface.java @@ -66,7 +66,7 @@ public interface VariantCrudInterface extends BaseSubmittedObjectCrudInterface find(@DefaultValue("0") @QueryParam("page") Integer page, @DefaultValue("10") @QueryParam("limit") Integer limit, @RequestBody HashMap params); @Override diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java index adf650992..b585c1494 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/alleleAssociations/AlleleVariantAssociationService.java @@ -12,6 +12,7 @@ import org.alliancegenome.curation_api.dao.GeneDAO; import org.alliancegenome.curation_api.dao.NoteDAO; import org.alliancegenome.curation_api.dao.PersonDAO; +import org.alliancegenome.curation_api.dao.VariantDAO; import org.alliancegenome.curation_api.dao.associations.alleleAssociations.AlleleVariantAssociationDAO; import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ApiErrorException; @@ -39,6 +40,7 @@ public class AlleleVariantAssociationService extends BaseEntityCrudService currentAssociations = variant.getAlleleVariantAssociations(); if (currentAssociations == null) { currentAssociations = new ArrayList<>(); diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java index 426221ad5..4328a7701 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java @@ -30,27 +30,31 @@ public static String getHgvsIdentifier(VariantFmsDTO dto) { } String hgvs = chrAccession + ":g." + start; - switch(dto.getType()) { - case "SO:1000002": // point mutation - hgvs = hgvs + refSeq + ">" + varSeq; - break; - case "SO:1000008": // substitution - hgvs = hgvs + refSeq + ">" + varSeq; - break; - case "SO:0000667": // insertion - hgvs = hgvs + "_" + end + "ins" + varSeq; - break; - case "SO:0000159": // deletion - hgvs = hgvs + "_" + end + "del"; - break; - case "SO:0002007": // MNV - hgvs = hgvs + "_" + end + "delins" + varSeq; - break; - case "SO:1000032": // delin - hgvs = hgvs + "_" + end + "delins" + varSeq; - break; - default: - hgvs = null; + if (StringUtils.isNotBlank(dto.getType())) { + switch(dto.getType()) { + case "SO:1000002": // point mutation + hgvs = hgvs + refSeq + ">" + varSeq; + break; + case "SO:1000008": // substitution + hgvs = hgvs + refSeq + ">" + varSeq; + break; + case "SO:0000667": // insertion + hgvs = hgvs + "_" + end + "ins" + varSeq; + break; + case "SO:0000159": // deletion + hgvs = hgvs + "_" + end + "del"; + break; + case "SO:0002007": // MNV + hgvs = hgvs + "_" + end + "delins" + varSeq; + break; + case "SO:1000032": // delin + hgvs = hgvs + "_" + end + "delins" + varSeq; + break; + default: + hgvs = null; + } + } else { + hgvs = null; } return hgvs; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index af061472d..de4e7ddf4 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -6,7 +6,6 @@ import java.util.Map; import java.util.Objects; -import org.alliancegenome.curation_api.constants.EntityFieldConstants; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.dao.AssemblyComponentDAO; @@ -44,7 +43,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; -import io.quarkus.logging.Log; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; import jakarta.transaction.Transactional; @@ -103,7 +101,7 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu } if (StringUtils.isBlank(dto.getGenomicVariantSequence()) && !Objects.equals(dto.getType(), "SO:0000667") && !Objects.equals(dto.getType(), "SO:1000032")) { - variantResponse.addErrorMessage("genomicReferenceSequence", ValidationConstants.REQUIRED_MESSAGE + " for variant type " + dto.getType()); + variantResponse.addErrorMessage("genomicVariantSequence", ValidationConstants.REQUIRED_MESSAGE + " for variant type " + dto.getType()); } } } else { @@ -209,7 +207,6 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, ObjectResponse cvglaResponse = new ObjectResponse(); AssemblyComponent chromosome = null; - if (dto.getStart() == null) { cvglaResponse.addErrorMessage("start", ValidationConstants.REQUIRED_MESSAGE); } @@ -239,10 +236,10 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, String hgvs = HgvsIdentifierHelper.getHgvsIdentifier(dto); - if (StringUtils.isNotBlank(hgvs) && !cvglaResponse.hasErrors() && CollectionUtils.isNotEmpty(variant.getCuratedVariantGenomicLocations())) { + if (variant != null && StringUtils.isNotBlank(hgvs) && !cvglaResponse.hasErrors() && CollectionUtils.isNotEmpty(variant.getCuratedVariantGenomicLocations())) { for (CuratedVariantGenomicLocationAssociation existingLocationAssociation : variant.getCuratedVariantGenomicLocations()) { if (Objects.equals(hgvs, existingLocationAssociation.getHgvs())) { - association = existingLocationAssociation; + association = curatedVariantGenomicLocationAssociationDAO.find(existingLocationAssociation.getId()); break; } } @@ -289,20 +286,19 @@ public void validateAlleleVariantAssociation(VariantFmsDTO dto, List idsAd if (StringUtils.isBlank(dto.getAlleleId())) { avaResponse.addErrorMessage("alleleId", ValidationConstants.REQUIRED_MESSAGE); } else { - if (CollectionUtils.isNotEmpty(variant.getAlleleVariantAssociations())) { - for (AlleleVariantAssociation existingAssociation : variant.getAlleleVariantAssociations()) { - if (Objects.equals(dto.getAlleleId(), existingAssociation.getAlleleAssociationSubject().getModEntityId())) { - association = existingAssociation; - break; - } - } - } - if (association.getId() == null) { Allele allele = alleleService.findByIdentifierString(dto.getAlleleId()); if (allele == null) { avaResponse.addErrorMessage("alleleId", ValidationConstants.INVALID_MESSAGE + " (" + dto.getAlleleId() + ")"); } else { + if (CollectionUtils.isNotEmpty(allele.getAlleleVariantAssociations())) { + for (AlleleVariantAssociation existingAssociation : allele.getAlleleVariantAssociations()) { + if (Objects.equals(dto.getAlleleId(), existingAssociation.getAlleleAssociationSubject().getModEntityId())) { + association = alleleVariantAssociationDAO.find(existingAssociation.getId()); + break; + } + } + } association.setAlleleAssociationSubject(allele); } } diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index a1750d8e9..7b8909717 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -48,9 +48,10 @@ public void init() { private final String variantFmsBulkPostEndpoint = "/api/variant/bulk/WB/fmsvariants"; private final String variantGetEndpoint = "/api/variant/"; private final String allele = "WB:AlleleWithVar1"; - private final String assemblyComponent = "RefSeq:NC_003279.8"; + private final String allele2 = "WB:AlleleWithVar2"; private final String variantId = "var_NC_003279.8:g.1A>T"; private final String reference = "AGRKB:000000001"; + private final String reference2 = "AGRKB:000000021"; private void loadRequiredEntities() throws Exception { createSoTerm("SO:1000002", "substitution", false); @@ -60,11 +61,12 @@ private void loadRequiredEntities() throws Exception { createSoTerm("SO:0000159", "deletion", false); createSoTerm("SO:1000032", "delins", false); createSoTerm("SO:0001587", "stop_gained", false); + createSoTerm("SO:0001578", "stop_lost", false); Vocabulary nameTypeVocabulary = getVocabulary(VocabularyConstants.NAME_TYPE_VOCABULARY); VocabularyTerm symbolTerm = getVocabularyTerm(nameTypeVocabulary, "nomenclature_symbol"); DataProvider dataProvider = createDataProvider("WB", false); createAllele(allele, "TestAlleleWithVariant", "NCBITaxon:6239", symbolTerm, false, dataProvider); - //createAssemblyComponent(assemblyComponent, "I", getGenomeAssembly("WBcel235"), dataProvider); + createAllele(allele2, "TestAlleleWithVariant2", "NCBITaxon:6239", symbolTerm, false, dataProvider); } @@ -110,5 +112,107 @@ public void variantFmsBulkUpload() throws Exception { body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage")); } + + @Test + @Order(2) + public void variantFmsBulkUploadUpdate() throws Exception { + HashMap> params = new HashMap<>(); + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); + + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "UD_01_update_variant.json", params); + + RestAssured.given(). + when(). + get(variantGetEndpoint + variantId). + then(). + statusCode(200). + body("entity.modInternalId", is(variantId)). + body("entity.taxon.curie", is("NCBITaxon:6239")). + body("entity.dataProvider.sourceOrganization.abbreviation", is("WB")). + body("entity.variantType.curie", is("SO:1000008")). + body("entity.sourceGeneralConsequence.curie", is("SO:0001578")). + body("entity.curatedVariantGenomicLocations", hasSize(1)). + body("entity.curatedVariantGenomicLocations[0].hgvs", is("NC_003279.8:g.1A>T")). + body("entity.curatedVariantGenomicLocations[0].relation.name", is("located_on")). + body("entity.curatedVariantGenomicLocations[0].variantGenomicLocationAssociationObject.name", is("I")). + body("entity.curatedVariantGenomicLocations[0].start", is(1)). + body("entity.curatedVariantGenomicLocations[0].end", is(1000)). + body("entity.alleleVariantAssociations", hasSize(2)). + body("entity.alleleVariantAssociations[0].relation.name", is("has_variant")). + body("entity.alleleVariantAssociations[0].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar1")). + body("entity.alleleVariantAssociations[1].relation.name", is("has_variant")). + body("entity.alleleVariantAssociations[1].alleleAssociationSubject.modEntityId", is("WB:AlleleWithVar2")). + body("entity.relatedNotes", hasSize(1)). + body("entity.relatedNotes[0].internal", is(false)). + body("entity.relatedNotes[0].freeText", is("This is an updated test note.")). + body("entity.relatedNotes[0].noteType.name", is("comment")). + body("entity.relatedNotes[0].references[0].curie", is(reference2)). + body("entity.crossReferences", hasSize(1)). + body("entity.crossReferences[0].referencedCurie", is("TEST:WBVar00252637")). + body("entity.crossReferences[0].displayName", is("TEST:WBVar00252637")). + body("entity.crossReferences[0].resourceDescriptorPage.name", is("homepage")); + + } + + @Test + @Order(3) + public void variantFmsBulkUploadMissingRequiredFields() throws Exception { + HashMap> params = new HashMap<>(); + params.put("Entities", createCountParams(1, 1, 0, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); + + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_01_no_start.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_02_no_end.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_03_no_sequence_of_reference_accession_number.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_04_no_type.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_05_no_genomic_reference_sequence.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_06_no_genomic_variant_sequence.json", params); + + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_07_no_allele_id.json", params); + } + + @Test + @Order(4) + public void variantFmsBulkUploadEmptyRequiredFields() throws Exception { + HashMap> params = new HashMap<>(); + params.put("Entities", createCountParams(1, 1, 0, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); + + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_01_empty_sequence_of_reference_accession_number.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_02_empty_type.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_03_empty_genomic_reference_sequence.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_04_empty_genomic_variant_sequence.json", params); + + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Locations", createCountParams(1, 0, 1, 0)); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_05_empty_allele_id.json", params); + } + + @Test + @Order(3) + public void variantFmsBulkUploadInvalidFields() throws Exception { + HashMap> params = new HashMap<>(); + params.put("Entities", createCountParams(1, 1, 0, 0)); + params.put("Locations", createCountParams(1, 1, 0, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_01_invalid_type.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_02_invalid_type_for_fms_submissions.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_03_invalid_consequence.json", params); + + params.put("Entities", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 0, 1, 0)); + + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_04_invalid_sequence_of_reference_accession_number.json", params); + + params.put("Locations", createCountParams(1, 0, 1, 0)); + params.put("Associations", createCountParams(1, 1, 0, 0)); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_05_invalid_allele_id.json", params); + } } diff --git a/src/test/resources/bulk/fms/10_variant/ER_01_empty_sequence_of_reference_accession_number.json b/src/test/resources/bulk/fms/10_variant/ER_01_empty_sequence_of_reference_accession_number.json new file mode 100644 index 000000000..2262e85c7 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/ER_01_empty_sequence_of_reference_accession_number.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/ER_02_empty_type.json b/src/test/resources/bulk/fms/10_variant/ER_02_empty_type.json new file mode 100644 index 000000000..195de9a76 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/ER_02_empty_type.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/ER_03_empty_genomic_reference_sequence.json b/src/test/resources/bulk/fms/10_variant/ER_03_empty_genomic_reference_sequence.json new file mode 100644 index 000000000..d7a853664 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/ER_03_empty_genomic_reference_sequence.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/ER_04_empty_genomic_variant_sequence.json b/src/test/resources/bulk/fms/10_variant/ER_04_empty_genomic_variant_sequence.json new file mode 100644 index 000000000..37d803915 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/ER_04_empty_genomic_variant_sequence.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/ER_05_empty_allele_id.json b/src/test/resources/bulk/fms/10_variant/ER_05_empty_allele_id.json new file mode 100644 index 000000000..4128735e4 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/ER_05_empty_allele_id.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/IV_01_invalid_type.json b/src/test/resources/bulk/fms/10_variant/IV_01_invalid_type.json new file mode 100644 index 000000000..cf64872c9 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/IV_01_invalid_type.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:Invalid", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/IV_02_invalid_type_for_fms_submissions.json b/src/test/resources/bulk/fms/10_variant/IV_02_invalid_type_for_fms_submissions.json new file mode 100644 index 000000000..4e26a3b13 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/IV_02_invalid_type_for_fms_submissions.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:0001587", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/IV_03_invalid_consequence.json b/src/test/resources/bulk/fms/10_variant/IV_03_invalid_consequence.json new file mode 100644 index 000000000..71aeb2580 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/IV_03_invalid_consequence.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:Invalid", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/IV_04_invalid_sequence_of_reference_accession_number.json b/src/test/resources/bulk/fms/10_variant/IV_04_invalid_sequence_of_reference_accession_number.json new file mode 100644 index 000000000..c9ba16122 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/IV_04_invalid_sequence_of_reference_accession_number.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:Invalid", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/IV_05_invalid_allele_id.json b/src/test/resources/bulk/fms/10_variant/IV_05_invalid_allele_id.json new file mode 100644 index 000000000..4b30042ec --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/IV_05_invalid_allele_id.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:Invalid", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_01_no_start.json b/src/test/resources/bulk/fms/10_variant/MR_01_no_start.json new file mode 100644 index 000000000..79abce088 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_01_no_start.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_02_no_end.json b/src/test/resources/bulk/fms/10_variant/MR_02_no_end.json new file mode 100644 index 000000000..735f8aa64 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_02_no_end.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_03_no_sequence_of_reference_accession_number.json b/src/test/resources/bulk/fms/10_variant/MR_03_no_sequence_of_reference_accession_number.json new file mode 100644 index 000000000..5daf65491 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_03_no_sequence_of_reference_accession_number.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_04_no_type.json b/src/test/resources/bulk/fms/10_variant/MR_04_no_type.json new file mode 100644 index 000000000..1c218b86b --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_04_no_type.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_05_no_genomic_reference_sequence.json b/src/test/resources/bulk/fms/10_variant/MR_05_no_genomic_reference_sequence.json new file mode 100644 index 000000000..090755af6 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_05_no_genomic_reference_sequence.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_06_no_genomic_variant_sequence.json b/src/test/resources/bulk/fms/10_variant/MR_06_no_genomic_variant_sequence.json new file mode 100644 index 000000000..45e9c273f --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_06_no_genomic_variant_sequence.json @@ -0,0 +1,47 @@ +[ + { + "alleleId": "WB:AlleleWithVar1", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/MR_07_no_allele_id.json b/src/test/resources/bulk/fms/10_variant/MR_07_no_allele_id.json new file mode 100644 index 000000000..10758b229 --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/MR_07_no_allele_id.json @@ -0,0 +1,47 @@ +[ + { + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000002", + "consequence": "SO:0001587", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is a test note.", + "references": [ + { + "publicationId": "PMID:25920550", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252636", + "pages": [ + "homepage" + ] + } + ] + } +] + diff --git a/src/test/resources/bulk/fms/10_variant/UD_01_update_variant.json b/src/test/resources/bulk/fms/10_variant/UD_01_update_variant.json new file mode 100644 index 000000000..0ce4614fc --- /dev/null +++ b/src/test/resources/bulk/fms/10_variant/UD_01_update_variant.json @@ -0,0 +1,48 @@ +[ + { + "alleleId": "WB:AlleleWithVar2", + "sequenceOfReferenceAccessionNumber": "RefSeq:NC_003279.8", + "start": 1, + "end": 1000, + "genomicReferenceSequence": "A", + "genomicVariantSequence": "T", + "type": "SO:1000008", + "consequence": "SO:0001578", + "references": [ + { + "publicationId": "PMID:25920554", + "crossReference": { + "id": "WB:WBPaper00042242", + "pages": [ + "reference" + ] + } + } + ], + "notes": [ + { + "note": "This is an updated test note.", + "references": [ + { + "publicationId": "PMID:25920551", + "crossReference": { + "id": "WB:WBPaper00042241", + "pages": [ + "reference" + ] + } + } + ] + } + ], + "crossReferences": [ + { + "id": "TEST:WBVar00252637", + "pages": [ + "homepage" + ] + } + ] + } +] + From 297b285082bb73b30ad13c0d0b0bdd3cbb11cb7a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 13:49:11 +0100 Subject: [PATCH 326/342] Checkstyle fixes --- .../enums/ChromosomeAccessionEnum.java | 4 ++-- .../jobs/executors/VariantFmsExecutor.java | 4 ---- .../model/entities/AssemblyComponent.java | 5 ----- .../VariantGenomicLocationAssociation.java | 3 --- ...VariantGenomicLocationAssociationService.java | 2 +- .../helpers/variants/HgvsIdentifierHelper.java | 2 +- .../validation/dto/VariantDTOValidator.java | 3 --- .../dto/fms/CrossReferenceFmsDTOValidator.java | 4 ++-- .../dto/fms/VariantFmsDTOValidator.java | 16 ++++++++-------- .../curation_api/VariantFmsITCase.java | 7 +++---- 10 files changed, 17 insertions(+), 33 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java index 1b936d27d..bbcf0729c 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java @@ -151,8 +151,8 @@ public static String getChromosomeAccession(String chromosomeName, String assemb return null; } for (ChromosomeAccessionEnum chromosome : values()) { - if (chromosomeName.equals(chromosome.chromosomeName) && - assemblyIdentifier.equals(chromosome.assemblyIdentifier)) { + if (chromosomeName.equals(chromosome.chromosomeName) + && assemblyIdentifier.equals(chromosome.assemblyIdentifier)) { return chromosome.accession; } } diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java index ce2d82972..cbb96a931 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java @@ -3,7 +3,6 @@ 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; @@ -14,7 +13,6 @@ import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; 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.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantIngestFmsDTO; import org.alliancegenome.curation_api.response.APIResponse; @@ -22,11 +20,9 @@ import org.alliancegenome.curation_api.services.VariantService; import org.alliancegenome.curation_api.services.associations.alleleAssociations.AlleleVariantAssociationService; import org.alliancegenome.curation_api.services.associations.variantAssociations.CuratedVariantGenomicLocationAssociationService; -import org.alliancegenome.curation_api.services.helpers.gff3.Gff3AttributesHelper; import org.alliancegenome.curation_api.services.validation.dto.fms.VariantFmsDTOValidator; import org.alliancegenome.curation_api.util.ProcessDisplayHelper; import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.tuple.ImmutablePair; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java index 7446d8643..a0a58a63e 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AssemblyComponent.java @@ -4,14 +4,9 @@ import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; 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; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java index 506299681..bc2f3176a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java @@ -3,8 +3,6 @@ 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.Exon; -import org.alliancegenome.curation_api.model.entities.LocationAssociation; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; @@ -21,7 +19,6 @@ 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; diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java index f7db87280..898536f55 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java @@ -30,7 +30,7 @@ @JBossLog @RequestScoped -public class CuratedVariantGenomicLocationAssociationService extends BaseEntityCrudService { +public class CuratedVariantGenomicLocationAssociationService extends BaseEntityCrudService { @Inject CuratedVariantGenomicLocationAssociationDAO curatedVariantGenomicLocationAssociationDAO; @Inject VariantFmsDTOValidator variantFmsDtoValidator; diff --git a/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java index 4328a7701..331712250 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java +++ b/src/main/java/org/alliancegenome/curation_api/services/helpers/variants/HgvsIdentifierHelper.java @@ -31,7 +31,7 @@ public static String getHgvsIdentifier(VariantFmsDTO dto) { String hgvs = chrAccession + ":g." + start; if (StringUtils.isNotBlank(dto.getType())) { - switch(dto.getType()) { + switch (dto.getType()) { case "SO:1000002": // point mutation hgvs = hgvs + refSeq + ">" + varSeq; break; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java index e92a91372..134bbc2ea 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/VariantDTOValidator.java @@ -2,7 +2,6 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; import org.alliancegenome.curation_api.constants.ValidationConstants; import org.alliancegenome.curation_api.constants.VocabularyConstants; @@ -16,12 +15,10 @@ import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.model.entities.ontology.SOTerm; import org.alliancegenome.curation_api.model.ingest.dto.VariantDTO; -import org.alliancegenome.curation_api.model.ingest.dto.fms.VariantFmsDTO; import org.alliancegenome.curation_api.response.ObjectResponse; import org.alliancegenome.curation_api.response.SearchResponse; import org.alliancegenome.curation_api.services.VocabularyTermService; import org.alliancegenome.curation_api.services.helpers.notes.NoteIdentityHelper; -import org.alliancegenome.curation_api.services.helpers.variants.HgvsIdentifierHelper; import org.alliancegenome.curation_api.services.ontology.SoTermService; import org.alliancegenome.curation_api.services.validation.dto.base.BaseDTOValidator; import org.apache.commons.collections.CollectionUtils; diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java index 2b60fea8d..a5606a08f 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/CrossReferenceFmsDTOValidator.java @@ -33,7 +33,7 @@ public ObjectResponse> validateCrossReferenceFmsDTO(CrossRe pageNames = dto.getPages(); } - for (String pageName : pageNames) { + for (String pageName : pageNames) { CrossReference xref = new CrossReference(); if (StringUtils.isBlank(dto.getId())) { @@ -59,7 +59,7 @@ public ObjectResponse> validateCrossReferenceFmsDTO(CrossRe xref.setResourceDescriptorPage(page); xrefList.add(xref); } - } + } } crResponse.setEntity(xrefList); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index de4e7ddf4..731fb71ef 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -88,9 +88,9 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu SOTerm variantType = null; if (StringUtils.isBlank(dto.getType())) { variantResponse.addErrorMessage("type", ValidationConstants.REQUIRED_MESSAGE); - } else if (Objects.equals(dto.getType(), "SO:1000002") || Objects.equals(dto.getType(), "SO:1000008") || - Objects.equals(dto.getType(), "SO:0000667") || Objects.equals(dto.getType(), "SO:0000159") || - Objects.equals(dto.getType(), "SO:0002007") || Objects.equals(dto.getType(), "SO:1000032")) { + } else if (Objects.equals(dto.getType(), "SO:1000002") || Objects.equals(dto.getType(), "SO:1000008") + || Objects.equals(dto.getType(), "SO:0000667") || Objects.equals(dto.getType(), "SO:0000159") + || Objects.equals(dto.getType(), "SO:0002007") || Objects.equals(dto.getType(), "SO:1000032")) { variantType = soTermService.findByCurieOrSecondaryId(dto.getType()); if (variantType == null) { variantResponse.addErrorMessage("type", ValidationConstants.INVALID_MESSAGE + " (" + dto.getType() + ")"); @@ -203,13 +203,13 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu @Transactional public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, List idsAdded, Variant variant) throws ValidationException { - CuratedVariantGenomicLocationAssociation association = new CuratedVariantGenomicLocationAssociation(); + CuratedVariantGenomicLocationAssociation association = new CuratedVariantGenomicLocationAssociation(); ObjectResponse cvglaResponse = new ObjectResponse(); AssemblyComponent chromosome = null; if (dto.getStart() == null) { cvglaResponse.addErrorMessage("start", ValidationConstants.REQUIRED_MESSAGE); - } + } if (dto.getEnd() == null) { cvglaResponse.addErrorMessage("end", ValidationConstants.REQUIRED_MESSAGE); @@ -229,8 +229,8 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, } } if (chromosome == null) { - cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.INVALID_MESSAGE + " (" + - dto.getSequenceOfReferenceAccessionNumber() + ")"); + cvglaResponse.addErrorMessage("sequenceOfReferenceAccessionNumber", ValidationConstants.INVALID_MESSAGE + " (" + + dto.getSequenceOfReferenceAccessionNumber() + ")"); } } @@ -253,7 +253,7 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, association.setRelation(vocabularyTermService.getTermInVocabulary(VocabularyConstants.LOCATION_ASSOCIATION_RELATION_VOCABULARY, "located_on").getEntity()); if (StringUtils.isNotBlank(dto.getGenomicReferenceSequence())) { association.setReferenceSequence(dto.getGenomicReferenceSequence()); - } + } if (StringUtils.isNotBlank(dto.getGenomicVariantSequence())) { association.setVariantSequence(dto.getGenomicVariantSequence()); } diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index 7b8909717..def629f99 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -8,7 +8,6 @@ import org.alliancegenome.curation_api.base.BaseITCase; import org.alliancegenome.curation_api.constants.VocabularyConstants; import org.alliancegenome.curation_api.model.entities.DataProvider; -import org.alliancegenome.curation_api.model.entities.GenomeAssembly; import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; @@ -173,7 +172,7 @@ public void variantFmsBulkUploadMissingRequiredFields() throws Exception { params.put("Entities", createCountParams(1, 0, 1, 0)); params.put("Locations", createCountParams(1, 0, 1, 0)); - checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_07_no_allele_id.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "MR_07_no_allele_id.json", params); } @Test @@ -191,7 +190,7 @@ public void variantFmsBulkUploadEmptyRequiredFields() throws Exception { params.put("Entities", createCountParams(1, 0, 1, 0)); params.put("Locations", createCountParams(1, 0, 1, 0)); - checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_05_empty_allele_id.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "ER_05_empty_allele_id.json", params); } @Test @@ -212,7 +211,7 @@ public void variantFmsBulkUploadInvalidFields() throws Exception { params.put("Locations", createCountParams(1, 0, 1, 0)); params.put("Associations", createCountParams(1, 1, 0, 0)); - checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_05_invalid_allele_id.json", params); + checkBulkLoadRecordCounts(variantFmsBulkPostEndpoint, variantFmsTestFilePath + "IV_05_invalid_allele_id.json", params); } } From f48465bf90afd54c4e989af97e7cee8927fc4fde Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 13:51:50 +0100 Subject: [PATCH 327/342] Prettify --- .../cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js index c0784d2e3..936baa078 100644 --- a/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js +++ b/src/main/cliapp/src/containers/dataLoadsPage/DataLoadsComponent.js @@ -87,7 +87,7 @@ export const DataLoadsComponent = () => { // 'VariantDTO', 'ConstructDTO', 'AlleleGeneAssociationDTO', - 'ConstructGenomicEntityAssociationDTO' + 'ConstructGenomicEntityAssociationDTO', ], ], ['DISEASE_ANNOTATION', ['GeneDiseaseAnnotationDTO', 'AlleleDiseaseAnnotationDTO', 'AGMDiseaseAnnotationDTO']], From d37e02e89025ec3d6dbfc1de0dc4a1db4d296132 Mon Sep 17 00:00:00 2001 From: Olin Blodgett Date: Fri, 25 Oct 2024 11:45:53 -0400 Subject: [PATCH 328/342] ReEnabled indexing for phenotypes --- .../curation_api/model/entities/AGMPhenotypeAnnotation.java | 4 ++-- .../model/entities/AllelePhenotypeAnnotation.java | 4 ++-- .../curation_api/model/entities/GenePhenotypeAnnotation.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java index a847152f0..373c00259 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java @@ -27,7 +27,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -//@Indexed +@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @@ -159,4 +159,4 @@ public String getSubjectSpeciesName() { } return phenotypeAnnotationSubject.getTaxon().getGenusSpecies(); } -} \ No newline at end of file +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java index a20b9b2a0..be8f61b1f 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java @@ -27,7 +27,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -//@Indexed +@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @@ -137,4 +137,4 @@ public String getSubjectSpeciesName() { } return phenotypeAnnotationSubject.getTaxon().getGenusSpecies(); } -} \ No newline at end of file +} diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java index fa1469d80..73bc911d6 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java @@ -20,7 +20,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; -//@Indexed +@Indexed @Entity @Data @EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true) @@ -100,4 +100,4 @@ public String getSubjectSpeciesName() { } return phenotypeAnnotationSubject.getTaxon().getGenusSpecies(); } -} \ No newline at end of file +} From b79e0c3599817b8ba98161683bb20a90a7a70615 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 16:58:47 +0100 Subject: [PATCH 329/342] Re-import index libraries --- .../curation_api/model/entities/AGMPhenotypeAnnotation.java | 1 + .../curation_api/model/entities/AllelePhenotypeAnnotation.java | 1 + .../curation_api/model/entities/GenePhenotypeAnnotation.java | 1 + 3 files changed, 3 insertions(+) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java index 373c00259..d23d9dc19 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AGMPhenotypeAnnotation.java @@ -9,6 +9,7 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java index be8f61b1f..b3a893e3a 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/AllelePhenotypeAnnotation.java @@ -9,6 +9,7 @@ import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java index 73bc911d6..f8f9ad158 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/GenePhenotypeAnnotation.java @@ -5,6 +5,7 @@ import org.alliancegenome.curation_api.view.View; import org.eclipse.microprofile.openapi.annotations.media.Schema; import org.hibernate.search.mapper.pojo.automaticindexing.ReindexOnUpdate; +import org.hibernate.search.mapper.pojo.mapping.definition.annotation.Indexed; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexedEmbedded; import org.hibernate.search.mapper.pojo.mapping.definition.annotation.IndexingDependency; From bda4cf73a2266a6f349a54fe06f9b50849eb1b8a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 17:30:03 +0100 Subject: [PATCH 330/342] Rename bulk load groups --- .../VariantGenomicLocationAssociation.java | 4 +-- ...d_variant_genomic_location_association.sql | 29 +++++++++++++------ 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java index bc2f3176a..578f67878 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java @@ -69,13 +69,13 @@ public abstract class VariantGenomicLocationAssociation extends VariantLocationA @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "insertedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 1000) + @Column(length = 4000) private String insertedSequence; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "deletedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 1000) + @Column(length = 4000) private String deletedSequence; @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index 3c9685d3b..e5a60ba20 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -25,8 +25,8 @@ CREATE TABLE curatedvariantgenomiclocation ( genelocalizationtype_id bigint, consequence_id bigint, curatedconsequence_id bigint, - referencesequence character varying(1000), - variantsequence character varying(1000) + referencesequence character varying(4000), + variantsequence character varying(4000) ); CREATE TABLE curatedvariantgenomiclocation_informationcontententity ( @@ -149,19 +149,30 @@ DELETE FROM bulkmanualload WHERE id IN (SELECT id FROM bulkload WHERE backendbul DELETE FROM bulkload WHERE backendbulkloadtype = 'VARIANT'; DELETE FROM bulkloadgroup WHERE name = 'Direct (LinkML) DQM Variant Loads'; -INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'Variant Bulk Loads'); +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Expression Loads' WHERE name = 'Expression Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) HTP Expression Dataset Annotation Loads' WHERE name = 'HTP Expression Dataset Annotation Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) HTP Expression Dataset Sample Annotation Loads' WHERE name = 'HTP Expression Dataset Sample Annotation Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Interaction Loads' WHERE name = 'Interaction Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Molecule Loads' WHERE name = 'Molecule Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Orthology Loads' WHERE name = 'Orthology Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Paralogy Loads' WHERE name = 'Paralogy Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Phenotype Loads' WHERE name = 'Phenotype Bulk Loads'; +UPDATE bulkloadgroup SET name = 'File Management System (FMS) Sequence Targeting Reagent Loads' WHERE name = 'Sequence Targeting Reagent Bulk Loads'; +UPDATE bulkloadgroup SET name = 'Expression Atlas Loads' WHERE name = 'Expression Atlas Load'; + +INSERT INTO bulkloadgroup (id, name) VALUES (nextval('bulkloadgroup_seq'), 'File Management System (FMS) Variant Loads'); INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'FB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'FB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'ZFIN Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'Variant Bulk Loads'; + SELECT nextval('bulkload_seq'), 'VARIATION', 'ZFIN Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkscheduledload (id, cronschedule, scheduleactive) SELECT id, '0 0 22 ? * SUN-THU', false FROM bulkload WHERE backendbulkloadtype = 'VARIATION'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) From caa5ce7219312ea8024e89af401fee5e44e610d8 Mon Sep 17 00:00:00 2001 From: Adam Gibson Date: Fri, 25 Oct 2024 12:22:56 -0500 Subject: [PATCH 331/342] pass down default column width --- src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js b/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js index a53fd8d90..88ff2f443 100644 --- a/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js +++ b/src/main/cliapp/src/containers/moleculesPage/MoleculesTable.js @@ -115,6 +115,7 @@ export const MoleculesTable = () => { tableState={tableState} setTableState={setTableState} columns={columns} + defaultColumnWidth={DEFAULT_COLUMN_WIDTH} dataKey="curie" isEditable={false} isInEditMode={isInEditMode} From 052bfbe615cfb54daec43e23acfe88999f6cd807 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 19:07:55 +0100 Subject: [PATCH 332/342] Switch to text columns --- .../VariantGenomicLocationAssociation.java | 4 ++-- ....37.0.64__curated_variant_genomic_location_association.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java index 578f67878..d070e6faf 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantGenomicLocationAssociation.java @@ -69,13 +69,13 @@ public abstract class VariantGenomicLocationAssociation extends VariantLocationA @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "insertedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 4000) + @Column(columnDefinition = "TEXT") private String insertedSequence; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "deletedSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 4000) + @Column(columnDefinition = "TEXT") private String deletedSequence; @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index e5a60ba20..24aa9ad13 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -25,8 +25,8 @@ CREATE TABLE curatedvariantgenomiclocation ( genelocalizationtype_id bigint, consequence_id bigint, curatedconsequence_id bigint, - referencesequence character varying(4000), - variantsequence character varying(4000) + referencesequence text, + variantsequence text ); CREATE TABLE curatedvariantgenomiclocation_informationcontententity ( From acfedab8076701889f60062544ab6df49f928084 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 19:36:51 +0100 Subject: [PATCH 333/342] Remove SGD load --- ....37.0.64__curated_variant_genomic_location_association.sql | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index 24aa9ad13..1d5707257 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -167,8 +167,6 @@ INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'VARIATION', 'MGI Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'VARIATION', 'RGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; -INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) - SELECT nextval('bulkload_seq'), 'VARIATION', 'SGD Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) SELECT nextval('bulkload_seq'), 'VARIATION', 'WB Variant Load', 'STOPPED', id FROM bulkloadgroup WHERE name = 'File Management System (FMS) Variant Loads'; INSERT INTO bulkload (id, backendbulkloadtype, name, bulkloadstatus, group_id) @@ -181,8 +179,6 @@ INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'VARIATION', 'MGI' FROM bulkload WHERE name = 'MGI Variant Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'VARIATION', 'RGD' FROM bulkload WHERE name = 'RGD Variant Load'; -INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) - SELECT id, 'VARIATION', 'SGD' FROM bulkload WHERE name = 'SGD Variant Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) SELECT id, 'VARIATION', 'WB' FROM bulkload WHERE name = 'WB Variant Load'; INSERT INTO bulkfmsload (id, fmsdatatype, fmsdatasubtype) From 619c5846bdbe61cdad8f83854ea78feabeb92b85 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 21:04:24 +0100 Subject: [PATCH 334/342] More text columns --- .../variantAssociations/VariantLocationAssociation.java | 4 ++-- ....37.0.64__curated_variant_genomic_location_association.sql | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java index 4d6ac9fae..130ba9fa1 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java @@ -54,13 +54,13 @@ public abstract class VariantLocationAssociation extends LocationAssociation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "referenceSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 1000) + @Column(columnDefinition = "TEXT") private String referenceSequence; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "variantSequence_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) - @Column(length = 1000) + @Column(columnDefinition = "TEXT") private String variantSequence; @IndexedEmbedded(includePaths = {"curie", "name", "secondaryIdentifiers", "synonyms.name", "namespace", diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index 1d5707257..d54849ddd 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -12,8 +12,8 @@ CREATE TABLE curatedvariantgenomiclocation ( variationstrand character varying(1), hgvs character varying(255), paddedbase character varying(1), - insertedsequence character varying(1000), - deletedsequence character varying(1000), + insertedsequence text, + deletedsequence text, numberadditionaldnabasepairs integer, numberremoveddnabasepairs integer, createdby_id bigint, From a85a663cfca073d47aa7d4e60c71c58b6a8411ce Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 21:53:40 +0100 Subject: [PATCH 335/342] Use HGVSg md5sum as variant modInternalId --- .../services/validation/dto/fms/VariantFmsDTOValidator.java | 3 ++- .../java/org/alliancegenome/curation_api/VariantFmsITCase.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index 731fb71ef..b945c08f1 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -40,6 +40,7 @@ import org.alliancegenome.curation_api.services.helpers.variants.HgvsIdentifierHelper; import org.alliancegenome.curation_api.services.ontology.NcbiTaxonTermService; import org.alliancegenome.curation_api.services.ontology.SoTermService; +import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -109,7 +110,7 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu } String hgvs = HgvsIdentifierHelper.getHgvsIdentifier(dto); - String modInternalId = "var_" + hgvs; + String modInternalId = DigestUtils.md5Hex(hgvs); if (StringUtils.isNotBlank(hgvs) && !variantResponse.hasErrors()) { SearchResponse searchResponse = variantDAO.findByField("modInternalId", modInternalId); diff --git a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java index def629f99..b78e22251 100644 --- a/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java +++ b/src/test/java/org/alliancegenome/curation_api/VariantFmsITCase.java @@ -11,6 +11,7 @@ import org.alliancegenome.curation_api.model.entities.Vocabulary; import org.alliancegenome.curation_api.model.entities.VocabularyTerm; import org.alliancegenome.curation_api.resources.TestContainerResource; +import org.apache.commons.codec.digest.DigestUtils; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.MethodOrderer; @@ -48,7 +49,7 @@ public void init() { private final String variantGetEndpoint = "/api/variant/"; private final String allele = "WB:AlleleWithVar1"; private final String allele2 = "WB:AlleleWithVar2"; - private final String variantId = "var_NC_003279.8:g.1A>T"; + private final String variantId = DigestUtils.md5Hex("NC_003279.8:g.1A>T"); private final String reference = "AGRKB:000000001"; private final String reference2 = "AGRKB:000000021"; From d0f76f248433b046e0eb7dd431be4e5ece624e5a Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 22:03:30 +0100 Subject: [PATCH 336/342] Make hgvs text column --- .../variantAssociations/VariantLocationAssociation.java | 1 + ...v0.37.0.64__curated_variant_genomic_location_association.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java index 130ba9fa1..602e48636 100644 --- a/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java +++ b/src/main/java/org/alliancegenome/curation_api/model/entities/associations/variantAssociations/VariantLocationAssociation.java @@ -49,6 +49,7 @@ public abstract class VariantLocationAssociation extends LocationAssociation { @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") @KeywordField(name = "hgvs_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer") @JsonView({ View.FieldsOnly.class }) + @Column(columnDefinition = "TEXT") private String hgvs; @FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer") diff --git a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql index d54849ddd..e6e8b5c2c 100644 --- a/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql +++ b/src/main/resources/db/migration/v0.37.0.64__curated_variant_genomic_location_association.sql @@ -10,7 +10,7 @@ CREATE TABLE curatedvariantgenomiclocation ( start integer, phase integer, variationstrand character varying(1), - hgvs character varying(255), + hgvs text, paddedbase character varying(1), insertedsequence text, deletedsequence text, From a7ade5a1ab66552f730123606e1171b2bf04b78c Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 22:30:28 +0100 Subject: [PATCH 337/342] Fix incorrect constant --- .../curation_api/constants/EntityFieldConstants.java | 1 + .../curation_api/jobs/executors/VariantFmsExecutor.java | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) 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 09ac6c7d1..7eb0a89cd 100644 --- a/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java +++ b/src/main/java/org/alliancegenome/curation_api/constants/EntityFieldConstants.java @@ -38,6 +38,7 @@ private EntityFieldConstants() { 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 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; diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java index cbb96a931..544fd07f8 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java @@ -40,8 +40,7 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { BulkFMSLoad fms = (BulkFMSLoad) bulkLoadFileHistory.getBulkLoad(); VariantIngestFmsDTO variantData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), VariantIngestFmsDTO.class); - bulkLoadFileHistory.getBulkLoadFile().setRecordCount(variantData.getData().size()); - + AGRCurationSchemaVersion version = CuratedVariantGenomicLocationAssociation.class.getAnnotation(AGRCurationSchemaVersion.class); bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (variantData.getMetaData() != null && StringUtils.isNotBlank(variantData.getMetaData().getRelease())) { From 9b433b81db0af8cf7399a3e2379aad9faa78aa7d Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 22:35:13 +0100 Subject: [PATCH 338/342] Actually fix incorrect constant --- .../CuratedVariantGenomicLocationAssociationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java index 898536f55..78f47a501 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java +++ b/src/main/java/org/alliancegenome/curation_api/services/associations/variantAssociations/CuratedVariantGenomicLocationAssociationService.java @@ -48,7 +48,7 @@ public List getIdsByDataProvider(BackendBulkDataProvider dataProvider) { Map params = new HashMap<>(); params.put(EntityFieldConstants.VARIANT_ASSOCIATION_SUBJECT_DATA_PROVIDER, dataProvider.sourceOrganization); if (StringUtils.equals(dataProvider.sourceOrganization, "RGD")) { - params.put(EntityFieldConstants.EXON_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); + params.put(EntityFieldConstants.VARIANT_ASSOCIATION_SUBJECT_TAXON, dataProvider.canonicalTaxonCurie); } List associationIds = curatedVariantGenomicLocationAssociationDAO.findIdsByParams(params); associationIds.removeIf(Objects::isNull); From 27d08befcfab38d27e85a5c59dcb21d3f1572b76 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 22:50:56 +0100 Subject: [PATCH 339/342] Use correct assembyl accessions --- .../enums/ChromosomeAccessionEnum.java | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java index bbcf0729c..05e9dceb5 100644 --- a/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java +++ b/src/main/java/org/alliancegenome/curation_api/enums/ChromosomeAccessionEnum.java @@ -27,50 +27,50 @@ public enum ChromosomeAccessionEnum { FB_211000022280494("211000022280494", "RefSeq:NW_001845164.1", "R6"), FB_211000022280703("211000022280703", "RefSeq:NW_001845199.1", "R6"), FB_RDNA("rDNA", "RefSeq:NW_007931121.1", "R6"), - MGI_1("1", "RefSeq:NC_000067.6", "GRCm39"), - MGI_2("2", "RefSeq:NC_000068.7", "GRCm39"), - MGI_3("3", "RefSeq:NC_000069.6", "GRCm39"), - MGI_4("4", "RefSeq:NC_000070.6", "GRCm39"), - MGI_5("5", "RefSeq:NC_000071.6", "GRCm39"), - MGI_6("6", "RefSeq:NC_000072.6", "GRCm39"), - MGI_7("7", "RefSeq:NC_000073.6", "GRCm39"), - MGI_8("8", "RefSeq:NC_000074.6", "GRCm39"), - MGI_9("9", "RefSeq:NC_000075.6", "GRCm39"), - MGI_10("10", "RefSeq:NC_000076.6", "GRCm39"), - MGI_11("11", "RefSeq:NC_000077.6", "GRCm39"), - MGI_12("12", "RefSeq:NC_000078.6", "GRCm39"), - MGI_13("13", "RefSeq:NC_000079.6", "GRCm39"), - MGI_14("14", "RefSeq:NC_000080.6", "GRCm39"), - MGI_15("15", "RefSeq:NC_000081.6", "GRCm39"), - MGI_16("16", "RefSeq:NC_000082.6", "GRCm39"), - MGI_17("17", "RefSeq:NC_000083.6", "GRCm39"), - MGI_18("18", "RefSeq:NC_000084.6", "GRCm39"), - MGI_19("19", "RefSeq:NC_000085.6", "GRCm39"), - MGI_X("X", "RefSeq:NC_000086.7", "GRCm39"), - MGI_Y("Y", "RefSeq:NC_000087.7", "GRCm39"), + MGI_1("1", "RefSeq:NC_000067.7", "GRCm39"), + MGI_2("2", "RefSeq:NC_000068.8", "GRCm39"), + MGI_3("3", "RefSeq:NC_000069.7", "GRCm39"), + MGI_4("4", "RefSeq:NC_000070.7", "GRCm39"), + MGI_5("5", "RefSeq:NC_000071.7", "GRCm39"), + MGI_6("6", "RefSeq:NC_000072.7", "GRCm39"), + MGI_7("7", "RefSeq:NC_000073.7", "GRCm39"), + MGI_8("8", "RefSeq:NC_000074.7", "GRCm39"), + MGI_9("9", "RefSeq:NC_000075.7", "GRCm39"), + MGI_10("10", "RefSeq:NC_000076.7", "GRCm39"), + MGI_11("11", "RefSeq:NC_000077.7", "GRCm39"), + MGI_12("12", "RefSeq:NC_000078.7", "GRCm39"), + MGI_13("13", "RefSeq:NC_000079.7", "GRCm39"), + MGI_14("14", "RefSeq:NC_000080.7", "GRCm39"), + MGI_15("15", "RefSeq:NC_000081.7", "GRCm39"), + MGI_16("16", "RefSeq:NC_000082.7", "GRCm39"), + MGI_17("17", "RefSeq:NC_000083.7", "GRCm39"), + MGI_18("18", "RefSeq:NC_000084.7", "GRCm39"), + MGI_19("19", "RefSeq:NC_000085.7", "GRCm39"), + MGI_X("X", "RefSeq:NC_000086.8", "GRCm39"), + MGI_Y("Y", "RefSeq:NC_000087.8", "GRCm39"), MGI_MT("MT", "RefSeq:NC_005089.1", "GRCm39"), - RGD_1("1", "RefSeq:NC_005100.4", "mRatBN7.2"), - RGD_2("2", "RefSeq:NC_005101.4", "mRatBN7.2"), - RGD_3("3", "RefSeq:NC_005102.4", "mRatBN7.2"), - RGD_4("4", "RefSeq:NC_005103.4", "mRatBN7.2"), - RGD_5("5", "RefSeq:NC_005104.4", "mRatBN7.2"), - RGD_6("6", "RefSeq:NC_005105.4", "mRatBN7.2"), - RGD_7("7", "RefSeq:NC_005106.4", "mRatBN7.2"), - RGD_8("8", "RefSeq:NC_005107.4", "mRatBN7.2"), - RGD_9("9", "RefSeq:NC_005108.4", "mRatBN7.2"), - RGD_10("10", "RefSeq:NC_005109.4", "mRatBN7.2"), - RGD_11("11", "RefSeq:NC_005110.4", "mRatBN7.2"), - RGD_12("12", "RefSeq:NC_005111.4", "mRatBN7.2"), - RGD_13("13", "RefSeq:NC_005112.4", "mRatBN7.2"), - RGD_14("14", "RefSeq:NC_005113.4", "mRatBN7.2"), - RGD_15("15", "RefSeq:NC_005114.4", "mRatBN7.2"), - RGD_16("16", "RefSeq:NC_005115.4", "mRatBN7.2"), - RGD_17("17", "RefSeq:NC_005116.4", "mRatBN7.2"), - RGD_18("18", "RefSeq:NC_005117.4", "mRatBN7.2"), - RGD_19("19", "RefSeq:NC_005118.4", "mRatBN7.2"), - RGD_20("20", "RefSeq:NC_005119.4", "mRatBN7.2"), - RGD_X("X", "RefSeq:NC_005120.4", "mRatBN7.2"), - RGD_Y("Y", "RefSeq:NC_024475.1", "mRatBN7.2"), + RGD_1("1", "RefSeq:NC_051336.1", "mRatBN7.2"), + RGD_2("2", "RefSeq:NC_051337.1", "mRatBN7.2"), + RGD_3("3", "RefSeq:NC_051338.1", "mRatBN7.2"), + RGD_4("4", "RefSeq:NC_051339.1", "mRatBN7.2"), + RGD_5("5", "RefSeq:NC_051340.1", "mRatBN7.2"), + RGD_6("6", "RefSeq:NC_051341.1", "mRatBN7.2"), + RGD_7("7", "RefSeq:NC_051342.1", "mRatBN7.2"), + RGD_8("8", "RefSeq:NC_051343.1", "mRatBN7.2"), + RGD_9("9", "RefSeq:NC_051344.1", "mRatBN7.2"), + RGD_10("10", "RefSeq:NC_051345.1", "mRatBN7.2"), + RGD_11("11", "RefSeq:NC_051346.1", "mRatBN7.2"), + RGD_12("12", "RefSeq:NC_051347.1", "mRatBN7.2"), + RGD_13("13", "RefSeq:NC_051348.1", "mRatBN7.2"), + RGD_14("14", "RefSeq:NC_051349.1", "mRatBN7.2"), + RGD_15("15", "RefSeq:NC_051350.1", "mRatBN7.2"), + RGD_16("16", "RefSeq:NC_051351.1", "mRatBN7.2"), + RGD_17("17", "RefSeq:NC_051352.1", "mRatBN7.2"), + RGD_18("18", "RefSeq:NC_051353.1", "mRatBN7.2"), + RGD_19("19", "RefSeq:NC_051354.1", "mRatBN7.2"), + RGD_20("20", "RefSeq:NC_051355.1", "mRatBN7.2"), + RGD_X("X", "RefSeq:NC_051356.1", "mRatBN7.2"), + RGD_Y("Y", "RefSeq:NC_051357.1", "mRatBN7.2"), RGD_MT("MT", "RefSeq:NC_001665.2", "mRatBN7.2"), SGD_I("chrI", "RefSeq:NC_001133.9", "R64-4-1"), SGD_II("chrII", "RefSeq:NC_001134.8", "R64-4-1"), From 542e785bc269ea2e7f1444be9dbbc1c5e1778cab Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 23:46:01 +0100 Subject: [PATCH 340/342] Loading tweaks --- .../jobs/executors/VariantFmsExecutor.java | 18 ++++++++---------- .../dto/fms/VariantFmsDTOValidator.java | 19 +++++++++++++------ 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java index 544fd07f8..1c0f036ec 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java @@ -41,8 +41,6 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { VariantIngestFmsDTO variantData = mapper.readValue(new GZIPInputStream(new FileInputStream(bulkLoadFileHistory.getBulkLoadFile().getLocalFilePath())), VariantIngestFmsDTO.class); - AGRCurationSchemaVersion version = CuratedVariantGenomicLocationAssociation.class.getAnnotation(AGRCurationSchemaVersion.class); - bulkLoadFileHistory.getBulkLoadFile().setLinkMLSchemaVersion(version.max()); if (variantData.getMetaData() != null && StringUtils.isNotBlank(variantData.getMetaData().getRelease())) { bulkLoadFileHistory.getBulkLoadFile().setAllianceMemberReleaseVersion(variantData.getMetaData().getRelease()); } @@ -55,14 +53,13 @@ public void execLoad(BulkLoadFileHistory bulkLoadFileHistory) { bulkLoadFileDAO.merge(bulkLoadFileHistory.getBulkLoadFile()); - bulkLoadFileHistory.setCount(variantData.getData().size()); updateHistory(bulkLoadFileHistory); boolean success = runLoad(bulkLoadFileHistory, variantData.getData(), entityIdsAdded, locationIdsAdded, associationIdsAdded, dataProvider); if (success) { - runCleanup(variantService, bulkLoadFileHistory, dataProvider.name(), variantService.getIdsByDataProvider(dataProvider.name()), entityIdsAdded, "variant"); - runCleanup(curatedVariantGenomicLocationAssociationService, bulkLoadFileHistory, dataProvider.name(), curatedVariantGenomicLocationAssociationService.getIdsByDataProvider(dataProvider), locationIdsAdded, "curated variant genomic location association"); - runCleanup(alleleVariantAssociationService, bulkLoadFileHistory, dataProvider.name(), alleleVariantAssociationService.getAssociationsByDataProvider(dataProvider), associationIdsAdded, "allele variant association"); + runCleanup(variantService, bulkLoadFileHistory, dataProvider.name(), variantService.getIdsByDataProvider(dataProvider.name()), entityIdsAdded, "Variant"); + runCleanup(curatedVariantGenomicLocationAssociationService, bulkLoadFileHistory, dataProvider.name(), curatedVariantGenomicLocationAssociationService.getIdsByDataProvider(dataProvider), locationIdsAdded, "Curated variant genomic location association"); + runCleanup(alleleVariantAssociationService, bulkLoadFileHistory, dataProvider.name(), alleleVariantAssociationService.getAssociationsByDataProvider(dataProvider), associationIdsAdded, "Allele variant association"); } bulkLoadFileHistory.finishLoad(); updateHistory(bulkLoadFileHistory); @@ -93,9 +90,9 @@ private boolean runLoad( String countType = null; for (VariantFmsDTO dto : data) { countType = "Entities"; - Variant variant = null; + Long variantId = null; try { - variant = variantFmsDtoValidator.validateVariant(dto, entityIdsAdded, dataProvider); + variantId = variantFmsDtoValidator.validateVariant(dto, entityIdsAdded, dataProvider); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -107,7 +104,7 @@ private boolean runLoad( } countType = "Locations"; try { - variantFmsDtoValidator.validateCuratedVariantGenomicLocationAssociation(dto, locationIdsAdded, variant); + variantFmsDtoValidator.validateCuratedVariantGenomicLocationAssociation(dto, locationIdsAdded, variantId); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -119,7 +116,7 @@ private boolean runLoad( } countType = "Associations"; try { - variantFmsDtoValidator.validateAlleleVariantAssociation(dto, associationIdsAdded, variant); + variantFmsDtoValidator.validateAlleleVariantAssociation(dto, associationIdsAdded, variantId); history.incrementCompleted(countType); } catch (ObjectUpdateException e) { history.incrementFailed(countType); @@ -129,6 +126,7 @@ private boolean runLoad( history.incrementFailed(countType); addException(history, new ObjectUpdateExceptionData(dto, e.getMessage(), e.getStackTrace())); } + ph.progressProcess(); } updateHistory(history); diff --git a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java index b945c08f1..5cbd0a331 100644 --- a/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java +++ b/src/main/java/org/alliancegenome/curation_api/services/validation/dto/fms/VariantFmsDTOValidator.java @@ -69,7 +69,7 @@ public class VariantFmsDTOValidator { @Inject VariantNoteFmsDTOValidator variantNoteFmsDtoValidator; @Transactional - public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { + public Long validateVariant(VariantFmsDTO dto, List idsAdded, BackendBulkDataProvider dataProvider) throws ValidationException { ObjectResponse variantResponse = new ObjectResponse(); Variant variant = new Variant(); @@ -198,11 +198,11 @@ public Variant validateVariant(VariantFmsDTO dto, List idsAdded, BackendBu idsAdded.add(variant.getId()); } - return variant; + return variant.getId(); } @Transactional - public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, List idsAdded, Variant variant) throws ValidationException { + public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, List idsAdded, Long variantId) throws ValidationException { CuratedVariantGenomicLocationAssociation association = new CuratedVariantGenomicLocationAssociation(); ObjectResponse cvglaResponse = new ObjectResponse(); @@ -237,6 +237,10 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, String hgvs = HgvsIdentifierHelper.getHgvsIdentifier(dto); + Variant variant = null; + if (variantId != null) { + variant = variantDAO.find(variantId); + } if (variant != null && StringUtils.isNotBlank(hgvs) && !cvglaResponse.hasErrors() && CollectionUtils.isNotEmpty(variant.getCuratedVariantGenomicLocations())) { for (CuratedVariantGenomicLocationAssociation existingLocationAssociation : variant.getCuratedVariantGenomicLocations()) { if (Objects.equals(hgvs, existingLocationAssociation.getHgvs())) { @@ -259,7 +263,7 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, association.setVariantSequence(dto.getGenomicVariantSequence()); } - if (variant == null) { + if (variantId == null) { cvglaResponse.addErrorMessage("variant", ValidationConstants.INVALID_MESSAGE); } @@ -276,13 +280,16 @@ public void validateCuratedVariantGenomicLocationAssociation(VariantFmsDTO dto, } @Transactional - public void validateAlleleVariantAssociation(VariantFmsDTO dto, List idsAdded, Variant variant) throws ValidationException { + public void validateAlleleVariantAssociation(VariantFmsDTO dto, List idsAdded, Long variantId) throws ValidationException { AlleleVariantAssociation association = new AlleleVariantAssociation(); ObjectResponse avaResponse = new ObjectResponse(); - if (variant == null) { + Variant variant = null; + if (variantId == null) { avaResponse.addErrorMessage("variant", ValidationConstants.INVALID_MESSAGE); + } else { + variant = variantDAO.find(variantId); } if (StringUtils.isBlank(dto.getAlleleId())) { avaResponse.addErrorMessage("alleleId", ValidationConstants.REQUIRED_MESSAGE); From 1fcb6baef802e214d475fa18994a2efd19353124 Mon Sep 17 00:00:00 2001 From: markquintontulloch Date: Fri, 25 Oct 2024 23:47:38 +0100 Subject: [PATCH 341/342] Remove unused import --- .../curation_api/jobs/executors/VariantFmsExecutor.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java index 1c0f036ec..8f55a3778 100644 --- a/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java +++ b/src/main/java/org/alliancegenome/curation_api/jobs/executors/VariantFmsExecutor.java @@ -8,9 +8,6 @@ import org.alliancegenome.curation_api.enums.BackendBulkDataProvider; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException; import org.alliancegenome.curation_api.exceptions.ObjectUpdateException.ObjectUpdateExceptionData; -import org.alliancegenome.curation_api.interfaces.AGRCurationSchemaVersion; -import org.alliancegenome.curation_api.model.entities.Variant; -import org.alliancegenome.curation_api.model.entities.associations.variantAssociations.CuratedVariantGenomicLocationAssociation; 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.VariantFmsDTO; From e76902b3039ec521316ef7cd798e3d1247e7db74 Mon Sep 17 00:00:00 2001 From: VarunReddy1111 Date: Mon, 11 Nov 2024 11:30:40 -0600 Subject: [PATCH 342/342] Updated Release notes --- RELEASE-NOTES.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 673f39311..aa699123a 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -2,6 +2,41 @@ https://agr-jira.atlassian.net/wiki/spaces/ATEAM/overview +## v0.35.0 +* New features + * Load FBcv into the persistent store (SCRUM-2190) + * Implement Gene Type field/column for Genes data table (SCRUM-3983) + * Turn off auxiliary clean up for associated entities (e.g. clean up of disease annotations based on a gene load) - public site Indexer work (SCRUM-4150) + * SQTR Gene Associations import into Persistent store (SCRUM-4185, SCRUM-4187, SCRUM-4188) + * HTPdataset loaded into persistent store (SCRUM-4192,SCRUM-4303, SCRUM-4341) + * Make obsolete disease annotations hidden by default for all MOD default settings (SCRUM-4277) + * HTPdataset ZFIN Fms files having wrong naming of property (SCRUM-4328) + * Clean up erroneous DOTerms (SCRUM-4337) + * Importing expression annotations into the persistent store - Load ExpressionPattern, TemporalContext, and AnatomicalSite (SCRUM-3952) + * Implement programmatic, regular purging of exception message history for all exceptions older than 2 weeks (SCRUM-4377) + * HTPdatasetSample import P1 - Creating entities and migration file (SCRUM-4426) + * Reenable downloading of all exception messages for a given data load (SCRUM-4452) + * P1: Expression Atlas Import: Load accession data files from Ensembl, etc... (SCRUM-4118) + * GFF Loading (Load assembly, transcripts, exons, and CDSs without positional information; Load positional information for Transcripts, Exons, and CDSs; Load associations between Genes, Transcripts, Exons, and CDSs) (SCRUM-4174, SCRUM-4175, SCRUM-4176) + * Associate Expression Annotations with Go Slim Terms (SCRUM-4300) + * Implement caching of references for DQM loads (SCRUM-4336) + * Accommodate BIOGRID-ORCS loader data type: to establish 3rd part link out to BIOGRID from gene page phenotypes section P1 - create DTO, load via migration, and loading infrastructure (SCRUM-4440) + * Investigate: Accommodate BIOGRID-ORCS loader data type: to establish 3rd part link out to BIOGRID from gene page phenotypes section (SCRUM-4471) + * Load VariantGenomicLocationAssociation from FMS submissions and generate HGVSg identifiers (SCRUM-4499) + * Test effect of removing AuditedObject fields on disease annotation indexing speed (SCRUM-4520) + * Java model changes for disease genetic modifier changes to split based on modifier type (SCRUM-4523) + * Curation UI changes to Disease Annotations table to split out Genetic Modifiers into 3 separate fields for each of Gene, Allele and AGM modifier types (SCRUM-4524) +* Fixes and maintenance + * Edit cancelation button getting squeezed out of frame on alpha data tables (SCRUM-4236) + * Constructs data table on alpha-curation throwing 500 error and not loading (SCRUM-4259) + * Fix SQTR Gene Association Integration Tests (SCRUM-4299) + * Curl timing out when uploading to persistent store (SCRUM-3683) + * Annotations and interactions not indexed on alpha-curation (despite attempts to reindex) (SCRUM-4254) + * Loads not showing in the Data Loads page "Data Processing Info Table" widget (SCRUM-4428) + * New "Running Time" showing negative time counting down (SCRUM-4429) + * Molecule table columns expand automatically when sorting (SCRUM-4531) + + ## v0.34.0 * New features * Paralogy annotations loaded into persistent store (SCRUM-4086, SCRUM-4088, SCRUM-4089, SCRUM-4090)