This page is a reference for most useful operations and features in the DNAnexus JupyterLab environment:
You can download input data from a project using
dx download in a notebook cell:
%%bashdx download input_data/reads.fastq
%%bash keyword converts the whole cell to a magic cell which allows us to run bash code in that cell without exiting the Python kernel. See more examples of magic commands in the IPython documentation. The
! prefix to achieves the same result:
! dx download input_data/reads.fastq
dx command can be executed from the terminal.
To download data with Python in the notebook, you can use the
Check dxpy helper functions for details on how to download files and folders.
Any files from the execution environment can be uploaded to the project using
%%bashdx upload Readme.ipynb
To upload data using Python in the notebook, you can use the
Check dxpy helper functions for details on how to upload files and folders.
By selecting a notebook or any other file on your computer and dragging it into the DNAnexus project file browser, you can upload the files directly to the project. To download a file, right-click on it and click
Download (to local computer).
You may upload and download data to the local execution environment in a similar way, i.e. by dragging and dropping files to the execution file browser or by right-clicking on the files there and clicking
It is useful to have a terminal provided by JupyterLab at hand, which uses
bash shell by default and lets you execute shell scripts or interact with the platform via
dx toolkit. For example, the command:
$ dx pwdMyProject:/
will confirm what the current project context is.
pwd will show you that the working directory of the execution environment is
/opt/notebooks. The JupyterLab server is launched from this directory, which is also the default location of the output files generated in the notebooks.
To open a terminal window, go to
Terminal or open it from the Launcher (using the "Terminal" box at the bottom). To open a Launcher, select
You can install
apt-get, and other packages in the execution environment from the notebook:
%%bashpip install torchpip install torchvisionconda install -c conda-forge opencv
By creating a snapshot, you can start subsequent sessions with these packages pre-installed by providing the snapshot as input.