Mercurial > repos > rnateam > splitfasta
diff splitFasta.py @ 0:f6d6b62540f8 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/splitfasta commit 03f3cc2000e6ce876a3cb44c55c3fe878a2e7ce3-dirty
author | rnateam |
---|---|
date | Fri, 16 Oct 2015 16:13:08 -0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/splitFasta.py Fri Oct 16 16:13:08 2015 -0400 @@ -0,0 +1,13 @@ +#!/usr/bin/env python +import os +import sys +from Bio import SeqIO + +if __name__ == "__main__": + inpath = sys.argv[1] + os.mkdir('splits') + with open(inpath, 'r') as handle: + for record in SeqIO.parse(handle, 'fasta'): + header = os.path.join('splits', record.id + '.fasta') + with open(header, 'w') as handle2: + SeqIO.write([record], handle2, 'fasta')