statonlab/tripal_manage_analyses

database integrity: feature-designed analysis needs to be taken into account.

Opened this issue · 1 comments

@laceysanderson said in GMOD/Chado#59

I would worry a bit about this causing inconsistencies in the database. For example, what if your transcripts for a given analysis are for species X and the linker table points to species Y? I think this might be better implemented as a materialized view that pulls through the analysis -> feature -> organism connection. From an application standpoint this ends up being the same thing but from the database level it will help you keep consistency. Would that work for HWG ?

Perhaps the trigger could check if the organism for the current feature being inserted is in the organism_analysis table and if not, adds it?

So 2 things need to happen.

  • Don't let the user disassociate an organism from an analysis if features exist that link it. This can be in
    the widget's validate.
  • Automatically add the association when new features are inserted. How about a hook entity_published (probably not called that) that checks if the entity type is a feature and associates as necessary?