PageRenderTime 16ms CodeModel.GetById 2ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/AminoAcidMatrices.R

http://github.com/sbotond/phylosim
R | 942 lines | 165 code | 49 blank | 728 comment | 0 complexity | 13d32c17283616ebfc6ed0ae0ff30201 MD5 | raw file
  1##	
  2## Copyright 2009 Botond Sipos	
  3## See the package description for licensing information.	
  4
  5##
  6## cpREV
  7##
  8##########################################################################/** 
  9#
 10# @RdocClass cpREV
 11# 
 12# @title "The cpREV empirical amino acid substitution model"
 13# 
 14# \description{ 
 15#
 16#
 17#	@classhierarchy
 18# }
 19#
 20# \references{
 21# Adachi, J., P. J. Waddell, W. Martin, and M. Hasegawa (2000) Plastid
 22# genome phylogeny and a model of amino acid substitution for proteins
 23# encoded by chloroplast DNA - Journal of Molecular Evolution 50:348--358 
 24# DOI: 10.1007/s002399910038 \url{http://bit.ly/bnBVLm}
 25# }
 26#	
 27# @synopsis
 28#	
 29# \arguments{
 30# 	\item{equ.dist}{Equilibrium distribution.}
 31# 	\item{...}{Not used.}
 32#	}
 33# 
 34# \section{Fields and Methods}{ 
 35# 	@allmethods
 36# }
 37# 
 38# \examples{ 
 39#	# create substitution model object 
 40#	p<-cpREV()
 41#	# get object summary	
 42#	summary(p)
 43#	# display a bubble plot
 44#	plot(p)
 45#
 46#       # The following code demonstrates how to use 
 47#       # the process in a simulation.
 48#	
 49#	# create a sequence, attach process p
 50#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
 51#	# sample states
 52#	sampleStates(s)
 53#       # make the first three positions invariable
 54#       setRateMultipliers(s,p,0,1:3)
 55#       # get rate multipliers
 56#       getRateMultipliers(s,p)
 57#       # create a simulation object
 58#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
 59#       # run simulation
 60#       Simulate(sim)
 61#       # print alignment
 62#       sim$alignment
 63# }
 64# 
 65# @author
 66#
 67# \seealso{ 
 68# 	AminoAcidSubst GeneralSubstitution UNREST
 69# }
 70# 
 71#*/###########################################################################
 72setConstructorS3(
 73  "cpREV",
 74  function(
 75		equ.dist=NA,
 76    		...
 77  ){
 78
 79		this<-AminoAcidSubst$newAAMatrix(
 80			name="cpREV",
 81			paml.file="cpREV.dat",
 82			equ.dist=equ.dist
 83		);
 84
 85		return(this);
 86
 87  },
 88  enforceRCC=FALSE
 89);
 90
 91##
 92## PAM
 93##
 94##########################################################################/** 
 95#
 96# @RdocClass PAM
 97# 
 98# @title "The PAM empirical amino acid substitution model"
 99# 
100# \description{ 
101#
102#
103#	@classhierarchy
104# }
105#
106# \references{
107# Dayhoff, M. O.; Schwartz, R. M.; Orcutt, B. C. (1978). "A model of evolutionary change in proteins" - 
108# Atlas of Protein Sequence and Structure 5 (3):345-352
109#
110# }
111#	
112# @synopsis
113#	
114# \arguments{
115# 	\item{equ.dist}{Equilibrium distribution.}
116# 	\item{...}{Not used.}
117#	}
118# 
119# \section{Fields and Methods}{ 
120# 	@allmethods
121# }
122# 
123# \examples{ 
124#	# create substitution model object 
125#	p<-PAM()
126#	# get object summary	
127#	summary(p)
128#	# display a bubble plot
129#	plot(p)
130#
131#       # The following code demonstrates how to use 
132#       # the process in a simulation.
133#	
134#	# create a sequence, attach process p
135#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
136#	# sample states
137#	sampleStates(s)
138#       # make the first three positions invariable
139#       setRateMultipliers(s,p,0,1:3)
140#       # get rate multipliers
141#       getRateMultipliers(s,p)
142#       # create a simulation object
143#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
144#       # run simulation
145#       Simulate(sim)
146#       # print alignment
147#       sim$alignment
148# }
149# 
150# @author
151#
152# \seealso{ 
153# 	AminoAcidSubst GeneralSubstitution UNREST
154# }
155# 
156#*/###########################################################################
157setConstructorS3(
158  "PAM",
159  function(
160		equ.dist=NA,
161    ...
162  ){
163
164		this<-AminoAcidSubst$newAAMatrix(
165			name="PAM",
166			paml.file="dayhoff.dat",
167			equ.dist=equ.dist
168		);
169
170		return(this);
171
172  },
173  enforceRCC=FALSE
174);
175
176##
177## PAM-dcmut
178##
179##########################################################################/** 
180#
181# @RdocClass PAM.dcmut
182# 
183# @title "The PAM.dcmut empirical amino acid substitution model"
184# 
185# \description{ 
186#
187#
188#	@classhierarchy
189# }
190#
191# \references{
192# Kosiol, C, and Goldman, N (2005) Different versions of the Dayhoff rate matrix -
193# Molecular Biology and Evolution 22:193-199 \url{http://dx.doi.org/10.1093/molbev/msi005}
194# }
195#	
196# @synopsis
197#	
198# \arguments{
199# 	\item{equ.dist}{Equilibrium distribution.}
200# 	\item{...}{Not used.}
201#	}
202# 
203# \section{Fields and Methods}{ 
204# 	@allmethods
205# }
206# 
207# \examples{ 
208#	# create substitution model object 
209#	p<-PAM.dcmut()
210#	# get object summary	
211#	summary(p)
212#	# display a bubble plot
213#	plot(p)
214#
215#       # The following code demonstrates how to use 
216#       # the process in a simulation.
217#	
218#	# create a sequence, attach process p
219#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
220#	# sample states
221#	sampleStates(s)
222#       # make the first three invariable
223#       setRateMultipliers(s,p,0,1:3)
224#       # get rate multipliers
225#       getRateMultipliers(s,p)
226#       # create a simulation object
227#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
228#       # run simulation
229#       Simulate(sim)
230#       # print alignment
231#       sim$alignment
232# }
233# 
234# @author
235#
236# \seealso{ 
237# 	AminoAcidSubst GeneralSubstitution UNREST
238# }
239# 
240#*/###########################################################################
241setConstructorS3(
242  "PAM.dcmut",
243  function(
244		equ.dist=NA,
245    ...
246  ){
247
248		this<-AminoAcidSubst$newAAMatrix(
249			name="PAM.dcmut",
250			paml.file="dayhoff-dcmut.dat",
251			equ.dist=equ.dist
252		);
253
254		return(this);
255
256  },
257  enforceRCC=FALSE
258);
259
260##
261## JTT
262##
263##########################################################################/** 
264#
265# @RdocClass JTT
266# 
267# @title "The JTT empirical amino acid substitution model"
268# 
269# \description{ 
270#
271#
272#	@classhierarchy
273# }
274#
275# \references{
276# Jones, D. T., W. R. Taylor, and J. M. Thornton (1992) The rapid generation of mutation data matrices 
277# from protein sequences. CABIOS 8:275-282 \url{http://dx.doi.org/10.1093/bioinformatics/8.3.275}
278# }
279#	
280# @synopsis
281#	
282# \arguments{
283# 	\item{equ.dist}{Equilibrium distribution.}
284# 	\item{...}{Not used.}
285#	}
286# 
287# \section{Fields and Methods}{ 
288# 	@allmethods
289# }
290# 
291# \examples{ 
292#	# create substitution model object 
293#	p<-JTT()
294#	# get object summary	
295#	summary(p)
296#	# display a bubble plot
297#	plot(p)
298#
299#       # The following code demonstrates how to use 
300#       # the process in a simulation.
301#	
302#	# create a sequence, attach process p
303#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
304#	# sample states
305#	sampleStates(s)
306#       # make the first three positions invariable
307#       setRateMultipliers(s,p,0,1:3)
308#       # get rate multipliers
309#       getRateMultipliers(s,p)
310#       # create a simulation object
311#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
312#       # run simulation
313#       Simulate(sim)
314#       # print alignment
315#       sim$alignment
316# }
317# 
318# @author
319#
320# \seealso{ 
321# 	AminoAcidSubst GeneralSubstitution UNREST
322# }
323# 
324#*/###########################################################################
325setConstructorS3(
326  "JTT",
327  function(
328		equ.dist=NA,
329    ...
330  ){
331
332		this<-AminoAcidSubst$newAAMatrix(
333			name="JTT",
334			paml.file="jones.dat",
335			equ.dist=equ.dist
336		);
337
338		return(this);
339
340  },
341  enforceRCC=FALSE
342);
343
344##
345## JTT.dcmut
346##
347##########################################################################/** 
348#
349# @RdocClass JTT.dcmut
350# 
351# @title "The JTT.dcmut empirical amino acid substitution model"
352# 
353# \description{ 
354#
355#
356#	@classhierarchy
357# }
358#
359# \references{
360# Kosiol, C, and Goldman, N (2005) Different versions of the Dayhoff rate matrix -
361# Molecular Biology and Evolution 22:193-199 \url{http://dx.doi.org/10.1093/molbev/msi005}
362#
363# Jones, D. T., W. R. Taylor, and J. M. Thornton (1992) The rapid generation of mutation data matrices 
364# from protein sequences. CABIOS 8:275-282 \url{http://dx.doi.org/10.1093/bioinformatics/8.3.275}
365# }
366#	
367# @synopsis
368#	
369# \arguments{
370# 	\item{equ.dist}{Equilibrium distribution.}
371# 	\item{...}{Not used.}
372#	}
373# 
374# \section{Fields and Methods}{ 
375# 	@allmethods
376# }
377# 
378# \examples{ 
379#	# create substitution model object 
380#	p<-JTT.dcmut()
381#	# get object summary	
382#	summary(p)
383#	# display a bubble plot
384#	plot(p)
385#
386#       # The following code demonstrates how to use 
387#       # the process in a simulation.
388#	
389#	# create a sequence, attach process p
390#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
391#	# sample states
392#	sampleStates(s)
393#       # make the first threee positions invariable
394#       setRateMultipliers(s,p,0,1:3)
395#       # get rate multipliers
396#       getRateMultipliers(s,p)
397#       # create a simulation object
398#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
399#       # run simulation
400#       Simulate(sim)
401#       # print alignment
402#       sim$alignment
403# }
404# 
405# @author
406#
407# \seealso{ 
408# 	AminoAcidSubst GeneralSubstitution UNREST
409# }
410# 
411#*/###########################################################################
412setConstructorS3(
413  "JTT.dcmut",
414  function(
415		equ.dist=NA,
416    ...
417  ){
418
419		this<-AminoAcidSubst$newAAMatrix(
420			name="JTT.dcmut",
421			paml.file="jones-dcmut.dat",
422			equ.dist=equ.dist
423		);
424
425		return(this);
426
427  },
428  enforceRCC=FALSE
429);
430
431##
432## LG
433##
434##########################################################################/** 
435#
436# @RdocClass LG
437# 
438# @title "The LG empirical amino acid substitution model"
439# 
440# \description{ 
441#
442#
443#	@classhierarchy
444# }
445#
446# \references{
447# Le, S. Q., and O. Gascuel (2008) An improved general amino acid replacement matrix - 
448# Mol. Biol. Evol. 25:1307-1320 \url{http://dx.doi.org/10.1093/molbev/msn067}
449# }
450#	
451# @synopsis
452#	
453# \arguments{
454# 	\item{equ.dist}{Equilibrium distribution.}
455# 	\item{...}{Not used.}
456#	}
457# 
458# \section{Fields and Methods}{ 
459# 	@allmethods
460# }
461# 
462# \examples{ 
463#	# create substitution model object 
464#	p<-LG()
465#	# get object summary	
466#	summary(p)
467#	# display a bubble plot
468#	plot(p)
469#
470#       # The following code demonstrates how to use 
471#       # the process in a simulation.
472#	
473#	# create a sequence, attach process p
474#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
475#	# sample states
476#	sampleStates(s)
477#       # make the first three positions invariable
478#       setRateMultipliers(s,p,0,1:3)
479#       # get rate multipliers
480#       getRateMultipliers(s,p)
481#       # create a simulation object
482#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
483#       # run simulation
484#       Simulate(sim)
485#       # print alignment
486#       sim$alignment
487# }
488# 
489# @author
490#
491# \seealso{ 
492# 	AminoAcidSubst GeneralSubstitution UNREST
493# }
494# 
495#*/###########################################################################
496setConstructorS3(
497  "LG",
498  function(
499		equ.dist=NA,
500    ...
501  ){
502
503		this<-AminoAcidSubst$newAAMatrix(
504			name="LG",
505			paml.file="lg.dat",
506			equ.dist=equ.dist
507		);
508
509		return(this);
510
511  },
512  enforceRCC=FALSE
513);
514
515##
516## mtArt
517##
518##########################################################################/** 
519#
520# @RdocClass mtArt
521# 
522# @title "The mtArt empirical amino acid substitution model"
523# 
524# \description{ 
525#
526#
527#	@classhierarchy
528# }
529#
530# \references{
531# Abascal, F., D. Posada, and R. Zardoya (2007) MtArt: A new Model of
532# amino acid replacement for Arthropoda - Mol. Biol. Evol. 24:1-5 \url{http://dx.doi.org/10.1093/molbev/msl136}
533#
534# }
535#	
536# @synopsis
537#	
538# \arguments{
539# 	\item{equ.dist}{Equilibrium distribution.}
540# 	\item{...}{Not used.}
541#	}
542# 
543# \section{Fields and Methods}{ 
544# 	@allmethods
545# }
546# 
547# \examples{ 
548#	# create substitution model object 
549#	p<-mtArt()
550#	# get object summary	
551#	summary(p)
552#	# display a bubble plot
553#	plot(p)
554#
555#       # The following code demonstrates how to use 
556#       # the process in a simulation.
557#	
558#	# create a sequence, attach process p
559#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
560#	# sample states
561#	sampleStates(s)
562#       # make the first three positions invariable
563#       setRateMultipliers(s,p,0,1:3)
564#       # get rate multipliers
565#       getRateMultipliers(s,p)
566#       # create a simulation object
567#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
568#       # run simulation
569#       Simulate(sim)
570#       # print alignment
571#       sim$alignment
572# }
573# 
574# @author
575#
576# \seealso{ 
577# 	AminoAcidSubst GeneralSubstitution UNREST
578# }
579# 
580#*/###########################################################################
581setConstructorS3(
582  "mtArt",
583  function(
584		equ.dist=NA,
585    ...
586  ){
587
588		this<-AminoAcidSubst$newAAMatrix(
589			name="mtArt",
590			paml.file="mtArt.dat",
591			equ.dist=equ.dist
592		);
593
594		return(this);
595
596  },
597  enforceRCC=FALSE
598);
599
600##
601## mtMam
602##
603##########################################################################/** 
604#
605# @RdocClass mtMam
606# 
607# @title "The mtMam empirical amino acid substitution model"
608# 
609# \description{ 
610#
611#
612#	@classhierarchy
613# }
614#
615# \references{
616# Yang, Z., R. Nielsen, and M. Hasegawa (1998) Models of amino acid
617# substitution and applications to Mitochondrial protein evolution,
618# Molecular Biology and Evolution 15:1600-1611 \url{http://bit.ly/by4NMb}
619# }
620#	
621# @synopsis
622#	
623# \arguments{
624# 	\item{equ.dist}{Equilibrium distribution.}
625# 	\item{...}{Not used.}
626#	}
627# 
628# \section{Fields and Methods}{ 
629# 	@allmethods
630# }
631# 
632# \examples{ 
633#	# create substitution model object 
634#	p<-mtMam()
635#	# get object summary	
636#	summary(p)
637#	# display a bubble plot
638#	plot(p)
639#
640#       # The following code demonstrates how to use 
641#       # the process in a simulation.
642#	
643#	# create a sequence, attach process p
644#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
645#	# sample states
646#	sampleStates(s)
647#       # make the first three positions invariable
648#       setRateMultipliers(s,p,0,1:3)
649#       # get rate multipliers
650#       getRateMultipliers(s,p)
651#       # create a simulation object
652#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
653#       # run simulation
654#       Simulate(sim)
655#       # print alignment
656#       sim$alignment
657# }
658# 
659# @author
660#
661# \seealso{ 
662# 	AminoAcidSubst GeneralSubstitution UNREST
663# }
664# 
665#*/###########################################################################
666setConstructorS3(
667  "mtMam",
668  function(
669		equ.dist=NA,
670    ...
671  ){
672
673		this<-AminoAcidSubst$newAAMatrix(
674			name="mtMam",
675			paml.file="mtmam.dat",
676			equ.dist=equ.dist
677		);
678		
679		return(this);
680
681  },
682  enforceRCC=FALSE
683);
684
685##
686## mtREV24
687##
688##########################################################################/** 
689#
690# @RdocClass mtREV24
691# 
692# @title "The mtREV24 empirical amino acid substitution model"
693# 
694# \description{ 
695#
696#
697#	@classhierarchy
698# }
699#
700# \references{
701# Adachi, J. and Hasegawa, M. (1996) MOLPHY version 2.3: programs for
702# molecular phylogenetics based on maximum likelihood.  Computer Science
703# Monographs of Institute of Statistical Mathematics 28:1-150
704# }
705#	
706# @synopsis
707#	
708# \arguments{
709# 	\item{equ.dist}{Equilibrium distribution.}
710# 	\item{...}{Not used.}
711#	}
712# 
713# \section{Fields and Methods}{ 
714# 	@allmethods
715# }
716# 
717# \examples{ 
718#	# create substitution model object 
719#	p<-mtREV24()
720#	# get object summary	
721#	summary(p)
722#	# display a bubble plot
723#	plot(p)
724#
725#       # The following code demonstrates how to use 
726#       # the process in a simulation.
727#	
728#	# create a sequence, attach process p
729#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
730#	# sample states
731#	sampleStates(s)
732#       # make the first three positions invariable
733#       setRateMultipliers(s,p,0,1:3)
734#       # get rate multipliers
735#       getRateMultipliers(s,p)
736#       # create a simulation object
737#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
738#       # run simulation
739#       Simulate(sim)
740#       # print alignment
741#       sim$alignment
742# }
743# 
744# @author
745#
746# \seealso{ 
747# 	AminoAcidSubst GeneralSubstitution UNREST
748# }
749# 
750#*/###########################################################################
751setConstructorS3(
752  "mtREV24",
753  function(
754		equ.dist=NA,
755    ...
756  ){
757
758		this<-AminoAcidSubst$newAAMatrix(
759			name="mtREV24",
760			paml.file="mtREV24.dat",
761			equ.dist=equ.dist
762		);
763		
764		return(this);
765
766  },
767  enforceRCC=FALSE
768);
769
770##
771## MtZoa
772##
773##########################################################################/** 
774#
775# @RdocClass MtZoa
776# 
777# @title "The MtZoa empirical amino acid substitution model"
778# 
779# \description{ 
780#
781#
782#	@classhierarchy
783# }
784#
785# \references{
786# Rota-Stabelli, O., Z. Yang, and M. Telford. (2009) MtZoa: a general mitochondrial amino acid 
787# substitutions model for animal evolutionary studies. Mol. Phyl. Evol 52(1):268-72 \url{http://bit.ly/bjZfKi}
788# }
789#	
790# @synopsis
791#	
792# \arguments{
793# 	\item{equ.dist}{Equilibrium distribution.}
794# 	\item{...}{Not used.}
795#	}
796# 
797# \section{Fields and Methods}{ 
798# 	@allmethods
799# }
800# 
801# \examples{ 
802#	# create substitution model object 
803#	p<-MtZoa()
804#	# get object summary	
805#	summary(p)
806#	# display a bubble plot
807#	plot(p)
808#
809#       # The following code demonstrates how to use 
810#       # the process in a simulation.
811#	
812#	# create a sequence, attach process p
813#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
814#	# sample states
815#	sampleStates(s)
816#       # make the first three positions invariable
817#       setRateMultipliers(s,p,0,1:3)
818#       # get rate multipliers
819#       getRateMultipliers(s,p)
820#       # create a simulation object
821#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
822#       # run simulation
823#       Simulate(sim)
824#       # print alignment
825#       sim$alignment
826# }
827# 
828# @author
829#
830# \seealso{ 
831# 	AminoAcidSubst GeneralSubstitution UNREST
832# }
833# 
834#*/###########################################################################
835setConstructorS3(
836  "MtZoa",
837  function(
838		equ.dist=NA,
839    ...
840  ){
841
842		this<-AminoAcidSubst$newAAMatrix(
843			name="MtZoa",
844			paml.file="MtZoa.dat",
845			equ.dist=equ.dist
846		);
847		
848		return(this);
849
850  },
851  enforceRCC=FALSE
852);
853
854##
855## WAG
856##
857##########################################################################/** 
858#
859# @RdocClass WAG
860# 
861# @title "The WAG empirical amino acid substitution model"
862# 
863# \description{ 
864#
865#
866#	@classhierarchy
867# }
868#
869# \references{
870# Whelan, S. and N. Goldman (2001)  A general empirical model of
871# protein evolution derived from multiple protein families using a maximum likelihood 
872# approach - Molecular Biology and Evolution 18:691-699 \url{http://bit.ly/dpTKAd}
873# }
874#	
875# @synopsis
876#	
877# \arguments{
878# 	\item{equ.dist}{Equilibrium distribution.}
879# 	\item{...}{Not used.}
880#	}
881# 
882# \section{Fields and Methods}{ 
883# 	@allmethods
884# }
885# 
886# \examples{ 
887#	# create substitution model object 
888#	p<-WAG()
889#	# get object summary	
890#	summary(p)
891#	# display a bubble plot
892#	plot(p)
893#
894#       # The following code demonstrates how to use 
895#       # the process in a simulation.
896#	
897#	# create a sequence, attach process p
898#	s<-AminoAcidSequence(length=10,processes=list(list(p)) )
899#	# sample states
900#	sampleStates(s)
901#       # make the first three positions invariable
902#       setRateMultipliers(s,p,0,1:3)
903#       # get rate multipliers
904#       getRateMultipliers(s,p)
905#       # create a simulation object
906#       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
907#       # run simulation
908#       Simulate(sim)
909#       # print alignment
910#       sim$alignment
911# }
912# 
913# @author
914#
915# \seealso{ 
916# 	AminoAcidSubst GeneralSubstitution UNREST
917# }
918# 
919#*/###########################################################################
920setConstructorS3(
921  "WAG",
922  function(
923		equ.dist=NA,
924    ...
925  ){
926
927		this<-AminoAcidSubst$newAAMatrix(
928			name="WAG",
929			paml.file="wag.dat",
930			equ.dist=equ.dist
931		);
932		return(this);
933
934  },
935  enforceRCC=FALSE
936);
937
938
939
940
941
942