Loading Ape Package and reading in butterfly file
#install.packages("ape")
library(ape)
butterfly <- read.table("butterfly.seq", sep = ",", header = F)
Downloading required sequences from Genbank, to be stored as a single variable
sequences <- read.GenBank(butterfly$V1,
seq.names = butterfly$V1,
species.names = TRUE,
as.character = TRUE)
Exporting the butterfly sequence as a FASTA file
write.dna(sequences, "butterfly.fasta", format = "fasta")