This Wiki page is an edited version of Chinmay’s presentation.
Connections for the Hibernate engine are configured in the Spring configuration file
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="url" value="jdbc:postgresql://holly.sanger.ac.uk:5432/chado" />
<property name="username" value="DELIBERATELY_BOGUS_NAME"/>
<property name="password" value="WIBBLE" />
</bean>
<property name="JDBC.Driver" value="org.postgresql.Driver"/>
<property name="JDBC.ConnectionURL” value="jdbc:postgresql://${chado}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
Creating a gene
genes[0] = new Feature(ORG, GENE, "xfile", false, false, now, now);
genes[0].setSeqLen(1029);
sequenceDao.persist(genes[0]);
FeatureLoc loc = new FeatureLoc(SOURCE_FEATURE, genes[0], 13691, false, 14720, false, (short)1, 0, 0 ,0);
sequenceDao.persist(loc);
addFeatureProp(genes[0], "description", "A test gene for GMOD meeting");
addSynonymsToFeature(genes[0], "mulder", "scully");
createExon("exon1", genes[0], 13691, 13767, now, 0);
createExon("exon2", genes[0], 14687, 14720, now, 1);
Retrieve a gene
Feature f = sequenceDao.getFeatureByUniqueName("xfile");
displayGene(f);
Update a gene
genes[0].setUniqueName("x-file");
sequenceDao.merge(genes[0]);
private Feature createExon(String name, Feature gene, int min, int max, Timestamp now, int rank) {
Feature exon = new Feature(ORG, EXON, name, false, false, now, now);
exon.setSeqLen(max-min);
sequenceDao.persist(exon);
FeatureLoc loc = new FeatureLoc(SOURCE_FEATURE, exon, min, false, max, false,
(short)1, 0, 0 ,0);
sequenceDao.persist(loc);
return exon;
}
Simple web page to demonstrate displaying a basic feature
<st:section name="Naming" id="gene_naming" collapsed="false" collapsible="false"
hideIfEmpty="true">
<dl>
<dt><b>symbol:</b></dt>
<dd>${feature.uniqueName}</dd>
</dl>
<db:synonym name="synonym" var="name" collection="${feature.featureSynonyms}">
<br /><b>Synonym:</b> <db:list-string collection="${name}" />
</db:synonym>
<dt><b>Type:</b></dt>
<dd>${feature.cvTerm.name}</dd>
<st:section name="Exons" collapsed="false" collapsible="true" hideIfEmpty="true">
<display:table name="exons" uid="tmp" pagesize="30" class="simple" cellspacing="0"
cellpadding="4">
<display:column property="uniqueName" title="Exon"/>
<display:column property="featureLocsForSrcFeatureId.fmin" title="Start"/>
<display:column property="featureLocsForSrcFeatureId.fmax" title="end"/>
</display:table>
</st:section>
<st:section name="cds" collapsible="true">
<b>${feature.residues}</b>
</st:section>