#!/usr/bin/python

#use: split_fasta.py <fasta> <per file number entries>

import sys
from Bio import SeqIO

myFASTA = open(sys.argv[1], 'rU')
number = int(sys.argv[2])
i=0
for record in SeqIO.parse(myFASTA, "fasta") :
    if i % number == 0 :
        output = open(sys.argv[1]+"-"+str(i), 'w')
    SeqIO.write(record,output,"fasta")
    i+=1

myFASTA.close()
