⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smithwatermangotohwindowedaffine.java

📁 SimMetrics is a Similarity Metric Library, e.g. from edit distance s (Levenshtein, Gotoh, Jaro etc)
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/**
 * SimMetrics - SimMetrics is a java library of Similarity or Distance
 * Metrics, e.g. Levenshtein Distance, that provide float based similarity
 * measures between String Data. All metrics return consistant measures
 * rather than unbounded similarity scores.
 *
 * Copyright (C) 2005 Sam Chapman - Open Source Release v1.1
 *
 * Please Feel free to contact me about this library, I would appreciate
 * knowing quickly what you wish to use it for and any criticisms/comments
 * upon the SimMetric library.
 *
 * email:       s.chapman@dcs.shef.ac.uk
 * www:         http://www.dcs.shef.ac.uk/~sam/
 * www:         http://www.dcs.shef.ac.uk/~sam/stringmetrics.html
 *
 * address:     Sam Chapman,
 *              Department of Computer Science,
 *              University of Sheffield,
 *              Sheffield,
 *              S. Yorks,
 *              S1 4DP
 *              United Kingdom,
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 *
 * This program 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 General Public License
 * for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

package uk.ac.shef.wit.simmetrics.similaritymetrics;

import uk.ac.shef.wit.simmetrics.similaritymetrics.costfunctions.AbstractAffineGapCost;
import uk.ac.shef.wit.simmetrics.similaritymetrics.costfunctions.AbstractSubstitutionCost;
import uk.ac.shef.wit.simmetrics.similaritymetrics.AbstractStringMetric;
import uk.ac.shef.wit.simmetrics.math.MathFuncs;
import uk.ac.shef.wit.simmetrics.similaritymetrics.costfunctions.AffineGap5_1;
import uk.ac.shef.wit.simmetrics.similaritymetrics.costfunctions.SubCost5_3_Minus3;

import java.io.Serializable;

/**
 * Package: uk.ac.shef.wit.simmetrics.similaritymetrics
 * Description: SmithWatermanGotohWindowedAffine implements the smith waterman with gotoh extension using a windowed affine gap.
 * Date: 23-Apr-2004
 * Time: 14:25:30
 * 
 * @author Sam Chapman <a href="http://www.dcs.shef.ac.uk/~sam/">Website</a>, <a href="mailto:sam@dcs.shef.ac.uk">Email</a>.
 * @version 1.1
 */
public class SmithWatermanGotohWindowedAffine extends AbstractStringMetric implements Serializable {

    /**
     * a constant for calculating the estimated timing cost.
     */
    private final float ESTIMATEDTIMINGCONST = 4.5e-5f;

    /**
     * private field for the maximum affine gap window size.
     */
    private final int windowSize;

    /**
     * the private cost function used in the SmithWatermanGotoh distance.
     */
    private AbstractSubstitutionCost dCostFunc;

    /**
     * the private cost function for affine gaps.
     */
    private AbstractAffineGapCost gGapFunc;

    /**
     * constructor - default (empty).
     */
    public SmithWatermanGotohWindowedAffine() {
        //set the default gap cost func
        gGapFunc = new AffineGap5_1();
        //set the default cost func
        dCostFunc = new SubCost5_3_Minus3();
        //set the default windowSize
        windowSize = 100;
    }

    /**
     * constructor.
     *
     * @param gapCostFunc - the gap cost function
     */
    public SmithWatermanGotohWindowedAffine(final AbstractAffineGapCost gapCostFunc) {
        //set the gap cost func
        gGapFunc = gapCostFunc;
        //set the cost func to a default function
        dCostFunc = new SubCost5_3_Minus3();
        //set the default window size
        windowSize = 100;
    }

    /**
     * constructor.
     *
     * @param gapCostFunc - the cost of a gap
     * @param costFunc    - the cost function to use
     */
    public SmithWatermanGotohWindowedAffine(final AbstractAffineGapCost gapCostFunc, final AbstractSubstitutionCost costFunc) {
        //set the gap cost func
        gGapFunc = gapCostFunc;
        //set the cost func
        dCostFunc = costFunc;
        //set the default window size
        windowSize = 100;
    }

    /**
     * constructor.
     *
     * @param costFunc - the cost function to use
     */
    public SmithWatermanGotohWindowedAffine(final AbstractSubstitutionCost costFunc) {
        //set the gapCost to a default value
        gGapFunc = new AffineGap5_1();
        //set the cost func
        dCostFunc = costFunc;
        //set the default window size
        windowSize = 100;
    }

    /**
     * constructor.
     *
     * @param affineGapWindowSize the size of the affine gap window to use
     */
    public SmithWatermanGotohWindowedAffine(final int affineGapWindowSize) {
        //set the default gap cost func
        gGapFunc = new AffineGap5_1();
        //set the default cost func
        dCostFunc = new SubCost5_3_Minus3();
        //set the default windowSize
        windowSize = affineGapWindowSize;
    }

    /**
     * constructor.
     *
     * @param gapCostFunc - the gap cost function
     * @param affineGapWindowSize the size of the affine gap window to use
     */
    public SmithWatermanGotohWindowedAffine(final AbstractAffineGapCost gapCostFunc, final int affineGapWindowSize) {
        //set the gap cost func
        gGapFunc = gapCostFunc;
        //set the cost func to a default function
        dCostFunc = new SubCost5_3_Minus3();
        //set the default window size
        windowSize = affineGapWindowSize;
    }

    /**
     * constructor.
     *
     * @param gapCostFunc - the cost of a gap
     * @param costFunc    - the cost function to use
     * @param affineGapWindowSize the size of the affine gap window to use
     */
    public SmithWatermanGotohWindowedAffine(final AbstractAffineGapCost gapCostFunc, final AbstractSubstitutionCost costFunc, final int affineGapWindowSize) {
        //set the gap cost func
        gGapFunc = gapCostFunc;
        //set the cost func
        dCostFunc = costFunc;
        //set the default window size
        windowSize = affineGapWindowSize;
    }

    /**
     * constructor.
     *
     * @param costFunc - the cost function to use
     * @param affineGapWindowSize the size of the affine gap window to use
     */
    public SmithWatermanGotohWindowedAffine(final AbstractSubstitutionCost costFunc, final int affineGapWindowSize) {
        //set the gapCost to a default value
        gGapFunc = new AffineGap5_1();
        //set the cost func
        dCostFunc = costFunc;
        //set the default window size
        windowSize = affineGapWindowSize;
    }

    /**
     * get the g gap cost function.
     *
     * @return the gap cost function used
     */
    public final AbstractAffineGapCost getgGapFunc() {
        return gGapFunc;
    }

    /**
     * set the g gap cost function with the one provided.
     *
     * @param gGapFunc - the gap cost function provided
     */
    public final void setgGapFunc(final AbstractAffineGapCost gGapFunc) {
        this.gGapFunc = gGapFunc;
    }

    /**
     * get the d(i,j) cost function.
     *
     * @return AbstractSubstitutionCost cost function used
     */
    public final AbstractSubstitutionCost getdCostFunc() {
        return dCostFunc;
    }

    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -