name: build_cellranger_reference
namespace: reference
scope: "public"
description: Build a Cell Ranger-compatible reference folder from user-supplied genome FASTA and gene GTF files. Creates a new folder named after the genome.
authors:
  - __merge__: /src/authors/angela_pisco.yaml
    roles: [ author ]
  - __merge__: /src/authors/robrecht_cannoodt.yaml
    roles: [ author, maintainer ]
arguments:
  # inputs
  - type: file
    name: --genome_fasta
    required: true
    description: Reference genome fasta.
    example: genome_sequence.fa.gz
  - type: file
    name: --transcriptome_gtf
    required: true
    description: Reference transcriptome annotation.
    example: transcriptome_annotation.gtf.gz
  - type: string
    name: "--reference_version"
    required: false
    description: "Optional reference version string to include with reference"
  - type: file
    name: --output
    direction: output
    required: true
    description: Output folder
    example: cellranger_reference
resources:
  - type: bash_script
    path: script.sh
test_resources:
  - type: bash_script
    path: test.sh
  - path: /resources_test/reference_gencodev41_chr1

engines:
- type: docker
  image: ghcr.io/data-intuitive/cellranger:9.0
  setup:
    - type: docker
      run: |
        DEBIAN_FRONTEND=noninteractive apt update && \
        apt upgrade -y && apt install -y procps pigz && rm -rf /var/lib/apt/lists/*
  test_setup:
    - type: apt
      packages: [ git, wget ]
    - type: docker
      run: |
        TARGETARCH="${TARGETARCH:-$(dpkg --print-architecture)}" && \
        TARGETOS="${TARGETOS:-linux}" && \
        PATH="${PATH}:/usr/local/go/bin" && \
        wget https://go.dev/dl/go1.21.4.$TARGETOS-$TARGETARCH.tar.gz && tar -C /usr/local/ -xzf go1.21.4.$TARGETOS-$TARGETARCH.tar.gz && \
        rm go1.21.4.$TARGETOS-$TARGETARCH.tar.gz && \
        git clone --branch v2.5.0 https://github.com/shenwei356/seqkit.git && \
        cd seqkit/seqkit/ && go build && cp seqkit /usr/bin/ && cd ../../ && rm -rf seqkit && rm -r /usr/local/go
  
runners:
- type: executable
- type: nextflow
  directives:
    label: [ highmem, highcpu ]
