bio-isoelectric_point 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt CHANGED
@@ -1,3 +1,3 @@
1
- Copyright (c) 2010 George Githinji
1
+ Copyright (c) 2011 George Githinji
2
2
 
3
- bioruby-isoelectric_point library can be freely distributed under the same terms as Ruby.
3
+ bioruby-isoelectric_point library can be freely distributed under the same terms as Ruby.
data/README.rdoc CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  The isoelectric point (pI), sometimes abbreviated to iep, is the pH at which a particular molecule or surface carries no net electrical charge.
4
4
 
5
- This library is a ruby implementation for calculating the isoelectric point of a protein, based on the bioperl’s approach. It can be installed as a bioruby-plugin.
5
+ This library is a ruby implementation for estimating the isoelectric point of a protein, based on the bioperl’s approach. It can be installed as a bioruby-plugin.
6
6
 
7
7
  Support for the following Pka sets is available
8
8
 
9
- * dta_select
9
+ * dtaselect
10
10
  * emboss
11
11
  * rodwell
12
12
  * wikipedia
@@ -29,10 +29,10 @@ You can also create a custom Pka set as shown in the example
29
29
  protein_seq = Bio::Sequence::AA.new("KKGFTCGELA")
30
30
 
31
31
  #what is the protein charge at ph 14?
32
- charge = protein_seq.calculate_charge_at(14) #=>-2.999795857467562
32
+ charge = protein_seq.charge_at(14) #=>-2.999795857467562
33
33
 
34
- #calculate the ph using dtaselect pka set and round off to 3 decimal places
35
- isoelectric_point = protein_seq.calculate_iep('dtaselect', 3) #=>8.219
34
+ #calculate the pH using dtaselect pka set and round off to 3 decimal places
35
+ isoelectric_point = protein_seq.isoelectric_point('dtaselect', 3) #=>8.219
36
36
 
37
37
  # calculate the iep ph with a custom set
38
38
  custom_pka_set = { "N_TERMINUS" => 8.1,
@@ -45,7 +45,7 @@ You can also create a custom Pka set as shown in the example
45
45
  "C" => 8.33,
46
46
  "Y" => 9.5
47
47
  }
48
- iep_ph = protein_seq.calculate_iep(custom_pka_set, 3) #=> 8.193
48
+ iep_ph = protein_seq.isoelectric_point(custom_pka_set, 3) #=> 8.193
49
49
 
50
50
 
51
51
  == Contributing to bio-isoelectric_point
@@ -60,6 +60,6 @@ You can also create a custom Pka set as shown in the example
60
60
 
61
61
  == Copyright
62
62
 
63
- Copyright (c) 2010 George Githinji. See LICENSE.txt for
63
+ Copyright (c)2011 George Githinji. See LICENSE.txt for
64
64
  further details.
65
65
 
data/Rakefile CHANGED
@@ -15,8 +15,8 @@ Jeweler::Tasks.new do |gem|
15
15
  gem.name = "bio-isoelectric_point"
16
16
  gem.homepage = "http://github.com/GeorgeG/bioruby-isoelectric_point"
17
17
  gem.license = "Ruby"
18
- gem.summary = %Q{A bioruby plugin for calculating the isoelectric point of a protein. It can be installed as a bioruby plugin.}
19
- gem.description = %Q{The isoelectric point (pI), sometimes abbreviated to iep, is the pH at which a particular molecule or surface carries no net electrical charge. }
18
+ gem.summary = %Q{A bioruby plugin for calculating the isoelectric point and the charge of a protein sequence.}
19
+ gem.description = %Q{A bioruby plugin for calculating the isoelectric point of a protein }
20
20
  gem.email = "georgkam@gmail.com"
21
21
  gem.authors = ["George Githinji","Pascal Betz"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,12 +5,12 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{bio-isoelectric_point}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["George Githinji", "Pascal Betz"]
12
- s.date = %q{2010-12-25}
13
- s.description = %q{The isoelectric point (pI), sometimes abbreviated to iep, is the pH at which a particular molecule or surface carries no net electrical charge. }
12
+ s.date = %q{2011-01-30}
13
+ s.description = %q{A bioruby plugin for calculating the isoelectric point of a protein }
14
14
  s.email = %q{georgkam@gmail.com}
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE.txt",
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.licenses = ["Ruby"]
37
37
  s.require_paths = ["lib"]
38
38
  s.rubygems_version = %q{1.3.7}
39
- s.summary = %q{A bioruby plugin for calculating the isoelectric point of a protein. It can be installed as a bioruby plugin.}
39
+ s.summary = %q{A bioruby plugin for calculating the isoelectric point and the charge of a protein sequence.}
40
40
  s.test_files = [
41
41
  "test/aa_test.rb",
42
42
  "test/extensions_test.rb",
@@ -1,5 +1,19 @@
1
1
  require 'bio'
2
2
 
3
3
  ['pka_data', 'extensions', 'aa'].each do |name|
4
- require File.join(File.dirname(__FILE__), 'isoelectric_point', name)
5
- end
4
+ require File.join(File.expand_path(File.dirname(__FILE__)), 'isoelectric_point',"#{name}")
5
+ end
6
+
7
+
8
+ # protein_seq = Bio::Sequence::AA.new("KKGFTCGELA")
9
+ #
10
+ # #what is the protein charge at ph 14?
11
+ # charge = protein_seq.charge_at(14) #=>-2.999795857467562
12
+ #
13
+ # #calculate the pH using dtaselect pka set and round off to 3 decimal places
14
+ # isoelectric_point = protein_seq.isoelectric_point('dtaselect', 3) #=>8.219
15
+ #
16
+ # puts charge
17
+ # puts isoelectric_point
18
+ #
19
+ #
@@ -12,12 +12,13 @@ module Bio
12
12
  # pka_name_or_set: the name of a PKA set or a custom PKA set
13
13
  # places: specify the number of decimal places the value should be rounded to.
14
14
  # loop_limit: how many iterations should be made to find the point. You should not need to tweak this.
15
- def calculate_iep(pka_name_or_set = 'dtaselect', places = 2, loop_limit = 100)
15
+ #TODO to be renamed to isoelectric_point to preserve clarity
16
+ def isoelectric_point(pka_name_or_set = 'dtaselect', places = 2, loop_limit = 100)
16
17
  loops = 0
17
18
  ph = 7.5
18
19
  step = 3.5
19
20
  begin
20
- current_charge = calculate_charge_at(ph, pka_name_or_set)
21
+ current_charge = charge_at(ph, pka_name_or_set)
21
22
  if current_charge > 0
22
23
  ph += step
23
24
  else
@@ -32,7 +33,8 @@ module Bio
32
33
 
33
34
  # Calculate the charge of the sequence at a given ph
34
35
  # As a second argument you can pass the name of the PKA set or a custom PKA set
35
- def calculate_charge_at(ph, pka_name_or_set = 'dtaselect')
36
+
37
+ def charge_at(ph, pka_name_or_set = 'dtaselect')
36
38
  ['K', 'R', 'H'].inject(partial_charge(select_pka(pka_name_or_set)['N_TERMINUS'], ph)) do |memo, item|
37
39
  memo += partial_charge(select_pka(pka_name_or_set)[item], ph) * charged_residue_frequencies[item]
38
40
  end -
@@ -67,7 +69,7 @@ module Bio
67
69
 
68
70
  #
69
71
  # Select a PKA set according to the name or supply a custom set.
70
- # Raises ArgumentError if the name can not be mapped to a PKA set.
72
+ # Raises ArgumentError if the name can not be mapped to a Pka set.
71
73
  # If the argument is a String it is used as a key to lookup the set,
72
74
  # if it's a Hash then it's assumed a custom set has been supplied.
73
75
  def select_pka(pka_name_or_set = 'dtaselect')
@@ -81,4 +83,6 @@ module Bio
81
83
  end #select_pka
82
84
  end #class AA
83
85
  end #class Sequence
84
- end #module Bio
86
+ end #module Bio
87
+ #include a new class Bio::AA::Index for Pkas? suggestes by tokiashiki katayama
88
+
@@ -1,5 +1,7 @@
1
1
  module Bio
2
2
  class Sequence
3
+
4
+ #It would be better to have a class for pKa, compatible with Bio::AAindex indices.Bio::AAindex
3
5
  class PkaData
4
6
  PKAS = {
5
7
  'dtaselect' => { 'N_TERMINUS' => 8.0,
@@ -55,4 +57,4 @@ module Bio
55
57
  }.freeze
56
58
  end
57
59
  end
58
- end
60
+ end
data/test/aa_test.rb CHANGED
@@ -1,5 +1,6 @@
1
1
 
2
- require 'test_helper'
2
+ #require 'helper'
3
+ require File.join(File.expand_path(File.dirname(__FILE__)),'helper')
3
4
 
4
5
  # include Bio::Sequence
5
6
  class AATest < Test::Unit::TestCase
@@ -28,7 +29,7 @@ class AATest < Test::Unit::TestCase
28
29
  should 'calculate iep' do
29
30
  places = 2
30
31
  @known.each do |sequence, expected|
31
- actual = Bio::Sequence::AA.new(sequence).calculate_iep('dtaselect', places)
32
+ actual = Bio::Sequence::AA.new(sequence).isoelectric_point('dtaselect', places)
32
33
  assert_equal expected.round_to_places(places), actual, "Expected the iep to be #{expected} but was #{actual} for #{sequence}"
33
34
  end
34
35
  end
@@ -59,10 +60,10 @@ class AATest < Test::Unit::TestCase
59
60
  end
60
61
 
61
62
  should "calculates the isolectric point to 0 places" do
62
- assert_equal 11, @sequence.calculate_iep('dtaselect', 0)
63
+ assert_equal 11, @sequence.isoelectric_point('dtaselect', 0)
63
64
  end
64
65
  should "calculates the isolectric pointto 3 places" do
65
- assert_equal 10.603, @sequence.calculate_iep('dtaselect', 3)
66
+ assert_equal 10.603, @sequence.isoelectric_point('dtaselect', 3)
66
67
  end
67
68
 
68
69
  context 'use a custom pka set' do
@@ -79,22 +80,22 @@ class AATest < Test::Unit::TestCase
79
80
  }
80
81
  end
81
82
  should 'accept a custom pka set and use it for calculation' do
82
- assert_equal 10.106, @sequence.calculate_iep(@custom, 3)
83
+ assert_equal 10.106, @sequence.isoelectric_point(@custom, 3)
83
84
  end
84
85
 
85
86
  should 'raise when no result can be found due to a invalid set' do
86
87
  @custom['K'] = 20
87
88
  assert_raises RuntimeError do
88
- @sequence.calculate_iep(@custom, 3)
89
+ @sequence.isoelectric_point(@custom, 3)
89
90
  end
90
91
  end
91
92
  end
92
93
  context 'use another pka set' do
93
94
  should 'work with all provided sets without raising' do
94
95
  Bio::Sequence::PkaData::PKAS.keys.each do |key|
95
- @sequence.calculate_iep(key, 3, 25)
96
+ @sequence.isoelectric_point(key, 3, 25)
96
97
  end
97
98
  end
98
99
  end
99
100
  end
100
- end
101
+ end
@@ -14,4 +14,4 @@ class ExtensionsTest < Test::Unit::TestCase
14
14
  assert_equal 1.12, @float.round_to_places(2)
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -1,7 +1,5 @@
1
1
  require 'helper'
2
2
 
3
3
  class TestBioIsoelectricPoint < Test::Unit::TestCase
4
- should "create a real test" do
5
4
 
6
- end
7
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - George Githinji
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-25 00:00:00 +03:00
18
+ date: 2011-01-30 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -89,7 +89,7 @@ dependencies:
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: *id005
92
- description: "The isoelectric point (pI), sometimes abbreviated to iep, is the pH at which a particular molecule or surface carries no net electrical charge. "
92
+ description: "A bioruby plugin for calculating the isoelectric point of a protein "
93
93
  email: georgkam@gmail.com
94
94
  executables: []
95
95
 
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
127
  requirements:
128
128
  - - ">="
129
129
  - !ruby/object:Gem::Version
130
- hash: -2384793528143520988
130
+ hash: -1228718005813956698
131
131
  segments:
132
132
  - 0
133
133
  version: "0"
@@ -145,7 +145,7 @@ rubyforge_project:
145
145
  rubygems_version: 1.3.7
146
146
  signing_key:
147
147
  specification_version: 3
148
- summary: A bioruby plugin for calculating the isoelectric point of a protein. It can be installed as a bioruby plugin.
148
+ summary: A bioruby plugin for calculating the isoelectric point and the charge of a protein sequence.
149
149
  test_files:
150
150
  - test/aa_test.rb
151
151
  - test/extensions_test.rb