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       T       C
#> 2           1     snp_2            0         2000       C       T
#> 3           1     snp_3            0         3000       T       C
#> 4           1     snp_4            0         4000       C       T
#> 5           1     snp_5            0         5000       T       C
#> 6           1     snp_6            0         6000       C       T
#> 7           1     snp_7            0         7000       T       C
#> 8           1     snp_8            0         8000       C       T
#> 9           1     snp_9            0         9000       C       T
#> 10          1    snp_10            0        10000       T       C
#> 11          1    snp_11            0        11000       T       C
#> 12          1    snp_12            0        12000       C       T
#> 
#> 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   NA    2    1    0   NA   NA    0    2     1     0    NA
#> [2,]    1    1    0    2   NA    0    1    1    2     1     1    NA
#> [3,]    2    2    0    1   NA    0    2    2    1     0     1    NA
#> [4,]    2    1    1    2    0    1    2    1    2     1     1     2
#> [5,]    2   NA    2    0   NA    2    1    1    1     2     0    NA