Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aaron-contreras/hamming-kata
Exercism.io java kata
https://github.com/aaron-contreras/hamming-kata
Last synced: 26 days ago
JSON representation
Exercism.io java kata
- Host: GitHub
- URL: https://github.com/aaron-contreras/hamming-kata
- Owner: aaron-contreras
- Created: 2020-03-05T01:27:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-05T01:27:48.000Z (almost 5 years ago)
- Last Synced: 2024-11-12T03:44:13.481Z (about 2 months ago)
- Language: Java
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Hamming
Calculate the Hamming Distance between two DNA strands.
Your body is made up of cells that contain DNA. Those cells regularly wear out and need replacing, which they achieve by dividing into daughter cells. In fact, the average human body experiences about 10 quadrillion cell divisions in a lifetime!
When cells divide, their DNA replicates too. Sometimes during this process mistakes happen and single pieces of DNA get encoded with the incorrect information. If we compare two strands of DNA and count the differences between them we can see how many mistakes occurred. This is known as the "Hamming Distance".
We read DNA using the letters C,A,G and T. Two strands might look like this:
GAGCCTACTAACGGGAT
CATCGTAATGACGGCCT
^ ^ ^ ^ ^ ^^They have 7 differences, and therefore the Hamming Distance is 7.
The Hamming Distance is useful for lots of things in science, not just biology, so it's a nice phrase to be familiar with :)
# Implementation notes
The Hamming distance is only defined for sequences of equal length, so
an attempt to calculate it between sequences of different lengths should
not work. The general handling of this situation (e.g., raising an
exception vs returning a special value) may differ between languages.# Tips
## Hints
This is the first exercise with tests that require you to throw an
[`Exception`](https://docs.oracle.com/javase/8/docs/api/java/lang/Exception.html). `Exception`s are typically thrown to
indicate that a program has encountered an unexpected input or state.We use JUnit's [`ExpectedException`](http://junit.org/junit4/javadoc/4.12/org/junit/rules/ExpectedException.html)
[rule](https://github.com/junit-team/junit4/wiki/rules) throughout the track to verify that the exceptions you throw
are:1. instances of a specified Java type;
2. (optionally) initialized with a specified message.## Setup
Go through the setup instructions for Java to install the necessary
dependencies:[https://exercism.io/tracks/java/installation](https://exercism.io/tracks/java/installation)
# Running the tests
You can run all the tests for an exercise by entering the following in your
terminal:```sh
$ gradle test
```> Use `gradlew.bat` if you're on Windows
In the test suites all tests but the first have been skipped.
Once you get a test passing, you can enable the next one by removing the
`@Ignore("Remove to run test")` annotation.## Source
The Calculating Point Mutations problem at Rosalind [http://rosalind.info/problems/hamm/](http://rosalind.info/problems/hamm/)
## Submitting Incomplete Solutions
It's possible to submit an incomplete solution so you can see how others have
completed the exercise.