racset: Randomize an acset

Description Usage Arguments Details Value Examples

View source: R/performance.R

Description

racset randomizes the entries in the allele count matrixes or the genotype matrix

Usage

1
racset(acset, type = "ac", fixedrowmargin = FALSE)

Arguments

acset

An acset list created by new_acset.

type

A character string with two allowed values. 'ac' specifies that the allele count matrixes should be randomized and 'gt' specifies that the genotype matrix should be randomized.

fixedrowmargin

Boolean specifying if the row-sums should be kept unchanged.

Details

The function scrambles all entries within each allele count matrix or within the genotype matrix.

Value

acset A randomized acset list.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
##create a small artificial genotype matrix
ncells = 10
paternal = c(0, 2, 0, 0, 2)
maternal = c(2, 0, 2, 2, 0)
gt = as.matrix(as.data.frame(rep(list(paternal, maternal), ncells / 2)))
vars = 1:nrow(gt)
colnames(gt) = 1:ncells
rownames(gt) = vars

##create a feature annotation data-frame
nvars = nrow(gt)
featdata = as.data.frame(matrix(cbind(rep('jfeat', nvars),
as.character(1:nvars), rep('dummy', nvars), rep('dummy', nvars)), ncol = 4,
dimnames = list(vars, c('feat', 'var', 'ref', 'alt'))), stringsAsFactors =
FALSE)

##create acset
acset = new_acset(featdata, gt = gt)

##Randomize the genotype matrix
type = 'gt'
acset_rand = racset(acset, type)

scphaser documentation built on May 29, 2017, 3:49 p.m.