Skip to content

Instantly share code, notes, and snippets.

@marcelm
Last active January 29, 2021 14:11
Show Gist options
  • Save marcelm/af99da7dea5ac93cfaaa5fac946c6b00 to your computer and use it in GitHub Desktop.
Save marcelm/af99da7dea5ac93cfaaa5fac946c6b00 to your computer and use it in GitHub Desktop.
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