Skip to end of metadata
Go to start of metadata


Sweave is a powerful tool that allows bioinformatics analysts to combine code, results, figures, and documentation discussing and describing the results into the same document.

In this exercise, you'll go through the process of documenting and analysis using Sweave.

To get familiar with Sweave and also hone your R analysis skills, you'll use R and Sweave to run a simple analysis of gene size distributions from two different plants genomes.


The following assignment description assumes you've reviewed the reading and the lecture slides.


Getting started

Get GeneAnal.Rnw, which is attached to this page. 

Use R to generate a report. On a UNIX system where R and LaTeX are installed, you can create a report from GeneAnal.Rnw like so:

This generates a PDF file GeneAnal.pdf.

Open the source code file GeneAnal.Rnw and compare it side by side with your newly generated report file GeneAnal.pdf.

Make note of how R code is embedded in GeneAnal.Rnw and how it looks in the report.

Get two genomes to compare

In class, Dr. Loraine should have assigned you (and your partner) a genome to analyze. If you don't yet have your genomes, email Dr. Loraine.

(Students taking the class on-line can pick genomes by visiting

Edit GeneAnal.Rnw.

Edit GeneAnal.Rnw as follows:

  • Instead of analyzing corn and Arabidopsis genes, analyze your selected genomes.
  • Add a new section that inserts a histogram of gene sizes and the log10 of genes sizes.

Test the file.

Give a copy of the file to one (or more) class-mates and ask them to generate a report using your file. Check that they (a) generate the report and (b) the report produces the same results.

Turn it in.

Check in the final version (that you want graded) of your file into your part of the class subversion repository by the due date.


Dr. Loraine will run whatever version was current at the due date.

  • No labels