deinterleave {ComPairWise} | R Documentation |
Takes an interleaved alignment and turns it into a sequential one.
deinterleave(alignment)
alignment |
An alignment object, presumably one with every taxon split into more than one sequence |
This is a workaround function for reading alignments. It re-assembles interleaved alignments, which otherwise would come out with every line of sequence as a different taxon.
deinterleave requires that all the parts of one sequence have the same taxon name, and that otherwise no taxon names be duplicate. It concatenates sequences based only on their taxon names.
~Describe the value returned An alignment object with the input sequences reassembled.
nb |
Number of sequences in the alignment |
nam |
Names of the sequences |
seq |
The sequences themselves |
com |
Currently NA; comment |
Designed as an internal function but works as a standalone. Called by read.nexus
TER
##---- Should be DIRECTLY executable !! ---- ##-- ==> Define data, use random, ##-- or do help(data=index) for the standard data sets. ## The function is currently defined as function (alignment) { taxa <- unique(alignment$nam) deint <- function(taxon, alignment) paste(alignment$seq[alignment$nam == taxon], sep = "", collapse = "") x <- unlist(lapply(taxa, deint, alignment)) newaln <- list(nb = length(taxa), nam = taxa, seq = x, com = NA) class(newaln) <- "alignment" return(newaln) }