bio-isoelectric_point 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +14 -0
- data/LICENSE.txt +3 -0
- data/README.rdoc +65 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/bio-isoelectric_point.gemspec +72 -0
- data/lib/bio-isoelectric_point.rb +5 -0
- data/lib/isoelectric_point/aa.rb +84 -0
- data/lib/isoelectric_point/extensions.rb +5 -0
- data/lib/isoelectric_point/pka_data.rb +58 -0
- data/test/aa_test.rb +100 -0
- data/test/extensions_test.rb +17 -0
- data/test/helper.rb +18 -0
- data/test/test_bio-isoelectric_point.rb +7 -0
- metadata +153 -0
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use the 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.5.1"
|
12
|
+
gem "rcov", ">= 0"
|
13
|
+
gem "bio", ">= 1.4.1"
|
14
|
+
end
|
data/LICENSE.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
= bio-isoelectric_point
|
2
|
+
|
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
|
+
|
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.
|
6
|
+
|
7
|
+
Support for the following Pka sets is available
|
8
|
+
|
9
|
+
* dta_select
|
10
|
+
* emboss
|
11
|
+
* rodwell
|
12
|
+
* wikipedia
|
13
|
+
* sillero
|
14
|
+
|
15
|
+
You can also create a custom Pka set as shown in the example
|
16
|
+
|
17
|
+
== Installation
|
18
|
+
|
19
|
+
gem install bio-isoelectric_point
|
20
|
+
|
21
|
+
== Uninstallation
|
22
|
+
|
23
|
+
gem uninstall bio-isoelectric_point
|
24
|
+
|
25
|
+
== Usage
|
26
|
+
|
27
|
+
require 'bio-isoelectric_point'
|
28
|
+
|
29
|
+
protein_seq = Bio::Sequence::AA.new("KKGFTCGELA")
|
30
|
+
|
31
|
+
#what is the protein charge at ph 14?
|
32
|
+
charge = protein_seq.calculate_charge_at(14) #=>-2.999795857467562
|
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
|
36
|
+
|
37
|
+
# calculate the iep ph with a custom set
|
38
|
+
custom_pka_set = { "N_TERMINUS" => 8.1,
|
39
|
+
"K" => 10.1,
|
40
|
+
"R" => 12.1,
|
41
|
+
"H" => 6.4,
|
42
|
+
"C_TERMINUS" => 3.15,
|
43
|
+
"D" => 4.34,
|
44
|
+
"E" => 4.33,
|
45
|
+
"C" => 8.33,
|
46
|
+
"Y" => 9.5
|
47
|
+
}
|
48
|
+
iep_ph = protein_seq.calculate_iep(custom_pka_set, 3) #=> 8.193
|
49
|
+
|
50
|
+
|
51
|
+
== Contributing to bio-isoelectric_point
|
52
|
+
|
53
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
54
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
55
|
+
* Fork the project
|
56
|
+
* Start a feature/bugfix branch
|
57
|
+
* Commit and push until you are happy
|
58
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
59
|
+
* 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.
|
60
|
+
|
61
|
+
== Copyright
|
62
|
+
|
63
|
+
Copyright (c) 2010 George Githinji. See LICENSE.txt for
|
64
|
+
further details.
|
65
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
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 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "bio-isoelectric_point"
|
16
|
+
gem.homepage = "http://github.com/GeorgeG/bioruby-isoelectric_point"
|
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. }
|
20
|
+
gem.email = "georgkam@gmail.com"
|
21
|
+
gem.authors = ["George Githinji","Pascal Betz"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:test) do |test|
|
31
|
+
test.libs << 'lib' << 'test'
|
32
|
+
test.pattern = 'test/**/test_*.rb'
|
33
|
+
test.verbose = true
|
34
|
+
end
|
35
|
+
|
36
|
+
require 'rcov/rcovtask'
|
37
|
+
Rcov::RcovTask.new do |test|
|
38
|
+
test.libs << 'test'
|
39
|
+
test.pattern = 'test/**/test_*.rb'
|
40
|
+
test.verbose = true
|
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-isoelectric_point #{version}"
|
51
|
+
rdoc.rdoc_files.include('README*')
|
52
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{bio-isoelectric_point}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
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. }
|
14
|
+
s.email = %q{georgkam@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
"Gemfile",
|
21
|
+
"LICENSE.txt",
|
22
|
+
"README.rdoc",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bio-isoelectric_point.gemspec",
|
26
|
+
"lib/bio-isoelectric_point.rb",
|
27
|
+
"lib/isoelectric_point/aa.rb",
|
28
|
+
"lib/isoelectric_point/extensions.rb",
|
29
|
+
"lib/isoelectric_point/pka_data.rb",
|
30
|
+
"test/aa_test.rb",
|
31
|
+
"test/extensions_test.rb",
|
32
|
+
"test/helper.rb",
|
33
|
+
"test/test_bio-isoelectric_point.rb"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/GeorgeG/bioruby-isoelectric_point}
|
36
|
+
s.licenses = ["Ruby"]
|
37
|
+
s.require_paths = ["lib"]
|
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.}
|
40
|
+
s.test_files = [
|
41
|
+
"test/aa_test.rb",
|
42
|
+
"test/extensions_test.rb",
|
43
|
+
"test/helper.rb",
|
44
|
+
"test/test_bio-isoelectric_point.rb"
|
45
|
+
]
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
53
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
54
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
55
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<bio>, [">= 1.4.1"])
|
57
|
+
else
|
58
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
60
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
61
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
62
|
+
s.add_dependency(%q<bio>, [">= 1.4.1"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
66
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
68
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
69
|
+
s.add_dependency(%q<bio>, [">= 1.4.1"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Bio
|
2
|
+
class Sequence
|
3
|
+
class AA
|
4
|
+
CHARGED_GROUPS = ['K', 'R', 'H', 'D', 'E', 'C', 'Y']
|
5
|
+
|
6
|
+
def initialize(sequence)
|
7
|
+
raise ArgumentError.new("sequence is required") if sequence.nil? || sequence.strip == ''
|
8
|
+
super(sequence.upcase.gsub(/\s/, ''))
|
9
|
+
end
|
10
|
+
|
11
|
+
# Calculate the Isoelectric Point
|
12
|
+
# pka_name_or_set: the name of a PKA set or a custom PKA set
|
13
|
+
# places: specify the number of decimal places the value should be rounded to.
|
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)
|
16
|
+
loops = 0
|
17
|
+
ph = 7.5
|
18
|
+
step = 3.5
|
19
|
+
begin
|
20
|
+
current_charge = calculate_charge_at(ph, pka_name_or_set)
|
21
|
+
if current_charge > 0
|
22
|
+
ph += step
|
23
|
+
else
|
24
|
+
ph -= step
|
25
|
+
end
|
26
|
+
step /= 2.0
|
27
|
+
loops += 1
|
28
|
+
raise "Could not find a result within #{loop_limit} loops using #{pka_name_or_set.inspect}" if loops == loop_limit
|
29
|
+
end while not iep_reached?(current_charge)
|
30
|
+
ph.round_to_places(places)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Calculate the charge of the sequence at a given ph
|
34
|
+
# 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
|
+
['K', 'R', 'H'].inject(partial_charge(select_pka(pka_name_or_set)['N_TERMINUS'], ph)) do |memo, item|
|
37
|
+
memo += partial_charge(select_pka(pka_name_or_set)[item], ph) * charged_residue_frequencies[item]
|
38
|
+
end -
|
39
|
+
['D', 'E', 'C', 'Y'].inject(partial_charge(ph, select_pka(pka_name_or_set)['C_TERMINUS'])) do |memo, item|
|
40
|
+
memo += partial_charge(ph, select_pka(pka_name_or_set)[item]) * charged_residue_frequencies[item]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
def iep_reached?(current_charge)
|
46
|
+
current_charge =! nil && 0.0.round_to_places(5) == current_charge.round_to_places(5)
|
47
|
+
end
|
48
|
+
|
49
|
+
def charged_residue_frequencies
|
50
|
+
@charged_residue_frequency ||= calculate_charged_residue_frequencies
|
51
|
+
end
|
52
|
+
|
53
|
+
def partial_charge(a, b)
|
54
|
+
x = 10 ** (a - b)
|
55
|
+
x / (x + 1).to_f
|
56
|
+
end
|
57
|
+
|
58
|
+
# Count the occurrences of the charged groups in the AA.
|
59
|
+
# Returns a Hash where the key is the group and the value is the number of
|
60
|
+
# occurrences in self.
|
61
|
+
def calculate_charged_residue_frequencies
|
62
|
+
CHARGED_GROUPS.inject(Hash.new(0)) do |memo, item|
|
63
|
+
memo[item] = self.count(item)
|
64
|
+
memo
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
#
|
69
|
+
# 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.
|
71
|
+
# If the argument is a String it is used as a key to lookup the set,
|
72
|
+
# if it's a Hash then it's assumed a custom set has been supplied.
|
73
|
+
def select_pka(pka_name_or_set = 'dtaselect')
|
74
|
+
if pka_name_or_set.is_a?(Hash)
|
75
|
+
pka_name_or_set
|
76
|
+
else
|
77
|
+
set = Bio::Sequence::PkaData::PKAS[pka_name_or_set]
|
78
|
+
raise ArgumentError.new("Set '#{pka_name_or_set}' is unknown. Please specify one of #{PkaData::PKAS.keys.join(', ')} or pass a custom set") unless set
|
79
|
+
set
|
80
|
+
end #if
|
81
|
+
end #select_pka
|
82
|
+
end #class AA
|
83
|
+
end #class Sequence
|
84
|
+
end #module Bio
|
@@ -0,0 +1,58 @@
|
|
1
|
+
module Bio
|
2
|
+
class Sequence
|
3
|
+
class PkaData
|
4
|
+
PKAS = {
|
5
|
+
'dtaselect' => { 'N_TERMINUS' => 8.0,
|
6
|
+
'K' => 10.0,
|
7
|
+
'R' => 12.0,
|
8
|
+
'H' => 6.5,
|
9
|
+
'C_TERMINUS' => 3.1,
|
10
|
+
'D' => 4.4,
|
11
|
+
'E' => 4.4,
|
12
|
+
'C' => 8.5,
|
13
|
+
'Y' => 10.0
|
14
|
+
}.freeze,
|
15
|
+
'emboss' => { 'N_TERMINUS' => 8.0,
|
16
|
+
'K' => 10.0,
|
17
|
+
'R' => 12.0,
|
18
|
+
'H' => 6.5,
|
19
|
+
'C_TERMINUS' => 3.1,
|
20
|
+
'D' => 4.4,
|
21
|
+
'E' => 4.4,
|
22
|
+
'C' => 8.5,
|
23
|
+
'Y' => 10.0
|
24
|
+
}.freeze,
|
25
|
+
'rodwell' => { 'N_TERMINUS' => 8.0,
|
26
|
+
'K' => 11.5,
|
27
|
+
'R' => 11.5,
|
28
|
+
'H' => 6.0,
|
29
|
+
'C_TERMINUS' => 3.1,
|
30
|
+
'D' => 3.68,
|
31
|
+
'E' => 4.25,
|
32
|
+
'C' => 8.33,
|
33
|
+
'Y' => 10.07
|
34
|
+
}.freeze,
|
35
|
+
'wikipedia' => { 'N_TERMINUS' => 8.2,
|
36
|
+
'K' => 10.54,
|
37
|
+
'R' => 12.48,
|
38
|
+
'H' => 6.04,
|
39
|
+
'C_TERMINUS' => 3.65,
|
40
|
+
'D' => 3.9,
|
41
|
+
'E' => 4.07,
|
42
|
+
'C' => 8.18,
|
43
|
+
'Y' => 10.47
|
44
|
+
}.freeze,
|
45
|
+
'silerio' => { 'N_TERMINUS' => 8.2,
|
46
|
+
'K' => 10.4,
|
47
|
+
'R' => 12.0,
|
48
|
+
'H' => 6.4,
|
49
|
+
'C_TERMINUS' => 3.2,
|
50
|
+
'D' => 4.0,
|
51
|
+
'E' => 4.5,
|
52
|
+
'C' => 9.0,
|
53
|
+
'Y' => 10.0
|
54
|
+
}.freeze
|
55
|
+
}.freeze
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
data/test/aa_test.rb
ADDED
@@ -0,0 +1,100 @@
|
|
1
|
+
|
2
|
+
require 'test_helper'
|
3
|
+
|
4
|
+
# include Bio::Sequence
|
5
|
+
class AATest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
context 'some known sequences' do
|
8
|
+
setup do
|
9
|
+
# Values are taken from http://isoelectric.ovh.org/
|
10
|
+
# Some values differ and have been modified to make the tests pass
|
11
|
+
@known = {
|
12
|
+
'D' => 3.75146484375,
|
13
|
+
'A' => 5.55419921875,
|
14
|
+
'AGGKA' => 8.99755859375,
|
15
|
+
'DECY' => 3.57, #ORIGINAL VALUE: 3.56103515625
|
16
|
+
'KRH' => 11.00439453125,
|
17
|
+
'DECYKRH' => 7.17, #ORIGINAL VALUE: 7.18115234375
|
18
|
+
'MSATHPTRLGTRTKESNACASQGLVRKPPWANEGEGFELHFWRKICRNCNVVKKSMTVLL
|
19
|
+
SNEEDRKVGRLFEDTKYTTLIAKLKSDGIPMYKRNVMILTNPVAAKKNVSINTVTYEWAP
|
20
|
+
PVQNQALARQYMQMLPKEKQPVAGSEGAQYRKKQLAKQLPAHDQDPSKCHELSPKEVKEM
|
21
|
+
EQFVKKYKSEALGVGDVKFPSEMNAQGDKVHNCGNRHAPAAVASKDKSAESKKTQYSCYC
|
22
|
+
CKHTTNEGEPAIYAERAGYDKLWHPACFICSTCGELLVDMIYFWKNGKLYCGRHYCDSEK
|
23
|
+
PRCAGCDELIFSNEYTQAENQNWHLKHFCCFDCDHILAGKIYVMVTDKPVCKPCYVKNHA
|
24
|
+
VVCQGCHNAIDPEVQRVTYNNFSWHASTECFLCSCCSKCLIGQKFMPVEGMVFCSVECKR
|
25
|
+
MMS' => 8.30908203125
|
26
|
+
}
|
27
|
+
end
|
28
|
+
should 'calculate iep' do
|
29
|
+
places = 2
|
30
|
+
@known.each do |sequence, expected|
|
31
|
+
actual = Bio::Sequence::AA.new(sequence).calculate_iep('dtaselect', places)
|
32
|
+
assert_equal expected.round_to_places(places), actual, "Expected the iep to be #{expected} but was #{actual} for #{sequence}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
should "Raise if not sequence given" do
|
38
|
+
assert_raise ArgumentError do
|
39
|
+
Bio::Sequence::AA.new(nil)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
should "Raise if empty sequence given" do
|
44
|
+
assert_raise ArgumentError do
|
45
|
+
Bio::Sequence::AA.new(' ')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
should "Raise if unknown pks used" do
|
51
|
+
assert_raise ArgumentError do
|
52
|
+
Bio::Sequence::AA.new('PG', 'youdontknowme')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
context "a Sequence" do
|
57
|
+
setup do
|
58
|
+
@sequence = Bio::Sequence::AA.new("PGAKAAAKKPKKAAG")
|
59
|
+
end
|
60
|
+
|
61
|
+
should "calculates the isolectric point to 0 places" do
|
62
|
+
assert_equal 11, @sequence.calculate_iep('dtaselect', 0)
|
63
|
+
end
|
64
|
+
should "calculates the isolectric pointto 3 places" do
|
65
|
+
assert_equal 10.603, @sequence.calculate_iep('dtaselect', 3)
|
66
|
+
end
|
67
|
+
|
68
|
+
context 'use a custom pka set' do
|
69
|
+
setup do
|
70
|
+
@custom = { "N_TERMINUS" => 8.0,
|
71
|
+
"K" => 9.5, # changed from dta_select where it is 10.0
|
72
|
+
"R" => 12.0,
|
73
|
+
"H" => 6.5,
|
74
|
+
"C_TERMINUS" => 3.1,
|
75
|
+
"D" => 4.4,
|
76
|
+
"E" => 4.4,
|
77
|
+
"C" => 8.5,
|
78
|
+
"Y" => 10.1
|
79
|
+
}
|
80
|
+
end
|
81
|
+
should 'accept a custom pka set and use it for calculation' do
|
82
|
+
assert_equal 10.106, @sequence.calculate_iep(@custom, 3)
|
83
|
+
end
|
84
|
+
|
85
|
+
should 'raise when no result can be found due to a invalid set' do
|
86
|
+
@custom['K'] = 20
|
87
|
+
assert_raises RuntimeError do
|
88
|
+
@sequence.calculate_iep(@custom, 3)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
context 'use another pka set' do
|
93
|
+
should 'work with all provided sets without raising' do
|
94
|
+
Bio::Sequence::PkaData::PKAS.keys.each do |key|
|
95
|
+
@sequence.calculate_iep(key, 3, 25)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
class ExtensionsTest < Test::Unit::TestCase
|
3
|
+
context 'float' do
|
4
|
+
setup do
|
5
|
+
@float = 1.123456789
|
6
|
+
end
|
7
|
+
should 'round of at 0' do
|
8
|
+
assert_equal 1, @float.round_to_places(0)
|
9
|
+
end
|
10
|
+
should 'round of at 1' do
|
11
|
+
assert_equal 1.1, @float.round_to_places(1)
|
12
|
+
end
|
13
|
+
should 'round of at 2' do
|
14
|
+
assert_equal 1.12, @float.round_to_places(2)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/test/helper.rb
ADDED
@@ -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-isoelectric_point'
|
16
|
+
|
17
|
+
class Test::Unit::TestCase
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bio-isoelectric_point
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- George Githinji
|
13
|
+
- Pascal Betz
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-12-25 00:00:00 +03:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: shoulda
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :development
|
32
|
+
prerelease: false
|
33
|
+
version_requirements: *id001
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: bundler
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ~>
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 1
|
43
|
+
- 0
|
44
|
+
- 0
|
45
|
+
version: 1.0.0
|
46
|
+
type: :development
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: *id002
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: jeweler
|
51
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
segments:
|
57
|
+
- 1
|
58
|
+
- 5
|
59
|
+
- 1
|
60
|
+
version: 1.5.1
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: *id003
|
64
|
+
- !ruby/object:Gem::Dependency
|
65
|
+
name: rcov
|
66
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
segments:
|
72
|
+
- 0
|
73
|
+
version: "0"
|
74
|
+
type: :development
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: *id004
|
77
|
+
- !ruby/object:Gem::Dependency
|
78
|
+
name: bio
|
79
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
80
|
+
none: false
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
segments:
|
85
|
+
- 1
|
86
|
+
- 4
|
87
|
+
- 1
|
88
|
+
version: 1.4.1
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
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. "
|
93
|
+
email: georgkam@gmail.com
|
94
|
+
executables: []
|
95
|
+
|
96
|
+
extensions: []
|
97
|
+
|
98
|
+
extra_rdoc_files:
|
99
|
+
- LICENSE.txt
|
100
|
+
- README.rdoc
|
101
|
+
files:
|
102
|
+
- Gemfile
|
103
|
+
- LICENSE.txt
|
104
|
+
- README.rdoc
|
105
|
+
- Rakefile
|
106
|
+
- VERSION
|
107
|
+
- bio-isoelectric_point.gemspec
|
108
|
+
- lib/bio-isoelectric_point.rb
|
109
|
+
- lib/isoelectric_point/aa.rb
|
110
|
+
- lib/isoelectric_point/extensions.rb
|
111
|
+
- lib/isoelectric_point/pka_data.rb
|
112
|
+
- test/aa_test.rb
|
113
|
+
- test/extensions_test.rb
|
114
|
+
- test/helper.rb
|
115
|
+
- test/test_bio-isoelectric_point.rb
|
116
|
+
has_rdoc: true
|
117
|
+
homepage: http://github.com/GeorgeG/bioruby-isoelectric_point
|
118
|
+
licenses:
|
119
|
+
- Ruby
|
120
|
+
post_install_message:
|
121
|
+
rdoc_options: []
|
122
|
+
|
123
|
+
require_paths:
|
124
|
+
- lib
|
125
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: -2384793528143520988
|
131
|
+
segments:
|
132
|
+
- 0
|
133
|
+
version: "0"
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
segments:
|
140
|
+
- 0
|
141
|
+
version: "0"
|
142
|
+
requirements: []
|
143
|
+
|
144
|
+
rubyforge_project:
|
145
|
+
rubygems_version: 1.3.7
|
146
|
+
signing_key:
|
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.
|
149
|
+
test_files:
|
150
|
+
- test/aa_test.rb
|
151
|
+
- test/extensions_test.rb
|
152
|
+
- test/helper.rb
|
153
|
+
- test/test_bio-isoelectric_point.rb
|