Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3f1de98

Browse files
author
programmiri
committed
Add excercise and solution for RNA Transcription
1 parent d4d14b6 commit 3f1de98

File tree

7 files changed

+4383
-0
lines changed

7 files changed

+4383
-0
lines changed

‎rna-transcription/.eslintrc‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"root": true,
3+
"parser": "babel-eslint",
4+
"parserOptions": {
5+
"ecmaVersion": 7,
6+
"sourceType": "module"
7+
},
8+
"env": {
9+
"es6": true,
10+
"node": true,
11+
"jest": true
12+
},
13+
"extends": [
14+
"eslint:recommended",
15+
"plugin:import/errors",
16+
"plugin:import/warnings"
17+
],
18+
"rules": {
19+
"linebreak-style": "off",
20+
21+
"import/extensions": "off",
22+
"import/no-default-export": "off",
23+
"import/no-unresolved": "off",
24+
"import/prefer-default-export": "off"
25+
}
26+
}

‎rna-transcription/README.md‎

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# RNA Transcription
2+
3+
Given a DNA strand, return its RNA complement (per RNA transcription).
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**),
8+
guanine (**G**) and thymine (**T**).
9+
10+
The four nucleotides found in RNA are adenine (**A**), cytosine (**C**),
11+
guanine (**G**) and uracil (**U**).
12+
13+
Given a DNA strand, its transcribed RNA strand is formed by replacing
14+
each nucleotide with its complement:
15+
16+
* `G` -> `C`
17+
* `C` -> `G`
18+
* `T` -> `A`
19+
* `A` -> `U`
20+
21+
## Setup
22+
23+
Go through the setup instructions for Javascript to install the necessary
24+
dependencies:
25+
26+
[https://exercism.io/tracks/javascript/installation](https://exercism.io/tracks/javascript/installation)
27+
28+
## Requirements
29+
30+
Install assignment dependencies:
31+
32+
```bash
33+
$ npm install
34+
```
35+
36+
## Making the test suite pass
37+
38+
Execute the tests with:
39+
40+
```bash
41+
$ npm test
42+
```
43+
44+
In the test suites all tests but the first have been skipped.
45+
46+
Once you get a test passing, you can enable the next one by changing `xtest` to
47+
`test`.
48+
49+
## Source
50+
51+
Hyperphysics [http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html](http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html)
52+
53+
## Submitting Incomplete Solutions
54+
55+
It's possible to submit an incomplete solution so you can see how others have
56+
completed the exercise.

‎rna-transcription/babel.config.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
useBuiltIns: false,
10+
},
11+
12+
],
13+
],
14+
};

‎rna-transcription/package.json‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"name": "exercism-javascript",
3+
"version": "0.0.0",
4+
"description": "Exercism exercises in Javascript.",
5+
"author": "Katrina Owen",
6+
"private": true,
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/exercism/javascript"
10+
},
11+
"devDependencies": {
12+
"@babel/cli": "^7.2.3",
13+
"@babel/core": "^7.4.0",
14+
"@babel/preset-env": "^7.4.2",
15+
"@types/jest": "^24.0.13",
16+
"@types/node": "^12.0.4",
17+
"babel-eslint": "^10.0.1",
18+
"babel-jest": "^24.5.0",
19+
"eslint": "^5.15.3",
20+
"eslint-plugin-import": "^2.16.0",
21+
"jest": "^24.5.0"
22+
},
23+
"jest": {
24+
"modulePathIgnorePatterns": [
25+
"package.json"
26+
]
27+
},
28+
"scripts": {
29+
"test": "jest --no-cache ./*",
30+
"watch": "jest --no-cache --watch ./*",
31+
"lint": "eslint .",
32+
"lint-test": "eslint . && jest --no-cache ./* "
33+
},
34+
"license": "MIT",
35+
"dependencies": {}
36+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//
2+
// This is only a SKELETON file for the 'RNA Transcription' exercise. It's been provided as a
3+
// convenience to get you started writing code faster.
4+
//
5+
6+
const translationMap = {
7+
G: 'C',
8+
C: 'G',
9+
T: 'A',
10+
A: 'U',
11+
};
12+
13+
export const toRna = (string) => {
14+
return string
15+
.split('')
16+
.map((char) => translationMap[char] || char)
17+
.join('');
18+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import { toRna } from './rna-transcription';
2+
3+
describe('Transcription', () => {
4+
test('empty rna sequence', () => {
5+
expect(toRna('')).toEqual('');
6+
});
7+
8+
test('transcribes cytosine to guanine', () => {
9+
expect(toRna('C')).toEqual('G');
10+
});
11+
12+
test('transcribes guanine to cytosine', () => {
13+
expect(toRna('G')).toEqual('C');
14+
});
15+
16+
test('transcribes thymine to adenine', () => {
17+
expect(toRna('T')).toEqual('A');
18+
});
19+
20+
test('transcribes adenine to uracil', () => {
21+
expect(toRna('A')).toEqual('U');
22+
});
23+
24+
test('transcribes all dna nucleotides to their rna complements', () => {
25+
expect(toRna('ACGTGGTCTTAA')).toEqual('UGCACCAGAAUU');
26+
});
27+
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /