git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@114013 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,28 @@ |
1 |
+msaConvert <- function(x, type=c("seqinr::alignment", |
|
2 |
+ "bios2mds::align")) |
|
3 |
+{ |
|
4 |
+ type <- match.arg(type) |
|
5 |
+ |
|
6 |
+ if (!is(x, "MultipleAlignment")) |
|
7 |
+ stop("x must be a 'MultipleAlignment' object") |
|
8 |
+ |
|
9 |
+ x <- as.character(unmasked(x)) |
|
10 |
+ |
|
11 |
+ if (type == "seqinr::alignment") |
|
12 |
+ { |
|
13 |
+ out <- list(nb=length(x), |
|
14 |
+ nam=names(x), |
|
15 |
+ seq=unname(x), |
|
16 |
+ com=NA) |
|
17 |
+ |
|
18 |
+ class(out) <- "alignment" |
|
19 |
+ } |
|
20 |
+ else if (type == "bios2mds::align") |
|
21 |
+ { |
|
22 |
+ out <- .Call("SplitCharVector2List", x) |
|
23 |
+ names(out) <- names(x) |
|
24 |
+ class(out) <- "align" |
|
25 |
+ } |
|
26 |
+ |
|
27 |
+ out |
|
28 |
+} |