library(glue)
seq_to_fas <- function(seq, path) {
fas <- data.frame(
ID = seq,
Sequence = seq)
# save as fas
Xfasta <- character(nrow(fas) * 2)
Xfasta[c(TRUE, FALSE)] <- paste0(">", fas$ID)
Xfasta[c(FALSE, TRUE)] <- fas$Sequence
print(glue("save .fas file in ",path ))
writeLines(Xfasta, path)
}
반응형