Mercurial > repos > cpt > cpt_gff_split
view gff3_splitgff.py @ 4:4b60e0b6a150 draft
planemo upload commit f33bdf952d796c5d7a240b132af3c4cbd102decc
author | cpt |
---|---|
date | Fri, 05 Jan 2024 05:52:42 +0000 |
parents | 8bd03ba8510a |
children |
line wrap: on
line source
#!/usr/bin/env python import sys import argparse from Bio import SeqIO from Bio.Seq import Seq from CPT_GFFParser import gffParse, gffWrite if __name__ == "__main__": parser = argparse.ArgumentParser( description="Sample script to add an attribute to a feature via web services" ) parser.add_argument("data", type=argparse.FileType("r"), help="GFF3 File") parser.add_argument( "--gff", type=argparse.FileType("w"), help="Output Annotations", default="data.gff3", ) parser.add_argument( "--fasta", type=argparse.FileType("w"), help="Output Sequence", default="data.fa", ) args = parser.parse_args() for record in gffParse(args.data): gffWrite([record], args.gff) record.description = "" if isinstance(record.seq, str): record.seq = Seq(record.seq) SeqIO.write([record], args.fasta, "fasta") sys.exit()