setStates.Sequence: Set the states for a set of Site objects aggregated by a...

Description Usage Arguments Value Author(s) See Also Examples

Description

Set the states for a set of Site objects aggregated by a Sequence object. The value vector is recycled, which is useful when creating repeated patterns.

Usage

1
2
## S3 method for class 'Sequence'
setStates(this, value, index, ...)

Arguments

this

A Sequence object.

value

A character vector containg the states (recycled if shorter than the index vector). The states must be compatible with the corresponding Alphabet object.

index

An integer vector specifying a set of positions. It is set to 1:seq$length if omitted.

...

Not used.

Value

The Sequence object (invisible).

Author(s)

Botond Sipos, Gregory Jordan

See Also

For more information see Sequence.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
	# create a sequence object of length 10
	s<-Sequence(alphabets=list(NucleotideAlphabet()),length=10)
	# set the states in some ranges
	setStates(s,c("A","T","A"),index=1:5)
	setStates(s,c("G","C"),index=6:10)
	# display sequence
	s
	# set the states for the whole Sequence object
	setStates(s,c("A","T","T","A"))
	s
	# set states via virtual field
	s$states<-c("A","T")
	s
 

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