Example #1
0
 def add_canvas(self, proxy_widget, dom_element_ref, 
         width=None, height=None, x=0, y=0, entropy=True, 
         dwidth=30, dheight=40, ylabel=None):
     from jp_gene_viz import js_context
     js_context.load_if_not_loaded(["sequence_motifs.js"])
     columns = self.json_columns(entropy=entropy)
     (ncolumns, nrows) = self.frequency_sequence.shape
     if width is None:
         width = ncolumns * dwidth
     if height is None:
         height = nrows * dheight
     w = proxy_widget
     elt = dom_element_ref
     canvas_tag = '<canvas width="%s" height="%s"/>' % (
         int(width + x * 2), int(height + y * 2))
     options = {
         "x": x,
         "y": y,
     }
     if ylabel is not None:
         options["ylabel"] = ylabel
     else:
         if not entropy:
             options["ylabel"] = "probability"
         else:
             options["ylabel"] = "bits"
             options["yMaximumDefault"] = 2.0
     jQuery = w.window().jQuery
     new_canvas = jQuery(canvas_tag)
     w(elt.append(new_canvas.sequence_motif(width, height, columns, options)))
     w.flush()
     return w
Example #2
0
def initialize(loaded=[False]):
    if not loaded[0]:
        print "loading javascript"
        js_context.load_if_not_loaded(["three.js"])
        js_context.load_if_not_loaded(["three_curve.js"])
        js_proxy.load_javascript_support()
    loaded[0] = True
Example #3
0
def initialize(loaded=[False]):
    if not loaded[0]:
        print "loading javascript"
        js_context.load_if_not_loaded(["three.js"])
        js_context.load_if_not_loaded(["three_curve.js"])
        js_proxy.load_javascript_support()
    loaded[0] = True
Example #4
0
 def __init__(self, *pargs, **kwargs):
     super(ScatterPlot3D, self).__init__(*pargs, **kwargs)
     js_context.load_if_not_loaded(["three_scatter.js"])
     js_context.load_if_not_loaded(["three_rotator.js"])
     js_context.load_if_not_loaded(["TextGeometry.js"])
     js_context.load_if_not_loaded(["three_simple_text.js"])
     js_proxy.load_javascript_support()
     self.series_list = []
Example #5
0
 def __init__(self, *pargs, **kwargs):
     super(ScatterPlot3D, self).__init__(*pargs, **kwargs)
     js_context.load_if_not_loaded(["three_scatter.js"])
     js_context.load_if_not_loaded(["three_rotator.js"])
     js_context.load_if_not_loaded(["TextGeometry.js"])
     js_context.load_if_not_loaded(["three_simple_text.js"])
     js_proxy.load_javascript_support()
     self.series_list = []
Example #6
0
    def __init__(self,
                 message="Choose file",
                 root=".",
                 files=True,
                 folders=False,
                 upload=False,
                 dialog=True,
                 width=500,
                 *args,
                 **kwargs):
        """
        FileChooser constructor.

        Parameters
        ----------
        message : str 
            Message near the top of the widget as a prompt.
        root : str
            The root path for the top folder to display.
        files : bool
            Make non-folders selectable iff true.
        folders : bool
            Show folders iff true.
        upload : bool
            Enable file upload iff true.
        dialog : bool
            Show in a jQueryUI dialog iff true, else inline.
        width : int
            Width of widget in pixels.
        """
        super(FileChooser, self).__init__(*args, **kwargs)
        js_context.load_if_not_loaded(["simple_upload_button.js"])
        js_context.load_if_not_loaded(["server_file_chooser.js"])
        self.root = root
        self.upload = upload
        self.files = files
        self.folders = folders
        self.dialog = dialog
        self.message = message
        self.width = width
        self.widget = js_proxy.ProxyWidget()
        self.layout([self.root])
Example #7
0
 def add_canvas(self,
                proxy_widget,
                dom_element_ref,
                width=None,
                height=None,
                x=0,
                y=0,
                entropy=True,
                dwidth=30,
                dheight=40,
                ylabel=None):
     from jp_gene_viz import js_context
     js_context.load_if_not_loaded(["sequence_motifs.js"])
     columns = self.json_columns(entropy=entropy)
     (ncolumns, nrows) = self.frequency_sequence.shape
     if width is None:
         width = ncolumns * dwidth
     if height is None:
         height = nrows * dheight
     w = proxy_widget
     elt = dom_element_ref
     canvas_tag = '<canvas width="%s" height="%s"/>' % (int(width + x * 2),
                                                        int(height + y * 2))
     options = {
         "x": x,
         "y": y,
     }
     if ylabel is not None:
         options["ylabel"] = ylabel
     else:
         if not entropy:
             options["ylabel"] = "probability"
         else:
             options["ylabel"] = "bits"
             options["yMaximumDefault"] = 2.0
     jQuery = w.window().jQuery
     new_canvas = jQuery(canvas_tag)
     w(
         elt.append(
             new_canvas.sequence_motif(width, height, columns, options)))
     w.flush()
     return w
Example #8
0
def initialize():
    print "loading javascript"
    js_proxy.load_javascript_support()
    js_context.load_if_not_loaded(["three.js"])
    js_context.load_if_not_loaded(["FontUtils.js"])
    #time.sleep(0.1)
    #display(HTML(load_font))
    js_context.load_if_not_loaded(["helvetiker_regular.typeface.js"])
    def __init__(self, message="Choose file",
        root=".", files=True, folders=False, upload=False, 
        dialog=True, width=500,
        *args, **kwargs):
        """
        FileChooser constructor.

        Parameters
        ----------
        message : str 
            Message near the top of the widget as a prompt.
        root : str
            The root path for the top folder to display.
        files : bool
            Make non-folders selectable iff true.
        folders : bool
            Show folders iff true.
        upload : bool
            Enable file upload iff true.
        dialog : bool
            Show in a jQueryUI dialog iff true, else inline.
        width : int
            Width of widget in pixels.
        """
        super(FileChooser, self).__init__(*args, **kwargs)
        js_context.load_if_not_loaded(["simple_upload_button.js"])
        js_context.load_if_not_loaded(["server_file_chooser.js"])
        self.root = root
        self.upload = upload
        self.files = files
        self.folders = folders
        self.dialog = dialog
        self.message = message
        self.width = width
        self.widget = js_proxy.ProxyWidget()
        self.layout([self.root])
Example #10
0
def load_javascript_support(verbose=False):
    js_context.load_if_not_loaded(["js_proxy.js"])
Example #11
0
def load_javascript_support(verbose=False):
    js_context.load_if_not_loaded(["js_proxy.js"])
Example #12
0
def load_javascript_support(verbose=False):
    """
    Install javascript support required for this module into the notebook.
    """
    js_context.load_if_not_loaded(["cytoscape.js", "jp_cytoscape.js"], verbose=verbose)
Example #13
0
def init():
    for (library, dependency) in JS_LIBRARIES:
        js_context.load_if_not_loaded([library], local=False)
    js_proxy.load_javascript_support()
def initialize():
    js_context.load_if_not_loaded(["cytoscape.js"])
    js_proxy.load_javascript_support()
    color_widget.load_javascript_support()
Example #15
0
def load_javascript_support(verbose=False):
    """
    Install javascript support required for this module into the notebook.
    """
    js_context.load_if_not_loaded(["cytoscape.js", "jp_cytoscape.js"],
                                  verbose=verbose)
Example #16
0
def initialize():
    js_context.load_if_not_loaded(["cytoscape.js"])
    js_proxy.load_javascript_support()
    color_widget.load_javascript_support()