GithubHelp home page GithubHelp logo

nf-core / differentialabundance Goto Github PK

View Code? Open in Web Editor NEW
45.0 141.0 24.0 7.95 MB

Differential abundance analysis for feature/ observation matrices from platforms such as RNA-seq

Home Page: https://nf-co.re/differentialabundance

License: MIT License

HTML 1.89% Nextflow 97.29% CSS 0.83%
nextflow nf-core pipeline workflow atac-seq chip-seq deseq2 differential-abundance differential-expression gsea limma microarray rna-seq shiny

differentialabundance's Introduction

nf-core/differentialabundance

GitHub Actions CI Status GitHub Actions Linting StatusAWS CICite with Zenodo nf-test

Nextflow run with conda run with docker run with singularity Launch on Seqera Platform

Get help on SlackFollow on TwitterFollow on MastodonWatch on YouTube

Introduction

nf-core/differentialabundance is a bioinformatics pipeline that can be used to analyse data represented as matrices, comparing groups of observations to generate differential statistics and downstream analyses. The pipeline supports RNA-seq data such as that generated by the nf-core rnaseq workflow, and Affymetrix arrays via .CEL files. Other types of matrix may also work with appropriate changes to parameters, and PRs to support additional specific modalities are welcomed.

The pipeline is built using Nextflow, a workflow tool to run tasks across multiple compute infrastructures in a very portable manner. It uses Docker/Singularity containers making installation trivial and results highly reproducible. The Nextflow DSL2 implementation of this pipeline uses one container per process which makes it much easier to maintain and update software dependencies. Where possible, these processes have been submitted to and installed from nf-core/modules in order to make them available to all nf-core pipelines, and to everyone within the Nextflow community!

On release, automated continuous integration tests run the pipeline on a full-sized dataset on the AWS cloud infrastructure. This ensures that the pipeline runs on AWS, has sensible resource allocation defaults set to run on real-world datasets, and permits the persistent storage of results to benchmark between pipeline releases and other analysis sources. The results obtained from the full-sized test can be viewed on the nf-core website.

Pipeline summary

nf-core/differentialabundance metro map

  1. Optionally generate a list of genomic feature annotations using the input GTF file (if a table is not explicitly supplied).
  2. Cross-check matrices, sample annotations, feature set and contrasts to ensure consistency.
  3. Run differential analysis over all contrasts specified.
  4. Optionally run a differential gene set analysis.
  5. Generate exploratory and differential analysis plots for interpretation.
  6. Optionally build and (if specified) deploy a Shiny app for fully interactive mining of results.
  7. Build an HTML report based on R markdown, with interactive plots (where possible) and tables.

Usage

Note

If you are new to Nextflow and nf-core, please refer to this page on how to set-up Nextflow. Make sure to test your setup with -profile test before running the workflow on actual data.

RNA-seq:

 nextflow run nf-core/differentialabundance \
     --input samplesheet.csv \
     --contrasts contrasts.csv \
     --matrix assay_matrix.tsv \
     --gtf mouse.gtf \
     --outdir <OUTDIR>  \
     -profile rnaseq,<docker/singularity/podman/shifter/charliecloud/conda/institute>

:::note If you are using the outputs of the nf-core rnaseq workflow as input here either:

  • supply the raw count matrices (file names like gene_counts.tsv) alongide the transcript length matrix via --transcript_length_matrix (rnaseq versions >=3.12.0, preferred)
  • or supply the gene_counts_length_scaled.tsv or gene_counts_scaled.tsv matrices.

See the usage documentation for more information. :::

Affymetrix microarray:

 nextflow run nf-core/differentialabundance \
     --input samplesheet.csv \
     --contrasts contrasts.csv \
     --affy_cel_files_archive cel_files.tar \
     --outdir <OUTDIR>  \
     -profile affy,<docker/singularity/podman/shifter/charliecloud/conda/institute>

Warning

Please provide pipeline parameters via the CLI or Nextflow -params-file option. Custom config files including those provided by the -c Nextflow option can be used to provide any configuration except for parameters; see docs.

For more details and further functionality, please refer to the usage documentation and the parameter documentation.

Reporting

The pipeline reports its outcomes in two forms.

R markdown and HTML

The primary workflow output is an HTML-format report produced from an R markdown template (you can also supply your own). This leverages helper functions from shinyngs to produce rich plots and tables, but does not provide significant interactivity.

screenshot of the markdown report

Additionally, a zip file is produced by the pipeline, containing an R markdown file and all necessary file inputs for reporting. The markdown file is the same as the input template, but with the parameters set appropriately, so that you can run the reporting yourself in RStudio, and add any customisations you need.

Shiny-based data mining app

A second optional output is produced by leveraging shinyngs to build an interactive Shiny application. This allows more interaction with the data, setting of thresholds etc.

screenshot of the ShinyNGS contrast table

screenshot of the ShinyNGS gene plot

By default the application is provided as an R script and associated serialised data structure, which you can use to quickly start the application locally. With proper configuration the app can also be deployed to shinyapps.io - though this requires you to have an account on that service (free tier available).

Pipeline output

To see the results of an example test run with a full size dataset refer to the results tab on the nf-core website pipeline page. For more details about the output files and reports, please refer to the output documentation.

Credits

nf-core/differentialabundance was originally written by Jonathan Manning (@pinin4fjords) and Oskar Wacker (@WackerO). Jonathan Manning (now at Seqera) initially worked on this workflow as an employee of Healx, an AI-powered, patient-inspired tech company, accelerating the discovery and development of treatments for rare diseases. Oskar Wacker works for QBiC at Tübingen University. We are grateful for the support of open science in this project.

We thank the many members of the nf-core community who assisted with this pipeline, often by reviewing module pull requests including but not limited to:

Contributions and Support

If you would like to contribute to this pipeline, please see the contributing guidelines.

For further information or help, don't hesitate to get in touch on the Slack #differentialabundance channel (you can join with this invite).

Citations

If you use nf-core/differentialabundance for your analysis, please cite it using the following doi: 10.5281/zenodo.7568000.

An extensive list of references for the tools used by the pipeline can be found in the CITATIONS.md file.

This pipeline uses code and infrastructure developed and maintained by the nf-core community, reused here under the MIT license.

You can cite the nf-core publication as follows:

The nf-core framework for community-curated bioinformatics pipelines.

Philip Ewels, Alexander Peltzer, Sven Fillinger, Harshil Patel, Johannes Alneberg, Andreas Wilm, Maxime Ulysse Garcia, Paolo Di Tommaso & Sven Nahnsen.

Nat Biotechnol. 2020 Feb 13. doi: 10.1038/s41587-020-0439-x.

differentialabundance's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

differentialabundance's Issues

Over-representation analysis in addition to GSEA

Description of feature

As far as I can tell the differentialabundance pipeline currently performs gene set enrichment analysis using the gsea-cli. It would be great to additionally support gene set analysis using a simple over-representation test (ORA, aka Fisher's exact test) based on the differential gene expression results.

ORA is very easy to compute and to interpret and has therefore been recommended in Geistlinger et al's benchmark paper.

Another advantage of basing the results on the list of differentially expressed genes is that the GSEA cli does not seem to model covariates. By using the DE genes the results are automatically accounted for an arbitrary design specified to DESeq2.

Possible implementation

Using the clusterProfiler package, more specifically:

P.S. clusterProfiler also implements GSEA based on a ranked gene list derived from differential expression analysis. I expect this is both faster than the GSEA cli and (being based on the corresponding DE gene list) takes covariates into account.

Transcription factor and Pathway scoring using DoRothEA/PROGENy

Description of feature

  • DoRothEA provides curated transciption factor activation signatures
  • PROGENy provides high-quality cancer pathway signatures that are based on "pathway responsive genes". This is superior over using e.g. KEGG pathways as the signatures are derived from perturbation experiments. As opposed to genes in a pathway (which might not change expression but just be phosphorylated), we actually know that the signature gene change on the mRNA level.

Dorothea may be useful for all sorts of samples, PROGENy is mostly useful in the field of (immuno-)oncology, but it could still make sense to include it as an optional step in the pipeline.

Possible implementation

Use decoupler (there is both an R version and a Python version) to compute Dorothea and Progeny scores based on the results of the differential gene expression analysis. Include plots such as this one in the MultiQC report:

(from https://decoupler-py.readthedocs.io/en/latest/notebooks/bulk.html)

Complete docs- README etc

Description of feature

Once all the MVP functionality is added, we should document it before first release.

Allow affy array processing

Description of feature

Add array processing via two new modules:

  • affy/readaffy (or possibly affy/justrma) - CEL to expression matrix
  • QC?
  • limma/differential - differential analysis analagous to DESeq2

I'm still weighing up if it makes sense to have a separate array workflow.

update citations

Description of feature

Before we release we should make sure that any appropriate citations are in the report file.

Add filtering module

Description of feature

We need a module for configurable pre-filtering before running differential analysis.

This should be as generic as possible, taking a matrix, a threshold value, and a number or proportion of samples to which that filter should apply.

In my experience, a filter should made to apply to a number of samples relating to the minimum group size, but NOT be applied with an awareness of what those groups are (this can lead to artefacts).

This may well be a trivial R script added as a template, and I think I already have some proven code we can use.

Add batch correction

Description of feature

I'll start working on a module for this using limma as in rnadeseq

Shouldn't be re-using the single exploratory palette across multiple informative variables

Description of the bug

In recent reporting updates I added looping to generate different colourings of e.g. the clustering dendrogram by different informative variables. Unfortunately I forgot to make the palette variable-dependent, leading to https://nfcore.slack.com/archives/C045UNCS5R9/p1679498784311969

Command used and terminal output

No response

Relevant files

No response

System information

No response

Reduce file size for report

Description of feature

(sorry @WackerO , you were right!)

I'm noticing my browser having trouble coping with reports (even if they are only 30Mb or so).

We may have to do some sensible truncation of the d/e tables etc, and take steps to reduce the size of the HTML associated with different plots (maybe some rounding is in order).

Differential splicing analysis using rMATS

Description of feature

Differential splicing is a frequent consequence observed in RNA-Seq data. rMATS (https://rnaseq-mats.sourceforge.net/) is the most frequently used analysis tool, providing outputs for skipped exons, alternative 5' and 3' splice sites, mutually exclusive exons, and retained introns. Performing this analysis (and maybe some overview plots, like violin plots of the delta "percent spliced in" deltaPSI metric) would be an important new feature.
Thanks for working on this great new pipeline.

Sample check failure with names including '-' symbol

Description of the bug

Pipeline failing with input and matrix sample names including "-" character on CUSTOM_MATRIXFILTER step, error gives all names of samples with "-" ID. When I check the work folder for the process, the names in each of the files have had "-" changed to ".", but I think this might be being compared to the original names and failing?

If I change names with sed in input and matrix file to remove "-", the pipeline continues without error.

Command used and terminal output

nextflow run nf-core/differentialabundance \
	-profile singularity \
	-r dev \
	--input diffabundance/inputs/samplesheet.csv \
	--contrasts diffabundance/inputs/serCan_contrasts.csv \
	--matrix diffabundance/inputs/data/rsem.merged.transcript_counts.tsv \
	--gtf reference/serCan2020/serCan2020_no_genes.gtf \
        -w diffabundance/work \
	--features_id_col 'transcript_id' \
	--outdir diffabundance/results \
	--max_memory '160.GB' \
	--deseq2_cores 8 \
	-resume

# output:
executor >  local (2)
[32/9bd716] process > NFCORE_DIFFERENTIALABUNDANC... [100%] 1 of 1, cached: 1 ✔
[52/70c121] process > NFCORE_DIFFERENTIALABUNDANC... [100%] 1 of 1 ✔
[ed/3225f0] process > NFCORE_DIFFERENTIALABUNDANC... [100%] 1 of 1, failed: 1 ✘
[-        ] process > NFCORE_DIFFERENTIALABUNDANC... -
[-        ] process > NFCORE_DIFFERENTIALABUNDANC... -
[-        ] process > NFCORE_DIFFERENTIALABUNDANC... -
[-        ] process > NFCORE_DIFFERENTIALABUNDANC... -
[-        ] process > NFCORE_DIFFERENTIALABUNDANC... -
Execution cancelled -- Finishing pending tasks before exit
-[nf-core/differentialabundance] Pipeline completed with errors-
Error executing process > 'NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_MATRIXFILTER ([id:study])'

Caused by:
  Process `NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_MATRIXFILTER ([id:study])` terminated with an error exit status (1)

Command executed [/.nextflow/assets/nf-core/differentialabundance/./workflows/../modules/nf-core/custom/matrixfilter/templates/matrixfilter.R]:

  #!/usr/bin/env Rscript
  
  # Filter rows based on the number of columns passing the abundance threshold. By
  # default this will be any row with a value of 1 or more, which would be a
  # permissive threshold for RNA-seq data.
  #
  # In RNA-seq studies it's often not enough to just remove genes not expressed in
  # any sample. We also want to remove anything likely to be part of noise, or
  # which has sufficiently low expression that differential analysis would not be
  # useful. For that reason we might require a higher threshold than 1, and
  # require that more than one sample passes.
  #
  # Often we want to know that a gene is expressed in a substantial enough number
  # of sample that differential analysis worthwhile, so we may pick a threshold
  # sample number related to group size. Note that we do not filter with an
  # awareness of the groups themselves, since this adds bias towards discovery
  # between those groups.
  
  ################################################
  ################################################
  ## Functions                                  ##
  ################################################
  ################################################
  
  #' Parse out options from a string without recourse to optparse
  #'
  #' @param x Long-form argument list like --opt1 val1 --opt2 val2
  #' @param opt_defaults A lis with default argument values
  #'
  #' @return named list of options and values similar to optparse
  
  parse_args <- function(x, opt_defaults){
      args_list <- unlist(strsplit(x, ' ?--')[[1]])[-1]
      args_vals <- unlist(lapply(args_list, function(y) strsplit(y, ' +')), recursive = FALSE)
  
      # 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)]
  
      # Now apply CLI options to override defaults
  
      opt_types <- lapply(opt_defaults, class)
  
      for ( ao in names(parsed_args)){
          if (! ao %in% names(opt_defaults)){
              stop(paste("Invalid option:", ao))
          }else{
  
              # Preserve classes from defaults where possible
              if (! is.null(opt_defaults[[ao]])){
                  parsed_args[[ao]] <- as(parsed_args[[ao]], opt_types[[ao]])
              }
              opt_defaults[[ao]] <- parsed_args[[ao]]
          }
      }
      opt_defaults
  }
  
  #' Flexibly read CSV or TSV files
  #'
  #' @param file Input file
  #' @param header Passed to read.delim()
  #' @param row.names Passed to read.delim()
  #' @param nrows Passed to read.delim()
  #'
  #' @return output Data frame
  
  read_delim_flexible <- function(file, header = TRUE, row.names = NULL, nrows = -1 ){
  
      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
      )
  }
  
  # Set up default options
  
  opt <- list(
      abundance_matrix_file = 'rsem.merged.transcript_counts.assay.tsv',
      sample_file = 'samplesheet.sample_metadata.tsv',
      minimum_abundance = 1,
      minimum_samples = 1,
      minimum_proportion = 0,
      grouping_variable = NULL
  )
  
  opt <- parse_args('--minimum_samples 1 --minimum_abundance 1', opt)
  
  abundance_matrix <- read_delim_flexible(opt$abundance_matrix_file, row.names = 1)
  feature_id_name <- colnames( read_delim_flexible(opt$abundance_matrix_file, nrows = 1)[1])
  
  # If a sample sheet was specified, validate the matrix against it
  
  if (opt$sample_file != ''){
  
      # Read the sample sheet and check against matrix
  
      samplesheet <- read_delim_flexible(opt$sample_file, row.names = 1)
      missing_samples <- setdiff(rownames(samplesheet), colnames(abundance_matrix))
  
      if (length(missing_samples) > 0){
          stop(
              paste(
                  paste(missing_samples, collapse = ', '),
                  'not represented in supplied abundance matrix'
              )
          )
      }else{
          abundance_matrix <- abundance_matrix[,rownames(samplesheet)]
      }
  }else{
  
      # If we're not using a sample sheet to select columns, then at least make
      # sure the ones we have are numeric (some upstream things like the RNA-seq
      # workflow have annotation colummns as well)
  
      numeric_columns <- unlist(lapply(1:ncol(abundance_matrix), function(x) is.numeric(abundance_matrix[,x])))
      abundance_matrix <- abundance_matrix[,numeric_columns]
  }
  
  # If we want to define n based on the levels of a grouping variable...
  
  if ((opt$sample_file != '') && ( ! is.null(opt$grouping_variable))){
  
      # Pick a minimum number of samples to pass threshold based on group size
  
      if (! opt$grouping_variable %in% colnames(samplesheet)){
          stop(paste(opt$grouping_variable, "not in supplied sample sheet"))
      }else{
          opt$minimum_samples <- min(table(samplesheet[[opt$grouping_variable]]))
          if ( opt$minimum_proportion > 0){
              opt$minimum_samples <- opt$minimum_samples * opt$minimum_proportion
          }
      }
  }else if (opt$minimum_proportion > 0){
  
      # Or if we want to define it based on a static proportion of the sample number
  
      opt$minimum_samples <- ncol(abundance_matrix) * opt$minimum_proportion
  }
  
  # Generate a boolean vector specifying the features to retain
  
  keep <- apply(abundance_matrix, 1, function(x){
      sum(x > opt$minimum_abundance) >= opt$minimum_samples
  })
  
  # Write out the matrix retaining the specified rows and re-prepending the
  # column with the feature identifiers
  
  prefix = ifelse('study' == 'null', '', 'study')
  
  write.table(
      data.frame(rownames(abundance_matrix)[keep], abundance_matrix[keep,,drop = FALSE]),
      file = paste0(
          prefix,
          '.filtered.tsv'
      ),
      col.names = c(feature_id_name, colnames(abundance_matrix)),
      row.names = FALSE,
      sep = '	',
      quote = FALSE
  )
  
  ################################################
  ################################################
  ## R SESSION INFO                             ##
  ################################################
  ################################################
  
  sink("R_sessionInfo.log")
  print(sessionInfo())
  sink()
  
  ################################################
  ################################################
  ## VERSIONS FILE                              ##
  ################################################
  ################################################
  
  r.version <- strsplit(version[['version.string']], ' ')[[1]][3]
  
  writeLines(
      c(
          '"NFCORE_DIFFERENTIALABUNDANCE:DIFFERENTIALABUNDANCE:CUSTOM_MATRIXFILTER":',
          paste('    r-base:', r.version)
      ),
  'versions.yml')
  
  ################################################
  ################################################
  ################################################
  ################################################

Command exit status:
  1

Command output:
  (empty)

Command error:
  Error: ES1_48_Control-lipid_0, ES2_48_Control-lipid_14, ES3_48_Control-lipid_21, ES4_164_Control-protein_0, ES5_164_Control-protein_14, ES6_164_Control-protein_21, ES7_SEM19-1354_Control-protein_14, ES8_SEM19-1354_Control-protein_21, ES9_172_Control-protein_0, ES10_172_Control-protein_14, ES11_172_Control-protein_21, ES12_209_MG-lipid_0, ES13_209_MG-lipid_14, ES14_209_MG-lipid_21, ES15_601_Control-protein_14, ES16_601_Control-protein_21, ES17_615_Control-protein_0, ES18_615_Control-protein_14, ES19_615_Control-protein_21, ES20_618_Control-lipid_0, ES21_618_Control-lipid_14, ES22_618_Control-lipid_21, ES23_Blue-010_Control-lipid_0, ES24_Blue-010_Control-lipid_21, ES25_619_MG-lipid_0, ES26_619_MG-lipid_14, ES27_619_MG-lipid_21, ES103_625_Control-lipid_0, ES104_625_Control-lipid_14, ES105_625_Control-lipid_21, ES31_Blue-055_MG-protein_0, ES32_Blue-055_MG-protein_14, ES33_101-LS_MG-lipid_0, ES34_101-LS_MG-lipid_14, ES35_101-LS_MG-lipid_21, ES36_AR17-21_MG-lipid_0, ES37_AR17-21_MG-lipid_14,
  Execution halted

Work dir:
  diffabundance/work/ed/3225f0361d750970c0c0439ac3407c

Tip: view the complete command output by changing to the process work dir and entering the command `cat .command.out`

Relevant files

command_files.tgz

System information

Nextflow version 22.10.1
Hardware HPC
Executor slurm
Container engine: Singularity
OS Linux
Version of nf-core/differentialabundance: dev

Handle spike sequences correctly

Description of feature

Where quantification has been undertaken in the presence of technical controls (e.g ERCC spikes with RNA-seq), then this workflow should be able to handle those controls effectively.

This should involve supplying a list of technical control feature names for handling by the appropriate modules (e.g. DESeq2 for RNA-seq).

Issue for module level change required in DESeq2 is nf-core/modules#2440

Shiny app generation doesn't work for arrays

Description of the bug

The app-building script from shinyngs was not distinguishing feature IDs used in matrices and differential tables, and these are different in the array pathway through the workflow. This is now fixed upstream, but will remain broken here until the next release of shinyngs and deployment here.

Command used and terminal output

No response

Relevant files

No response

System information

No response

Add shiny app generation

Description of feature

Add an option for actually building Shiny apps with ShinyNGS (rather than just re-using shinyngs functions as we do now).

Define inputs and file types

Description of feature

An initial workflow starting point defining the base structure and inputs/ outputs, to be agreed on during PR.

Color palette includes hard to read bright yellow

Description of the bug

The color palette used for plots includes yellow which is hard to see on white background, e.g. in pca2d. Maybe only an issue with many conditions.

grafik

Command used and terminal output

No response

Relevant files

No response

System information

No response

Plot differentially expressed genes by Biotype

Description of feature

I find it useful to assess the result of the DE analysis by plotting the number of differentially expressed genes by gene type. If the majority is not protein coding, it is usually a sign that something is not right.

Therefore, I suggest to add a plot like the following to the MultiQC report.

Gene types are typically available from the GTF file.

Allow or switch to GSEA preranked

Description of feature

Currently I'm connecting up the GSEA module in its basic mode whereby expression matrices and classes are supplied. In future we should exploit the fold change estimates from DESeq2 instead.

This will require:

  1. A new module (GSEA/PRERANKED alongside the current GSEA/GSEA)
  2. Matrices with identifiers already 'collapsed' to the IDs used in the gene sets (might need little local module to do that from the annotation table)

Box plot alternative for larger sample numbers

Description of feature

The report currently generates boxplots that look like

boxplot

This is not going to work for larger sample numbers. Minimally the faceting needs to switch to row-wise (which I need to do in the upstream shinyngs package I think), but ultimately we need an alternative we can use instead, or switch to at larger 'N' values.

One option is a line-based alternative I've used before:

Screenshot 2022-12-14 at 18 45 49

... but it's open to discussion.

Make GTF optional

Description of feature

At the moment the pipeline is written mostly for genomics context as it requires a GTF to be provided as mandatory input. This limits applications for other use cases where such a file might not be available. There could be potential solutions to this:

  • Limit applications, e.g. do not run parts of the pipeline that use the GTF
  • Allow different types of "annotation information", e.g. a plain TSV / similar that allows annotating features accordingly, thereby enabling use of the same functionality for other domains (proteomics, nanostring, ...)

Add BioQC to identify tissue heterogeneity

Description of feature

It would be useful to add BioQC as an analysis module and the output to the MultiQC report.

(Disclaimer: I'm a coauthor on the BioQC paper)

What is this good for

BioQC helps identifying "tissue heterogeneity" in samples, i.e. it is a check if there are traces of tissues in a sample that you wouldn't expect to be there and that may bias the results. It could be caused by contamination, unprecise resection of tissue, but also biological factors such as immune-cell infiltration. In the most extreme case mislabelled can be identified. In another publication we showed that (depending on the tissue) 1-40% of samples are affected, so it definitely makes sense to check this routinely.

How does it work

Essentially this is a single-sample gene set enrichment analysis using tissue-specific gene signatures. The BioQC R package provides both tissue signatures and a very fast implementation of a ssGSEA based on a wilcoxon test.

Solution I'd like to see in differntialabundance

Include a heatmap with the signature scores in the multiQC report. Here's an example heatmap how this looked on a real-world dataset of mouse biopsies from different tissues with tree different treatments:

In this case, it looks quite good, but there seems to be a slight pancreas contaimation in Sample POOLAM1-13. This might also appear as an outlier in a PCA, but using this heatmap we can actually explain the additional variance.

Add sparse matrix input

Description of feature

Large-scale applications such as those we may develop in future will needs sparse matrix input. To include:

  • matrix market format (.mtx)
  • HDF5 flavours such as annData

Gene set analysis

Description of feature

Probably a basic part of any differential analysis (particularly in expression) is a gene set analysis. I propose we have a module for the Broad's GSEA if it's feasible.

Module-level issue nf-core/modules#2584.

Allow use of different primary feature identifier in outputs

Description of feature

It is sometimes useful to use a different primary feature identifier in output files than the one from the input matrix. We should allow that conversion to happen as part of processing.

I imagine this being a simple local module that remaps matrix identifiers early on in the workflow by referencing the feature annotation table.

Establish outputs/ reports

Description of feature

I'm unsure on the detail of how to implement this due to lack of nf-core experience, but we'll need to set up the final reporting (ideally visible in Tower), presenting the results of the differential analysis in an interpretable way.

MultiQC integration?

Add subway map for documentation

Description of feature

I admit, I've been avoiding doing it (I hate faffing around with graphics suites), but it would be nice to have the subway diagram for the next release, particularly if we have increased the complexity somewhat by then.

Allow multiple gene sets for GSEA

Description of feature

Currently it is possible to specify a single gmt file for gene signatures. I would find it useful if it was possible to specify multiple sets of gene signatures (e.g. KEGG, HALLMARK, GO biological process, GO molecular functions, and that these manually curated gene sets I got from the collaborator).

They should also appear as separate tables in the MultiQC report.

Add differential plotting

Description of feature

To include volcano plots etc.

I have a script in shinyngs to do this I'm going to wrap in a module as a possible candidate.

Add input checking

Description of feature

We need to ensure the consistency of inputs- that sets of feature and sample annotation are consistent with supplied matrices and contrast definitions.

There is the QBiC scripts, or I have a feature/ observation matrix checking module in implementation at nf-core/modules#2392.

Implement nf-test

Description of feature

I'm going to switch the github ci to pytest-workflow so that github can monitor the consistency of pipeline output instead of just checking that PRs don't make the pipeline fail

Error when contrast is blocking by multiple variables

Description of the bug

Contrasts that have multiple blocking variables separated by ";" results in an error where the corresponding file is not found, appears the ";" is not being replaced with a "_" in the file name.

Command used and terminal output

nextflow run nf-core/differentialabundance \
	-profile singularity \
	-r 1.0.1 \
	--input samplesheet.csv \
	--contrasts contrasts.csv \
	--matrix rsem.merged.gene_counts.tsv \
	--gtf ensembl_genome/S288C.gtf \
        -w work_core \
	--features_id_col 'gene_id' \
	--outdir results_test \
	-resume


# content of .command.err;  occurred during chunk 8 of Rmd knitting.
processing file: study.Rmd
Quitting from lines 307-342 (study.Rmd) 
Error in FUN(X[[i]], ...) : 
  Differential file .//genotype-WT-GENE-strain;stress.deseq2.results.tsv does not exist
Calls: <Anonymous> ... eval_with_user_handlers -> eval -> eval -> lapply -> lapply -> FUN
Execution halted

Relevant files

No response

System information

Nextflow version 22.10.1
Hardware: HPC
Executor: slurm
Container engine: Singularity
OS: Linux
Version: nf-core/differentialabundance 1.0.1

Gene counts for multiple threshold sets

Description of feature

Right now, the final report lists differential gene counts for a single threshold set of p value, fold change. It would be useful to generate the statistics for multiple sets of thresholds.

Complete minimal report content

Description of feature

Reporting infrastructure was added in #19.

We need sufficient reporting content in the .Rmd to support a first release.

@WackerO - I know you have a vested interest in the report so I think this might be an exception where we do work on the same issue via separate PRs.

I'll try to make fairly granular PRs to the markdown file as I add sections to support this and keep conflicts manageable.

Allow multiple report files

Description of feature

It would be useful if the pipeline allowed multiple reports to be generated. In-house we have the need to use different formulations of the results for different purposes.

Add an `observation_name_col` parameter

Description of feature

The underlying issue @WackerO was trying to tackle in #62 is a mismatch between column headers of an expression matrix and the rows of a sample sheet. This can be more simply fixed by including the relevant data in the sample sheet (for example the bam file name output by featurecounts in the column header), and setting the appropriate observation_id_col in the workflow parameters.

The down-side of this is that all the plots etc will have the filenames, which is less than ideal.

Analagous to the existing feature_name_col, we need an observation_name_col that will allow us to use a different display name for samples than the one used in the expression matrix.

This will also require some upstream changes in shinyngs.

Allow for subsetting of samples for specific contrasts

Description of feature

There are situations when blocking can lead to non-full rank matrices in DESeq2 unless the data are subset to specific samples (e.g. when some samples are paired and these need to be compared, but there are other samples without pairing).

This request is for a feature to subset to samples for specific contrasts.

This could potentially be done by providing a single boolean option for a contrast to subset the data to only samples involved in the contrast (which may be otherwise useful), or providing a reference to another column in the sample sheet that specifies which samples to include.

Add differential analysis

Description of feature

Connect input checking to differential analysis. For RNA-seq this will be deseq2/differential.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.