Skip to content

Commit

Permalink
Merge pull request #23 from jasenfinch/devel
Browse files Browse the repository at this point in the history
v1.0.9
  • Loading branch information
jasenfinch committed Nov 17, 2022
2 parents a1014b6 + 752b2f4 commit 7db4776
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 97 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master,devel]
branches: [main, master, devel]
pull_request:
branches: [main, master]

Expand All @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
Expand All @@ -29,30 +29,33 @@ jobs:
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: rcmdcheck

- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt install mono-xbuild
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- name: Setup R dependencies
- name: Set up R dependencies
run: |
rawrr::installRawFileReaderDLLs()
rawrr::buildRawrrExe()
msconverteR::get_pwiz_container()
shell: Rscript {0}

- uses: r-lib/actions/check-r-package@v1
- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: grover
Title: Web API Framework for Mass Spectrometry Data Transfer
Version: 1.0.8
Version: 1.0.9
Authors@R:
person(given = "Jasen",
family = "Finch",
Expand All @@ -12,6 +12,7 @@ URL: https://jasenfinch.github.io/grover/
BugReports: https://github.com/jasenfinch/grover/issues
License: GPL-3
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
Imports: callr,
cli,
crayon,
Expand Down Expand Up @@ -42,4 +43,4 @@ Suggests:
Remotes: wilsontom/msconverteR,
bioc::rawrr
VignetteBuilder: knitr
RoxygenNote: 7.1.2
RoxygenNote: 7.2.2
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ importFrom(plumber,pr_run)
importFrom(plumber,serializer_content_type)
importFrom(progress,progress_bar)
importFrom(purrr,map)
importFrom(purrr,map_chr)
importFrom(purrr,walk)
importFrom(rawrr,readFileHeader)
importFrom(rawrr,readIndex)
Expand Down
16 changes: 15 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
# grover 1.0.9

* The [`grover::groverAPI`](https://jasenfinch.github.io/grover/reference/groverAPI.html) `log_dir` and `temp_dir` argument directories are now created if they do not already exist.

* The [`grover::groverAPI`](https://jasenfinch.github.io/grover/reference/groverAPI.html) `temp_dir` argument default is now `tempdir()`.

* [`grover::extant`](https://jasenfinch.github.io/grover/reference/extant.html) now returns `TRUE` if the specified API is accessible and `FALSE` if not.

* The argument `overwrite` has now been added to [`grover::convertFile`](https://jasenfinch.github.io/grover/reference/convert.html) and [`grover::convertDirectory`](https://jasenfinch.github.io/grover/reference/convert.html) to enable the overwriting of local mzML files with the same file name as the raw files to be converted.

* Removed the `build_vignettes` argument from the installation instructions in the package README as the package documetation is available online from https://jasenfinch.github.io/grover.

* Removed the Introduction vignette as the majority of this information was duplicated in the package README.

# grover 1.0.8

* Added Bioconductor package [`rawrr](https://bioconductor.org/packages/release/bioc/html/rawrr.html) as a `bioc` remote to ensure the package can be installed correctly using [`pak`](https://pak.r-lib.org/) and [`renv`](https://rstudio.github.io/renv/articles/renv.html).
Expand Down Expand Up @@ -50,4 +64,4 @@

* Fixed conversion argument helpers to work correctly with `msconverteR`.

* Converted files now returned correctly by the API.
* Converted files now returned correctly by the API.
6 changes: 4 additions & 2 deletions R/allGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ setGeneric('convertFile',function(grover_client,
file,
args = '',
outDir = '.',
zip = TRUE){
zip = TRUE,
overwrite = FALSE){
standardGeneric('convertFile')
})

Expand All @@ -99,7 +100,8 @@ setGeneric('convertDirectory',function(grover_client,
directory,
args = '',
outDir = '.',
zip = TRUE){
zip = TRUE,
overwrite = FALSE){
standardGeneric('convertDirectory')
})

Expand Down
14 changes: 11 additions & 3 deletions R/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,18 @@
groverAPI <- function(grover_host,
background = FALSE,
log_dir = '~/.grover/logs',
temp_dir = '~/.grover/temp'){
temp_dir = tempdir()){

log_dir <- normalizePath(log_dir)
temp_dir <- normalizePath(temp_dir)
log_dir <- path.expand(log_dir)
temp_dir <- path.expand(temp_dir)

if (!dir.exists(log_dir)){
dir.create(log_dir)
}

if (!dir.exists(temp_dir)){
dir.create(temp_dir)
}

if (isFALSE(background)) {
API(host(grover_host),
Expand Down
14 changes: 9 additions & 5 deletions R/client-check.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@

#' Check the existance of a grover API
#' @rdname extant
#' @description Check grover API is still extistant.
#' @param grover_client S4 object of class GroverGlient
#' @return `TRUE` if the API host is accessible and `FALSE` if not.
#' @importFrom httr GET content
#' @export

Expand All @@ -16,12 +18,14 @@ setMethod('extant',signature = 'GroverClient',
GET() %>%
content() %>%
unlist()},silent = TRUE)

if (answer != "I'm still here!") {
answer <- 'grover is MIA!'
}

return(answer)
status <- ifelse(
answer == "I'm still here!",
TRUE,
FALSE
)

return(status)
}
)

Expand Down
45 changes: 33 additions & 12 deletions R/client-conversion.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#' @param args arguments to pass to msconverteR::convert_files
#' @param outDir output directory path for converted files
#' @param zip zip converted file
#' @param overwrite overwrite local mzML files that already exist at the `outDir` path that have the same file name as the raw files to be converted
#' @return A vector of file paths to converted data files.
#' @importFrom tools file_path_sans_ext
#' @importFrom stringr str_split
Expand All @@ -26,7 +27,8 @@ setMethod('convertFile',signature = 'GroverClient',
file,
args = NULL,
outDir = '.',
zip = TRUE){
zip = TRUE,
overwrite = FALSE){

converted_file <- file %>%
file_path_sans_ext() %>%
Expand Down Expand Up @@ -78,7 +80,8 @@ setMethod('convertFile',signature = 'GroverClient',
zipped_file_path <- str_c(outDir,'/',fileName,'.mzML.gz')

gzip(converted_file_path,
zipped_file_path)
zipped_file_path,
overwrite = overwrite)

converted_file_path <- zipped_file_path
}
Expand Down Expand Up @@ -113,6 +116,7 @@ setMethod('convertFile',signature = 'GroverClient',
})

#' @rdname convert
#' @importFrom purrr map_chr
#' @export

setMethod('convertDirectory',signature = 'GroverClient',
Expand All @@ -121,25 +125,41 @@ setMethod('convertDirectory',signature = 'GroverClient',
directory,
args = '',
outDir = '.',
zip = TRUE){
zip = TRUE,
overwrite = FALSE){

outDir <- str_c(outDir,directory,sep = '/')

files <- listRawFiles(grover_client,instrument,directory)
if (!dir.exists(outDir)) {
dir_create(outDir)
}

local_files <- list.files(
outDir,
pattern = '.mzML'
)

raw_files <- listRawFiles(grover_client,instrument,directory)

if (isFALSE(overwrite)){
files <- raw_files[!(file_path_sans_ext(raw_files) %in%
file_path_sans_ext(local_files,compression = zip))]
} else {
files <- raw_files
}

message('\nConverting ',
bold(blue(directory)),
' containing ',
bold(yellow(length(files))),
' .raw files\n')

outDir <- str_c(outDir,directory,sep = '/')
dir_create(outDir)
' .raw files from directory ',
bold(blue(directory)),
'\n')

pb <- progress_bar$new(
format = "[:bar] :percent eta: :eta",
total = length(files), clear = FALSE)
pb$tick(0)

results <- map(seq_len(length(files)),~{
results <- map_chr(seq_len(length(files)),~{
file <- files[.]
suppressMessages({
res <- convertFile(grover_client,
Expand All @@ -148,7 +168,8 @@ setMethod('convertDirectory',signature = 'GroverClient',
file,
args,
outDir,
zip)
zip,
overwrite)
})
pb$tick()
return(res)
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<!-- badges: start -->
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![R-CMD-check](https://github.com/jasenfinch/grover/workflows/R-CMD-check/badge.svg)](https://github.com/jasenfinch/grover/actions)
[![R-CMD-check](https://github.com/jasenfinch/grover/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jasenfinch/grover/actions/workflows/R-CMD-check.yaml)
[![Codecov test coverage](https://codecov.io/gh/jasenfinch/grover/branch/master/graph/badge.svg)](https://codecov.io/gh/jasenfinch/grover?branch=master)
[![license](https://img.shields.io/badge/license-GNU%20GPL%20v3.0-blue.svg)](https://github.com/jasenfinch/grover/blob/master/DESCRIPTION)
[![GitHub release](https://img.shields.io/github/release/jasenfinch/grover.svg)](https://GitHub.com/jasenfinch/grover/releases/)
Expand All @@ -26,15 +26,13 @@ The package functionality is platform independent with file conversion and sampl
The `grover` package can be installed from GitHub using the following:

```
remotes::install_github('jasenfinch/grover',build_vignettes = TRUE)
remotes::install_github('jasenfinch/grover')
```

### Learn more

The package documentation can be browsed online at <https://jasenfinch.github.io/grover/>.

If this is your first time using `grover` see the [Introduction to grover](https://jasenfinch.github.io/grover/articles/introduction.html) vignette for information on how to get started.

If you believe you've found a bug in `grover`, please file a bug (and, if
possible, a [reproducible example](https://reprex.tidyverse.org)) at
<https://github.com/jasenfinch/grover/issues>.
Expand Down
2 changes: 1 addition & 1 deletion man/conversionArgs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions man/convert.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/extant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/grover.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/groverAPI.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7db4776

Please sign in to comment.