Mercurial > repos > cpt_testbed > suite_work2
comparison remove_annotations.py @ 0:d5c3354c166d draft default tip
Uploaded
| author | cpt_testbed |
|---|---|
| date | Fri, 29 Apr 2022 10:33:36 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:d5c3354c166d |
|---|---|
| 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) |
