Convert between different IBD-state labelling schemes

Description

Convert "label", "lexicographic", "jacquard" and "vec", full state description vector.

All conversions are done to and from "label", as used in IBD_Haplo. More information regarding IBD_Haplo can be found at www.stat.washington.edu/thompson/Genepi/pangaea.shtml

See the tutorial by typing vignettes("IBDlabels_tutorial")

Details

Package: IBDlabel
Type: Package
Version: 1.0
Date: 2014-12-01
License: GPL-3

Author(s)

Fiona Grimson <fgrimson@uw.edu>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
## For more examples see

vignette( "IBDlabels_tutorial" )

######### All States ######################

## create lookup matrix
allStates( ngam = 4 )
allStates( ngam = 5 )

######### Jacquard Ordering ###############

## list all jacquard states
allJaq()

## Convert label to jacquard
label2jaq( 3, phased = TRUE )
label2jaq( 3, phased = FALSE )

## Convert jacquard to label
jaq2label( 9, phased = TRUE )
jaq2label( 9, phased = FALSE )

######## Lexicographic Ordering ###########

## Vector of all lexicograghic states with labels ( names of elements )
allLex( ngam = 4 )

## Convert lex to label
lex2label( lex = c( 1, 2, 15), ngam = 4 )

## Convert label to lex
## Some labels go to the same lex state
label2lex( label = c( 2, 3 ), ngam = 4 ) 

######## Vector Notation ##################

## Vectors for all labels
allVec( ngam = 4 )

## Convert vector to label, with renumbering 
vec2label( c(1,1,1,3))
vec2label( c(1,1,1,2)) 

## Convert label to vector
label2vec( 1, ngam = 4 )
label2vec( 2, ngam = 4 )
label2vec( 2, ngam = 6 ) 

## renumbering
fgl2vec( c( 1,1,1,3) )
fgl2vec( c(5,1,5,6) )