You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is a generalized DB schema that takes advantage of registries in identifiers.org. I added some comments to explain the purpose.
fromdjango.dbimportmodels# Registry in identifiers.orgclassRegistry(models.Model):
name=models.CharField()
prefix=models.CharField()
description=models.CharField()
# and other attributes of a registry ...# Entity includes common attributes of any entity (such as gene,# publication, disease, tissue, etc)classEntity(models.Model):
accession=models.CharField(null=True) # accession in identifiers.orgregistry=models.ForeignKey(Registry, null=True)
# and other attributes shared by all entities ...# "Gene" is one kind of entityclassGene(models.Model):
entity=models.OneToOneField(
Entity,
on_delete=models.CASCADE,
primary_key=True,
)
# specific attributes for a genescientific_name=models.CharField(max_length=32)
systematic_name=models.CharField(max_length=32)
organism=models.ForeignKey(Organism, ...)
# "Publication" is another kind of entityclassPublication(models.Model):
entity=models.OneToOneField(
Entity,
on_delete=models.CASCADE,
primary_key=True,
)
# specific attributes for a publicationpmid=models.IntegerField(null=True, unique=True, db_index=True)
title=models.TextField()
authors=models.TextField()
date=models.DateField()
journal=models.TextField()
volume=models.TextField(blank=True, null=True)
pages=models.TextField(blank=True, null=True)
issue=models.TextField(blank=True, null=True)
# "Disease" is another kind of entityclassDisease(models.Model):
entity=models.OneToOneField(
Entity,
on_delete=models.CASCADE,
primary_key=True,
)
# and specific attributes for a disease ...# "Entityset" includes common attributes for any kind of entity set.# It may include different types of entities.classEntityset(models.Model):
creator=models.ForeignKey(User)
title=models.TextField()
abstract=models.TextField(null=True)
slug=models.SlugField(help_text="Slugified title field", max_length=75)
public=models.BooleanField(default=False)
deleted=models.BooleanField(default=False)
fork_of=models.ForeignKey('self', editable=False, null=True)
tip_item_count=models.IntegerField(null=True)
# "Geneset" is one kind of "Entityset"classGeneset(models.Model):
entityset=models.OneToOneField(
Entityset,
on_delete=models.CASCADE,
primary_key=True,
)
organism=models.ForeignKey(Organism)
# and other attributes for a geneset# Similar models can be defined for "Publicationset" or "Diseaseset" ...# Version of an EntitysetclassVersion(models.Model):
entityset=models.ForeignKey(entityset)
creator=models.ForeignKey(User)
ver_hash=models.CharField(db_index=True, max_length=40)
description=models.TextField(null=True)
commit_date=models.DateTimeField(auto_now_add=True)
parent=models.ForeignKey('self', null=True)
# Annotations of entitiesclassAnnotation(models.Model):
version=models.ForeignKey(Version)
primary_entity=models.ForeignKey(Entity) # entity that is being annotatedannotator_entity=models.ForeignKey(Entity) # entity that is the annotation
The text was updated successfully, but these errors were encountered:
After doing some more thinking on this, I am having trouble figuring out if this makes sense. We still have to explicitly support each type (i.e., by having a Gene model, a Geneset model). Is this costing us more in added complexity without an added benefit?
Yes, Gene and Geneset models should be still explicitly defined, because Entity or Entityset can't include gene-specific or geneset-specific attributes. The largest benefit is that if we want to add other types of entities later (for example, Disease), we don't have to change Version or Annotation model, which is related to Entityset or Entity directly.
Here is a generalized DB schema that takes advantage of registries in
identifiers.org
. I added some comments to explain the purpose.The text was updated successfully, but these errors were encountered: