wiki:AddingDataTypes

Version 1 (modified by trac, 14 years ago) (diff)

--

Adding data types

Adding of data types is done by

  • editing 'xgap_db.xml' to add the data type
  • editing 'xgap_ui.xml' to add it the XGAP user interface.
  • subsequently running the generator as described in MolgenisGeneratorBasics.
  • and finally updating the database (

WARNING: don't run the MolgenisUpdateDatabase? if you want to keep data in the database! Instead copy/paste relevant SQL from the /generated/sql/create_tables.sql file!

Below two examples are shown.

Example 1

We have sequencing data for bacterial artificial chromosome (BAC) clones. This is something measured on a bacteria, so it's a trait. Since the fragments have a genetical location, we would like to have this annotated as well.

We add a new entity named "Clone" to xgap_db.xml with a proper description. We 'add' this to the possible traits by 'extending' the Trait datatype. Lastly, we reuse the notation of genetic location by adding 'Locus' information using 'implements'. As a result Clone will have all properties of Locus as well as Trait.

<entity name="Clone" extends="Trait" implements="Locus">
        <description>
        BAC clone fragment.
        </description>
</entity>

Then add this new entity to the user interface by adding under the 'Trait' menu:

<form name="Clones" entity="Clone"/>

Finally we run the generator and update the database as described above, i.e., in /generated/sql/create_tables.sql copy the create table Clone and paste it into the mysql prompt.

Example 2

We want to 'wrap' datamatrices as a QTL dataset where we annotate a specific matrix to contain 'genotypes' and another matrix to contain 'phenotypes'. These datasets do not need names.

We add an entity named "QTLDataSet" to xgap_db.xml with a proper description. We do want the matrix to fit into the XGAP datastructure but do not need to name it, therefore we extend 'Describable' which gives the record a unique ID, but not 'Identifiable' which would add a 'name' field. Then we add two fields with are both crossreferences to 'Data' by "id", though the label will be "name".

<entity name="QTLDataSet" extends="Describable">
        <description>The starting point of QTL analysis.</description>
        <field name="Genotypes" nillable="true" type="xref" xref_entity="Data" xref_field="id" xref_label="name" />
        <field name="Phenotypes"  nillable="true" type="mref" xref_entity="Data" xref_field="id" xref_label="name" />
</entity>

Then we add it to the user interface by adding to xgap_ui.xml at a proper location:

<form name="QTLDataSet" entity="QTLDataSet"/>

Finally we run the generator and update the database as described above, i.e., in /generated/sql/create_tables.sql copy the create table QTLDataSet and paste it into the mysql prompt.