How to create a genotype database for use as a DAS source

Assuming your data is of the following format seperated by tabs (genotype id, chromosome, position, genotype bases):

rs7763	16	544555	TT
rs763158	16	546105	GG
rs7190878	16	549131	AG
rs4984890	16	552699	CT
rs710925	16	573355	AG

if you have access to a mysql database and admin priveleges you can use the following commands to set up a database called genotype1 with a table called genotype.

First you have to make sure you have a user set up for creating and reading from the database:

if it’s not a production database you can usually log in as root using:

-mysql -u uroot

Then run the following commands:

create database genotype1;

grant all privileges on genotype1.* to genotype@localhost;

then type exit and then login as the genotype user.

mysql -u genotype -p

use genotype;

CREATE TABLE `genotype` (

`rs_id` varchar (100) NOT NULL,

`chromosome` mediumint(8) unsigned NOT NULL,

`position` bigint(8) unsigned NOT NULL,

`bases` varchar(5) default NULL,

PRIMARY KEY  (`rs_id`)


you now have a database called genotype1 set up with a user genotype and password genotype (which obviously you would set to something different).

To load your data file using the unix command line and not when logged into mysql:

mysqlimport -u genotype -pgenotype –local genotype1 genotype.txt

loads the genotype.txt file into the genotype table (note file names need to be same as table name) into the genotype1 database.

Or from the mysql command line: LOAD DATA INFILE ‘/Users/jw12/genotype.txt’ into table genotype;
example configuration for MyDAS:

<datasource uri="person1"

title="genotype db person1"

description="genotype db person1"



<maintainer email="" />

<version uri="person1" created="2010-04-01">


<coordinates uri=""




test_range="ENSG00000160916">Ensembl,Gene_ID,Homo sapiens</coordinates>

<capability type="das1:sources" query_uri="http://localhost:8080/das/ensemblTest" />

<capability type="das1:types" query_uri="http://localhost:8080/das/ensemblTest/types" />

<capability type="das1:features" query_uri="http://localhost:8080/das/ensemblTest/features" />

<capability type="das1:feature-by-id" query_uri="http://localhost:8080/das/ensemblTest/features" />

<capability type="das1:stylesheet" query_uri="http://localhost:8080/das/ensemblTest/stylesheet" />

<capability type="das1:unknown-feature" />

<capability     type="das1:maxbins"     />

<capability     type="das1:entry_points"        />







Setting up a MyDAS data source from svn using eclipse

select new -> project from svn.

make sure mydas repository is added in your svn repository list.

navigate to the svn repository mydas->mydastemplate.

select open project with wizard.

open the project as a “dynammic web project”

right click on the “pom.xml” file and select “package”. wait for maven to package the project

right click on the project and select “enable maven dependencies” – project icon will then have “M” on it and may take a minute to build.

right click on the project and select run on server. select a tomcat server and the server should then run.

put this url into your browser: http://localhost:8080/MyDasTemplate/das/referencegff/features?segment=L47615.1

if the page responds with a blank try right clicking on the page and select “view source”. This should then have an xml response containing this data:

<SEGMENT id=”L47615.1″ start=”1″ stop=”3221″ total=”2″ version=”FromFile” label=”L47615.1″>
<FEATURE id=”GFF_feature_1″ label=”GFF_feature_1″>
<TYPE id=”TSS”/>
<METHOD id=”hand_built”>hand_built</METHOD>
<FEATURE id=”GFF_feature_2″ label=”GFF_feature_2″>
<TYPE id=”TSS”/>
<METHOD id=”hand_built”>hand_built</METHOD>
if this is not the case and you get a class not found error. right click on your project and then “Deployment Assembly” then “add”, add maven library dependencies (select the whole library not individual ones).
when developing a new adapter:
I changed the mydas log to be to the console by changing the rootCategory line in the file:

log4j.rootCategory=DEBUG, console

Generating Features response programmatically with JDAS

I’ve just added a CreateFeatures class in the package org.biodas.jdas.creators this makes making constructing the DAS features object model from the JAXB2 generated classes much easier.

METHOD method=featuresC.createMethod(“Path Problem; Status Under Review”, “Path Problem; Status Under Review”, “ECO:1500”);

TYPE type=featuresC.createType(“Path Problem:Haplotypic clone overlap”, “Path Problem:Haplotypic clone overlap”,”PathProblem”, “SO:1500”);

List<String> partFeatureIds=new ArrayList<String>();


List <String> parentFeatureIds=new ArrayList<String>();


FEATURE feature=featuresC.createFeature(“ZG-3699”, “5101786”, “5276672”, “+”, “1”, “86”, method, type);

FEATURE feature1=featuresC.createFeatureWithParts(“ZG-3819”, “5101286”, “5276672”, “+”, “1”, “100”, method, type, partFeatureIds );

FEATURE feature2=featuresC.createFeatureWithParents(“ZG-36”, “5101786”, “5276672”, “+”, “1”, “86”, method, type, parentFeatureIds);

List<FEATURE> features=new ArrayList<FEATURE>();




SEGMENT segment=featuresC.createSegment(“18″,”1.1″,”4679530”, “5944401”, features);

//DASGFF dgff = this.createDASGFF(segment);

//or if multiple segments

List<SEGMENT> segments=new ArrayList<SEGMENT>();



DASGFF dgff2 = featuresC.createDASGFF(segments);

//test the created objects

DasGFFAdapter dasGffAdapter=new DasGFFAdapter(dgff2);


List<FEATURE> featuresR = dasGffAdapter.getGFF().getSegment().get(0).getFEATURE();

for(FEATURE featureTemp:featuresR){

System.out.println(featureTemp.getId()+” start=”+featureTemp.getSTART()+” stop=”+featureTemp.getEND());




replaces code that looks like this:

DASGFF dgff = factory.createDASGFF();

SEGMENT segment = factory.createSEGMENT();





FEATURE feature = factory.createFEATURE();


feature.setSTART(new BigInteger(“5101286”));

feature.setEND(new BigInteger(“5276672”));

METHOD method = factory.createMETHOD();

method.setContent(“Path Problem; Status Under Review”);

method.setId(“Path Problem; Status Under Review”);





TYPE type = factory.createTYPE();

type.setContent(“Path Problem:Haplotypic clone overlap”);

type.setId(“Path Problem:Haplotypic clone overlap”);





GFF gff = factory.createGFF();



return dgff;

//you can then test the objects created using code like this:

DasGFFAdapter dasGffAdapter=new DasGFFAdapter(dgff2);

List<FEATURE> featuresR = dasGffAdapter.getGFF().getSegment().get(0).getFEATURE();

for(FEATURE featureTemp:featuresR){

System.out.println(featureTemp.getId()+” start=”+featureTemp.getSTART()+” stop=”+featureTemp.getEND());


DAS writeback

The current version of the DAS writeback server that uses MyDAS is here: There is an older version that is at a different google location – make sure you don’t use that one. The writeback implementation was written by Gustavo.

The code can be downloaded from svn and used in eclipse much the same as I’ve described in a previous post about JDAS. Once you have the war file running on a server you can access the basic writeback client at http://localhost:8080/writeback-datasource/ not the url stated in the tutorial here which probably works if you download the .war file instead of using svn.

The root of the DAS source created is here http://localhost:8080/writeback-datasource/das/

after going through the tutorial example if I make a request to get the features I’ve just created It appears to be that I don’t get a response, however when you look at the source of the web page the xml is there. This I think is a stylesheet issue.



to create a mysql database for use:

for das writeback on laptop mysql instance:

mysql -u root

create database daswriteback;

grant all privileges on daswriteback.* to dasregistry@localhost;

Then we edit the hibernate.cfg.xml file to use the mysql database rather than derby:


<property name=”hibernate.connection.driver_class”>com.mysql.jdbc.Driver</property>

<property name=”hibernate.connection.password”>dasregistry</property>

<property name=”hibernate.connection.url”>jdbc:mysql://localhost/daswriteback</property>

<property name=”hibernate.connection.username”>dasregistry</property>

<property name=”hibernate.dialect”>org.hibernate.dialect.MySQLDialect</property>

<!–         <property name=””>update</property> –>

<property name=””>create</property>

<property name=”show_sql”>true</property>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Type.hbm.xml”/>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Method.hbm.xml”/>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Target.hbm.xml”/>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Users.hbm.xml”/>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Feature.hbm.xml”/>

<mapping resource=”uk/ac/ebi/mydas/writeback/datasource/model/Segment.hbm.xml”/>

A new page about setting up the advanced search index for MyDAS is now here:

New Registry Version 4.1.6

There has been a registry update highlights below:


* json responses for web service if accept header = application/json. The exact format of the json response is currently subject to change.

* multiple parameters for the same type are now accepted for e.g. capabilities=features;capabilities=types; returning sources with either features or types

* select active or inactive or both sources using the active=true, active=false or active=any, default is active only

* lists and links to rng files at



The registry web service code is now self contained and is it’s own project hosted here: it uses the Spring REST mvc framework, JAXB2 and the Jackson JSON library. Also maven.


The new registry rest service uses the JDAS project which is here: . This project has object models generated from the relaxng schema files and thus has an easy to use model that follows the structure of the documents. These objects also have JAXB2 annotations that enables the immediate use of more standard Java libraries like spring REST and the Jackson library.


To make a json request you can for example make a request to after setting the “accept” header in the request to “application/json”. A simple REST client can be downloaded for free from here:



Configuration for REST spring mvc with Jackson json mapper omitting null properties

Putting this configuration into my spring res-mvc-config.xml changed the json responses so that null properties are not written. To make this changes have an effect you have to get rid of any mvc:annotation-driven element as this stops the overriding having an effect. no errors will be thrown, so it’s not easy to see what is going on or not going on 😉

<<?xml version=”1.0″ encoding=”UTF-8″?>
<beans xmlns=”;

<context:component-scan base-package=””></context:component-scan>

<context:component-scan base-package=””></context:component-scan>
<!– <mvc:annotation-driven/> –>

<property name=”messageConverters”>
<bean> </bean>
<property name=”objectMapper” ref=”jacksonObjectMapper” />

<!– jackson configuration : –>
<bean id=”jacksonObjectMapper” />
<bean id=”jacksonSerializationConfig”
factory-bean=”jacksonObjectMapper” factory-method=”getSerializationConfig” />
<property name=”targetMethod” value=”setSerializationInclusion” />
<property name=”targetObject” ref=”jacksonSerializationConfig” />
<property name=”arguments”>
<value type=””>NON_NULL</value>


Mapping urls to a jsp

I have a directory with some schema files in that I wanted to list for people to see. The old tomcat would list them if you went to the directory e.g. there were a few forums where various answers to how to do this came up top in google, but they weren’t very simple. The simplest being to create a servlet to redirect to the jsp from your desired urls, simple but not very quick. I knew there had to be a quicker way as jsps are compiled into servlets anyway!

I found an article here which is what I wanted and it’s pretty easy.


so for my directory listing url I used these mappings to allow access through the directory with and without the last slash: