aboutsummaryrefslogtreecommitdiff
path: root/rust/nucleotide-count/README.md
diff options
context:
space:
mode:
authorFederico Igne <git@federicoigne.com>2020-12-26 17:48:38 +0000
committerFederico Igne <git@federicoigne.com>2021-11-03 18:55:08 +0000
commit02481656966b0a8dfc95cf3c22bcc049660ff7d4 (patch)
tree8e39798fcaf27931d91c2088423fd4e97adcfc2d /rust/nucleotide-count/README.md
parent4e2052c4d792540c2f742b2c2a081b11117ed41d (diff)
downloadexercism-02481656966b0a8dfc95cf3c22bcc049660ff7d4.tar.gz
exercism-02481656966b0a8dfc95cf3c22bcc049660ff7d4.zip
Move Rust exercises in a subdirectory
Diffstat (limited to 'rust/nucleotide-count/README.md')
-rw-r--r--rust/nucleotide-count/README.md110
1 files changed, 110 insertions, 0 deletions
diff --git a/rust/nucleotide-count/README.md b/rust/nucleotide-count/README.md
new file mode 100644
index 0000000..9a85942
--- /dev/null
+++ b/rust/nucleotide-count/README.md
@@ -0,0 +1,110 @@
1# Nucleotide Count
2
3Each of us inherits from our biological parents a set of chemical
4instructions known as DNA that influence how our bodies are constructed.
5All known life depends on DNA!
6
7> Note: You do not need to understand anything about nucleotides or DNA
8> to complete this exercise.
9
10DNA is a long chain of other chemicals and the most important are the
11four nucleotides, adenine, cytosine, guanine and thymine. A single DNA
12chain can contain billions of these four nucleotides and the order in
13which they occur is important! We call the order of these nucleotides in
14a bit of DNA a "DNA sequence".
15
16We represent a DNA sequence as an ordered collection of these four
17nucleotides and a common way to do that is with a string of characters
18such as "ATTACG" for a DNA sequence of 6 nucleotides. 'A' for adenine,
19'C' for cytosine, 'G' for guanine, and 'T' for thymine.
20
21Given a string representing a DNA sequence, count how many of each
22nucleotide is present. If the string contains characters that aren't A,
23C, G, or T then it is invalid and you should signal an error.
24
25For example:
26
27```
28"GATTACA" -> 'A': 3, 'C': 1, 'G': 1, 'T': 2
29"INVALID" -> error
30```
31
32## Rust Installation
33
34Refer to the [exercism help page][help-page] for Rust installation and learning
35resources.
36
37## Writing the Code
38
39Execute the tests with:
40
41```bash
42$ cargo test
43```
44
45All but the first test have been ignored. After you get the first test to
46pass, open the tests source file which is located in the `tests` directory
47and remove the `#[ignore]` flag from the next test and get the tests to pass
48again. Each separate test is a function with `#[test]` flag above it.
49Continue, until you pass every test.
50
51If you wish to run all ignored tests without editing the tests source file, use:
52
53```bash
54$ cargo test -- --ignored
55```
56
57To run a specific test, for example `some_test`, you can use:
58
59```bash
60$ cargo test some_test
61```
62
63If the specific test is ignored use:
64
65```bash
66$ cargo test some_test -- --ignored
67```
68
69To learn more about Rust tests refer to the [online test documentation][rust-tests]
70
71Make sure to read the [Modules][modules] chapter if you
72haven't already, it will help you with organizing your files.
73
74## Further improvements
75
76After you have solved the exercise, please consider using the additional utilities, described in the [installation guide](https://exercism.io/tracks/rust/installation), to further refine your final solution.
77
78To format your solution, inside the solution directory use
79
80```bash
81cargo fmt
82```
83
84To see, if your solution contains some common ineffective use cases, inside the solution directory use
85
86```bash
87cargo clippy --all-targets
88```
89
90## Submitting the solution
91
92Generally you should submit all files in which you implemented your solution (`src/lib.rs` in most cases). If you are using any external crates, please consider submitting the `Cargo.toml` file. This will make the review process faster and clearer.
93
94## Feedback, Issues, Pull Requests
95
96The [exercism/rust](https://github.com/exercism/rust) repository on GitHub is the home for all of the Rust exercises. If you have feedback about an exercise, or want to help implement new exercises, head over there and create an issue. Members of the rust track team are happy to help!
97
98If you want to know more about Exercism, take a look at the [contribution guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/README.md).
99
100[help-page]: https://exercism.io/tracks/rust/learning
101[modules]: https://doc.rust-lang.org/book/ch07-02-defining-modules-to-control-scope-and-privacy.html
102[cargo]: https://doc.rust-lang.org/book/ch14-00-more-about-cargo.html
103[rust-tests]: https://doc.rust-lang.org/book/ch11-02-running-tests.html
104
105## Source
106
107The Calculating DNA Nucleotides_problem at Rosalind [http://rosalind.info/problems/dna/](http://rosalind.info/problems/dna/)
108
109## Submitting Incomplete Solutions
110It's possible to submit an incomplete solution so you can see how others have completed the exercise.