read.phylip {ComPairWise} | R Documentation |
Reads a PHYLIP-format alignment file and returns it as an alignment object
read.phylip(filename)
filename |
Name of the file to be read. |
read.phylip reads the file specified by filename, using scan. It skips the first line (which should not contain data) and assumes that the rest of the file contains data.
It will try to guess how to parse taxon names by looking for whitespace in the data. If it finds whitespace, it will guess that the taxon names are what comes before the first space. If it finds no whitespace it will assume that the first ten characters of each line are the taxon name.
An object of class alignment, of the same format as alignments in the package seqinr. It is a list with the following components:
nb |
The number of taxa |
nam |
The taxon names as a character vector |
seq |
The data as a character vector (data for each taxon is a single string) |
com |
Currently always NA; present for compatibility with other formats that might have comments |
Will fail if it guesses incorrectly about where the character data start; the first data column must be either directly after the first whitespace (space or tab) in the line or the 11th character in the line.
For some PHYLIP files the phylip reader in seqinr works better.
TER
check.format
for automated format checking, read.nexus
for NEXUS, read.alignment
for some other formats
## Not run: oldwd <- getwd() setwd(file.path(.Library, "ComPairWise", "examples")) read.phylip("sample.phy") setwd(oldwd) rm(oldwd) ## End(Not run)