Learn R Programming

bravo (version 4.1.0)

dense2sparse: Convert numeric genotype matrix to sparse matrix

Description

Reads a numeric genotype file and converts it to a sparse matrix format.

Usage

dense2sparse(
  file.name,
  num.genotypes = NULL,
  separator = NULL,
  fixed = TRUE,
  recode = TRUE,
  na.strings = c("NA", ".", "-9", "NN"),
  progress = TRUE
)

Value

A sparse matrix of class dgCMatix.

Arguments

file.name

Path to the numeric genotype file. Could be (and should be) gzipped.

num.genotypes

Maximum number of genotypes to read. An upper bound is OK.

separator

"\t" or "," etc. that separates the entries in a line.

fixed

Is `separator` a fixed string (TRUE) or a regex (FALSE)?

recode

recode each SNP so its major allele is 0 (per-SNP)

na.strings

tokens treated as missing

progress

Whether to show a progress bar (default TRUE).