file.write {phyclust} | R Documentation |
Write Data to Files by Formats
Description
Two major file formats are supported in phyclust,
Format phylip
and Format fasta
.
These functions only write files in basic syntax.
Usage
write.fasta(seqdata, filename, classid = NULL, seqname = NULL,
width.line = 60, lower.case = FALSE, code.type = .code.type[1],
sep = "")
write.fasta.format(seqdata, filename, classid = NULL, seqname = NULL,
width.line = 60, sep = "")
write.phylip(seqdata, filename, classid = NULL, seqname = NULL,
width.seqname = 10, width.line = 60, lower.case = FALSE,
code.type = .code.type[1], sep = "")
write.phylip.format(seqdata, filename, classid = NULL, seqname = NULL,
width.seqname = 10, width.line = 60, sep = "")
write.paml(seqdata, filename, classid = NULL, seqname = NULL,
width.seqname = 10, width.line = 60, lower.case = FALSE,
code.type = .code.type[1], sep = "")
write.paml.format(seqdata, filename, classid = NULL, seqname = NULL,
width.seqname = 10, width.line = 60, sep = "")
Arguments
seqdata |
a matrix contains sequence ids as |
filename |
a file name where data is written to. |
classid |
class id of sequences. |
seqname |
sequence names. |
width.seqname |
number of characters of sequence names to be stored. |
width.line |
width of lines for breaking lines. |
lower.case |
use lower case of letters to write |
code.type |
either "NUCLEOTIDE" (default) or "SNP". |
sep |
a character to split sites, "" (default) and "," for "CODON". |
Details
write.fasta
, write.phylip
, and write.paml
are general
functions call write.fasta.format
, write.phylip.format
and
write.paml.format
.
write.fasta.format
, write.phylip.format
, and
wirte.paml.format
will not do any transformation for input sequences,
but directly write them into the file as code.type = NULL
in
write.fasta
, write.phylip
and write.paml
.
Note that PAML uses one of PHYLIP format to deal with sequence files, so
write.paml.format
is to write files in a different format of
write.phylip.format
. The main purpose of write.paml
and
write.paml.format
is to generate files for pamle.baseml
.
sep
can specify a character which is used to split sites in file.
By default, "" denote no character between sites. Only "CODON" id requires
a character to avoid ambiguity.
Value
Save a text file.
Author(s)
Wei-Chen Chen wccsnow@gmail.com
References
Phylogenetic Clustering Website: https://snoweye.github.io/phyclust/
See Also
Examples
## Not run:
library(phyclust, quiet = TRUE)
# PHYLIP
data.path <- paste(.libPaths()[1], "/phyclust/data/crohn.phy", sep = "")
my.snp <- read.phylip(data.path, code.type = "SNP")
write.phylip(my.snp$org, "new.crohn.phy", code.type = "SNP")
# FASTA
data.path <- paste(.libPaths()[1], "/phyclust/data/pony625.fas", sep = "")
(my.pony <- read.fasta(data.path))
write.fasta(my.pony$org, "new.pony.fas")
# PAML
write.paml(my.pony$org, "new.pony.pam")
# Amino acid in PHYLIP
aa.aid <- nid2aid(my.pony$org)
aa.acode <- aid2acode(aa.aid)
write.phylip(aa.aid, "new.pony.aa.phy", code.type = "AMINO_ACID")
write.phylip.format(aa.aid, "new.pony.aa.aid.phy", sep = ",")
write.phylip.format(aa.acode, "new.pony.aa.acode.phy")
# Amino acid in FASTA
write.fasta(aa.aid, "new.pony.aa.phy", code.type = "AMINO_ACID")
write.fasta.format(aa.aid, "new.pony.aa.aid.phy", sep = ",")
write.fasta.format(aa.acode, "new.pony.aa.acode.fas")
# Amino acid in PAML
write.paml(aa.aid, "new.pony.aa.pam", code.type = "AMINO_ACID")
write.paml.format(aa.aid, "new.pony.aa.aid.pam", sep = ",")
write.paml.format(aa.acode, "new.pony.aa.acode.pam")
## End(Not run)