Learn R Programming

⚠️There's a newer version (1.1.0) of this package.Take me there.

Mega2R (version 1.0.6)

Accessing and Processing a 'Mega2' Genetic Database

Description

Uses as input genetic data that have been reformatted and stored in a 'SQLite' database; this database is initially created by the standalone 'mega2' C++ program (available freely from ). Loads and manipulates data frames containing genotype, phenotype, and family information from the input 'SQLite' database, and decompresses needed subsets of the genotype data, on the fly, in a memory efficient manner. We have also created several more functions that illustrate how to use the data frames as well as perform useful tasks: these permit one to run the 'pedgene' package to carry out gene-based association tests on family data using selected marker subsets, to run the 'SKAT' package to carry out gene-based association tests using selected marker subsets, to run the 'famSKATRC' package to carry out gene-based association tests on families (optionally) and with rare or common variants using selected marker subsets, to output the 'Mega2R' data as a VCF file and related files (for phenotype and family data), and to convert the data frames into CoreArray Genomic Data Structure (GDS) format.

Copy Link

Version

Install

install.packages('Mega2R')

Monthly Downloads

52

Version

1.0.6

License

GPL-2

Maintainer

Daniel E Weeks

Last Published

May 15th, 2020

Functions in Mega2R (1.0.6)

Mega2R-TBLS

Mega2R SQLite3 tables
Mega2R

Mega2R package
mkGenABELgenotype

generate GenABEL compressed genotype matrix
Mega2pedgene

Execute the pedgene function on a transcript ranges
Mega2gdsfmt

transcode mega2 to gdsfmt/SNP_ARRAY
dump_mega2rtutorial_data

dump tutorial data
mkGenABELphenotype

generate required PLINK (.phe) file
mkVCFphe

generate required PLINK (.phe) file
mkphenotype

generate a phenotype data frame
dmpPed

generate the .ped, .fam and .map files of PLINK PED representation of a gwaa.data-class object
getgenotypes

fetch genotype character matrix for specified markers
mk_markers_with_skip

make the derived "markers" data frame and store it in the environment.
read.Mega2DB

load Mega2 database and initialize family data frame and markers data frame
applyFnToMarkers

apply a function to the genotypes from a set of markers
getgenotypesraw

fetch genotype integer matrix for specified markers
applyFnToGenes

apply a function to the genotypes (markers) in each gene transcript and/or base pair range
init_SKAT

load Mega2 SQLite database and perform initialization for SKAT usage
DOpedgene

pedgene call back function
Mega2ENVGenABEL

generate gwaa.data-class object
getgenotype_person

return the genotypes for all markers of a given person
showPhenoNames

show the association between index no and phenotype
mkVCFfreq

generate required VCF frequency (.freq) file
getAlleles

pull allele pairs
mkVCFhdr

generate required VCF header
Mega2SKAT

execute the CRAN SKAT function on a subset of the gene transcripts
computeDosage

computeDosage function
init_pedgene

load Mega2 SQLite database and perform initialization for pedgene usage
init_famSKATRC

load Mega2 SQLite database and perform initialization for famSKATRC usage
dbmega2_import

read Mega2 SQLite database into R
mkfam

assemble pedigree information into a data frame
mk_unified_genotype_table

concatenate separate genotype vectors for each chromosome to one extended vector containing all the chromosomes and store it in the environment.
uniqueFamMember

regenerate fam data frame with unique values in member column
Mega2VCF

generate a VCF file set for a collection of markers
resetMega2ENV

return an initialized environment
setAnnotations

set default name of transcription database and name of database mapping gene name to entrez gene id
getgenotypes_R

fetch genotype matrix for specified markers (assemble by rows)
mkAlleles

generate allele pairs in with MAJ(or) allele first
getgenotypesgenabel

process the genotype matrix for specified markers and return the corresponding GenABEL genotype matrix
Mega2famSKATRC

execute the CRAN famSKAT_RC function on a subset of the gene transcripts
getgenotypesdos

fetch dosage integer matrix for specified markers
mkVCFpen

generate required Mega2 penetrance (.pen) file
mkGenABELtfam

generate required fam family for PLINK TPED (.tfam) file
mkGenABELtped

generate a PLINK TPED file for GenABEL
mkVCFmap

generate required Mega2 map (.map) file
mkGenABELcoding

generate GenABEL coding vector
mkVCFfam

generate required VCF family (.fam) file
mkMarkers

create "markers" data frame
setRanges

set default range data: chromosome and start/end base pair
setfam

replace the pedigree data frame
showMapNames

show the association between mapno and mapname
where_mega2rtutorial_data

show directory of tutorial data
showMega2ENV

show Mega2R environment, viz. data frames and related info.
Mega2GenABELClean

delete temporary PLINK tped files processed by GenABEL
DOSKAT

SKAT call back function
Mega2GenABELtst

compare two gwaa.data-class objects
Mega2GenABEL

generate gwaa.data-class object from a Mega2R database
Mega2R-TBLSFilter

Mega2R SQLite3 table filter
DOfamSKATRC

DofamSKATRC call back function
applyFnToRanges

apply a function to all the genotypes for markers found in several specified ranges
clean_mega2rtutorial_data

remove tutorial data
Mega2RVersion

Mega2R version