-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch_pubmed_for_pmids copy.py
81 lines (72 loc) · 1.78 KB
/
search_pubmed_for_pmids copy.py
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from Bio import Entrez
#import time
def search_pubmed(author):
# Set your email here
Entrez.email = "[email protected]"
# Define search query
query = f'"{author}"[Author]'
# Perform the search
handle = Entrez.esearch(db="pubmed", term=query, retmax=500)
record = Entrez.read(handle)
handle.close()
# Get the list of PMIDs
pmids = record["IdList"]
# Introduce a delay of 1 second if needed
#time.sleep(1)
return pmids
# List of authors to search for
# JQ Smith
authors = [
"Wideqvist, Maria",
"Abu Al Chay, Moner",
"Frisk Torell, Matilda",
"Novo, Mirza",
"Jha, Sandeep",
"Valeljung, Inger",
"Mellberg, Tomas",
"Björkenstam, Marie",
"Bartfay, Sven Erik",
"Backelin, Charlotte",
"Martinsson, Andreas",
"Taha, Amar",
"Bene, Orsolya",
"Vahedi, Farzad",
"Rubulis, Aigars",
"Herczku, Csaba",
"Bollano, Entela",
"Bergfeldt, Lennart",
"Sigurjonsdottir, Runa",
"Lundgren, Peter",
"Smith, Gustav",
"Hjalmarsson, Clara",
"Andersson, Bert",
"Bergh, Niklas",
"Omerovic, Elmir",
"Redfors, Björn",
"Dworeck, Christian",
"Odell, Annika",
"Andréen, Sofie",
"Ljungman, Charlotta",
"Dahlberg, Pia",
"Axelsson, Karl-Jonas",
"Angerås, Oskar",
"Råmunddal, Truls",
"Odenstedt, Jacob",
"Romeo, Stefano",
"Pirazzi, Carlo",
"Bobbio, Emanuele",
"Karason, Kristjan",
"Bentzel, Sara",
"Ravn-Fischer, Annica",
"Rawshani, Araz",
"Skoglund, Kristofer",
"Lachonius, Maria"
]
for author in authors:
pmids = search_pubmed(author)
print(f"Author: {author}")
if pmids:
print(", ".join(pmids))
else:
print("No publications found.")
print("-" * 20) # Separator for readability