Fake a "bigSNP"

snp_fake(n, m)

Arguments

n

Number of individuals.

m

Number of SNPs.

Value

A new temporary bigSNP object representing n individuals and m SNPs. The genotype Filebacked Big Matrix is initialized with missing values.

Examples

(test <- snp_fake(5, 12))
#> $genotypes
#> A Filebacked Big Matrix of type 'code 256' with 5 rows and 12 columns.
#> 
#> $fam
#>   family.ID sample.ID paternal.ID maternal.ID sex affection
#> 1     fam_1     ind_1           0           0   0        -9
#> 2     fam_2     ind_2           0           0   0        -9
#> 3     fam_3     ind_3           0           0   0        -9
#> 4     fam_4     ind_4           0           0   0        -9
#> 5     fam_5     ind_5           0           0   0        -9
#> 
#> $map
#>    chromosome marker.ID genetic.dist physical.pos allele1 allele2
#> 1           1     snp_1            0         1000       C       T
#> 2           1     snp_2            0         2000       C       T
#> 3           1     snp_3            0         3000       T       C
#> 4           1     snp_4            0         4000       T       C
#> 5           1     snp_5            0         5000       C       T
#> 6           1     snp_6            0         6000       T       C
#> 7           1     snp_7            0         7000       T       C
#> 8           1     snp_8            0         8000       T       C
#> 9           1     snp_9            0         9000       T       C
#> 10          1    snp_10            0        10000       T       C
#> 11          1    snp_11            0        11000       C       T
#> 12          1    snp_12            0        12000       T       C
#> 
#> attr(,"class")
#> [1] "bigSNP"

# The genotype Filebackeg Big Matrix is initialized with missing values
G <- test$genotypes
G[]
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
#> [2,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
#> [3,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
#> [4,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA
#> [5,]   NA   NA   NA   NA   NA   NA   NA   NA   NA    NA    NA    NA

# Modify the genotype `big.matrix`
G[] <- sample(as.raw(0:3), size = length(G), replace = TRUE)
G[]
#>      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,]    0    0    0    0    1    2    0    2   NA     2     0     1
#> [2,]    0    2    0   NA    0    0    1    1    1    NA     2     1
#> [3,]    1    2    0    2    0    0    1   NA    1     2     1     2
#> [4,]    0    0   NA   NA   NA    0    1    2    1    NA     2     0
#> [5,]    1   NA   NA   NA    2    0    0    0   NA     1     1     0