Jupyter NOTEBOOKS and basic Python
A brief tutorial on the use of jupyter notebooks and the python data analysis library pandas for genomic data analysis.
Workshop on Population and Speciation Genomics, Český Krumlov, June 2022.
By Hannes Svardal ([email protected])
Jupyter notebooks can run locally or on a server. You access them in your browser. Here you will run a jupyter notebook on your amazon cloud instance (AMI).
To start the jupyter server
- First, you need to get a terminal on your amazon cloud instance (AMI). You can do that in two ways.
- Either, use guacamole. In your web browser, go to the address
- http://ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com:8080/guacamole
where XXX-XXX-XXX-XXX is replaced by the Amazon instance IP address assigned to you. You can find that address at the web page. - username: wpsg, password: the one written on the whiteboard
- http://ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com:8080/guacamole
- Or use ssh from your terminal
ssh [email protected]
(replace XXX with your Amazon instance IP address, see above)
- Either, use guacamole. In your web browser, go to the address
- Navigate into the tutorial directory:
cd ~/workshop_materials/a06_python_jupyter_intro
- Start a screen session by typing:
screen
- Confirm with
Return
- Start the conda virtual environment:
conda activate conda
(we created a conda environment that contains required python packages) - Start the notebook server:
jupyter notebook --port=8889
- The command blocks the terminal. That is normal. Keep it running. You can get back to a functional terminal by typing
Ctrl + a, d
(firstCtrl + a
, thend
) - In your local browser, navigate to the web address: http://c2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com:8889 (replace XXX with your Amazon instance IP address, see above)
- You will see the folder contents. Click on 2022-05_python_jupyter_tutorial.ipynb to open the notebook and start a python kernel.
- Follow the exercises in the jupyter notebook. If you have questions please ask.
- You can download the whole material from this tutorial as a zip file here <TO BE ADDED>
Running the tutorial after the workshop, on your local machine
If you have python and jupyter installed, you can simply run the notebook in the following way:
-
- Start the notebook server:
jupyter notebook --no-browser --port=8889
- In your local browser, navigate to the web address: localhost:8889
- Start the notebook server:
Further resources about jupyter notebooks can be found here: