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