UnigeneTools (BioJava-1.5-beta API)
Keywords: org.biojava.bio.program.unigene.UnigeneTools class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.program.unigene
Class UnigeneTools

    java.lang.Object
      org.biojava.bio.program.unigene.UnigeneTools

    public class UnigeneTools

extends Object

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.

## Example use

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
     }

Author:
  Matthew Pocock

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(URL dbURL)` Create a new UnigeneDB instance referred to by a URL.
`static UnigeneFactory` | `findFactory(URL dbURL)` Find the UnigeneFactory that can accept a URL.
`static String` | `getSpeciesForShortName(String name)` Converts short species names (like Hs) to long species names (like Homo Sapiens).
`static UnigeneDB` | `loadUnigene(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

### UNIGENE_ANNOTATION

    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.

### LIBRARY_ANNOTATION

    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

### UnigeneTools

    public UnigeneTools()

Method Detail

### getSpeciesForShortName

    public static String getSpeciesForShortName(String name)

  Converts short species names (like Hs) to long species names (like Homo Sapiens).

  Parameters:
    `name` - the short name
  Returns:
    the long name

### buildDataParser

    public static ParserListener buildDataParser(TagValueListener listener)
                                          throws ParserException

  Generate a tag-value parser for unigene data files that will pass all parsing events on to your listener.

  Parameters:
    `listener` - the TagValueListener to pass events onto
  Returns:
    a ParserListener that is ready to consume unigene data documents
  Throws:
    `ParserException`

### buildLibInfoParser

    public static ParserListener buildLibInfoParser(TagValueListener listener)
                                             throws IOException,
                                                    ParserException

  Generate a tag-value parser for the library info unigene files.

  Parameters:
    `listener` - the TagValueListener to pass events onto
  Returns:
    a ParserListener that is ready to consume unigene lib.info files
  Throws:
    `IOException`
    `ParserException`

### registerFactory

    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.

  Parameters:
    `factory` - the UnigeneFactory to register

### unregisterFactory

    public static void unregisterFactory(UnigeneFactory factory)

  Register a UnigeneFactory.

  This method is for developers who wish to unregister a factory.

  Parameters:
    `factory` - the UnigeneFactory to unregister

### loadUnigene

    public static UnigeneDB loadUnigene(URL dbURL)
                                 throws BioException

  Load a UnigeneDB instance referred to by a URL.

  Parameters:
    `dbURL` - the URL location the database
  Returns:
    a UnigeneDB instance
  Throws:
    `BioException` - if there was no UnigeneFactory able to process that URL or if there was some error connecting

### createUnigene

    public static UnigeneDB createUnigene(URL dbURL)
                                   throws BioException

  Create a new UnigeneDB instance referred to by a URL.

  Parameters:
    `dbURL` - the URL location the database
  Returns:
    a UnigeneDB instance
  Throws:
    `BioException` - if there was no UnigeneFactory able to process that URL or if there was some error creating it

### findFactory

    public static UnigeneFactory findFactory(URL dbURL)
                                      throws BioException

  Find the UnigeneFactory that can accept a URL.

  This method is for developers only. The normal way to interact with factories is to call UnigeneTools.loadUnigene() and UnigeneTools.createUnigene()

  Parameters:
    `dbURL` - the URL to find a factory for
  Returns:
    the UnigeneFactory that accepts that URL
  Throws:
    `BioException` - if there is no factory for that type of URL

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD