Mercurial > repos > iuc > ncbi_eutils_egquery
comparison efetch.py @ 0:9d18e6815994 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ncbi_entrez_eutils commit 15bcc5104c577b4b9c761f2854fc686c07ffa9db
author | iuc |
---|---|
date | Thu, 07 Jul 2016 02:39:52 -0400 |
parents | |
children | 28f69754ddc5 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9d18e6815994 |
---|---|
1 #!/usr/bin/env python | |
2 import argparse | |
3 import eutils | |
4 | |
5 | |
6 if __name__ == '__main__': | |
7 parser = argparse.ArgumentParser(description='EFetch', epilog='') | |
8 parser.add_argument('db', help='Database to use') | |
9 parser.add_argument('--user_email', help="User email") | |
10 parser.add_argument('--admin_email', help="Admin email") | |
11 | |
12 # ID source | |
13 parser.add_argument('--id_list', help='list of ids') | |
14 parser.add_argument('--id', help='Comma separated individual IDs') | |
15 parser.add_argument('--history_file', help='Fetch results from previous query') | |
16 | |
17 # Output | |
18 parser.add_argument('--retmode', help='Retmode') | |
19 parser.add_argument('--rettype', help='Rettype') | |
20 args = parser.parse_args() | |
21 | |
22 c = eutils.Client(history_file=args.history_file, user_email=args.user_email, admin_email=args.admin_email) | |
23 merged_ids = c.parse_ids(args.id_list, args.id, args.history_file) | |
24 | |
25 payload = {} | |
26 if args.history_file is not None: | |
27 payload.update(c.get_history()) | |
28 else: | |
29 payload['id'] = ','.join(merged_ids) | |
30 | |
31 for attr in ('retmode', 'rettype'): | |
32 if getattr(args, attr, None) is not None: | |
33 payload[attr] = getattr(args, attr) | |
34 | |
35 c.fetch(args.db, ftype=args.retmode, **payload) |