= 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 [http://www.molgenis.org/wiki/MolgenisGeneratorBasics 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.
{{{
#!xml
BAC clone fragment.
}}}
Then add this new entity to the user interface by adding under the 'Trait' menu:
{{{
#!xml
}}}
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".
{{{
#!xml
The starting point of QTL analysis.
}}}
Then we add it to the user interface by adding to xgap_ui.xml at a proper location:
{{{
#!xml
}}}
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.