getsnp: Read SNP data from a binary dosage file

Description Usage Arguments Value Examples

View source: R/getsnp.R

Description

Routine to read the dosage and genetic probabilities about a SNP from a binary dosage file

Usage

1
getsnp(bdinfo, snp, dosageonly = TRUE)

Arguments

bdinfo

Information about a binary dosage file return from getbdinfo

snp

The SNP to read the information about. This may be the SNP ID or the index of the SNP in the snps dataset in the bdinfo list

dosageonly

Indicator to return the dosages only or the dosages allowing with the genetic probabilities. Default value is TRUE

Value

A list with either the dosages or the dosages and the genetic probabilities.

Examples

1
2
3
4
5
6
# Get the information about the file
vcf1abdfile <- system.file("extdata", "vcf1a.bdose", package = "BinaryDosage")
bdinfo <- getbdinfo(bdfiles = vcf1abdfile)

# Read the first SNP
getsnp(bdinfo, 1, FALSE)

Example output

$dosage
 [1] 2.000 1.002 1.000 0.122 1.000 0.000 1.004 2.000 0.000 0.918 2.000 0.940
[13] 0.783 0.000 1.000 0.013 1.000 0.000 0.089 1.000 2.000 0.869 0.000 1.000
[25] 1.860 1.000 0.000 0.982 1.000 2.000 0.000 0.000 1.000 0.000 0.000 1.000
[37] 0.065 0.949 0.850 0.000 1.031 1.000 1.015 0.000 0.000 0.000 1.000 2.000
[49] 0.000 0.999 1.000 0.000 0.121 0.000 0.000 2.000 0.000 1.000 0.000 0.000

$p0
 [1] 0.000 0.000 0.000 0.878 0.000 1.000 0.000 0.000 1.000 0.082 0.000 0.060
[13] 0.217 1.000 0.000 0.987 0.000 1.000 0.911 0.000 0.000 0.145 1.000 0.000
[25] 0.000 0.000 1.000 0.018 0.000 0.000 1.000 1.000 0.000 1.000 1.000 0.000
[37] 0.935 0.051 0.150 1.000 0.000 0.000 0.000 1.000 1.000 1.000 0.000 0.000
[49] 1.000 0.001 0.000 1.000 0.882 1.000 1.000 0.000 1.000 0.000 1.000 1.000

$p1
 [1] 0.000 0.998 1.000 0.122 1.000 0.000 0.996 0.000 0.000 0.918 0.000 0.940
[13] 0.783 0.000 1.000 0.013 1.000 0.000 0.089 1.000 0.000 0.842 0.000 1.000
[25] 0.140 1.000 0.000 0.982 1.000 0.000 0.000 0.000 1.000 0.000 0.000 1.000
[37] 0.065 0.949 0.850 0.000 0.969 1.000 0.985 0.000 0.000 0.000 1.000 0.000
[49] 0.000 0.999 1.000 0.000 0.115 0.000 0.000 0.000 0.000 1.000 0.000 0.000

$p2
 [1] 1.000 0.002 0.000 0.000 0.000 0.000 0.004 1.000 0.000 0.000 1.000 0.000
[13] 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000 0.014 0.000 0.000
[25] 0.860 0.000 0.000 0.000 0.000 1.000 0.000 0.000 0.000 0.000 0.000 0.000
[37] 0.000 0.000 0.000 0.000 0.031 0.000 0.015 0.000 0.000 0.000 0.000 1.000
[49] 0.000 0.000 0.000 0.000 0.003 0.000 0.000 1.000 0.000 0.000 0.000 0.000

BinaryDosage documentation built on Jan. 13, 2020, 5:06 p.m.