PageRenderTime 23ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/PopularAlphabets.R

http://github.com/sbotond/phylosim
R | 266 lines | 59 code | 14 blank | 193 comment | 0 complexity | 41fed7e08543ca1a56f2ac6b98f4e3c7 MD5 | raw file
  1##	
  2## Copyright 2009 Botond Sipos	
  3## See the package description for licensing information.	
  4##	
  5
  6##
  7## AnyAlphabet
  8##
  9##########################################################################/** 
 10#
 11# @RdocClass AnyAlphabet
 12# 
 13# @title "The AnyAlphabet class"
 14# 
 15# \description{
 16#	This is a special Alphabet class which matches any alphabet. 
 17#	The '=='.Alphabet method always returns TRUE when one of the
 18#	compared objects inherits from AnyAlphabet. This behaviour is 
 19#	handy when creating processes that have no alphabet preference 
 20#	(like a deletion process).
 21#
 22#		@classhierarchy
 23# }
 24#	
 25# @synopsis
 26#	
 27# \arguments{
 28# 	\item{...}{Not used.}
 29#	}
 30# 
 31# \section{Fields and Methods}{ 
 32# 	@allmethods
 33# }
 34# 
 35# \examples{ 
 36#	# create some alphabet objects
 37#	a<-BinaryAlphabet()
 38#	b<-NucleotideAlphabet()
 39#	any<-AnyAlphabet()
 40#	# compare objects
 41#	a == b
 42#	any == a
 43#	any == b
 44# }
 45# 
 46# @author
 47#
 48# \seealso{ 
 49# 	Alphabet
 50# }
 51# 
 52#*/###########################################################################
 53setConstructorS3(
 54  "AnyAlphabet",
 55  function(... ){
 56
 57		this<-Alphabet(type="*ANY*",symbols=c());
 58		extend(this,
 59			"AnyAlphabet",
 60			 .any.flag=TRUE
 61			);
 62
 63  },
 64  enforceRCC=TRUE
 65);
 66
 67##
 68## BinaryAlphabet
 69##
 70##########################################################################/** 
 71#
 72# @RdocClass BinaryAlphabet
 73# 
 74# @title "The BinaryAlphabet class"
 75# 
 76# \description{ 
 77#	 Class of Alphabet objects with the c("0","1") symbol set.
 78#
 79#	@classhierarchy
 80# }
 81#	
 82# @synopsis
 83#	
 84# \arguments{
 85# 	\item{...}{Not used.}
 86#	}
 87# 
 88# \section{Fields and Methods}{ 
 89# 	@allmethods
 90# }
 91# 
 92# \examples{ 
 93#	# create a binary alphabet
 94#	b<-BinaryAlphabet()
 95#	# get alphabet summary
 96#	summary(b)
 97# }
 98# 
 99# @author
100#
101# \seealso{ 
102# 	Alphabet
103# }
104# 
105#*/###########################################################################
106setConstructorS3(
107  "BinaryAlphabet",
108  function(... ){
109
110		this<-Alphabet(type="Binary",symbols=c("0","1"));
111		extend(this,"BinaryAlphabet");
112
113  },
114  enforceRCC=TRUE
115);
116
117##
118## NucleotideAlphabet
119##
120##########################################################################/** 
121#
122# @RdocClass NucleotideAlphabet
123# 
124# @title "The NucleotideAlphabet class"
125# 
126# \description{ 
127#	Class of Alphabet objects with the c("T","C","A","G") symbol
128#	set, representing nucleotides.
129#
130#	@classhierarchy
131# }
132#	
133# @synopsis
134#	
135# \arguments{
136# 	\item{...}{Not used.}
137#	}
138# 
139# \section{Fields and Methods}{ 
140# 	@allmethods
141# }
142# 
143# \examples{ 
144#	# create a nucleotide alphabet
145#	b<-NucleotideAlphabet()
146#	# get alphabet summary
147#	summary(b)
148# }
149# 
150# @author
151#
152# \seealso{ 
153# 	Alphabet
154# }
155# 
156#*/###########################################################################
157setConstructorS3(
158  "NucleotideAlphabet",
159  function(... ){
160
161		this<-Alphabet(type="Nucleotide",symbols=c("T","C","A","G"));
162		extend(this,"NucleotideAlphabet");
163
164  },
165  enforceRCC=TRUE
166);
167
168##
169## AminoAcidAlphabet
170##
171##########################################################################/** 
172#
173# @RdocClass AminoAcidAlphabet
174# 
175# @title "The AminoAcidAlphabet class"
176# 
177# \description{ 
178#	Class of Alphabet objects representing amino acids, using the
179#	one-letter IUPAC amino acid codes as symbol set:
180#	\preformatted{
181#	IUPAC code	Amino acid
182#
183#	A		Alanine
184#	C		Cysteine
185#	D		Aspartic Acid
186#	E		Glutamic Acid
187#	F		Phenylalanine
188#	G		Glycine
189#	H		Histidine
190#	I		Isoleucine
191#	K		Lysine
192#	L		Leucine
193#	M		Methionine
194#	N		Asparagine
195#	P		Proline
196#	Q		Glutamine
197#	R		Arginine
198#	S		Serine
199#	T		Threonine
200#	V		Valine
201#	W		Tryptophan
202#	Y		Tyrosine
203#}
204#
205#	@classhierarchy
206# }
207#	
208# @synopsis
209#	
210# \arguments{
211# 	\item{...}{Not used.}
212#	}
213# 
214# \section{Fields and Methods}{ 
215# 	@allmethods
216# }
217# 
218# \examples{ 
219#	a<-AminoAcidAlphabet();
220#	# get object summary
221#	summary(a)
222# }
223# 
224# @author
225#
226# \seealso{ 
227# 	Alphabet
228# }
229# 
230#*/###########################################################################
231setConstructorS3(
232  "AminoAcidAlphabet",
233  function(... ){
234
235		this<-Alphabet(
236				type="Amino acid",
237				symbols=c(
238					"A",
239					"R",
240					"N",
241					"D", 
242					"C",
243					"Q",
244					"E",
245					"G", 
246					"H",
247					"I",
248					"L",
249					"K",
250					"M",
251					"F",
252					"P",
253					"S", 
254					"T",
255					"W",
256					"Y",
257					"V"
258				)
259		 );
260		extend(this,"AminoAcidAlphabet");
261
262  },
263  enforceRCC=TRUE
264);
265
266