fastadframe: Writes a FASTA-formatted DNA dataset from a...

View source: R/fastadframe.R

fastadframeR Documentation

Writes a FASTA-formatted DNA dataset from a dataframe-formatted DNA alignment

Description

Writes data.frame formatted DNA alignment or list formatted NEXUS file as originally imported with ape's function read.nexus.data into a FASTA-formatted file. It is useful for writing each gene dataset from within the resulting list of compared gene datasets, after running the concatenating functions catfullGenes and catmultGenes. The function is also useful for saving into FASTA format the original list-formatted NEXUS object as read by read.nexus.data, after making specific changes in such original individual alignment (e.g. corrections of species names).

Usage

fastadframe(x, file,
            dropmisseq = TRUE,
            endgaps.to.miss = TRUE)

Arguments

x

The object to be written, any two-column-sized data.frame where the first column contains the taxon names and the second column the DNA sequence. Otherwise, the object may be a list-formatted NEXUS file as originally imported with ape's function read.nexus.data.

file

Either a character string naming a file or a connection open for writing.

dropmisseq

Logical, if FALSE the function will not drop species with empty DNA sequence. After running the concatenating function catmultGenes using missdata = TRUE, and then using dropSeq to remove duplicated accessions of the same species, you might find useful to keep dropmisseq = TRUE so as to save each individual DNA alignment by also removing species that fully miss the sequence data.

endgaps.to.miss

Logical, if FALSE the function will not replace terminal GAPs into missing character (?).

Author(s)

Domingos Cardoso

See Also

catfullGenes

catmultGenes

dropSeq

Examples

## Not run: 
data(Gaya)
catdf <- catfullGenes(Gaya,
                      multiaccessions = FALSE,
                      shortaxlabel = TRUE,
                      missdata = TRUE)

ITS <- catdf[[1]]
petLpsbE <- catdf[[2]]
rpl16 <- catdf[[3]]

fastadframe(ITS, file = "filename.fasta",
            dropmisseq = TRUE)
fastadframe(petLpsbE, file = "filename.fasta",
            dropmisseq = TRUE)
fastadframe(rpl16, file = "filename.fasta",
            dropmisseq = TRUE)

## End(Not run)


domingoscardoso/catGenes documentation built on March 14, 2024, 9:21 p.m.