Mercurial > repos > cpt > cpt_remove_annotations
diff cpt_rem_annotes/remove_annotations.py @ 0:03d27abd1dfd draft
Uploaded
author | cpt |
---|---|
date | Fri, 13 May 2022 05:26:10 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cpt_rem_annotes/remove_annotations.py Fri May 13 05:26:10 2022 +0000 @@ -0,0 +1,19 @@ +#!/usr/bin/env python +import sys +import argparse +from CPT_GFFParser import gffParse, gffWrite + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("gff3", type=argparse.FileType("r"), help="GFF3 annotations") + parser.add_argument("--remark", action="store_true", help="Remove remark features") + parser.add_argument("--region", action="store_true", help="Remove region features") + args = parser.parse_args() + + for rec in gffParse(args.gff3): + rec.annotations = {} + if args.remark: + rec.features = [x for x in rec.features if x.type != "remark"] + if args.region: + rec.features = [x for x in rec.features if x.type != "region"] + gffWrite([rec], sys.stdout)