Coding assignments are typically issued on a Monday of each week via a URL invite link posted to LearnJCU and also posted on https://bc3203.bioinformatics.guide
Each of the major assignments will also be issued via the same process.
In order to access the assignment using the URL invite link you need to perform quite a few initial setup steps. These are described in detail in the git and github guide.
All assignments come with a “guide” which provides background information to help you answer the required questions. Always start by working your way through this background information document. Depending on the specific assignment you may find it useful to read entirely through the document before starting exercises, or alternate between reading and completing the exercises. In general if you are having trouble with an exercise you should look for clues in the background docs.
You can always find the guide associated with each assignment by looking up the relevant assignment on the front page of the subject website, https://bc3203.bioinformatics.guide
Most coding assignments include automated tests so that you can verify your answers. These tests will only work if you have installed some required software components in your rstudio environment.
To install required components make sure you run the following commands in a terminal window on your rstudio instance. You only need to do this once.
cd
bash setup_bats.sh
In addition. Within each assignment you should run its specific setup code. Instructions on how to do this are provided at the top of the exercises.Rmd
(see below) for each assignment.
Open the file containing exercises (called exercises.Rmd
) in RStudio.
First time only: You will need to get RStudio to install a bunch of packages related to compiling RMarkdown documents. Do this by clicking the Knit button (see screenshot). Wait a few seconds and a dialog box will appear. Click Yes. Installing the packages can take quite a while so be patient. This only need to be done once.
Edit the exercises.Rmd
file by replacing your_answer_here
with the answers to each of the exercises.
After each of the questions you will usually also find some test code that looks similar to this
bash test.sh question_01
Run your own code and run the test code by clicking the “Run current chunk” button (green triangle) on each chunk respectively (see below)
If your answer is correct the test should pass
When you are finished make sure you commit
and push
your changes back to github.
Note: Make sure you save changes in exercises.Rmd
before running the test code. Tests will run on the latest saved version and will ignore unsaved changes.
If you are unsure how to answer a question try experimenting with commands in the terminal before entering them into the answer box. To open a Terminal in RStudio, choose Terminal
-> New Terminal
from the Tools
menu. This will give you an interactive terminal where you can type unix commands and see the outputs.
Using your interactive terminal session you can;
Try to solve all the exercises in numerical order. These exercises are designed to start fairly easy and build in difficulty. Unless you are really stuck on a specific exercise it is unlikely to be beneficial to try skipping ahead.
Almost all the tutorials and assignments for this subject use RMarkdown. You will be running both R
and BASH
code from within RMarkdown documents using the “Run this chunk” button, and by compiling your entire notebooks.
There are some differences between how code runs from RMarkdown and how it runs in the interactive terminal window. It is important to be aware of these in case they trip you up.
Every BASH code chunk in RMarkdown runs in a new shell. This means that changing directory with cd
or setting environment variables, or defining functions will only have effect within that code chunk. This is different from the Terminal window where the shell will persist until you logout of the server.
RMarkdown code chunks don’t allow user input. This means that if you run a command that requires user input you will probably see a spinning wheel until you actively stop the command.
This tutorial comes with a test for every exercise. It is important to realise that every test gets run in a completely empty temporary directory. This means that your answer code must be self-contained. For example if your answer depends on a directory or file that you created in a previous step you will need to repeat that step to regenerate the directory or file.