Skip to content

Commit 5d552d7

Browse files
committed
Merge branch 'develop' for new release
2 parents a3b7e83 + 53b867b commit 5d552d7

File tree

8 files changed

+52
-7
lines changed

8 files changed

+52
-7
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: rentrez
2-
Version: 1.2.1
3-
Date: 2018-02-12
2+
Version: 1.2.2
3+
Date: 2019-05-02
44
Title: 'Entrez' in R
55
Authors@R: c(
66
person("David", "Winter", role=c("aut", "cre"),

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Version 1.2.2
2+
------------------
3+
Maintenance release containing a number of bug fixes.
4+
5+
* A fix #127 forces curl to use http/1.1, as NCBI produces errors when sing http/2
6+
(thanks @hammer for bug report and fix)
7+
* fix #131 stops pubmed records with reference sections production > 1
8+
value for the 'pmid' field. Thanks @agbarnett for the report.
9+
* Added clarification around the expectd input for `extract_from_esummary` to
10+
the docs.
11+
112
Version 1.2.1
213
------------------
314

R/base.r

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,23 @@ make_entrez_query <- function(util, config, interface=".fcgi?", by_id=FALSE, deb
4949
return( list(uri = uri, args=args ) )
5050
}
5151

52+
#Seemingly, NCBI moved to https but not http v2.0?
53+
# (thatnks Jeff Hammerbacher for report/solution)
54+
#
55+
# if no httr::config was passed we will add one
56+
if(is.null(config)){
57+
config = httr::config(http_version = 2)
58+
# otherwise add http version, checkign we aren't overwriting something
59+
# passed in (seems unlikely, but worth checking?)
60+
#
61+
} else {
62+
if ("http_version" %in% names(config$options)) {
63+
warning("Over-writing httr config options for 'http_version', as NCBI servers require v1.1")
64+
}
65+
config$options$http_version <- 2
66+
}
67+
68+
5269
if(length(args$id) > 200){
5370
response <- httr::POST(uri, body=args, config= config)
5471
} else {

R/entrez_summary.r

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ entrez_summary <- function(db, id=NULL, web_history=NULL,
8181

8282
#' Extract elements from a list of esummary records
8383
#'@export
84-
#'@param esummaries A list of esummary objects
84+
#'@param esummaries Either an esummary or an esummary_list (as returned by
85+
#' entrez_summary).
8586
#'@param elements the names of the element to extract
8687
#'@param simplify logical, if possible return a vector
88+
#'@seealso \code{\link{entrez_summary}} for examples of this function in action.
8789
#'@return List or vector containing requested elements
8890
extract_from_esummary <- function(esummaries, elements, simplify=TRUE){
8991
UseMethod("extract_from_esummary", esummaries)

R/parse_pubmed_xml.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ parse_one_pubmed <- function(paper){
5858
res$issue <- get_value(".//JournalIssue/Issue")
5959
res$pages <- get_value(".//MedlinePgn")
6060
res$key_words <- get_value(".//DescriptorName")
61-
res$doi <- get_value(".//ArticleId[@IdType='doi']")
62-
res$pmid <- get_value(".//ArticleId[@IdType='pubmed']")
61+
res$doi <- get_value(".//PubmedData/ArticleIdList/ArticleId[@IdType='doi']")
62+
res$pmid <- get_value(".//PubmedData/ArticleIdList/ArticleId[@IdType='pubmed']")
6363
res$abstract <- get_value(".//AbstractText")
6464

6565
structure(res, class="pubmed_record", empty=FALSE)

man/extract_from_esummary.Rd

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_net.r

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
context("Network")
22
test_that("The NCBI is contactable from this comptuter /",{
3-
expect_true(!httr::http_error("http://eutils.ncbi.nlm.nih.gov/entrez/eutils/"))
3+
response <- httr::GET("https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi")
4+
expect_lt(response$status_code, 400)
45
})

tests/testthat/test_parse.r

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ parsed_raw <- parse_pubmed_xml(raw_rec)
1010
parsed_rec <- parse_pubmed_xml(xml_rec)
1111
parsed_multi <- parse_pubmed_xml(multi_rec)
1212

13+
multi_pmid_eg <- parse_pubmed_xml(
14+
entrez_fetch(db="pubmed", id='29743284', rettype="xml")
15+
)
16+
1317
test_that("pubmed file parsers work",{
1418
expect_that(raw_rec, is_a("character"))
1519

@@ -27,6 +31,12 @@ test_that("pubmed file parsers work",{
2731
# re-introduced there will be 25 authors in each record and this will fail
2832
expect_that(length(parsed_multi[[1]]$authors), equals(1))
2933

34+
# Bug #131 related to extracting all PMIDs from a pubmed xml that contained
35+
# references, not just the one true pm od teh artcle. Testing we don't
36+
# regress
37+
38+
expect_that(length(multi_pmid_eg$pmid), equals(1))
39+
3040
})
3141

3242
test_that("we can print pubmed records", {

0 commit comments

Comments
 (0)