Class SimpleNCBITaxonomyLoader

  • All Implemented Interfaces:
    NCBITaxonomyLoader

    public class SimpleNCBITaxonomyLoader
    extends java.lang.Object
    implements NCBITaxonomyLoader
    Loads NCBI taxon information from names.dmp and nodes.dmp, which are two of the files in the archive downloadable at ftp://ftp.ncbi.nih.gov/pub/taxonomy/ . This simple implementation makes no attempt to process deletions or merges - it merely creates instances as it goes along, reusing any that may already exist.
    Since:
    1.5
    Author:
    Richard Holland
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected NCBITaxon findTaxon​(java.lang.Object[] theKeys)  
      NCBITaxon readName​(java.io.BufferedReader names)
      Reads the next entry from the names.dmp file and returns the corresponding NCBITaxon object with the name added in already.
      NCBITaxon readNode​(java.io.BufferedReader nodes)
      Reads the next entry from the nodes.dmp file and returns the corresponding NCBITaxon object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • readNode

        public NCBITaxon readNode​(java.io.BufferedReader nodes)
                           throws java.io.IOException,
                                  ParseException
        Reads the next entry from the nodes.dmp file and returns the corresponding NCBITaxon object.
        Specified by:
        readNode in interface NCBITaxonomyLoader
        Parameters:
        nodes - something that reads the nodes.dmp file
        Returns:
        the next NCBITaxon object in the file, or null if the file has ended.
        Throws:
        java.io.IOException
        ParseException
      • readName

        public NCBITaxon readName​(java.io.BufferedReader names)
                           throws java.io.IOException,
                                  ParseException
        Reads the next entry from the names.dmp file and returns the corresponding NCBITaxon object with the name added in already. Note that this does not clear out existing names from the taxon, it only adds them. Use the code snippet below if you want to clear out the names first: for (Iterator i = taxon.getNameClasses().iterator(); i.hasNext(); ) { taxon.getNames((String)i.next()).clear(); }
        Specified by:
        readName in interface NCBITaxonomyLoader
        Parameters:
        names - something that reads the names.dmp file
        Returns:
        the NCBITaxon object corresponding to the next entry in the file, or null if the file has ended.
        Throws:
        java.io.IOException
        ParseException