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 * Created on June 7, 2010
021 * Author: Mark Chapman
022 */
023
024package org.biojava.nbio.alignment.template;
025
026/**
027 * Defines a data structure for the gap penalties used during a sequence alignment routine.
028 *
029 * @author Mark Chapman
030 */
031public interface GapPenalty {
032
033        /**
034         * Defines the possible types of gap penalties.  This is:
035         * <ul>
036         *  <li>CONSTANT, if static and the extension penalty is 0
037         *  <li>LINEAR, if static and the open penalty is 0
038         *  <li>AFFINE, if static but neither CONSTANT nor LINEAR
039         *  <li>DYNAMIC, if penalty values change during alignment
040         * </ul>
041         */
042        enum Type {CONSTANT, LINEAR, AFFINE, DYNAMIC};
043
044        /**
045         * Returns penalty given when an already open gap elongates by a single element
046         *
047         * @return gap extension penalty
048         */
049        int getExtensionPenalty();
050
051        /**
052         * Returns penalty given when a deletion or insertion gap first opens
053         *
054         * @return gap open penalty
055         */
056        int getOpenPenalty();
057
058        /**
059         * Returns {@link GapPenalty.Type} stored.
060         *
061         * @return gap penalty type
062         */
063        Type getType();
064
065        /**
066         * Sets penalty given when an already open gap elongates by a single element
067         *
068         * @param gep gap extension penalty
069         */
070        void setExtensionPenalty(int gep);
071
072        /**
073         * Sets penalty given when a deletion or insertion gap first opens
074         *
075         * @param gop gap open penalty
076         */
077        void setOpenPenalty(int gop);
078
079}