-
Notifications
You must be signed in to change notification settings - Fork 0
/
PathologyArticlesFromTurkeyComparedtoAllPublishedArticles.Rmd
358 lines (249 loc) · 8.2 KB
/
PathologyArticlesFromTurkeyComparedtoAllPublishedArticles.Rmd
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
---
title: "Pathology Articles From Turkey Compared to All Published Articles"
output: html_notebook
---
# europepmc
https://cran.r-project.org/web/packages/europepmc/index.html
https://cran.r-project.org/web/packages/europepmc/vignettes/evergreenreviewgraphs.html
```{r}
library(europepmc)
```
```{r}
articlesPerTotalArticles <- europepmc::epmc_hits_trend(query = "(AFF:'Turkey') AND ((AFF:'pathology') OR (AFF:'Pathology'))", period = 1980:2017)
articlesPerTotalArticles
```
A trend graph of articles of #pathologist from #Turkey derived from Europe PMC #RStats #europepmc #evergreenreviewgraph #pathology #research #bibliography
```{r}
library(ggplot2)
ggplot(articlesPerTotalArticles, aes(year, query_hits / all_hits)) +
geom_point() +
geom_line() +
xlab("Year published") +
ylab("Proportion of Pathology articles \n from Turkey in Europe PMC")
```
---
# PubMed
## Data retriveal from PubMed using EDirect
Article PMID downloaded as `txt`.
```{r Search PubMed download PMID, eval=FALSE, include=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"esearch -db pubmed -query \"(pathology[Affiliation] OR patoloji[Affiliation]) AND (Turkey[Affiliation] OR Türkiye[Affiliation])\" -datetype PDAT -mindate 1800 -maxdate 3000 | \ efetch -format uid > data/pubmed_result_TurkPath_uid.txt \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
```
---
```{r Search local PubMed with downloaded PMID extract data as xml, eval=FALSE, include=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"cat data/pubmed_result_TurkPath_uid.txt | \ fetch-pubmed -path /Volumes/Agu2018/PubMed > data/pubmed_result_TurkPath.xml \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
```
---
```{r extract doi from xml, message=FALSE, warning=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"xtract -input data/pubmed_result_TurkPath.xml -pattern PubmedArticle -block ArticleId -if ArticleId@IdType -equals doi -element ArticleId > data/pubmed_result_TurkPath_doi.txt \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
```
```{r}
library(tidyverse)
pubmed_result_TurkPath_doi <- read.delim("data/pubmed_result_TurkPath_doi.txt", header = FALSE)
```
```{r}
pubmed_result_TurkPath_doi$V1[grep("^10.", pubmed_result_TurkPath_doi$V1)]
pubmed_result_TurkPath_doi$V2 <- grepl(
pattern = "^10.",
x = pubmed_result_TurkPath_doi$V1
)
pubmed_result_TurkPath_doi2 <- pubmed_result_TurkPath_doi %>%
filter(pubmed_result_TurkPath_doi$V2 == TRUE) %>%
select(V1)
write_csv(pubmed_result_TurkPath_doi2, "data/pubmed_result_TurkPath_doi2.txt", col_names = FALSE)
```
---
# WOS data for VOSviewer
```
(AD=Turkey AND SU=Pathology) OR (CU=Turkey AND SU=Pathology)
Indexes=SCI-EXPANDED, SSCI, A&HCI, CPCI-S, CPCI-SSH, BKCI-S, BKCI-SSH, ESCI Timespan=All years
```
# Hacettepe[Affiliation] AND Pathology[Affiliation]
```{r Search PubMed download all articles uid, eval=FALSE, include=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"esearch -db pubmed -query \"hacettepe[Affiliation] AND (pathology[Affiliation] OR patoloji[Affiliation])\" -datetype PDAT -mindate 1800 -maxdate 3000 | \ efetch -format uid > data/pubmed_result_hacettepe_pathology_uid.txt \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
file.info(here::here("data/pubmed_result_hacettepe_pathology_uid.txt"))$ctime
```
```{r Search PubMed download all articles xml, eval=FALSE, include=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"esearch -db pubmed -query \"hacettepe[Affiliation] AND (pathology[Affiliation] OR patoloji[Affiliation])\" -datetype PDAT -mindate 1800 -maxdate 3000 | \ efetch -format xml > data/pubmed_result_hacettepe_pathology_uid.xml \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
file.info(here::here("data/pubmed_result_hacettepe_pathology_uid.xml"))$ctime
```
```{r extract if pathology and hacettepe in same affiliation, eval=FALSE, include=FALSE}
myTerm <- rstudioapi::terminalCreate(show = FALSE)
rstudioapi::terminalSend(
myTerm,
"xtract -input data/pubmed_result_hacettepe_pathology_uid.xml -pattern PubmedArticle -tab \"|\" -sep \";\" -def \"NA\" -element MedlineCitation/PMID ArticleTitle Journal/ISSN ISOAbbreviation PubDate/Year Affiliation> data/data_hacettepepathology.csv \n"
)
Sys.sleep(1)
repeat {
Sys.sleep(0.1)
if (rstudioapi::terminalBusy(myTerm) == FALSE) {
print("Code Executed")
break
}
}
```
## read extracted data
```{r read data}
library(readr)
data_hacettepePathology <- read_delim(here::here("data/data_hacettepepathology.csv"),
"|",
escape_double = FALSE,
col_names = FALSE,
trim_ws = TRUE)
# View(data_hacettepePathology)
names(data_hacettepePathology) <- c("PMID", "ArticleTitle", "ISSN", "ISOAbbreviation", "PubDate", "Affiliation")
```
```{r separate affiliations}
library(tidyverse)
library(stringr)
str_count(string = data_hacettepePathology$Affiliation, pattern = ";") %>%
max()
```
```{r plain affiliation characters, include=FALSE}
# to.plain <- function(s) {
# # 1 character substitutions
# old1 <- "çğşıüöÇĞŞİÖÜ"
# new1 <- "cgsiuocgsiou"
# s1 <- chartr(old1, new1, s)
# # 2 character substitutions
# old2 <- c("œ", "ß", "æ", "ø")
# new2 <- c("oe", "ss", "ae", "oe")
# s2 <- s1
# for(i in seq_along(old2)) s2 <- gsub(old2[i], new2[i], s2, fixed = TRUE)
# s2
# }
data_hacettepePathology2 <- data_hacettepePathology %>%
select(PMID, Affiliation)
# [[:alpha:]]
# data_hacettepePathology2$Affiliation <- data_hacettepePathology2$Affiliation %>%
# tolower() %>%
# to.plain()
data_hacettepePathology2 <- data_hacettepePathology2 %>%
separate(col = "Affiliation", sep = ";", into = paste0("Affiliation", 1:6925))
```
```{r}
library(tidyverse)
library(reshape2)
DT.m1 <- melt(data_hacettepePathology2,
id.vars = c("PMID"),
measure.vars = paste0("Affiliation", 1:6925))
DT.m2 <- DT.m1 %>%
filter(!is.na(value))
DT.m2$count <- 1
```
```{r}
DT.m2$hacettepe <-
grepl(
pattern = ("[Hh]acettepe"),
x =
DT.m2$value
)
DT.m2$pathology <-
grepl(
pattern = ("[Pp]athology|[Pp]atoloji"),
x =
DT.m2$value
)
DT.m2$speach <-
grepl(
pattern = ("[Ss]peach|[Ss]peech"),
x =
DT.m2$value
)
```
```{r}
DT.m3 <- DT.m2 %>%
filter(hacettepe == TRUE & pathology == TRUE) %>%
filter(speach==FALSE)
```
```{r}
final_hacettepePathology <- data_hacettepePathology %>%
filter(PMID %in% DT.m3$PMID) %>%
select(-c("Affiliation")) %>%
left_join(DT.m3, by="PMID") %>%
select(c("PMID", "ArticleTitle", "ISSN", "ISOAbbreviation", "PubDate"), Affiliation = value) %>%
unique() %>%
mutate(PMIDLink = paste0("https://www.ncbi.nlm.nih.gov/pubmed/", PMID, ""))
writexl::write_xlsx(final_hacettepePathology, here::here("data/final_hacettepePathology.xlsx"))
```
```{r}
cat(paste0(final_hacettepePathology$PMID, " OR ")
)
```
```
(hacettepe[Affiliation] AND (pathology[Affiliation] OR patoloji[Affiliation])) NOT (speach[Affiliation] OR speech[Affiliation])
```
```
(Turkey[Affiliation] OR Turkiye[Affiliation]) AND ((pathology[Affiliation] OR patoloji[Affiliation]) NOT (speach[Affiliation] OR speech[Affiliation]))
```
```{r}
library(tidyverse)
library(tidylog)
library(mmpipe)
final_hacettepePathology <- data_hacettepePathology %V>%
filter(PMID %in% DT.m3$PMID) %V>%
select(-c("Affiliation")) %V>%
left_join(DT.m3, by="PMID") %V>%
select(c("PMID", "ArticleTitle", "ISSN", "ISOAbbreviation", "PubDate"), Affiliation = value) %V>%
unique() %V>%
mutate(PMIDLink = paste0("https://www.ncbi.nlm.nih.gov/pubmed/", PMID, ""))
```