diff --git a/.github/workflows/conventional-prs.yml b/.github/workflows/conventional-prs.yml index 82028b7..d0f5164 100644 --- a/.github/workflows/conventional-prs.yml +++ b/.github/workflows/conventional-prs.yml @@ -1,4 +1,5 @@ -name: Lint PR +name: Conventional PRs + on: pull_request_target: types: @@ -11,10 +12,5 @@ permissions: pull-requests: read jobs: - main: - name: Validate PR title - runs-on: ubuntu-latest - steps: - - uses: amannn/action-semantic-pull-request@v5 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + conventional-prs: + uses: MPUSP/mpusp-github-actions/.github/workflows/conventional-prs.yml@main diff --git a/.github/workflows/deploy-apptainer.yml b/.github/workflows/deploy-apptainer.yml new file mode 100644 index 0000000..aa93cbc --- /dev/null +++ b/.github/workflows/deploy-apptainer.yml @@ -0,0 +1,17 @@ +name: Deploy Apptainer + +on: + workflow_run: + workflows: ["Release Please"] + types: + - completed + workflow_dispatch: + +permissions: + contents: read + packages: write + +jobs: + deploy-apptainer: + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} + uses: MPUSP/mpusp-github-actions/.github/workflows/deploy-apptainer.yml@main diff --git a/.github/workflows/deploy_apptainer.yml b/.github/workflows/deploy_apptainer.yml deleted file mode 100644 index 1034cc3..0000000 --- a/.github/workflows/deploy_apptainer.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Deploy Apptainer - -on: - workflow_run: - workflows: ["release-please"] - types: - - completed - workflow_dispatch: - -jobs: - build_and_push: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} - steps: - - name: checkout repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: create dockerfile - uses: snakemake/snakemake-github-action@v2 - with: - directory: . - snakefile: workflow/Snakefile - install-apptainer: true - args: "--cores 1" - task: containerize - - - name: create apptainer recipe - shell: bash - run: | - pip install spython - sed -i "2i RUN apt-get update && apt-get install -y curl" Dockerfile - spython recipe Dockerfile > apptainer.def - sed -i 's/\/environment.yaml\/environment.yaml$/\/environment.yaml/' apptainer.def - - - name: create apptainer image - shell: bash - run: | - sudo apt-get install -y uidmap - apptainer build --fakeroot apptainer.sif apptainer.def - - - name: authenticate to GHCR - run: | - echo ${{ secrets.GITHUB_TOKEN }} | apptainer registry login -u ${{ github.actor }} --password-stdin oras://ghcr.io - - - name: push apptainer to GHCR - run: | - REPO=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]') - echo "Pushing apptainer to: oras://ghcr.io/${REPO}:latest" - apptainer push apptainer.sif "oras://ghcr.io/${REPO}:latest" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 2d5653d..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Tests - -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - Formatting: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Formatting - uses: super-linter/super-linter@v7 - env: - VALIDATE_ALL_CODEBASE: false - DEFAULT_BRANCH: main - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VALIDATE_SNAKEMAKE_SNAKEFMT: true - VALIDATE_YAML_PRETTIER: true - - Linting: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Lint workflow - uses: snakemake/snakemake-github-action@v2 - with: - directory: . - snakefile: workflow/Snakefile - args: "--lint" - - Testing: - runs-on: ubuntu-latest - needs: - - Linting - - Formatting - steps: - - uses: actions/checkout@v4 - - - name: Test workflow - uses: snakemake/snakemake-github-action@v2 - with: - directory: .test - snakefile: workflow/Snakefile - args: "--sdm conda --show-failed-logs --cores 2 --conda-cleanup-pkgs cache" - - - name: Test report - uses: snakemake/snakemake-github-action@v2 - with: - directory: .test - snakefile: workflow/Snakefile - args: "--cores 2 --report report.zip" diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index e9ec84c..b103aa0 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -1,20 +1,14 @@ +name: Release Please + on: push: - branches: - - main + branches: [main] permissions: contents: write pull-requests: write issues: write -name: release-please - jobs: release-please: - runs-on: ubuntu-latest - steps: - - uses: googleapis/release-please-action@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} - release-type: go # just keep a changelog, no version anywhere outside of git tags + uses: MPUSP/mpusp-github-actions/.github/workflows/release-please.yml@main diff --git a/.github/workflows/snakemake-tests.yml b/.github/workflows/snakemake-tests.yml new file mode 100644 index 0000000..7e58b06 --- /dev/null +++ b/.github/workflows/snakemake-tests.yml @@ -0,0 +1,12 @@ +name: Snakemake Tests + +on: + pull_request: + branches: [main] + +jobs: + snakemake-tests: + uses: MPUSP/mpusp-github-actions/.github/workflows/snakemake-tests.yml@main + with: + cores: 2 + dryrun: false diff --git a/README.md b/README.md index b35aa20..e77ece5 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Snakemake-simple-mapping [![Snakemake](https://img.shields.io/badge/snakemake-≥8.0.0-brightgreen.svg)](https://snakemake.github.io) -[![GitHub actions status](https://github.com/MPUSP/snakemake-simple-mapping/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/MPUSP/snakemake-simple-mapping/actions/workflows/main.yml) +[![GitHub Actions](https://github.com/MPUSP/snakemake-simple-mapping/actions/workflows/snakemake-tests.yml/badge.svg)](https://github.com/MPUSP/snakemake-simple-mapping/actions/workflows/snakemake-tests.yml) [![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/) -[![run with apptainer](https://img.shields.io/badge/run%20with-singularity-1D355C.svg?labelColor=000000)](https://sylabs.io/docs/) +[![run with apptainer](https://img.shields.io/badge/run%20with-apptainer-1D355C.svg?labelColor=000000)](https://apptainer.org/) [![workflow catalog](https://img.shields.io/badge/Snakemake%20workflow%20catalog-darkgreen)](https://snakemake.github.io/snakemake-workflow-catalog/docs/workflows/MPUSP/snakemake-simple-mapping) A Snakemake workflow for the mapping of reads to reference genomes, minimalistic and simple. diff --git a/config/README.md b/config/README.md index ce77ff5..68cd4d9 100644 --- a/config/README.md +++ b/config/README.md @@ -33,79 +33,3 @@ The sample sheet listing read input files needs to have the following layout: | ------- | ----------- | ------------------- | ------------------- | | sample1 | strain XY | sample1_R1.fastq.gz | sample1_R2.fastq.gz | | ... | ... | ... | ... | - -### Parameters - -This table lists all parameters that can be used to run the workflow. - -| parameter | type | details | default | -| ------------------------ | ------- | -------------------------------------------------------- | ----------------- | -| **samplesheet** | string | path to the sample sheet in tsv format | | -| **get_genome** | | | | -| database | string | database to use for genome retrieval, 'ncbi' or 'manual' | `ncbi` | -| assembly | string | Refseq ID to use for genome retrieval | `GCF_000307535.1` | -| fasta | string | path to a custom FASTA file (optional) | | -| gff | string | path to a custom GFF file (optional) | | -| gff_source_type | array | mapping of GFF source types to feature types | | -| **fastp** | | | | -| extra | string | additional arguments to Fastp | | -| **mapping** | | | | -| tool | string | mapping tool to use, one of 'bowtie2', 'bwa_mem2' | `bwa_mem2` | -| _bowtie2_ | | | | -| index | string | additional arguments to bowtie build | | -| extra | string | additional arguments to bowtie align | | -| _bwa_mem2_ | | | | -| extra | string | additional arguments to bwa-mem2 | | -| sort | string | sorting tool to use | `samtools` | -| sort_order | string | sorting order to use | `coordinate` | -| sort_extra | string | additional arguments to the sorting tool | | -| _samtools_sort_ | | | | -| extra | string | additional arguments to Samtools sort | `-m 4G` | -| index | object | Samtools index options | | -| extra | string | additional arguments to Samtools index | | -| _star_ | | | | -| index | string | additional arguments to STAR index | | -| extra | string | additional arguments to STAR align | | -| _minimap2_ | | | | -| index | string | additional arguments to minimap2 index | | -| extra | string | additional arguments to minimap2 align | `-ax map-ont` | -| sorting | string | sorting order to use | `coordinate` | -| sort_extra | string | additional arguments to the sorting tool | | -| **mapping_stats** | | | | -| _gffread_ | | | | -| extra | string | additional arguments to GFFread | | -| _rseqc_infer_experiment_ | | | | -| extra | string | additional arguments to RSeQC infer_experiment | | -| _rseqc_bam_stat_ | | | | -| extra | string | additional arguments to RSeQC bam_stat | | -| _deeptools_coverage_ | | | | -| genome_size | integer | genome size in base pairs | `1000` | -| extra | string | additional arguments to DeepTools bamCoverage | | -| **variant_calling** | | | | -| _bcftools_pileup_ | | | | -| uncompressed | boolean | whether to output uncompressed BCF files | `False` | -| extra | string | additional arguments to BCFtools pileup | | -| _bcftools_call_ | | | | -| uncompressed | boolean | whether to output uncompressed VCF files | `False` | -| caller | string | use '-c' for consensus or '-m' for multiallelic | `-c` | -| extra | string | additional arguments to BCFtools view | | -| _bcftools_view_ | | | | -| extra | string | additional arguments to BCFtools call | | -| _bcftools_filter_ | | | | -| filter | string | expression by which to filter BCF/VCF result | `-e 'ALT=\".\"'` | -| extra | string | additional arguments to BCFtools filter | | -| _freebayes_ | | | | -| extra | string | additional arguments to Freebayes call | | -| **variant_annotation** | | | | -| tool | string | annotation tool to use, one of 'vep', 'snpeff' | `vep` | -| _vep_ | | | | -| convert_gff | boolean | whether to convert NCBI GFF to Ensemble style GFF | `True` | -| plugins | array | VEP plugins to use | `[]` | -| extra | string | additional arguments to VEP | see config.yml | -| _snpeff_ | | | | -| extra | string | additional arguments to SnpEff | see config.yml | -| **qc** | | | | -| _fastqc_ | | | | -| extra | string | additional arguments to FastQC | | -| _multiqc_ | | | | -| extra | string | additional arguments to MultiQC | | diff --git a/config/schemas/config.schema.yml b/config/schemas/config.schema.yml index 7790ca5..2106db9 100644 --- a/config/schemas/config.schema.yml +++ b/config/schemas/config.schema.yml @@ -10,9 +10,11 @@ properties: database: type: string description: database to use for genome retrieval, 'ncbi' or 'manual' + default: ncbi assembly: type: string - description: assembly version to use for genome retrieval, e.g. 'GCF_000307535.1' + description: RefSeq assembly accession to use for genome retrieval + default: GCF_000307535.1 fasta: type: [string, "null"] description: path to a custom FASTA file (optional) @@ -34,13 +36,14 @@ properties: properties: extra: type: string - description: additional arguments to pass to Fastp + description: additional arguments to pass to fastp mapping: type: object properties: tool: type: string - description: mapping tool to use, one of 'bowtie2', 'bwa_mem2', 'star' + description: mapping tool to use, one of 'bowtie2', 'bwa_mem2', 'star', or 'minimap2' + default: bwa_mem2 bowtie2: type: object properties: @@ -59,9 +62,11 @@ properties: sort: type: string description: sorting tool to use, e.g. 'samtools' + default: samtools sort_order: type: string description: sorting order to use + default: coordinate sort_extra: type: string description: additional arguments to pass to the sorting tool @@ -83,9 +88,11 @@ properties: extra: type: string description: additional arguments to minimap2 align + default: -ax map-ont sorting: type: string description: sorting order to use + default: coordinate sort_extra: type: string description: additional arguments to pass to the sorting tool @@ -95,6 +102,7 @@ properties: extra: type: string description: additional arguments to pass to Samtools sort + default: -m 4G samtools_index: type: object properties: @@ -130,6 +138,7 @@ properties: genome_size: type: integer description: genome size in base pairs + default: 1000 extra: type: string description: additional arguments to pass to DeepTools bamCoverage @@ -150,6 +159,7 @@ properties: uncompressed: type: boolean description: whether to output uncompressed BCF files + default: false extra: type: string description: additional arguments to pass to BCFtools pileup @@ -159,9 +169,11 @@ properties: uncompressed: type: boolean description: whether to output uncompressed VCF files + default: false caller: type: string description: use '-c' for consensus or '-m' for multiallelic + default: "-c" extra: type: string description: additional arguments to pass to BCFtools call @@ -170,19 +182,23 @@ properties: properties: extra: type: string + description: additional arguments to pass to BCFtools view bcftools_filter: type: object properties: filter: type: string + description: expression used to filter BCF/VCF records + default: '-e ''ALT="."''' extra: type: string + description: additional arguments to pass to BCFtools filter freebayes: type: object properties: extra: type: string - description: additional arguments to pass to Freebayes + description: additional arguments to pass to Freebayes call required: - bcftools_pileup - bcftools_call @@ -195,15 +211,18 @@ properties: tool: type: string description: annotation tool to use, one of 'vep', 'snpeff' + default: vep vep: type: object properties: convert_gff: type: boolean - description: whether to convert NCBI GFF to VEP compatible format + description: whether to convert NCBI GFF to Ensembl-style GFF for VEP compatibility + default: true plugins: type: array description: list of VEP plugins to use + default: [] items: type: string extra: diff --git a/workflow/Snakefile b/workflow/Snakefile index 38ec062..fb02f75 100644 --- a/workflow/Snakefile +++ b/workflow/Snakefile @@ -21,7 +21,7 @@ include: "rules/report.smk" # container definition (optional) # ----------------------------------------------------- -containerized: "oras://ghcr.io/mpusp/snakemake-simple-mapping:latest" +container: "oras://ghcr.io/mpusp/snakemake-simple-mapping:latest" # optional messages, log and error handling