XSnpMatrix-class: Class "XSnpMatrix"

Description Objects from the Class Slots Extends Methods Author(s) See Also Examples

Description

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

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

Author(s)

David Clayton dc208@cam.ac.uk

See Also

SnpMatrix-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

Example output

Loading required package: survival
Loading required package: Matrix
$sex
haploid diploid 
    214     186 

$rows
   Call.rate      Certain.calls Heterozygosity  
 Min.   :0.4516   Min.   :1     Min.   :0.0000  
 1st Qu.:0.6903   1st Qu.:1     1st Qu.:0.0000  
 Median :0.9032   Median :1     Median :0.0000  
 Mean   :0.8345   Mean   :1     Mean   :0.1125  
 3rd Qu.:0.9290   3rd Qu.:1     3rd Qu.:0.2361  
 Max.   :0.9484   Max.   :1     Max.   :0.3458  

$cols
     Calls         Call.rate      Certain.calls      RAF         
 Min.   :  0.0   Min.   :0.0000   Min.   :1     Min.   :0.00000  
 1st Qu.:264.0   1st Qu.:0.6600   1st Qu.:1     1st Qu.:0.08831  
 Median :389.0   Median :0.9725   Median :1     Median :0.45126  
 Mean   :333.8   Mean   :0.8345   Mean   :1     Mean   :0.46021  
 3rd Qu.:397.0   3rd Qu.:0.9925   3rd Qu.:1     3rd Qu.:0.83244  
 Max.   :400.0   Max.   :1.0000   Max.   :1     Max.   :1.00000  
                                  NA's   :2     NA's   :2        
      MAF                P.AA              P.AB              P.BB         
 Min.   :0.000000   Min.   :0.00000   Min.   :0.00000   Min.   :0.000000  
 1st Qu.:0.007812   1st Qu.:0.03226   1st Qu.:0.01081   1st Qu.:0.005405  
 Median :0.113990   Median :0.30811   Median :0.18852   Median :0.195652  
 Mean   :0.174095   Mean   :0.42316   Mean   :0.23098   Mean   :0.345855  
 3rd Qu.:0.313218   3rd Qu.:0.83607   3rd Qu.:0.43784   3rd Qu.:0.655462  
 Max.   :0.496552   Max.   :1.00000   Max.   :0.72283   Max.   :1.000000  
 NA's   :2          NA's   :2         NA's   :2         NA's   :2         
      P.A              P.B              z.HWE          Calls.diploid  
 Min.   :0.0000   Min.   :0.00000   Min.   :-3.60226   Min.   :  0.0  
 1st Qu.:0.1619   1st Qu.:0.07729   1st Qu.:-0.55347   1st Qu.:122.0  
 Median :0.5461   Median :0.45390   Median : 0.13749   Median :184.0  
 Mean   :0.5430   Mean   :0.45699   Mean   : 0.06628   Mean   :157.5  
 3rd Qu.:0.9227   3rd Qu.:0.83810   3rd Qu.: 0.51360   3rd Qu.:186.0  
 Max.   :1.0000   Max.   :1.00000   Max.   : 7.67702   Max.   :186.0  
 NA's   :2        NA's   :2         NA's   :36                        

     174193 174196 174197 174208 174217 174219 174228 176365 176369 176370
1987 "B/B"  "A/A"  "A/A"  "A/B"  "A/A"  "A/A"  "A/A"  "B/B"  "A/A"  "B/B" 
436  "B"    "A"    "NA"   "B"    "NA"   "A"    "NA"   "B"    "NA"   "B"   
762  "B/B"  "A/A"  "A/A"  "B/B"  "A/A"  "A/A"  "A/B"  "B/B"  "A/A"  "B/B" 
1199 "A"    "A"    "A"    "B"    "A"    "A"    "A"    "B"    "A"    "B"   
1296 "B"    "A"    "A"    "A"    "A"    "A"    "NA"   "B"    "NA"   "B"   
81   "A"    "A"    "NA"   "B"    "A"    "A"    "NA"   "B"    "NA"   "A"   
1278 "B"    "A"    "A"    "B"    "B"    "A"    "NA"   "B"    "NA"   "B"   
1610 "A/B"  "A/A"  "NA"   "B/B"  "A/B"  "A/A"  "A/B"  "B/B"  "NA"   "B/B" 
1121 "B"    "A"    "NA"   "B"    "A"    "A"    "A"    "B"    "NA"   "B"   
1825 "B"    "A"    "A"    "B"    "A"    "A"    "NA"   "B"    "NA"   "B"   

snpStats documentation built on Nov. 8, 2020, 10:59 p.m.