We ask you come prepared to class with a laptop on which you can participate in coding activities. Please follow the instructions below to install the required software for this course (all programs should come pre-installed on your computer, or are freely available for academic use). We'll use the other files in this directory to test the software together in class. The tools you'll need include:
- WSL or Terminal for Unix command line
- Anaconda for installing Python
- Conda Environment for installing R and R packages
- Text Editor for file viewing / manipulation
Windows 10 comes with a new feature called Windows Subsystem for Linux (WSL) that allows you to access Unix tools on your computer. Please install WSL with the instructions here.
Macintosh operating systems are built on Unix, so many of the tools you'll need are pre-installed on your computer. You can access the command line through an application called Terminal. You can either search for this in Finder, or use the Go drop-down menu to locate it in the Utilities folder.
Please install Python using Anaconda, which includes Jupyter notebooks and most of the other packages we'll use for the course, according to the following instructions:
- Download the Anaconda installer for Python 3.x for your particular operating system.
- Double-click the downloaded file and follow the prompts to install Anaconda (default options are acceptable).
A conda environment is a directory that stores a specific collection of packages that you have installed. For this course, we ask that you create a custom conda environment with certain R packages so that everyone will be on the same page. To do this:
- Check that Anaconda has been installed.
- In WSL or Terminal, create a new conda environment with the packages we'll need for this course using the following command. Type 'y' when asked to Proceed. (NOTE: if prompted with a "To use the java command-line tool...", just press OK).
conda create -n tfcb2021 r r-tidyverse r-irkernel bioconductor-plyranges bioconductor-genomicfeatures -c conda-forge -c bioconda
- Activate the environment with:
conda activate tfcb2021
Biological data is almost exclusively represented as text, and we will be writing code and documentation in text files. It's useful to be able to open, examine, and edit text files using a light-weight text editor. Microsoft Word is not suitable for these types of files, and we do not recommend the text editors set as default on your computer, as these programs are often not optimized for working with code.
We will use VSCode as the source code and text editor for this class. Install VSCode on your computer and view the introductory video here before the first class to familiarize yourself with the user interface.
We will use the following features in VSCode as part of this class:
- Work with Git and GitHub for version control (see more below).
- Edit Markdown files and preview rendered versions.
- Write Python code in native Jupyter notebooks.
- Use the integrated terminal.
- Connect to and work on remote hosts such as the Fred Hutch Rhino computing cluster.
To get started on using VSCode:
- Open VSCode and click on 'Extensions' on the left-side menu.
- Install Python (by Microsoft), Markdown Preview Enhanced (by Yiyi Wang), and Remote - SSH (by Microsoft).
- Clone the
tfcb2021
GitHub repository in VSCode with View > Command Palette > Git: Clone > https://github.com/FredHutch/tfcb_2021.git. - Click on 'Explorer' on the left-side menu, and you should be able to open and manipulate all the files in the TFCB 2021 GitHub repository.
To use Python in Jupyter notebook:
- Open the test Jupyter notebook
test_python.ipynb
. - In the upper right corner, you should see an icon to select a kernel. Select the anaconda environment that you created, which should look something like
Python 3.x.x 64-bit (conda)
. - On the left-side of the code block, click the triangle to execute the code.
- You should see a 2 x 2 table filled with 1's (and no error messages).
To use R in Jupyter notebook:
- Open the Terminal window in VSCode (Terminal > New Terminal) and activate the
tfcb2021
environment you previously created withconda activate tfcb2021
. - Type
which R
into Terminal to identify where the R interpreter is located in the environment (ex./usr/local/bin/R
). - Now switch back to the base environment with
conda activate base
. - Type the location identified in Step 2 (ex.
/usr/local/bin/R
). This should start the R interpreter. - In the R interpreter, type
IRkernel::installspec()
after the >. This should install kernelspec in the right location. - Open the test Jupyter notebook
test_R.ipynb
. - In the upper right corner, select
R
as the kernel this time. - Run the code block.
- You should see a scatter plot of hwy vs. displ.