snpStats (version 1.22.0)

XSnpMatrix-class: Class "XSnpMatrix"

Description

This class extends the SnpMatrix-class to deal with SNPs on the X and Y chromosomes and mitocondrial SNPs.

Arguments

Objects from the Class

Objects can be created by calls of the form new("XSnpMatrix", x, diploid). Such objects have an additional slot to objects of class "SnpMatrix" consisting of a logical array of the same length as the number of rows. This array indicates whether genotypes in that row are diploid (TRUE) or haploid (FALSE as, for example, SNPs on the X chromosome for males).

Slots

.Data:
Object of class "matrix" and storage mode "raw"
diploid:
Object of class "logical" indicating sex of samples

Extends

Class "SnpMatrix", directly, with explicit coerce. Class "matrix", by class "SnpMatrix". Class "structure", by class "SnpMatrix". Class "array", by class "SnpMatrix". Class "vector", by class "SnpMatrix", with explicit coerce. Class "vector", by class "SnpMatrix", with explicit coerce.

Methods

[]
signature(x = "XSnpMatrix", i = "ANY", j = "ANY", drop = "missing"): subset extraction
[<-
signature(x = "XSnpMatrix", i = "ANY", j = "ANY", "XSnpMatrix"): subset assignment operation to replace part of an object
coerce
signature(from = "XSnpMatrix", to = "character"): map to codes 0, 1, 2, or NA
coerce
signature(from = "SnpMatrix", to = "XSnpMatrix"): maps a SnpMatrix to an XSnpMatrix. Ploidy is inferred from the genotype data since haploid genotypes should always be coded as homozygous. After inferring ploidy, heterozygous calls for haploid genotpes are set to NA
show
signature(object = "XSnpMatrix"): map to codes "A/A", "A/B", "B/B", "A", "B" or ""
summary
signature(object = "XSnpMatrix"): returns the distribution of ploidy, together with summaries of the data frames returned by row.summary and col.summary

See Also

SnpMatrix-class

Examples

Run this code
data(testdata)
summary(Xchromosome)

# display the first 10 snps of the first 10 samples
print(as(Xchromosome[1:10,1:10],'character'))

# convert the empty strings (no-calls) explicitly to "NC" before
# writing to an (anonymous and temporary) csv file
csvfile <- tempfile()
write.csv(file=csvfile, gsub ('^$', 'NC',
                              as(Xchromosome[1:10,1:10], 'character')
                             ), quote=FALSE)
unlink(csvfile)

Run the code above in your browser using DataCamp Workspace