You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/rosalind/06-hamming.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,8 @@
1
1
# Counting Point Mutations
2
2
3
3
!!! warning "The Problem"
4
-
Problem
5
4
6
-
Given two strings s and t of equal length, the Hamming distance between s
7
-
and t, denoted dH(s,t), is the number of corresponding symbols that differ in s and t.
5
+
Given two strings s and t of equal length, the Hamming distance between s and t, denoted dH(s,t), is the number of corresponding symbols that differ in s and t.
8
6
9
7
Given: Two DNA strings s and t of equal length (not exceeding 1 kbp).
10
8
@@ -18,12 +16,13 @@
18
16
```
19
17
20
18
***Sample Output***
19
+
21
20
```
22
21
7
23
22
```
24
23
25
24
26
-
To calculate the Hamming Distance between two strings/sequences, the two strings/DNA sequences must be the same length. Therefore, we can calculate the Hamming Distance by looping over one of the strings and checking if the corresponding character in the other string matches. Each mismatch will cause 1 to be added to a `counter` variable. At the end of the loop, we can return the total value of the `counter` variable.
25
+
To calculate the Hamming Distance between two strings/sequences, the two strings/DNA sequences must be the same length. We can calculate the Hamming Distance by looping over the characters in one of the strings and checking if the corresponding character at the same index in the other string matches. Each mismatch will cause 1 to be added to a `counter` variable. At the end of the loop, we can return the total value of the `counter` variable.
27
26
28
27
Let's give this a try!
29
28
@@ -41,7 +40,6 @@ function calcHamming(SeqA, SeqB)
41
40
42
41
mismatches =0
43
42
for i in1:SeqLength
44
-
# print(i)
45
43
if SeqA[i] != SeqB[i]
46
44
mismatches +=1
47
45
end
@@ -77,11 +75,11 @@ BioAlignmentsHamming[1]
77
75
```
78
76
79
77
80
-
The BioAlignments `hamming_distance` function requires three input variables -- the first of which allows the user to control the `type` of the returned hamming distance value. In the above example, `Int64` is provided as the input variable, but `Float64` or `UInt8` are also acceptable inputs.
78
+
The BioAlignments `hamming_distance` function requires three input variables -- the first of which allows the user to control the `type` of the returned hamming distance value. In the above example, `Int64` is provided as the input variable, but `Float64` or `Int8` are also acceptable inputs.
81
79
82
80
The second two input variables are the two sequences that are being compared.
83
81
84
-
There are two outputs of this function: the actual Hamming Distance value and the Alignment Anchor. The Alignment Anchor is a a one-dimensional array (vector) that is the same length as the length of the input strings. Each value in the vector is a also an AlignmentAnchor with three fields: sequence position, reference position, and an operation code ('0' for start, '=' for match, 'X' for mismatch).
82
+
There are two outputs of this function: the actual Hamming Distance value and the Alignment Anchor. The Alignment Anchor is a a one-dimensional array (vector) that is the same length as the length of the input strings. Each value in the vector is also an AlignmentAnchor with three fields: sequence position, reference position, and an operation code ('0' for start, '=' for match, 'X' for mismatch).
0 commit comments