Skip to content

Commit

Permalink
Merge pull request #1627 from alliance-genome/SCRUM-3952
Browse files Browse the repository at this point in the history
SCRUM-3952: add ExpressionPattern, TemporalContext and AnatomicalSite
  • Loading branch information
abecerra authored Jul 31, 2024
2 parents 60bc6f4 + 326bf0f commit cdf2c3b
Show file tree
Hide file tree
Showing 21 changed files with 1,233 additions and 94 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

}
Original file line number Diff line number Diff line change
@@ -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})
private AnatomicalTerm anatomicalStructure;

@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
@JsonView({View.FieldsOnly.class})
private AnatomicalTerm anatomicalSubstructure;

@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
@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.FieldsOnly.class})
@JoinTable(
name = "anatomicalsite_anatomicalstructurequalifiers",
indexes = {
@Index(name = "anatomicalstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"),
@Index(name = "anatomicalstructurequalifiers_structurequalifiers_index", columnList = "anatomicalstructurequalifiers_id")}
)
private List<VocabularyTerm> anatomicalStructureQualifiers;

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
@KeywordField(name = "anatomicalsubstructurequalifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
@ManyToMany
@JsonView({View.FieldsOnly.class})
@JoinTable(
name = "anatomicalsite_anatomicalsubstructurequalifiers",
indexes = {
@Index(name = "anatomicalsubstructurequalifiers_anatomicalsite_index", columnList = "anatomicalsite_id"),
@Index(name = "anatomicalsubstructurequalifiers_qualifiers_index", columnList = "anatomicalsubstructurequalifiers_id")}
)
private List<VocabularyTerm> anatomicalSubstructureQualifiers;

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
@KeywordField(name = "cellularcomponentqualifiers_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
@ManyToMany
@JsonView({View.FieldsOnly.class})
@JoinTable(
name = "anatomicalsite_cellularcomponentqualifiers",
indexes = {
@Index(name = "cellularcomponentqualifiers_anatomicalsite_index", columnList = "anatomicalsite_id"),
@Index(name = "cellularcomponentqualifiers_cellularcomponentqualifiers_index", columnList = "cellularcomponentqualifiers_id")}
)
private List<VocabularyTerm> cellularComponentQualifiers;

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
@KeywordField(name = "anatomicalstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
@ManyToMany
@JsonView({View.FieldsOnly.class})
@JoinTable(
name = "anatomicalsite_anatomicalstructureuberonterms",
indexes = {
@Index(name = "anatomicalstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"),
@Index(name = "anatomicalstructureuberonterms_uberonterms_index", columnList = "anatomicalstructureuberonterms_id")}
)
private List<UBERONTerm> anatomicalStructureUberonTerms;

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
@KeywordField(name = "anatomicalsubstructureuberonterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
@ManyToMany
@JsonView({View.FieldsOnly.class})
@JoinTable(
name = "anatomicalsite_anatomicalsubstructureuberonterms",
indexes = {
@Index(name = "anatomicalsubstructureuberonterms_anatomicalsite_index", columnList = "anatomicalsite_id"),
@Index(name = "anatomicalsubstructureuberonterms_uberonterms_index", columnList = "anatomicalsubstructureuberonterms_id")}
)
private List<UBERONTerm> anatomicalSubstructureUberonTerms;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,32 @@
@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 {

@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})
private ExpressionPattern expressionPattern;

@Transient
@JsonIgnore
public String getDataProviderString() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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})
private TemporalContext whenExpressed;

@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
@JsonView({ View.FieldsOnly.class})
private AnatomicalSite whereExpressed;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
Original file line number Diff line number Diff line change
@@ -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})
private StageTerm developmentalStageStart;

@IndexedEmbedded(includePaths = {"name", "name_keyword"})
@IndexingDependency(reindexOnUpdate = ReindexOnUpdate.SHALLOW)
@ManyToOne
@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})
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.FieldsOnly.class})
@JoinTable(
name = "temporalcontext_temporalqualifiers",
indexes = {
@Index(name = "temporalqualifiers_temporalcontext_index", columnList = "temporalcontext_id"),
@Index(name = "temporalqualifiers_temporalqualifiers_index", columnList = "temporalqualifiers_id")}
)
private List<VocabularyTerm> temporalQualifiers;

@FullTextField(analyzer = "autocompleteAnalyzer", searchAnalyzer = "autocompleteSearchAnalyzer")
@KeywordField(name = "stageuberonslimterms_keyword", aggregable = Aggregable.YES, sortable = Sortable.YES, searchable = Searchable.YES, normalizer = "sortNormalizer")
@ManyToMany
@JsonView({View.FieldsOnly.class})
@JoinTable(
name = "temporalcontext_stageuberonslimterms",
indexes = {
@Index(name = "stageuberonslimterms_temporalcontext_index", columnList = "temporalcontext_id"),
@Index(name = "stageuberonslimterms_uberonterms_index", columnList = "stageuberonslimterms_id")}
)
private List<VocabularyTerm> stageUberonSlimTerms;
}
Loading

0 comments on commit cdf2c3b

Please sign in to comment.