Example #1
0
        /// <summary>
        /// Generate a symmetric distance matrix from a set of aligned sequences.
        /// </summary>
        /// <param name="sequences">a set of aligned sequences</param>
        public void GenerateDistanceMatrix(IList <ISequence> sequences)
        {
            if (sequences.Count <= 0)
            {
                throw new ArgumentException("empty sequence dataset");
            }

            // Construct a symmetric distance matrix
            _distanceMatrix = new SymmetricDistanceMatrix(sequences.Count);

            // Fill in values
            Parallel.For(1, sequences.Count, PAMSAMMultipleSequenceAligner.parallelOption, row =>
            {
                for (int col = 0; col < row; ++col)
                {
                    float distanceScore       = KimuraDistanceScoreCalculator.CalculateDistanceScore(sequences[row], sequences[col]);
                    _distanceMatrix[row, col] = distanceScore;
                    _distanceMatrix[col, row] = distanceScore;
                }
            });
        }
Example #2
0
 /// <summary>
 /// Construct DistanceMatrix via Kimura method.
 /// The two functions are defined in KimuraDistanceScoreCalculator class.
 /// </summary>
 public KimuraDistanceMatrixGenerator()
 {
     _kimuraDistanceScoreCalculator = new KimuraDistanceScoreCalculator();
 }