All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.bio.taxonomy.ncbi.NCBITaxonNodeRank Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.bio.taxonomy.ncbi;

import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;


//------------------------------------------------------------------------------
/**
 * NCBI taxonomy levels.
 * 

* Based on values in the nodes.dmp file in ftp://ftp.ncbi.nih.gov/pub/taxonomy/taxdump.tar.gz *

* * @author J. Alex Taylor, hairyfatguy.com */ //------------------------------------------------------------------------------ // com.hfg XML/HTML Coding Library // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com // [email protected] //------------------------------------------------------------------------------ public class NCBITaxonNodeRank implements Comparable, Serializable { //************************************************************************** // PRIVATE FIELDS //************************************************************************** private String mName; private int mRank; private static Map sUniqueMap = new HashMap<>(30); //************************************************************************** // PUBLIC FIELDS //************************************************************************** public static NCBITaxonNodeRank SUPERKINGDOM = new NCBITaxonNodeRank(160, "superkingdom"); public static NCBITaxonNodeRank KINGDOM = new NCBITaxonNodeRank(155, "kingdom"); public static NCBITaxonNodeRank SUBKINGDOM = new NCBITaxonNodeRank(150, "subkingdom"); public static NCBITaxonNodeRank SUPERPHYLUM = new NCBITaxonNodeRank(145, "superphylum"); public static NCBITaxonNodeRank PHYLUM = new NCBITaxonNodeRank(140, "phylum"); public static NCBITaxonNodeRank SUBPHYLUM = new NCBITaxonNodeRank(135, "subphylum"); public static NCBITaxonNodeRank SUPERCLASS = new NCBITaxonNodeRank(130, "superclass"); public static NCBITaxonNodeRank CLASS = new NCBITaxonNodeRank(125, "class"); public static NCBITaxonNodeRank SUBCLASS = new NCBITaxonNodeRank(120, "subclass"); public static NCBITaxonNodeRank INFRACLASS = new NCBITaxonNodeRank(115, "infraclass"); public static NCBITaxonNodeRank COHORT = new NCBITaxonNodeRank(110, "cohort"); public static NCBITaxonNodeRank SUBCOHORT = new NCBITaxonNodeRank(109, "subcohort"); public static NCBITaxonNodeRank SUPERORDER = new NCBITaxonNodeRank(105, "superorder"); public static NCBITaxonNodeRank ORDER = new NCBITaxonNodeRank(100, "order"); public static NCBITaxonNodeRank SUBORDER = new NCBITaxonNodeRank( 95, "suborder"); public static NCBITaxonNodeRank PARVORDER = new NCBITaxonNodeRank( 90, "parvorder"); public static NCBITaxonNodeRank INFRAORDER = new NCBITaxonNodeRank( 85, "infraorder"); public static NCBITaxonNodeRank SUPERFAMILY = new NCBITaxonNodeRank( 80, "superfamily"); public static NCBITaxonNodeRank FAMILY = new NCBITaxonNodeRank( 75, "family"); public static NCBITaxonNodeRank SUBFAMILY = new NCBITaxonNodeRank( 70, "subfamily"); public static NCBITaxonNodeRank TRIBE = new NCBITaxonNodeRank( 65, "tribe"); public static NCBITaxonNodeRank SUBTRIBE = new NCBITaxonNodeRank( 60, "subtribe"); public static NCBITaxonNodeRank GENUS = new NCBITaxonNodeRank( 55, "genus"); public static NCBITaxonNodeRank SUBGENUS = new NCBITaxonNodeRank( 50, "subgenus"); public static NCBITaxonNodeRank SPECIES_GROUP = new NCBITaxonNodeRank( 45, "species group"); public static NCBITaxonNodeRank SPECIES_SUBGROUP = new NCBITaxonNodeRank( 40, "species subgroup"); public static NCBITaxonNodeRank SPECIES = new NCBITaxonNodeRank( 35, "species"); public static NCBITaxonNodeRank SUBSPECIES = new NCBITaxonNodeRank( 30, "subspecies"); public static NCBITaxonNodeRank STRAIN = new NCBITaxonNodeRank( 25, "strain"); public static NCBITaxonNodeRank VARIETAS = new NCBITaxonNodeRank( 20, "varietas"); public static NCBITaxonNodeRank SUBVARIETY = new NCBITaxonNodeRank( 19, "subvariety"); public static NCBITaxonNodeRank FORMA = new NCBITaxonNodeRank( 15, "forma"); public static NCBITaxonNodeRank FORMA_SPECIALIS = new NCBITaxonNodeRank( 14, "forma specialis"); public static NCBITaxonNodeRank SEROGROUP = new NCBITaxonNodeRank( 10, "serogroup"); public static NCBITaxonNodeRank SEROTYPE = new NCBITaxonNodeRank( 9, "serotype"); public static NCBITaxonNodeRank CLADE = new NCBITaxonNodeRank( 7, "clade"); public static NCBITaxonNodeRank MORPH = new NCBITaxonNodeRank( 6, "morph"); public static NCBITaxonNodeRank BIOTYPE = new NCBITaxonNodeRank( 5, "biotype"); public static NCBITaxonNodeRank GENOTYPE = new NCBITaxonNodeRank( 4, "genotype"); public static NCBITaxonNodeRank ISOLATE = new NCBITaxonNodeRank( 3, "isolate"); public static NCBITaxonNodeRank SECTION = new NCBITaxonNodeRank( 2, "section"); public static NCBITaxonNodeRank SUBSECTION = new NCBITaxonNodeRank( 1, "subsection"); public static NCBITaxonNodeRank SERIES = new NCBITaxonNodeRank( 0, "series"); public static NCBITaxonNodeRank PATHOGROUP = new NCBITaxonNodeRank( 0, "pathogroup"); public static NCBITaxonNodeRank NO_RANK = new NCBITaxonNodeRank( -1, "no rank"); //************************************************************************** // CONSTRUCTORS //************************************************************************** //-------------------------------------------------------------------------- private NCBITaxonNodeRank(int inRank, String inName) { mRank = inRank; mName = inName; if (sUniqueMap.containsKey(mName)) { throw new RuntimeException("A object already exists with the name '" + mName + "'!"); } sUniqueMap.put(mName, this); } //************************************************************************** // PUBLIC METHODS //************************************************************************** //-------------------------------------------------------------------------- public static Collection values() { return sUniqueMap.values(); } //-------------------------------------------------------------------------- public static NCBITaxonNodeRank valueOf(String inValue) { return sUniqueMap.get(inValue); } //-------------------------------------------------------------------------- public int compareTo(NCBITaxonNodeRank inObj) { return inObj != null ? mRank - inObj.mRank : 1; } //-------------------------------------------------------------------------- public String name() { return mName; } //-------------------------------------------------------------------------- /** The same as name(). */ @Override public String toString() { return name(); } //************************************************************************** // PRIVATE METHODS //************************************************************************** //-------------------------------------------------------------------------- /** * This method is called after de-serialization, allowing the object * to nominate a replacement object to be used in the output * graph instead of this object. We don't want multiple objects of each type * to exist in a target VM, so instances replace themselves with * local objects. */ private Object readResolve() { return sUniqueMap.get(mName); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy