Learn R Programming

phylosim (version 3.0.5)

GeneralInDel: The GeneralInDel class

Description

This is a class implementing the methods which are needed by both the GeneralInsertor and GeneralDeletor process.

Package: Class GeneralInDel

Object ~~| ~~+--PSRoot ~~~~~~~| ~~~~~~~+--Process ~~~~~~~~~~~~| ~~~~~~~~~~~~+--GeneralInDel

Directly known subclasses: BrownianInsertor, ContinuousDeletor, ContinuousInsertor, DiscreteDeletor, DiscreteInsertor, FastFieldDeletor, GeneralDeletor, GeneralInsertor

public static class GeneralInDel extends Process

Usage

GeneralInDel(name="Anonymous", rate=NA, propose.by=NA, accept.by=NA, ...)

Arguments

name

The name of the object.

rate

The general rate of the object.

propose.by

A function used to propose events.

accept.by

A function used to accept/reject events.

...

Additional arguments.

Fields and Methods

Methods:

checkConsistency -
getAcceptBy -
getProposeBy -
getRate -
hasUndefinedRate -
is -
proposeLength -
setAcceptBy -
setProposeBy -
setRate -
summary -

Methods inherited from Process: !=, ==, as.character, checkConsistency, clone, getAlphabet, getEventsAtSite, getId, getName, getParameterAtSite, getSiteSpecificParamIds, getSiteSpecificParamList, getWriteProtected, hasSiteSpecificParameter, hasUndefinedRate, is, setAlphabet, setId, setName, setParameterAtSite, setSiteSpecificParamIds, setSiteSpecificParamList, setWriteProtected, summary

Methods inherited from PSRoot: checkConsistency, enableVirtual, getComments, getMethodsList, globalConsistencyCheck, intersect.list, is, is.na, ll, my.all.equal, plot, setComments, setMethodsList, summary, virtualAssignmentForbidden

Methods inherited from Object: $, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

See Also

Process GeneralInsertor GeneralDeletor GeneralSubstitution

Examples

Run this code
# NOT RUN {
	# create a GeneralInDel object
	# rejecting half of the events
	# and proposing sizes in the range 1:10
	o<-GeneralInDel(
                   rate=1,
                   propose.by=function(process){sample(1:10,1)},
                   accept.by=function(){sample(c(TRUE,FALSE),1)}
                   );
	# check if inherits from GeneralInDel
	is.GeneralInDel(o)
	# check if it has undefined rates
	hasUndefinedRate(o)
	# get object summary
	summary(o)
	# set/get proposeBy function via virtual field
	o$proposeBy<-function(process){return(3)}	# fixed event length
	o$proposeBy
	# set/get acceptBy function via virtual field
	o$acceptBy<-function(){return(TRUE)}		# accept all events
	o$acceptBy
	# get/set general rate
	o$rate
	o$rate<-2	# double the rate
	# propose event length
	proposeLength(o)
 
# }

Run the code above in your browser using DataLab