Skip to content

Commit

Permalink
Merge pull request #177 from Moore-Institute-4-Plastic-Pollution-Res/…
Browse files Browse the repository at this point in the history
…main

add fixes to webr
  • Loading branch information
wincowgerDEV committed Sep 13, 2024
2 parents 9496c4e + 702a3f7 commit 3fa749f
Show file tree
Hide file tree
Showing 32 changed files with 25 additions and 707 deletions.
59 changes: 0 additions & 59 deletions .github/workflows/R-CMD-check.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
# Only build on main or master branch
branches: [main, master]
# Or when triggered manually
workflow_dispatch: {}
workflow_dispatch:

name: Build and deploy wasm R package repository

Expand Down
48 changes: 0 additions & 48 deletions .github/workflows/pkgdown.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/release-file-system-image.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/test-coverage.yaml

This file was deleted.

7 changes: 1 addition & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Package: OpenSpecy
Package: OpenSpecyWebr
Type: Package
Title: Analyze, Process, Identify, and Share Raman and (FT)IR Spectra
Version: 1.1.0
Expand Down Expand Up @@ -80,7 +80,6 @@ Imports:
data.table,
jsonlite,
yaml,
osfr,
caTools,
hyperSpec,
mmand,
Expand All @@ -94,15 +93,11 @@ Suggests:
knitr,
rmarkdown,
testthat (>= 3.1.9),
aws.s3,
loggit,
config,
shinyjs,
shinyWidgets,
bs4Dash,
dplyr,
DT,
mongolite,
ggplot2
RoxygenNote: 7.3.1
Roxygen: list(markdown = TRUE)
Expand Down
10 changes: 0 additions & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ S3method(restrict_range,OpenSpecy)
S3method(restrict_range,default)
S3method(sample_spec,OpenSpecy)
S3method(sample_spec,default)
S3method(share_spec,OpenSpecy)
S3method(share_spec,default)
S3method(sig_noise,OpenSpecy)
S3method(sig_noise,default)
S3method(smooth_intens,OpenSpecy)
Expand Down Expand Up @@ -95,7 +93,6 @@ export(fill_spec)
export(filter_spec)
export(flatten_range)
export(gen_grid)
export(get_lib)
export(get_metadata)
export(heatmap_spec)
export(human_ts)
Expand Down Expand Up @@ -130,7 +127,6 @@ export(restrict_range)
export(rm_lib)
export(run_app)
export(sample_spec)
export(share_spec)
export(sig_noise)
export(smooth_intens)
export(spec_res)
Expand Down Expand Up @@ -172,9 +168,6 @@ importFrom(mmand,closing)
importFrom(mmand,components)
importFrom(mmand,gaussianSmooth)
importFrom(mmand,shapeKernel)
importFrom(osfr,osf_download)
importFrom(osfr,osf_ls_files)
importFrom(osfr,osf_retrieve_node)
importFrom(plotly,add_markers)
importFrom(plotly,add_trace)
importFrom(plotly,layout)
Expand Down Expand Up @@ -202,10 +195,7 @@ importFrom(utils,head)
importFrom(utils,installed.packages)
importFrom(utils,modifyList)
importFrom(utils,packageVersion)
importFrom(utils,read.csv)
importFrom(utils,read.table)
importFrom(utils,sessionInfo)
importFrom(utils,unzip)
importFrom(utils,write.csv)
importFrom(yaml,read_yaml)
importFrom(yaml,write_yaml)
1 change: 1 addition & 0 deletions R/as_OpenSpecy.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
#' \code{\link{read_spec}()} for reading \code{OpenSpecy} objects.
#'
#' @importFrom data.table as.data.table
#' @importFrom digest digest
#' @export
as_OpenSpecy <- function(x, ...) {
UseMethod("as_OpenSpecy")
Expand Down
6 changes: 1 addition & 5 deletions R/io_spec.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#'
#' @param x an object of class \code{\link{OpenSpecy}}.
#' @param file file path to be read from or written to.
#' @param share defaults to \code{NULL}; needed to share spectra with the
#' Open Specy community; see \code{\link{share_spec}()} for details.
#' @param method optional; function to be used as a custom reader or writer.
#' Defaults to the appropriate function based on the file extension.
#' @param digits number of significant digits to use when formatting numeric
Expand Down Expand Up @@ -110,7 +108,7 @@ write_spec.OpenSpecy <- function(x, file, method = NULL,
#' @rdname io_spec
#'
#' @export
read_spec <- function(file, share = NULL, method = NULL, ...) {
read_spec <- function(file, method = NULL, ...) {
if (is.null(method)) {
if (grepl("(\\.yaml$)|(\\.yml$)", file, ignore.case = T)) {
yml <- read_yaml(file = file, ...)
Expand Down Expand Up @@ -147,8 +145,6 @@ read_spec <- function(file, share = NULL, method = NULL, ...) {
os$metadata$file_name <- basename(file)
}

if (!is.null(share)) share_spec(os, file = file, share = share)

return(os)
}

Expand Down
26 changes: 0 additions & 26 deletions R/manage_lib.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,32 +180,6 @@ check_lib <- function(type = c("derivative", "nobaseline", "raw", "mediod",
invisible()
}

#' @rdname manage_lib
#'
#' @importFrom utils read.csv
#' @importFrom osfr osf_retrieve_node osf_ls_files osf_download
#'
#' @export
get_lib <- function(type = c("derivative", "nobaseline", "raw", "mediod",
"model"),
path = "system", node = "x7dpz", conflicts = "overwrite",
...) {
lp <- ifelse(path == "system",
system.file("extdata", package = "OpenSpecy"),
path)

osf <- osf_retrieve_node(node) |>
osf_ls_files(pattern = ".rds", n_max = Inf)

message("Fetching Open Specy reference libraries from OSF ...")
osf |> subset(grepl(
paste0("(", paste(type, collapse = "|"), ").rds"),
osf$name)) |>
osf_download(path = lp, conflicts = conflicts, progress = TRUE, ...)

message("Use 'load_lib()' to load the library")
}

#' @rdname manage_lib
#'
#' @export
Expand Down
6 changes: 1 addition & 5 deletions R/read_envi.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#' standard deviations for the \code{gaussianSmooth} function from the
#' \code{mmand} package to describe how spectral smoothing occurs on each dimension.
#' The first two dimensions are x and y, the third is the wavenumbers.
#' @param share defaults to \code{NULL}; needed to share spectra with the
#' Open Specy community; see \code{\link{share_spec}()} for details.
#' @param metadata a named list of the metadata; see
#' \code{\link{as_OpenSpecy}()} for details.
#' @param \ldots further arguments passed to the submethods.
Expand Down Expand Up @@ -45,7 +43,7 @@
#' @importFrom caTools read.ENVI
#' @importFrom mmand gaussianSmooth
#' @export
read_envi <- function(file, header = NULL, spectral_smooth = F, sigma = c(1,1,1), share = NULL,
read_envi <- function(file, header = NULL, spectral_smooth = F, sigma = c(1,1,1),
metadata = list(
file_name = basename(file),
user_name = NULL,
Expand Down Expand Up @@ -118,8 +116,6 @@ read_envi <- function(file, header = NULL, spectral_smooth = F, sigma = c(1,1,1)
coords = dt[, 1:2] |> unique(),
session_id = T)

if (!is.null(share)) share_spec(os, file = file, share = share)

return(os)
}

Expand Down
Loading

0 comments on commit 3fa749f

Please sign in to comment.