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.seq.impl; 022 023import org.biojava.bio.seq.Feature; 024import org.biojava.bio.seq.FeatureHolder; 025import org.biojava.bio.seq.Sequence; 026import org.biojava.bio.seq.homol.Homology; 027import org.biojava.bio.seq.homol.HomologyFeature; 028import org.biojava.bio.symbol.IllegalAlphabetException; 029 030/** 031 * @author Matthew Pocock 032 * @author Keith James 033 */ 034public class SimpleHomologyFeature 035 extends SimpleStrandedFeature 036 implements HomologyFeature { 037 private Homology homology; 038 039 public Homology getHomology() { 040 return this.homology; 041 } 042 043 public Feature.Template makeTemplate() { 044 HomologyFeature.Template ft = new HomologyFeature.Template(); 045 fillTemplate(ft); 046 return ft; 047 } 048 049 protected void fillTemplate(HomologyFeature.Template ft) { 050 super.fillTemplate(ft); 051 ft.homology = getHomology(); 052 } 053 054 public SimpleHomologyFeature(Sequence sourceSeq, 055 FeatureHolder parent, 056 HomologyFeature.Template template) 057 throws IllegalArgumentException, IllegalAlphabetException 058 { 059 super(sourceSeq, parent, template); 060 this.homology = template.homology; 061 } 062 063 public String toString() { 064 return super.toString() + " " + getHomology(); 065 } 066}