One Codex has implemented Jupyter notebooks, to allow you to generate more complicated analyses, plots, and statistics for your data. But we know that the Jupyter Notebook environment may not be familiar for many of you, so in this article, we'll walk you through the core concepts, and how to create and run your own notebooks. To learn more about Python, or the types of things you can do with your data, take a look at some of the articles at the bottom of this page.
You can access Notebooks from the left panel (1). If this is your first time on this page, you can create a new notebook with the click of a button (2). All of your notebooks will be shown on this page (3). You can launch one at a time, but save as many as you like. We provide up to 4GB of RAM per notebook, which should be sufficient to do most of the analyses that you will need. By default, these notebooks are sorted by the most-recently run (4), but you can sort by creation date, or name, and search notebook names.
Edit Notebook Metadata
You'll see an "Edit" button for each notebook. This allows you to modify the metadata for that notebook.
This page gives you the option to change the name, switch version, and add a description to make it easier to know what's inside the notebook without having to launch it.
You can also delete the notebook from here. The "Copy" button does what you think! It creates a copy! This can be very useful if you'd like to have a template notebook saved that you can copy and modify for different projects.
By default, any notebook you create is private in your account, but you do have the option to share them. If a notebook is private, the globe beside the "Share" button will be grey. Once you share, that globe will be green, so that you can easily see which of your notebooks are shared or not from your notebook home page.
The "Share" button brings up the below panel. Once you toggle to "Shared", a link becomes available, which you can send to your collaborators to allow them to view your notebook. They will not be able to edit it directly.
Once a notebook is shared, anyone with the link will have the option to copy this notebook into their account. That copy is now theirs to edit, without modifying the original version. Feel free to copy the example notebook we've made available.
Build A Notebook
Notebooks are built in small blocks of code or notes, called cells. Each cell is usually a block with a specific purpose or output. In our example notebook, you'll see many different cells.
This one is a "Markdown" cell, which allows you to write notes, paragraphs, or descriptions which will appear in the final product. You can include headings in your "Markdown" cells by typing a "#" symbol before the line you want as a heading. You can add more "#" symbols to make the headings smaller.
Below is a "Code" cell, and the output that it generates once you run the code. We generally code in Python. If you're not familiar with that, you can check out our Python Introduction article.
You can choose between the different cell types using the drop-down menu along the top command panel.
The main types we'll use are "Code" cells and "Markdown" cells. The "Raw NBConvert" type can be useful if you convert your notebook to another format, such as HTML or LaTeX. To specify the format of a "Raw NBConvert" cell, with the cell selected, click "View" > "Cell Toolbar" > "Raw Cell Format". This will provide a drop-down menu at the top-right of the cell.
By default, this is set to "None", which means any contents in this cell will print in the final PDF as-is. You can use these other formats to modify how this cell would render. If you choose "Python", the cell won't render anything - it will not show in the final PDF.
The toolbar makes some of the most commonly-used functions easily accessible.
Create a new cell.
Cut, Copy, or Paste a cell.
Move a cell up or down relative to other cells.
Run the current cell. If it's a Code cell, this will output whatever plot or table you've coded. If it's a Markdown cell, it will format the output as desired (see the Markdown section below).
Spot a mistake as your code is running? Stop the kernel.
Restart the kernel. Any outputs and imports will be lost, so you will need to rerun cells to get them back.
Restart the kernel and run all cells.
This opens a command palette, showing you all of the different Jupyter Notebook commands available to you, including hot keys.
Run the Notebook. Generate a Report.
Once you've built the notebook, with all of the different cells you want in it, now you can run it. You have the option to run it cell-by-cell, using the "Run" button repeatedly. But once you know each cell works, you can generate a clean output by restarting the kernel and running all cells. Your Markdown cells will format as you like. If you have headers, you won't see the "#" symbol anymore, but you'll get the bold, larger font you were looking for. Your code cells will generate whatever you've coded, and any plots or figures will be shown below the code cell.
Once the notebook has finished running, you'll probably want to save it! "Save and Checkpoint" saves the actual notebook itself in your account, and allows you to continue to edit, and revert to that checkpoint if you ever need to.
You can download the Notebook, with all of the code as an .ipynb. This will allow you to open the notebook in other editors.
You can generate a PDF report. This doesn't show the underlying code, but does show the outputs of Markdown and Code cells, making it a nice presentation format.
Some users will have access to their own document portal through One Codex. The "Export to One Codex (.pdf)" option renders the notebook and saves the PDF in the users document portal. If you don't have a document portal, but would like to, reach out to us to discuss your options.
Now that you've seen the Jupyter Notebook environment, we've got a few more articles that can help you get started:
An introduction to Python programming, for anyone who wants to learn a little more about coding in the language we use most.
A walk-through of some of the common ways you may want to view your data using Jupyter Notebooks.
If you have any questions that these documents don't answer, you can reach us by email, or through the chat icon at the bottom-right of your screen. Happy coding!