# Welcome!
These are some brief notes on the inaugural use of https://jupyter.org at an OME event.
The examples mentioned below use the [Image Data Resource (IDR)](https://idr.openmicroscopy.org) as a source of realistically (over-)large data with an open license. Migrating the examples to work with your own server should not pose any difficulty, though you might not have the necessary metadata and data types for some examples. 

Welcome!

These are some brief notes on the inaugural use of https://jupyter.org at an OME event.

The examples mentioned below use the Image Data Resource (IDR) as a source of realistically (over-)large data with an open license. Migrating the examples to work with your own server should not pose any difficulty, though you might not have the necessary metadata and data types for some examples.

 
## 5 minute Jupyter Quick Start

5 minute Jupyter Quick Start

 
<img src="./jupyter_login.png" width="20%" style="float: left"/>
Before anything else, if you haven't been added to https://github.com/idr-contrib, please raise your hand now. You will need to be added to this organization in order to login.
----
If you've already been through this once, help your neighbor.
If you'd prefer not to login, you can follow along on [nbviewer](https://nbviewer.jupyter.org/github/idr/idr-notebooks/tree/master/).
If you are waiting on someone to add you, you might browse through the [available notebooks](https://github.com/IDR/idr-notebooks).
We'll know when you are successful in that you can click on "Start Server":
![jupyter start](./jupyter_start.png)

Before anything else, if you haven't been added to https://github.com/idr-contrib, please raise your hand now. You will need to be added to this organization in order to login.


If you've already been through this once, help your neighbor.

If you'd prefer not to login, you can follow along on nbviewer.

If you are waiting on someone to add you, you might browse through the available notebooks.

We'll know when you are successful in that you can click on "Start Server":

jupyter start

 
### What is Jupyter?
There are countless [online resources](https://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/) but very briefly:
 * _Jupyter_ runs on a server and provides the ability to remotely edit and run code.
 * Code is typically stored in a _notebook_, along with comments and results.
 * You can interactively change the code and re-run it, all **without installing anything**.

What is Jupyter?

There are countless online resources but very briefly:

  • Jupyter runs on a server and provides the ability to remotely edit and run code.
  • Code is typically stored in a notebook, along with comments and results.
  • You can interactively change the code and re-run it, all without installing anything.
In [1]:
print [chr(x) for x in range(65, 68)]
['A', 'B', 'C']
In [2]:
 
2 ** 10
# Last values are printed
Out[2]:
1024
 
### Is that it?
Well, things can get more complicated...

Is that it?

Well, things can get more complicated...

In [3]:
 
%%javascript
// for example crazy stuff like embedding Javascript
var kernel = Jupyter.notebook.kernel;
var url = window.location.href
var command = "url = " + "'"+url+"'";
kernel.execute(command);
In [4]:
 
# But by default, Jupyter assumes Python
# (This method will show up a few times in this intro)
def embed_or_show(path, image):
    """
    Embed with a website or show an image depending on the URL
    """
    if "jupyter.openmicroscopy.org" in url:
        from IPython.display import IFrame
        return IFrame('https://jupyter.openmicroscopy.org/jupyter/user/x/%s' % path, 800, 350)
    else:
        from IPython.display import HTML
        return HTML('<img src="https://github.com/joshmoore/ome2017-notebooks/raw/master/%s"/>' % image)
In [5]:
 
embed_or_show("/tree/#notebooks", "jupyter_files.png")
Out[5]:
 
### Why can't I save any files??
The `notebooks/` directory is a copy of what's under https://github.com/idr/idr-notebooks. You will need to put any files you'd like to edit under `scratch/`. The "easiest" way of doing this, unfortunately, is using the Terminal.

Why can't I save any files??

The notebooks/ directory is a copy of what's under https://github.com/idr/idr-notebooks. You will need to put any files you'd like to edit under scratch/. The "easiest" way of doing this, unfortunately, is using the Terminal.

In [6]:
 
embed_or_show("/tree/#running", "jupyter_running.png")
Out[6]:
xxxxxxxxxx
 
### What server? Where??
There are two Jupyter servers running which may lead to some confusion:
<img alt="architecture" src="https://github.com/joshmoore/ome2017-notebooks/raw/1806a874806a61b76e268cf9f0bb9c2724a5db94/servers.png" width="80%"/>
#### **https://jupyter.openmicroscopy.org/jupyter**
   * The **development** OME Jupyter instance.
   * Specially configured for OME2017 to re-use `idr-contrib`
   * Use this *during* OME2017.
   * Data available under http://ome2017.openmicroscopy.org
#### **https://idr.openmicroscopy.org/jupyter**
   * The **production** IDR Jupyter instance (also known as the Virtual Analysis Environment, VAE)
   * Talks to an **OMERO 5.2** server running at EBI. (Not accessible otherwise)
   * Use this *after* OME2017 now that you're a member of `idr-contrib`.
   * Data available under https://idr.openmicroscopy.org

What server? Where??

There are two Jupyter servers running which may lead to some confusion:

architecture

https://jupyter.openmicroscopy.org/jupyter

  • The development OME Jupyter instance.
  • Specially configured for OME2017 to re-use idr-contrib
  • Use this during OME2017.
  • Data available under http://ome2017.openmicroscopy.org

https://idr.openmicroscopy.org/jupyter

  • The production IDR Jupyter instance (also known as the Virtual Analysis Environment, VAE)
  • Talks to an OMERO 5.2 server running at EBI. (Not accessible otherwise)
  • Use this after OME2017 now that you're a member of idr-contrib.
  • Data available under https://idr.openmicroscopy.org
In [7]:
 
from idr import connection
conn = connection()
try:
    print "Number of screens:", len(list(conn.getObjects("Screen")))
except:
    conn.close()
Connected to IDR...
Number of screens: 35
 
### Anything else?
 * Don't hesitate to try things out.
 * You might start with README.ipynb when you have a moment.
 * Suggestions welcome.

Anything else?

  • Don't hesitate to try things out.
  • You might start with README.ipynb when you have a moment.
  • Suggestions welcome.
 
----
# Now for the fun part!

Now for the fun part!

 
## First session: IDR Annotations Tour (Round 1, Room 3)
Notebooks:
 * [IDR_API_example_script.ipynb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/IDR_API_example_script.ipynb)
 * [GenesToPhenotypes.ipynb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/GenesToPhenotypes.ipynb)
 * [GeneNetwork.ipynb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/GeneNetwork.ipynb)

First session: IDR Annotations Tour (Round 1, Room 3)

Notebooks:

 
## Second session: Analyzing Data in OMERO (Round 3, Room 2)
Notebooks:
 * Balaji: 2 intensity-based notebooks: [CalculateSharpness.ipynb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/CalculateSharpness.ipynb) and [CreateOmeroFigures.ipnyb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/CreateOmeroFigures.ipynb)
 * Balaji: a morphology-based notebook, [SysgroRoiLength.ipnyb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/SysgroRoiLength.ipynb)
 * Dominik:  [CondensationBulkAnnotations.R.ipynb](https://nbviewer.jupyter.org/github/idr/idr-notebooks/blob/master/notebooks/CondensationBulkAnnotations.R.ipynb) (R debut!)

Second session: Analyzing Data in OMERO (Round 3, Room 2)

Notebooks:

 
## Extra points if there's time
<!--
 * build your own
 * similarity (from presentation)
 * linkedness of everything
 -->

Extra points if there's time