Skip to content

Commit 046491a

Browse files
Fix r cmd check - I think...
1 parent 65287b4 commit 046491a

78 files changed

Lines changed: 920 additions & 169 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/R-CMD-check.yaml

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,37 @@
11
on:
22
push:
3-
branches: [main, master]
3+
branches: [main]
44
pull_request:
5-
release:
6-
types: [published]
7-
workflow_dispatch:
85

96
name: R CMD Check
107

118
permissions: read-all
129

1310
jobs:
14-
1511
check-package:
16-
1712
runs-on: ubuntu-latest
1813

19-
# Run checks with R-release, R-devel, and R-oldrelease.
20-
strategy:
21-
# Make sure each job runs independently. When `fail-fast` is true
22-
# (by default) all jobs in the matrix are cancelled as soon as one fails.
23-
fail-fast: false
24-
matrix:
25-
r-version: ['release', 'devel', 'oldrel']
26-
27-
# Override the default job name to display the current R version name in
28-
# parentheses (e.g. "check-package (R-release)").
29-
name: "check-package (R-${{ matrix.r-version }})"
30-
3114
steps:
32-
# Pull the latest changes from the repository down to the runner.
3315
- name: Checkout
3416
uses: actions/checkout@v4
3517

36-
# Install R and any system dependencies.
3718
- name: Setup R
3819
uses: r-lib/actions/setup-r@v2
3920
with:
40-
r-version: ${{ matrix.r-version }}
4121
use-public-rspm: true
42-
43-
44-
# Install R dependencies.
45-
- name: Install Dependencies
22+
23+
- name: Install system dependencies
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y libcurl4-openssl-dev libbz2-dev liblzma-dev zlib1g-dev libglpk-dev pandoc texlive-latex-recommended texlive-latex-extra
27+
28+
- name: Install R dependencies
4629
uses: r-lib/actions/setup-r-dependencies@v2
4730
with:
48-
extra-packages:
31+
extra-packages: |
4932
any::rcmdcheck
50-
any::pkgdown
51-
# Installed packages are cached by default - force an upgrade to the
52-
# latest version of all dependencies.
33+
cran::BiocManager
5334
upgrade: 'TRUE'
54-
55-
# Run CRAN checks - fails if any ERRORs or WARNINGs are raised in which
56-
# case the `rcmdcheck` output will be uploaded as an artifact.
57-
- name: Run Checks
58-
uses: r-lib/actions/check-r-package@v2
59-
env:
60-
_R_CHECK_PKG_SIZES_: true
61-
_R_CHECK_RD_XREFS_: true
62-
_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_: true
63-
_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_: true
35+
36+
- name: Run checks
37+
uses: r-lib/actions/check-r-package@v2

.github/workflows/pkgdown.yaml

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
21
on:
32
push:
4-
branches: [main, master]
3+
branches: [main]
54
pull_request:
6-
release:
7-
types: [published]
8-
workflow_dispatch:
95

10-
name: pkgdown.yaml
6+
name: pkgdown
117

12-
permissions: read-all
8+
permissions:
9+
contents: write
10+
pages: write
1311

1412
jobs:
1513
pkgdown:
1614
runs-on: ubuntu-latest
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
r-version: ['release', 'devel', 'oldrel']
21-
concurrency:
22-
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
2315
env:
2416
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
25-
permissions:
26-
contents: write
27-
17+
2818
steps:
2919
- uses: actions/checkout@v4
3020

@@ -33,17 +23,14 @@ jobs:
3323
- uses: r-lib/actions/setup-r@v2
3424
with:
3525
use-public-rspm: true
36-
37-
38-
- name: Install Dependencies
26+
27+
- name: Install dependencies
3928
uses: r-lib/actions/setup-r-dependencies@v2
4029
with:
41-
extra-packages:
42-
any::rcmdcheck
30+
extra-packages: |
4331
any::pkgdown
4432
upgrade: 'TRUE'
4533

46-
4734
- name: Build site
4835
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
4936
shell: Rscript {0}
@@ -54,4 +41,4 @@ jobs:
5441
with:
5542
clean: false
5643
branch: gh-pages
57-
folder: docs
44+
folder: docs

DESCRIPTION

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,17 +79,17 @@ Imports:
7979
ggnewscale,
8080
kohonen,
8181
Rcpp,
82-
RcppEigen,
83-
TreeDist
82+
TreeDist,
83+
NMF
8484
Suggests:
8585
knitr,
8686
RUnit,
8787
rmarkdown,
8888
testthat (>= 3.0.0),
89-
NMF,
9089
sf
9190
Encoding: UTF-8
9291
LazyData: true
92+
LazyDataCompression: bzip2
9393
RoxygenNote: 7.3.2
9494
VignetteBuilder: knitr
9595
URL: https://patrickcnmartin.github.io/Vesalius/, https://github.com/patrickCNMartin/Vesalius, https://wonlab-cs.github.io/Vesalius/

NAMESPACE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ importFrom(DESeq2,DESeqDataSetFromMatrix)
4343
importFrom(DESeq2,results)
4444
importFrom(Matrix,Matrix)
4545
importFrom(Matrix,rowMeans)
46+
importFrom(NMF,coefficients)
47+
importFrom(NMF,nmf)
4648
importFrom(RANN,nn2)
4749
importFrom(RColorBrewer,brewer.pal)
4850
importFrom(Rcpp,sourceCpp)
@@ -158,8 +160,11 @@ importFrom(patchwork,wrap_plots)
158160
importFrom(purrr,map)
159161
importFrom(purrr,map_dbl)
160162
importFrom(sp,point.in.polygon)
163+
importFrom(stats,IQR)
164+
importFrom(stats,as.dist)
161165
importFrom(stats,as.formula)
162166
importFrom(stats,chisq.test)
167+
importFrom(stats,cor)
163168
importFrom(stats,cutree)
164169
importFrom(stats,ecdf)
165170
importFrom(stats,fisher.test)
@@ -171,7 +176,11 @@ importFrom(stats,model.matrix)
171176
importFrom(stats,na.exclude)
172177
importFrom(stats,p.adjust)
173178
importFrom(stats,quantile)
179+
importFrom(stats,runif)
180+
importFrom(stats,sd)
181+
importFrom(stats,setNames)
174182
importFrom(stats,t.test)
183+
importFrom(stats,var)
175184
importFrom(stats,wilcox.test)
176185
importFrom(tools,toTitleCase)
177186
importFrom(tvR,denoise2)

R/dispatch.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ dispatch_sample <- function(territory_barcodes, ter, sample) {
146146

147147
#' dispatch barcodes to subset cost for match clustering
148148
#' @param vesalius_assay vesalius_assay object post cell mapping
149-
#' @param cell_label character - name of column containing cell names
150-
#' if the clustering is to be done by cell types only
149+
#' @param cost cost matrix
150+
#' @param trial character - trial name
151151
#' @param group_identity character - name of column containing group
152152
#' to be used for cluster (i.e. territories, segments, layers etc)
153+
#' @param ref_cells character vector - reference cell barcodes
154+
#' @param query_cells character vector - query cell barcodes
153155
#' @return character string of barcodes
154156
dispatch_cost_groups <- function(vesalius_assay,
155157
cost,

R/embeddings.R

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ embed_latent_space <- function(counts,
270270
#' @return normalised PCA embedding matrix
271271
#' @importFrom Seurat RunPCA
272272
#' @importFrom Seurat Embeddings
273+
#' @importFrom stats setNames
273274
embed_pca <- function(counts,
274275
dimensions,
275276
features = NULL,
@@ -503,27 +504,30 @@ embed_lsi_umap <- function(counts,
503504
#' @param counts Seurat object containing normalised counts
504505
#' @param dimensions number dimension to retain from NMF
505506
#' @param verbose logical if progress messages should be outputed
507+
#' @importFrom NMF nmf coefficients
506508
#' @return normalised NMF embedding matrix
507509
embed_nmf <- function(counts, dimensions, verbose = TRUE) {
508-
#--------------------------------------------------------------------------#
509-
# adding this since I don't want to have this package as a dependancy
510-
# The problem is that those functions are exported to name space
511-
# but NMF only works if the package is attached.
512-
#--------------------------------------------------------------------------#
513-
inst <- requireNamespace("NMF", quietly = TRUE)
514-
if (!inst) {
515-
stop("NMF is not installed - Please install NMF
516-
install.packages('NMF')
517-
https://cran.r-project.org/web/packages/NMF/index.html")
518-
} else {
519-
library("NMF")
520-
}
510+
# #--------------------------------------------------------------------------#
511+
# # adding this since I don't want to have this package as a dependancy
512+
# # The problem is that those functions are exported to name space
513+
# # but NMF only works if the package is attached.
514+
# #--------------------------------------------------------------------------#
515+
# inst <- requireNamespace("NMF", quietly = TRUE)
516+
# if (!inst) {
517+
# stop("NMF is not installed - Please install NMF
518+
# install.packages('NMF')
519+
# https://cran.r-project.org/web/packages/NMF/index.html")
520+
521+
# } else {
522+
# library("NMF")
523+
# }
524+
521525

522526
#--------------------------------------------------------------------------#
523527
# Get the normalized count matrix and matrix with variable features
524528
# from the Seurat object
525529
#--------------------------------------------------------------------------#
526-
vesalius:::message_switch("nmf_tensor", verbose)
530+
message_switch("nmf_tensor", verbose)
527531
features <- check_features(counts)
528532
count_matrix <- as.matrix(Seurat::GetAssayData(counts, layer = "data"))
529533
count_matrix <- count_matrix[features, ]
@@ -539,7 +543,7 @@ embed_nmf <- function(counts, dimensions, verbose = TRUE) {
539543
# Get the NMF projections (W matrix) and normalize
540544
#--------------------------------------------------------------------------#
541545
nmf_projections <- t(NMF::coefficients(nmf_result))
542-
nmf_projections <- apply(nmf_projections, 2, vesalius:::norm_pixel, "minmax")
546+
nmf_projections <- apply(nmf_projections, 2, norm_pixel, "minmax")
543547
nmf_projections <- list(as.matrix(nmf_projections))
544548
names(nmf_projections) <- "NMF"
545549

R/equalize_image.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#' @param dimensions numeric vector of latent space dimensions to use.
66
#' @param embedding character string describing which embedding should
77
#' be used.
8-
#' @param type character - histogram EQ type. Select from: BalanceSimplest,
8+
#' @param method character - histogram EQ type. Select from: BalanceSimplest,
99
#' EqualizePiecewise, SPE, EqualizeDP, EqualizeADP, ECDF (see details)
1010
#' @param N numeric describing how each colour channel will be mapped back to
1111
#' the image (Higher N = Higher greyscale contrast).

R/global_bindings.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ utils::globalVariables(c(".", "barcodes", "cc",
77
"cc.y", "cluster", "p.value", "seurat_clusters",
88
"territories", "territorries", "territory",
99
"tile", "tmpImg", "value", "x", "y", "img", "p_value_adj",
10-
"ind1", "ind2", "origin", "trial", "vesalius"))
10+
"ind1", "ind2", "origin", "trial", "vesalius",
11+
"c.1", "c.2", "c.3", "rgb_val","seed","query"))

R/integration.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
#' should be merged with the reference data (see details)
2525
#' @param labels_reference character - which columns in the reference data assay
2626
#' should be merged with the mapped data (see details)
27-
#' @param regenerate_tiles logical - should tiles be regenrated from integrated
27+
#' @param regenerate_tiles logical - should tiles be regenrated from integrated
2828
#' coordinates
29+
#' @param tensor_resolution numeric - tensor resolution for tile generation
30+
#' @param filter_grid numeric - filter grid parameter
31+
#' @param filter_threshold numeric - filter threshold parameter
2932
#' @param verbose logical - should progressed message be printed
3033
#' @details After mapping coordinates from a query onto a reference, vesalius
3134
#' provides a way to then integrate the assays together. This function will:
@@ -311,6 +314,7 @@ merge_coordinates <- function(matched, reference, barcodes) {
311314
#' to cell present in the other data set (similar to left and right joins).
312315
#' @return territory data frame with merged columns
313316
#' @importFrom dplyr right_join
317+
#' @importFrom stats runif
314318
merge_territories <- function(matched,
315319
reference,
316320
coordinates,

R/isolate_territories.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ distance_pooling <- function(img, capture_radius, min_spatial_index) {
295295
#' @importFrom imager imsplit threshold split_connected where
296296
#' @importFrom imagerExtra ThresholdML
297297
#' @importFrom dplyr inner_join
298+
#' @importFrom stats cor
298299
select_similar <- function(img,
299300
coordinates,
300301
threshold = 1) {

0 commit comments

Comments
 (0)