If Metannogen is started with the option "-port=
portnumber" then it may work as a client of
Web pages and application.
The underlying mechanism is that it is listening to the port10117 for incomming commands.
For demonstration, you can start Metannogen by clicking
metannogen.php.
Try the following shell commands.
echo listObjects=R00014 | telnet localhost 10117
or
echo metaboliteStructure=C05125 | telnet localhost 10117
or
echo openOrCreateDataset=R00014 | telnet localhost 10117
MS-Windows When I tested this telnet method under Windows-XP SP2 I found that the telnet command does not work properly.
It allows to enter the command like "listObjects=R00014" manually over the keyboard. But it does not allow piping text from the echo command.
Recommendation: Use a Cygwin shell rather than the CMD.EXE shell.
Emacs:The following Emacs-Lisp lines define three commands for Emacs to open a dataset, to view a metabolite structure and to
open an object in a browsable tree. The commands act on the token under the cursor:
(defun word-under-cursor(&optional delimL delimR)
"The word under the cursor"
(interactive)
(if (search-backward-regexp (or delimL "[^A-Za-z0-9_]") nil t) (forward-char) (beginning-of-buffer))
(setq word-under-cursor-begin (point))
(if (search-forward-regexp (or delimR "[^A-Za-z0-9_]") nil t) (backward-char) (end-of-buffer))
(setq word-under-cursor-end (point))
(buffer-substring word-under-cursor-begin word-under-cursor-end )
)
(defun MetannogenDataset()
(interactive)
(shell-command (concat "echo 'openDataset=" (word-under-cursor) "' | telnet localhost 10117 "))
)
(defun MetannogenMetaboliteStructure()
(interactive)
(shell-command (concat "echo 'metaboliteStructure=" (word-under-cursor "[ \r\t\n]" "[ \r\t\n]" ) "' | telnet localhost 10117 "))
)
(defun MetannogenList()
(interactive)
(shell-command (concat "echo 'listObjects=" (word-under-cursor "[ \r\t\n]" "[ \r\t\n]" ) "' | telnet localhost 10117 "))
)
Above primitive telnet well explains the basics and can be used for testing.
But it does not provide all required functions for inter-app-communication.
The following features may be required: