[BioRuby-cvs] bioruby/lib/bio/shell/plugin keggapi.rb,1.3,1.4
Katayama Toshiaki
k at pub.open-bio.org
Fri Nov 25 11:07:57 EST 2005
Update of /home/repository/bioruby/bioruby/lib/bio/shell/plugin
In directory pub.open-bio.org:/tmp/cvs-serv24669/lib/bio/shell/plugin
Modified Files:
keggapi.rb
Log Message:
* some listing methods (orgs, pathways, dbs) are added
* @keggapi is changed to be accessed as keggapi
Index: keggapi.rb
===================================================================
RCS file: /home/repository/bioruby/bioruby/lib/bio/shell/plugin/keggapi.rb,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** keggapi.rb 14 Nov 2005 02:01:54 -0000 1.3
--- keggapi.rb 25 Nov 2005 16:07:55 -0000 1.4
***************
*** 33,45 ****
private
! def setup_keggapi
unless @keggapi
@keggapi = Bio::KEGG::API.new
end
end
def bfind(str)
! setup_keggapi
! result = @keggapi.bfind(str)
display result
return result
--- 33,61 ----
private
! def keggapi
unless @keggapi
@keggapi = Bio::KEGG::API.new
end
+ return @keggapi
+ end
+
+ def _definition(list)
+ ary = []
+ list.each do |entry|
+ ary << "#{entry.entry_id}:\t#{entry.definition}"
+ end
+ return ary
+ end
+
+ # DBGET
+
+ def binfo(db = "all")
+ result = keggapi.binfo(db)
+ display result
+ return result
end
def bfind(str)
! result = keggapi.bfind(str)
display result
return result
***************
*** 47,70 ****
def bget(str)
! setup_keggapi
! entry = @keggapi.bget(str)
if block_given?
! yield entry
else
! display entry
end
! return entry
end
end
=begin
- --- list_databases
- --- list_organisms
- --- list_pathways(org)
- --- binfo(string)
- --- bfind(string)
- --- bget(string)
- --- btit(string)
--- get_linkdb_by_entry(entry_id, db, start, max_results)
--- get_best_best_neighbors_by_gene(genes_id, start, max_results)
--- 63,136 ----
def bget(str)
! result = keggapi.bget(str)
if block_given?
! yield result
else
! display result
end
! return result
! end
!
! def btit(str)
! result = keggapi.btit(str)
! display result
! return result
! end
!
! def bconv(str)
! result = keggapi.bconv(str)
! display result
! return result
! end
!
! # DATABASES
!
! def keggdbs
! list = keggapi.list_databases
! result = _definition(list).join("\n")
! display result
! return result
! end
!
! def keggorgs
! list = keggapi.list_organisms
! result = _definition(list).sort.join("\n")
! display result
! return result
! end
!
! def keggpathways(org = "map")
! list = keggapi.list_pathways(org)
! result = _definition(list).join("\n")
! display result
! return result
! end
!
! #--
! # *TODO* use kegg das instead?
! #++
! def kegggenome(org)
! result = ""
! require 'net/ftp'
! Net::FTP.open("ftp.genome.jp", "anonymous") do |ftp|
! path = "/pub/kegg/genomes/#{org}"
! list = ftp.nlst(path)
! file = list.grep(/.*genome$/).shift
! if file
! base = File.basename(file)
! ftp.getbinaryfile(file, base)
! result = File.read(base)
! end
! end
! return result
end
+ # def kegggene(genes_id)
+ # keggapi.bget()
+ # end
+
end
=begin
--- get_linkdb_by_entry(entry_id, db, start, max_results)
--- get_best_best_neighbors_by_gene(genes_id, start, max_results)
More information about the bioruby-cvs
mailing list