plotManhattan: Manhattan plot

Description Usage Arguments Value Author(s) Examples

View source: R/Postprocessing.R

Description

Plot the manhattan plot for a given environmental data

Usage

1
2
plotManhattan(preparedOutput, varEnv, valueName, chromo = "all",
  saveType = NULL, threshold = NULL, highlight = NULL)

Arguments

preparedOutput

char The prepared output list from prepare_output function

varEnv

char The name of the environmental variable one wish to study. Can be a vector of char if you want to plot several varEnv at a row. If saveType is NULL, the program prompts to continue. If saveType is png or pdf, several files are saved

valueName

char Name of the p- or q-value one wish to plot the manhattan on. This can be either pvalueG, pvalueW, qvalueG, qvalueW for G- or Waldscore respectively.

chromo

char/integer Name or vector of name of the chromosome to investigate. If all is chosen (default), all numerical chromosome will be mapped. If your sambada output is large (typically if you are working with more than 50K genomic file), you should probably map a subset of your dataset (e.g. chromo=1)

saveType

char One of NULL, 'png' or 'pdf'. If NULL is set, the plot will be shown in the R plotting window. Otherwise, it will be saved in the specified format in your working directory with the name 'manhattan-' followed by varEnv.

threshold

double A digit number indicating a value to draw a threshold line

highlight

char Name of the genotype to highlight in red on plot (should be SNPName_Genotype e.g. 'ARS-BFGL-NGS-106879_AA')

Value

The last plot object (if several varEnv are specified, only the last one is returned)

Author(s)

Solange Duruz

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 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) #If you run Unix
}
# Run prepareOutput
prep=prepareOutput(file.path(tempdir(),'uganda-subset-mol'),2,popStr=TRUE,
     interactiveChecks=FALSE)
###################
# Run plotManhattan
###################
plotManhattan(prep, c('bio1'),chromo='all',valueName='pvalueG')

# Example with several environmental variables
plotManhattan(prep,c('bio1','bio2'),'pvalueG')

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