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