Mercurial > repos > bernhardlutz > rest_tool
comparison rest_tool.py @ 0:a9793e52a3ef draft
Uploaded
| author | bernhardlutz |
|---|---|
| date | Sun, 23 Mar 2014 09:27:27 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:a9793e52a3ef |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 # Aufruf convert_graph.py --type type --id id --outformat format | |
| 3 | |
| 4 import sys, os | |
| 5 import networkx as nx | |
| 6 import argparse | |
| 7 import json | |
| 8 | |
| 9 from xgmml_networkx import XGMMLParserHelper, XGMMLWriter | |
| 10 from networkx.readwrite import json_graph | |
| 11 | |
| 12 #supported graph_types | |
| 13 output_types = ["tsv", "csv", "png", "json", "txt", "xml", "sdf", "asnt", "asnb", "jsonp"] | |
| 14 | |
| 15 def main(args): | |
| 16 | |
| 17 if __name__ == "__main__": | |
| 18 | |
| 19 parser = argparse.ArgumentParser() | |
| 20 parser.add_argument('--type', type=str, | |
| 21 help="That you want BioAssay Compund ...") | |
| 22 parser.add_argument('--id', type=str, | |
| 23 help="Specify the format of the input graph") | |
| 24 parser.add_argument('--outformat', type=str, | |
| 25 help="Specify the format of the output", choices = output_types) | |
| 26 if len(sys.argv) < 6: | |
| 27 print "Too few arguments..." | |
| 28 parser.print_help() | |
| 29 exit(1) | |
| 30 args = parser.parse_args() | |
| 31 main( args ) |
