detachHookFromNode.PhyloSim: Detach a node hook function from a given node of a phylo...

Description Usage Arguments Value Author(s) See Also Examples

Description

Detach a node hook function from a given node of a phylo object aggregated by a PhyloSim object.

Usage

1
2
## S3 method for class 'PhyloSim'
detachHookFromNode(this, node=NA, ...)

Arguments

this

A PhyloSim object.

node

Node identifier.

...

Not used.

Value

The PhyloSim object (invisible).

Author(s)

Botond Sipos, Gregory Jordan

See Also

attachHookToNode PhyloSim Simulate.PhyloSim

Examples

 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
	# Create a PhyloSim object.
	# Provide the phylo object
	# and the root sequence.
	sim<-PhyloSim(
		name="TinySim",
		phylo=rcoal(3),
		root.seq=NucleotideSequence(string="ATGC",processes=list(list(JC69())))
	);
	# create a node hook function
	hook<-function(seq=NA){
		# replace the substitution process with F84
		if(inherits(seq,"NucleotideSequence")){
			cat("Replacing JC69 with F84.\n");
			seq$processes<-list(list(F84(rate.params=list("Kappa" = 2))));
		}
		return(seq);
	}
	# attach hook function to node 5
	attachHookToNode(sim,5,hook);
	# detach hook from node 5
	detachHookFromNode(sim,5);
	# Run the simulation again
	Simulate(sim);	# You should not see the message printed out by the "hook" function.

 

phylosim documentation built on Nov. 22, 2019, 1:07 a.m.