|
| 1 | +name: scRNA MAST Analysis |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - '03_differential_expression/scRNA_MAST.qmd' |
| 8 | + pull_request: |
| 9 | + branches: [main] |
| 10 | + paths: |
| 11 | + - '03_differential_expression/scRNA_MAST.qmd' |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + r-mast: |
| 16 | + runs-on: ubuntu-22.04 |
| 17 | + |
| 18 | + env: |
| 19 | + RENV_PATHS_ROOT: ~/.local/share/renv # persistent cache location |
| 20 | + |
| 21 | + steps: |
| 22 | + - name: Checkout code |
| 23 | + uses: actions/checkout@v4 |
| 24 | + |
| 25 | + - name: Install pandoc |
| 26 | + run: sudo apt-get update && sudo apt-get install -y pandoc |
| 27 | + |
| 28 | + - name: Set up R |
| 29 | + uses: r-lib/actions/setup-r@v2 |
| 30 | + |
| 31 | + - name: Install system dependencies for R packages |
| 32 | + run: | |
| 33 | + sudo apt-get update |
| 34 | + sudo apt-get install -y build-essential libcurl4-openssl-dev libssl-dev libxml2-dev libgit2-dev libmagick++-dev libharfbuzz-dev libfribidi-dev libglpk-dev |
| 35 | + shell: bash |
| 36 | + |
| 37 | + - name: Cache R packages (renv) |
| 38 | + uses: actions/cache@v4 |
| 39 | + with: |
| 40 | + path: ${{ env.RENV_PATHS_ROOT }} |
| 41 | + key: ${{ runner.os }}-renv-${{ hashFiles('03_differential_expression/renv.lock') }} |
| 42 | + restore-keys: | |
| 43 | + ${{ runner.os }}-renv- |
| 44 | +
|
| 45 | + - name: Set repositories |
| 46 | + run: Rscript ubuntu.R |
| 47 | + |
| 48 | + - name: Restore environment from renv.lock |
| 49 | + run: | |
| 50 | + install.packages("renv", repos = "https://cloud.r-project.org") |
| 51 | + renv::restore(prompt = FALSE, lockfile = "03_differential_expression/renv.lock") |
| 52 | + shell: Rscript {0} |
| 53 | + |
| 54 | + - name: Run MAST analysis for cluster 2 |
| 55 | + run: | |
| 56 | + cd 03_differential_expression |
| 57 | + Rscript MAST_analysis.R \ |
| 58 | + --seurat_obj=https://github.com/bcbio/bcbioR-test-data/raw/refs/heads/main/singlecell/tiny.rds \ |
| 59 | + --resolution_column=integrated_snn_res.0.4 \ |
| 60 | + --cluster_name=2 \ |
| 61 | + --contrast=age \ |
| 62 | + --outputDir=out |
| 63 | + shell: bash |
| 64 | + |
| 65 | + - name: Set up Quarto |
| 66 | + uses: quarto-dev/quarto-actions/setup@v2 |
| 67 | + |
| 68 | + - name: Run MAST analysis |
| 69 | + id: render_qmd |
| 70 | + run: | |
| 71 | + cd 03_differential_expression |
| 72 | + quarto render scRNA_MAST.qmd |
| 73 | + shell: bash |
| 74 | + |
| 75 | + - name: Deploy HTML to gh-pages |
| 76 | + if: success() |
| 77 | + run: | |
| 78 | + git config --global user.name "github-actions[bot]" |
| 79 | + git config --global user.email "github-actions[bot]@users.noreply.github.com" |
| 80 | +
|
| 81 | + OUTPUT_FILE="03_differential_expression/scRNA_MAST.html" |
| 82 | +
|
| 83 | + # Fetch gh-pages (if exists) and create worktree |
| 84 | + git fetch origin gh-pages || true |
| 85 | + git worktree add /tmp/gh-pages gh-pages 2>/dev/null || git worktree add /tmp/gh-pages -b gh-pages |
| 86 | +
|
| 87 | + # Copy the file into the worktree |
| 88 | + mkdir -p "/tmp/gh-pages/$(dirname "$OUTPUT_FILE")" |
| 89 | + cp "$OUTPUT_FILE" "/tmp/gh-pages/$(dirname "$OUTPUT_FILE")/" |
| 90 | +
|
| 91 | + cd /tmp/gh-pages |
| 92 | +
|
| 93 | + # Commit and push if there are changes |
| 94 | + |
| 95 | + git add "$(dirname "$OUTPUT_FILE")/$(basename "$OUTPUT_FILE")" |
| 96 | + git commit -m "Deploy $(basename "$OUTPUT_FILE") [skip ci]" |
| 97 | + git push --force origin gh-pages |
| 98 | + |
| 99 | + shell: bash |
0 commit comments