This function takes as arguments a character vector of species names and an alignment and returns a list of length 2 reporting 1) the number of characters supporting the relationship between the specified species and 2) a numeric vector of those characters in the alignment. The function can be downloaded here.

library(Claddis)
source("characters.supporting.clade.R")

align <- ReadMorphNexus("verifiedCharacterMatrix.nex")

species <- c("Phoenicopterus_chilensis", "Gavia_sp")

characters.supporting.clade(species = species,
                            alignment = align)
#> $`Number of supporting chars`
#> [1] 411
#> 
#> $`supporting chars`
#>   [1]   3   4   6   8   9  10  12  13  14  17  18  19  21  23  25  26  27
#>  [18]  29  33  35  36  37  38  39  40  41  46  47  48  49  51  53  54  55
#>  [35]  56  57  58  60  61  62  65  66  67  72  73  76  77  79  80  81  82
#>  [52]  83  84  85  86  87  89  90  91  93  94  95  96  97  98  99 100 101
#>  [69] 102 104 106 107 108 109 110 112 113 115 116 117 118 119 120 122 123
#>  [86] 125 127 128 133 134 135 136 137 140 141 142 144 145 146 148 149 150
#> [103] 151 152 153 154 155 156 157 159 161 163 164 165 167 170 171 172 173
#> [120] 174 176 177 178 179 180 182 184 185 187 189 191 192 193 194 196 197
#> [137] 206 207 212 214 215 216 219 221 222 223 224 226 228 229 230 231 232
#> [154] 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249
#> [171] 250 253 254 255 256 257 258 259 261 262 263 264 265 267 268 270 271
#> [188] 272 273 276 278 280 281 282 283 284 285 287 288 292 293 294 295 296
#> [205] 297 300 301 304 305 306 307 308 309 310 311 313 314 315 316 317 318
#> [222] 319 320 321 322 324 325 326 328 329 330 335 336 338 339 340 341 343
#> [239] 344 345 346 347 348 349 351 353 355 357 359 364 365 367 368 370 371
#> [256] 372 375 376 377 379 380 381 382 388 389 390 392 393 394 395 397 398
#> [273] 400 401 402 403 404 405 406 407 408 409 410 413 415 416 417 418 419
#> [290] 420 421 422 425 426 427 428 430 432 435 436 437 439 442 443 445 447
#> [307] 451 453 456 457 458 459 460 461 462 463 464 465 466 469 470 471 473
#> [324] 479 484 487 488 489 490 491 492 493 495 497 500 501 502 503 504 508
#> [341] 511 512 513 515 517 518 522 525 527 528 529 531 532 533 540 542 543
#> [358] 544 545 546 548 551 553 557 558 559 563 565 566 567 568 569 571 572
#> [375] 574 577 579 583 586 588 589 590 594 595 596 597 601 602 603 607 609
#> [392] 610 611 613 615 618 619 620 621 623 624 625 628 629 630 631 632 633
#> [409] 634 635 636

The numeric vector can then be used to look up characters in a list of descriptions, or passed to other elements in the workflow as required.

These data can also be visualized on a phylogen using the function plot.num.supporting.chars, provided in the same file. This can allow visual identification of any clades that perhaps deviate from any trends.


phy <- read.nexus("aTree.nex")

# see ?spec_color for viridis color options

plot.num.supporting.chars(phy=phy,
                          viridis.col="D",
                          alignment = align,
                          show.tip.label = FALSE, 
                          node.pch = 19, 
                          node.cex=2)
#> Loading required package: viridis
#> Loading required package: viridisLite
#> Loading required package: kableExtra
#> Loading required package: raster
#> Loading required package: sp
#> 
#> Attaching package: 'raster'
#> The following object is masked from 'package:dplyr':
#> 
#>     select
#> The following objects are masked from 'package:ape':
#> 
#>     rotate, zoom


plot.num.supporting.chars(phy=phy,
                          viridis.col="A",
                          alignment = align,
                          show.tip.label = FALSE, 
                          node.pch = 19, 
                          node.cex=2)