[IPython-dev] Selecting data via http requests (event loop question?)
Mark Voorhies
mark.voorhies at ucsf.edu
Fri May 23 13:03:49 EDT 2014
That works beautifully -- thanks!
I wound up using RequestHandler.initialize to pass the plot and underlying data via:
application = tornado.web.Application([(r"/(.*)", MainHandler, {"genome":self.genome,"ax":self.fig.axes[0],"fig":self.fig})])
and forcing a refresh of the plot via display(fig) (fig.show() doesn't appear to be sufficient, but I haven't really pushed it)
Now, if you'll excuse me, I'm off to xkcd 478 everything =)
--Mark
On 05/22/2014 07:26 PM, MinRK wrote:
> Since the IPython kernel uses the tornado eventloop, so you can register
> handlers with tornado’s own HTTPServer, which will automatically be
> integrated into the already running loop.
>
> Here’s an example <https://gist.github.com/minrk/e30b33abeee31bc4b7c7> of
> registering a simple handler, from another recent question about hooking up
> a webserver in a kernel.
>
> -MinRK
>
>
>
> On Thu, May 22, 2014 at 11:45 AM, Mark Voorhies <mark.voorhies at ucsf.edu>wrote:
>
>> A lot of visualization tools for genomic data can emit an http request in
>> response to selecting a gene
>> (e.g., JavaTreeView and MeV (expression profiles and other
>> matrix/dendrogram data),
>> MochiView (deep sequencing and other genome position vs. scalar
>> data),
>> CytoScape (large network data -- interactive and scales better
>> than GraphViz))
>>
>> I am generating related, non-inlined plots in an IPython session and would
>> like to update selections
>> on these plots in response to selections in the external programs.
>>
>> A naive approach would be to listen for the HTTP requests using something
>> based on BaseHTTPServer from the standard library;
>> for this case, is there a straightforward way to include the server's
>> polling loop in the kernel's event loop
>> (e.g., something analogous to what's done for GUI event loops)?
>>
>> Alternatively, is there a way to hook into Tornado directly, or is there a
>> better approach that I'm not thinking of?
>>
>> Thanks in advance for any advice,
>>
>> Mark
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>
>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
More information about the IPython-dev
mailing list