Skip to contents

Calculates profiles for each character in a dataset. Will also simplify characters, with a warning, where they are too complex for the present implementation of profile parsimony:

  • inapplicable tokens will be replaced with the ambiguous token (i.e. -?);

  • Ambiguous tokens will be treated as fully ambiguous (i.e. {02}?)

  • Where more than two states are informative (i.e. unambiguously present in more than one taxon), states beyond the two most informative will be ignored.

Usage

PrepareDataProfile(dataset)

PrepareDataIW(dataset)

Arguments

dataset

dataset of class phyDat

Value

An object of class phyDat, with additional attributes. PrepareDataProfile adds the attributes:

  • info.amounts: details the information represented by each character when subject to N additional steps.

  • informative: logical specifying which characters contain any phylogenetic information.

  • bootstrap: The character vector c("info.amounts", "split.sizes"), indicating attributes to sample when bootstrapping the dataset (e.g. in Ratchet searches).

PrepareDataIW adds the attribute:

  • min.length: The minimum number of steps that must be present in each transformation series.

Functions

  • PrepareDataIW(): Prepare data for implied weighting

See also

Other profile parsimony functions: Carter1(), StepInformation(), WithOneExtraStep(), profiles

Author

Martin R. Smith; written with reference to phangorn:::prepareDataFitch()

Examples

data("congreveLamsdellMatrices")
dataset <- congreveLamsdellMatrices[[42]]
PrepareDataProfile(dataset)
#> $`1`
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> 
#> $`2`
#>  [1] 1 2 2 1 2 2 2 2 2 1 1 1 2 1 1 2 1 1 2 1 1 1 2 2 2 2 1 1 1 1 2 2 2 1 2 2 2 2
#> [39] 1 2 1 1 2 1 1 2 1 1 2 2 2 2 2 1 1
#> 
#> $`3`
#>  [1] 1 1 2 1 2 2 1 2 1 1 1 1 2 1 1 2 2 1 2 1 2 1 2 2 2 2 2 1 1 1 2 1 2 1 1 2 2 2
#> [39] 1 2 1 1 2 2 2 2 1 1 2 2 2 2 2 1 1
#> 
#> $`4`
#>  [1] 1 1 2 1 2 2 1 2 1 1 2 1 2 1 1 1 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1 2 2
#> [39] 2 2 1 2 1 1 1 1 2 1 2 2 1 1 2 1 2
#> 
#> $`20`
#>  [1] 1 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 1 2 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 2
#> [39] 1 2 2 1 1 2 1 1 1 1 2 1 1 2 1 1 1
#> 
#> $`21`
#>  [1] 1 1 2 1 2 2 2 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 1 1 1 1 2 1 1 2 2 1 1 1 1 2
#> [39] 1 2 2 1 1 2 2 2 1 1 1 1 1 2 1 1 2
#> 
#> $`22`
#>  [1] 2 1 2 1 2 2 2 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 1 2 1 1 2 2 1 1 1 1 1
#> [39] 1 2 1 2 2 2 2 2 1 1 2 1 1 2 1 1 2
#> 
#> attr(,"class")
#> [1] "phyDat"
#> attr(,"weight")
#>  [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
#> attr(,"nr")
#> [1] 55
#> attr(,"nc")
#> [1] 2
#> attr(,"index")
#>  [1]  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] 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] 51 52 53 54 55
#> attr(,"levels")
#> [1] "0" "1"
#> attr(,"allLevels")
#> [1] "0" "1" "?"
#> attr(,"type")
#> [1] "USER"
#> attr(,"contrast")
#>      0 1
#> [1,] 1 0
#> [2,] 0 1
#> [3,] 1 1
#> attr(,"info.amounts")
#>         [,1]      [,2]      [,3]     [,4]     [,5]      [,6]      [,7]
#> 1   0.000000  0.000000  0.000000 0.000000 0.000000  0.000000  0.000000
#> 2   5.285402  5.285402  5.285402 5.285402 5.285402  5.285402  5.285402
#> 3   9.150901  9.241099  9.345992 8.909893 8.909893  9.345992  9.330469
#> 4  11.717248 12.160268 12.570623 0.000000 0.000000 12.570623 12.515059
#> 5   0.000000 13.954287 15.099350 0.000000 0.000000 15.099350 14.964820
#> 6   0.000000  0.000000 16.993755 0.000000 0.000000 16.993755 16.718906
#> 7   0.000000  0.000000 18.287328 0.000000 0.000000 18.287328 17.781620
#> 8   0.000000  0.000000 19.024174 0.000000 0.000000 19.024174 18.191556
#> 9   0.000000  0.000000 19.314029 0.000000 0.000000 19.314029  0.000000
#> 10  0.000000  0.000000 19.364620 0.000000 0.000000 19.364620  0.000000
#> 11  0.000000  0.000000  0.000000 0.000000 0.000000  0.000000  0.000000
#>         [,8]      [,9]     [,10]     [,11]     [,12]     [,13]    [,14]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000 0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402  5.285402 5.285402
#> 3   9.340527  9.241099  9.150901  9.345992  9.340527  9.340527 8.909893
#> 4  12.551238 12.160268 11.717248 12.570623 12.551238 12.551238 0.000000
#> 5  15.052965 13.954287  0.000000 15.099350 15.052965 15.052965 0.000000
#> 6  16.900419  0.000000  0.000000 16.993755 16.900419 16.900419 0.000000
#> 7  18.118578  0.000000  0.000000 18.287328 18.118578 18.118578 0.000000
#> 8  18.748741  0.000000  0.000000 19.024174 18.748741 18.748741 0.000000
#> 9  18.928521  0.000000  0.000000 19.314029 18.928521 18.928521 0.000000
#> 10  0.000000  0.000000  0.000000 19.364620  0.000000  0.000000 0.000000
#> 11  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000 0.000000
#>        [,15]     [,16]     [,17]     [,18]     [,19]    [,20]     [,21]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000 0.000000  0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402 5.285402  5.285402
#> 3   9.150901  9.241099  9.150901  9.330469  9.347729 8.909893  9.347729
#> 4  11.717248 12.160268 11.717248 12.515059 12.576744 0.000000 12.576744
#> 5   0.000000 13.954287  0.000000 14.964820 15.113879 0.000000 15.113879
#> 6   0.000000  0.000000  0.000000 16.718906 17.022695 0.000000 17.022695
#> 7   0.000000  0.000000  0.000000 17.781620 18.339056 0.000000 18.339056
#> 8   0.000000  0.000000  0.000000 18.191556 19.107959 0.000000 19.107959
#> 9   0.000000  0.000000  0.000000  0.000000 19.432730 0.000000 19.432730
#> 10  0.000000  0.000000  0.000000  0.000000 19.504816 0.000000 19.504816
#> 11  0.000000  0.000000  0.000000  0.000000 19.509010 0.000000 19.509010
#>        [,22]     [,23]     [,24]     [,25]     [,26]     [,27]     [,28]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402  5.285402  5.285402
#> 3   9.241099  9.345992  9.340527  9.340527  9.347729  9.340527  9.150901
#> 4  12.160268 12.570623 12.551238 12.551238 12.576744 12.551238 11.717248
#> 5  13.954287 15.099350 15.052965 15.052965 15.113879 15.052965  0.000000
#> 6   0.000000 16.993755 16.900419 16.900419 17.022695 16.900419  0.000000
#> 7   0.000000 18.287328 18.118578 18.118578 18.339056 18.118578  0.000000
#> 8   0.000000 19.024174 18.748741 18.748741 19.107959 18.748741  0.000000
#> 9   0.000000 19.314029 18.928521 18.928521 19.432730 18.928521  0.000000
#> 10  0.000000 19.364620  0.000000  0.000000 19.504816  0.000000  0.000000
#> 11  0.000000  0.000000  0.000000  0.000000 19.509010  0.000000  0.000000
#>        [,29]     [,30]     [,31]     [,32]     [,33]     [,34]     [,35]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402  5.285402  5.285402
#> 3   9.340527  9.345992  9.340527  9.345992  9.330469  9.241099  9.340527
#> 4  12.551238 12.570623 12.551238 12.570623 12.515059 12.160268 12.551238
#> 5  15.052965 15.099350 15.052965 15.099350 14.964820 13.954287 15.052965
#> 6  16.900419 16.993755 16.900419 16.993755 16.718906  0.000000 16.900419
#> 7  18.118578 18.287328 18.118578 18.287328 17.781620  0.000000 18.118578
#> 8  18.748741 19.024174 18.748741 19.024174 18.191556  0.000000 18.748741
#> 9  18.928521 19.314029 18.928521 19.314029  0.000000  0.000000 18.928521
#> 10  0.000000 19.364620  0.000000 19.364620  0.000000  0.000000  0.000000
#> 11  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000
#>        [,36]     [,37]     [,38]     [,39]     [,40]     [,41]     [,42]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402  5.285402  5.285402
#> 3   9.313959  9.241099  9.340527  9.241099  9.241099  9.287129  9.345992
#> 4  12.454214 12.160268 12.551238 12.160268 12.160268 12.351120 12.570623
#> 5  14.811609 13.954287 15.052965 13.954287 13.954287 14.535765 15.099350
#> 6  16.389045  0.000000 16.900419  0.000000  0.000000 15.738559 16.993755
#> 7  17.137108  0.000000 18.118578  0.000000  0.000000  0.000000 18.287328
#> 8   0.000000  0.000000 18.748741  0.000000  0.000000  0.000000 19.024174
#> 9   0.000000  0.000000 18.928521  0.000000  0.000000  0.000000 19.314029
#> 10  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000 19.364620
#> 11  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000  0.000000
#>        [,43]     [,44]     [,45]     [,46]     [,47]    [,48]     [,49]
#> 1   0.000000  0.000000  0.000000  0.000000  0.000000 0.000000  0.000000
#> 2   5.285402  5.285402  5.285402  5.285402  5.285402 5.285402  5.285402
#> 3   9.287129  9.330469  9.347729  9.241099  9.330469 0.000000  9.287129
#> 4  12.351120 12.515059 12.576744 12.160268 12.515059 0.000000 12.351120
#> 5  14.535765 14.964820 15.113879 13.954287 14.964820 0.000000 14.535765
#> 6  15.738559 16.718906 17.022695  0.000000 16.718906 0.000000 15.738559
#> 7   0.000000 17.781620 18.339056  0.000000 17.781620 0.000000  0.000000
#> 8   0.000000 18.191556 19.107959  0.000000 18.191556 0.000000  0.000000
#> 9   0.000000  0.000000 19.432730  0.000000  0.000000 0.000000  0.000000
#> 10  0.000000  0.000000 19.504816  0.000000  0.000000 0.000000  0.000000
#> 11  0.000000  0.000000 19.509010  0.000000  0.000000 0.000000  0.000000
#>        [,50]    [,51]     [,52]     [,53]     [,54]     [,55]
#> 1   0.000000 0.000000  0.000000  0.000000  0.000000  0.000000
#> 2   5.285402 5.285402  5.285402  5.285402  5.285402  5.285402
#> 3   9.287129 0.000000  9.330469  9.340527  9.241099  9.313959
#> 4  12.351120 0.000000 12.515059 12.551238 12.160268 12.454214
#> 5  14.535765 0.000000 14.964820 15.052965 13.954287 14.811609
#> 6  15.738559 0.000000 16.718906 16.900419  0.000000 16.389045
#> 7   0.000000 0.000000 17.781620 18.118578  0.000000 17.137108
#> 8   0.000000 0.000000 18.191556 18.748741  0.000000  0.000000
#> 9   0.000000 0.000000  0.000000 18.928521  0.000000  0.000000
#> 10  0.000000 0.000000  0.000000  0.000000  0.000000  0.000000
#> 11  0.000000 0.000000  0.000000  0.000000  0.000000  0.000000
#> attr(,"informative")
#>  [1] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [16] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [31] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> [46] TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE
#> attr(,"bootstrap")
#> [1] "info.amounts"