comparison cpt_rem_annotes/remove_annotations.py @ 0:03d27abd1dfd draft

Uploaded
author cpt
date Fri, 13 May 2022 05:26:10 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:03d27abd1dfd
1 #!/usr/bin/env python
2 import sys
3 import argparse
4 from CPT_GFFParser import gffParse, gffWrite
5
6 if __name__ == "__main__":
7 parser = argparse.ArgumentParser()
8 parser.add_argument("gff3", type=argparse.FileType("r"), help="GFF3 annotations")
9 parser.add_argument("--remark", action="store_true", help="Remove remark features")
10 parser.add_argument("--region", action="store_true", help="Remove region features")
11 args = parser.parse_args()
12
13 for rec in gffParse(args.gff3):
14 rec.annotations = {}
15 if args.remark:
16 rec.features = [x for x in rec.features if x.type != "remark"]
17 if args.region:
18 rec.features = [x for x in rec.features if x.type != "region"]
19 gffWrite([rec], sys.stdout)