Skip to content

Commit

Permalink
executable: use ARGF instead of ARGV[0]
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben J. Woodcroft committed Mar 29, 2012
1 parent 48d025d commit 1026d1e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 38 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ group :development do
gem "shoulda", ">= 0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.6.0"
gem "rcov", ">= 0"
gem "bio", ">= 1.4.1"
gem "rdoc", "~> 3.12"
end
22 changes: 0 additions & 22 deletions Gemfile.lock

This file was deleted.

10 changes: 1 addition & 9 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,14 @@ Rake::TestTask.new(:test) do |test|
test.verbose = true
end

require 'rcov/rcovtask'
Rcov::RcovTask.new do |test|
test.libs << 'test'
test.pattern = 'test/**/test_*.rb'
test.verbose = true
test.rcov_opts << '--exclude "gems/*"'
end

task :default => :test

require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""

rdoc.rdoc_dir = 'rdoc'
rdoc.title = "bio-signalp #{version}"
rdoc.title = "bio-blah #{version}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
2 changes: 1 addition & 1 deletion bin/signalp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
].join("\t")
end

Bio::FlatFile.open(ARGV[0]).each do |seq|
Bio::FlatFile.open(ARGF).each do |seq|
result = runner.calculate(seq.seq)
if options['s']
puts [
Expand Down
32 changes: 27 additions & 5 deletions test/test_bio-signalp.rb
Original file line number Diff line number Diff line change
@@ -1,17 +1,39 @@
require 'helper'
require 'open3'

class TestBioSignalp < Test::Unit::TestCase
should "positive control" do
# Known to have a signal peptide
# Known to have a signal peptide
acp_sequence = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'

assert_equal true, Bio::SignalP::Wrapper.new.calculate(acp_sequence).signal?
end

should "negative control" do
# Known to have a signal peptide
# Known to have a signal peptide
non_signal_sequence = 'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK'

assert_equal false, Bio::SignalP::Wrapper.new.calculate(non_signal_sequence).signal?
end
end

class TestSignalPScript < Test::Unit::TestCase
should "positive control" do
# Known to have a signal peptide
acp_sequence = 'MKILLLCIIFLYYVNAFKNTQKDGVSLQILKKKRSNQVNFLNRKNDYNLIKNKNPSSSLKSTFDDIKKIISKQLSVEEDKIQMNSNFTKDLGADSLDLVELIMALEEKFNVTISDQDALKINTVQDAIDYIEKNNKQ'

command = "RUBYLIB="+
File.join(File.dirname(__FILE__),'..','lib')+' '+
File.join(File.dirname(__FILE__),'..','bin','signalp.rb')
Open3.popen3(command) do |stdin, stdout, stderr|
stdin.puts '>positive'
stdin.puts acp_sequence
stdin.close

@result = stdout.readlines # convert to string?
@error = stderr.readlines
end
p @result
p @error
end
end

0 comments on commit 1026d1e

Please sign in to comment.