Mercurial > repos > rnateam > splitfasta
comparison splitFasta.py @ 5:733ca84b21ee draft default tip
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/splitfasta commit 31945d5d8c5ebee64ebf29c6ea022fb831f47274"
author | rnateam |
---|---|
date | Mon, 21 Sep 2020 15:40:14 +0000 |
parents | ae4d5733272f |
children |
comparison
equal
deleted
inserted
replaced
4:ae4d5733272f | 5:733ca84b21ee |
---|---|
1 #!/usr/bin/env python | |
2 import os | |
3 import sys | |
4 from Bio import SeqIO | |
5 | |
6 if __name__ == "__main__": | |
7 inpath = sys.argv[1] | |
8 os.mkdir('splits') | |
9 with open(inpath, 'r') as handle: | |
10 for record in SeqIO.parse(handle, 'fasta'): | |
11 header = os.path.join('splits', record.id + '.fasta') | |
12 with open(header, 'w') as handle2: | |
13 SeqIO.write([record], handle2, 'fasta') |