-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublications.Rmd
executable file
·138 lines (117 loc) · 4.94 KB
/
publications.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
---
# Publications widget.
# This widget displays recent publications from `content/publication/`.
date: "2025-01-01T00:00:00"
draft: false
title: "Publications"
subtitle: ""
widget: "custom_vertical"
# Order that this section will appear in.
weight: 3
# Number of publications to list.
count: 10
# Show publication details (such as abstract)? (true/false)
detailed_list: false
---
```{r, include=FALSE}
knitr::opts_chunk$set(echo=FALSE, message=FALSE, warning=FALSE)
```
```{r readbib}
library(RefManageR)
library(magrittr)
library(dplyr)
bib <- ReadBib('../../misc/HS-publication.bib')
convertBold <- function(cc){
sapply(cc, function(ccc){
if(grepl('\\\\bf', ccc)){
ccc %>% gsub('\\\\bf', '', .) %>% paste0('<strong>', ., '</strong>') %>% return
} else {
return(ccc)
}
})
}
convertStars <- function(cc){
cc %>% gsub('\\*', '\\\\*', .)
}
bib.df <- lapply(bib, function(bibi) {
data.frame(
title = if (!is.null(bibi$title)) gsub('\\{', '', gsub('\\}', '', bibi$title)) else NA,
year = if (!is.null(bibi$year)) as.numeric(bibi$year) else NA,
doi = if (!is.null(bibi$doi)) bibi$doi else NA,
journal = if (!is.null(bibi$journal)) {
gsub('.*\\}\\{(.*)\\}', '\\1', bibi$journal)
} else if (!is.null(bibi$booktitle)) {
gsub('.*\\}\\{(.*)\\}', '\\1', bibi$booktitle)
} else {
NA
},
author = if (!is.null(bibi$author)) {
bibi$author %>%
as.character() %>%
convertBold %>%
convertStars %>%
paste(collapse = ', ')
} else {
NA
},
keywords = if (!is.null(bibi$keywords)) bibi$keywords else '',
pmid = if (!is.null(bibi$pmid)) bibi$pmid else '',
preprintdoi = if (!is.null(bibi$preprintdoi)) bibi$preprintdoi else '',
scripts = if (!is.null(bibi$scripts)) bibi$scripts else '',
press = if (!is.null(bibi$pressurl)) bibi$pressurl else '',
stringsAsFactors = FALSE
)
})
bib.df = do.call(rbind, bib.df)
bib.df %<>% mutate(rk=1:n())
```
```{r outlist, results='asis'}
htmlCit <- function(df){
## Button linking to PubMed Central
pmcid = ''
if(df$pmid != ''){
pmcid = paste0(' <a class="btn btn-primary btn-outline btn-xs" target=\"_blank\" href="https://www.ncbi.nlm.nih.gov/pmc/articles/pmid/', df$pmid, '">PubMed Central</a>')
}
## Button linking to the preprint
preprintdoi = ''
if(df$preprintdoi != ''){
preprintdoi = paste0(' <a class="btn btn-primary btn-outline btn-xs" target=\"_blank\" href="https://doi.org/', df$preprintdoi, '">Preprint</a>')
}
## Button linking to the repo with scripts
scripts = ''
if(df$scripts != ''){
scripts = paste0(' <a class="btn btn-primary btn-outline btn-xs" target=\"_blank\" href="', df$scripts, '">Data/Code</a>')
}
## Button linking to the press page
press = ''
if(df$press != ''){
press = paste0(' <a class="btn btn-primary btn-outline btn-xs" href="/fixed/', df$press, '">Press</a>')
}
## Start a "row"
cat('<li itemscope itemtype="http://schema.org/CreativeWork"><i class="fa-li fa fa-file-text-o" aria-hidden="true"></i>')
cat('<div class="row">')
## Article info and links
cat('<div class="col-md-10"><span itemprop="name">', df$title, '. <a target=\"_blank\" href="https://doi.org/',
df$doi, '">', df$journal, ' ', df$year, '.</a></span><div class="authorpub">', df$author, '</div>', pmcid, preprintdoi, scripts, press, '</div>', sep='')
## Badges
cat('<div class="col-md-2">')
cat(paste0('<span class="__dimensions_badge_embed__" data-doi="', df$doi, '" data-hide-zero-citations="true" data-style="small_rectangle"></span>'))
cat(paste0('<div data-badge-type="2" data-doi="',df$doi,'" data-hide-no-mentions="true" data-hide-less-than="1" class="altmetric-embed" data-badge-popover="left" data-link-target="_blank"></div>'))
if(df$preprintdoi != ''){
cat(paste0('<span class="__dimensions_badge_embed__" data-doi="', df$preprintdoi, '" data-hide-zero-citations="true" data-style="small_rectangle"></span>'))
cat(paste0('<div data-badge-type="2" data-doi="',df$preprintdoi,'" data-hide-no-mentions="true" data-hide-less-than="1" class="altmetric-embed" data-badge-popover="left" data-link-target="_blank"></div>'))
}
cat('</div>')
## End article "row"
cat('</div>')
cat('</li>')
data.frame()
}
cat('<ul class="fa-ul">')
dump = bib.df %>% filter(!grepl('Under review', journal), !grepl('no-website', keywords)) %>% group_by(desc(year),rk,title) %>% do(htmlCit(.))
cat('</ul>')
## cat('<h3>Consortia publications</h3>\n<ul class="fa-ul">')
## dump = bib.df %>% filter(!grepl('Under review', journal), grepl('no-website', keywords)) %>% group_by(desc(year),rk,title) %>% do(htmlCit(.))
## cat('</ul>')
##And here is the [PDF of my PhD thesis](https://github.com/jmonlong/phdthesis/releases/download/final/Monlong_Jean_HumanGenetics_thesis.pdf) on "*Population-Based Approaches to Characterize Copy Number Variation from Whole-Genome Sequencing in Healthy Individuals and ##Disease Cohorts*" ([LaTeX source](https://github.com/jmonlong/phdthesis)).
```