/// <summary>
        /// Solves the HAMM problem (http://rosalind.info/problems/hamm/).
        /// </summary>
        private static void SolveHamm()
        {
            var lines     = File.ReadAllLines(@"Data\HAMM\rosalind_hamm.txt");
            var firstDna  = new Dna(lines[0].Trim());
            var secondDna = new Dna(lines[1].Trim());

            var hammingDistance = firstDna.HammingDistance(secondDna);

            SaveResult(@"Results\rosalind_hamm_results.txt", hammingDistance.ToString(CultureInfo.InvariantCulture));
        }
예제 #2
0
        public void HammingDistanceTest()
        {
            // Arrange
            var       dna                   = new Dna("GAGCCTACTAACGGGAT");
            var       mutatedDna            = new Dna("CATCGTAATGACGGCCT");
            const int expectedMutationCount = 7;

            // Act
            var mutationCount = dna.HammingDistance(mutatedDna);

            // Assert
            Assert.That(expectedMutationCount, Is.EqualTo(mutationCount));
        }