Mercurial > repos > iuc > ncbi_eutils_esummary
annotate epost.py @ 1:c8d4ea6376a7 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
author | iuc |
---|---|
date | Tue, 30 Oct 2018 19:09:40 -0400 |
parents | 92bd8a680b9d |
children | 254f40d3ae2b |
rev | line source |
---|---|
0
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
1
c8d4ea6376a7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
iuc
parents:
0
diff
changeset
|
2 from __future__ import print_function |
c8d4ea6376a7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
iuc
parents:
0
diff
changeset
|
3 |
0
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
4 import argparse |
1
c8d4ea6376a7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
iuc
parents:
0
diff
changeset
|
5 |
0
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
6 import eutils |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
7 |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
8 |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
9 if __name__ == '__main__': |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
10 parser = argparse.ArgumentParser(description='EPost', epilog='') |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
11 parser.add_argument('db', help='Database to use') |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
12 parser.add_argument('--id_list', help='list of ids') |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
13 parser.add_argument('--id', help='Comma separated individual IDs') |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
14 parser.add_argument('--history_file', help='Post to new QueryKey in an existing WebEnv') |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
15 parser.add_argument('--user_email', help="User email") |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
16 parser.add_argument('--admin_email', help="Admin email") |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
17 |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
18 args = parser.parse_args() |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
19 |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
20 c = eutils.Client(history_file=args.history_file, user_email=args.user_email, admin_email=args.admin_email) |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
21 merged_ids = c.parse_ids(args.id_list, args.id, args.history_file) |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
22 |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
23 payload = {} |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
24 if args.history_file is not None: |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
25 payload.update(c.get_history()) |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
26 else: |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
27 payload['id'] = ','.join(merged_ids) |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
28 payload['WebEnv'] = '' |
92bd8a680b9d
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
iuc
parents:
diff
changeset
|
29 |
1
c8d4ea6376a7
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit a4b0969b33a68a0ea9ba12291f6694aec24f13ed
iuc
parents:
0
diff
changeset
|
30 print(c.post(args.db, **payload)) |