Skip to content

Commit

Permalink
Merge pull request #139 from omnideconv/maria2
Browse files Browse the repository at this point in the history
changed the if order-colorpalettes
  • Loading branch information
czackl committed Mar 25, 2024
2 parents 3ce65bb + 1aee0c5 commit c9bd2ef
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ jobs:
- name: Install pak
run: Rscript -e "install.packages('pak', repos='https://cran.rstudio.com/')"

- name: Install Devtools
run: Rscript -e "pak::pkg_install('devtools')"

- name: Install SpatialExperiment
run: Rscript -e "pak::pkg_install('drighelli/SpatialExperiment')"
run: Rscript -e "devtools::install_github('drighelli/SpatialExperiment')"

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/roxygenize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,14 @@ jobs:
- name: Install pak
run: Rscript -e "install.packages('pak', repos='https://cran.rstudio.com/')"

#- name: Install SpatialExperiment
# run: Rscript -e "pak::pkg_install('drighelli/SpatialExperiment')"

- name: Install Devtools
run: Rscript -e "pak::pkg_install('devtools')"

- name: Install SpatialExperiment
run: Rscript -e "pak::pkg_install('drighelli/SpatialExperiment')"
run: Rscript -e "devtools::install_github('drighelli/SpatialExperiment')"

- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,14 @@ jobs:
- name: Install pak
run: Rscript -e "install.packages('pak', repos='https://cran.rstudio.com/')"

# - name: Install SpatialExperiment
# run: Rscript -e "pak::pkg_install('drighelli/SpatialExperiment')"

- name: Install Devtools
run: Rscript -e "pak::pkg_install('devtools')"

- name: Install SpatialExperiment
run: Rscript -e "pak::pkg_install('drighelli/SpatialExperiment')"
run: Rscript -e "devtools::install_github('drighelli/SpatialExperiment')"

- name: Install Immunedeconv
run: Rscript -e "pak::pkg_install('omnideconv/immunedeconv')"
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ jobs:
#- name: Giotto
# run: Rscript -e "pak::pkg_install('drieslab/Giotto@master')"

- name: Install Devtools
run: Rscript -e "pak::pkg_install('devtools')"

- name: Install SpatialExperiment
run: Rscript -e "devtools::install_github('drighelli/SpatialExperiment')"

- name: Install Test Dependencies
run: Rscript -e "pak::pkg_install(c('drighelli/SpatialExperiment', 'testthat', 'omnideconv/immunedeconv', 'omnideconv/omnideconv', 'satijalab/seurat'))"
run: Rscript -e "pak::pkg_install(c('testthat', 'omnideconv/immunedeconv', 'omnideconv/omnideconv', 'satijalab/seurat'))" # drighelli/SpatialExperiment'

- uses: r-lib/actions/setup-r-dependencies@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spacedeconv
Title: Unified Interface to spatial transcriptomics deconvolution tools
Version: 0.1.0
Version: 0.1.1
Authors@R:
person(given="Constantin", family="Zackl", email="constantin.zackl@student.uibk.ac.at", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-1991-6943"))
Description: Collection of 31 deconvolution tools for spatial transcriptomics data.
Expand Down
9 changes: 4 additions & 5 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ plot_most_abundant <- function(spe, method = NULL, cell_type = NULL, remove = NU
num_colors_needed <- length(all_cell_types) - 1 # Number of celltypes

# Determine the palette type and generate colors
if (is.character(palette) && palette %in% rownames(RColorBrewer::brewer.pal.info)) {
if (is.vector(palette) && length(palette) > 1 && all(sapply(palette, is.character))) { # the manual comes first
# Custom color vector
color_vector <- palette
} else if (is.character(palette) && palette %in% rownames(RColorBrewer::brewer.pal.info)) {
# RColorBrewer palette
brewer_palette <- RColorBrewer::brewer.pal(RColorBrewer::brewer.pal.info[palette, "maxcolors"], palette)
color_vector <- colorRampPalette(brewer_palette)(num_colors_needed)
Expand All @@ -315,9 +318,6 @@ plot_most_abundant <- function(spe, method = NULL, cell_type = NULL, remove = NU
} else {
stop("Invalid palette type.")
}
} else if (is.vector(palette) && all(sapply(palette, is.character))) {
# Custom color vector
color_vector <- palette
} else {
stop("Invalid palette input.")
}
Expand All @@ -326,7 +326,6 @@ plot_most_abundant <- function(spe, method = NULL, cell_type = NULL, remove = NU
custom_colors <- c(color_vector, "#D3D3D3")
names(custom_colors) <- all_cell_types


return(make_baseplot(
spe = spe, df = df2, to_plot = "mostAbundant", palette = custom_colors,
sample_id = sample_id, image_id = image_id, background = background, zoom = zoom,
Expand Down

0 comments on commit c9bd2ef

Please sign in to comment.