Last data update: 2014.03.03

R: Parallel computing of the Likelihhod ratio test (or Wald...
permutation.snpR Documentation

Parallel computing of the Likelihhod ratio test (or Wald test) for an interaction term (or a simple SNP effect) on permutation sample

Description

The permutation.snp function performs on permutation sample a Likelihood Ratio Test (or a Wald test) for an interaction term SNP*E (where E is an Environment variable) or for the effect of the SNP. This function uses the parallel computing on different CPU of the computer. This function returns a matrix containing for each permutation and SNP the p-value of the interaction term tested (SNP*E) or the p-value of the SNP effect tested.

Usage

  permutation.snp(model, Outcome.model = "binary", data,
    var.inter = NULL, indice.snp, class.inter = NULL,
    method = "YX", nbcpu = NULL, Npermut = 1000,
    file.out = "res-permut")

Arguments

model

an object of class "formula" : a symbolic description of the model to be fitted without the interaction term.

Outcome.model

a character string naming the type of outcome considered. It could be "binary" (by default) or "survival".

data

a data frame containing the variables in the model.

var.inter

name of the variable which is tested in interaction with the SNPs (SNP:E). By default var.inter=NULL correspond to a test on the SNPs (no interaction)

indice.snp

vector or character indicating the SNPs to be tested.

class.inter

class of the var.inter variable. By default, the variable is considered as continuous and a Wald test is performed. Use ("factor") to indicate categorical variable.

method

method choice for the permutation. By default "YX" a permutation of the phenotype and the adjusted effect are performed otherwise only the phenotype is permuted.

nbcpu

integer indicating the number of CPU of your computer (-1). By default, the function use only one cpu.

Npermut

number of permutation (1000 by default).

file.out

name of the output file where the result will be saved.

Value

A matrix containing the p-value, for each permutation (row) and for each SNP (column), of the likelihood ratio test (or the Wald test) for the interaction term or the SNP effect. This matrix is also saved in a txt file (named by the argument file.out) located in the current directory.

Author(s)

Benoit Liquet benoit.liquet@isped.u-bordeaux2.fr
Therese Truong therese.truong@inserm.fr

Examples

data(data.pige)
data(data.pathway)
data(list.gene.snp)
res <-data.to.PIGE(data=data.pige,data.pathway=data.pathway,
list.gene.snp=list.gene.snp,choice.pathway=c(1,2))
formul <- formula(y~factor(cov1)+factor(cov2)+factor(cov3)+factor(cov4)
+var_int)
debut <- Sys.time()
p.snp.permut.ex <-  permutation.snp(model=formul,data=data.pige,
indice.snp=res$snp.selected,var.inter="var_int",class.inter=NULL,nbcpu=3,
Npermut=9,file.out="res-permut")
print(Sys.time()-debut)
##Survival example:
data(data.surv)
data(data.pathway.surv)
data(list.gene.snp.surv)
res1 <-data.to.PIGE(data=data.surv,data.pathway=data.pathway.surv,
list.gene.snp=list.gene.snp.surv,choice.pathway=c(1:7))
formul <- formula(Surv(TIME, EVENT) ~ var_int)
p.snp.permut.ex <-  permutation.snp(model=formul,Outcome.model="surv"
,data=data.surv,indice.snp=res1$snp.selected,var.inter="var_int",
class.inter=NULL,nbcpu=3,Npermut=9,file.out="res-permut-surv")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(PIGE)
Loading required package: snowfall
Loading required package: snow
Loading required package: ARTP
Loading required package: xtable
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/PIGE/permutation.snp.Rd_%03d_medium.png", width=480, height=480)
> ### Name: permutation.snp
> ### Title: Parallel computing of the Likelihhod ratio test (or Wald test)
> ###   for an interaction term (or a simple SNP effect) on permutation
> ###   sample
> ### Aliases: permutation.snp
> 
> ### ** Examples
> 
> data(data.pige)
> data(data.pathway)
> data(list.gene.snp)
> res <-data.to.PIGE(data=data.pige,data.pathway=data.pathway,
+ list.gene.snp=list.gene.snp,choice.pathway=c(1,2))
Perfect all the snp considered belong to the data frame> formul <- formula(y~factor(cov1)+factor(cov2)+factor(cov3)+factor(cov4)
+ +var_int)
> debut <- Sys.time()
> p.snp.permut.ex <-  permutation.snp(model=formul,data=data.pige,
+ indice.snp=res$snp.selected,var.inter="var_int",class.inter=NULL,nbcpu=3,
+ Npermut=9,file.out="res-permut")
R Version:  R version 3.3.1 (2016-06-21) 

snowfall 1.84-6.1 initialized (using snow 0.4-1): parallel execution on 3 CPUs.

Library PIGE loaded.
Library PIGE loaded in cluster.


Stopping cluster

> print(Sys.time()-debut)
Time difference of 7.345932 secs
> ##Survival example:
> data(data.surv)
> data(data.pathway.surv)
> data(list.gene.snp.surv)
> res1 <-data.to.PIGE(data=data.surv,data.pathway=data.pathway.surv,
+ list.gene.snp=list.gene.snp.surv,choice.pathway=c(1:7))
Perfect all the snp considered belong to the data frame> formul <- formula(Surv(TIME, EVENT) ~ var_int)
> p.snp.permut.ex <-  permutation.snp(model=formul,Outcome.model="surv"
+ ,data=data.surv,indice.snp=res1$snp.selected,var.inter="var_int",
+ class.inter=NULL,nbcpu=3,Npermut=9,file.out="res-permut-surv")
snowfall 1.84-6.1 initialized (using snow 0.4-1): parallel execution on 3 CPUs.

Library PIGE loaded.
Library PIGE loaded in cluster.


Stopping cluster

> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>