Browse Source

Initial Commit

main
Ravi Shah 5 years ago
commit
ec0dcd72f9
  1. 1
      .gitignore
  2. 5
      Cargo.lock
  3. 9
      Cargo.toml
  4. 32
      src/main.rs

1
.gitignore

@ -0,0 +1 @@
/target

5
Cargo.lock

@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "Rust-DNA-Transcription-Translation"
version = "0.1.0"

9
Cargo.toml

@ -0,0 +1,9 @@
[package]
name = "Rust-DNA-Transcription-Translation"
version = "0.1.0"
authors = ["rav4s <ravidhruvishshah@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

32
src/main.rs

@ -0,0 +1,32 @@
use std::io;
fn transcription(dna: String) -> Vec<char> {
let char_vec: Vec<char> = dna.chars().collect();
let mut transcribed_vec: Vec<char> = Vec::new();
for i in char_vec {
match i {
'A' => transcribed_vec.push('U'),
'T' => transcribed_vec.push('A'),
'C' => transcribed_vec.push('G'),
'G' => transcribed_vec.push('C'),
_ => println!("{}", i) //just print wrong for now
}
}
return transcribed_vec;
}
fn main() {
println!("Enter the DNA strand to be transcribed and translated: ");
let mut strand = String::new();
io::stdin()
.read_line(&mut strand)
.expect("Failed to read line");
strand = strand.to_uppercase();
let messenger_rna = transcription(strand);
}
Loading…
Cancel
Save