IGS Data Representation

From GMOD
Revision as of 19:15, 15 January 2009 by Jorvis (Talk | contribs)

Jump to: navigation, search

Chado is an elegant schema that can hold nearly anything from gene annotations to an MP3 collection. This fabulous flexibility comes with a price - different MODs arrive at different ways of storing the same biological information. This page is not meant to be a tutorial of how YOU should model your biological information in Chado. Rather, it is simply a brain dump of the way we are doing things at IGS, for better or worse.

The reference document is currently the Chado Best Practices page, into which much of this information may become merged at some point.

What we store

We currently use the Chado schema primarily to store genome annotation data, including comparative genomics. This includes both read-only databases from 'finished' annotations and ongoing, actively modified data. Prokaryotes and Eukaryotes are both represented in our datasets and we use MySQL and PostgreSQL back-ends. We've started using Oracle a bit and have essentially abandoned Sybase usage.

In terms of tools, the data representations discussed below are generated by custom scripts as well as components in Ergatis. They are read/edited by Manatee for manual curation, Sybil for comparative displays and several web applications such as Gemina and Pathema.

Feature naming convention

The de novo features we store in Chado follow the same naming convention, which is db.feature_type.N.M, where 'db' is an abbreviation for a database or project (usually an organism), feature_type corresponds to a value in cvterm.name, N is an incrementing integer scoped to that feature type, and M is the version number of that feature. So the second version of a gene from our Aspergillus fumigatus annotation project may have a name like: afu.gene.3320.2

Structural annotation

Our structural representation differs quite a bit from the current recommended implementation. The canonical gene model below illustrates this. For now I'll only touch on structural annotation, which is beginning to be covered well on the Chado Best Practices page and instead focus on functional annotation, which isn't.

Gene models

Canonical gene model

The following query shows all the features in our gene graph as well as their relationships. The example query is for a transcript feature 'hsn.transcript.39176.1' <sql>

   SELECT f1.name as subject, c.name as relationship, f2.name as object
     FROM feature f1
         JOIN feature_relationship fr ON f1.feature_id = fr.subject_id
         JOIN feature f2 ON fr.object_id = f2.feature_id
         JOIN cvterm c ON fr.type_id = c.cvterm_id
    WHERE f1.uniquename = 'hsn.transcript.39176.1'
       OR f2.uniquename = 'hsn.transcript.39176.1';
   +-------------------------+--------------+------------------------+
   | subject                 | relationship | object                 |
   +-------------------------+--------------+------------------------+
   | hsn.transcript.39176.1  | derives_from | hsn.gene.39416.1       |
   | hsn.polypeptide.39176.1 | part_of      | hsn.transcript.39176.1 |
   | hsn.CDS.39416.1         | derives_from | hsn.transcript.39176.1 |
   | hsn.exon.39416.1        | part_of      | hsn.transcript.39176.1 |
   +-------------------------+--------------+------------------------+

</sql>

Functional annotation

The assertions made in functional annotation differ greatly between MODs and annotation sources in general. Our minimal goal is to provide the following, whenever possible, for any given gene:

  • Gene product name
  • Gene symbol
  • GO terms (process, function, component)
  • Enzyme Commission (EC) number

Ideally, evidence should also be stored for each of these assertions.

Gene product name

Gene symbol

GO terms

Here I'll discuss first how the collection of terms that makes up GO is stored in the Chado schema and then discuss how we assign these terms to features.

Representation of the GO ontology

The source of the data is an entry within an OBO file, such as:

   [Term]
   id: GO:0004126
   name: cytidine deaminase activity
   namespace: function
   def: "Catalysis of the reaction\: cytidine + H2O = uridine + NH3." [EC:3.5.4.5]
   xref_analog: EC:3.5.4.5
   xref_analog: MetaCyc:CYTIDEAM2-RXN
   xref_analog: Reactome:83524
   is_a: GO:0019239

GO is stored as a controlled vocabulary, which has an entry in the 'cv' table. Here we already run into a contentious point on how this should be entered. Should there be a single entry for 'GO' as a whole or three different ones, since it contains three separate namespaces (process, function, component)? For this example I'll use the single 'GO' entry: <sql>

   SELECT *
     FROM cv
    WHERE name = 'GO';
   +-------+------+------------+
   | cv_id | name | definition |
   +-------+------+------------+
   |    10 | GO   | NULL       |
   +-------+------+------------+

</sql>

Whether to respect the namespaces within GO and create three distinct ontology entries is configurable within the initdb Ergatis component, which instantiates our Chado instances.

Next, there's a entry in 'cvterm' for this term but not by the GO:NNNNNNNN value. Instead, we can look it up by the name: <sql>

   SELECT cvterm_id, name, substring(definition,1,20), dbxref_id, is_obsolete
     FROM cvterm
    WHERE cv_id = 10
      AND name = 'cytidine deaminase activity';
   +-----------+-----------------------------+----------------------------+-----------+-------------+
   | cvterm_id | name                        | substring(definition,1,20) | dbxref_id | is_obsolete |
   +-----------+-----------------------------+----------------------------+-----------+-------------+
   |      6657 | cytidine deaminase activity | "Catalysis of the re       |     12389 |           0 |
   +-----------+-----------------------------+----------------------------+-----------+-------------+

</sql>

The actual GO:NNNNNNN value is a database reference (dbxref_id returned in last query): <sql>

   SELECT *
     FROM dbxref
    WHERE dbxref_id = 12389;
   +-----------+-------+------------+---------+-------------+
   | dbxref_id | db_id | accession  | version | description |
   +-----------+-------+------------+---------+-------------+
   |     12389 |    12 | GO:0004126 | 1.0     | NULL        |
   +-----------+-------+------------+---------+-------------+

</sql>

Which, of course, means there's a GO entry in the 'db' table too: <sql>

   SELECT *
     FROM db
    WHERE name = 'GO';
   +-------+------+-------------+-----------+------+
   | db_id | name | description | urlprefix | url  |
   +-------+------+-------------+-----------+------+
   |    12 | GO   | NULL        | NULL      | NULL |
   +-------+------+-------------+-----------+------+

</sql>

So, reviewing, to get the basic annotation for a GO term: <sql>

   SELECT dbx.accession, cvt.name, cvt.definition
     FROM cvterm cvt
       JOIN dbxref dbx ON cvt.dbxref_id = dbx.dbxref_id
    WHERE dbx.accession = 'GO:0004126';
   +------------+-----------------------------+---------------------------------------------------------------------------+
   | accession  | name                        | definition                                                                |
   +------------+-----------------------------+---------------------------------------------------------------------------+
   | GO:0004126 | cytidine deaminase activity | "Catalysis of the reaction: cytidine + H2O = uridine + NH3." [EC:3.5.4.5] |
   +------------+-----------------------------+---------------------------------------------------------------------------+

</sql>

What about the xref_analog entries we saw in the OBO definition? The additional entries are stored using the cvterm_dxref table.

Assigning GO terms to features

A more narrative description has yet to be written, but here's a query to get all assigned GO terms for a given transcript, with evidence. <sql>

   SELECT f.uniquename, d.accession, c2.name "evidence type", 
          cs.synonym "evidence code", fcp.value
   FROM feature f
       JOIN feature_cvterm fc ON f.feature_id = fc.feature_id
       JOIN cvterm c ON fc.cvterm_id = c.cvterm_id
       JOIN cv ON c.cv_id = cv.cv_id
       JOIN dbxref d ON c.dbxref_id = d.dbxref_id
       JOIN feature_cvtermprop fcp ON fc.feature_cvterm_id = fcp.feature_cvterm_id 
       JOIN cvterm c2 ON fcp.type_id = c2.cvterm_id
       JOIN cvtermsynonym cs ON c2.cvterm_id = cs.cvterm_id
   WHERE f.uniquename = 'hsn.transcript.39176.1'
     AND cv.name = 'GO';
   +------------------------+-------------+-------------------------------------+---------------+-----------+
   | uniquename             | role id     | evidence type                       | evidence code | value     |
   +------------------------+-------------+-------------------------------------+---------------+-----------+
   | hsn.transcript.39176.1 | GO:0008655  | inferred from electronic annotation | IEA           | TIGR01354 | 
   | hsn.transcript.39176.1 | GO:0005737  | inferred from electronic annotation | IEA           | TIGR01354 | 
   | hsn.transcript.39176.1 | GO:0004126  | inferred from electronic annotation | IEA           | TIGR01354 | 
   +------------------------+-------------+-------------------------------------+---------------+-----------+

</sql>

Enzyme Commission (EC) number

Versioning of features

Background

One important requirement for any institution doing active annotation with the schema is the ability to store a versioned history of genes as they're modified. If you consider the example of editing the start site of a gene, it's certainly possible to just directly modify the coordinates of the gene feature. In production, this causes complications.

We've taken the position that direct resizing of a feature's coordinates on a molecule is not allowed. In fact, any modifications of a feature that change its underlying sequence is problematic. Features are defined by the sequence they represent, and since any number of analyses (and annotation) made on a feature are based on the underlying sequence, changing this sequence invalidates the feature. If you've stored BLAST analysis for a polypeptide, as an example, and then change the coordinates of the feature all linked BLAST alignment coordinates would be incorrect and misleading.

Start site edits

To resolve these sorts of problems we create new, versioned features any time the underlying sequence of a feature is edited. The most common form of these edits is start site modification of a gene. Using that as an example, consider an example gene that has a feature.uniquename value of 'hsn.gene.39416.1'. It has functional annotation as well as several analyses linked such as blastp and hmmpfam results.

Deleting a gene