CS153 lab1: Introduction to Lab and Rosalind
This is our first lab meeting. Our goals are to introduce the CS lab,
to edit a small python program, and to solve a first problem on the
Rosalind website. This is just warmup for future homework problems.
If there is time, we can also see some other useful lab tools.
If things go smoothly, then you can finish this during our scheduled
time. Otherwise, your deadline for this lab is the start of the next
lab (10am Monday). A similar rule will apply for most future labs.
YOUR SCRIPT (list of steps)
- Login! Sit down at a workstation, and try to login with your
Emory NetID and password. If you cannot login, then let us know.
If necessary, I'll ask some tech staff to come help us with login issues.
You should see a desktop similar to the one on the projector, where I
use the "grader account" (cs153001).
These workstations run Ubuntu Linux, a free operating system that is
especially popular in schools and research. It offers both
graphical and text-based tools, we'll try some of both.
Find your "Applications" menu, near the top left corner.
(You can also get a useful "Activities Overview" by tapping
the left "Windows" key, or moving your mouse into the top-left corner).
You should be able to find a web browser (Firefox or Chrome), a
"Files" browser, and a "Terminal".
- Launch a web browser and visit this page:
You might also bookmark our course homepage,
for future reference.
Launch a Terminal.
A terminal is a text-only "command-line" interface.
When it starts, you see a prompt from the shell (the "bash" shell),
where you are expected to enter commands. This kind of interface
is not friendly to new users, but it can be quite effective once
you know some useful commands.
Enter the following four commands in your terminal.
I suggest that you just "copy-and-paste" these lines to your shell
(you can paste all four lines at once). I'll demonstrate this on the lab machine.
cp /home/cs153001/share/lab1/* .
I'll assume you have seen files and directories on
computers before. Here is what those commands are doing:
- The mkdir command creates a new subdirectory named
lab1, under your personal cs153 directory (the
cs153 directory should already exist). The
initial "~" is an abbreviation for your home directory,
which is something like /home/yourid.
- The cd command sets the "current directory" for
subsequent commands. So if we name a file without specifying
its directory, the commands will search the current directory.
For this lab, you should keep all your relevant files in
your ~/cs153/lab1 directory.
- The cp command copies some files from the grader account
to your current directory. The first argument (ending
with *) is a pattern, matching all files in a directory. The
second argument (the lonely ".") means your current directory
(that we just set with cd).
- The ls command lists the contents of the current directory.
You should see a listing of (four?) files. The optional -l flag
requests "long" format, so the listing also includes things like
file sizes and timestamps.
Note your ~/cs153/ should be already created, with some useful
privacy settings. In particular, it is readable by
the grader account, but not by other students.
There is much more that we could learn about Linux shell commands,
for example see this
For CS153, we'll just explain such commands as we need them.
Launch the graphical "Files" browser, which usually starts with a view
of your "home directory".
From there, you can navigate (by double-clicking) into cs153, and
then into lab1. You should see an icon for each file
that we copied and listed in the previous step.
(In fact, we could have copied the files using the file browser.)
One of the files is dna.py, a simple Python program.
You can run it already, by entering this command in the terminal:
That assumes you are still in the same "current directory" that
we set before. If that is not true (maybe you started a new terminal?)
then repeat the cd command from above.
As given, the dna.py program does not do much, but we will
start modifying it, and you should be able to finish it.
Open your dna.py in the text editor (gedit). The
simplest way is to double-click it in the file browser. Or, you can
also start the editor from the terminal with a command:
gedit dna.py &
The trailing ampersand (&) tells the shell to run the
editor "in the background", so we can enter more shell commands while
the editor is still running. (If you forget the ampersand, then quit
the editor and try again.)
In the editor, read the dna.py comments for instructions.
You are being asked to modify the program so that
counts A's, C's, G's, and T's in the given input file.
We will do much of this during the lab, so it should not be hard
The last line of your modified dna.py could look like
something like this:
print(countA, countC, countG, countT)
Run your modified dna.py program in the terminal, to see if
it has reasonable output like "20 12 17 21". If not, go back and fix it
until it works. If you get some mysterious error messages, ask
Once your dna.py is working, we are ready to solve our first
problem at Rosalind!
- If you have not done so already, go to
rosalind.info and setup an account,
using your email address. You will need to check your email for an
activation message from firstname.lastname@example.org. Please enter
your full name in your Rosalind profile, so I can tell who you are.
- Once your Rosalind account is active, join our class (CS153 Fall
2017) using the "enrollment link" on our
You only need to enroll once. In the future, you can
go directly to our
Rosalind class page.
- At our Rosalind class page, click the first problem,
"Counting DNA Nucleotides". Read it. It asks us to solve the problem
that we just solved using dna.py, so we are ready to solve it!
If you are using Firefox, I recommend that you first configure it to
"always asks me where to save files". Look for "Preferences" under
the "hamburger menu", and it should be under the first page of
"General" preferences. If you forget to do this, Firefox by default
saves all file downloads in a fixed location
- Now back on the Rosalind DNA problem page, click the big blue
"Download Dataset" button. A 5-minute timer
starts. You are downloading a text file called rosalind_dna.txt.
I recommend that you save it in ~/cs153/lab1/, overwriting
our original file with the same name.
Now back in the terminal, run dna.py again:
Assuming the output (a single line with four integers) looks good, you should
copy-and-paste that line to the Rosalind window, in the textbox labeled "Copy your answer here:".
Next, use the second "Choose File" button to select your python program (~/cs153/lab1/dna.py).
Finally, hit the big blue "Submit" button.
- If you do not finish within the five-minute time limit, no
problem. Just figure out how to do it a bit faster, and try again.
Rosalind has no limit on retries (but it may give you a different
input file each time).
Rosalind will let you know whether your submission was correct.
Try again until you get it.
- Once you are done at Rosalind, there is one other thing to check.
Make sure you have left a working copy of dna.py in your
Once you have done those two things, you are done with today's lab.
You may leave early, if you want, or try some of the other
(non-credit) Rosalind problems.
Note you do not have to finish this during our lab time, our
actual duedate for this lab is the start of the next lab (10am
Monday). But if you are doing this away from the lab, the hardest
part may be getting a copy of your program back into the
your "~/cs153/lab1" directory. (It can be done remotely, but
that requires some software tools.)
Today we just wanted to get the basic tools and Rosalind working.
The code today is so simple that I am not enforcing an "honor statement".
We will be more strict about future programs.