Learn R Programming

phylosim (version 3.0.5)

Site: The Site class

Description

This is the class representing a site. Site objects can have one associated Alphabet object and one or more Process objects that act on their states. The associated Process and Site objects must have associated Alphabet objects with the same symbols set, or at least one of the Alphabet objects should inherit from the class AnyAlphabet.

Site objects store the site-process-specific parameters of the attached Process objects. A site-process-specific parameter is a list containing: the identifier, the name, the value and type of the parameter. For example the ubiquitous rate multiplier site-process-specific parameter looks like list(id="rate.multiplier",name="Rate multiplier",value=1,type="numeric").

Templates for site-process-specific parameters and their default values are stored in the Process objects and copied into the Site object when the process is attached.

Site objects have fields for associated ancestral Site objects and Sequence objects.

Package: Class Site

Object ~~| ~~+--PSRoot ~~~~~~~| ~~~~~~~+--Site

Directly known subclasses:

public static class Site extends PSRoot

Usage

Site(state=NA, alphabet=NA, ancestral=NA, processes=NA, sequence=NA, ...)

Arguments

state

A symbol belonging to the specified alphabet.

alphabet

An alphabet object.

ancestral

The ancestral Site object.

processes

A list of Process objects.

sequence

The Sequence object to which the Site object belongs.

...

Not used.

Fields and Methods

Methods:

as.character -
attachProcess -
checkConsistency -
detachProcess -
flagTotalRate -
getAlphabet -
getAncestral -
getEvents -
getProcesses -
getSequence -
getState -
getTotalRate -
is -
isAttached -
setAlphabet -
setAncestral -
setEvents -
setProcesses -
setSequence -
setState -
setTotalRate -
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

Alphabet, Process, Event

Examples

Run this code
# NOT RUN {
		# create a site object
		site<-Site();
		# print the character representation (state)
		print(site);
		# get a summary
		summary(site);
		# create a site with a nucleotide alphabet
		site<-Site(state="A",alphabet=NucleotideAlphabet());
		# set site state
		site$state<-"G"
		# manipulate the associated Sequence object
		site$sequence<-Sequence()
		site$sequence
		# attach a substitution process
		site$processes<-list(JC69())
		# add one more substitution process
		attachProcess(site,K80())
		# get a list of active Event objects
		site$events
		# get a summary of the Site object
		summary(site);
 
# }

Run the code above in your browser using DataLab