From 4efdebf1d25b0734627237e44fa2ef7463c2ae67 Mon Sep 17 00:00:00 2001 From: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com> Date: Sun, 10 Nov 2024 21:11:27 -0500 Subject: [PATCH] style: fix two lines with too long lines Signed-off-by: Ali Sajid Imami <395482+AliSajid@users.noreply.github.com> --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/getConcordants.R | 7 ++++-- R/getSignature.R | 7 ++++-- R/utilities.R | 8 +++++++ codemeta.json | 41 ++++++------------------------------ man/dot-return_user_agent.Rd | 15 +++++++++++++ 7 files changed, 42 insertions(+), 39 deletions(-) create mode 100644 man/dot-return_user_agent.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 6a7f6c4..7b68fc4 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: drugfindR Title: Investigate iLINCS for candidate repurposable drugs -Version: 0.99.1016 +Version: 0.99.1017 Authors@R: c( person(given = c("Ali", "Sajid"), family = "Imami", diff --git a/NAMESPACE b/NAMESPACE index ebb7e55..0350012 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -45,3 +45,4 @@ importFrom(stringr,str_glue) importFrom(stringr,str_to_lower) importFrom(tibble,as_tibble) importFrom(tibble,tibble) +importFrom(utils,packageVersion) diff --git a/R/getConcordants.R b/R/getConcordants.R index f1021f1..134a687 100644 --- a/R/getConcordants.R +++ b/R/getConcordants.R @@ -16,13 +16,16 @@ #' @export #' #' @importFrom readr write_tsv -#' @importFrom httr2 request req_method req_url_query req_user_agent req_url_path_append req_perform resp_status resp_body_json resp_body_string +#' @importFrom httr2 request req_method req_url_query req_user_agent +#' @importFrom httr2 req_url_path_append req_perform resp_status +#' @importFrom httr2 resp_body_json resp_body_string #' @importFrom purrr map flatten_dfr #' @importFrom dplyr select any_of mutate filter #' @importFrom tibble tibble #' @importFrom rlang .data #' @importFrom stringr str_glue #' @importFrom curl form_file +#' @importFrom utils packageVersion #' #' @examples #' # Get the L1000 signature for LINCSKD_28 @@ -64,7 +67,7 @@ getConcordants <- function(signature, ilincsLibrary = "CP") { httr2::req_url_query(lib = libMap[ilincsLibrary]) |> httr2::req_body_multipart(file = curl::form_file(signatureFile)) |> httr2::req_method("POST") |> - httr2::req_user_agent(stringr::str_glue("drugfindR/v{packageVersion('drugfindR')}; https://github.com/CogDisResLab/drugfindR")) |> + httr2::req_user_agent(.return_user_agent()) |> httr2::req_perform() if (httr2::resp_status(request) == 200L) { diff --git a/R/getSignature.R b/R/getSignature.R index 459fd48..c64d2c2 100644 --- a/R/getSignature.R +++ b/R/getSignature.R @@ -16,12 +16,15 @@ #' @return a tibble with the L1000 Signature #' @export #' -#' @importFrom httr2 request req_method req_url_query req_user_agent req_url_path_append req_perform resp_status resp_body_json resp_body_string +#' @importFrom httr2 request req_method req_url_query req_user_agent +#' @importFrom httr2 req_url_path_append req_perform resp_status +#' @importFrom httr2 resp_body_json resp_body_string #' @importFrom tibble tibble as_tibble #' @importFrom rlang .data #' @importFrom dplyr select #' @importFrom purrr map_dfr #' @importFrom S4Vectors DataFrame +#' @importFrom utils packageVersion #' #' @examples #' # Get the L1000 signature for LINCSKD_28 @@ -38,7 +41,7 @@ getSignature <- function(sigId, l1000 = TRUE) { httr2::req_url_path_append("downloadSignature") |> httr2::req_url_query(sigID = sigId, noOfTopGenes = numGenes) |> httr2::req_method("POST") |> - httr2::req_user_agent("drugfindR/v0.99.980; https://github.com/CogDisResLab/drugfindR") |> + httr2::req_user_agent(.return_user_agent()) |> httr2::req_perform() diff --git a/R/utilities.R b/R/utilities.R index 8a38e77..120e341 100644 --- a/R/utilities.R +++ b/R/utilities.R @@ -100,3 +100,11 @@ loadMetadata <- function(lib) { libMap[lib] } + +#' Return a string suitable as a User-Agent for the iLINCS API +#' +#' @keywords internal +#' @return a string +.return_user_agent <- function() { + paste0("drugfindR/", utils::packageVersion("drugfindR"), "; https://github.com/CogDisResLab/drugfindR") +} diff --git a/codemeta.json b/codemeta.json index cc2bb36..3992f75 100644 --- a/codemeta.json +++ b/codemeta.json @@ -7,7 +7,7 @@ "codeRepository": "https://github.com/CogDisResLab/drugfindR", "issueTracker": "https://github.com/CogDisResLab/drugfindR/issues", "license": "https://spdx.org/licenses/GPL-3.0", - "version": "0.99.1016", + "version": "0.99.1017", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -17,10 +17,7 @@ "author": [ { "@type": "Person", - "givenName": [ - "Ali", - "Sajid" - ], + "givenName": ["Ali", "Sajid"], "familyName": "Imami", "email": "Ali.Sajid.Imami@gmail.com", "@id": "https://orcid.org/0000-0003-3684-3539" @@ -34,10 +31,7 @@ }, { "@type": "Person", - "givenName": [ - "Justin", - "Fortune" - ], + "givenName": ["Justin", "Fortune"], "familyName": "Creeden", "email": "Justin.Creeden@rockets.utoledo.edu", "@id": "https://orcid.org/0000-0003-3123-8401" @@ -46,10 +40,7 @@ "maintainer": [ { "@type": "Person", - "givenName": [ - "Ali", - "Sajid" - ], + "givenName": ["Ali", "Sajid"], "familyName": "Imami", "email": "Ali.Sajid.Imami@gmail.com", "@id": "https://orcid.org/0000-0003-3684-3539" @@ -351,27 +342,9 @@ }, "applicationCategory": "Genomics", "isPartOf": "https://bioconductor.org", - "keywords": [ - "LINCS", - "iLINCS", - "drugrepurposing", - "drugdiscovery", - "transcriptomics", - "geneexpression", - "geneknockdown", - "geneoverexpression", - "chemicalperturbagen", - "drugfindR", - "r", - "ilincs", - "bioinformatics", - "bioinformatics-pipeline" - ], - "fileSize": "2087.188KB", + "keywords": ["LINCS", "iLINCS", "drugrepurposing", "drugdiscovery", "transcriptomics", "geneexpression", "geneknockdown", "geneoverexpression", "chemicalperturbagen", "drugfindR", "r", "ilincs", "bioinformatics", "bioinformatics-pipeline"], + "fileSize": "2087.859KB", "readme": "https://github.com/CogDisResLab/drugfindR/blob/devel/README.md", - "contIntegration": [ - "https://github.com/CogDisResLab/drugfindR/actions/workflows/rworkflows.yml", - "https://app.codecov.io/gh/CogDisResLab/drugfindR?branch=devel" - ], + "contIntegration": ["https://github.com/CogDisResLab/drugfindR/actions/workflows/rworkflows.yml", "https://app.codecov.io/gh/CogDisResLab/drugfindR?branch=devel"], "developmentStatus": "https://lifecycle.r-lib.org/articles/stages.html#experimental" } diff --git a/man/dot-return_user_agent.Rd b/man/dot-return_user_agent.Rd new file mode 100644 index 0000000..3288ada --- /dev/null +++ b/man/dot-return_user_agent.Rd @@ -0,0 +1,15 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utilities.R +\name{.return_user_agent} +\alias{.return_user_agent} +\title{Return a string suitable as a User-Agent for the iLINCS API} +\usage{ +.return_user_agent() +} +\value{ +a string +} +\description{ +Return a string suitable as a User-Agent for the iLINCS API +} +\keyword{internal}