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

com.hfg.bio.seq.format.EMBL_DataClass Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.bio.seq.format;

import com.hfg.util.StringUtil;

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


//------------------------------------------------------------------------------
/**
 * Enumerated list of EMBL data class.
 * 
* Based on ftp://ftp.ebi.ac.uk/pub/databases/embl/doc/usrman.txt *
* @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 EMBL_DataClass implements Serializable { //************************************************************************** // PRIVATE FIELDS //************************************************************************** private String mName; private String mCode; private static Map sUniqueCodeMap = new HashMap<>(20); //************************************************************************** // PUBLIC FIELDS //************************************************************************** /** Constructed CON */ public static EMBL_DataClass CONSTRUCTED = new EMBL_DataClass("Constructed", "CON"); /** Patent PAT */ public static EMBL_DataClass PATENT = new EMBL_DataClass("Patent", "PAT"); /** Expressed Sequence Tag EST */ public static EMBL_DataClass EST = new EMBL_DataClass("Expressed Sequence Tag", "EST"); /** Genome Survey Sequence GSS */ public static EMBL_DataClass GSS = new EMBL_DataClass("Genome Survey Sequence", "GSS"); /** High Throughput cDNA sequencing HTC */ public static EMBL_DataClass HTC = new EMBL_DataClass("High Throughput cDNA sequencing", "HTC"); /** High Throughput Genome sequencing HTC */ public static EMBL_DataClass HTG = new EMBL_DataClass("High Throughput Genome sequencing", "HTG"); /** Mass Genome Annotation MGA */ public static EMBL_DataClass MGA = new EMBL_DataClass("Mass Genome Annotation", "MGA"); /** Whole Genome Shotgun WGS */ public static EMBL_DataClass WGS = new EMBL_DataClass("Whole Genome Shotgun", "WGS"); /** Transcriptome Shotgun Assembly TSA*/ public static EMBL_DataClass TSA = new EMBL_DataClass("Transcriptome Shotgun Assembly", "TSA"); /** Sequence Tagged Site */ public static EMBL_DataClass STS = new EMBL_DataClass("Sequence Tagged Site", "STS"); /** Standard STD */ public static EMBL_DataClass STANDARD = new EMBL_DataClass("Standard", "STD"); //************************************************************************** // CONSTRUCTORS //************************************************************************** //-------------------------------------------------------------------------- private EMBL_DataClass(String inName, String inCode) { mName = inName; mCode = inCode; if (sUniqueCodeMap.containsKey(mCode)) { throw new RuntimeException("A object already exists with the code '" + mCode + "'!"); } sUniqueCodeMap.put(mCode, this); } //************************************************************************** // PUBLIC METHODS //************************************************************************** //-------------------------------------------------------------------------- public static Collection values() { return sUniqueCodeMap.values(); } //-------------------------------------------------------------------------- /** Returns the corresponding EMBL_DataClass by comparing the value to the name and code values of the enumerated set. @param inValue the name or code of the EMBL data class to retrieve @return EMBL_DataClass object corresponding to the specified value */ public static EMBL_DataClass valueOf(String inValue) { EMBL_DataClass value = null; if (StringUtil.isSet(inValue)) { for (EMBL_DataClass dataClass : sUniqueCodeMap.values()) { if (dataClass.name().equalsIgnoreCase(inValue) || dataClass.getCode().equalsIgnoreCase(inValue)) { value = dataClass; break; } } } return value; } //-------------------------------------------------------------------------- public String name() { return mName; } //-------------------------------------------------------------------------- /** The same as name(). */ @Override public String toString() { return name(); } //-------------------------------------------------------------------------- /** Returns the 3-letter EMBL data class code. @return the 3-letter EMBL data class code */ public String getCode() { return mCode; } //************************************************************************** // 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 sUniqueCodeMap.get(mCode + ""); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy