vcfR2SnpMatrix

0th

Percentile

Extract genotype information from a vcfR object

Convert a vcfR-class object into a list composed of genetic distances, subject IDs, and a SnpMatrix-class/XSnpMatrix-class object.

Keywords
hplot
Usage
vcfR2SnpMatrix(obj, phased = NULL, subjects = NULL)
Arguments
obj

An instance or path of the vcfR-class object to be processed.

phased

If TRUE the output genotype data are in the form of a XSnpMatrix-class object. Otherwise, they are in the form of a SnpMatrix-class object. If it is unspecified, the phasing status will be determined by checking the first entry in the gt slot of the vcfR object. If the first entry is also missing, the value will be set to FALSE.

subjects

A character or factor containing subject IDs. If supplied, genotype info of only those subjects will be returned. This should be a subset of the sample IDs in the vcfR object.

Details

In order to let vcfR2SnpMatrix function properly, the input vcfR-class object is expected to be generated from a valid VCF file which contains only biallelic SNPs and includes a GT section.

Value

A list which contains the following components:

genetic.distances

A numeric vector of the reference positions of SNPs.

subjectID

A character vector of IDs of the subjects which the returned genotype data belong to.

data

An object of SnpMatrix-class/XSnpMatrix-class containing genotype data.

See Also

read.vcfR, SnpMatrix-class, XSnpMatrix-class

Aliases
  • vcfR2SnpMatrix
Examples
# NOT RUN {
# Load the vcfR object
require(vcfR)
data(vcfR_example)
vcf <- vcf[8:12,]

# Extract needed genotype information
alist <- vcfR2SnpMatrix(vcf)

# Draw a pairwise LD plot using the extracted data
LDheatmap(alist$data, alist$genetic.distance)


# }
Documentation reproduced from package LDheatmap, version 0.99-7, License: GPL-3

Community examples

Looks like there are no examples yet.