/// <summary>
        /// This is the function you implement.
        /// </summary>
        /// <param name="sequenceA">the first sequence</param>
        /// <param name="sequenceB">the second sequence, may have length not equal to the length of the first seq.</param>
        /// <param name="resultTableSoFar">the table of alignment results that has been generated so far using pair-wise alignment</param>
        /// <param name="rowInTable">this particular alignment problem will occupy a cell in this row the result table.</param>
        /// <param name="columnInTable">this particular alignment will occupy a cell in this column of the result table.</param>
        /// <returns>the alignment score for sequenceA and sequenceB.  The calling function places the result in entry rowInTable,columnInTable
        /// of the ResultTable</returns>
        public int Align(GeneSequence sequenceA, GeneSequence sequenceB, ResultTable resultTableSoFar, int rowInTable, int columnInTable)
        {
            if((columnInTable - rowInTable) < 0)
            {
                return 0;
            }

            Grid grid = new Grid(sequenceA.Sequence, sequenceB.Sequence, true, MaxCharactersToAlign);
            return grid.CalculateScoreSolution();
        }
Beispiel #2
0
        private void dataGridViewResults_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            statusMessage.Text = "Calculating Alignment...";
            txtAlignment.Text = "";
            this.Refresh();

            Grid extractionGrid = new Grid(m_sequences[e.RowIndex].Sequence, m_sequences[e.ColumnIndex].Sequence, false, 5000);
            int score = extractionGrid.CalculateExtractionSolution();
            Tuple<string, string> sequences = extractionGrid.ExtractPath();

            string trimmedNewTopSequence = TrimAlignment(sequences.Item1);
            string trimmedNewLeftSequence = TrimAlignment(sequences.Item2);

            StringBuilder builder = new StringBuilder();
            builder.Append(FormatSequence(trimmedNewTopSequence));
            builder.Append(FormatSequence(trimmedNewLeftSequence));
            txtAlignment.Text = builder.ToString();

            statusMessage.Text = "Done.";
        }