require(seqinr)
## Load data 

fasta <- read.fasta("FullSequence.fasta") # Read in FASTA alignment with seqinr
index <- read.csv("FullSequence_index.csv") # Read index file
## Make sequence of positions to extract and make new index

for (i in 1:nrow(index)){
  
  gene_loci <- index$Start[i]:index$Stop[i] 
  
  newfasta <- lapply(1:length(fasta), function(x){fasta[[x]][gene_loci]}) 
  
  names(newfasta) <- names(fasta)
  
  write.fasta(sequences = newfasta, names = names(newfasta), 
              file.out = paste0(index$Gene_Name[i],".fasta"), open = "w")
  
}