[Genabel-commits] r1192 - tutorials/GenABEL_general
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 16 21:07:10 CEST 2013
Author: yurii
Date: 2013-04-16 21:07:09 +0200 (Tue, 16 Apr 2013)
New Revision: 1192
Modified:
tutorials/GenABEL_general/fetchData.Rnw
Log:
changes so that user can simply copy the code for fetching the data
Modified: tutorials/GenABEL_general/fetchData.Rnw
===================================================================
--- tutorials/GenABEL_general/fetchData.Rnw 2013-04-16 16:30:29 UTC (rev 1191)
+++ tutorials/GenABEL_general/fetchData.Rnw 2013-04-16 19:07:09 UTC (rev 1192)
@@ -1,20 +1,29 @@
\section{Download necessary files}
-This code needs to be run prior to other parts of tutorial.
-It kills the 'RData' directory if it is there (danger! danger!) to make all tests
-clean.
+This code needs to be run prior to other parts of tutorial. We reccommend that
+prior to any actions you create a new directory, say, 'exercisesGenABEL', to
+keep all of your working tutorial files there.
-<<>>=
+Start R and make sure that your working directory is set to a proper location.
+Your current working directory can be queried by command 'getwd()'.
+Use 'setwd' command to set the working directory.
+
+The next lines of code kill the 'RData' directory if it is present in your
+working directory (danger! danger!) to make new clean data installation. Paste
+this code into R:
+
+\begin{verbatim}
unlink("RData",recursive=TRUE,force=TRUE)
dir.create("RData")
+\end{verbatim}
+<<echo=FALSE>>=
+unlink("RData",recursive=TRUE,force=TRUE)
+dir.create("RData")
@
-Now, fetch the necessary data from the server
-{\bf Would be nice to have this thing as a 'code' plate so people can
- copy-paste the code without the need to delete '+'ses}
-
-Define download procedure
-<<>>=
+Now, fetch the necessary data from the server. First, define the download
+procedure
+\begin{verbatim}
myDownloads <- function(baseUrl,baseLocal,files) {
for (cFile in files) {
cFileUrl <- paste(baseUrl,cFile,sep="")
@@ -26,11 +35,23 @@
stop(paste("can not download",cFileUrl,"into",cFileLocal,":",tryDownload))
}
}
+\end{verbatim}
+<<echo=FALSE>>=
+myDownloads <- function(baseUrl,baseLocal,files) {
+for (cFile in files) {
+ cFileUrl <- paste(baseUrl,cFile,sep="")
+ cFileLocal <- paste(baseLocal,cFile,sep="")
+ tryDownload <- try(
+ download.file(url=cFileUrl,destfile=cFileLocal)
+ )
+ if ( is(tryDownload,"try-error") )
+ stop(paste("can not download",cFileUrl,"into",cFileLocal,":",tryDownload))
+ }
+}
@
-Download data files:
-
-<<>>=
+Second, download data files:
+\begin{verbatim}
baseUrl <- "http://www.genabel.org/sites/default/files/data/"
baseLocal <- "RData/"
dataFiles <- c(
@@ -49,16 +70,37 @@
"emap0.dat",
"phe0.dat",
"ImputedDataAnalysis.RData")
-
myDownloads(baseUrl,baseLocal,dataFiles)
+\end{verbatim}
+<<echo=FALSE>>=
+baseUrl <- "http://www.genabel.org/sites/default/files/data/"
+baseLocal <- "RData/"
+dataFiles <- c(
+ "assocbase.RData",
+ "popdat.RData",
+ "mach1.out.mlinfo",
+ "mach1.mldose.fvi",
+ "mach1.mldose.fvd",
+ "rcT.PHE",
+ "gen0.illu",
+ "gen0.illuwos",
+ "gen0.tped",
+ "gen0.tfam",
+ "gen0.ped",
+ "map0.dat",
+ "emap0.dat",
+ "phe0.dat",
+ "ImputedDataAnalysis.RData")
+myDownloads(baseUrl,baseLocal,dataFiles)
@
-Special case of figure(s):
-
-<<>>=
+<<echo=FALSE>>=
+#Special case of figure(s), not shown to user
baseLocal <- ""
figuresFiles <- c(
"gwaa-data-class.pdf"
)
myDownloads(baseUrl,baseLocal,figuresFiles)
@
+
+That's it! - now you are fully set to start with the \texttt{GenABEL} tutorial!
More information about the Genabel-commits
mailing list