[BioRuby-cvs] bioruby/lib/bio/io fastacmd.rb,1.6,1.7
Naohisa Goto
ngoto at pub.open-bio.org
Tue Aug 16 06:25:31 EDT 2005
Update of /home/repository/bioruby/bioruby/lib/bio/io
In directory pub.open-bio.org:/tmp/cvs-serv9033/lib/bio/io
Modified Files:
fastacmd.rb
Log Message:
* lib/bio/command.rb
Newly added Bio::Command::Tools module.
Bio::Command::Tools is a collection of useful methods
for execution of external commands.
* lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb,
lib/bio/appl/hmmer.rb, lib/bio/io/fastacmd.rb
For security reason, shell special characters are escaped.
* lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb, lib/bio/appl/hmmer.rb
Options are stored with an array (@options).
#options and #opions= methods are added.
* lib/bio/appl/blast.rb, lib/bio/appl/fasta.rb
Bio::Blast.remote and Bio::Fasta.remote did not work
due to the change of the GenomeNet.
Index: fastacmd.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/io/fastacmd.rb,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** fastacmd.rb 10 Aug 2005 12:55:06 -0000 1.6
--- fastacmd.rb 16 Aug 2005 09:38:34 -0000 1.7
***************
*** 24,28 ****
require 'bio/db/fasta'
require 'bio/io/flatfile'
! require 'open3'
module Bio
--- 24,28 ----
require 'bio/db/fasta'
require 'bio/io/flatfile'
! require 'bio/command'
module Bio
***************
*** 32,35 ****
--- 32,36 ----
include Enumerable
+ include Bio::Command::Tools
def initialize(db)
***************
*** 52,95 ****
end
! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb
! cmd = "#{@fastacmd} -d #{@database} -s #{entry_id}"
! IO.popen(cmd, "r") do |io|
! io.sync = true
! results = Bio::FlatFile.new(Bio::FastaFormat, io).to_a
! end
! else
! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ]
! Open3.popen3(*cmd) do |inn, out, err|
! inn.close
! t = Thread.start { @errorlog = err.read }
! results = Bio::FlatFile.new(Bio::FastaFormat, out).to_a
! t.join
! results
! end
end
end
def each_entry
! if RUBY_PLATFORM[/mswin32|bccwin32/] # replace with appl/factory.rb
! cmd = "#{@fastacmd} -d #{@database} -D T"
! IO.popen(cmd, "r") do |io|
! io.sync = true
! Bio::FlatFile.open(Bio::FastaFormat, io) do |f|
! f.each_entry do |e|
! yield e
! end
! end
! end
! else
! cmd = [ @fastacmd, '-d', @database, '-D', 'T' ]
! Open3.popen3(*cmd) do |inn, out, err|
! inn.close
! t = Thread.start { @errorlog = err.read }
! Bio::FlatFile.open(Bio::FastaFormat, out) do |f|
! f.each_entry do |e|
! yield e
! end
end
- t.join
end
end
--- 53,71 ----
end
! cmd = [ @fastacmd, '-d', @database, '-s', entry_id ]
! call_command_local(cmd) do |inn, out|
! inn.close_write
! Bio::FlatFile.new(Bio::FastaFormat, out).to_a
end
end
def each_entry
! cmd = [ @fastacmd, '-d', @database, '-D', 'T' ]
! call_command_local(cmd) do |inn, out|
! inn.close_write
! Bio::FlatFile.open(Bio::FastaFormat, out) do |f|
! f.each_entry do |e|
! yield e
end
end
end
More information about the bioruby-cvs
mailing list