bio-hydropathy 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+ group :development do
9
+ gem "shoulda", ">= 0"
10
+ gem "bundler", "~> 1.0.0"
11
+ gem "jeweler", "~> 1.6.4"
12
+ gem "rcov", ">= 0"
13
+ gem "bio", ">= 1.4.1"
14
+ end
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Ben J Woodcroft
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,28 @@
1
+ = bio-hydropathy
2
+
3
+ Simple biogem to calculate amino acid hydropathy. They are calculated as proposed by
4
+
5
+ Jack Kyte, Russell F. Doolittle,
6
+ A simple method for displaying the hydropathic character of
7
+ a protein, Journal of Molecular Biology,
8
+ Volume 157, Issue 1, 5 May 1982, Pages 105-132
9
+
10
+ Example:
11
+
12
+ Bio::Sequence::AA.new('ACD').hydrophopathy_profile #=> [1.8, 2.5, -3.5]
13
+
14
+ == Contributing to bio-bio-hydropathy
15
+
16
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
17
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
18
+ * Fork the project
19
+ * Start a feature/bugfix branch
20
+ * Commit and push until you are happy with your contribution
21
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
22
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
23
+
24
+ == Copyright
25
+
26
+ Copyright (c) 2012 Ben J Woodcroft. See LICENSE.txt for
27
+ further details.
28
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "bio-hydropathy"
18
+ gem.homepage = "http://github.com/wwood/bioruby-hydropathy"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Hydropathy scale for BioRuby}
21
+ gem.description = %Q{Hydropathy scale for BioRuby}
22
+ gem.email = "donttrustben near gmail.com"
23
+ gem.authors = ["Ben J Woodcroft"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "bio-hydropathy #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1 @@
1
+ require 'bio/sequence/aa/hydropathy'
@@ -0,0 +1,59 @@
1
+ require 'bio'
2
+
3
+ module Bio
4
+ class Sequence
5
+ class AA
6
+ # Return an array of hydrophobicities, as defined by Kyte and Doolittle
7
+ def hydrophopathy_profile
8
+ profile = []
9
+ seq.each_char do |letter|
10
+ profile.push Bio::AminoAcid::Data::KYTE_DOOLITTLE_HYDROPATHY_SCALE[letter]
11
+ end
12
+ profile
13
+ end
14
+
15
+ # Sum of hydropathy values for each amino acid, divided by the length of the protein
16
+ def grand_average_of_hydropathy
17
+ hydrophopathy_profile.inject{|sum,x| sum + x }.to_f/seq.length
18
+ end
19
+ alias_method :gravy, :grand_average_of_hydropathy
20
+ end
21
+ end
22
+
23
+
24
+ class AminoAcid
25
+ module Data
26
+ # Jack Kyte, Russell F. Doolittle,
27
+ # A simple method for displaying the hydropathic character of
28
+ # a protein, Journal of Molecular Biology,
29
+ # Volume 157, Issue 1, 5 May 1982, Pages 105-132, ISSN 0022-2836, 10.1016/0022-2836(82)90515-0.
30
+ KYTE_DOOLITTLE_HYDROPATHY_SCALE = {
31
+ 'A' => 1.8,
32
+ 'C' => 2.5,
33
+ 'D' => -3.5,
34
+ 'E' => -3.5,
35
+ 'F' => 2.8,
36
+ 'G' => -0.4,
37
+ 'H' => -3.2,
38
+ 'I' => 4.5,
39
+ 'K' => -3.9,
40
+ 'L' => 3.8,
41
+ 'M' => 1.9,
42
+ 'N' => -3.5,
43
+ 'P' => -1.6,
44
+ 'Q' => -3.5,
45
+ 'R' => -4.5,
46
+ 'S' => -0.8,
47
+ 'T' => -0.7,
48
+ 'U' => 0.0,
49
+ 'V' => 4.2,
50
+ 'W' => -0.9,
51
+ 'Y' => -1.3,
52
+
53
+ 'B' => -3.5,
54
+ 'X' => -0.49,
55
+ 'Z' => -3.5,
56
+ }
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'bio-hydropathy'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,12 @@
1
+ require 'helper'
2
+
3
+ class TestBioBioGravy < Test::Unit::TestCase
4
+ should "hydrophobicity" do
5
+ assert_equal [1.8, 2.5, -3.5], Bio::Sequence::AA.new('ACD').hydrophopathy_profile
6
+ end
7
+
8
+ should "gravy" do
9
+ assert_equal -4, (Bio::Sequence::AA.new('ACDCD').grand_average_of_hydropathy*100).to_i
10
+ assert_equal -4, (Bio::Sequence::AA.new('ACDCD').gravy*100).to_i
11
+ end
12
+ end
metadata ADDED
@@ -0,0 +1,150 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-hydropathy
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Ben J Woodcroft
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-01-26 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ type: :development
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ hash: 3
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ version_requirements: *id001
32
+ name: shoulda
33
+ prerelease: false
34
+ - !ruby/object:Gem::Dependency
35
+ type: :development
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ hash: 23
42
+ segments:
43
+ - 1
44
+ - 0
45
+ - 0
46
+ version: 1.0.0
47
+ version_requirements: *id002
48
+ name: bundler
49
+ prerelease: false
50
+ - !ruby/object:Gem::Dependency
51
+ type: :development
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ hash: 7
58
+ segments:
59
+ - 1
60
+ - 6
61
+ - 4
62
+ version: 1.6.4
63
+ version_requirements: *id003
64
+ name: jeweler
65
+ prerelease: false
66
+ - !ruby/object:Gem::Dependency
67
+ type: :development
68
+ requirement: &id004 !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ hash: 3
74
+ segments:
75
+ - 0
76
+ version: "0"
77
+ version_requirements: *id004
78
+ name: rcov
79
+ prerelease: false
80
+ - !ruby/object:Gem::Dependency
81
+ type: :development
82
+ requirement: &id005 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ hash: 5
88
+ segments:
89
+ - 1
90
+ - 4
91
+ - 1
92
+ version: 1.4.1
93
+ version_requirements: *id005
94
+ name: bio
95
+ prerelease: false
96
+ description: Hydropathy scale for BioRuby
97
+ email: donttrustben near gmail.com
98
+ executables: []
99
+
100
+ extensions: []
101
+
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.rdoc
105
+ files:
106
+ - .document
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - VERSION
112
+ - lib/bio-hydropathy.rb
113
+ - lib/bio/sequence/aa/hydropathy.rb
114
+ - test/helper.rb
115
+ - test/test_bio-hydropathy.rb
116
+ homepage: http://github.com/wwood/bioruby-hydropathy
117
+ licenses:
118
+ - MIT
119
+ post_install_message:
120
+ rdoc_options: []
121
+
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ none: false
126
+ requirements:
127
+ - - ">="
128
+ - !ruby/object:Gem::Version
129
+ hash: 3
130
+ segments:
131
+ - 0
132
+ version: "0"
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ none: false
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ hash: 3
139
+ segments:
140
+ - 0
141
+ version: "0"
142
+ requirements: []
143
+
144
+ rubyforge_project:
145
+ rubygems_version: 1.8.6
146
+ signing_key:
147
+ specification_version: 3
148
+ summary: Hydropathy scale for BioRuby
149
+ test_files: []
150
+