
 N E X T F L O W   ~  version 24.10.4

Launching `https://github.com/nf-core/riboseq` [riboseq_15] DSL2 - revision: 235e008eda [1.1.0]


------------------------------------------------------
                                        ,--./,-.
        ___     __   __   __   ___     /,-._.--~'
  |\ | |__  __ /  ` /  \ |__) |__         }  {
  | \| |       \__, \__/ |  \ |___     \`-._,-`-,
                                        `._,._,'
  nf-core/riboseq 1.1.0
------------------------------------------------------
Input/output options
  input                           : samplesheet.csv
  contrasts                       : contrasts.csv
  outdir                          : riboseq

Reference genome options
  fasta                           : /data/user/mbansal/Mapping_and_fastq_files/MAPPING_MINIMAP2/reference_genome_files/GRCh38.p13.genome.fa
  gtf                             : /data/user/mbansal/Mapping_and_fastq_files/MAPPING_MINIMAP2/reference_genome_files/gencode.v44.annotation.gtf

Alignment options
  min_mapped_reads                : 5

Riboseq-specific options
  extra_ribotricer_detectorfs_args: --phase_score_cutoff 0.2
  extra_anota2seq_run_args        : --nPermutations 1000 --useRVM TRUE

Generic options
  trace_report_suffix             : 2025-06-05_10-28-22

Core Nextflow options
  revision                        : 1.1.0
  runName                         : riboseq_15
  containerEngine                 : singularity
  launchDir                       : /data/project/ding_lab/riboseq
  workDir                         : /data/project/ding_lab/riboseq/work
  projectDir                      : /home/mbansal/.nextflow/assets/nf-core/riboseq
  userName                        : mbansal
  profile                         : singularity
  configFiles                     : /home/mbansal/.nextflow/assets/nf-core/riboseq/nextflow.config

!! Only displaying parameters that differ from the pipeline defaults !!
------------------------------------------------------
* The pipeline
    https://doi.org/10.5281/zenodo.10966364

* The nf-core framework
    https://doi.org/10.1038/s41587-020-0439-x

* Software dependencies
    https://github.com/nf-core/riboseq/blob/master/CITATIONS.md

WARN: The following invalid input values have been detected:

* --run_anota2seq: true


WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

[-        ] NFC…:PREPARE_GENOME:GTF_FILTER -
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -

[-        ] NFC…:PREPARE_GENOME:GTF_FILTER -
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -
[-        ] NFC…ENOME:CUSTOM_GETCHROMSIZES -
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[-        ] NFC…GENOME:STAR_GENOMEGENERATE -
[-        ] NFC…_SETSTRANDEDNESS:CAT_FASTQ -
[-        ] NFC…ER_SETSTRANDEDNESS:FQ_LINT -
[-        ] NFC…UMITOOLS_TRIMGALORE:FASTQC -
[-        ] NFC…OOLS_TRIMGALORE:TRIMGALORE -
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`

[-        ] NFC…:PREPARE_GENOME:GTF_FILTER -
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -
[-        ] NFC…ENOME:CUSTOM_GETCHROMSIZES -
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[-        ] NFC…GENOME:STAR_GENOMEGENERATE -
[-        ] NFC…_SETSTRANDEDNESS:CAT_FASTQ -
[-        ] NFC…ER_SETSTRANDEDNESS:FQ_LINT -
[-        ] NFC…UMITOOLS_TRIMGALORE:FASTQC -
[-        ] NFC…OOLS_TRIMGALORE:TRIMGALORE -
[-        ] NFC…ESS:FQ_LINT_AFTER_TRIMMING -
[-        ] NFC…RANDEDNESS:SORTMERNA_INDEX -
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[-        ] NFC…:PREPARE_GENOME:GTF_FILTER -
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -
[-        ] NFC…ENOME:CUSTOM_GETCHROMSIZES -
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[-        ] NFC…GENOME:STAR_GENOMEGENERATE -
[-        ] NFC…_SETSTRANDEDNESS:CAT_FASTQ -
[-        ] NFC…ER_SETSTRANDEDNESS:FQ_LINT -
[-        ] NFC…UMITOOLS_TRIMGALORE:FASTQC -
[-        ] NFC…OOLS_TRIMGALORE:TRIMGALORE -
[-        ] NFC…ESS:FQ_LINT_AFTER_TRIMMING -
[-        ] NFC…RANDEDNESS:SORTMERNA_INDEX -
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
Plus 13 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[-        ] NFC…:PREPARE_GENOME:GTF_FILTER -
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -
[-        ] NFC…ENOME:CUSTOM_GETCHROMSIZES -
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[-        ] NFC…GENOME:STAR_GENOMEGENERATE -
[-        ] NFC…_SETSTRANDEDNESS:CAT_FASTQ -
[-        ] NFC…ER_SETSTRANDEDNESS:FQ_LINT -
[-        ] NFC…UMITOOLS_TRIMGALORE:FASTQC -
[-        ] NFC…OOLS_TRIMGALORE:TRIMGALORE -
[-        ] NFC…ESS:FQ_LINT_AFTER_TRIMMING -
[-        ] NFC…RANDEDNESS:SORTMERNA_INDEX -
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
Plus 20 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1
[-        ] NFC…OME:MAKE_TRANSCRIPTS_FASTA -
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[-        ] NFC…GENOME:STAR_GENOMEGENERATE -
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4
[-        ] NFC…ER_SETSTRANDEDNESS:FQ_LINT -
[-        ] NFC…UMITOOLS_TRIMGALORE:FASTQC -
[-        ] NFC…OOLS_TRIMGALORE:TRIMGALORE -
[-        ] NFC…ESS:FQ_LINT_AFTER_TRIMMING -
[-        ] NFC…RANDEDNESS:SORTMERNA_INDEX -
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
Plus 21 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[-        ] NFC…ARE_GENOME:SORTMERNA_INDEX -
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[-        ] NFC…RANDEDNESS:SORTMERNA_INDEX -
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
Plus 20 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[-        ] NFC…_SETSTRANDEDNESS:SORTMERNA -
[-        ] NFC…SS:FQ_LINT_AFTER_SORTMERNA -
[-        ] NFC…PLE_FQ_SALMON:SALMON_INDEX -
[-        ] NFC…PLE_FQ_SALMON:FQ_SUBSAMPLE -
[-        ] NFC…PLE_FQ_SALMON:SALMON_QUANT -
[-        ] NFC…ASTQ_ALIGN_STAR:STAR_ALIGN -
[-        ] NFC…TOOLS_GENOME:SAMTOOLS_SORT -
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
Plus 20 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4
[-        ] NFC…OOLS_GENOME:SAMTOOLS_INDEX -
[-        ] NFC…TS_SAMTOOLS:SAMTOOLS_STATS -
[f0/ea3800] NFC…PTOME:SAMTOOLS_SORT (WT_1) | 3 of 3, cached: 3
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[10/9cc11f] NFC…SALMON:SALMON_QUANT (WT_1) | 3 of 3, cached: 3
Plus 18 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

executor >  local (2)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 0 of 1
Plus 7 more processes waiting for tasks…
WARN: Found the following unidentified headers in /data/project/ding_lab/riboseq/samplesheet.csv:
	- sample_description
	- pair
	- treatment
	- sample_group

WARN: Access to undefined parameter `salmon_index` -- Initialise it to a default value eg. `params.salmon_index = some_value`
WARN: Access to undefined parameter `skip_pseudo_alignment` -- Initialise it to a default value eg. `params.skip_pseudo_alignment = some_value`
WARN: Access to undefined parameter `pseudo_aligner` -- Initialise it to a default value eg. `params.pseudo_aligner = some_value`
WARN: Access to undefined parameter `sortmerna_index` -- Initialise it to a default value eg. `params.sortmerna_index = some_value`
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition
WARN: The operator `first` is useless when applied to a value channel which returns a single value by definition

executor >  local (3)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 0 of 1
Plus 6 more processes waiting for tasks…













executor >  local (3)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
Plus 6 more processes waiting for tasks…













executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 0 of 1
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 0 of 1
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 0 of 1
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 0 of 1
Plus 1 more processes waiting for tasks…

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 0 of 1
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 0 of 1
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 0 of 1
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 0 of 1
Plus 1 more processes waiting for tasks…
ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 0 of 1
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 0 of 1
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 0 of 1
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 1 of 1, failed: 1 ✘
Plus 1 more processes waiting for tasks…
Execution cancelled -- Finishing pending tasks before exit
ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 1 of 1 ✔
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 0 of 1
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 0 of 1
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 1 of 1, failed: 1 ✘
Plus 1 more processes waiting for tasks…
Execution cancelled -- Finishing pending tasks before exit
ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 1 of 1 ✔
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 1 of 1 ✔
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 0 of 1
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 1 of 1, failed: 1 ✘
Plus 1 more processes waiting for tasks…
Execution cancelled -- Finishing pending tasks before exit
ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 1 of 1 ✔
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 1 of 1 ✔
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 1 of 1 ✔
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 0 of 1
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 1 of 1, failed: 1 ✘
Plus 1 more processes waiting for tasks…
Execution cancelled -- Finishing pending tasks before exit
ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details

executor >  local (8)
[cc/176183] NFC…TER (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[d0/fe276c] NFC…rsem/GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[24/2067e7] NFC…ZES (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[4f/e23c8c] NFC…ENOME:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[17/7bf8e8] NFC…ATE (GRCh38.p13.genome.fa) | 1 of 1, cached: 1 ✔
[00/40f94b] NFC…ANDEDNESS:CAT_FASTQ (WT_1) | 4 of 4, cached: 4 ✔
[90/10fd19] NFC…LINT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[92/5f03ac] NFC…S_TRIMGALORE:FASTQC (WT_2) | 4 of 4, cached: 4 ✔
[54/ec00ba] NFC…LORE (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[d4/8a9f00] NFC…LINT_AFTER_TRIMMING (WT_1) | 4 of 4, cached: 4 ✔
[17/83feaf] NFC…DNESS:SORTMERNA_INDEX ([]) | 1 of 1, cached: 1 ✔
[e3/d986e9] NFC…ANDEDNESS:SORTMERNA (WT_1) | 4 of 4, cached: 4 ✔
[09/b60b0e] NFC…ERNA (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[2c/499b77] NFC…EX (genome.transcripts.fa) | 1 of 1, cached: 1 ✔
[e1/e25e99] NFC…SALMON:FQ_SUBSAMPLE (WT_1) | 4 of 4, cached: 4 ✔
[ce/efe70b] NFC…UANT (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[8c/17d592] NFC…IGN_STAR:STAR_ALIGN (WT_2) | 4 of 4, cached: 4 ✔
[66/74aaab] NFC…ENOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[bd/df7ad7] NFC…NDEX (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[99/790404] NFC…TATS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[35/3fb05d] NFC…S:SAMTOOLS_FLAGSTAT (WT_2) | 4 of 4, cached: 4 ✔
[31/9a578d] NFC…TATS (SNORD133_knockout_2) | 4 of 4, cached: 4 ✔
[f1/921709] NFC…PTOME:SAMTOOLS_SORT (WT_2) | 4 of 4, cached: 4 ✔
[5f/dcc9a7] NFC…TOME:SAMTOOLS_INDEX (WT_2) | 4 of 4, cached: 4 ✔
[d2/8beea5] NFC…OOLS:SAMTOOLS_STATS (WT_2) | 4 of 4, cached: 4 ✔
[0a/2990a6] NFC…STAT (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[1a/0ab511] NFC…S:SAMTOOLS_IDXSTATS (WT_1) | 4 of 4, cached: 4 ✔
[eb/63f99d] NFC…OSEQ (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[27/c909ec] NFC…DUAL (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[66/0601c9] NFC…H_PREDICT_ALL (allsamples) | 0 of 1
[53/e05d31] NFC…OTRICER_PREPAREORFS (null) | 1 of 1, cached: 1 ✔
[84/7c7cdb] NFC…ORFS (SNORD133_knockout_1) | 4 of 4, cached: 4 ✔
[5b/c06f4a] NFC…SALMON:SALMON_QUANT (WT_2) | 4 of 4, cached: 4 ✔
[5c/aa85eb] NFC…LMON:CUSTOM_TX2GENE (null) | 1 of 1 ✔
[2a/d7f607] NFC…AR_SALMON:TXIMETA_TXIMPORT | 1 of 1 ✔
[a2/b86de2] NFC…LMON:SE_GENE (all_samples) | 1 of 1 ✔
[df/3ff4b8] NFC…ENGTH_SCALED (all_samples) | 1 of 1 ✔
[08/b7b3e4] NFC…_GENE_SCALED (all_samples) | 1 of 1 ✔
[73/064188] NFC…E_TRANSCRIPT (all_samples) | 1 of 1 ✔
[f5/e60bea] NFC…_knockout, batch:, pair:]) | 1 of 1, failed: 1 ✘
Plus 1 more processes waiting for tasks…

ERROR ~ Error executing process > 'NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])'

Caused by:
  Process `NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN ([id:SNORD133_vs_control, variable:sample_group, reference:control, target:SNORD133_knockout, batch:, pair:])` terminated with an error exit status (1)


Command executed [/home/mbansal/.nextflow/assets/nf-core/riboseq/./workflows/riboseq/../../modules/nf-core/anota2seq/anota2seqrun/templates/anota2seqrun.r]:

  #!/usr/bin/env Rscript
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Check for Non-Empty, Non-Whitespace String
  #'
  #' This function checks if the input is non-NULL and contains more than just whitespace.
  #' It returns TRUE if the input is a non-empty, non-whitespace string, and FALSE otherwise.
  #'
  #' @param input A variable to check.
  #' @return A logical value: TRUE if the input is a valid, non-empty, non-whitespace string; FALSE otherwise.
  #' @examples
  #' is_valid_string("Hello World") # Returns TRUE
  #' is_valid_string("   ")         # Returns FALSE
  #' is_valid_string(NULL)          # Returns FALSE
  
  is_valid_string <- function(input) {
      !is.null(input) && nzchar(trimws(input))
  }
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- lapply(args_list, function(x) scan(text=x, what='character', quiet = TRUE))
  
      # Ensure the option vectors are length 2 (key/ value) to catch empty ones
      args_vals <- lapply(args_vals, function(z){ length(z) <- 2; z})
  
      parsed_args <- structure(lapply(args_vals, function(x) x[2]), names = lapply(args_vals, function(x) x[1]))
      parsed_args[! is.na(parsed_args)]
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, check.names = TRUE){
  
      ext <- tolower(tail(strsplit(basename(file), split = "\\.")[[1]], 1))
  
      if (ext == "tsv" || ext == "txt") {
          separator <- "\t"
      } else if (ext == "csv") {
          separator <- ","
      } else {
          stop(paste("Unknown separator for", ext))
      }
  
      read.delim(
          file,
          sep = separator,
          header = header,
          row.names = row.names,
          check.names = check.names
      )
  }
  
  #' Round numeric dataframe columns to fixed decimal places by applying
  #' formatting and converting back to numerics
  #'
  #' @param dataframe A data frame
  #' @param columns Which columns to round (assumes all of them by default)
  #' @param digits How many decimal places to round to?
  #'
  #' @return output Data frame
  
  round_dataframe_columns <- function(df, columns = NULL, digits = 8){
      if (is.null(columns)){
          columns <- colnames(df)
      }
  
      df[,columns] <- format(
          data.frame(df[, columns], check.names = FALSE),
          nsmall = digits
      )
  
      # Convert columns back to numeric
  
      for (c in columns) {
          df[[c]][grep("^ *NA$", df[[c]])] <- NA
          df[[c]] <- as.numeric(df[[c]])
      }
      df
  }
  
  ################################################
  ################################################
  ## PARSE PARAMETERS FROM NEXTFLOW             ##
  ################################################
  ################################################
  
  # I've defined these in a single array like this so that we could go back to an
  # optparse-driven method in future with module bin/ directories, rather than
  # the template
  
  # Set defaults and classes
  
  opt <- list(
      output_prefix = ifelse('null' == 'null', 'SNORD133_vs_control', 'null'),
      count_file = 'salmon.merged.gene_counts_length_scaled.tsv',
      sample_file = 'samplesheet.csv',
      sample_treatment_col = 'sample_group',
      reference_level = 'control',
      target_level = 'SNORD133_knockout',
      sample_id_col = "sample",
      samples_pairing_col = NULL,
      samples_batch_col = NULL,
      subset_to_contrast_samples = FALSE,
      exclude_samples_col = NULL,
      exclude_samples_values = NULL,
      dataType = "RNAseq",             # for anota2seqDataSetFromMatrix
      normalize = TRUE,                # for anota2seqDataSetFromMatrix
      transformation = "TMM-log2",     # for anota2seqDataSetFromMatrix
      filterZeroGenes = TRUE,          # for anota2seqDataSetFromMatrix
      varCutOff = NULL,                # for anota2seqDataSetFromMatrix
      performQC = TRUE,                # for anota2seqRun
      onlyGroup = FALSE,               # for anota2seqRun
      performROT = TRUE,               # for anota2seqRun
      generateSingleGenePlots = FALSE, # for anota2seqRun
      analyzeBuffering = TRUE,         # for anota2seqRun
      analyzemRNA = TRUE,              # for anota2seqRun
      useRVM = TRUE,                   # for anota2seqRun
      correctionMethod = "BH",         # for anota2seqRun
      useProgBar = FALSE,              # for anota2seqRun
      getRVM = TRUE,                   # for anota2seqGetOutput
      output = 'full'                  # for anota2seqGetOutput
  )
  opt_types <- lapply(opt, class)
  
  # Apply parameter overrides
  
  args_opt <- parse_args('--subset_to_contrast_samples TRUE')
  for ( ao in names(args_opt)){
      if (! ao %in% names(opt)){
          stop(paste("Invalid option:", ao))
      }else{
  
          # Preserve classes from defaults where possible
          if (! is.null(opt[[ao]])){
              args_opt[[ao]] <- as(args_opt[[ao]], opt_types[[ao]])
          }
          opt[[ao]] <- args_opt[[ao]]
      }
  }
  
  # Check if required parameters have been provided
  
  required_opts <- c('sample_treatment_col', 'reference_level', 'target_level', 'output_prefix')
  missing <- required_opts[!unlist(lapply(opt[required_opts], is_valid_string)) | !required_opts %in% names(opt)]
  
  if (length(missing) > 0){
      stop(paste("Missing required options:", paste(missing, collapse=', ')))
  }
  
  # Check file inputs are valid
  
  for (file_input in c('count_file', 'sample_file')){
      if (! is_valid_string(opt[[file_input]])) {
          stop(paste("Please provide", file_input), call. = FALSE)
      }
  
      if (! file.exists(opt[[file_input]])){
          stop(paste0('Value of ', file_input, ': ', opt[[file_input]], ' is not a valid file'))
      }
  }
  
  ################################################
  ################################################
  ## Finish loading libraries                   ##
  ################################################
  ################################################
  
  library(anota2seq)
  
  ################################################
  ################################################
  ## READ IN COUNTS FILE AND SAMPLE METADATA    ##
  ################################################
  ################################################
  
  count.table <-
      read_delim_flexible(
          file = opt$count_file,
          header = TRUE,
          row.names = opt$gene_id_col,
          check.names = FALSE
      )
  sample.sheet <- read_delim_flexible(file = opt$sample_file)
  
  # Deal with spaces that may be in sample column
  opt$sample_id_col <- make.names(opt$sample_id_col)
  
  if (! opt$sample_id_col %in% colnames(sample.sheet)){
      stop(paste0("Specified sample ID column '", opt$sample_id_col, "' is not in the sample sheet"))
  }
  
  # Sample sheet can have duplicate rows for multiple sequencing runs, so uniqify
  # before assigning row names
  
  sample.sheet <- sample.sheet[! duplicated(sample.sheet[[opt$sample_id_col]]), ]
  rownames(sample.sheet) <- sample.sheet[[opt$sample_id_col]]
  
  # Check that all samples specified in the input sheet are present in the counts
  # table. Assuming they are, subset and sort the count table to match the sample
  # sheet
  
  missing_samples <-
      sample.sheet[!rownames(sample.sheet) %in% colnames(count.table), opt$sample_id_col]
  
  if (length(missing_samples) > 0) {
      stop(paste(
          length(missing_samples),
          'specified samples missing from count table:',
          paste(missing_samples, collapse = ',')
      ))
  } else{
      # Save any non-count data, will gene metadata etc we might need later
      noncount.table <-
          count.table[, !colnames(count.table) %in% rownames(sample.sheet), drop = FALSE]
      count.table <- count.table[, rownames(sample.sheet)]
  }
  
  ################################################
  ################################################
  ## CHECK CONTRAST SPECIFICATION               ##
  ################################################
  ################################################
  
  sample_treatment_col <- make.names(opt$sample_treatment_col)
  
  if (!sample_treatment_col %in% colnames(sample.sheet)) {
      stop(
          paste0(
          'Chosen contrast variable \"',
          sample_treatment_col,
          '\" not in sample sheet'
          )
      )
  } else if (any(!c(opt$reflevel, opt$treatlevel) %in% sample.sheet[[sample_treatment_col]])) {
      stop(
          paste(
          'Please choose reference and treatment levels that are present in the',
          sample_treatment_col,
          'column of the sample sheet'
          )
      )
  }
  
  # Optionally, subset to only the samples involved in the contrast
  
  if (opt$subset_to_contrast_samples){
      sample_selector <- sample.sheet[[sample_treatment_col]] %in% c(opt$target_level, opt$reference_level)
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  # Optionally, remove samples with specified values in a given field (probably
  # don't use this as well as the above)
  
  if ((is_valid_string(opt$exclude_samples_col)) && (is_valid_string(opt$exclude_samples_values))){
      exclude_values = unlist(strsplit(opt$exclude_samples_values, split = ';'))
  
      if (! opt$exclude_samples_col %in% colnames(sample.sheet)){
          stop(paste(opt$exclude_samples_col, ' specified to subset samples is not a valid sample sheet column'))
      }
  
      print(paste0('Excluding samples with values of ', opt$exclude_samples_values, ' in ', opt$exclude_samples_col))
      sample_selector <- ! sample.sheet[[opt$exclude_samples_col]] %in% exclude_values
  
      selected_samples <- sample.sheet[sample_selector, opt$sample_id_col]
      count.table <- count.table[, selected_samples]
      sample.sheet <- sample.sheet[selected_samples, ]
  }
  
  ################################################
  ################################################
  ## Run anota2seqRun()                         ##
  ################################################
  ################################################
  
  # Separate matrix into riboseq and rnaseq data
  
  riboseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'riboseq']
  rnaseq_samples <- sample.sheet[[opt$sample_id_col]][sample.sheet[['type']] == 'rnaseq']
  
  if (! is.null(opt$samples_pairing_col)){
      riboseq_samples <- riboseq_samples[order(sample.sheet[riboseq_samples, opt$samples_pairing_col])]
      rnaseq_samples <- rnaseq_samples[order(sample.sheet[rnaseq_samples, opt$samples_pairing_col])]
  }
  
  riboseq_data <- count.table[,riboseq_samples]
  rnaseq_data <- count.table[,rnaseq_samples]
  
  # Make the anota2seqDataSet
  
  anota2seqDataSetFromMatrix_args <- list(
      dataP = riboseq_data,
      dataT = rnaseq_data,
      phenoVec = sample.sheet[rnaseq_samples, opt$sample_treatment_col],
      dataType = opt$dataType,
      normalize = opt$normalize,
      transformation = opt$transformation,
      filterZeroGenes = opt$filterZeroGenes,
      varCutOff = opt$varCutOff
  )
  
  if (! is.null(opt$samples_batch_col)){
      anota2seqDataSetFromMatrix_args$batchVec <- samples[rnaseq_samples, opt$samples_batch_col]
  }
  
  ads <- do.call(anota2seqDataSetFromMatrix, anota2seqDataSetFromMatrix_args)
  
  # Run anota2seqRun
  
  contrast_matrix <- matrix(
      c(-1, 1),
      nrow = 2,
      dimnames = list(sort(c(opt$reference_level, opt$target_level)), NULL)
  )
                                                                                   
  ads <- anota2seqRun(
      ads,
      contrasts = contrast_matrix,
      performQC = opt$performQC,
      onlyGroup = opt$onlyGroup,
      performROT = opt$performROT,
      generateSingleGenePlots = opt$generateSingleGenePlots,
      analyzeBuffering = opt$analyzeBuffering,
      analyzemRNA = opt$analyzemRNA,
      useRVM = opt$useRVM,
      correctionMethod = opt$correctionMethod,
      useProgBar = FALSE
  )
  
  ################################################
  ################################################
  ## Generate outputs                           ##
  ################################################
  ################################################
  
  contrast.name <-
      paste(opt$target_level, opt$reference_level, sep = "_vs_")
  cat("Saving results for ", contrast.name, " ...
  ", sep = "")
  
  for (analysis in c("translated mRNA", "total mRNA", "translation", "buffering", "mRNA abundance")){
  
      output <- anota2seqGetOutput(
          ads,
          analysis = analysis,
          output = opt$output,
          getRVM = opt$getRVM,
          selContrast = 1
      )
  
      write.table(
          output,
          file = paste(opt$output_prefix, sub(' ', '_', analysis), 'anota2seq.results.tsv', sep = '.'),
          col.names = TRUE,
          row.names = FALSE,
          sep = '	',
          quote = FALSE
      )
  }
  
  # Fold change plot
  
  png(
      file = paste(opt$output_prefix, 'fold_change.png', sep = '.'),
      width = 720,
      height = 720
  )
  anota2seqPlotFC(
      ads,
      visualizeRegModes = "all",
      selContrast = 1,
      contrastName = contrast.name,
      plotToFile = FALSE
  )
  dev.off()
  
  # R object for other processes to use
  
  saveRDS(ads, file = paste(opt$output_prefix, 'Anota2seqDataSet.rds', sep = '.'))
  
  # Rename files files output by anota2seqPerformQC()
  
  sapply(list.files(pattern = "^ANOTA2SEQ_"), function(f) file.rename(f, sub("^ANOTA2SEQ_", paste0(opt$output_prefix, '.'), f)))
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink(paste(opt$output_prefix, "R_sessionInfo.log", sep = '.'))
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  anota2seq.version <- as.character(packageVersion('anota2seq'))
  
  writeLines(
      c(
          '"NFCORE_RIBOSEQ:RIBOSEQ:ANOTA2SEQ_ANOTA2SEQRUN":',
          paste('    bioconductor-anota2seq:', anota2seq.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error in anota2seqCheckInput(dataP, dataT, phenoVec, batchVec, NULL, "BH",  : 
    Number of columns for dataT and dataP must be identical.
  Calls: do.call -> <Anonymous> -> anota2seqCheckInput
  Execution halted

Work dir:
  /data/project/ding_lab/riboseq/work/f5/e60beabdc92c21be951212d1085ca4

Container:
  /data/project/ding_lab/riboseq/work/singularity/depot.galaxyproject.org-singularity-bioconductor-anota2seq-1.24.0--r43hdfd78af_0.img

Tip: you can try to figure out what's wrong by changing to the process work dir and showing the script file named `.command.sh`

 -- Check '.nextflow.log' file for details
ERROR ~ Pipeline failed. Please refer to troubleshooting docs: https://nf-co.re/docs/usage/troubleshooting

 -- Check '.nextflow.log' file for details
