Description Usage Arguments Details Value Author(s) See Also Examples
asSnpMatrix converts a GenotypeData
object to a SnpMatrix-class object.
1 2 | asSnpMatrix(genoData, snpNames="snpID", scanNames="scanID",
snp=c(1,-1), scan=c(1,-1))
|
genoData |
A |
snpNames |
The name of the SNP variable in |
scanNames |
The name of the scan variable in |
snp |
An integer vector of the form (start, count), where start is the index of the first data element to read and count is the number of elements to read. A value of '-1' for count indicates that all SNPs should be read. |
scan |
An integer vector of the form (start, count), where start is the index of the first data element to read and count is the number of elements to read. A value of '-1' for count indicates that all scans should be read. |
The default is to extract all SNPs and scans from genoData, but
for a large dataset this may exceed R's memory limit. Alternatively,
snp and scan may be used to specify (start,
count) of SNPs and scans to extract from genoData.
In the SnpMatrix object, genotypes are stored as 0 = missing, 1
= "A/A", 2= "A/B" or "B/A", and 3 = "B/B". (In a GenotypeData
object, 0 = "B/B", 1 = "A/B" or "B/A", and 2 = "A/A".)
Columns are SNPs with
names snpNames and rows are scans with names scanNames
(the transpose of the GenotypeData object).
A SnpMatrix-class object.
Stephanie Gogarten
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | library(snpStats)
library(GWASdata)
file <- system.file("extdata", "illumina_geno.gds", package="GWASdata")
gds <- GdsGenotypeReader(file)
data(illuminaSnpADF, illuminaScanADF)
genoData <- GenotypeData(gds, snpAnnot=illuminaSnpADF, scanAnnot=illuminaScanADF)
snpmat <- asSnpMatrix(genoData, snpNames="rsID", scanNames="scanID")
snpmat
as(snpmat[1:5, 1:5], "character")
summary(snpmat)
# only chromosome 21
chr <- getChromosome(genoData)
c21 <- which(chr == 21)
snpmat <- asSnpMatrix(genoData, snpNames="rsID", scanNames="scanID",
snp=c(c21[1], length(c21)))
snpmat
close(genoData)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.