Learn R Programming

GeRnika (version 1.1.0)

B_to_phylotree: Create a Phylotree object from a B matrix.

Description

This function creates a Phylotree class object from a B matrix.

Usage

B_to_phylotree(B, labels = NA)

Value

A Phylotree class object.

Arguments

B

A square matrix that represents the phylogenetic tree.

labels

An optional vector containing the tags of the genes in the phylogenetic tree. NA by default.

Examples

Run this code
# Create a B matrix instance
# composed by 10 subpopulations of
# clones
B <- create_instance(
       n = 10, 
       m = 4, 
       k = 1, 
       selection = "neutral")$B

# Create a new 'Phylotree' object
# on the basis of the B matrix
phylotree <- B_to_phylotree(B = B)

# Generate the tags for the genes of
# the phyogenetic tree
tags <- LETTERS[1:nrow(B)]

# Create a new 'Phylotree' object
# on the basis of the B matrix and
# the list of tags
phylotree_tags <- B_to_phylotree(
                    B = B, 
                    labels = tags)

Run the code above in your browser using DataLab