protein_maker 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04fa58016b0d2f0dca901e981ebbc467b0f82ccbb43cfdf18e407b448025394f
4
+ data.tar.gz: c3c353cc045dc83fbf20e42696ebaa2fdbfa7e1dee373ec2483338f4819d7e53
5
+ SHA512:
6
+ metadata.gz: 25e0cd65ee59f309191aad242aad39d251d46dbe94d25856923b7591ea03c9600225ea4f7b025a5ae867b03aefb80e17b1d6351088faa772035a5680d6245f14
7
+ data.tar.gz: 63d49691788a56b28e88001cca97f48ef24445654481fa4b8826b74bc4b370782f3e1302f77d01cca812e4b7529bf3d51ac27379495c4cad7091fa4b2a096abe
data/lib/dna_worker.rb ADDED
@@ -0,0 +1,37 @@
1
+ require 'genetic_constants'
2
+
3
+ module DnaWorker
4
+ def self.print_complementary_base_pairing(sequence)
5
+ sequence = sequence.map(&:to_sym)
6
+
7
+ mRNA_sequence = sequence.map { |base| GeneticConstants.nitrogenous_base_pairs[base] }
8
+
9
+ mRNA_sequence
10
+ end
11
+
12
+
13
+ def self.initiate_translation(codon_collection)
14
+
15
+ puts "intiating translation of mRNA sequence"
16
+ puts ""
17
+ puts "resulting amino acid sequence..."
18
+ puts ""
19
+
20
+ codon_collection.each do |codon|
21
+ if GeneticConstants.genetic_code[codon.join("")].nil?
22
+ next
23
+ elsif GeneticConstants.genetic_code[codon.join("")] == "STOP"
24
+ print "#{GeneticConstants.genetic_code[codon.join("")]}"
25
+ puts ""
26
+ puts "=>translation of mRNA sequence terminated.<="
27
+ break
28
+ else
29
+ print "#{GeneticConstants.genetic_code[codon.join("")]}---"
30
+ end
31
+ end
32
+ print "STOP"
33
+ puts ""
34
+ end
35
+ end
36
+
37
+
@@ -0,0 +1,80 @@
1
+ module GeneticConstants
2
+ def self.nitrogenous_base_pairs
3
+ {
4
+ :A => :U,
5
+ :T => :A,
6
+ :G => :C,
7
+ :C => :G
8
+ }
9
+ end
10
+
11
+ def self.genetic_code
12
+ {
13
+
14
+ "UUU" => "Phe",
15
+ "UUC" => "Phe",
16
+ "UUA" => "Leu",
17
+ "UUG" => "Leu",
18
+ "CUU" => "Leu",
19
+ "CUC" => "Leu",
20
+ "CUA" => "Leu",
21
+ "CUG" => "Leu",
22
+ "AUU" => "Ile",
23
+ "AUC" => "Ile",
24
+ "AUA" => "Ile",
25
+ "AUG" => "Met",
26
+ "GUU" => "Val",
27
+ "GUC" => "Val",
28
+ "GUA" => "Val",
29
+ "GUG" => "Val",
30
+ "UCU" => "Ser",
31
+ "UCC" => "Ser",
32
+ "UCA" => "Ser",
33
+ "UCG" => "Ser",
34
+ "CCU" => "Pro",
35
+ "CCC" => "Pro",
36
+ "CCA" => "Pro",
37
+ "CCG" => "Pro",
38
+ "ACU" => "Thr",
39
+ "ACC" => "Thr",
40
+ "ACA" => "Thr",
41
+ "ACG" => "Thr",
42
+ "GCU" => "Ala",
43
+ "GCC" => "Ala",
44
+ "GCA" => "Ala",
45
+ "GCG" => "Ala",
46
+ "UAU" => "Tyr",
47
+ "UAC" => "Tyr",
48
+ "UAA" => "STOP",
49
+ "UAG" => "STOP",
50
+ "CAU" => "His",
51
+ "CAC" => "His",
52
+ "CAA" => "Gln",
53
+ "CAG" => "Gln",
54
+ "AAU" => "Asn",
55
+ "AAC" => "Asn",
56
+ "AAA" => "Lys",
57
+ "AAG" => "Lys",
58
+ "GAU" => "Asp",
59
+ "GAC" => "Asp",
60
+ "GAA" => "Glu",
61
+ "GAG" => "Glu",
62
+ "UGU" => "Cys",
63
+ "UGC" => "Cys",
64
+ "UGA" => "STOP",
65
+ "UGG" => "Trp",
66
+ "CGU" => "Arg",
67
+ "CGC" => "Arg",
68
+ "CGA" => "Arg",
69
+ "CGG" => "Arg",
70
+ "AGU" => "Ser",
71
+ "AGC" => "Ser",
72
+ "AGA" => "Arg",
73
+ "AGG" => "Arg",
74
+ "GGU" => "Gly",
75
+ "GGC" => "Gly",
76
+ "GGA" => "Gly",
77
+ "GGG" => "Gly"
78
+ }
79
+ end
80
+ end
@@ -0,0 +1,30 @@
1
+ require 'genetic_constants'
2
+ require 'dna_worker'
3
+
4
+
5
+ class ProteinMaker
6
+ include GeneticConstants
7
+ include DnaWorker
8
+
9
+ attr_accessor :input_sequence
10
+ attr_reader :purified_array_sequence, :complementary_mRNA_sequence, :codon_collection, :amino_acid_strand
11
+
12
+ def initialize(input_sequence=nil)
13
+ raise 'No Input Sequence' if input_sequence.nil?
14
+
15
+ @input_sequence = input_sequence
16
+ @codon_collection = []
17
+ end
18
+
19
+ def synthesize_amino_acid_strand
20
+ @purified_array_sequence = @input_sequence.split('')
21
+ @purified_array_sequence = @purified_array_sequence.map(&:upcase)
22
+ @purified_array_sequence.select! { |ele| GeneticConstants.nitrogenous_base_pairs.keys.include?(ele.to_sym) }
23
+
24
+ @complementary_mRNA_sequence = DnaWorker.print_complementary_base_pairing(@purified_array_sequence)
25
+ @complementary_mRNA_sequence.join('')
26
+
27
+ @complementary_mRNA_sequence.each_slice(3) { |codon| @codon_collection << codon }
28
+ DnaWorker.initiate_translation(@codon_collection)
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: protein_maker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - Paa-Yaw
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2021-11-29 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple ruby program that reads and synthesizes complementary mRNA sequence,
14
+ and then translates mRNA sequence to make a chain of amino acids
15
+ email: deepsky_5@live.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/dna_worker.rb
21
+ - lib/genetic_constants.rb
22
+ - lib/protein_maker.rb
23
+ homepage: https://github.com/paa-yaw/ruby-project-protein-synthesis
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.3.0.dev
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: A simple ruby program that reads and synthesizes complementary mRNA sequence,
46
+ and then translates mRNA sequence to make a chain of amino acids
47
+ test_files: []