Skip to content

Instantly share code, notes, and snippets.

@marcelm
Last active January 29, 2021 14:11
FASTA to FASTQ conversion
#!/usr/bin/env python3
"""
Run with:
fasta2fastq < in.fasta > out.fastq
"""
import dnaio
import sys
with dnaio.open(sys.stdin.buffer) as inf:
with dnaio.open(sys.stdout.buffer, mode="w", fileformat="fastq") as outf:
for record in inf:
record.qualities = "H" * len(record.sequence)
outf.write(record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment