haploblock_df2list: convert a haploblock-defining data frame to a list

Description Usage Arguments Details Value Examples

View source: R/PolyHaplotyper.R

Description

convert a haploblock-defining data frame to a list as needed by inferHaplotypes

Usage

1
haploblock_df2list(df, mrkcol, hbcol, sorted=TRUE)

Arguments

df

a data.frame with at least the following two columns

mrkcol

the name or number of the column with the markers

hbcol

the name or number of the column with the haploblocks

sorted

if TRUE (default) the haploblock list is sorted in alphabetical order of haploblock name (the markers within haploblocks are not sorted); if FALSE the haploblocks will be in order of first occurrence in df

Details

function inferHaplotypes needs a list where each item is a vector of all markers in one haploblock. This function produces such a list from a data.frame where the markers are in one column and the haploblocks in another column. The markers and haploblocks columns may be character, factor or numeric, and the columns may be indicated by name or number.

Value

the desired list

Examples

1
2
3
4
5
df1 <- data.frame(
 marker=paste0("mrk",1:9),
 block=LETTERS[c(1,2,3,2,3,1,1,2,2)],
 extracol=runif(9))
haploblock_df2list(df=df1, mrkcol="marker", hbcol=2)

PolyHaplotyper documentation built on June 17, 2021, 5:12 p.m.