Learn R Programming

phylotools (version 0.1.1)

rename.fasta: Renaming a fasta object given a reference table

Description

this function could be used to rename the sequences in the fasta object, given a reference dataframe.

Usage

rename.fasta(fas, ref, fil = NULL, prefix = NULL)

Arguments

fas
the fasta object.
ref
Dataframe with first column of the names of the sequences , the second column which name to change into.
fil
A string indicating the file name, the result written to.
prefix
prefix of which the names of the sequences.

Value

  • fasta object

Details

Prefix providing the flexibility of modifying the input names of sequences, for example, if the sequences names begin with "P_seq1", and unfortunately the names in reference table are lack of "P_". You may set the prefix as "P_", and without changing the reference table.

References

None

See Also

gnames.fas

Examples

Run this code
library(seqRFLP)
## loading data
data(fil.fas)
## Get the names of the sequences
col1 <- gnames.fas(fil.fas)
## Generating new names
col2 <- paste("seq", 1:length(col1), sep = "")
reftable.rename <- data.frame(col1, col2)
## 
rename.fasta(fil.fas, reftable.rename)

Run the code above in your browser using DataLab