Skip to content

Commit d354e4e

Browse files
committed
updated 2025-09-29
1 parent 04740c1 commit d354e4e

File tree

4 files changed

+27
-13
lines changed

4 files changed

+27
-13
lines changed

R/sysdata.rda

10 Bytes
Binary file not shown.

data-raw/data-raw.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ source("data-raw/gwas_utils.R")
66

77
options(timeout = 5000000)
88

9-
catalog_version_date <- '2025-08-24'
10-
ebi_catalog_version_date <- '2025-08-24'
9+
catalog_version_date <- '2025-09-29'
10+
ebi_catalog_version_date <- '2025-09-29'
1111
fname_catalog_associations <-
1212
file.path(
1313
"data-raw",
@@ -145,11 +145,9 @@ for (c in gwas_collections) {
145145
## GET CITATION DATA
146146
gwas_citations[[c]] <- get_citations_pubmed(
147147
pmids = unique(gwas_hits[[c]]$pmid),
148-
cache_pmid_fname = file.path(
148+
chunk_size <- 250, cache_pmid_fname = file.path(
149149
"data-raw",
150-
paste0(
151-
"citations_gwas_",c,"_current.rds"
152-
))
150+
paste0("citations_gwas_",c,"_current.rds"))
153151
)
154152

155153

data-raw/gwas_utils.R

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,14 @@ chunk <- function(x,n) split(x, factor(sort(rank(x)%%n)))
9696
#'
9797
#' @param pmids An array of Pubmed IDs
9898
#' @param cache_pmid_fname File with retrieved citation data (.rds)
99+
#' @param chunk_size Size of chunks to be processed (
100+
#' max 400 due to EUtils limit)
99101
#' @return citation PubMed citation, with first author, journal and year
100102
#'
101-
get_citations_pubmed <- function(pmids, cache_pmid_fname = NA){
103+
get_citations_pubmed <- function(
104+
pmids,
105+
cache_pmid_fname = NA,
106+
chunk_size = 100){
102107

103108
pmid_df <- data.frame('pmid' = pmids)
104109
cache_citations <- data.frame()
@@ -123,11 +128,10 @@ get_citations_pubmed <- function(pmids, cache_pmid_fname = NA){
123128
}else{
124129
all_citations <- cache_citations
125130
}
126-
127131
pmids <- pmid_df$pmid
128132

129133
## make chunk of maximal 400 PMIDs from input array (limit by EUtils)
130-
pmid_chunks <- chunk(pmids,ceiling(length(pmids)/100))
134+
pmid_chunks <- chunk(pmids,ceiling(length(pmids)/chunk_size))
131135
j <- 0
132136
cat('Retrieving PubMed citations for PMID list, total length',
133137
length(pmids))
@@ -146,9 +150,21 @@ get_citations_pubmed <- function(pmids, cache_pmid_fname = NA){
146150
i <- 1
147151
first_author <- c()
148152
while (i <= length(authorlist)) {
149-
first_author <- c(first_author,
150-
paste(authorlist[[i]][1,]$LastName,
151-
" et al.", sep = ""))
153+
if (length(authorlist[[i]]) == 5) {
154+
if(!is.na(authorlist[[i]][1,]$LastName)){
155+
first_author <- c(first_author,
156+
paste(authorlist[[i]][1,]$LastName,
157+
" et al.", sep = ""))
158+
}
159+
if(is.na(authorlist[[i]][1,]$LastName) &
160+
!is.na(authorlist[[i]][1,]$CollectiveName)){
161+
first_author <- c(
162+
first_author,
163+
authorlist[[i]][1,]$CollectiveName)
164+
}
165+
}else{
166+
first_author <- c(first_author, "Unknown et al.")
167+
}
152168
i <- i + 1
153169
}
154170
journal <- RISmed::ISOAbbreviation(result)

inst/CITATION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ citEntry(
44
entry = "Manual",
55
title = "gwasOncoX: Low-to-moderate risk variants from GWAS studies in cancer",
66
author = "Sigve Nakken",
7-
year = "2022",
7+
year = "2025",
88
note = "R package version 1.5.5",
99
url = "https://github.com/sigven/gwasOncoX",
1010
textVersion = paste("Nakken S. ","(2025)",

0 commit comments

Comments
 (0)