-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcall_biopython.py
More file actions
51 lines (36 loc) · 1.17 KB
/
call_biopython.py
File metadata and controls
51 lines (36 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/python3
# -*- coding: iso-8859-15 -*-
from Bio import Entrez
import argparse
from biopython_wrapper.wrapper import (
publication_ids, publication_info
)
def main():
parser = argparse.ArgumentParser(description="Call biopython apis with your email.")
parser.add_argument(
"--email", dest="email", default=None
)
parser.add_argument(
"--retmax", dest="retmax", help="Return at most `retmax` records.",
default="1"
)
parser.add_argument(
"--db", dest="db", help="NCBI Database to query.", default="pubmed"
)
parser.add_argument("search_term", help="Search term to query.")
args = parser.parse_args()
email = args.email
if email is None:
with open("./.email_cache.txt", "r") as f:
email = f.read().strip()
else:
with open("./.email_cache.txt", "w") as f:
f.write(email)
ids = publication_ids(
search_term=args.search_term, retmax=args.retmax, db=args.db
)
results = publication_info(publication_ids=ids, db=args.db)
# TODO: Do something more useful than just print it!
print(results)
if __name__ == "__main__":
main()