B cell Lineage Tree List¶
Bases: list
Extends class list in order to store and manipulate list of LineageTrees.
Source code in tribal/lineage_tree.py
455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 |
|
__str__()
¶
To string method.
Source code in tribal/lineage_tree.py
458 459 460 |
|
append(item)
¶
Append a LineageTree to the LineageTreeList.
Source code in tribal/lineage_tree.py
462 463 464 |
|
find_all_best_trees()
¶
Find the LineageTree(s) with optimal scores.
Returns:
Type | Description |
---|---|
float
|
the optimal CSR likelihood of the best LineageTree. |
LineageTreeList
|
a LineageTreeList of LineageTree with optimal CSR likelihood. |
Source code in tribal/lineage_tree.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
|
find_best_tree()
¶
Find the LineageTree with optimal score.
If there are multiple optimal solutions, it returns the first one it finds.
See find_all_best_trees
to get all optimal solutions in the LineageTreeList or sample_best_trees
to randomly
sample from among the optimal LineageTrees.
Returns:
Type | Description |
---|---|
float
|
the optimal CSR likelihood of the best LineageTree |
LineageTree
|
a LineageTree with optimal CSR likelihood |
Source code in tribal/lineage_tree.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
|
sample_best_tree(rng=None, seed=1016)
¶
Find a LineageTree with optimal score.
If there are multiple optimal solutions, it randomly samples among the lineage trees with optimal solutions.
See find_all_best_trees
to get all optimal solutions in the LineageTreeList or find_best_tree
to randomly
sample from among the optimal LineageTrees.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rng |
Generator
|
a numpy random number generator to use for sampling. (default: None) |
None
|
seed |
int
|
a random number seed to use to initialize a numpy.random.Generator (default: 1016) |
1016
|
Returns:
Type | Description |
---|---|
LineageTree
|
a randomly sampled LineageTree with optimal CSR likelihood |
Source code in tribal/lineage_tree.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 |
|
to_pickle(fname)
¶
Pickle the LineageTreeList.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fname |
str
|
the path to where the pickled object should be saved. |
required |
Source code in tribal/lineage_tree.py
537 538 539 540 541 542 543 544 545 546 |
|
write(fname, sep=',')
¶
Write the objective scores of all LineageTrees in the list to a file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fname |
str
|
path to where file should be written. |
required |
sep |
str
|
the seperator (default: ","). |
','
|
Source code in tribal/lineage_tree.py
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 |
|
write_all(outpath, isotype_encoding=None)
¶
Write the data for all LineageTrees in the list to files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
outpath |
str
|
the path to where the files should be written. |
required |
isotype_encoding |
list
|
the ordered isotype labeles |
None
|
Source code in tribal/lineage_tree.py
575 576 577 578 579 580 581 582 583 584 585 586 |
|