nf-core/scrnaseq

repository·master·Indexed 43 days ago

https://github.com/nf-core/scrnaseq

A best-practice bioinformatics pipeline for processing 10x Genomics single-cell RNA-seq data. It supports multiple alignment and quantification engines, including Cellranger, STARSolo, Alevin-Fry (SimpleAF), and Kallisto + BUStools. The pipeline includes tools for FASTQ renaming, GTF filtering, and Seurat-based postprocessing.

Tokens
10.5K
Snippets
30
Records
59
Agent score
57%

What's inside nf-core/scrnaseq

  1. Overview of nf-core/scrnaseq

    master

    nf-core/scrnaseq

    nf-core/scrnaseq is a bioinformatics best-practice analysis pipeline designed for processing 10x Genomics single-cell RNA-seq data. It is a community-driven project that supports multiple alignment and quantification methods, allowing users to choose the workflow that best fits their analysis needs.

    Supported alignment/quantification methods include:

    • SimpleAF (Alevin-Fry) + qcatch
    • STARSolo
    • Kallisto + BUStools
    • Cellranger (Note: Cellranger is a commercial tool from 10X Genomics Inc. The container provided is built by the nf-core community and is not directly supported by 10X Genomics.)
  2. Access nf-core/scrnaseq usage and output documentation

    master

    The documentation for the nf-core/scrnaseq pipeline is organized into two primary sections:

    • Usage: Provides an overview of the pipeline workflow, instructions on how to execute it, and a detailed description of all available command-line flags.
    • Output: Explains the various results generated by the pipeline and provides guidance on how to interpret them.

    For general information regarding the installation, configuration, and execution of any nf-core pipeline, visit the central nf-core website: https://nf-co.re.

  3. Configure expected cell counts

    master

    The expected_cells parameter allows you to specify the anticipated number of cells for a sample. This is used by specific tools to optimize processing.

    Supported tools:

    • Alevin-fry
    • STARsolo
    • Cellranger

    Warning: For Cellranger v7 and later, it is not recommended to supply the --expected-cells parameter.

  4. Automatic renaming of FASTQ files for Cellranger

    master

    The nf-core/scrnaseq pipeline includes logic to automatically rename FASTQ files to match the required Cellranger naming convention: {sample_name}_S{i}_L00{j}_{R1,R2}_001.fastq.gz.

    This is necessary when input data does not follow the standard 10x Genomics naming convention, which often occurs when:

    1. Data is downloaded from sequence databases with non-standard names.
    2. Samples are sequenced across multiple flow cells (requiring multiple input directories).
    3. Data is multiplexed.

    The pipeline assumes that input files in the channel are ordered as file1 R1, file1 R2, file2 R1, file2 R2, .... This order is typically maintained if files are explicitly listed in a samplesheet or if they can be sorted by filename.

  5. Identify unsupported protocols

    master

    The nf-core/scrnaseq pipeline is designed for barcode-based protocols. The following are not supported:

    • Smart-seq2: Use nf-core/rnaseq instead, as it is optimized for plate-based full-length transcript sequencing without UMIs.
    • Cell hashing / Genotype-based demultiplexing: Use the hadge pipeline for pooled samples.
  6. Understand matrix conversion suffixes (raw, filtered, cellbender_filter)

    master

    To maintain provenance between different alignment and filtering steps, the pipeline appends suffixes to converted .h5ad (AnnData) and .rds (Seurat) files.

    Output directory: results/${params.aligner}/mtx_conversions

    File Naming Convention: *_{suffix}_matrix.{h5ad,rds}

    SuffixMeaning
    rawConversion of the raw/unprocessed matrix. Also used for tools that only produce one matrix (e.g., simpleaf).
    filteredConversion of the filtered/processed matrix generated by the tool.
    cellbender_filterConversion of the matrix generated by the cellbender remove background module.

    Note: For simpleaf, by default only raw results are generated, followed by cellbender to generate cellbender_filter results.

  7. Choose an alignment method with the decision tree

    master

    The pipeline offers several paths for single-cell RNA analysis. Users can choose between different aligners depending on their requirements for output formats (such as h5ad, seurat, or mtx matrices).

    Common alignment options include:

    • simpleaf
    • kallisto
    • star
    • cellranger
    • kbpython (Kallisto)

    Refer to the specific alignment options documentation to decide which method is most appropriate for your data.

  8. Use and contribute to nf-core/configs

    master

    For recurring organizational settings, you can use custom configuration files. If you want to share these settings with the community, you can request to have them added to the nf-core/configs repository.

    Steps to contribute:

    1. Test your config file locally using the -c parameter.
    2. Create a pull request to nf-core/configs including your config file and associated documentation (following the format in nf-core/configs/docs).
    3. Amend nfcore_custom.config in that repository to include your new profile.

    For more information, consult the Nextflow documentation.

  9. Verify Cellranger file renaming via MD5 checksums

    master

    To ensure that automatic renaming does not alter the biological results, the pipeline's renaming logic can be validated by comparing MD5 checksums of the Cellranger output files (e.g., raw_feature_bc_matrix.h5, filtered_feature_bc_matrix.h5, and molecule_info.h5) across different input scenarios: standard naming, multi-flowcell, multiplexed, and concatenated files. Identical MD5 sums indicate that the renaming process is transparent to the Cellranger algorithm.

    # Example of checking MD5 sums for output files
    > md5sum **/outs/*.h5 | sort
    2a7a5a022f01cb8d95965980f0d95ca5  10k_PBMC_3p_nextgem_Chromium_X_fastqs/10k_PBMC_3p_nextgem_Chromium_X/outs/raw_feature_bc_matrix.h5
    2a7a5a022f01cb8d95965980f0d95ca5  fastq_cat/10k_PBMC_3p_nextgem_Chromium_X/outs/raw_feature_bc_matrix.h5
    2a7a5a022f01cb8d95965980f0d95ca5  fastq_multiflowcell/10k_PBMC_3p_nextgem_Chromium_X/outs/raw_feature_bc_matrix.h5
    2a7a5a022f01cb8d95965980f0d95ca5  fastq_multiplexed/10k_PBMC_3p_nextgem_Chromium_X/outs/raw_feature_bc_matrix.h5
  10. Run and update tests with nf-test

    master

    Use nf-test to validate your changes locally. Use the --verbose flag to see Nextflow console logs.

    To run the test suite:

    nf-test test --tag test --profile +docker --verbose

    If you have added new functionality and need to update test assertions in the .nf.test files within the tests/ directory, use the --update-snapshots flag:

    nf-test test --tag test --profile +docker --verbose --update-snapshots
  11. Run the nf-core/scrnaseq pipeline

    master

    The standard way to execute the pipeline is via Nextflow. You must provide an input samplesheet, an output directory, and a genome. Use a profile (e.g., -profile docker) to specify the execution environment.

    Typical command:

    nextflow run nf-core/scrnaseq --input ./samplesheet.csv --outdir ./results --genome GRCh38 -profile docker

    Pipeline output files:

    • work/: Nextflow working directory containing intermediate files.
    • <OUTDIR>: The directory specified by --outdir containing final results.
    • .nextflow_log: Nextflow execution log.
    • Various Nextflow hidden files for history and logs.
  12. Limit Nextflow JVM memory requirements

    master

    To prevent the Nextflow Java virtual machines from requesting excessive memory, you can limit the heap size by setting the NXF_OPTS environment variable. It is recommended to add this to your ~/.bashrc or ~/.bash_profile.

    NXF_OPTS='-Xms1g -Xmx4g'