Learn R Programming

HIBAG (version 1.8.3)

hlaMakeSNPGeno: Make a SNP genotype object

Description

To create a hlaSNPGenoClass object (SNP genotypic object).

Usage

hlaMakeSNPGeno(genotype, sample.id, snp.id, snp.position, A.allele, B.allele, assembly="auto")

Arguments

genotype
a genotype matrix, ``# of SNPs'' - by - ``# of individuals''
sample.id
a vector of sample IDs
snp.id
a vector of SNP IDs
snp.position
a vector of SNP positions
A.allele
a vector of A alleles in the SNP list
B.allele
a vector of B alleles in the SNP list
assembly
the human genome reference: "hg18", "hg19" (default), "hg20"; "auto" refers to "hg19"; "auto-silent" refers to "hg19" without any warning

Value

Return a hlaSNPGenoClass object, and it is a list:
genotype
a genotype matrix, ``# of SNPs'' - by - ``# of individuals''
sample.id
a vector of sample IDs
snp.id
a vector of SNP IDs
snp.position
a vector of SNP positions in basepair
snp.allele
a vector of characters with the format of ``A allele/B allele''
assembly
the human genome reference

Details

genotype is a numeric matrix, with an entry value 0 standing for BB (ZERO A allele), 1 for AB (ONE A allele), 2 for AA (TWO A alleles) and others for missing values (missing genotypes are usually set to be NA).

See Also

hlaGenoSubset, hlaGenoCombine

Examples

Run this code
summary(HapMap_CEU_Geno)

allele <- strsplit(HapMap_CEU_Geno$snp.allele, "/")
A.allele <- sapply(allele, function(x) { x[1] })
B.allele <- sapply(allele, function(x) { x[2] })

geno <- hlaMakeSNPGeno(HapMap_CEU_Geno$genotype, HapMap_CEU_Geno$sample.id,
    HapMap_CEU_Geno$snp.id, HapMap_CEU_Geno$snp.position, A.allele, B.allele,
    assembly="hg19")

summary(geno)

Run the code above in your browser using DataLab