%\VignetteDepends{}
%\VignetteIndexEntry{Appendix -- Nagalakshmi et al}
%\VignettePackage{SeattleIntro2010}

\documentclass{article}

\usepackage{BioconductorVignette}
\SweaveOpts{keep.source=TRUE}

\title{Preparing Data from Nagalakshmi et al.}
\author{Martin Morgan \\ Fred Hutchinson Cancer Research Center}
\date{9-10 December, 2010}

\begin{document}

\maketitle

This data set is based on Nagalakshmi et al.~\cite{pmid18451266}. The
data was retrieved from the
\href{http://trace.ncbi.nlm.nih.gov/Traces/home/}{sequence read
  archive}, aligned with \href{http://bio-bwa.sourceforge.net/}{bwa},
and converted to BAM format with
\href{http://samtools.sourceforge.net/}{samtools}.

Data were downloaded from the sequence read archive by visiting 
\url{http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?study=SRP000227}
and downloading reads for the entire study. This results in a
directory structure
\begin{verbatim}
SRP000227
|---SRR002051
|   |-- SRR002051.sra
|---SRR002058
|   |-- SRR002058.sra
|---SRR002059
|   |-- SRR002059.sra
|---SRR002061
|   |-- SRR002061.sra
|--- SRR002062
|   |-- SRR002062.sra
|---SRR002064
    |-- SRR002064.sra
\end{verbatim}
Fastq files were extracted using
\href{http://trace.ncbi.nlm.nih.gov/Traces/sra/sra.cgi?cmd=show&f=software&m=software&s=software}{NCBI
  SRA SDK}.
\begin{verbatim}
#! /usr/bin/env sh
SRA=/home/mtmogan/bin/sratoolkit.2.0b4-3-suse_linux32
for f in `ls */*.sra`
do 
    ${SRA}/sratoolkit.2.0b4-3-suse_linux32/fastq-dump $f
done
\end{verbatim}
Reference sequences were retrieved from
\href{http://hgdownload.cse.ucsc.edu/goldenPath/sacCer2/chromosomes/}{UCSC}
golden path, unzipped, and \texttt{cat}enated into a single file. The
file was indexed for use by the bwa aligner with \texttt{bwa index
  sacCer2.fa}.  Reads were aligned and converted to BAM as
\begin{verbatim}
#! /usr/bin/env sh
BWA=/home/mtmorgan/bin/bwa/bwa
SAMTOOLS=/home/mtmorgan/bin/samtools/samtools
for f in `ls ./SRP000227/*fastq`
do
    echo "processing: $f"
    g=`basename $f`
    ${BWA} aln -t 2 Saccer2.fa $f > aln/$g.sai
    ${BWA} samse Saccer2.fa aln/$g.sai $f > aln/$g.sam
    ${SAMTOOLS} view -Sb aln/$g.sam > aln/$g.bam
    rm aln/$g.sai aln/$g.sam
done
\end{verbatim}
Descriptive information about samples (e.g., protocol and replicate)
were extracted by hand from web pages at the SRA.

Objects used in the lab were processed using the following \R{}
script. This script requires files and a directory structure that are
not distributed with this package.
<<create-objects>>=
library(SeattleIntro2010)
readScript("create-objects.R")
@ 

Relevant software versions are
\begin{verbatim}
Program: samtools (Tools for alignments in the SAM format)
Version: 0.1.11 (r851)

Program: bwa (alignment via Burrows-Wheeler transformation)
Version: 0.5.8c (r1536)
Contact: Heng Li <lh3@sanger.ac.uk>

sratoolkit.2.0b4-3-suse_linux32/fastq-dump
Version: 2.0.0
\end{verbatim}

<<sessionInfo>>=
sessionInfo()
@ 

\bibliographystyle{plain}
\bibliography{SeattleIntro2010}

\end{document}
