Skip to content
Snippets Groups Projects
Commit 708da2b7 authored by Laura Cook's avatar Laura Cook
Browse files

first commit - script parses a multiFASTA and output a separate fasta file for each sequence header

parent ab960190
No related branches found
No related tags found
No related merge requests found
#!usr/bin/env python3
import string
import random
import sys
import os
from Bio import SeqIO
## usage python3 parse_FASTA.py [input.fasta] > [output.fasta]
file = sys.argv[1]
# Loop through all the files in the variable
with open(file, 'r') as all_TWARs:
# for each record (TWAR header) in the file parse it as a FASTA
for record in SeqIO.parse(all_TWARs, "fasta"):
# set the record ID to a variable
id = record.id
# set the TWAR sequence to a variable
seq = record.seq
print(">" + str(id) + "\n" + str(seq) + "*")
all_TWARs.close()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment