view fasta_len.py @ 3:b741d86046a6 draft

planemo upload commit 94b0cd1fff0826c6db3e7dc0c91c0c5a8be8bb0c
author cpt
date Mon, 05 Jun 2023 02:54:00 +0000
parents
children
line wrap: on
line source

#!/usr/bin/env python
import argparse
from Bio import SeqIO
import sys


if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("fasta", type=argparse.FileType("r"))
    args = parser.parse_args()

    for record in SeqIO.parse(args.fasta, "fasta"):
        sys.stdout.write("%s\t%s\n" % (record.id, len(record)))