[BioRuby-cvs] bioruby/lib/bio/appl blast.rb,1.28,1.29
Jan Aerts
aerts at dev.open-bio.org
Tue May 16 09:50:16 UTC 2006
Update of /home/repository/bioruby/bioruby/lib/bio/appl
In directory dev.open-bio.org:/tmp/cvs-serv25476
Modified Files:
blast.rb
Log Message:
Added/reformatted docs.
Index: blast.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/appl/blast.rb,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** blast.rb 18 Feb 2006 16:08:10 -0000 1.28
--- blast.rb 16 May 2006 09:50:13 -0000 1.29
***************
*** 2,29 ****
# = bio/appl/blast.rb - BLAST wrapper
#
! # Copyright:: Copyright (C) 2001
! # Mitsuteru C. Nakao <n at bioruby.org>
! # Copyrigth:: Copyright (C) 2002,2003
! # KATAYAMA Toshiaki <k at bioruby.org>
# License:: Ruby's
#
# $Id$
#
! # = Description
! #
! # = Examples
#
! # program = 'blastp'
! # database = 'SWISS'
! # options = '-e 0.0001'
! # serv = Bio::Blast.new(program, database, options)
! # server = 'genomenet'
! # genomenet = Bio::Blast.remote(program, database, options, server)
! # report = serv.query(sequence_text)
#
# = References
#
# * http://www.ncbi.nlm.nih.gov/blast/
- #
# * http://blast.genome.jp/ideas/ideas.html#blast
#
--- 2,20 ----
# = bio/appl/blast.rb - BLAST wrapper
#
! # Copyright (C):: 2001 Mitsuteru C. Nakao <n at bioruby.org>
! # Copyright (C):: 2002,2003 KATAYAMA Toshiaki <k at bioruby.org>
! # Copyright (C):: 2006 Jan Aerts <jan.aerts at bbsrc.ac.uk>
! #
# License:: Ruby's
#
# $Id$
#
! # = DESCRIPTION
#
! # This file holds the Bio::Blast class, which creates BLAST factories.
#
# = References
#
# * http://www.ncbi.nlm.nih.gov/blast/
# * http://blast.genome.jp/ideas/ideas.html#blast
#
***************
*** 36,72 ****
module Bio
! # BLAST wrapper
#
! # == Description
#
! # A blastall program wrapper.
#
! # == Examples
#
! # program = 'blastp'
! # database = 'SWISS'
! # options = '-e 0.0001'
! # serv = Bio::Blast.new(program, database, options)
! #
! # server = 'genomenet'
! # genomenet = Bio::Blast.remote(program, database, options, server)
! #
! # report = serv.query(sequence_text)
#
! # == Available databases for Blast.remote(@program, @db, option, 'genomenet')
#
! # ----------+-------+---------------------------------------------------
! # @program | query | @db (supported in GenomeNet)
! # ----------+-------+---------------------------------------------------
! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd,
! # ----------+-------+ pir, prf, pdbstr
! # blastx | NA |
! # ----------+-------+---------------------------------------------------
! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss,
! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd,
! # tblastn | AA | genes-nt, genome, vgenes.nuc
! # ----------+-------+---------------------------------------------------
#
! # * See http://blast.genome.jp/ideas/ideas.html#blast for more details.
#
class Blast
--- 27,77 ----
module Bio
! # = DESCRIPTION
! #
! # The Bio::Blast class contains methods for running local or remote BLAST
! # searches, as well as for parsing of the output of such BLASTs (i.e. the
! # BLAST reports). For more information on similarity searches and the BLAST
! # program, see http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html.
#
! # = USAGE
#
! # require 'bio'
! #
! # # To run an actual BLAST analysis:
! # # 1. create a BLAST factory
! # remote_blast_factory = Bio::Blast.remote('blastp', 'SWISS',
! # '-e 0.0001', 'genomenet')
! # #or:
! # local_blast_factory = Bio::Blast.local('blastn','/path/to/db')
#
! # # 2. run the actual BLAST by querying the factory
! # report = remote_blast_factory.query(sequence_text)
#
! # # Then, to parse the report, see Bio::Blast::Report
#
! # == Available databases for Bio::Blast.remote
#
! # ----------+-------+---------------------------------------------------
! # program | query | db (supported in GenomeNet)
! # ----------+-------+---------------------------------------------------
! # blastp | AA | nr-aa, genes, vgenes.pep, swissprot, swissprot-upd,
! # ----------+-------+ pir, prf, pdbstr
! # blastx | NA |
! # ----------+-------+---------------------------------------------------
! # blastn | NA | nr-nt, genbank-nonst, gbnonst-upd, dbest, dbgss,
! # ----------+-------+ htgs, dbsts, embl-nonst, embnonst-upd, epd,
! # tblastn | AA | genes-nt, genome, vgenes.nuc
! # ----------+-------+---------------------------------------------------
#
! # = SEE ALSO
! #
! # * Bio::Blast::Report
! # * Bio::Blast::Report::Hit
! # * Bio::Blast::Report::Hsp
! #
! # = REFERENCE
! #
! # * http://www.ncbi.nlm.nih.gov/Education/BLASTinfo/similarity.html
! # * http://blast.genome.jp/ideas/ideas.html#blast
#
class Blast
***************
*** 80,89 ****
include Bio::Command::Tools
! # Sets up the blast program at the localhost
def self.local(program, db, option = '')
self.new(program, db, option, 'local')
end
! # Sets up the blast program at the remote host (server)
def self.remote(program, db, option = '', server = 'genomenet')
self.new(program, db, option, server)
--- 85,113 ----
include Bio::Command::Tools
! # This is a shortcut for Bio::Blast.new:
! # Bio::Blast.local(program, database, options)
! # is equivalent to
! # Bio::Blast.new(program, database, options, 'local')
! # ---
! # *Arguments*:
! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
! # * _db_ (required): name of the local database
! # * _options_: blastall options \
! # (see http://www.genome.jp/dbget-bin/show_man?blast2)
! # *Returns*:: Bio::Blast factory object
def self.local(program, db, option = '')
self.new(program, db, option, 'local')
end
! # Bio::Blast.remote does exactly the same as Bio::Blast.new, but sets
! # the remote server 'genomenet' as its default.
! # ---
! # *Arguments*:
! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
! # * _db_ (required): name of the remote database
! # * _options_: blastall options \
! # (see http://www.genome.jp/dbget-bin/show_man?blast2)
! # * _server_: server to use (DEFAULT = 'genomenet')
! # *Returns*:: Bio::Blast factory object
def self.remote(program, db, option = '', server = 'genomenet')
self.new(program, db, option, server)
***************
*** 107,120 ****
! # Program name for blastall -p (blastp, blastn, blastx, tblastn or tblastx).
attr_accessor :program
! # Database name for blastall -d
attr_accessor :db
! # Options for blastall
attr_accessor :options
! #
attr_accessor :server
--- 131,145 ----
! # Program name (_-p_ option for blastall): blastp, blastn, blastx, tblastn
! # or tblastx
attr_accessor :program
! # Database name (_-d_ option for blastall)
attr_accessor :db
! # Options for blastall
attr_accessor :options
! # Server to submit the BLASTs to
attr_accessor :server
***************
*** 141,153 ****
! # Returns a blast factory object (Bio::Blast).
! #
! # --- Bio::Blast.new(program, db, option = '', server = 'local')
! # --- Bio::Blast.local(program, db, option = '')
! # --- Bio::Blast.remote(program, db, option = '', server = 'genomenet')
! #
! # For the develpper, you can add server 'hoge' by adding
! # exec_hoge(query) method.
! #
def initialize(program, db, opt = [], server = 'local')
@program = program
--- 166,185 ----
! # Creates a Bio::Blast factory object.
! #
! # To run any BLAST searches, a factory has to be created that describes a
! # certain BLAST pipeline: the program to use, the database to search, any
! # options and the server to use. E.g.
! #
! # blast_factory = Bio::Blast.new('blastn','dbsts', '-e 0.0001 -r 4', 'genomenet')
! #
! # ---
! # *Arguments*:
! # * _program_ (required): 'blastn', 'blastp', 'blastx', 'tblastn' or 'tblastx'
! # * _db_ (required): name of the (local or remote) database
! # * _options_: blastall options \
! # (see http://www.genome.jp/dbget-bin/show_man?blast2)
! # * _server_: server to use (e.g. 'genomenet'; DEFAULT = 'local')
! # *Returns*:: Bio::Blast factory object
def initialize(program, db, opt = [], server = 'local')
@program = program
***************
*** 178,187 ****
end
! # Execute blast search and returns Report object (Bio::Blast::Report).
def query(query)
return self.send("exec_#{@server}", query.to_s)
end
! # option reader
def option
# backward compatibility
--- 210,228 ----
end
! # This method submits a sequence to a BLAST factory, which performs the
! # actual BLAST.
! #
! # fasta_sequences = Bio::FlatFile.open(Bio::FastaFormat, 'my_sequences.fa')
! # report = blast_factory.query(fasta_sequences)
! #
! # ---
! # *Arguments*:
! # * _query_ (required): single- or multiple-FASTA formatted sequence(s)
! # *Returns*:: a Bio::Blast::Report object
def query(query)
return self.send("exec_#{@server}", query.to_s)
end
! # Returns options of blastall
def option
# backward compatibility
***************
*** 189,193 ****
end
! # option setter
def option=(str)
# backward compatibility
--- 230,234 ----
end
! # Set options for blastall
def option=(str)
# backward compatibility
***************
*** 285,303 ****
end # module Bio
-
- if __FILE__ == $0
- begin
- require 'pp'
- alias p pp
- rescue
- end
-
- # serv = Bio::Blast.local('blastn', 'hoge.nuc')
- # serv = Bio::Blast.local('blastp', 'hoge.pep')
- serv = Bio::Blast.remote('blastp', 'genes')
-
- query = ARGF.read
- p serv.query(query)
- end
-
-
--- 326,327 ----
More information about the bioruby-cvs
mailing list