ProteinTranslate 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: de1765ceecea78bbf9b6aaf67acffefee9e3c071
4
+ data.tar.gz: 299f7d7b43c484beaf56045948bea1b1ab907271
5
+ SHA512:
6
+ metadata.gz: aac7c6ff3794d626af7dde4b575bbaf56984cf2ee6b3819362453cb31133f9b46ade42476a09eac3bb217e61be104d72afea4f891fd32f5942180bcd6415066b
7
+ data.tar.gz: 95b371d409bbe8e53fd4a5c5aff9c027a957c8dece4c513bea01b5a1a466e5aa596f1a63f48b12b738af135fcdb433aabc681c4c5a173a56bcb220be67e67ff4
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ - rbx-19mode
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ProteinTranslate.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 marrero-
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'ProteinTranslate/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "ProteinTranslate"
8
+ spec.version = ProteinTranslate::VERSION
9
+ spec.authors = ["marrero-"]
10
+ spec.email = ["alexmd54@gmail.com"]
11
+ spec.summary = %q{Gem.}
12
+ spec.description = %q{Ruby Gem which translate RNA to Protein}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "coveralls"
25
+ end
@@ -0,0 +1,38 @@
1
+ # ProteinTranslate
2
+
3
+ For documentation:
4
+ https://marrero-.github.io/ProteinTranslate
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'ProteinTranslate'
12
+ ```
13
+
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install ProteinTranslate
21
+
22
+ ## Usage
23
+
24
+ Install the Gem and then you can translate a ARN string to the protein equivalence:
25
+ ```ruby
26
+
27
+ translateString("AUGUUUUCUUAG")
28
+ #=> "Methionine","Phenylalanine", "Serine"
29
+
30
+ ```
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it ( https://github.com/marrero-/ProteinTranslate/fork )
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create a new Pull Request
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+
4
+ task :default => :spec
5
+
6
+ desc "Expectativas Básicas"
7
+ task :spec do
8
+ sh "rspec -I. spec/spec_protein.rb"
9
+ end
@@ -0,0 +1,5 @@
1
+ require "ProteinTranslate/version"
2
+ require "ProteinTranslate/protein"
3
+ module ProteinTranslate
4
+ # Your code goes here...
5
+ end
@@ -0,0 +1,70 @@
1
+
2
+
3
+ module ProteinTranslate
4
+
5
+ #Clase para traduciar una cadena en ARN
6
+ #a los codones y proteinas correspondientes
7
+ class ProteinTranslate
8
+
9
+ attr_reader :equivalence, :stop
10
+
11
+ def initialize
12
+
13
+ #Hash que contiene las equivalencias entre
14
+ #codones y las respectivas proteínas
15
+ @equivalence = {
16
+ "AUG" => "Methionine",
17
+ "UUU" => "Phenylalanine",
18
+ "UUC" => "Phenylalanine",
19
+ "UUA" => "Leucine",
20
+ "UUG" => "Leucine",
21
+ "UCU" => "Serine",
22
+ "UCC" => "Serine",
23
+ "UCA" => "Serine",
24
+ "UCG" => "Serine",
25
+ "UAU" => "Tyrosine",
26
+ "UAC" => "Tyrosine",
27
+ "UGU" => "Cysteine",
28
+ "UGC" => "Cysteine",
29
+ "UGG"=> "Tryptophan"
30
+ }
31
+
32
+ #Array que contiene los valores que si son detectados
33
+ #en la cadena indican que se pueden terminar la traduccion
34
+ @stop = ["UAA", "UAG", "UGA"]
35
+ end
36
+
37
+ #Metodo que recibe una cadena y devuelve
38
+ #un array de codons que la conforman
39
+ def divideStringInCondons(cadena)
40
+ array = Array.new
41
+ i = 0
42
+ while i <= cadena.length-3
43
+ if (@stop.include?("#{cadena[i,3]}"))
44
+ break
45
+ end
46
+ array << cadena[i,3]
47
+ i += 3
48
+ end
49
+ array
50
+ end
51
+
52
+ #Metodo que recibe una cadena y devuelve un array con las
53
+ #proteinas que la conforman
54
+ #Previamente se convierten en codones
55
+ def translateString(cadena)
56
+ array = divideStringInCondons(cadena)
57
+ proteina = Array.new
58
+ i = 0
59
+ array.each do |value|
60
+ if(@equivalence.has_key?("#{value}"))
61
+ proteina[i] = @equivalence["#{value}"]
62
+ i += 1
63
+ end
64
+ end
65
+ proteina
66
+ end
67
+
68
+ end
69
+
70
+ end
@@ -0,0 +1,3 @@
1
+ module ProteinTranslate
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,98 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause
4
+ # this file to always be loaded, without a need to explicitly require it in any
5
+ # files.
6
+ #
7
+ # Given that it is always loaded, you are encouraged to keep this file as
8
+ # light-weight as possible. Requiring heavyweight dependencies from this file
9
+ # will add to the boot time of your test suite on EVERY test run, even for an
10
+ # individual file that may not need all of that loaded. Instead, consider making
11
+ # a separate helper file that requires the additional dependencies and performs
12
+ # the additional setup, and require it from the spec files that actually need
13
+ # it.
14
+ #
15
+ # The `.rspec` file also contains a few flags that are not defaults but that
16
+ # users commonly want.
17
+ #
18
+ require 'coveralls'
19
+ Coveralls.wear!
20
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
21
+ RSpec.configure do |config|
22
+ # rspec-expectations config goes here. You can use an alternate
23
+ # assertion/expectation library such as wrong or the stdlib/minitest
24
+ # assertions if you prefer.
25
+ config.expect_with :rspec do |expectations|
26
+ # This option will default to `true` in RSpec 4. It makes the `description`
27
+ # and `failure_message` of custom matchers include text for helper methods
28
+ # defined using `chain`, e.g.:
29
+ # be_bigger_than(2).and_smaller_than(4).description
30
+ # # => "be bigger than 2 and smaller than 4"
31
+ # ...rather than:
32
+ # # => "be bigger than 2"
33
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
34
+ end
35
+
36
+ # rspec-mocks config goes here. You can use an alternate test double
37
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
38
+ config.mock_with :rspec do |mocks|
39
+ # Prevents you from mocking or stubbing a method that does not exist on
40
+ # a real object. This is generally recommended, and will default to
41
+ # `true` in RSpec 4.
42
+ mocks.verify_partial_doubles = true
43
+ end
44
+
45
+ # The settings below are suggested to provide a good initial experience
46
+ # with RSpec, but feel free to customize to your heart's content.
47
+ =begin
48
+ # These two settings work together to allow you to limit a spec run
49
+ # to individual examples or groups you care about by tagging them with
50
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
51
+ # get run.
52
+ config.filter_run :focus
53
+ config.run_all_when_everything_filtered = true
54
+
55
+ # Allows RSpec to persist some state between runs in order to support
56
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
57
+ # you configure your source control system to ignore this file.
58
+ config.example_status_persistence_file_path = "spec/examples.txt"
59
+
60
+ # Limits the available syntax to the non-monkey patched syntax that is
61
+ # recommended. For more details, see:
62
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
63
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
64
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
65
+ config.disable_monkey_patching!
66
+
67
+ # This setting enables warnings. It's recommended, but in some cases may
68
+ # be too noisy due to issues in dependencies.
69
+ config.warnings = true
70
+
71
+ # Many RSpec users commonly either run the entire suite or an individual
72
+ # file, and it's useful to allow more verbose output when running an
73
+ # individual spec file.
74
+ if config.files_to_run.one?
75
+ # Use the documentation formatter for detailed output,
76
+ # unless a formatter has already been configured
77
+ # (e.g. via a command-line flag).
78
+ config.default_formatter = 'doc'
79
+ end
80
+
81
+ # Print the 10 slowest examples and example groups at the
82
+ # end of the spec run, to help surface which specs are running
83
+ # particularly slow.
84
+ config.profile_examples = 10
85
+
86
+ # Run specs in random order to surface order dependencies. If you find an
87
+ # order dependency and want to debug it, you can fix the order by providing
88
+ # the seed, which is printed after each run.
89
+ # --seed 1234
90
+ config.order = :random
91
+
92
+ # Seed global randomization in this process using the `--seed` CLI option.
93
+ # Setting this allows you to use `--seed` to deterministically reproduce
94
+ # test failures related to randomization by passing the same `--seed` value
95
+ # as the one that triggered the failure.
96
+ Kernel.srand config.seed
97
+ =end
98
+ end
@@ -0,0 +1,130 @@
1
+
2
+
3
+ require 'ProteinTranslate/protein'
4
+
5
+ describe ProteinTranslate::ProteinTranslate do
6
+ before :each do
7
+ @protein = ProteinTranslate::ProteinTranslate.new
8
+ end
9
+
10
+ context "#Basic"do
11
+
12
+ it "Debe exisistir un objeto de la clase ProteinTranslate::ProteinTranslate"do
13
+ expect(@protein).not_to eq(nil)
14
+ end
15
+
16
+ it "Debe existir un hash que contenga las equivalencias"do
17
+ expect(@protein.equivalence).not_to eq(nil)
18
+ end
19
+
20
+ end
21
+
22
+ context "#Methionine" do
23
+ it "Debe tener la equivalencia para AUG"do
24
+ expect(@protein.equivalence["AUG"]).to eq("Methionine")
25
+ end
26
+ end
27
+
28
+ context "#Phenylalanine" do
29
+
30
+ it "Debe tener la equivalencia para UUU" do
31
+ expect(@protein.equivalence["UUU"]).to eq("Phenylalanine")
32
+ end
33
+ it "Debe tener la otra equivalencia para Phenylalanine"do
34
+ expect(@protein.equivalence["UUC"]).to eq("Phenylalanine")
35
+ end
36
+ end
37
+
38
+ context "#Leucine"do
39
+ it "Debe tener una de las equivalencias a Leucine" do
40
+ expect(@protein.equivalence["UUA"]).to eq("Leucine")
41
+ end
42
+ it "UUG tambien es una equivalencia para Leucina"do
43
+ expect(@protein.equivalence["UUG"]).to eq("Leucine")
44
+ end
45
+ end
46
+
47
+ context "#Serine" do
48
+
49
+ it "UCU => Serine" do
50
+ expect(@protein.equivalence["UCU"]).to eq("Serine")
51
+ end
52
+
53
+ it "UCC => Serine" do
54
+ expect(@protein.equivalence["UCC"]).to eq("Serine")
55
+ end
56
+
57
+ it "UCA => Serine" do
58
+ expect(@protein.equivalence["UCA"]).to eq("Serine")
59
+ end
60
+
61
+ it "UCG => Serine" do
62
+ expect(@protein.equivalence["UCG"]).to eq("Serine")
63
+ end
64
+ end
65
+
66
+ context "#Tyrosine" do
67
+
68
+ it "UAU => Tyrosine" do
69
+ expect(@protein.equivalence["UAU"]).to eq("Tyrosine")
70
+ end
71
+
72
+ it "UAC => Tyrosine" do
73
+ expect(@protein.equivalence["UAC"]).to eq("Tyrosine")
74
+ end
75
+ end
76
+
77
+ context "#Cysteine" do
78
+
79
+ it "UGU => Cysteine" do
80
+ expect(@protein.equivalence["UGU"]).to eq("Cysteine")
81
+ end
82
+
83
+ it "UGC => Cysteine" do
84
+ expect(@protein.equivalence["UGC"]).to eq("Cysteine")
85
+ end
86
+ end
87
+
88
+ context "#Tryptophan"do
89
+ it "UGG => Tryptophan" do
90
+ expect(@protein.equivalence["UGG"]).to eq("Tryptophan")
91
+ end
92
+ end
93
+
94
+ context "#Funcionamiento" do
95
+ it "Existe un metodo que dada una cadena te devuelve un array con los 'condon'" do
96
+ expect(@protein.respond_to?:divideStringInCondons).to eq(true)
97
+ end
98
+ it "El metodo tiene que funcionar correctamente " do
99
+ expect(@protein.divideStringInCondons("AUGUUUUCUUAG")).to eq(["AUG", "UUU", "UCU"])
100
+ end
101
+ it "EL metodo de Translate devuelve las proteínas"do
102
+ expect(@protein.translateString("AUGUUUUCUUAG")).to eq(["Methionine","Phenylalanine", "Serine"])
103
+ end
104
+ end
105
+
106
+ context "#STOP" do
107
+ it "Debe tener un array para parar la traduccion" do
108
+ expect(@protein.stop).not_to eq(nil)
109
+ end
110
+ it "Debe contener el valor UAA" do
111
+ expect(@protein.stop.include?("UAA")).to eq(true)
112
+ end
113
+ it "Debe incluir el valor UAG"do
114
+ expect(@protein.stop.include?("UAG")).to eq(true)
115
+ end
116
+ it "Debe incluir el valor UGA" do
117
+ expect(@protein.stop.include?("UGA")).to eq(true)
118
+ end
119
+ end
120
+ end
121
+
122
+ =begin
123
+ UAU, UAC |Tyrosine
124
+
125
+ UGU, UGC |Cysteine
126
+
127
+ UGG |Tryptophan
128
+
129
+ UAA, UAG, UGA |STOP
130
+ =end
metadata ADDED
@@ -0,0 +1,116 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ProteinTranslate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - marrero-
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-27 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coveralls
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Ruby Gem which translate RNA to Protein
70
+ email:
71
+ - alexmd54@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".coveralls.yml"
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - ProteinTranslate.gemspec
83
+ - README.md
84
+ - Rakefile
85
+ - lib/ProteinTranslate.rb
86
+ - lib/ProteinTranslate/protein.rb
87
+ - lib/ProteinTranslate/version.rb
88
+ - spec/spec_helper.rb
89
+ - spec/spec_protein.rb
90
+ homepage: ''
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
94
+ post_install_message:
95
+ rdoc_options: []
96
+ require_paths:
97
+ - lib
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ requirements: []
109
+ rubyforge_project:
110
+ rubygems_version: 2.4.6
111
+ signing_key:
112
+ specification_version: 4
113
+ summary: Gem.
114
+ test_files:
115
+ - spec/spec_helper.rb
116
+ - spec/spec_protein.rb