-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfind_ct.py
More file actions
26 lines (20 loc) · 799 Bytes
/
Copy pathfind_ct.py
File metadata and controls
26 lines (20 loc) · 799 Bytes
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
from sqlite_utils import Database
pubmedDbFile = "/ssd/sqlite/PubMed.db"
pubmed = Database(pubmedDbFile)
def get_pmid_by_type(type_do):
return list(pubmed.query("SELECT pmid FROM type WHERE type = ?;", [type_do]))
def get_nct_by_type(type_do):
query="SELECT * FROM acc JOIN type ON acc.pmid = type.pmid WHERE type.type=?;"
return list(pubmed.query(query, [type_do]))
#main
ct_pmids = get_pmid_by_type("D016430")
print(f"Total clinical trials from PubMed.db (Clinical Trial D016430):{len(ct_pmids)}")
print(ct_pmids[0])
nct_matches = get_nct_by_type("D016430")
print(f"Clinical trials with NCT IDs: {len(nct_matches)}")
for row in nct_matches[:6]:
print(row)
retracted = get_nct_by_type("D016441")
print(f" Retracted: {len(retracted)}")
for row in retracted[:6]:
print(row)