|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.bio.program.unigene.UnigeneTools
public class UnigeneTools
Usefull tools for working with Unigene.
This class is the main port-of-call for users of the Unigene package. It provides the core APIs for finding a Unigene database as well as registering your own Unigene drivers. Additionaly, it contains methods to return parsers for each of the main Unigene flat-file types. If you wish to bypass the biojava object model entirely, you can choose to use these parsers instead.
Creating a Unigene instance from your local Unigene directory (assuming that you have read/write privileges to the directory)
UnigeneDB unigene = UnigeneTools.createUnigene( new URL("file:///usr/local/biodata/unigene") );
Fetch a unigene cluster
UnigeneDB unigene = UnigeneTools.loadUnigene( new URL("file:///usr/local/biodata/unigene") ); UnigeneCluster cluster = unigenge.getCluster("Aga001"); System.out.println("Title: " + cluster.getTitle());
Parse a data file yourself
BufferedReader br = new BufferedReader(new FileReader(unigeneFile)); Parser = new Parser(); TagValueListener echo = new Echo(); ParserListener pl = UnigeneTools.buildDataParser(echo); while(parser.read(br, pl.getParser(), pl.getListener())) { // read an entry }
Field Summary | |
---|---|
static AnnotationType |
LIBRARY_ANNOTATION
Annotation schema for all Unigene libraries. |
static AnnotationType |
UNIGENE_ANNOTATION
Annotation schema for all UnigeneCluster instances. |
Constructor Summary | |
---|---|
UnigeneTools()
|
Method Summary | |
---|---|
static ParserListener |
buildDataParser(TagValueListener listener)
Generate a tag-value parser for unigene data files that will pass all parsing events on to your listener. |
static ParserListener |
buildLibInfoParser(TagValueListener listener)
Generate a tag-value parser for the library info unigene files. |
static UnigeneDB |
createUnigene(java.net.URL dbURL)
Create a new UnigeneDB instance referred to by a URL. |
static UnigeneFactory |
findFactory(java.net.URL dbURL)
Find the UnigeneFactory that can accept a URL. |
static java.lang.String |
getSpeciesForShortName(java.lang.String name)
Converts short species names (like Hs) to long species names (like Homo Sapiens). |
static UnigeneDB |
loadUnigene(java.net.URL dbURL)
Load a UnigeneDB instance referred to by a URL. |
static void |
registerFactory(UnigeneFactory factory)
Register a UnigeneFactory. |
static void |
unregisterFactory(UnigeneFactory factory)
Register a UnigeneFactory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final AnnotationType UNIGENE_ANNOTATION
Annotation schema for all UnigeneCluster instances. This states what propperties can be expected to be associated with a cluster and how many values they may have.
public static final AnnotationType LIBRARY_ANNOTATION
Annotation schema for all Unigene libraries. This states what propperties can be expected to be associated with a library and how many values they may have.
Constructor Detail |
---|
public UnigeneTools()
Method Detail |
---|
public static java.lang.String getSpeciesForShortName(java.lang.String name)
name
- the short name
public static ParserListener buildDataParser(TagValueListener listener) throws ParserException
listener
- the TagValueListener to pass events onto
ParserException
public static ParserListener buildLibInfoParser(TagValueListener listener) throws java.io.IOException, ParserException
listener
- the TagValueListener to pass events onto
java.io.IOException
ParserException
public static void registerFactory(UnigeneFactory factory)
Register a UnigeneFactory.
This method is for developers who have written their own UnigeneFactory implementations. By default, jdbc and file URLs are handled by built-in factories.
When you register a factory, it will be used for all URLs that is can accept. If a factory is registered afterwards that can accept the same URL, the first factory registered will be used.
factory
- the UnigeneFactory to registerpublic static void unregisterFactory(UnigeneFactory factory)
Register a UnigeneFactory.
This method is for developers who wish to unregister a factory.
factory
- the UnigeneFactory to unregisterpublic static UnigeneDB loadUnigene(java.net.URL dbURL) throws BioException
dbURL
- the URL location the database
BioException
- if there was no UnigeneFactory able to process that
URL or if there was some error connectingpublic static UnigeneDB createUnigene(java.net.URL dbURL) throws BioException
dbURL
- the URL location the database
BioException
- if there was no UnigeneFactory able to process that
URL or if there was some error creating itpublic static UnigeneFactory findFactory(java.net.URL dbURL) throws BioException
This method is for developers only. The normal way to interact with factories is to call UnigeneTools.loadUnigene() and UnigeneTools.createUnigene()
dbURL
- the URL to find a factory for
BioException
- if there is no factory for that type of URL
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |