Learn R Programming

solarius (version 0.3.0.2)

snpdata2solar: Export snp genotypes, genotype covariates and amp to SOLAR

Description

A list of functions allows to pass SNPs data from R to SOLAR.

Usage

snpdata2solar(mat, dir)
snpcovdata2solar(mat, dir, nGTypes = FALSE, out)
snpmap2solar(map, dir)

Arguments

mat
A matrix of genotypes or genotypes as covariates to be exported.
dir
A character with path where SOLAR files to be created.
nGTypes
Logical, whether a column nGTypes to be added to snp.genocov file. The default value is FALSE.
out
(optional) A list, that contains the names for snp.genocov and snp.geno-list files. This argument is internally used in solarAssoc function.
map
A data frame with annotation (map) information for SNPs.

Details

snpdata2solar function (1) exports the data set of genotypes stored in mat itto SOLAR files, (2) runs solar command `snp load solar.gen` to check the data is loaded ok; (3) if two output files were not created, throws an error.

snpcovdata2solar function emulates the `snp load` SOLAR command. Two output files are produced: `snp.genocov` and `snp.geno-list`. The steps are the following: (1) add prefix `snp_` to SNP names; (2) (optional) compute stats on # genotyped individuals (columns `nGTypes`); (3) write data and metadata into files.

snpmap2solar function (1) separates data by chromosome; (2) write the table into SOLAR map file; (3) check if the map file is OK by running SOLAR command load map -basepair

Examples

Run this code
# Example of `snp.genocov` file:
# id,nGTypes,snp_s1,snp_s2,...
# 1,50,0,0,...
# 2,50,0,0,...

# Example of `snp.geno-list` file:
# snp_s1
# snp_s2
# ...

Run the code above in your browser using DataLab