001/* 002 * BioJava development code 003 * 004 * This code may be freely distributed and modified under the 005 * terms of the GNU Lesser General Public Licence. This should 006 * be distributed with the code. If you do not have a copy, 007 * see: 008 * 009 * http://www.gnu.org/copyleft/lesser.html 010 * 011 * Copyright for this code is held jointly by the individual 012 * authors. These should be listed in @author doc comments. 013 * 014 * For more information on the BioJava project and its aims, 015 * or to join the biojava-l mailing list, visit the home page 016 * at: 017 * 018 * http://www.biojava.org/ 019 * 020 */ 021package org.biojava.bio.proteomics; 022 023import org.biojava.bio.BioError; 024import org.biojava.bio.seq.io.SymbolTokenization; 025import org.biojava.bio.symbol.AlphabetManager; 026import org.biojava.bio.symbol.AtomicSymbol; 027import org.biojava.bio.symbol.FiniteAlphabet; 028 029/** 030 * Simple access to protein seccondary structure assignments. 031 * 032 * @author Matthew Pocock 033 */ 034public final class StructureTools { 035 private static final FiniteAlphabet struct; 036 037 private static final AtomicSymbol space; 038 private static final AtomicSymbol c; 039 private static final AtomicSymbol h; 040 private static final AtomicSymbol g; 041 private static final AtomicSymbol i; 042 private static final AtomicSymbol e; 043 private static final AtomicSymbol b; 044 private static final AtomicSymbol t; 045 private static final AtomicSymbol s; 046 047 static { 048 try { 049 struct = (FiniteAlphabet) AlphabetManager.alphabetForName("STRUCTURE"); 050 051 SymbolTokenization sTok = struct.getTokenization("token"); 052 053 space = (AtomicSymbol) sTok.parseToken(" "); 054 c = (AtomicSymbol) sTok.parseToken("c"); 055 h = (AtomicSymbol) sTok.parseToken("h"); 056 g = (AtomicSymbol) sTok.parseToken("g"); 057 i = (AtomicSymbol) sTok.parseToken("i"); 058 e = (AtomicSymbol) sTok.parseToken("e"); 059 b = (AtomicSymbol) sTok.parseToken("b"); 060 t = (AtomicSymbol) sTok.parseToken("t"); 061 s = (AtomicSymbol) sTok.parseToken("s"); 062 } catch (Throwable t) { 063 throw new BioError("Could not initialise structure alphabet", t); 064 } 065 } 066 067 public FiniteAlphabet getStructure() { 068 return struct; 069 } 070 071 public AtomicSymbol get_() { 072 return space; 073 } 074 075 public AtomicSymbol getC() { 076 return c; 077 } 078 079 public AtomicSymbol getH() { 080 return h; 081 } 082 083 public AtomicSymbol getG() { 084 return g; 085 } 086 087 public AtomicSymbol getI() { 088 return i; 089 } 090 091 public AtomicSymbol getE() { 092 return e; 093 } 094 095 public AtomicSymbol getB() { 096 return b; 097 } 098 099 public AtomicSymbol getT() { 100 return t; 101 } 102 103 public AtomicSymbol getS() { 104 return s; 105 } 106}