Skip to content

Commit 3a35cc2

Browse files
add distances.jl solution
1 parent 5fa4fc0 commit 3a35cc2

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

docs/src/rosalind/06-hamm.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,23 @@ bio_hamming[1]
115115
The Alignment Anchor for the above example is:
116116
```
117117
AlignmentAnchor[AlignmentAnchor(0, 0, '0'), AlignmentAnchor(1, 1, 'X'), AlignmentAnchor(2, 2, '='), AlignmentAnchor(3, 3, 'X'), AlignmentAnchor(4, 4, '='), AlignmentAnchor(5, 5, 'X'), AlignmentAnchor(7, 7, '='), AlignmentAnchor(8, 8, 'X'), AlignmentAnchor(9, 9, '='), AlignmentAnchor(10, 10, 'X'), AlignmentAnchor(14, 14, '='), AlignmentAnchor(16, 16, 'X'), AlignmentAnchor(17, 17, '=')]
118-
119118
```
120119

120+
### Distances.Jl method
121+
122+
Another package that calculates the Hamming distance is the [Distances package](https://github.com/JuliaStats/Distances.jl). We can call its `hamming` function on our two test sequences:
123+
124+
125+
126+
```julia
127+
using Distances
128+
129+
ex_seq_a = "GAGCCTACTAACGGGAT"
130+
ex_seq_b = "CATCGTAATGACGGCCT"
131+
132+
Distances.hamming(ex_seq_a, ex_seq_b)
133+
```
134+
135+
136+
121137

0 commit comments

Comments
 (0)