bio-exportpred 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.2"
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-exportpred
2
+
3
+ ExportPred is a computer program for predicting whether particular Plasmodium falciparum proteins are exported into the red blood cell cytosol during the intraerythrocytic stages. This biogem is a wrapper around the program, so that it can be interacted with programmatically.
4
+
5
+ http://bioinf.wehi.edu.au/exportpred/
6
+
7
+ Example usage:
8
+
9
+ positive_control = 'MAVSTYNNTRRNGLRYVLKRRTILSVFAVICMLSLNLSIFENNNNNYGFHCNKRHFKSLAEASPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETY'
10
+ result = Bio::ExportPred::Wrapper.new.calculate(positive) #=> Bio::ExportPred::Result object
11
+ assert_equal true, result.signal?
12
+ assert result.predicted_rle?
13
+
14
+ == Contributing to bio-exportpred
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-exportpred"
18
+ gem.homepage = "http://github.com/wwood/bioruby-exportpred"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins}
21
+ gem.description = %Q{Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins. Requires local install of the program, which is available from http://bioinf.wehi.edu.au/exportpred/}
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-exportpred #{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,62 @@
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 = "bio-exportpred"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben J Woodcroft"]
12
+ s.date = "2012-01-20"
13
+ s.description = "Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins. Requires local install of the program, which is available from http://bioinf.wehi.edu.au/exportpred/"
14
+ s.email = "donttrustben near gmail.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.mkd"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.mkd",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bio-exportpred.gemspec",
27
+ "lib/bio-exportpred.rb",
28
+ "lib/bio/appl/exportpred.rb",
29
+ "test/helper.rb",
30
+ "test/test_bio-exportpred.rb"
31
+ ]
32
+ s.homepage = "http://github.com/wwood/bioruby-exportpred"
33
+ s.licenses = ["MIT"]
34
+ s.require_paths = ["lib"]
35
+ s.rubygems_version = "1.8.11"
36
+ s.summary = "Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins"
37
+
38
+ if s.respond_to? :specification_version then
39
+ s.specification_version = 3
40
+
41
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
43
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
44
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
45
+ s.add_development_dependency(%q<rcov>, [">= 0"])
46
+ s.add_development_dependency(%q<bio>, [">= 1.4.2"])
47
+ else
48
+ s.add_dependency(%q<shoulda>, [">= 0"])
49
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
51
+ s.add_dependency(%q<rcov>, [">= 0"])
52
+ s.add_dependency(%q<bio>, [">= 1.4.2"])
53
+ end
54
+ else
55
+ s.add_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
57
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
58
+ s.add_dependency(%q<rcov>, [">= 0"])
59
+ s.add_dependency(%q<bio>, [">= 1.4.2"])
60
+ end
61
+ end
62
+
@@ -0,0 +1 @@
1
+ require 'bio/appl/exportpred'
@@ -0,0 +1,87 @@
1
+ require 'open3'
2
+
3
+ module Bio
4
+ class ExportPred
5
+ class Wrapper
6
+ # Use ExportPred called locally to predict whether a protein is exported or
7
+ # not.
8
+ # TODO: better doco here, explain options
9
+ def calculate(sequence, options={})
10
+ command = 'exportpred --input=-'
11
+ #--no-RLE and -r seem to fail when running exportpred on the command line, so here I'll just set the thresholds very high instead
12
+ command = "#{command} --KLD-threshold=99999" if options[:no_KLD]
13
+ command = "#{command} --RLE-threshold=99999" if options[:no_RLE]
14
+
15
+ Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
16
+ stdin.puts '>wrapperSeq'
17
+ stdin.puts "#{sequence}"
18
+ stdin.close
19
+
20
+ result = stdout.readlines
21
+ error = stderr.readlines
22
+
23
+ unless error.length == 1
24
+ raise Exception, "There appears to be a problem while running ExportPred:\n#{error}"
25
+ end
26
+ parse_error = error[0].strip.match(/^(\d+) sequences read from stdin$/)
27
+ unless parse_error[1].to_i == 1
28
+ raise Exception, "There appears to be a problem while running ExportPred, unexpected output form: \n#{error}"
29
+ end
30
+
31
+ # Error checking
32
+ unless [0,1].include?(result.length)
33
+ raise Exception, "Unexpected number of lines found in ExportPred output (#{result.length}:\n#{result}"
34
+ end
35
+
36
+ return Result.create_from_line(result[0], options)
37
+ end
38
+ end
39
+ end
40
+
41
+ class Result
42
+ @@all_result_names = [
43
+ :predicted_rle,
44
+ :predicted_kld,
45
+ :score
46
+ ]
47
+ @@all_result_names.each do |rn|
48
+ attr_accessor rn
49
+ end
50
+
51
+ # Given the STDOUT from the ExportPred program, create a programmatically manipulatable Bio::ExportPred::Result object
52
+ #
53
+ # TODO: explain options={}
54
+ def self.create_from_line(line, options={})
55
+ result = Result.new
56
+ if !line or line == ''
57
+ result.predicted_rle = false unless options[:no_RLE]
58
+ result.predicted_kld = false unless options[:no_KLD]
59
+ return result
60
+ end
61
+
62
+ # line is going to be something like
63
+ # metoo RLE 6.44141 [a-met:M][a-leader:AVSTYNNTRRNGLRYVLKRR][a-hydrophobic:TILSVFAVICMLSL][a-spacer:NLSIFENNNNNYGFHCNKRH][a-RLE:FKSLAEA][a-tail:SPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETYKIPDEYKMRKFKFAHFEMQGYALKQEKFLLEYAFLSLNGKLCERKKFKEVLEYVKREWIEFRKSMFDVWKEKLASEFREHGEMLNQKRKLKQHELDRRAQREKMLEEHSRGIFAKGYLGEVESETIKKKTEHHENVNEDNVEKPKLQQHKVQPPKVQQQKVQPPKSQQQKVQPPKSQQQKVQPPKVQQQKVQPPKVQKPKLQNQKGQKQVSPKAKGNNQAKPTKGNKLKKN]
64
+ splits = line.split("\t")
65
+ raise Exception, "Badly parsed line: #{line}" if splits.length != 4
66
+ if splits[1] == 'RLE'
67
+ result.predicted_rle = true
68
+ elsif splits[1] = 'KLD'
69
+ result.predicted_kld = true
70
+ end
71
+ result.score = splits[2].to_f
72
+ return result
73
+ end
74
+
75
+ def predicted?
76
+ @predicted_rle or @predicted_kld
77
+ end
78
+ alias_method :signal?, :predicted?
79
+ alias_method :predicted_rle?, :predicted_rle
80
+ alias_method :predicted_kld?, :predicted_kld
81
+
82
+ def self.all_result_names
83
+ @@all_result_names
84
+ end
85
+ end
86
+ end
87
+ 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-exportpred'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,48 @@
1
+ require 'helper'
2
+
3
+ class TestBioExportpred < Test::Unit::TestCase
4
+ def test_create_from_line
5
+ # test empty
6
+ line = ''
7
+ r = Bio::ExportPred::Result.create_from_line(line)
8
+ assert r
9
+ assert_kind_of Bio::ExportPred::Result, r
10
+ assert_equal false, r.predicted?
11
+
12
+ line = 'metoo RLE 6.44141 [a-met:M][a-leader:AVSTYNNTRRNGLRYVLKRR][a-hydrophobic:TILSVFAVICMLSL][a-spacer:NLSIFENNNNNYGFHCNKRH][a-RLE:FKSLAEA][a-tail:SPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETYKIPDEYKMRKFKFAHFEMQGYALKQEKFLLEYAFLSLNGKLCERKKFKEVLEYVKREWIEFRKSMFDVWKEKLASEFREHGEMLNQKRKLKQHELDRRAQREKMLEEHSRGIFAKGYLGEVESETIKKKTEHHENVNEDNVEKPKLQQHKVQPPKVQQQKVQPPKSQQQKVQPPKSQQQKVQPPKVQQQKVQPPKVQKPKLQNQKGQKQVSPKAKGNNQAKPTKGNKLKKN]'
13
+ r = Bio::ExportPred::Result.create_from_line(line)
14
+ assert r
15
+ assert_kind_of Bio::ExportPred::Result, r
16
+ assert r.predicted?
17
+ assert_equal 6.44141, r.score
18
+ end
19
+
20
+ def test_create_from_line_options
21
+ # test empty
22
+ line = ''
23
+ r = Bio::ExportPred::Result.create_from_line(line, :no_RLE => true)
24
+ assert r
25
+ assert_kind_of Bio::ExportPred::Result, r
26
+ assert_equal false, r.predicted_kld
27
+ assert_equal nil, r.predicted_rle
28
+ end
29
+
30
+ def test_wrapper_positive
31
+ positive = 'MAVSTYNNTRRNGLRYVLKRRTILSVFAVICMLSLNLSIFENNNNNYGFHCNKRHFKSLAEASPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETY'
32
+ result = Bio::ExportPred::Wrapper.new.calculate(positive)
33
+ assert_equal true, result.signal?
34
+ assert result.predicted_rle?
35
+ end
36
+
37
+ def test_wrapper_negative
38
+ negative = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'
39
+ assert_equal false, Bio::ExportPred::Wrapper.new.calculate(negative).signal?
40
+ end
41
+
42
+ def test_no_rle
43
+ positive = 'MAVSTYNNTRRNGLRYVLKRRTILSVFAVICMLSLNLSIFENNNNNYGFHCNKRHFKSLAEASPEEHNNLRSHSTSDPKKNEEKSLSDEINKCDMKKYTAEEINEMINSSNEFINRNDMNIIFSYVHESEREKFKKVEENIFKFIQSIVETY'
44
+ result = Bio::ExportPred::Wrapper.new.calculate(positive, :no_RLE => true)
45
+ assert_equal nil, result.predicted_rle?
46
+ assert_equal false, result.signal?
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bio-exportpred
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-20 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ requirement: &id001 !ruby/object:Gem::Requirement
22
+ none: false
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ hash: 3
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ version_requirements: *id001
31
+ name: shoulda
32
+ prerelease: false
33
+ type: :development
34
+ - !ruby/object:Gem::Dependency
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ none: false
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ hash: 23
41
+ segments:
42
+ - 1
43
+ - 0
44
+ - 0
45
+ version: 1.0.0
46
+ version_requirements: *id002
47
+ name: bundler
48
+ prerelease: false
49
+ type: :development
50
+ - !ruby/object:Gem::Dependency
51
+ requirement: &id003 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ hash: 7
57
+ segments:
58
+ - 1
59
+ - 6
60
+ - 4
61
+ version: 1.6.4
62
+ version_requirements: *id003
63
+ name: jeweler
64
+ prerelease: false
65
+ type: :development
66
+ - !ruby/object:Gem::Dependency
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ none: false
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ hash: 3
73
+ segments:
74
+ - 0
75
+ version: "0"
76
+ version_requirements: *id004
77
+ name: rcov
78
+ prerelease: false
79
+ type: :development
80
+ - !ruby/object:Gem::Dependency
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ none: false
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 3
87
+ segments:
88
+ - 1
89
+ - 4
90
+ - 2
91
+ version: 1.4.2
92
+ version_requirements: *id005
93
+ name: bio
94
+ prerelease: false
95
+ type: :development
96
+ description: Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins. Requires local install of the program, which is available from http://bioinf.wehi.edu.au/exportpred/
97
+ email: donttrustben near gmail.com
98
+ executables: []
99
+
100
+ extensions: []
101
+
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.mkd
105
+ files:
106
+ - .document
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.mkd
110
+ - Rakefile
111
+ - VERSION
112
+ - bio-exportpred.gemspec
113
+ - lib/bio-exportpred.rb
114
+ - lib/bio/appl/exportpred.rb
115
+ - test/helper.rb
116
+ - test/test_bio-exportpred.rb
117
+ homepage: http://github.com/wwood/bioruby-exportpred
118
+ licenses:
119
+ - MIT
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: 3
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
+ hash: 3
140
+ segments:
141
+ - 0
142
+ version: "0"
143
+ requirements: []
144
+
145
+ rubyforge_project:
146
+ rubygems_version: 1.8.11
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: Wrapper around the ExportPred algorithm for predicting P. falciparum exported proteins
150
+ test_files: []
151
+