Mercurial > repos > sanbi-uwc > tb2neo
annotate write_db_summary.py @ 0:35bcefc9176b draft default tip
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
author | sanbi-uwc |
---|---|
date | Thu, 15 Jun 2017 07:41:38 -0400 |
parents | |
children |
rev | line source |
---|---|
0
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
2 from __future__ import print_function |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
3 |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
4 import argparse |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
5 import os |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
6 import os.path |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
7 |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
8 parser = argparse.ArgumentParser( |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
9 description="Write HTML summary from neostore datatype") |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
10 parser.add_argument('basepath') |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
11 parser.add_argument('label') |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
12 |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
13 args = parser.parse_args() |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
14 |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
15 output = """<html><head><title>Files for Composite Dataset ({})</title></head> |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
16 <p/>This composite dataset is composed of |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
17 the following files:<p/><ul>\n""".format(args.label) |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
18 db_path = args.basepath + '/neo4jdb/databases/graph.db' |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
19 for filename in os.listdir(db_path): |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
20 if filename.startswith('.'): |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
21 continue |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
22 path = db_path + '/' + filename |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
23 if os.path.isdir(path): |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
24 continue |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
25 output += "<li>{}</li>\n".format(filename) |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
26 output += '</ul></html>\b' |
35bcefc9176b
planemo upload for repository https://github.com/sanbi-sa/tools-sanbi-uwc commit dbd9af1e941e35ec9ca2a9f75af02edea67a5981
sanbi-uwc
parents:
diff
changeset
|
27 print(output) |