1 ## clustal.R (2012-11-28)
3 ## Multiple Sequence Alignment with External Applications
5 ## Copyright 2011-2012 Emmanuel Paradis
7 ## This file is part of the R-package `ape'.
8 ## See the file ../COPYING for licensing issues.
10 clustal <- function(x, pw.gapopen = 10, pw.gapext = 0.1,
11 gapopen = 10, gapext = 0.2, exec = NULL,
12 MoreArgs = "", quiet = TRUE, original.ordering = TRUE)
16 if (os == "Linux") exec <- "clustalw"
17 if (os == "Darwin") exec <- "clustalw2"
18 if (os == "Windows") shortPathName("C:/Program Files/ClustalW2/clustalw2.exe")
22 system(paste(exec, "-help"))
23 return(invisible(NULL))
27 inf <- paste(d, "input_clustal.fas", sep = "/")
28 outf <- paste(d, "input_clustal.aln", sep = "/")
29 write.dna(x, inf, "fasta")
30 prefix <- c("-INFILE", "-PWGAPOPEN", "-PWGAPEXT", "-GAPOPEN", "-GAPEXT")
31 suffix <- c(inf, pw.gapopen, pw.gapext, gapopen, gapext)
32 opts <- paste(prefix, suffix, sep = "=", collapse = " ")
33 opts <- paste(opts, MoreArgs)
34 system(paste(exec, opts), ignore.stdout = quiet)
35 res <- read.dna(outf, "clustal")
36 if (original.ordering) res <- res[labels(x), ]
40 muscle <- function(x, exec = "muscle", MoreArgs = "", quiet = TRUE, original.ordering = TRUE)
44 return(invisible(NULL))
48 inf <- paste(d, "input_muscle.fas", sep = "/")
49 outf <- paste(d, "output_muscle.fas", sep = "/")
50 write.dna(x, inf, "fasta")
51 opts <- paste("-in", inf, "-out", outf)
52 if (quiet) opts <- paste(opts, "-quiet")
53 opts <- paste(opts, MoreArgs)
54 system(paste(exec, opts))
55 res <- read.dna(outf, "fasta")
56 if (original.ordering) res <- res[labels(x), ]
60 tcoffee <- function(x, exec = "t_coffee", MoreArgs = "", quiet = TRUE, original.ordering = TRUE)
64 return(invisible(NULL))
70 inf <- "input_tcoffee.fas"
71 write.dna(x, inf, "fasta")
72 opts <- paste(inf, MoreArgs)
73 if (quiet) opts <- paste(opts, "-quiet=nothing")
74 system(paste(exec, opts))
75 res <- read.dna("input_tcoffee.aln", "clustal")
76 if (original.ordering) res <- res[labels(x), ]