RScelestial Vignette

  collapse = TRUE,
  comment = "#>"
# We load igraph for drawing trees. If you do not want to draw,
# there is no need to import igraph.

Installing RScelestial

The RScelestial package could be installed easily as follows



Here we show a simulation. We build a data set with following command.

# Following command generates ten samples with 20 loci. 
# Rate of mutations on each edge of the evolutionary tree is 1.5. 
D = synthesis(10, 20, 5, seed = 7)

Inferring the phylogenetic tree

seq = as.ten.state.matrix(D$seqeunce)
SP = scelestial(seq, return.graph = TRUE)

You can draw the graph with following command

tree.plot(SP, vertex.size = 30)

Also, we can make a rooted tree with cell "C8" as the root of the tree as follows:

SP = scelestial(seq, root.assign.method = "fix", root = "C8", return.graph = TRUE)
tree.plot(SP, vertex.size = 30)

Setting root.assign.method to "balance" lets the algorithm decide for a root that produces minimum height tree.

SP = scelestial(seq, root.assign.method = "balance", return.graph = TRUE)
tree.plot(SP, vertex.size = 30)

Evaluating results

Following command calculates the distance array between pairs of samples.

D.distance.matrix <- distance.matrix.true.tree(D)
SP.distance.matrix <- distance.matrix.scelestial(SP)
## Difference between normalized distance matrices
vertices <- rownames(SP.distance.matrix)
sum(abs(D.distance.matrix[vertices,vertices] - SP.distance.matrix))

Try the RScelestial package in your browser

Any scripts or data that you put into this service are public.

RScelestial documentation built on March 24, 2020, 1:08 a.m.