prepareOutput: Prepare output (useful for all postprocessing analysis)

Description Usage Arguments Value Author(s) Examples

View source: R/Postprocessing.R

Description

Read sambada's output and prepare it by retrieving the snp position and chromosome (useful for plotting manhattan)

Usage

1
2
prepareOutput(sambadaname, dimMax, gdsFile = NULL, popStr = FALSE,
  nrows = NULL, interactiveChecks = TRUE)

Arguments

sambadaname

char The name of the genofile without extension name given to sambada (or outputfile of sambada without the ending -Out-Dim.csv)

dimMax

integer The maximum number of dimension given in sambada

gdsFile

char Name of the gds file associated with sambada's input file. If null, will try with sambadaname.gds

popStr

logical Indicates whether sambada was run using the POPSTRVAR parameter (i.e. population structure was taken into account). Default false

nrows

integer Specifies the number of line to read from the input file. Useful if saveType 'END ALL' was used in sambadaParallel and that the number of models run is large so that the reading and processing is too slow. The saveType 'END' parameter ensures that most significant models are located at the top of the file.

interactiveChecks

logical If TRUE, plots showing the distribution of p-values and estimates of pi0 (to adjust q-values) will be drawn. According to Storey's method to calculate q-values (Storey, J. D. (2003). The positive false discovery rate: a Bayesian interpretation and the q-value. The Annals of Statistics, 31(6), 2013-2035), you need to estimate a pi0 parameter which can be derived from an histogram of p-values. Pi0 correponds to the limit when p-value -> 1. The histogram should reach a plateau with increasing p-value. It this is not the case, q-values might not be the best option to correct for multiple testing.

Value

a list containing a) $sambadaOutput a matrix containing the output from sambada with 3 additional column: corresponding snp, chromosome and position of the marker b) $chrSNPNum The total number of SNPs in each chromosome c) $chrMaxPos The highest position found in each chromosome

Author(s)

Solange Duruz, Sylvie Stucki

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Example with data from the package
# First copy needed files into the temporary directory
file.copy(system.file("extdata", "uganda-subset-mol-Out-2.csv", package = "R.SamBada"), 
     file.path(tempdir(),'uganda-subset-mol-Out-2.csv'), overwrite=TRUE)
file.copy(system.file("extdata", "uganda-subset-mol-storey.csv", package = "R.SamBada"), 
     file.path(tempdir(),'uganda-subset-mol-storey.csv'), overwrite=TRUE)
if(Sys.info()['sysname']=='Windows'){
  file.copy(system.file("extdata", "uganda-subset-mol_windows.gds", package = "R.SamBada"),
      file.path(tempdir(),'uganda-subset-mol.gds'), overwrite=TRUE) #If you run Windows
} else {
  file.copy(system.file("extdata", "uganda-subset-mol_unix.gds", package = "R.SamBada"),
      file.path(tempdir(),'uganda-subset-mol.gds'), overwrite=TRUE)
}
###################
# Run prepareOutput
###################
prep=prepareOutput(file.path(tempdir(),'uganda-subset-mol'),2,popStr=TRUE,
     interactiveChecks=FALSE)

SolangeD/RSambada documentation built on Dec. 27, 2021, 12:17 a.m.