    001    /*
    002     * LocalAlignmentBlock.java
    003     *
    004     * Copyright 2003 Sergio Anibal de Carvalho Junior
    005     *
    006     * This file is part of NeoBio.
    007     *
    008     * NeoBio is free software; you can redistribute it and/or modify it under the terms of
    009     * the GNU General Public License as published by the Free Software Foundation; either
    010     * version 2 of the License, or (at your option) any later version.
    011     *
    012     * NeoBio is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
    013     * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    014     * PURPOSE. See the GNU General Public License for more details.
    015     *
    016     * You should have received a copy of the GNU General Public License along with NeoBio;
    017     * if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
    018     * Boston, MA 02111-1307, USA.
    019     *
    020     * Proper attribution of the author as the source of the software would be appreciated.
    021     *
    022     * Sergio Anibal de Carvalho Junior             mailto:sergioanibaljr@users.sourceforge.net
    023     * Department of Computer Science               http://www.dcs.kcl.ac.uk
    024     * King's College London, UK                    http://www.kcl.ac.uk
    025     *
    026     * Please visit http://neobio.sourceforge.net
    027     *
    028     * This project was supervised by Professor Maxime Crochemore.
    029     *
    030     */
    031
    032    package neobio.alignment;
    033
    034    /**
    035     * This class is used by the {@linkplain CrochemoreLandauZivUkelsonLocalAlignment}
    036     * algorithm to store the information of an alignment block. All fields are public (but
    037     * final) in order to simplify the access to the data.
    038     *
    039     * <P>For more information on how this class is used, please refer to the specification
    040     * of the <CODE>CrochemoreLandauZivUkelsonLocalAlignment</CODE> class.</P>
    041     *
    042     * @author Sergio A. de Carvalho Jr.
    043     * @see CrochemoreLandauZivUkelsonLocalAlignment
    044     */
    045    public class LocalAlignmentBlock extends AlignmentBlock
    046    {
    047            /**
    048             * The value of the highest scoring path which starts at the input border of this
    049             * block and ends inside it, called E-path.
    050             */
    051            public int[] E_path_score;
    052
    053            /**
    054             * An array of pointers to blocks that are source of E-paths.
    055             */
    056            public LocalAlignmentBlock[] E_path_ancestor;
    057
    058            /**
    059             * Indexes of of the entry in the ancestor block that is the source of the E-path.
    060             */
    061            public int[] E_path_ancestor_index;
    062
    063            /**
    064             * The value of the highest scoring path which starts inside the block and ends at its
    065             * output border.
    066             */
    067            public int[] S_path_score;
    068
    069            /**
    070             * The type of the highest scoring path ending at a given position of the output
    071             * border of a block.
    072             */
    073            public byte[] path_type;
    074
    075            /**
    076             * The direction to the source of the S-path of the new vertex of this block.
    077             */
    078            public byte S_direction;
    079
    080            /**
    081             * The value of the highest scoring path contained in this block, called C-path.
    082             */
    083            public int C;
    084
    085            /**
    086             * Creates a new root block.
    087             *
    088             * @param factor1 factor of the first sequence being aligned
    089             * @param factor2 factor of the second sequence being aligned
    090             */
    091            LocalAlignmentBlock (Factor factor1, Factor factor2)
    092            {
    093                    super (factor1, factor2);
    094
    095                    E_path_score = S_path_score = new int[] {0};
    096                    E_path_ancestor = new LocalAlignmentBlock [] {this};
    097                    E_path_ancestor_index = new int [] {0};
    098            }
    099
    100            /**
    101             * Creates a new alignment block, with all arrays created with the specified size.
    102             *
    103             * @param factor1 factor of the first sequence being aligned
    104             * @param factor2 factor of the second sequence being aligned
    105             * @param size size of the arrays to be created
    106             */
    107            LocalAlignmentBlock (Factor factor1, Factor factor2, int size)
    108            {
    109                    super (factor1, factor2, size);
    110
    111                    E_path_score = new int [size];
    112                    E_path_ancestor = new LocalAlignmentBlock [size];
    113                    E_path_ancestor_index = new int [size];
    114                    S_path_score = new int [size];
    115                    path_type = new byte [size];
    116            }
    117    }