Skip to content

java classes that inherit from parent classes do not change based on slot_usage #395

@sierra-moxon

Description

@sierra-moxon

DiseaseAnnotation LinkML yaml:

DiseaseAnnotation:
    is_a: Association
    abstract: true
    mixins:
      - AuditedObject
    description: >-
      An annotation asserting an association between a biological entity and a disease supported by evidence.
    slots:
      - curie
      - negated
      - evidence_codes
      - annotation_reference
      - with # what constrains this?  what is gene+with=strain?
      - disease_qualifiers # what is the enumeration that constrains this?
      - genetic_sex # does this really belong at the top level?
      - private_note # we should probably pull this out into a _private_ note object.
      - disease_annotation_note # we should probably pull this out into a note object.
      - disease_annotation_summary # we should probably pull this out into a note object
    slot_usage:
      subject:
        required: true
        description: >-
          The biological entity to which the disease ontology term is associated.
        range: AlleleOrGeneMixin
      # TODO: this doesn't seem to be coming in with the appropriate slot_usage into the java class (instead just annotating with superclass)
      predicate:  # predicate is basically disease_relation.  We should determine if we want such a generic name for this in the parent Association objectl
        required: true
        description: >-
          Constrains the disease subject, associationType and inferredGeneAssociation.
        range: disease_relation_enum
      negated:
        description: >-
          The negative qualifier for the annotation.
      object:
        required: true
        description: >-
          The disease ontology term.
        range: Disease
      data_provider:
        required: true
        description: >-
          source of data, can be multiple of these, each with a type and a crossReference
      with:
        description: >-
          http://geneontology.org/docs/go-annotation-file-gaf-format-21/#with-or-from-column-8
        range: Gene
        # TODO: restrict usage to these evidence codes
        # ISO, ISS, IGI or ISS and ISO or any combo of ISS, ISO, IGI.
      references:               # evidence in JSON schema
        required: true
        multivalued: false
        description: >-
          The reference in which the disease association was asserted/reported.
      evidence_codes:
        multivalued: true
      genetic_sex:
        range: genetic_sex_enum

Subclass of DiseaseAnnotation that restricts 'subject' to only 'Gene' objects in LinkML yaml:

  GeneDiseaseAnnotation:
    is_a: DiseaseAnnotation
    description:
    slots:
      - gene_disease_genetic_modifier
      - gene_disease_genetic_modifier_relation
      - gene_disease_relation
      - sgd_strain_background
    slot_usage:
      subject:
        required: true
        description: >-
          The gene to which the disease ontology term is associated.
        range: Gene
      predicate:
        required: true
        range: gene_disease_relation_enum
      gene_disease_genetic_modifier:
        required: false
        range: BiologicalEntity

Java class of DiseaseAnnotation:

package org.alliancegenome.curation.model;

import java.util.List;
import lombok.*;

/**
  An annotation asserting an association between a biological entity and a disease supported by evidence.
**/
@Data
@EqualsAndHashCode(callSuper=false)
public class DiseaseAnnotation extends Association {

  private String curie;
  private Boolean negated;
  private List<ECOTerm> evidenceCodes;
  private Reference annotationReference;
  private Gene with;
  private String diseaseQualifiers;
  private String geneticSex;
  private String privateNote;
  private String diseaseAnnotationNote;
  private String diseaseAnnotationSummary;
  private Integer tableKey;
  private Person producedBy;
  private String creationDate;
  private Person modifiedBy;
  private String dateLastModified;

}

Java class of GeneDiseaseAnnotation:

package org.alliancegenome.curation.model;

import java.util.List;
import lombok.*;

/**
  None
**/
@Data
@EqualsAndHashCode(callSuper=false)
public class GeneDiseaseAnnotation extends DiseaseAnnotation {

  private BiologicalEntity geneDiseaseGeneticModifier;
  private String geneDiseaseGeneticModifierRelation;
  private String geneDiseaseRelation;
  private AffectedGenomicModel sgdStrainBackground;

}

Would it be possible that the generated java subclasses would flatten the properties from the parent class into the child class when the slot_usage was different from the parent? Or, would the best option in modeling be that we don't include properties in the parent class that need to be restricted further in the child class and instead just declare the slots (like subject) in the child class?

ie: is this doable?

package org.alliancegenome.curation.model;

import java.util.List;
import lombok.*;

/**
  None
**/
@Data
@EqualsAndHashCode(callSuper=false)
public class GeneDiseaseAnnotation extends DiseaseAnnotation {

  private BiologicalEntity geneDiseaseGeneticModifier;
  private String geneDiseaseGeneticModifierRelation;
  private String geneDiseaseRelation;
  private AffectedGenomicModel sgdStrainBackground;
  private Gene subject;
  private BiologicalEntity geneDiseaseGeneticModifier;
  // etc...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions