name: "rsem_calculate_expression"
namespace: "rsem"
info:
  migration_info:
    git_repo: https://github.com/nf-core/rnaseq.git
    paths: [modules/nf-core/rsem/calculateexpression/main.nf, modules/nf-core/rsem/calculateexpression/meta.yml]
    last_sha: 92b2a7857de1dda9d1c19a088941fc81e2976ff7

description: | 
  Calculate expression with RSEM.

argument_groups:
- name: "Input"
  arguments:
  - name: "--id"
    type: string
    description: Sample ID.
  - name: "--strandedness"
    type: string
    description: Sample strand-specificity. Must be one of unstranded, forward, reverse
    choices: [forward, reverse, unstranded]
  - name: "--paired"
    type: boolean
    description: Paired-end reads or not?
  - name: "--input"
    type: file
    description: Input reads for quantification.
    multiple: true
    multiple_sep: ","
  - name: "--index"
    type: file
    description: RSEM index.  
  - name: "--extra_args"
    type: string
    description: Extra rsem-calculate-expression arguments in addition to the defaults.

- name: "Output"
  arguments:
  - name: "--counts_gene"
    type: file
    description: Expression counts on gene level
    example: sample.genes.results
    direction: output
  - name: "--counts_transcripts"
    type: file
    description: Expression counts on transcript level
    example: sample.isoforms.results
    direction: output
  - name: "--stat"
    type: file
    description: RSEM statistics
    example: sample.stat
    direction: output
  - name: "--logs"
    type: file
    description: RSEM logs
    example: sample.log
    direction: output
  - name: "--bam_star"
    type: file
    description: BAM file generated by STAR (optional)
    example: sample.STAR.genome.bam
    direction: output
  - name: "--bam_genome"
    type: file
    description: Genome BAM file (optional)
    example: sample.genome.bam
    direction: output
  - name: "--bam_transcript"
    type: file
    description: Transcript BAM file (optional)
    example: sample.transcript.bam
    direction: output

resources:
  - type: bash_script
    path: script.sh

test_resources:
  - type: bash_script
    path: test.sh
  - path: /testData/minimal_test/input_fastq/SRR6357070_1.fastq.gz
  - path: /testData/minimal_test/input_fastq/SRR6357070_2.fastq.gz
  - path: /testData/minimal_test/reference/rsem.tar.gz

# TODO: Install bowtie/bowtie2 
engines:
  - type: docker
    image: ubuntu:22.04
    setup:
    - type: apt
      packages: 
        - build-essential 
        - gcc 
        - g++ 
        - make 
        - wget 
        - zlib1g-dev 
        - unzip 
        - xxd 
        - perl 
        - r-base
        - bowtie2
        - python3-pip 
        - git
    - type: docker
      env: 
        - STAR_VERSION=2.7.11b
        - RSEM_VERSION=1.3.3
        - TZ=Europe/Brussels
      run: |
        ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
        cd /tmp && \
        wget --no-check-certificate https://github.com/alexdobin/STAR/archive/refs/tags/${STAR_VERSION}.zip && \
        unzip ${STAR_VERSION}.zip && \
        cd STAR-${STAR_VERSION}/source && \
        make STARstatic CXXFLAGS_SIMD=-std=c++11 && \
        cp STAR /usr/local/bin && \
        cd /tmp && \
        wget --no-check-certificate https://github.com/deweylab/RSEM/archive/refs/tags/v${RSEM_VERSION}.zip && \
        unzip v${RSEM_VERSION}.zip && \
        cd RSEM-${RSEM_VERSION} && \
        make && \
        make install && \
        rm -rf /tmp/STAR-${STAR_VERSION} /tmp/${STAR_VERSION}.zip && \
        rm -rf /tmp/RSEM-${RSEM_VERSION} /tmp/v${RSEM_VERSION}.zip && \
        cd && \
        apt-get clean && \
        echo 'export PATH=$PATH:/usr/local/bin' >> /etc/profile && \
        echo 'export PATH=$PATH:/usr/local/bin' >> ~/.bashrc && \
        /bin/bash -c "source /etc/profile && source ~/.bashrc && echo $PATH && which STAR"

runners:
  - type: executable
  - type: nextflow