Last data update: 2014.03.03
R: SNP cluster plots
genoClusterPlot R Documentation
SNP cluster plots
Description
Generates either X,Y or R,Theta cluster plots for specified SNP's.
Usage
genoClusterPlot(intenData, genoData, plot.type = c("RTheta", "XY"),
snpID, main.txt = NULL, by.sex = FALSE,
scan.sel = NULL, scan.hilite = NULL,
start.axis.at.0 = FALSE,
colors = c("default", "neon", "primary"),
verbose = TRUE, ...)
genoClusterPlotByBatch(intenData, genoData, plot.type = c("RTheta", "XY"),
snpID, batchVar, main.txt = NULL, scan.sel = NULL,
colors = c("default", "neon", "primary"),
verbose = TRUE, ...)
Arguments
intenData
IntensityData
object containing 'X' and 'Y' values.
genoData
GenotypeData
object
plot.type
The type of plots to generate. Possible values are
"RTheta" (default) or "XY".
snpID
A numerical vector containing the SNP number for each plot.
batchVar
A character string indicating which annotation
variable should be used as the batch.
main.txt
A character vector containing the title to give to each plot.
by.sex
Logical value specifying whether to indicate sex on the
plot. If TRUE
, sex must be present in intenData or genoData.
scan.sel
integer vector of scans to include in the plot. If NULL
,
all scans will be included.
scan.hilite
integer vector of scans to highlight in the plot
with different colors. If NULL
, all scans will be plotted with
the same colors.
start.axis.at.0
Logical for whether the min value of each axis
should be 0.
colors
Color scheme to use for genotypes. "default" is colorblind safe (colorbrewer Set2), "neon" is bright orange/green/fuschia, and "primary" is red/green/blue.
verbose
Logical value specifying whether to show progress.
...
Other parameters to be passed directly to plot
.
Details
Either 'RTheta' (default) or 'XY' plots can be generated. R and Theta
values are computed from X and Y using the formulas r <- x+y
and
theta <- atan(y/x)*(2/pi)
.
If by.sex==TRUE
, females are indicated with circles and males
with crosses.
Author(s)
Caitlin McHugh
See Also
IntensityData
, GenotypeData
Examples
# create data object
library(GWASdata)
data(illuminaScanADF, illuminaSnpADF)
xyfile <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
xy <- GdsIntensityReader(xyfile)
xyData <- IntensityData(xy, scanAnnot=illuminaScanADF, snpAnnot=illuminaSnpADF)
genofile <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
geno <- GdsGenotypeReader(genofile)
genoData <- GenotypeData(geno, scanAnnot=illuminaScanADF, snpAnnot=illuminaSnpADF)
# select first 9 snps
snpID <- illuminaSnpADF$snpID[1:9]
rsID <- illuminaSnpADF$rsID[1:9]
par(mfrow=c(3,3)) # plot 3x3
genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID)
# select samples
scan.sel <- illuminaScanADF$scanID[illuminaScanADF$race == "CEU"]
genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID,
scan.sel=scan.sel, by.sex=TRUE)
genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID,
scan.hilite=scan.sel)
close(xyData)
close(genoData)
## affy data - cluster plots by plate
data(affyScanADF, affySnpADF)
xyfile <- system.file("extdata", "affy_qxy.nc", package="GWASdata")
xy <- NcdfIntensityReader(xyfile)
xyData <- IntensityData(xy, scanAnnot=affyScanADF, snpAnnot=affySnpADF)
genofile <- system.file("extdata", "affy_geno.nc", package="GWASdata")
geno <- NcdfGenotypeReader(genofile)
genoData <- GenotypeData(geno, scanAnnot=affyScanADF, snpAnnot=affySnpADF)
# select first 9 snps
snpID <- affySnpADF$snpID[1:9]
rsID <- affySnpADF$rsID[1:9]
genoClusterPlotByBatch(xyData, genoData, snpID=snpID, main.txt=rsID,
batchVar="plate")
close(xyData)
close(genoData)
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(GWASTools)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/GWASTools/genoClusterPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: genoClusterPlot
> ### Title: SNP cluster plots
> ### Aliases: genoClusterPlot genoClusterPlotByBatch
> ### Keywords: hplot
>
> ### ** Examples
>
> # create data object
> library(GWASdata)
> data(illuminaScanADF, illuminaSnpADF)
>
> xyfile <- system.file("extdata", "illumina_qxy.gds", package="GWASdata")
> xy <- GdsIntensityReader(xyfile)
> xyData <- IntensityData(xy, scanAnnot=illuminaScanADF, snpAnnot=illuminaSnpADF)
>
> genofile <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
> geno <- GdsGenotypeReader(genofile)
> genoData <- GenotypeData(geno, scanAnnot=illuminaScanADF, snpAnnot=illuminaSnpADF)
>
> # select first 9 snps
> snpID <- illuminaSnpADF$snpID[1:9]
> rsID <- illuminaSnpADF$rsID[1:9]
>
> par(mfrow=c(3,3)) # plot 3x3
> genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID)
start time = 2016-07-05 21:58:33
plot number = 1 system time = 2016-07-05 21:58:33
plot number = 2 system time = 2016-07-05 21:58:33
plot number = 3 system time = 2016-07-05 21:58:33
plot number = 4 system time = 2016-07-05 21:58:33
plot number = 5 system time = 2016-07-05 21:58:33
plot number = 6 system time = 2016-07-05 21:58:33
plot number = 7 system time = 2016-07-05 21:58:33
plot number = 8 system time = 2016-07-05 21:58:33
plot number = 9 system time = 2016-07-05 21:58:33
>
> # select samples
> scan.sel <- illuminaScanADF$scanID[illuminaScanADF$race == "CEU"]
> genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID,
+ scan.sel=scan.sel, by.sex=TRUE)
start time = 2016-07-05 21:58:33
plot number = 1 system time = 2016-07-05 21:58:33
plot number = 2 system time = 2016-07-05 21:58:33
plot number = 3 system time = 2016-07-05 21:58:33
plot number = 4 system time = 2016-07-05 21:58:33
plot number = 5 system time = 2016-07-05 21:58:33
plot number = 6 system time = 2016-07-05 21:58:33
plot number = 7 system time = 2016-07-05 21:58:33
plot number = 8 system time = 2016-07-05 21:58:33
plot number = 9 system time = 2016-07-05 21:58:33
>
> genoClusterPlot(xyData, genoData, snpID=snpID, main.txt=rsID,
+ scan.hilite=scan.sel)
start time = 2016-07-05 21:58:33
plot number = 1 system time = 2016-07-05 21:58:33
plot number = 2 system time = 2016-07-05 21:58:33
plot number = 3 system time = 2016-07-05 21:58:33
plot number = 4 system time = 2016-07-05 21:58:33
plot number = 5 system time = 2016-07-05 21:58:33
plot number = 6 system time = 2016-07-05 21:58:33
plot number = 7 system time = 2016-07-05 21:58:33
plot number = 8 system time = 2016-07-05 21:58:33
plot number = 9 system time = 2016-07-05 21:58:33
> close(xyData)
> close(genoData)
>
> ## affy data - cluster plots by plate
> data(affyScanADF, affySnpADF)
>
> xyfile <- system.file("extdata", "affy_qxy.nc", package="GWASdata")
> xy <- NcdfIntensityReader(xyfile)
> xyData <- IntensityData(xy, scanAnnot=affyScanADF, snpAnnot=affySnpADF)
>
> genofile <- system.file("extdata", "affy_geno.nc", package="GWASdata")
> geno <- NcdfGenotypeReader(genofile)
> genoData <- GenotypeData(geno, scanAnnot=affyScanADF, snpAnnot=affySnpADF)
>
> # select first 9 snps
> snpID <- affySnpADF$snpID[1:9]
> rsID <- affySnpADF$rsID[1:9]
>
> genoClusterPlotByBatch(xyData, genoData, snpID=snpID, main.txt=rsID,
+ batchVar="plate")
start time = 2016-07-05 21:58:33
i= 1 j= 1 2016-07-05 21:58:33
i= 1 j= 2 2016-07-05 21:58:33
i= 1 j= 3 2016-07-05 21:58:33
i= 2 j= 1 2016-07-05 21:58:33
i= 2 j= 2 2016-07-05 21:58:33
i= 2 j= 3 2016-07-05 21:58:33
i= 3 j= 1 2016-07-05 21:58:33
i= 3 j= 2 2016-07-05 21:58:33
i= 3 j= 3 2016-07-05 21:58:33
i= 4 j= 1 2016-07-05 21:58:33
i= 4 j= 2 2016-07-05 21:58:33
i= 4 j= 3 2016-07-05 21:58:33
i= 5 j= 1 2016-07-05 21:58:33
i= 5 j= 2 2016-07-05 21:58:34
i= 5 j= 3 2016-07-05 21:58:34
i= 6 j= 1 2016-07-05 21:58:34
i= 6 j= 2 2016-07-05 21:58:34
i= 6 j= 3 2016-07-05 21:58:34
i= 7 j= 1 2016-07-05 21:58:34
i= 7 j= 2 2016-07-05 21:58:34
i= 7 j= 3 2016-07-05 21:58:34
i= 8 j= 1 2016-07-05 21:58:34
i= 8 j= 2 2016-07-05 21:58:34
i= 8 j= 3 2016-07-05 21:58:34
i= 9 j= 1 2016-07-05 21:58:34
i= 9 j= 2 2016-07-05 21:58:34
i= 9 j= 3 2016-07-05 21:58:34
> close(xyData)
> close(genoData)
>
>
>
>
>
>
> dev.off()
null device
1
>