Difference between revisions of "Dazzle Tutorial"
(New page: = Dazzle Tutorial Introduction = This tutorial will take you through setting up Dazzle (in the Eclipse Environment and using Tomcat as your container) as a DAS server using the already a...) |
(→Configure using dazzle.xml) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= Dazzle Tutorial Introduction = | = Dazzle Tutorial Introduction = | ||
− | + | This tutorial will take you through setting up Dazzle (in the Eclipse Environment and using Tomcat as your container) as a DAS server using the already available test sources and then it will take you through how to write your own plugin using the this setup. | |
Setting up dazzle in eclipse makes it easier to debug the application if configuration files are incorrect and makes it easy to test your das server in an integrated environment. This step by step guide should be usable by anyone with only a moderate knowledge of java and web development. It describes how to set up a basic dazzle instance with the default plugins available and test datasets included in the application. | Setting up dazzle in eclipse makes it easier to debug the application if configuration files are incorrect and makes it easy to test your das server in an integrated environment. This step by step guide should be usable by anyone with only a moderate knowledge of java and web development. It describes how to set up a basic dazzle instance with the default plugins available and test datasets included in the application. | ||
Line 7: | Line 7: | ||
= Steps required to set up dazzle in eclipse with already available plugins = | = Steps required to set up dazzle in eclipse with already available plugins = | ||
− | + | Setting up dazzle in eclipse makes it easier to debug the application if configuration files are incorrect and makes it easy to test your das server in an integrated environment. This step by step guide should be usable by anyone with only a moderate knowledge of java and web development. It describes how to set up a basic dazzle instance with the default plugins available and test datasets included in the application. | |
=== Download container (apache tomcat 5.5.27) === | === Download container (apache tomcat 5.5.27) === | ||
− | + | Go to [http://tomcat.apache.org/download-55.cgi http://tomcat.apache.org/download-55.cgi"] and download tomcat by clicking on a link under the core catagory - windows installer if you are using windows or a tar.gz if you are using linux or macOSX | |
=== Download EasyEclipse (EasyEclipse server java version which has Web tools already or the Ganymede version). === | === Download EasyEclipse (EasyEclipse server java version which has Web tools already or the Ganymede version). === | ||
− | + | Go to http://www.easyeclipse.org/site/distributions/server-java.html and select the download for your type of operating system e.g. windows or mac | |
=== Set up a server configuration in eclipse === | === Set up a server configuration in eclipse === | ||
Line 45: | Line 45: | ||
# right click on the project in the eclipse explorer window and select "build path" then "configure build path","add jars" then open the project in the popup that appears and a jars dir should be visible, then select all the jar files, then ok. | # right click on the project in the eclipse explorer window and select "build path" then "configure build path","add jars" then open the project in the popup that appears and a jars dir should be visible, then select all the jar files, then ok. | ||
− | + | (newer features require java 5.0 so we need to make sure the project is configured to use java 5.0 as standard). rigt click on the project and select properties then the J2EE tab, then select the jar files as before to be added to the project. | |
# go to project properties again and select the java build path, source tab- then click "add resources" tick the resources folder and ok. | # go to project properties again and select the java build path, source tab- then click "add resources" tick the resources folder and ok. | ||
Line 51: | Line 51: | ||
=== Configure using dazzle.xml === | === Configure using dazzle.xml === | ||
− | + | now go to the dazzlecfg.xml file in the dazzle-webapp folder and alter the "value" next to filename for all occurances and put a / in front e.g. change "test.embl" to "/test.embl" | |
=== Run using eclipse === | === Run using eclipse === | ||
Line 68: | Line 68: | ||
= Adding your own Data Source and writing your own plugin = | = Adding your own Data Source and writing your own plugin = | ||
− | + | Using the above setup in of Dazzle in Eclipse we are now going to write our own Java classes to get data from our own datasource. | |
== Background information on Dazzle and it's structure/methodology. == | == Background information on Dazzle and it's structure/methodology. == | ||
− | + | If you wish to get stuck into coding straight away carry on with this page. If you wish to get an overview of the inner workings of Dazzle go [DazzleMethodologyAndStructure Dazzle Methodology And Structure]. | |
== Writing the plugins (a genomic dazzle data source) == | == Writing the plugins (a genomic dazzle data source) == | ||
Line 81: | Line 81: | ||
Note: to use the latest biojava code you can get it from svn and check it out as a normal java project then run ant on the build.xml file. then delete the biojava.jar currently set and add the new biojava.jar from the ant-build directory of your new biojava project by adding it to the J2EE dependencies. | Note: to use the latest biojava code you can get it from svn and check it out as a normal java project then run ant on the build.xml file. then delete the biojava.jar currently set and add the new biojava.jar from the ant-build directory of your new biojava project by adding it to the J2EE dependencies. | ||
− | + | BasicData.txt file is in this format: | |
Line 132: | Line 132: | ||
The methods in our class getFileName and setFileName allow the filename to be specified in the dazzlecfg.xml file as above. In the public void init(ServletContext ctx) method we allow dazzle to initialize our data by calling this method which then calls our parseData method. In the parse data method we read in the whole of the data file into memory (if you are using a database you probably would initialize the connections instead). | The methods in our class getFileName and setFileName allow the filename to be specified in the dazzlecfg.xml file as above. In the public void init(ServletContext ctx) method we allow dazzle to initialize our data by calling this method which then calls our parseData method. In the parse data method we read in the whole of the data file into memory (if you are using a database you probably would initialize the connections instead). | ||
− | + | A utility class you will need to run this code is here: | |
Line 328: | Line 328: | ||
} | } | ||
− | + | once you have got your features cmd working you can download the dasobert project from svn and test it by creating a class like this (you can add this class to the same package as your plugins): | |
Line 525: | Line 525: | ||
</DASSTYLE> | </DASSTYLE> | ||
− | + | to use this test stylesheet with our dazzle source we can just make sure the file is under the dazzle-webapp directory of eclipse and then add this line to our dazzlecfg.xml file : | |
<string name="stylesheet" value="/test.style" /> | <string name="stylesheet" value="/test.style" /> | ||
− | + | Instructions for deploying to live server: With eclipse you can select export, as war file, then select a dir to put you .war file into. When this is done you can copy this war file to a production tomcat or resin servers webapp directory. Then to run Dazzle from tomcat you just run the following on cmd line from within the webapp dir: | |
Line 539: | Line 539: | ||
sh ../bin/shutdown.sh | sh ../bin/shutdown.sh | ||
− | + | For development purposes and the purposes of this tutorial we can just continue to run our das server through eclipse as we have been. | |
= Setting up our server in the DAS Registry = | = Setting up our server in the DAS Registry = | ||
Line 546: | Line 546: | ||
# box1: Enter and easy to remember but descriptive name in the nickname box | # box1: Enter and easy to remember but descriptive name in the nickname box | ||
# box2:select the coordinate system (note you can type the first letter to get you close to the correct one) in our case it's N for NCBI. Select "NCBI_36, Chromosome, HomoSapiens". | # box2:select the coordinate system (note you can type the first letter to get you close to the correct one) in our case it's N for NCBI. Select "NCBI_36, Chromosome, HomoSapiens". | ||
− | # box3: Paste in the full das path for your data source | + | # box3: Paste in the full das path for your data source http://www.yourdomainname.org/das/JonsPlugin |
# box5: Put your email address | # box5: Put your email address | ||
# box6: Put a desciption of your source and any relevant experimental conditions etc | # box6: Put a desciption of your source and any relevant experimental conditions etc | ||
Line 584: | Line 584: | ||
= Writing some client code = | = Writing some client code = | ||
− | The client code/Dasobert tutorial is here [ | + | The client code/Dasobert tutorial is here [[Dasobert_Tutorial]] There are some examples of writing client code here: http://www.derkholm.net/svn/repos/dasobert/trunk/doc/examples/ |
Latest revision as of 13:42, 9 July 2009
Contents
- 1 Dazzle Tutorial Introduction
- 2 Steps required to set up dazzle in eclipse with already available plugins
- 2.1 Download container (apache tomcat 5.5.27)
- 2.2 Download EasyEclipse (EasyEclipse server java version which has Web tools already or the Ganymede version).
- 2.3 Set up a server configuration in eclipse
- 2.4 Get project from the latest source in subversion
- 2.5 Configure using dazzle.xml
- 2.6 Run using eclipse
- 2.7 Deploy to a Tomcat container using Eclipse
- 3 Adding your own Data Source and writing your own plugin
- 4 Setting up our server in the DAS Registry
- 5 Looking at your server with Ensembl
- 6 Writing some client code
Dazzle Tutorial Introduction
This tutorial will take you through setting up Dazzle (in the Eclipse Environment and using Tomcat as your container) as a DAS server using the already available test sources and then it will take you through how to write your own plugin using the this setup.
Setting up dazzle in eclipse makes it easier to debug the application if configuration files are incorrect and makes it easy to test your das server in an integrated environment. This step by step guide should be usable by anyone with only a moderate knowledge of java and web development. It describes how to set up a basic dazzle instance with the default plugins available and test datasets included in the application.
Steps required to set up dazzle in eclipse with already available plugins
Setting up dazzle in eclipse makes it easier to debug the application if configuration files are incorrect and makes it easy to test your das server in an integrated environment. This step by step guide should be usable by anyone with only a moderate knowledge of java and web development. It describes how to set up a basic dazzle instance with the default plugins available and test datasets included in the application.
Download container (apache tomcat 5.5.27)
Go to http://tomcat.apache.org/download-55.cgi" and download tomcat by clicking on a link under the core catagory - windows installer if you are using windows or a tar.gz if you are using linux or macOSX
Download EasyEclipse (EasyEclipse server java version which has Web tools already or the Ganymede version).
Go to http://www.easyeclipse.org/site/distributions/server-java.html and select the download for your type of operating system e.g. windows or mac
Set up a server configuration in eclipse
- right click on the servers tab at the bottom of eclipse.
- click new, server.
- browse to the tomcat 5.5.27 dir and select.
- next, next, ok.
Get project from the latest source in subversion
- choose file, import, SVN, checkout projects from svn. (if this option does not exist you need to install the SVN plugin for eclipse Subclipse
- click next (create new repository location).
- type in "http://www.derkholm.net/svn/repos/dazzle/"
- next
- select the trunk directory
- next
- leave the default "check out the project using the New Project Wizard"
- click "finish"
- open web dir then select dynamic web project, next
- type in the name of your project as "das"
- click next
- in the "Content directory:" field type in "dazzle-webapp"
- click "finish"
- click ok if eclipse talks about standard resources
Your das project should now be in eclipse.
- right click on the project in the eclipse explorer window and select "build path" then "configure build path","add jars" then open the project in the popup that appears and a jars dir should be visible, then select all the jar files, then ok.
(newer features require java 5.0 so we need to make sure the project is configured to use java 5.0 as standard). rigt click on the project and select properties then the J2EE tab, then select the jar files as before to be added to the project.
- go to project properties again and select the java build path, source tab- then click "add resources" tick the resources folder and ok.
Configure using dazzle.xml
now go to the dazzlecfg.xml file in the dazzle-webapp folder and alter the "value" next to filename for all occurances and put a / in front e.g. change "test.embl" to "/test.embl"
Run using eclipse
- Right click on the project in the window on the left and select "run as" then "run on server", "finish". Another window should appear with the url http://localhost:8080/das/ at the top and a list of das sources.
- Alternatively:
- Right click on the "tomcat 5.5..." server in the servers tab in the bottom window of eclipse and choose start.
- If you navigate to http://localhost:8080/das/ in a internet browser you should now see a list of das sources!!!???
- now type into the browser the url http://localhost:8080/das/dsn
- right click on the web page and select "view page source" this will open a file containing the raw xml that is being returned from your dazzle server.
Deploy to a Tomcat container using Eclipse
- Right click on the project in the left hand window and select "export","web","WAR file","next", browse to a folder where you want to put the war file, click "save" and then "finish". You can now move this .war file into the webapp directory of any java compliant webapp container such as tomcat or resin).
Adding your own Data Source and writing your own plugin
Using the above setup in of Dazzle in Eclipse we are now going to write our own Java classes to get data from our own datasource.
Background information on Dazzle and it's structure/methodology.
If you wish to get stuck into coding straight away carry on with this page. If you wish to get an overview of the inner workings of Dazzle go [DazzleMethodologyAndStructure Dazzle Methodology And Structure].
Writing the plugins (a genomic dazzle data source)
- right click on the original das project then select "new source folder" type in the name of your new source folder, I used "mySrc" as a name - click next.
- add a package called myplugins to this source folder and a class MyGFFSource
Note: to use the latest biojava code you can get it from svn and check it out as a normal java project then run ant on the build.xml file. then delete the biojava.jar currently set and add the new biojava.jar from the ant-build directory of your new biojava project by adding it to the J2EE dependencies.
BasicData.txt file is in this format:
1 799614 988150 RP11-54O7 1 1115132 1227290 RP5-902P8 1 1419309 1506414 RP5-832C2 1 1609533 1719442 RP1-283E3 1 1682617 1882900 RP1-140A9 1 1825391 2014198 RP11-547D24 1 2062380 2242269 RP11-181G12 1 2368110 2522845 RP3-395M20 1 2847618 3039179 RP11-333E3 1 3214521 3355092 RP4-785P20 1 3391696 3538713 RP11-46F15 1 3628936 3737792 RP1-286D6 1 4220465 4395827 RP11-168B8 1 4476687 4608114 RP1-37J18 1 5189627 5308621 RP4-703E10 1 5866139 6042830 RP11-49J3 1 6125992 6292510 RP1-120G22 1 6411973 6587996 RP11-58A11 1 6661384 6810842 RP11-242F24 1 7059893 7186680 RP3-438L4 1 7146893 7259359 RP3-505B13 1 7316045 7478083 RP4-549F15 1 7641506 7843561 RP11-338N10 1 7705429 7868155 RP3-467L1 1 7960195 8134265 RP11-478I22
Step 1= set up a basic features request for this gff type file (note this not a complete gff file, which is why we can't use a ready made plugin).
remember if you are going to set up a gff type reader and read from a file you need to tell the servlet the filename in the dazzlecfg.xml
<dazzle xmlns="http://www.biojava.org/2000/dazzle"> <!-- Test reference server --> <datasource id="JonsPlugin" jclass="myplugins.MyDataSource"> <string name="name" value="MyFirstPlugin" /> <string name="description" value="a demo for how to write a dazzle plugin"/> <string name="fileName" value="/BasicData.txt"/> <string name="version" value="1.0"/> </datasource> </dazzle>
you will also need to make sure that eclipse restarts the server in order for any changes in the dazzlecfg.xml to take effect. you also need getFileName and setFileName() methods for dazzle to set the filename in your DazzleDataSource.
here we extend the AbstractGFFFeatureSource which is itself an extension of the AbstractDazzleDataSource which implements the DazzleDataSource interface. In this way we are holding true to the contract that needs to upheld to impement a DazzleDataSource plugin.
The methods in our class getFileName and setFileName allow the filename to be specified in the dazzlecfg.xml file as above. In the public void init(ServletContext ctx) method we allow dazzle to initialize our data by calling this method which then calls our parseData method. In the parse data method we read in the whole of the data file into memory (if you are using a database you probably would initialize the connections instead).
A utility class you will need to run this code is here:
package myplugins; import java.util.ArrayList; import java.util.Iterator; import org.biojava.servlets.dazzle.Segment; import org.biojava.servlets.dazzle.datasource.GFFFeature; /** * simple class for demo purposes that returns features from given segments of a chromosome * that has probably been specified in gff type format * @author jw12 * */ public class Chromosome { private String id=""; private int start=1; private int end; ArrayList features; public Chromosome(String id, int end){ this.id=id; this.end=end; features =new ArrayList(); } public void addFeature(GFFFeature feature){ this.features.add(feature); } public GFFFeature[] getFeatures(Segment seg){ System.out.println("seg in chromosome=" seg); ArrayList featuresOnSegment=new ArrayList(); int start=seg.getStart(); int stop =seg.getStop(); //loop over arraylist of features and return a lis Iterator it=features.iterator(); while(it.hasNext()){ GFFFeature feature=(GFFFeature)it.next(); int fStart=Integer.parseInt(feature.getStart()); int fStop=Integer.parseInt(feature.getEnd()); //if between start and stop then include in returned list if((fStart>=start && fStart<=stop)||(fStop<=stop && fStop>=start)){ featuresOnSegment.add(feature); } } return (GFFFeature[]) featuresOnSegment.toArray(new GFFFeature[featuresOnSegment.size()]); //return new GFFFeature[0]; } }
package myplugins; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.StringTokenizer; import javax.servlet.ServletContext; import org.biojava.servlets.dazzle.Segment; import org.biojava.servlets.dazzle.datasource.AbstractGFFFeatureSource; import org.biojava.servlets.dazzle.datasource.DataSourceException; import org.biojava.servlets.dazzle.datasource.GFFFeature; public class MyDataSource extends AbstractGFFFeatureSource { String fileName; //private ArrayList allFeatures; HashMap chromosomes; public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public void init(ServletContext ctx) throws DataSourceException { //data = new HashMap(); super.init(ctx); try { //parse the phobius result file parseData(ctx); } catch (Exception ex) { throw new DataSourceException(ex, "Couldn't load data file"); } } private void parseData(ServletContext ctx) { chromosomes=new HashMap(); //allFeatures=new ArrayList(); System.out.println("filename in my source=====" fileName); BufferedReader br = new BufferedReader(new InputStreamReader(ctx.getResourceAsStream(fileName))); try { for(String line = br.readLine(); line != null; line = br.readLine()) { System.out.println("line in file =" line); if ( line.charAt(0) == '#') continue; StringTokenizer token = new StringTokenizer(line,"\t");//split line by tabs if (token.countTokens() < 5) { throw new IOException("file does not match expected format at line " line " it has got" token.countTokens() " tokens!"); } //create a new GFFFeature for each line and add to an arraylist String []fields=new String[5]; int i=0; while(token.hasMoreTokens()){ String tok=(String)token.nextElement(); fields[i]=tok; //System.out.println("token added ok"); i ; } String chromosomeId=fields[0]; GFFFeature feature = new GFFFeature(); feature.setOrientation(fields[3]); feature.setType("blast"); feature.setStart(fields[1]); feature.setEnd(fields[2]); feature.setMethod("BLAST"); feature.setName(fields[4]); feature.setLabel("label here"); //allFeatures.add(of); Chromosome chr=null; if(chromosomes.containsKey(chromosomeId)){ chr=(Chromosome)chromosomes.get(chromosomeId); }else{ chr=new Chromosome(chromosomeId, 100000000); chromosomes.put(chromosomeId,chr); } chr.addFeature(feature); //of.setLink("http://phobius.cgb.ki.se"); //of.setScore(o); //of.setType(of.getName()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } /** * we have overridden the super class method here as we need to. */ public String getFeatureID(GFFFeature f) { return f.getName(); } public GFFFeature[] getFeatures(Segment seg, String[] types) throws DataSourceException { System.out.println("got a features request from a segement " seg); System.out.println("segment id=" seg.getReference() " segment start=" seg.getStart() " seg stop=" seg.getStop()); //note there is also a getMax and getMin methods for the segment class in case stop is less than start??? //seg is something like 1:1,1000 if chromosomal String chromosomeId=seg.getReference(); Chromosome chr=(Chromosome) chromosomes.get(chromosomeId); GFFFeature[] features=chr.getFeatures(seg); return features; //return new GFFFeature[0]; } public GFFFeature[] getFeatures (String reference) throws DataSourceException { System.out.println("got features from reference" reference); return new GFFFeature[0]; } }
once you have got your features cmd working you can download the dasobert project from svn and test it by creating a class like this (you can add this class to the same package as your plugins):
package myplugins; import org.biojava.dasobert.dasregistry.Das1Validator; public class ValidateMySource { public static void main(String args[]){ String url="http://localhost:8080/das/JonsPlugin/"; String cmd="features"; String testcode="1:1,10000000"; Das1Validator validator=new Das1Validator(); boolean isValid=validator.validateFeatures(url, testcode, false); if(isValid)System.out.println("this is valid"); } }
note: you need to add the biojava project or jar and the dasobert.jar or project to your build path before this code will compile. You can right click and select run as application in the eclipse explorer window on this class.
So far we have enabled Dazzle to initialize our data source (in this case load our flat file into memory) and enable Dazzle to run a features cmd on our data source. Next we want to add some more functionality. Lets enable the entry_points cmd, the entry points spec is here- http://www.biodas.org/wiki/DAS1.6#Entry_Points_Command
If your server is a reference server i.e. it serves up sequence it should also tell people what entry_points (in this case chromosomes and their lengths it has). to do this we can make our class implement DazzleReferenceSource which has two methods getSequence and getEntryPoints.
So if we add implements DazzleReferenceSource to the declaration of our class we can then right click on the red error mark that comes up on the side of the main panel in eclipse and select implement unimplemented methods. This creates the empty methods mentioned above. then we can fill them in like this:
The other method we will need to implement if we want to show people the lengths of our chromsomes which we do is getLandmarkLength where we are overriding a default method in the superclass AbstractDazzleDataSource.
/** This method deals with the DAS -entry points command. * @return a set containing the references to the entry points */ public Set getEntryPoints() { Set<String> s = new TreeSet<String> (); // this example has only one feature. // for your real data you might want to add a SQL query here. s.add("1"); s.add("2"); s.add("3"); s.add("4"); s.add("5"); s.add("6"); s.add("7"); s.add("8"); s.add("9"); s.add("10"); s.add("11"); s.add("12"); s.add("13"); s.add("14"); s.add("15"); s.add("16"); s.add("17"); s.add("18"); s.add("19"); s.add("20"); s.add("21"); s.add("22"); s.add("X"); s.add("Y"); return s; } /** * Return the length of the requested sequence */ public int getLandmarkLength(String ref) throws DataSourceException, NoSuchElementException { //set up a hashmap with our references ie chromosome ids in as keys and their lengths as values HashMap lengthsMap=new HashMap(); lengthsMap.put("1", "247249719"); lengthsMap.put("2", "242951149"); lengthsMap.put("3", "199501827"); lengthsMap.put("4", "191273063"); lengthsMap.put("5", "180857866"); lengthsMap.put("6", "10000000"); lengthsMap.put("7", "10000000"); lengthsMap.put("8", "10000000"); lengthsMap.put("9", "10000000"); lengthsMap.put("10", "10000000"); lengthsMap.put("11", "10000000"); lengthsMap.put("12", "10000000"); lengthsMap.put("13", "10000000"); lengthsMap.put("14", "10000000"); lengthsMap.put("15", "10000000"); lengthsMap.put("16", "10000000"); lengthsMap.put("17", "10000000"); lengthsMap.put("18", "10000000"); lengthsMap.put("19", "10000000"); lengthsMap.put("20", "10000000"); lengthsMap.put("21", "10000000"); lengthsMap.put("22", "10000000"); lengthsMap.put("X", "10000000"); lengthsMap.put("Y", "10000000"); System.out.println("ref in landmark=" ref); int length=-1; String lengthString=(String)lengthsMap.get(ref); System.out.println("paring int" lengthString); length=Integer.parseInt(lengthString); return length; }
to implement the sequence cmd which you need to do for a reference server (but not if you are setting up an annotation server) you can override the getSequence method like below , but obviously changing the sequence returned for each reference:
public Sequence getSequence(String ref) throws NoSuchElementException, DataSourceException { String seq = "AGCCCGTATATAATATGAGAGAGGCCCCGCGCG"; try { Sequence dna = DNATools.createDNASequence(seq, ref); return dna; } catch ( IllegalSymbolException e){ throw new DataSourceException(e.getMessage()); } }
the sequence cmd will look like this: http://localhost:8080/das/JonsPlugin/sequence?segment=1:1,33
Error Segments: Because we are using the GFF set of classes we don't need to worry about creating error segments as these are handled by the FeaturesHandler When a request for the sequence or annotations of a named segment may fail because either: 1. the requested segment is outside the bounds of the reference object. 2. the reference object is not known to the server So we don't need to do any extra coding here.
Sources cmd: Now we have our server serving some information and it now has some capabilities we need to make it known to the world which we do in two ways: 1) create a sources cmd response to let people and machines know more information about our data 2) Registering our data with the DAS Registry at http://www.dasregistry.org
so for our source cmd: we need to edit the sources.xml file that should be under our dazzle-webapp dir in eclipse: We need our source to look like this:
most of the entries are self explanatory, but it's important to put in your email address or the contact persons email address, a description and how recent the source is.
The coordinate system you want should be listed at the bottom of this page: http://www.dasregistry.org/help_coordsys.jsp We are using a NCBI36 human genome with chromosomes as our reference sequences. so we want to click on the link that corresponds to this source in order to get the information we want to add to our coordinate system xml elements. A good tip is to go to this page and find the entry for the coordinate system and copy and paste the xml for the coordinate system into your sources.xml document which will avoid typos and other issues with validation: http://www.dasregistry.org/das1/coordinatesystem
<?xml version='1.0' encoding='UTF-8' ?> <?xml-stylesheet type="text/xsl" href="das.xsl"?> <SOURCES> <SOURCE uri="JonsPlugin" title="Our simple almost gff DAS source" doc_href="http://www.myhomepage.org" description="Test set for promoter-finding software"> <MAINTAINER email="JoeBloggs@myemail.org" /> <VERSION uri="latest" created="2009-02-25"> <COORDINATES uri="http://www.dasregistry.org/coordsys/CS_DS40" taxid="9606" version="36" source="Chromosome" authority="NCBI" test_range="1:1,1000000"/>NCBI_36,Chromosome,Homo sapiens</COORDINATES> <CAPABILITY type="das1:sequence" query_uri="http://localhost:8080/das/JonsPlugin/sequence" /> <CAPABILITY type="das1:features" query_uri="http://localhost:8080/das/JonsPlugin/features" /> <CAPABILITY type="das1:entry_points" query_uri="http://localhost:8080/das/JonsPlugin/entry_points" /> <CAPABILITY type="das1:stylesheet" query_uri="http://localhost:8080/das/JonsPlugin/stylesheet" /> <PROP name="label" value="BioSapiens" /> </VERSION> </SOURCE> </SOURCES>
our capabilities of our server should be listed and as we are conforming to DAS1 we put das1: in front of the commands we support. obviously localhost:8080 will need to be replaced with your domain name when your Dazzle server is deployed to a live server.
we can add the following lines of code to our validator to test the sources response:
boolean isSourcesValid=validator.validateSourcesCmd(url); if(isSourcesValid)System.out.println("sources cmd is valid");
We have listed in our capabilities the stylesheet cmd, but we do not currently implement it. So lets do that now:
stylesheet: To test this cmd: http://localhost:8080/das/JonsPlugin/stylesheet We can use a stylesheet called test.style which looks like this:
<?xml version="1.0" standalone="yes"?> <DASSTYLE> <STYLESHEET> <CATEGORY id="default"> <TYPE id="default"> <GLYPH> <ARROW> <HEIGHT>10</HEIGHT> <COLOR>yellow</COLOR> <PARALLEL>yes</PARALLEL> </ARROW> </GLYPH> </TYPE> </CATEGORY> </STYLESHEET> </DASSTYLE>
to use this test stylesheet with our dazzle source we can just make sure the file is under the dazzle-webapp directory of eclipse and then add this line to our dazzlecfg.xml file :
<string name="stylesheet" value="/test.style" />
Instructions for deploying to live server: With eclipse you can select export, as war file, then select a dir to put you .war file into. When this is done you can copy this war file to a production tomcat or resin servers webapp directory. Then to run Dazzle from tomcat you just run the following on cmd line from within the webapp dir:
sh ../bin/startup.sh and to shut down dazzle: sh ../bin/shutdown.sh
For development purposes and the purposes of this tutorial we can just continue to run our das server through eclipse as we have been.
Setting up our server in the DAS Registry
- Go to the http://www.dasregistry.org and select "register new" from the menu at the top of the page.
- box1: Enter and easy to remember but descriptive name in the nickname box
- box2:select the coordinate system (note you can type the first letter to get you close to the correct one) in our case it's N for NCBI. Select "NCBI_36, Chromosome, HomoSapiens".
- box3: Paste in the full das path for your data source http://www.yourdomainname.org/das/JonsPlugin
- box5: Put your email address
- box6: Put a desciption of your source and any relevant experimental conditions etc
- box7: Hold down the ctrl key and select the capabilities you have implimented in your source (in this tutorial we have features, types, source, entry_points and sequence).
- box8: If you have a web page describing your project where the das data comes from the put the full url here
- box9: If you wish to add a tag/label of the types specified to it here
- box10: Tick this box if you with your email to be used to let you know if your servers is down
- when you're happy press save and go to next step
- enter "1:1,33" for the test region
- click "register"
You will see that our source will not validate because of the sequence cmd where we only gave a sequence of 33 bp long. If you remove the sequence cmd from the list of capabilities the source will validate.
Looking at your server with Ensembl
To get ensembl to read your das sources the sources.xml file needs to be configured correctly with your domain name and full path to each capability URI configured with the correct domain name.
- Open a browser and go to http://www.ensembl.org/
- Select the "Human Genome" link
- From the left hand side menu select Karyotype
- Click on chromosome 1 and select "jump to location view"
- Click on "Add custom data to page" from the left hand menu
- "Attach DAS"
- If you have already succesfully registered your source with the registry you can select next and then tick your source from the options then available
- alternatively you can manually configure your source by pasting in the url to your das server "http://mydomainname.ac.uk:8080/das" into the box labelled "or other DAS server:"
- click next
- If you sources.xml and dazzle server is working correctly ensembl will then take you to a page that says "The following DAS sources have now been attached: your das source"
- Click "close" on the right hand side to close this configuration window and go back to contig view
To verify that our dazzle server is now being read correctly by ensembl we can navigate to a region we know has a feature and see if our track is displayed along with the features:
- Between the overview and the detailed veiw on the ensembl page there are boxes where we can specify the location of our known features
- In the boxes labelled "Location:" put 1 for chromosome 1 then 1 and 1000000 for the start and end of the regions
- You should now see a black line towards the left of the screen within a track labelled "Our simple almost gff DAS source"
Writing some client code
The client code/Dasobert tutorial is here Dasobert_Tutorial There are some examples of writing client code here: http://www.derkholm.net/svn/repos/dasobert/trunk/doc/examples/