[Genabel-commits] r1117 - pkg/ProbABEL/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri Mar 8 15:51:06 CET 2013
Author: lckarssen
Date: 2013-03-08 15:51:06 +0100 (Fri, 08 Mar 2013)
New Revision: 1117
Modified:
pkg/ProbABEL/src/prepare_data.R
Log:
Added some more comments to the prepare_data.R script to explain its
meaning.
Also cleaned up the code layout a bit.
Modified: pkg/ProbABEL/src/prepare_data.R
===================================================================
--- pkg/ProbABEL/src/prepare_data.R 2013-03-07 12:33:41 UTC (rev 1116)
+++ pkg/ProbABEL/src/prepare_data.R 2013-03-08 14:51:06 UTC (rev 1117)
@@ -1,3 +1,10 @@
+# This R script serves as an example of how to create input files for
+# running ProbABEL.
+# It requires several files (listed below) and basically selects the
+# phenotype and covariates you want from a larger phenotype file,
+# orders them in the same order as the mldose file. At the end it
+# converts existing dose and prob files to DatABEL format.
+
#
# file containing all phenotypes
# variables should be separated by space or tab, missing values coded as NA
@@ -35,18 +42,31 @@
# code
#
-ophe <- read.table(original_phenofile,head=T,strings=F)
+ophe <- read.table(original_phenofile, header=TRUE, stringsAsFactors=FALSE)
rownames(ophe) <- ophe$id
-idso <- scan(ids_order_file,what=character())
+idso <- scan(ids_order_file, what=character())
-newphe <- ophe[idso,c("id",trait,covars)]
+newphe <- ophe[idso, c("id", trait,covars)]
-write.table(newphe,file=output_phenofile,quote=F,row.names=F)
+write.table(newphe, file=output_phenofile, quote=FALSE, row.names=FALSE)
-if (!require(GenABEL)) stop("further code requres GenABEL library installed")
-if (!require(DatABEL)) stop("further code requres DatABEL library installed")
+if (!require(GenABEL))
+ stop("further code requires the GenABEL library to be installed")
+if (!require(DatABEL))
+ stop("further code requires the DatABEL library to be installed")
unlink("*.fv?")
-fvdose <- mach2databel(imputedg="test.mldose",mlinfo="test.mlinfo",out="test.dose")
-fvprob <- mach2databel(imputedg="test.mlprob",mlinfo="test.mlinfo",out="test.prob",isprob=TRUE)
-mmdose <- mach2databel("mmscore_gen.mldose","mmscore_gen.mlinfo","mmscore_gen.dose")
-mmprob <- mach2databel("mmscore_gen.mlprob","mmscore_gen.mlinfo","mmscore_gen.prob",isprob=TRUE)
+
+fvdose <- mach2databel(imputedg="test.mldose",
+ mlinfo="test.mlinfo",
+ out="test.dose")
+fvprob <- mach2databel(imputedg="test.mlprob",
+ mlinfo="test.mlinfo",
+ out="test.prob",
+ isprob=TRUE)
+mmdose <- mach2databel("mmscore_gen.mldose",
+ "mmscore_gen.mlinfo",
+ "mmscore_gen.dose")
+mmprob <- mach2databel("mmscore_gen.mlprob",
+ "mmscore_gen.mlinfo",
+ "mmscore_gen.prob",
+ isprob=TRUE)
More information about the Genabel-commits
mailing list