commit ec0dcd72f94aaf1d7dbb0f3ee69648ee297af1d5 Author: rav4s Date: Fri Feb 19 18:57:03 2021 -0600 Initial Commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ea8c4bf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..af827ac --- /dev/null +++ b/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" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..07b8a5f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "Rust-DNA-Transcription-Translation" +version = "0.1.0" +authors = ["rav4s "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..2a006f3 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,32 @@ +use std::io; + +fn transcription(dna: String) -> Vec { + let char_vec: Vec = dna.chars().collect(); + let mut transcribed_vec: Vec = 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); +}