Skip to content

Commit

Permalink
Merge pull request #946 from jashapiro/jashapiro/seurat-convert
Browse files Browse the repository at this point in the history
Initiate `seurat-conversion`
  • Loading branch information
jashapiro authored Dec 16, 2024
2 parents 02b9f82 + 3b38d92 commit 017db46
Show file tree
Hide file tree
Showing 17 changed files with 1,589 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/docker_seurat-conversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This is a workflow to build the docker image for the seurat-conversion module
#
# Docker modules are run on pull requests when code for files that affect the Docker image have changed.
# If other files are used during the Docker build, they should be added to `paths`
#
# At module initialization, this workflow is inactive, and needs to be activated manually

name: Build docker image for seurat-conversion

concurrency:
# only one run per branch at a time
group: "docker_seurat-conversion_${{ github.ref }}"
cancel-in-progress: true

on:
# pull_request:
# branches:
# - main
# paths:
# - "analyses/seurat-conversion/Dockerfile"
# - "analyses/seurat-conversion/.dockerignore"
# - "analyses/seurat-conversion/renv.lock"
# - "analyses/seurat-conversion/conda-lock.yml"
# push:
# branches:
# - main
# paths:
# - "analyses/seurat-conversion/Dockerfile"
# - "analyses/seurat-conversion/.dockerignore"
# - "analyses/seurat-conversion/renv.lock"
# - "analyses/seurat-conversion/conda-lock.yml"
workflow_dispatch:
inputs:
push-ecr:
description: "Push to AWS ECR"
type: boolean
required: true

jobs:
test-build:
name: Test Build Docker Image
if: github.event_name == 'pull_request' || (contains(github.event_name, 'workflow_') && !inputs.push-ecr)
runs-on: ubuntu-latest

steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build image
uses: docker/build-push-action@v5
with:
context: "{{defaultContext}}:analyses/seurat-conversion"
push: false
cache-from: type=gha
cache-to: type=gha,mode=max

build-push:
name: Build and Push Docker Image
if: github.repository_owner == 'AlexsLemonade' && (github.event_name == 'push' || inputs.push-ecr)
uses: ./.github/workflows/build-push-docker-module.yml
with:
module: "seurat-conversion"
push-ecr: true
62 changes: 62 additions & 0 deletions .github/workflows/run_seurat-conversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This is a workflow to run the seurat-conversion module
#
# Analysis modules are run based on three triggers:
# - Manual trigger
# - On pull requests where code in the module has changed
# - As a reusable workflow called from a separate workflow which periodically runs all modules
#
# At initialization, only the manual trigger is active

name: Run seurat-conversion analysis module
env:
MODULE_PATH: analyses/seurat-conversion
AWS_DEFAULT_REGION: us-east-2

concurrency:
# only one run per branch at a time
group: "run_seurat-conversion_${{ github.ref }}"
cancel-in-progress: true

on:
workflow_dispatch:
# workflow_call:
# pull_request:
# branches:
# - main
# paths:
# - analyses/seurat-conversion/**
# - "!analyses/seurat-conversion/Dockerfile"
# - "!analyses/seurat-conversion/.dockerignore"
# - .github/workflows/run_seurat-conversion.yml

jobs:
run-module:
if: github.repository_owner == 'AlexsLemonade'
runs-on: ubuntu-latest

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

- name: Set up R
uses: r-lib/actions/setup-r@v2
with:
r-version: 4.4.0
use-public-rspm: true

- name: Set up pandoc
uses: r-lib/actions/setup-pandoc@v2

- name: Set up renv
uses: r-lib/actions/setup-renv@v2
with:
working-directory: ${{ env.MODULE_PATH }}

# Update this step as needed to download the desired data
- name: Download test data
run: ./download-data.py --test-data --format SCE

- name: Run analysis module
run: |
cd ${MODULE_PATH}
# run module script(s) here
4 changes: 4 additions & 0 deletions analyses/seurat-conversion/.Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Don't activate renv in an OpenScPCA docker image
if (Sys.getenv('OPENSCPCA_DOCKER') != 'TRUE') {
source('renv/activate.R')
}
8 changes: 8 additions & 0 deletions analyses/seurat-conversion/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Ignore everything by default
*

# Include specific files in the docker environment
!/renv.lock
!/requirements.txt
!/environment.yml
!/conda-lock.yml
7 changes: 7 additions & 0 deletions analyses/seurat-conversion/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Results should not be committed
/results/*
!/results/README.md

# Ignore the scratch directory (but keep it present)
/scratch/*
!/scratch/.gitkeep
26 changes: 26 additions & 0 deletions analyses/seurat-conversion/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# A template docker file for creating a new analysis
# Docker image for the hello-R analysis
FROM bioconductor/r-ver:3.19

# Labels following the Open Containers Initiative (OCI) recommendations
# For more information, see https://specs.opencontainers.org/image-spec/annotations/?v=v1.0.1
LABEL org.opencontainers.image.authors="OpenScPCA [email protected]"
LABEL org.opencontainers.image.source="https://github.com/AlexsLemonade/OpenScPCA-analysis/tree/main/analyses/seurat-conversion"

# Set an environment variable to allow checking if we are in an OpenScPCA container
ENV OPENSCPCA_DOCKER=TRUE

# Install renv to enable later package installation
RUN Rscript -e "install.packages('renv')"

# Disable the renv cache to install packages directly into the R library
ENV RENV_CONFIG_CACHE_ENABLED=FALSE

# Copy the renv.lock file from the host environment to the image
COPY renv.lock renv.lock

# restore from renv.lock file and clean up to reduce image size
RUN Rscript -e 'renv::restore()' && \
rm -rf ~/.cache/R/renv && \
rm -rf /tmp/downloaded_packages && \
rm -rf /tmp/Rtmp*
33 changes: 33 additions & 0 deletions analyses/seurat-conversion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Seurat conversion

This analysis module is used to convert the SingleCellExperiment objects from the ScPCA Portal to Seurat objects.

## Description

Please provide a description of your module, including:

- What type of analysis is included?
- What methods or tools are used?

If there are multiple steps in the module, please include an outline of the analysis steps and scripts used.

## Usage

TBD

## Input files

Input modules will be a SingleCellExperiment objects (as `.rds` files) from the ScPCA Portal.


## Output files

Seurat object files (as `.rds` files) will be generated as output, organized by project.

## Software requirements

The code for the project will be in R, so all software dependencies will be managed by `renv`.

## Computational resources

The only computational requirements should be sufficient RAM to load the SingleCellExperiment objects and resulting Seurat objects into memory.
2 changes: 2 additions & 0 deletions analyses/seurat-conversion/components/dependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# R dependencies not captured by `renv`
# library("missing_package")
Empty file.
46 changes: 46 additions & 0 deletions analyses/seurat-conversion/renv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"R": {
"Version": "4.4.0",
"Repositories": [
{
"Name": "BioCsoft",
"URL": "https://bioconductor.org/packages/3.19/bioc"
},
{
"Name": "BioCann",
"URL": "https://bioconductor.org/packages/3.19/data/annotation"
},
{
"Name": "BioCexp",
"URL": "https://bioconductor.org/packages/3.19/data/experiment"
},
{
"Name": "BioCworkflows",
"URL": "https://bioconductor.org/packages/3.19/workflows"
},
{
"Name": "BioCbooks",
"URL": "https://bioconductor.org/packages/3.19/books"
},
{
"Name": "CRAN",
"URL": "https://p3m.dev/cran/latest"
}
]
},
"Bioconductor": {
"Version": "3.19"
},
"Packages": {
"renv": {
"Package": "renv",
"Version": "1.0.11",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "47623f66b4e80b3b0587bc5d7b309888"
}
}
}
7 changes: 7 additions & 0 deletions analyses/seurat-conversion/renv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
library/
local/
cellar/
lock/
python/
sandbox/
staging/
Loading

0 comments on commit 017db46

Please sign in to comment.