deinterleave {ComPairWise}R Documentation

Convert interleaved alignments to sequential

Description

Takes an interleaved alignment and turns it into a sequential one.

Usage

deinterleave(alignment)

Arguments

alignment An alignment object, presumably one with every taxon split into more than one sequence

Details

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.

Value

~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

Note

Designed as an internal function but works as a standalone. Called by read.nexus

Author(s)

TER

See Also

read.nexus

Examples

##---- 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)
  }

[Package ComPairWise version 1.01 Index]