bio-signalp 0.2.0 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
+ gem "bio", ">= 1.4.1"
5
6
 
6
7
  # Add dependencies to develop your gem here.
7
8
  # Include everything needed to run rake, tests, features, etc.
@@ -9,6 +10,6 @@ group :development do
9
10
  gem "shoulda", ">= 0"
10
11
  gem "bundler", "~> 1.0.0"
11
12
  gem "jeweler", "~> 1.6.0"
12
- gem "rcov", ">= 0"
13
13
  gem "bio", ">= 1.4.1"
14
+ gem "rdoc", "~> 3.12"
14
15
  end
data/Rakefile CHANGED
@@ -32,14 +32,6 @@ Rake::TestTask.new(:test) do |test|
32
32
  test.verbose = true
33
33
  end
34
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
35
  task :default => :test
44
36
 
45
37
  require 'rake/rdoctask'
@@ -47,7 +39,7 @@ Rake::RDocTask.new do |rdoc|
47
39
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
40
 
49
41
  rdoc.rdoc_dir = 'rdoc'
50
- rdoc.title = "bio-signalp #{version}"
42
+ rdoc.title = "bio-blah #{version}"
51
43
  rdoc.rdoc_files.include('README*')
52
44
  rdoc.rdoc_files.include('lib/**/*.rb')
53
45
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.2
@@ -2,6 +2,9 @@
2
2
 
3
3
  require 'rubygems'
4
4
  require 'bio'
5
+
6
+ # always load from the directory relative to the current script's directory
7
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
5
8
  require 'bio-signalp'
6
9
 
7
10
  # if this was not called as a module, run as a script.
@@ -71,9 +74,11 @@ if $0 == __FILE__
71
74
  ].join("\t")
72
75
  end
73
76
 
74
- Bio::FlatFile.open(ARGV[0]).each do |seq|
77
+ Bio::FlatFile.open(ARGF).each do |seq|
75
78
  result = runner.calculate(seq.seq)
76
- if options['s']
79
+ if result.nil?
80
+ $stderr.puts "Unexpected empty sequence detected, ignoring: #{seq.definition}"
81
+ elsif options['s']
77
82
  puts [
78
83
  seq.entry_id,
79
84
  result.nn_D_prediction ? 'T' : 'F',
@@ -4,15 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{bio-signalp}
8
- s.version = "0.2.0"
7
+ s.name = "bio-signalp"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben J Woodcroft"]
12
- s.date = %q{2012-01-06}
13
- s.default_executable = %q{signalp.rb}
14
- s.description = %q{A wrapper for the signal peptide prediction algorith SignalP. Not very well supported, but seems to work for the author, at least.}
15
- s.email = %q{donttrustben near gmail.com}
12
+ s.date = "2012-03-29"
13
+ s.description = "A wrapper for the signal peptide prediction algorith SignalP. Not very well supported, but seems to work for the author, at least."
14
+ s.email = "donttrustben near gmail.com"
16
15
  s.executables = ["signalp.rb"]
17
16
  s.extra_rdoc_files = [
18
17
  "LICENSE.txt",
@@ -21,7 +20,6 @@ Gem::Specification.new do |s|
21
20
  s.files = [
22
21
  ".document",
23
22
  "Gemfile",
24
- "Gemfile.lock",
25
23
  "LICENSE.txt",
26
24
  "README.rdoc",
27
25
  "Rakefile",
@@ -33,34 +31,37 @@ Gem::Specification.new do |s|
33
31
  "test/helper.rb",
34
32
  "test/test_bio-signalp.rb"
35
33
  ]
36
- s.homepage = %q{http://github.com/wwood/bioruby-signalp}
34
+ s.homepage = "http://github.com/wwood/bioruby-signalp"
37
35
  s.licenses = ["MIT"]
38
36
  s.require_paths = ["lib"]
39
- s.rubygems_version = %q{1.6.1}
40
- s.summary = %q{A wrapper for the signal peptide prediction algorith SignalP}
37
+ s.rubygems_version = "1.8.17"
38
+ s.summary = "A wrapper for the signal peptide prediction algorith SignalP"
41
39
 
42
40
  if s.respond_to? :specification_version then
43
41
  s.specification_version = 3
44
42
 
45
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
44
+ s.add_runtime_dependency(%q<bio>, [">= 1.4.1"])
46
45
  s.add_development_dependency(%q<shoulda>, [">= 0"])
47
46
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
47
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
49
- s.add_development_dependency(%q<rcov>, [">= 0"])
50
48
  s.add_development_dependency(%q<bio>, [">= 1.4.1"])
49
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
51
50
  else
51
+ s.add_dependency(%q<bio>, [">= 1.4.1"])
52
52
  s.add_dependency(%q<shoulda>, [">= 0"])
53
53
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
54
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
55
- s.add_dependency(%q<rcov>, [">= 0"])
56
55
  s.add_dependency(%q<bio>, [">= 1.4.1"])
56
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
57
57
  end
58
58
  else
59
+ s.add_dependency(%q<bio>, [">= 1.4.1"])
59
60
  s.add_dependency(%q<shoulda>, [">= 0"])
60
61
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
62
  s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
62
- s.add_dependency(%q<rcov>, [">= 0"])
63
63
  s.add_dependency(%q<bio>, [">= 1.4.1"])
64
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
64
65
  end
65
66
  end
66
67
 
@@ -9,7 +9,11 @@ module Bio
9
9
  class Wrapper
10
10
  # Given an amino acid sequence, return a SignalPResult
11
11
  # representing it taken from the file.
12
+ #
13
+ # Returns nil if the sequence is empty
12
14
  def calculate(sequence)
15
+ return nil if sequence.nil? or sequence == ''
16
+
13
17
  command = 'signalp -trunc 70 -format short -t euk'
14
18
  Open3.popen3(command) do |stdin, stdout, stderr, wait_thr|
15
19
  stdin.puts '>wrapperSeq'
@@ -1,17 +1,57 @@
1
1
  require 'helper'
2
+ require 'open3'
2
3
 
3
4
  class TestBioSignalp < Test::Unit::TestCase
4
5
  should "positive control" do
5
- # Known to have a signal peptide
6
+ # Known to have a signal peptide
6
7
  acp_sequence = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'
7
-
8
+
8
9
  assert_equal true, Bio::SignalP::Wrapper.new.calculate(acp_sequence).signal?
9
10
  end
10
-
11
+
11
12
  should "negative control" do
12
- # Known to have a signal peptide
13
+ # Known to have a signal peptide
13
14
  non_signal_sequence = 'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK'
14
-
15
+
15
16
  assert_equal false, Bio::SignalP::Wrapper.new.calculate(non_signal_sequence).signal?
16
17
  end
17
18
  end
19
+
20
+ class TestSignalPScript < Test::Unit::TestCase
21
+ command = File.join(File.dirname(__FILE__),'..','bin','signalp.rb')
22
+
23
+ should "positive control" do
24
+ # Known to have a signal peptide
25
+ acp_sequence = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'
26
+
27
+ Open3.popen3(command) do |stdin, stdout, stderr|
28
+ stdin.puts '>positive'
29
+ stdin.puts acp_sequence
30
+ stdin.close
31
+
32
+ @result = stdout.readlines # convert to string?
33
+ @error = stderr.readlines
34
+ end
35
+ assert_equal [">positive\n", "FKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ\n"], @result
36
+ assert_equal [], @error
37
+ end
38
+
39
+ should "return gracefully when empty sequences are given" do
40
+ acp_sequence = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'
41
+
42
+ Open3.popen3(command) do |stdin, stdout, stderr|
43
+ stdin.puts '>positive'
44
+ stdin.puts acp_sequence
45
+ stdin.puts '>empty'
46
+ stdin.puts '>positive2'
47
+ stdin.puts acp_sequence
48
+ stdin.close
49
+
50
+ @result = stdout.readlines # convert to string?
51
+ @error = stderr.readlines
52
+ end
53
+ assert_equal [">positive\n", "FKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ\n",
54
+ ">positive2\n", "FKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ\n"], @result
55
+ assert_equal ["Unexpected empty sequence detected, ignoring: empty\n"], @error
56
+ end
57
+ end
metadata CHANGED
@@ -1,112 +1,94 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bio-signalp
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.2
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Ben J Woodcroft
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-01-06 00:00:00 +11:00
19
- default_executable: signalp.rb
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- type: :development
23
- requirement: &id001 !ruby/object:Gem::Requirement
12
+ date: 2012-03-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bio
16
+ requirement: &68905280 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 3
29
- segments:
30
- - 0
31
- version: "0"
32
- version_requirements: *id001
33
- name: shoulda
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 1.4.1
22
+ type: :runtime
34
23
  prerelease: false
35
- - !ruby/object:Gem::Dependency
24
+ version_requirements: *68905280
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ requirement: &68904090 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
36
33
  type: :development
37
- requirement: &id002 !ruby/object:Gem::Requirement
34
+ prerelease: false
35
+ version_requirements: *68904090
36
+ - !ruby/object:Gem::Dependency
37
+ name: bundler
38
+ requirement: &68962450 !ruby/object:Gem::Requirement
38
39
  none: false
39
- requirements:
40
+ requirements:
40
41
  - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 23
43
- segments:
44
- - 1
45
- - 0
46
- - 0
42
+ - !ruby/object:Gem::Version
47
43
  version: 1.0.0
48
- version_requirements: *id002
49
- name: bundler
50
- prerelease: false
51
- - !ruby/object:Gem::Dependency
52
44
  type: :development
53
- requirement: &id003 !ruby/object:Gem::Requirement
45
+ prerelease: false
46
+ version_requirements: *68962450
47
+ - !ruby/object:Gem::Dependency
48
+ name: jeweler
49
+ requirement: &68960950 !ruby/object:Gem::Requirement
54
50
  none: false
55
- requirements:
51
+ requirements:
56
52
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 15
59
- segments:
60
- - 1
61
- - 6
62
- - 0
53
+ - !ruby/object:Gem::Version
63
54
  version: 1.6.0
64
- version_requirements: *id003
65
- name: jeweler
66
- prerelease: false
67
- - !ruby/object:Gem::Dependency
68
55
  type: :development
69
- requirement: &id004 !ruby/object:Gem::Requirement
70
- none: false
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 0
77
- version: "0"
78
- version_requirements: *id004
79
- name: rcov
80
56
  prerelease: false
81
- - !ruby/object:Gem::Dependency
82
- type: :development
83
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *68960950
58
+ - !ruby/object:Gem::Dependency
59
+ name: bio
60
+ requirement: &68958790 !ruby/object:Gem::Requirement
84
61
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 5
89
- segments:
90
- - 1
91
- - 4
92
- - 1
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
93
65
  version: 1.4.1
94
- version_requirements: *id005
95
- name: bio
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *68958790
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &68994130 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '3.12'
77
+ type: :development
96
78
  prerelease: false
97
- description: A wrapper for the signal peptide prediction algorith SignalP. Not very well supported, but seems to work for the author, at least.
79
+ version_requirements: *68994130
80
+ description: A wrapper for the signal peptide prediction algorith SignalP. Not very
81
+ well supported, but seems to work for the author, at least.
98
82
  email: donttrustben near gmail.com
99
- executables:
83
+ executables:
100
84
  - signalp.rb
101
85
  extensions: []
102
-
103
- extra_rdoc_files:
86
+ extra_rdoc_files:
104
87
  - LICENSE.txt
105
88
  - README.rdoc
106
- files:
89
+ files:
107
90
  - .document
108
91
  - Gemfile
109
- - Gemfile.lock
110
92
  - LICENSE.txt
111
93
  - README.rdoc
112
94
  - Rakefile
@@ -117,39 +99,32 @@ files:
117
99
  - lib/bio/appl/signalp.rb
118
100
  - test/helper.rb
119
101
  - test/test_bio-signalp.rb
120
- has_rdoc: true
121
102
  homepage: http://github.com/wwood/bioruby-signalp
122
- licenses:
103
+ licenses:
123
104
  - MIT
124
105
  post_install_message:
125
106
  rdoc_options: []
126
-
127
- require_paths:
107
+ require_paths:
128
108
  - lib
129
- required_ruby_version: !ruby/object:Gem::Requirement
109
+ required_ruby_version: !ruby/object:Gem::Requirement
130
110
  none: false
131
- requirements:
132
- - - ">="
133
- - !ruby/object:Gem::Version
134
- hash: 3
135
- segments:
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
114
+ version: '0'
115
+ segments:
136
116
  - 0
137
- version: "0"
138
- required_rubygems_version: !ruby/object:Gem::Requirement
117
+ hash: -84068147
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
119
  none: false
140
- requirements:
141
- - - ">="
142
- - !ruby/object:Gem::Version
143
- hash: 3
144
- segments:
145
- - 0
146
- version: "0"
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
147
124
  requirements: []
148
-
149
125
  rubyforge_project:
150
- rubygems_version: 1.6.1
126
+ rubygems_version: 1.8.17
151
127
  signing_key:
152
128
  specification_version: 3
153
129
  summary: A wrapper for the signal peptide prediction algorith SignalP
154
130
  test_files: []
155
-
@@ -1,22 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- bio (1.4.1)
5
- git (1.2.5)
6
- jeweler (1.6.4)
7
- bundler (~> 1.0)
8
- git (>= 1.2.5)
9
- rake
10
- rake (0.9.2)
11
- rcov (0.9.9)
12
- shoulda (2.11.3)
13
-
14
- PLATFORMS
15
- ruby
16
-
17
- DEPENDENCIES
18
- bio (>= 1.4.1)
19
- bundler (~> 1.0.0)
20
- jeweler (~> 1.6.0)
21
- rcov
22
- shoulda