Skip to content

Commit

Permalink
Merge pull request #2 from Sage-Bionetworks-Workflows/main
Browse files Browse the repository at this point in the history
add old updates
  • Loading branch information
allaway authored Jul 3, 2024
2 parents ed13671 + d76b3dd commit cb7f55f
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 5 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

on:
# schedule:
# - cron: '40 17 * * *'
push:
branches: [ "main" ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
workflow_dispatch:

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}


jobs:
build:

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@v3

# 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
with:
cosign-release: 'v2.1.1'

# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@v2

# 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@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
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@v2
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

# 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@v4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max


# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
TAGS: ${{ steps.meta.outputs.tags }}
DIGEST: ${{ steps.build-and-push.outputs.digest }}
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
13 changes: 9 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,25 @@ ENV PATH=/root/miniconda3/bin:$PATH
# Create conda environment
COPY environment.yml /
RUN conda env create -f /environment.yml && conda clean -a
ENV PATH=/root/miniconda3/envs/vcf2maf/bin:$PATH
ENV PATH=/root/miniconda3/envs/vep/bin:$PATH

# rsync
RUN yum install -y rsync \
tar \
procps \
perl \
which

# Install vcf2maf
RUN bash -c 'export VCF2MAF_URL=`curl -sL https://api.github.com/repos/nf-osi/vcf2maf/releases | grep -m1 tarball_url | cut -d\" -f4`; curl -L -o nf-osi-vcf2maf.tar.gz $VCF2MAF_URL; tar -zxf nf-osi-vcf2maf.tar.gz; cd nf-osi-vcf2maf-*'
RUN curl -s -L -o vcf2maf.tar.gz https://github.com/Sage-Bionetworks-Workflows/vcf2maf/archive/refs/tags/107.1.tar.gz \
&& tar -zxf vcf2maf.tar.gz \
&& rm vcf2maf.tar.gz \
&& mv $(find . -maxdepth 1 -type d -name '*vcf2maf*') vcf2maf \
&& chmod a+x vcf2maf/*.pl \
&& ln -sr vcf2maf/*.pl /usr/local/bin/

# Dump the details of the installed packages to a file for posterity
RUN conda env export --name vcf2maf > vcf2maf.yml
RUN conda env export --name vep > vep.yml
RUN conda init bash

RUN mkdir /workdir

44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,47 @@ done
```

## Adding support for `--af_gnomadg`

### Original command

```console
docker run \
-v $HOME/data:/work/:rw -v /dev/shm/:/ref/:ro \
nfosi/vcf2maf:latest \
perl nf-osi-vcf2maf-1b34293/vcf2maf.pl --input-vcf /work/test-small.vcf \
--output-maf /work/test-small.maf --vep-data /ref/vep \
--ref-fasta /ref/fasta/Homo_sapiens_assembly38.fasta \
--vep-path /root/miniconda3/envs/vcf2maf/bin --ncbi-build GRCh38
```

### Using vcf2maf.sh

This shell script adds support for `--af_gnomadg`

```console
docker run \
-v $HOME/data:/work/:rw -v /dev/shm/:/ref/:ro \
-v $HOME/vcf2maf-wf/:/src/:ro \
nfosi/vcf2maf:latest \
bash /src/vcf2maf.sh --input-vcf /work/test-small.vcf \
--output-maf /work/test-small.maf --vep-data /ref/vep \
--ref-fasta /ref/fasta/Homo_sapiens_assembly38.fasta \
--vep-path /root/miniconda3/envs/vcf2maf/bin --ncbi-build GRCh38
```

### Using vcf2maf-gnomad-genomes

This uses a forked version of vcf2maf

```console
docker run \
-v $HOME/data:/work/:rw -v /dev/shm/:/ref/:ro \
sagebionetworks/vcf2maf:gnomad-genomes \
vcf2maf.pl --input-vcf /work/test-small.vcf \
--output-maf /work/test-small.maf --vep-data /ref/vep \
--ref-fasta /ref/fasta/Homo_sapiens_assembly38.fasta \
--vep-path /root/miniconda3/envs/vep/bin --ncbi-build GRCh38
```

2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# You can use this file to create a conda environment for this pipeline:
# conda env create -f environment.yml
name: vcf2maf
name: vep
channels:
- conda-forge
- bioconda
Expand Down

0 comments on commit cb7f55f

Please sign in to comment.