| Class | Bio::DBGET |
| In: |
lib/bio/io/dbget.rb
|
| Parent: | Object |
Main class method to access DBGET server. Optionally, this method can be called with the alternative DBGET server address and the TCP/IP port number.
‘com’ should be one of the following DBGET commands:
These methods are shortcut for the dbget commands. Actually, Bio::DBGET.((|com|))(arg) internally calls Bio::DBGET.dbget(com, arg). Most of these methods accept the argument "-h" for help.
‘arg’ should be one of the following formats :
Note that options in the above example can be omitted. If ‘arg’ is empty, the help message with a list of options for ‘com’ will be shown by default. Supported database names will be found at the GenomeNet DBGET web page www.genome.jp/dbget/.
# File lib/bio/io/dbget.rb, line 55
55: def DBGET.dbget(com, arg, serv = nil, port = nil)
56:
57: unless serv or port # if both of serv and port are nil
58: if ENV["DBGET"] =~ /:/ # and ENV["DBGET"] exists
59: serv, port = ENV["DBGET"].split(':')
60: end
61: end
62: serv = serv ? serv : SERV
63: port = port ? port : PORT
64:
65: if arg.empty?
66: arg = "-h" # DBGET help message
67: end
68:
69: query = "#{com} #{arg}\n" # DBGET query string
70:
71: sock = TCPSocket.open("#{serv}", "#{port}")
72:
73: sock.write(query) # submit query
74: sock.flush # buffer flush
75:
76: sock.gets # skip "+Helo DBgetServ ..."
77: sock.gets # skip "#If you see this message, ..."
78: sock.gets # skip "*Request-IDent"
79:
80: result = sock.read # DBGET result
81:
82: sock.close
83:
84: return result
85: end
seq("db entry") method retrieves the first sequence of the entry
Shortcut to retrieve the sequence of the entry in FASTA format. This method is equivalent to Bio::DBGET.bget("-f -n 1 #{arg}") and ‘arg’ should be the "db:entry" or "db entry1 entry2 …" format.
# File lib/bio/io/dbget.rb, line 119
119: def DBGET.seq(arg)
120: dbget("bget", "-f -n 1 #{arg}")
121: end
seq2("db entry") method retrieves the second sequence of the entry if any
Shortcut to retrieve the second sequence of the entry in FASTA format. This method is equivalent to Bio::DBGET.bget("-f -n 2 #{arg}"). Only useful when treating the KEGG GENES database entries which have both AASEQ and NTSEQ fields. This method is obsolete and it is recommended to use ‘naseq’ and ‘aaseq’ instead.
# File lib/bio/io/dbget.rb, line 130
130: def DBGET.seq2(arg)
131: dbget("bget", "-f -n 2 #{arg}")
132: end