Mercurial > repos > jjohnson > gffutils
comparison create_gffdb.py @ 0:8ba71aead5bc draft
planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/gffutils commit 186424e18ed21f2aea293fa7c4b654a9a4fb5d8c-dirty
author | jjohnson |
---|---|
date | Sun, 08 Apr 2018 13:26:47 -0400 |
parents | |
children | 8880c2e4b2ee |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:8ba71aead5bc |
---|---|
1 #!/usr/bin/env python | |
2 | |
3 from __future__ import print_function | |
4 | |
5 import argparse | |
6 import json | |
7 import sys | |
8 | |
9 import gffutils | |
10 | |
11 | |
12 def __main__(): | |
13 parser = argparse.ArgumentParser( | |
14 description='Convert mga output to bed and tsv') | |
15 parser.add_argument( | |
16 'input_gff', | |
17 help="gff3 or gtf file to load") | |
18 parser.add_argument( | |
19 'gff_sqlite', | |
20 help="sqlite file") | |
21 args = parser.parse_args() | |
22 | |
23 db = gffutils.create_db(args.input_gff, args.gff_sqlite) | |
24 version = db.execute('SELECT version FROM meta').fetchone()[0] | |
25 print('version:%s' % version,file=sys.stdout) | |
26 dialect = db.execute('SELECT dialect FROM meta').fetchone()[0] | |
27 info = json.loads(dialect) | |
28 if 'fmt' in info: | |
29 print('format:%s' % info['fmt'],file=sys.stdout) | |
30 seqids = [r[0] for r in db.execute('SELECT distinct seqid FROM features').fetchall()] | |
31 print('seqids:%s' % ','.join(seqids),file=sys.stdout) | |
32 | |
33 | |
34 if __name__ == "__main__": | |
35 __main__() |