Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in exploratory plots with --differential_subset_to_contrast_samples #418

Open
sci-kai opened this issue Jan 6, 2025 · 0 comments
Open
Labels
bug Something isn't working

Comments

@sci-kai
Copy link

sci-kai commented Jan 6, 2025

Description of the bug

Hi, I ran the nf-core differentialabundance pipeline with nf-core/rnaseq output, 6 different contrasts defined in contrasts.csv and the parameter --differential_subset_to_contrast_samples .
I get the following error message (I removed the samplenames for privacy reasons):

Error executing process > 'NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:PLOT_EXPLORATORY (condition)'

Caused by:
  Process `NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:PLOT_EXPLORATORY (condition)` terminated with an error exit status (1)


Command executed:

  exploratory_plots.R \
      --sample_metadata "samplesheet.sample_metadata.tsv" \
      --feature_metadata "Homo_sapiens.anno.feature_metadata.tsv" \
      --assay_files "salmon.merged.gene_counts.assay.tsv,all.normalised_counts.tsv,all.vst.tsv" \
      --contrast_variable "condition" \
      --outdir "condition" \
      --sample_id_col "sample" --feature_id_col "gene_id" --assay_names "raw,normalised,variance_stabilised" --final_assay "variance_stabilised" --outlier_mad_threshold -5 --palette_name "Set1" --log2_assays "raw,normalised"
  
  cat <<-END_VERSIONS > versions.yml
  "NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:PLOT_EXPLORATORY":
      r-shinyngs: $(Rscript -e "library(shinyngs); cat(as.character(packageVersion('shinyngs')))")
  END_VERSIONS

Command exit status:
  1

Command output:
  [1] "Reading inputs..."

Command error:
      table, tapply, union, unique, unsplit, which.max, which.min
  
  Loading required package: S4Vectors
  
  Attaching package: ‘S4Vectors’
  
  The following object is masked from ‘package:utils’:
  
      findMatches
  
  The following objects are masked from ‘package:base’:
  
      expand.grid, I, unname
  
  Loading required package: IRanges
  Loading required package: GenomeInfoDb
  Loading required package: Biobase
  Welcome to Bioconductor
  
      Vignettes contain introductory material; view with
      'browseVignettes()'. To cite Bioconductor, see
      'citation("Biobase")', and for packages 'citation("pkgname")'.
  
  
  Attaching package: ‘Biobase’
  
  The following object is masked from ‘package:MatrixGenerics’:
  
      rowMedians
  
  The following objects are masked from ‘package:matrixStats’:
  
      anyMissing, rowMedians
  
  
  Attaching package: ‘shinyngs’
  
  The following object is masked from ‘package:MatrixGenerics’:
  
      colMedians
  
  The following object is masked from ‘package:matrixStats’:
  
      colMedians
  
  Error in h(simpleError(msg, call)) : 
    error in evaluating the argument 'object' in selecting a method for function 'na.omit': Some sample metadata names ({here was a list of samplenames}
  Calls: lapply -> lapply -> FUN -> na.omit -> read_matrix
  Execution halted
  INFO:    Cleaning up image...

Work dir:
  /differentialabundance_subsetcontrasts/work/6a/8581fed49925b45df360cb03bf6bd0

Tip: you can replicate the issue by changing to the process work dir and entering the command `bash .command.run`

I found the error to be the following:
The samplesheet.sample_metadata.tsv contains all samplenames, while the normalised counts file all.normalised_counts.tsv only contains samples that are defined as contrasts.
Line 190 in the exploratory_plots.R file therefore gives an error, as the assay file has less columns as specified in sample_metadata.

assay_data <- lapply(assay_files, function(x) {
  na.omit(
    read_matrix(
      x,
      sample_metadata = sample_metadata,
      feature_metadata = feature_metadata,
      row.names = 1
    )
  )
})

I propose a solution could be to subset the samplesheets for each contrast when --differential_subset_to_contrast_samples is enabled and supply to this process.

Command used and terminal output

nextflow run nf-core-differentialabundance_1.5.0/1_5_0 \
-profile singularity,hilbert,offline \
-c config/differentialabundance/run-differentialabundance.config \
-params-file config/differentialabundance/nf-params.json \
-plugins [email protected] \
--differential_subset_to_contrast_samples

Relevant files

nf-params.json:

{
  "study_name": "mosaik",
  "input": "config/differentialabundance/samplesheet.csv",
  "contrasts": "config/differentialabundance/contrasts.csv",
  "outdir": "results",
  "matrix": "results_summary/salmon.merged.gene_counts.tsv",
  "transcript_length_matrix": "results_summary/salmon.merged.gene_lengths.tsv",
  "gsea_run": true,
  "gsea_zip_report": true,
  "gene_sets_files": "db/msigdb/merged/c1_c2cp_c5hpo_c5gobp.v2024.1.Hs.symbols.gmt",
  "genome": "GRCh38",
  "gtf": "db/rnaseq_ensemble_reference/Homo_sapiens.GRCh38.112.gtf.gz"
}

profile hilbert & offline:

  hilbert {
        params {
            config_profile_description = 'HILBERT'
            // HPC job resources
            max_memory = 200.GB
            max_cpus = 32
            max_time = 72.h
        }
        process {
            executor = 'pbspro'
            module = 'Singularity/3.7.1'
            queuesize = 100
        }
    }
    offline {
        // reduce the pulltimeout so that you don't need to wait 20 minutes for error message of failed singularity pullTimeout (if workflow accidentally tries to do so)
        apptainer.pullTimeout = '1s'
        singularity.pullTimeout = '1s'
        charliecloud.pullTimeout = '1s'
    }

System information

nextflow version: 24.04.4
version: 1.5.0

@sci-kai sci-kai added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant