Pre-requisites

Install these packages:

install.packages("RSQLite")
install.packages("ncdf4")

2 Part I: Implementing the GWASdata class

The process of designing and implementing a new class requires that the devel- opper spends some time thinking about:

It’s generally considered good design to avoid storing redundant information (although some exceptions can be made for performance considerations) and to keep things as simple as possible.

2.1 Class definition

For our GWASdata class, we want the following slots:

Exercise 1

Start a new file (let’s name it GWASdata-class.R) and write the setClass state ment for the GWASdata class.

  setClass("GWASdata",
  representation(
  datapath="character",
  ...
  ...
  )
  )
datapath <- file.path("./inst/extdata", "small_snpData.nc")
datapath

metadatapath <- file.path("./inst/extdata", "small_metadata.sqlite")
metadatapath
pth <- file.path("../inst/extdata", "snpdata.csv")
dat <- scan(pth, what = character(0), sep =",",
                               skip = 600, nlines = 1, quiet = TRUE)
library(RSQLite)
library(RNetCDF)


datapath <- file.path("../inst/extdata", "small_snpData.nc")
metadatapath <- file.path("../inst/extdata", "small_metadata.sqlite")

source("../R/GWASdata-class.R")
GWASdataRead(datapath, metadatapath)
source("../R/GWASdata-class.R")
datapath <- file.path("../inst/extdata", "small_snpData.nc")
metadatapath <- file.path("../inst/extdata", "small_metadata.sqlite")

gwas <- GWASdata(datapath = datapath, metadatapath = metadatapath)
dataconn(gwas)
nrow(gwas)
ncol(gwas)


AlfonsoRReyes/StudentGWAS documentation built on May 5, 2019, 4:54 a.m.