Mercurial > repos > cpt > cpt_gff_split
view gff3_splitgff.py @ 5:ba8b6a5ffd9e draft default tip
planemo upload commit bd6df65b549fbec575d891285d194f55340ee52d
author | cpt |
---|---|
date | Fri, 24 May 2024 03:13:25 +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()