Mercurial > repos > cpt_testbed > functionalworkflow
diff gff3_splitgff.py @ 0:f678e282b320 draft default tip
"planemo upload"
author | cpt_testbed |
---|---|
date | Fri, 06 May 2022 07:07:23 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gff3_splitgff.py Fri May 06 07:07:23 2022 +0000 @@ -0,0 +1,35 @@ +#!/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()