From 242123c6ed346df63b7db010d47e9a821bb8bb7c Mon Sep 17 00:00:00 2001 From: Isabel Restrepo Date: Fri, 5 Oct 2018 12:10:46 -0400 Subject: [PATCH 1/4] update body part of HTTP post to use correct tag Also added test for longer efetch --- src/eutils.jl | 8 ++++---- test/eutils.jl | 24 ++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/eutils.jl b/src/eutils.jl index 496db2c..d433960 100644 --- a/src/eutils.jl +++ b/src/eutils.jl @@ -92,7 +92,7 @@ Parameters: db, id, WebEnv. function epost(ctx::AbstractDict=empty_context(); params...) params = process_parameters(params, ctx) body = HTTP.escapeuri(params) - res = HTTP.request("POST", string(baseURL, "epost.fcgi"), query=body) + res = HTTP.request("POST", string(baseURL, "epost.fcgi"), body=body) set_context!(ctx, res) return res end @@ -107,7 +107,7 @@ Parameters: db, id, query_key, WebEnv, retstart, retmax, retmode, version. function esummary(ctx::AbstractDict=empty_context(); params...) params = process_parameters(params, ctx) body = HTTP.escapeuri(params) - return HTTP.request("POST", string(baseURL, "esummary.fcgi"), query=body) + return HTTP.request("POST", string(baseURL, "esummary.fcgi"), body=body) end """ @@ -121,7 +121,7 @@ strand, seq_start, seq_stop, complexity. function efetch(ctx::AbstractDict=empty_context(); params...) params = process_parameters(params, ctx) body = HTTP.escapeuri(params) - return HTTP.request("POST", string(baseURL, "efetch.fcgi"), query=body, retry_non_idempotent=true) + return HTTP.request("POST", string(baseURL, "efetch.fcgi"), body=body, retry_non_idempotent=true) end """ @@ -135,7 +135,7 @@ datetype, reldate, mindate, maxdate. function elink(ctx::AbstractDict=empty_context(); params...) params = process_parameters(params, ctx) body = HTTP.escapeuri(params) - return HTTP.request("POST", string(baseURL, "elink.fcgi"), query=body) + return HTTP.request("POST", string(baseURL, "elink.fcgi"), body=body) end """ diff --git a/test/eutils.jl b/test/eutils.jl index f08f367..7dc48d9 100644 --- a/test/eutils.jl +++ b/test/eutils.jl @@ -87,6 +87,30 @@ @test res.status == 200 res = efetch(ctx, db="protein", retmode="xml") @test res.status == 200 + + # esearch then efeth for large number of ids + retmax = 1000 + search_term = """(Asthma[MeSH Major Topic]) + AND ("1/1/2018"[Date - Publication] : + "3000"[Date - Publication])""" + res = esearch(db = "pubmed", term = search_term, + retstart = 0, retmax = retmax, tool = "BioJulia") + + #convert xml to dictionary + esearch_dict = parse_xml(String(res.body)) + + #get the list of ids and perfom a fetch + ids = [parse(Int64, id_node) for id_node in esearch_dict["IdList"]["Id"]] + + res = efetch(db = "pubmed", tool = "BioJulia", retmode = "xml", rettype = "null", id = ids) + @test res.status == 200 + @test startswith(Dict(res.headers)["Content-Type"], "text/xml") + + body = parse_xml(String(res.body)) + + @test haskey(body, "PubMedArticle") + @test length(body["PubmedArticle"]) == retmax + end @testset "elink" begin From 94162c7982b12c854e3c69173bf18c9c1143f12c Mon Sep 17 00:00:00 2001 From: Isabel Restrepo Date: Fri, 5 Oct 2018 12:12:10 -0400 Subject: [PATCH 2/4] fix capitalization of xml element --- test/eutils.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/eutils.jl b/test/eutils.jl index 7dc48d9..1e6cb4d 100644 --- a/test/eutils.jl +++ b/test/eutils.jl @@ -108,7 +108,7 @@ body = parse_xml(String(res.body)) - @test haskey(body, "PubMedArticle") + @test haskey(body, "PubmedArticle") @test length(body["PubmedArticle"]) == retmax end From 0a4f0ecebcd4b175f246ee30cf413f3107d0a071 Mon Sep 17 00:00:00 2001 From: Isabel Restrepo Date: Fri, 5 Oct 2018 13:27:00 -0400 Subject: [PATCH 3/4] Remove .toml files --- Manifest.toml | 158 -------------------------------------------------- Project.toml | 15 ----- 2 files changed, 173 deletions(-) delete mode 100644 Manifest.toml delete mode 100644 Project.toml diff --git a/Manifest.toml b/Manifest.toml deleted file mode 100644 index 1227138..0000000 --- a/Manifest.toml +++ /dev/null @@ -1,158 +0,0 @@ -[[AbstractTrees]] -deps = ["Markdown", "Test"] -git-tree-sha1 = "feb8b2c99359901e295443c9d0c7e711604acf39" -uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" -version = "0.2.0" - -[[Base64]] -uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" - -[[BinaryProvider]] -deps = ["Libdl", "Pkg", "SHA", "Test"] -git-tree-sha1 = "b530fbeb6f41ab5a83fbe3db1fcbe879334bcd2d" -uuid = "b99e7846-7c00-51b0-8f62-c81ae34c0232" -version = "0.4.2" - -[[Compat]] -deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"] -git-tree-sha1 = "ae262fa91da6a74e8937add6b613f58cd56cdad4" -uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "1.1.0" - -[[DataStructures]] -deps = ["InteractiveUtils", "REPL", "Random", "Serialization", "Test"] -git-tree-sha1 = "2afbbd0294306b0b74a753c196be50b35edb625c" -uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.11.1" - -[[Dates]] -deps = ["Printf"] -uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" - -[[DelimitedFiles]] -deps = ["Mmap"] -uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab" - -[[Distributed]] -deps = ["LinearAlgebra", "Random", "Serialization", "Sockets"] -uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" - -[[EzXML]] -deps = ["BinaryProvider", "Libdl", "Pkg", "Printf", "Test"] -git-tree-sha1 = "0080045a5ce51180a704d67074c0f15a41b9427a" -uuid = "8f5d6c58-4d21-5cfd-889c-e3ad7ee6a615" -version = "0.8.0" - -[[Gumbo]] -deps = ["AbstractTrees", "BinaryProvider", "Libdl", "Pkg", "SHA", "Test"] -git-tree-sha1 = "9129bb34e8ec20cbe78b6d7be6d67f5a711d3b0f" -uuid = "708ec375-b3d6-5a57-a7ce-8257bf98657a" -version = "0.5.0" - -[[HTTP]] -deps = ["Base64", "Dates", "Distributed", "IniFile", "MbedTLS", "Sockets", "Test"] -git-tree-sha1 = "8a0f75e8b09df01d9f1ba9ad3fbf8b4983595d20" -uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3" -version = "0.6.14" - -[[IniFile]] -deps = ["Test"] -git-tree-sha1 = "098e4d2c533924c921f9f9847274f2ad89e018b8" -uuid = "83e8ac13-25f8-5344-8a64-a9f2b223428f" -version = "0.5.0" - -[[InteractiveUtils]] -deps = ["LinearAlgebra", "Markdown"] -uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240" - -[[IterTools]] -deps = ["Pkg", "SparseArrays", "Test"] -git-tree-sha1 = "ed0787e62dc46b8d8c7c3db54391d71e0da5fefd" -uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -version = "1.0.0" - -[[JSON]] -deps = ["Dates", "Distributed", "Mmap", "Pkg", "Sockets", "Test", "Unicode"] -git-tree-sha1 = "fec8e4d433072731466d37ed0061b3ba7f70eeb9" -uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.19.0" - -[[LibGit2]] -uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" - -[[Libdl]] -uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" - -[[LinearAlgebra]] -deps = ["Libdl"] -uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" - -[[Logging]] -uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" - -[[Markdown]] -deps = ["Base64"] -uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" - -[[MbedTLS]] -deps = ["BinaryProvider", "Compat", "Libdl", "Pkg", "Sockets"] -git-tree-sha1 = "17d5a81dbb1e682d4ff707c01f0afe5948068fa6" -uuid = "739be429-bea8-5141-9913-cc70e7f3736d" -version = "0.6.0" - -[[Mmap]] -uuid = "a63ad114-7e13-5084-954f-fe012c677804" - -[[Pkg]] -deps = ["Dates", "LibGit2", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"] -uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" - -[[Printf]] -deps = ["Unicode"] -uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" - -[[REPL]] -deps = ["InteractiveUtils", "Markdown", "Sockets"] -uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" - -[[Random]] -deps = ["Serialization"] -uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" - -[[SHA]] -uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" - -[[Serialization]] -uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" - -[[SharedArrays]] -deps = ["Distributed", "Mmap", "Random", "Serialization"] -uuid = "1a1011a3-84de-559e-8e89-a11a2f7dc383" - -[[Sockets]] -uuid = "6462fe0b-24de-5631-8697-dd941f90decc" - -[[SparseArrays]] -deps = ["LinearAlgebra", "Random"] -uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" - -[[Statistics]] -deps = ["LinearAlgebra", "SparseArrays"] -uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" - -[[Test]] -deps = ["Distributed", "InteractiveUtils", "Logging", "Random"] -uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[[UUIDs]] -deps = ["Random"] -uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4" - -[[Unicode]] -uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" - -[[XMLDict]] -deps = ["DataStructures", "EzXML", "IterTools", "Test"] -git-tree-sha1 = "77a40486f4e5c81c57867d056933022bc4c5fe02" -uuid = "228000da-037f-5747-90a9-8195ccbf91a5" -version = "0.3.0" diff --git a/Project.toml b/Project.toml deleted file mode 100644 index affee64..0000000 --- a/Project.toml +++ /dev/null @@ -1,15 +0,0 @@ -name = "BioServices" -uuid = "a0d4ced5-b29c-5395-b614-ca030a679c4b" -authors = ["Ben J Ward "] -version = "0.3.0" - -[deps] -Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" -Gumbo = "708ec375-b3d6-5a57-a7ce-8257bf98657a" -HTTP = "cd3eb016-35fb-5094-929b-558a96fad6f3" -JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" -XMLDict = "228000da-037f-5747-90a9-8195ccbf91a5" - -[compat] -julia = "1.0" From 089dae7faa801ef996dcf9a7c305059284082066 Mon Sep 17 00:00:00 2001 From: Isabel Restrepo Date: Fri, 5 Oct 2018 13:35:58 -0400 Subject: [PATCH 4/4] Updates to change log --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d29f396..c254ddd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,15 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [Unreleased] +## [0.3.1] - 2018-10-5 +### Changes +- eutils.jl to use the correct http parameter when passing the body to POST +- tests/eutils.jl to perform efetch with large number of PMID which breaks if incorrect http format is used +### Removed +- *.toml files to wait until versioning is ready for new Pkg + +## [0.3.0] - 2018-09-21 +### Changed - Updated HUMANS.md. - Added compatibility with Julia 1.0