Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docker Build

on:
push:
branches:
- release
build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

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

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
3 changes: 1 addition & 2 deletions Dockerfile
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ RUN apt-get update && apt-get install -y \
&& rm -rf /var/lib/apt/lists/*

# Install required R packages
RUN R -e "install.packages(c('ggplot2', 'dplyr', 'tidyr', 'cowplot', 'scales'), repos='http://cran.rstudio.com/')"
RUN R -e "install.packages(c('ggplot2', 'dplyr', 'tidyr', 'cowplot', 'scales', 'segmented'), repos='http://cran.rstudio.com/')"

# Copy the R script to the working directory
COPY bedgraph-visualizer.R .



# Example usage:
# docker build -t my-r-script .
# docker run --rm -v $(pwd)/output:/usr/src/app/output my-r-script BAF.bedgraph.gz LRR.bedgraph.gz regions.bed output
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Example usage:
# docker build -t my-r-script .
# docker run --rm -v $(pwd)/output:/usr/src/app/output my-r-script BAF.bedgraph.gz LRR.bedgraph.gz regions.bed output
11 changes: 7 additions & 4 deletions bedgraph-visualizer.R
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,20 @@ genome_plot <- function() {
}

# Function to plot specific regions
region_plot <- function(region_file, padding_percent=0.2) {
region_plot <- function(region_file, min_padding=600000) {
# Load region data
regions <- read.table(region_file, header = FALSE)
colnames(regions) <- c("Chr", "Start", "End", "Type")

# Iterate over each region and create plots
for (i in 1:nrow(regions)) {
region <- regions[i, ]
padding = (region$End - region$Start ) * padding_percent
padded_start = region$Start - padding / 2
padded_end = region$End + padding / 2
padding = (region$End - region$Start )
if (padding <= min_padding) {
padding = min_padding
}
padded_start = region$Start - padding
padded_end = region$End + padding

# Filter BAF and LRR data for the current region
filtered_baf <- baf_data %>%
Expand Down