From 3f22bd44dcd03212cf3cf4614356e25b1b4e510c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poisot?= Date: Fri, 27 Nov 2020 09:24:56 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20oneliners=20for=20taxonomic=20af?= =?UTF-8?q?filiation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/taxon.jl | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/src/taxon.jl b/src/taxon.jl index 3fd34f6..edd78be 100644 --- a/src/taxon.jl +++ b/src/taxon.jl @@ -38,34 +38,14 @@ function taxon(name::String; ] args = Dict{String, Any}("name" => name, "strict" => strict) - if !isnothing(rank) - args["rank"] = String(rank) - end - - if !isnothing(kingdom) - args["kingdom"] = String(kingdom) - end - - if !isnothing(phylum) - args["phylum"] = String(phylum) - end - - if !isnothing(class) - args["class"] = String(class) - end - - if !isnothing(order) - args["order"] = String(order) - end - - if !isnothing(family) - args["family"] = String(family) - end - - if !isnothing(genus) - args["genus"] = String(genus) - end - + isnothing(rank) || (args["rank"] = String(rank)) + isnothing(kingdom) || (args["kingdom"] = String(kingdom)) + isnothing(phylum) || (args["phylum"] = String(phylum)) + isnothing(class) || (args["class"] = String(class)) + isnothing(order) || (args["order"] = String(order)) + isnothing(family) || (args["family"] = String(family)) + isnothing(genus) || (args["genus"] = String(genus)) + sp_s_url = gbifurl * "species/match" sp_s_req = HTTP.get(sp_s_url, query=args) if sp_s_req.status == 200