Skip to content

Commit

Permalink
Implement rna-transcription in Dart
Browse files Browse the repository at this point in the history
  • Loading branch information
Sgoettschkes committed Nov 12, 2023
1 parent fb32194 commit 9f039d8
Show file tree
Hide file tree
Showing 7 changed files with 546 additions and 0 deletions.
38 changes: 38 additions & 0 deletions dart/rna-transcription/HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Help

## Running the tests

To run the tests:

```sh
$ dart test
```

## Submitting your solution

You can submit your solution using the `exercism submit lib/rna_transcription.dart` command.
This command will upload your solution to the Exercism website and print the solution page's URL.

It's possible to submit an incomplete solution which allows you to:

- See how others have completed the exercise
- Request help from a mentor

## Need to get help?

If you'd like help solving the exercise, check the following pages:

- The [Dart track's documentation](https://exercism.org/docs/tracks/dart)
- The [Dart track's programming category on the forum](https://forum.exercism.org/c/programming/dart)
- [Exercism's programming category on the forum](https://forum.exercism.org/c/programming/5)
- The [Frequently Asked Questions](https://exercism.org/docs/using/faqs)

Should those resources not suffice, you could submit your (incomplete) solution to request mentoring.

To get help if you're having trouble, you can use one of the following resources:

- [Dart API Documentation](https://api.dart.dev/)
- [Dart Gitter Chat](https://gitter.im/dart-lang/home)
- [Community Information](https://www.dart.dev/community)
- [/r/dartlang](https://www.reddit.com/r/dartlang) is the Dart subreddit.
- [StackOverflow](https://stackoverflow.com/questions/tagged/dart) can be used to search for your problem and see if it has been answered already. You can also ask and answer questions.
57 changes: 57 additions & 0 deletions dart/rna-transcription/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# RNA Transcription

Welcome to RNA Transcription on Exercism's Dart Track.
If you need help running the tests or submitting your code, check out `HELP.md`.

## Introduction

You work for a bioengineering company that specializes in developing therapeutic solutions.

Your team has just been given a new project to develop a targeted therapy for a rare type of cancer.

~~~~exercism/note
It's all very complicated, but the basic idea is that sometimes people's bodies produce too much of a given protein.
That can cause all sorts of havoc.
But if you can create a very specific molecule (called a micro-RNA), it can prevent the protein from being produced.
This technique is called [RNA Interference][rnai].
[rnai]: https://admin.acceleratingscience.com/ask-a-scientist/what-is-rnai/
~~~~

## Instructions

Your task is determine the RNA complement of a given DNA sequence.

Both DNA and RNA strands are a sequence of nucleotides.

The four nucleotides found in DNA are adenine (**A**), cytosine (**C**), guanine (**G**) and thymine (**T**).

The four nucleotides found in RNA are adenine (**A**), cytosine (**C**), guanine (**G**) and uracil (**U**).

Given a DNA strand, its transcribed RNA strand is formed by replacing each nucleotide with its complement:

- `G` -> `C`
- `C` -> `G`
- `T` -> `A`
- `A` -> `U`

~~~~exercism/note
If you want to look at how the inputs and outputs are structured, take a look at the examples in the test suite.
~~~~

## Source

### Created by

- @SuperPaintman

### Contributed to by

- @Stargator
- @kytrinyx

### Based on

Hyperphysics - https://web.archive.org/web/20220408112140/http://hyperphysics.phy-astr.gsu.edu/hbase/Organic/transcription.html
18 changes: 18 additions & 0 deletions dart/rna-transcription/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
analyzer:
strong-mode:
implicit-casts: false
implicit-dynamic: false
errors:
unused_element: error
unused_import: error
unused_local_variable: error
dead_code: error

linter:
rules:
# Error Rules
- avoid_relative_lib_imports
- avoid_types_as_parameter_names
- literal_only_boolean_expressions
- no_adjacent_strings_in_list
- valid_regexps
25 changes: 25 additions & 0 deletions dart/rna-transcription/lib/rna_transcription.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class RnaTranscription {
String toRna(String dna) {
List<String> dnaParts = dna.split('');
List<String> rnaParts = dnaParts.map((d) => transcribe(d)).toList();
return rnaParts.join('');
}

String transcribe(String d) {
switch (d) {
case 'G':
return 'C';
break;
case 'C':
return 'G';
break;
case 'T':
return 'A';
break;
case 'A':
return 'U';
break;
}
return '';
}
}
Loading

0 comments on commit 9f039d8

Please sign in to comment.