Skip to content

Commit 9c259eb

Browse files
Add rna-transcription exercise (#5)
1 parent a4e20ee commit 9c259eb

File tree

16 files changed

+451
-10
lines changed

16 files changed

+451
-10
lines changed

config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
"prerequisites": [],
3939
"difficulty": 2
4040
},
41+
{
42+
"slug": "rna-transcription",
43+
"name": "RNA Transcription",
44+
"uuid": "a070940a-1e7b-4e41-898c-b5381ba63bde",
45+
"practices": [],
46+
"prerequisites": [],
47+
"difficulty": 1
48+
},
4149
{
4250
"slug": "hello-world",
4351
"name": "Hello World",

exercises/practice/darts/lake-manifest.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

exercises/practice/hello-world/lake-manifest.json

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Instructions
2+
3+
Your task is to determine the RNA complement of a given DNA sequence.
4+
5+
Both DNA and RNA strands are a sequence of nucleotides.
6+
7+
The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**), and thymine (**T**).
8+
9+
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**), and uracil (**U**).
10+
11+
Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:
12+
13+
- `G` -> `C`
14+
- `C` -> `G`
15+
- `T` -> `A`
16+
- `A` -> `U`
17+
18+
~~~~exercism/note
19+
If you want to look at how the inputs and outputs are structured, take a look at the examples in the test suite.
20+
~~~~
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Introduction
2+
3+
You work for a bioengineering company that specializes in developing therapeutic solutions.
4+
5+
Your team has just been given a new project to develop a targeted therapy for a rare type of cancer.
6+
7+
~~~~exercism/note
8+
It's all very complicated, but the basic idea is that sometimes people's bodies produce too much of a given protein.
9+
That can cause all sorts of havoc.
10+
11+
But if you can create a very specific molecule (called a micro-RNA), it can prevent the protein from being produced.
12+
13+
This technique is called [RNA Interference][rnai].
14+
15+
[rnai]: https://admin.acceleratingscience.com/ask-a-scientist/what-is-rnai/
16+
~~~~
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace RnaTranscription
2+
3+
def complement (nucleotide : Char) : Char :=
4+
match nucleotide with
5+
| 'G' => 'C'
6+
| 'C' => 'G'
7+
| 'T' => 'A'
8+
| 'A' => 'U'
9+
| _ => nucleotide
10+
11+
def toRna (dna : String) : String :=
12+
String.map complement dna
13+
14+
end RnaTranscription
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"authors": [
3+
"keiravillekode"
4+
],
5+
"files": {
6+
"solution": [
7+
"RnaTranscription.lean"
8+
],
9+
"test": [
10+
"RnaTranscriptionTest.lean"
11+
],
12+
"example": [
13+
".meta/Example.lean"
14+
]
15+
},
16+
"blurb": "Given a DNA strand, return its RNA complement.",
17+
"source": "Hyperphysics",
18+
"source_url": "https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html"
19+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[b4631f82-c98c-4a2f-90b3-c5c2b6c6f661]
13+
description = "Empty RNA sequence"
14+
15+
[a9558a3c-318c-4240-9256-5d5ed47005a6]
16+
description = "RNA complement of cytosine is guanine"
17+
18+
[6eedbb5c-12cb-4c8b-9f51-f8320b4dc2e7]
19+
description = "RNA complement of guanine is cytosine"
20+
21+
[870bd3ec-8487-471d-8d9a-a25046488d3e]
22+
description = "RNA complement of thymine is adenine"
23+
24+
[aade8964-02e1-4073-872f-42d3ffd74c5f]
25+
description = "RNA complement of adenine is uracil"
26+
27+
[79ed2757-f018-4f47-a1d7-34a559392dbf]
28+
description = "RNA complement"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
namespace RnaTranscription
2+
3+
def toRna (dna : String) : String :=
4+
sorry
5+
6+
end RnaTranscription
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import LeanTest
2+
import RnaTranscription
3+
4+
open LeanTest
5+
6+
def rnaTranscriptionTests : TestSuite :=
7+
(TestSuite.empty "RnaTranscription")
8+
|>.addTest "Empty RNA sequence" (do
9+
return assertEqual "" (RnaTranscription.toRna ""))
10+
|>.addTest "RNA complement of cytosine is guanine" (do
11+
return assertEqual "G" (RnaTranscription.toRna "C"))
12+
|>.addTest "RNA complement of guanine is cytosine" (do
13+
return assertEqual "C" (RnaTranscription.toRna "G"))
14+
|>.addTest "RNA complement of thymine is adenine" (do
15+
return assertEqual "A" (RnaTranscription.toRna "T"))
16+
|>.addTest "RNA complement of adenine is uracil" (do
17+
return assertEqual "U" (RnaTranscription.toRna "A"))
18+
|>.addTest "RNA complement" (do
19+
return assertEqual "UGCACCAGAAUU" (RnaTranscription.toRna "ACGTGGTCTTAA"))
20+
21+
def main : IO UInt32 := do
22+
runTestSuitesWithExitCode [rnaTranscriptionTests]

0 commit comments

Comments
 (0)