Skip to content

Commit 4c2b60b

Browse files
author
Hector Galvez
committed
Added simple script that converts a single-line fasta to a line-wrapped fasta
1 parent 7347245 commit 4c2b60b

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

python/wrapFasta.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python
2+
3+
from Bio.Seq import Seq
4+
from Bio import SeqIO
5+
import sys
6+
7+
'''
8+
Simple script that takes in a fasta file and returns a line-warped fasta.
9+
'''
10+
11+
infile = sys.argv[1]
12+
13+
if infile[-3:] == '.fa':
14+
outfile = infile.replace('.fa', '.wrap.fa')
15+
elif infile[-6:] == '.fasta':
16+
outfile = infile.replace('.fasta', '.wrap.fasta')
17+
else:
18+
print("Unsopported filetype")
19+
20+
SeqIO.convert(infile, 'fasta', outfile, 'fasta')
21+

0 commit comments

Comments
 (0)