Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrue committed Sep 5, 2024
0 parents commit 21ea664
Show file tree
Hide file tree
Showing 31 changed files with 1,801 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
^renv$
^renv\.lock$
^LICENSE\.md$
.github
Dockerfile
_pkgdown.yml
^.*\.Rproj$
^\.Rproj\.user$
130 changes: 130 additions & 0 deletions .github/workflows/basic_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
name: Check, build, and push image

on: [push, pull_request]

env:
cache-version: v1

jobs:
r-build-and-check:
runs-on: ubuntu-latest
container: bioconductor/bioconductor_docker:devel

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: TRUE
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
CRAN: https://packagemanager.posit.co/cran/__linux__/jammy/latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Query dependencies and update old packages
run: |
BiocManager::install(ask=FALSE)
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v4
with:
path: /usr/local/lib/R/site-library
key: ${{ env.cache-version }}-${{ runner.os }}-r-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-r-

- name: Install dependencies
run: |
BiocManager::repositories()
remotes::install_deps(dependencies = TRUE, repos = BiocManager::repositories())
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "warning", check_dir = "check")
shell: Rscript {0}

- name: Build pkgdown
run: |
PATH=$PATH:$HOME/bin/ Rscript -e 'pkgdown::build_site(".")'
# deploy needs rsync? Seems so.
- name: Install deploy dependencies
run: |
apt-get update
apt-get -y install rsync
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: docs # The folder the action should deploy.

docker-build-and-push:
#needs: r-build-and-check
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Set Environment Variables
run: |
REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
REGISTRY=ghcr.io
echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
echo "IMAGE=${REGISTRY}/${REPO_LOWER}" >> $GITHUB_ENV
- name: Show environment
run: |
env
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@v3

- name: Setup Docker buildx
uses: docker/setup-buildx-action@v3

# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE }}

# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: |
${{ env.IMAGE }}:latest
${{ env.IMAGE }}:${{ env.GIT_SHA }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
inst/doc
*~
.Rproj.user
*Rproj
renv/
renv.lock
.Rprofile
docs/
.DS_Store
60 changes: 60 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Package: iSEEtheTeam
Title: Package demo for EuroBioC2024
Version: 1.0.0
Authors@R:
c(person(given = "Kevin",
family = "Rue-Albrecht",
role = "aut",
email = "kevinrue67@gmail.com",
comment = c(ORCID = "0000-0003-3899-3872")),
person(given = "Federico",
family = "Marini",
role = c("aut", "cre"),
email = "marinif@uni-mainz.de",
comment = c(ORCID = "0000-0003-3252-7758")),
person(given = "Charlotte",
family = "Soneson",
role = "aut",
email = "charlottesoneson@gmail.com",
comment = c(ORCID = "0000-0003-3833-2169"))
)
Description: This package provides the environment and materials for the
package demo at the European Bioconductor Meeting 2024.
The environment includes the iSEE package and all its extensions
developed under the iSEE organisation.
The materials provide a brief overview of the core package functionality,
and a walkthrough of the development of an example extension package.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends:
Biobase
Imports:
iSEE,
iSEEde,
iSEEhex,
iSEEhub,
iSEEindex,
iSEEpathways,
iSEEu,
shiny,
shinyWidgets
Suggests:
airway,
BiocStyle,
DESeq2,
fgsea,
knitr,
org.Hs.eg.db,
pkgdown,
rmarkdown,
scRNAseq,
scater,
scuttle,
sessioninfo
URL: https://isee.github.io/iSEEDemoEuroBioC2024/
BugReports: https://github.com/iSEE/iSEEDemoEuroBioC2024/issues/new/choose
VignetteBuilder: knitr
DockerImage: ghcr.io/isee/iseedemoeurobioc2024:latest
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM bioconductor/bioconductor_docker:devel

WORKDIR /home/rstudio

COPY --chown=rstudio:rstudio . /home/rstudio/

RUN Rscript -e "options(repos = c(CRAN = 'https://cran.r-project.org')); BiocManager::install(ask=FALSE)"

RUN Rscript -e "options(repos = c(CRAN = 'https://cran.r-project.org')); devtools::install('.', dependencies=TRUE, build_vignettes=TRUE, repos = BiocManager::repositories())"
2 changes: 2 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
YEAR: 2020
COPYRIGHT HOLDER: Sean Davis
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# MIT License

Copyright (c) 2020 Sean Davis

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by roxygen2: do not edit by hand

export(AaronLun)
export(CharlotteSoneson)
export(FedericoMarini)
export(KevinRue)
exportClasses(AaronLun)
exportClasses(CharlotteSoneson)
exportClasses(FedericoMarini)
exportClasses(KevinRue)
exportMethods(.defineOutput)
exportMethods(.fullName)
exportMethods(.panelColor)
exportMethods(.refineParameters)
exportMethods(.renderOutput)
exportMethods(initialize)
import(iSEE)
import(methods)
importClassesFrom(iSEE,Panel)
importFrom(methods,callNextMethod)
importFrom(shiny,imageOutput)
importFrom(shiny,renderImage)
importFrom(shiny,tagList)
importFrom(shinyWidgets,addSpinner)
98 changes: 98 additions & 0 deletions R/AaronLun.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
.photoFile <- "PhotoFile"

collated <- character(0)
collated[.photoFile] <- "character"

#' @importClassesFrom iSEE Panel
#' @export
setClass("AaronLun", contains="Panel", slots=collated)

#' Aaron Lun
#'
#' @name AaronLun-class
#'
#' @aliases
#' initialize,AaronLun-method
#' .refineParameters,AaronLun-method
#' .panelColor,AaronLun-method
#' .fullName,AaronLun-method
#' .defineOutput,AaronLun-method
#' .renderOutput,AaronLun-method
NULL

#' Aaron Lun
#'
#' @export
#' @examples
#' library(SummarizedExperiment)
#' library(iSEE)
#'
#' se <- SummarizedExperiment()
#'
#' iSEE(se, initial = list(AaronLun()))
AaronLun <- function(...) {
new("AaronLun", ...)
}

#' @export
#' @importFrom methods callNextMethod
setMethod("initialize", "AaronLun", function(.Object, ...) {
args <- list(...)

args <- .emptyDefault(args, .photoFile, system.file(package = "iSEEtheTeam", "images", "aaron-lun.png"))

do.call(callNextMethod, c(list(.Object), args))
})

#' @export
#' @importFrom methods callNextMethod
setMethod(".refineParameters", "AaronLun", function(x, se) {
x <- callNextMethod()

if (is.null(x)) {
return(NULL)
}

x
})

#' @export
#' @importFrom methods callNextMethod
setMethod(".panelColor", "AaronLun", function(x) {
"#dc3545"
})

#' @export
setMethod(".fullName", "AaronLun", function(x) "Aaron Lun")

#' @importFrom shiny imageOutput
#' @importFrom shinyWidgets addSpinner
#' @export
setMethod(".defineOutput", "AaronLun", function(x) {
plot_name <- .getEncodedName(x)
addSpinner(
imageOutput(plot_name, height=paste0(slot(x, .organizationHeight), "px")),
color=.panelColor(x)
)
})

#' @export
#' @importFrom shiny renderImage tagList
setMethod(".renderOutput", "AaronLun", function(x, se, output, pObjects, rObjects) {
plot_name <- .getEncodedName(x)
force(se) # defensive programming to avoid difficult bugs due to delayed evaluation.

# width <- session$clientData[[paste0("output_", plot_name, "_width")]]
# height <- session$clientData[[paste0("output_", plot_name, "_height")]]

# nocov start
output[[plot_name]] <- renderImage({
list(src = x[[.photoFile]],
width = "100%",
# height = "100%",
alt = "Aaron Lun")
}, deleteFile = FALSE)
# nocov end

callNextMethod()
})
Loading

0 comments on commit 21ea664

Please sign in to comment.