Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Created May 6, 2014 18:53
Show Gist options
  • Save mdshw5/c7cf7a232b27de0d4b31 to your computer and use it in GitHub Desktop.
Save mdshw5/c7cf7a232b27de0d4b31 to your computer and use it in GitHub Desktop.
Biostars #99889
"""
Convert FASTA to FASTQ file with a static
Usage:
$ ./fasta_to_fastq NAME.fasta NAME.fastq
"""
import sys, os
from Bio import SeqIO
# Get inputs
fa_path = sys.argv[1]
fq_path = sys.argv[2]
# make fastq
with open(fa_path, "r") as fasta, open(fq_path, "w") as fastq:
for record in SeqIO.parse(fasta, "fasta"):
record.letter_annotations["phred_quality"] = [40] * len(record)
SeqIO.write(record, fastq, "fastq")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment