%\VignetteIndexEntry{Appendix}
%\VignettePackage{useR2011}

\SweaveOpts{keep.source=TRUE}

\appendix

\section{Appendix: data retrieval}

The following script was used to retrieve a portion of the Pasilla
data set from the short read archive. The data is very large;
extraction relies on installation of the SRA SDK, available from the
Short Read Archive.
<<pasilla-get, eval=FALSE>>=
library(RCurl)
srasdk <- "/home/mtmorgan/bin/sra_sdk-2.0.1" # local installation
sra <- "ftp://ftp-trace.ncbi.nih.gov/sra/sra-instant/reads/ByExpt/sra"
expt <- "SRX/SRX014/SRX014458/"
url <- sprintf("%s/%s", sra, expt)
acc <- strsplit(getURL(url, ftplistonly=TRUE), "\n")[[1]]

urls <- sprintf("%s%s/%s.sra", url, acc, acc)
for (fl in urls)
    system(sprintf("wget %s",  fl), wait=FALSE, ignore.stdout=TRUE)

app <- sprintf("%s/bin64/fastq-dump", srasdk)
for (fl in file.path(wd, basename(urls)))
     system(sprintf("%s %s", app, fl), wait=FALSE)
@ 

