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 */ 021 022//package org.biojava.bio.program.hmmer; 023package org.biojava.bio.program.hmmer; 024 025import org.biojava.bio.Annotation; 026import org.biojava.bio.dist.Distribution; 027import org.biojava.bio.dp.EmissionState; 028import org.biojava.bio.dp.IllegalTransitionException; 029import org.biojava.bio.dp.ModelInState; 030import org.biojava.bio.dp.SimpleEmissionState; 031import org.biojava.bio.dp.SimpleMarkovModel; 032import org.biojava.bio.dp.SimpleModelInState; 033import org.biojava.bio.symbol.IllegalAlphabetException; 034import org.biojava.bio.symbol.IllegalSymbolException; 035import org.biojava.utils.ChangeVetoException; 036 037/** 038 * This is a class for representing the full HMMER generated Profile HMM (including loop 039 * states N and C terminal looping states). 040 * 041 * @author Lachlan Coin 042 * @since 1.3 043 */ 044public class FullHmmerProfileHMM extends SimpleMarkovModel{ 045 046 EmissionState j; 047 EmissionState c; 048 EmissionState n; 049 ModelInState hmmState; 050 051 private final static int [] advance = { 1 }; 052 053 FullHmmerProfileHMM( 054 HmmerProfileHMM hmm 055 ) throws IllegalSymbolException, IllegalTransitionException, 056 IllegalAlphabetException, ChangeVetoException { 057 super(1,hmm.emissionAlphabet(),hmm.stateAlphabet().getName()); 058 059 Distribution nullDist = hmm.getInsert(1).getDistribution(); 060 hmmState = new SimpleModelInState(hmm, hmm.stateAlphabet().getName()); 061 062 j = new SimpleEmissionState( 063 "j", 064 Annotation.EMPTY_ANNOTATION, 065 advance, 066 nullDist 067 ); 068 069 070 c = new SimpleEmissionState( 071 "j", 072 Annotation.EMPTY_ANNOTATION, 073 advance, 074 nullDist 075 ); 076 077 078 n = new SimpleEmissionState( 079 "j", 080 Annotation.EMPTY_ANNOTATION, 081 advance, 082 nullDist 083 ); 084 addState(j); 085 addState(c); 086 addState(n); 087 addState(hmmState); 088 089 090 091 092 createTransition(magicalState(), n); 093 createTransition(n, hmmState); 094 createTransition(n, n); 095 createTransition(hmmState,c); 096 createTransition(hmmState,j); 097 createTransition(j,hmmState); 098 createTransition(j,j); 099 createTransition(c,c); 100 createTransition(c,magicalState()); 101 102 } 103 104 /** Gets the J loop state */ 105 public EmissionState jState(){ 106 return j; 107 } 108 109 /** Gets the c loop state */ 110 public EmissionState cState(){ 111 return c; 112 } 113 114 /** Gets the n loop state */ 115 public EmissionState nState(){ 116 return n; 117 } 118 119 /** Gets the inner HmmerProfileHMM state */ 120 public ModelInState hmm(){ 121 return hmmState; 122 } 123 124}