readALNfile: Read and Write Clustal .ALN and .NXS files

readALNfileR Documentation

Read and Write Clustal .ALN and .NXS files

Description

Helper functions to read and/or write the files from Clustal, for Multiple Sequence Alignments (MSA)

Usage

readALN(file)
readNEXUS(file)

writeALN( aln, outfile, line.width = 60, title, capitalize = NULL, blankMissingFlanks = FALSE, 
		fastaToo = FALSE)

Arguments

file, outfile

full pathname to existing Clustal output file. Or a full pathname for a file to be written to.

aln

a MSA alignment object, as returned ba MAFFT. See mafft.

line.width

integer number of characters to write per line of output.

capitalize

Optional. Either a logical, or a character string in "uppper", "lower", controlling how the aligned characters are case converted or not.

blankMissingFlanks

logical, should the hyphens that denote gap characters at the very beginning and ending flanks of the MSA, which are only due to missing sequence instead of true insertions or deletions, be represented as blanks instead.

fastaToo

logical, should the sequences in the aln object also be written out in FASTA format. Note that these FASTA sequences will preserve any gap hyphens present in the MSA into the FASTA constructs.

Details

These function facilitate manipulation of MSA results as R objects.

Value

For readNEXUS, a character matrix, with a single letter for each element. The rownames are the names of the sequences submitted to Clustal.

For readALN, a list:

alignment

a character matrix with a single letter for each element.

consensus

the 'consensus string' from below the MSA elements.

pct.conserved

numeric vector of the amount of sequence similarity along the MSA, expressing each column position as the percentage of rows that contain the most commonly observed character.

For writeALN, one or two files written to disk.


robertdouglasmorrison/DuffyTools documentation built on April 13, 2025, 8:51 p.m.