# JupyterLab Quickstart

{% hint style="info" %}
JupyterLab is accessible to all users of the UK Biobank Research Analysis Platform and the Our Future Health Trusted Research Environment.

A license is required to access JupyterLab on the DNAnexus Platform. [Contact DNAnexus Sales](mailto:sales@dnanexus.com) for more information.
{% endhint %}

## Run a JupyterLab Session and Create Notebooks

### 1. Launch JupyterLab and View the Project

First, launch JupyterLab in the project of your choice, as described in the [Running JupyterLab](https://documentation.dnanexus.com/user/jupyter-notebooks/running-dxjupyterlab) guide.

After starting your JupyterLab session, click on the `DNAnexus` tab on the left sidebar to see all the files and folders in the project.

### 2. Create an Empty Notebook

To create a new empty notebook in the DNAnexus project, select `DNAnexus` > `New Notebook` from the top menu.

This creates an untitled `ipynb` file, viewable in the DNAnexus project browser, which refreshes every few seconds.

To rename your file, right-click on its name and select `Rename`.

### 3. Edit and Save the Notebook in the Project

You can open and edit the newly created notebook directly from the project (accessible from the DNAnexus tab in the left sidebar). To save your changes, press <kbd>Ctrl</kbd>+<kbd>S</kbd> (or <kbd>Command</kbd>+<kbd>S</kbd> on macOS), or click on the save icon in the Toolbar (an area below the tab bar at the top). A new notebook version lands in the project, and you should see in the "Last modified" column that the file was created recently.

Since DNAnexus files are immutable, each notebook save creates a new version in the project, replacing the file of the same name. The previous version moves to the `.Notebook_archive` with a timestamp suffix added to its name. Saving notebooks directly in the project as new files preserves your analyses beyond the JupyterLab session's end.

### 4. Download the Data to the Execution Environment

To process your data in the notebook, the data must be available in the execution environment (as is the case with any DNAnexus app).

You can [download input data from a project](https://documentation.dnanexus.com/user/references#download-files-from-the-project-to-the-local-execution-environment) for your notebook using `dx download` in a notebook cell:

```shell
%%bash
dx download input_data/reads.fastq
```

You can also use the [terminal](https://documentation.dnanexus.com/user/references#use-the-terminal) to execute the `dx` command.

### 5. Upload Data to the Project

For any data generated by your notebook that needs to be preserved, [upload it to the project](https://documentation.dnanexus.com/user/references#upload-data-from-the-session-to-the-project) before the session ends and the JupyterLab worker terminates. Upload data directly in the notebook by running `dx upload` from a notebook cell or from the terminal:

```shell
%%bash
dx upload results.csv
```

{% hint style="info" %}
If you create a notebook from the Launcher or from the top menu (`File` > `New` > `Notebook`), the notebook is *not* created in the project but in the [local execution environment](https://documentation.dnanexus.com/user/jupyter-notebooks/..#worker-execution-environment). To move it to the project, you must upload it to the project manually. Make sure you [upload your local notebooks to the project](https://documentation.dnanexus.com/user/references#upload-data-from-the-session-to-the-project) before the session expires, or work on your notebooks directly from the project, so as not to lose your work.
{% endhint %}

## Next Steps

* Check the [References](https://documentation.dnanexus.com/user/jupyter-notebooks/references) guide for tips on the most useful operations and features in JupyterLab.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://documentation.dnanexus.com/user/jupyter-notebooks/quickstart.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
