Once you've got a set of ORFs you're happy with, you'll likely want to save them to a file. You can do that by using the getSeq() function in the BSgenome package, passing it the original sequence object—dna_object—and the ranges in orfs_to_keep, then give the result some names using names(), and you can use the writeXStringSet() function to save them to file:
extracted_orfs <- BSgenome::getSeq(dna_object, orfs_to_keep) names(extracted_orfs) <- paste0("orf_", 1:length(orfs_to_keep)) writeXStringSet(extracted_orfs, "saved_orfs.fa")