Skip to content

Commit

Permalink
Merge branch 'dev' into anndata-concatenation
Browse files Browse the repository at this point in the history
  • Loading branch information
grst authored Jan 15, 2025
2 parents a8e46f2 + 0e282f6 commit 3fb71b1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 49 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## dev
## [Unreleased]

- Add a checker so that `--fb_reference` does not break the pipeline in case `ab` files are not used in `cellranger multi` sub-workflow.
- Update example usage command in README with valid reference genome parameter ([#339](https://github.com/nf-core/scrnaseq/issues/339))

## v3.0.0 - 2024-12-09

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Now, you can run the pipeline using:
nextflow run nf-core/scrnaseq \
-profile <docker/singularity/.../institute> \
--input samplesheet.csv \
--genome_fasta GRCm38.p6.genome.chr19.fa \
--fasta GRCm38.p6.genome.chr19.fa \
--gtf gencode.vM19.annotation.chr19.gtf \
--protocol 10XV2 \
--aligner <alevin/kallisto/star/cellranger> \
Expand Down
4 changes: 3 additions & 1 deletion assets/multiqc_config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
report_comment: >
This report has been generated by the <a href="https://github.com/nf-core/scrnaseq/tree/dev" target="_blank">nf-core/scrnaseq</a> analysis pipeline. For information about how to interpret these results, please see the <a href="https://nf-co.re/scrnaseq/dev/docs/output" target="_blank">documentation</a>.
This report has been generated by the <a href="https://github.com/nf-core/scrnaseq/tree/dev" target="_blank">nf-core/scrnaseq</a>
analysis pipeline. For information about how to interpret these results, please see the
<a href="https://nf-co.re/scrnaseq/dev/docs/output" target="_blank">documentation</a>.
report_section_order:
"nf-core-scrnaseq-methods-description":
order: -1000
Expand Down
12 changes: 11 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { getGenomeAttribute } from './subworkflows/local/utils_nfcore_scrnaseq_pipeline'
include { SCRNASEQ } from './workflows/scrnaseq'
include { PIPELINE_INITIALISATION } from './subworkflows/local/utils_nfcore_scrnaseq_pipeline'
include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_scrnaseq_pipeline'
Expand All @@ -24,7 +25,16 @@ include { PIPELINE_COMPLETION } from './subworkflows/local/utils_nfcore_scrn
GENOME PARAMETER VALUES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// we cannot modify params. here, we must load the files

// Params cannot be changed if they have been set beforehand
// Thus, manually provided files are not overwritten by the genome attributes
params.fasta = getGenomeAttribute('fasta')
params.gtf = getGenomeAttribute('gtf')
params.salmon_index = getGenomeAttribute('simpleaf')
params.txp2gene = getGenomeAttribute('simpleaf_tx2pgene')
params.cellranger_index = params.aligner == 'cellrangerarc' ?
getGenomeAttribute('cellrangerarc') :
getGenomeAttribute('cellranger')

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ manifest {
description = """Pipeline for processing 10x Genomics single cell rnaseq data"""
mainScript = 'main.nf'
nextflowVersion = '!>=24.04.2'
version = 'dev'
version = '3.1.0dev'
doi = '10.5281/zenodo.3568187'
}

Expand Down
71 changes: 27 additions & 44 deletions workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -23,44 +23,29 @@ include { GUNZIP as GUNZIP_FASTA } from '../modules/n
include { GUNZIP as GUNZIP_GTF } from '../modules/nf-core/gunzip/main'
include { H5AD_CONVERSION } from '../subworkflows/local/h5ad_conversion'


workflow SCRNASEQ {

take:
ch_fastq

main:
ch_multiqc_files = Channel.empty()
ch_versions = Channel.empty()
ch_mtx_matrices = Channel.empty()

protocol_config = Utils.getProtocol(workflow, log, params.aligner, params.protocol)
if (protocol_config['protocol'] == 'auto' && params.aligner !in ["cellranger", "cellrangerarc", "cellrangermulti"]) {
error "Only cellranger supports `protocol = 'auto'`. Please specify the protocol manually!"
}

// collect paths from genome attributes file (e.g. iGenomes.config; optional)
// we cannot overwrite params in the workflow (they stay null as coming from the config file)
def genome_fasta = params.fasta ?: getGenomeAttribute('fasta')
def gtf = params.gtf ?: getGenomeAttribute('gtf')
def star_index = params.star_index // ?: getGenomeAttribute('star') TODO: Currently not fetching iGenomes star index due version incompatibility
def salmon_index = params.salmon_index ?: getGenomeAttribute('simpleaf')
def txp2gene = params.txp2gene ?: getGenomeAttribute('simpleaf_tx2pgene')

// Make cellranger or cellranger-arc index conditional
def cellranger_index = []
if (params.aligner in ["cellranger", "cellrangermulti"]){
cellranger_index = params.cellranger_index ?: getGenomeAttribute('cellranger')
}
else if (params.aligner == "cellrangerarc") {
cellranger_index = params.cellranger_index ?: getGenomeAttribute('cellrangerarc')
}

ch_genome_fasta = genome_fasta ? file(genome_fasta, checkIfExists: true) : []
ch_gtf = gtf ? file(gtf, checkIfExists: true) : []

// general input and params
ch_transcript_fasta = params.transcript_fasta ? file(params.transcript_fasta): []
ch_motifs = params.motifs ? file(params.motifs) : []
ch_cellrangerarc_config = params.cellrangerarc_config ? file(params.cellrangerarc_config) : []
ch_txp2gene = txp2gene ? file(txp2gene, checkIfExists: true) : []
ch_multiqc_files = Channel.empty()
ch_genome_fasta = params.fasta ? file(params.fasta, checkIfExists: true) : []
ch_gtf = params.gtf ? file(params.gtf, checkIfExists: true) : []
ch_transcript_fasta = params.transcript_fasta ? file(params.transcript_fasta) : []
ch_motifs = params.motifs ? file(params.motifs) : []
ch_txp2gene = params.txp2gene ? file(params.txp2gene, checkIfExists: true) : []

if (params.barcode_whitelist) {
ch_barcode_whitelist = file(params.barcode_whitelist, checkIfExists: true)
} else if (protocol_config.containsKey("whitelist")) {
Expand All @@ -75,28 +60,26 @@ workflow SCRNASEQ {

//kallisto params
ch_kallisto_index = params.kallisto_index ? file(params.kallisto_index, checkIfExists: true) : []
kb_workflow = params.kb_workflow
kb_t1c = params.kb_t1c ? file(params.kb_t1c, checkIfExists: true) : []
kb_t2c = params.kb_t2c ? file(params.kb_t2c, checkIfExists: true) : []
kb_t1c = params.kb_t1c ? file(params.kb_t1c, checkIfExists: true) : []
kb_t2c = params.kb_t2c ? file(params.kb_t2c, checkIfExists: true) : []

//salmon params
ch_salmon_index = salmon_index ? file(salmon_index, checkIfExists: true) : []
ch_salmon_index = params.salmon_index ? file(params.salmon_index, checkIfExists: true) : []

//star params
star_index = star_index ? file(star_index, checkIfExists: true) : null
ch_star_index = star_index ? Channel.value( [[id: star_index.baseName], star_index] ) : []
star_feature = params.star_feature
star_index = params.star_index ? file(params.star_index, checkIfExists: true) : null
ch_star_index = star_index ? Channel.value( [[id: star_index.baseName], star_index] ) : []

//cellranger params
ch_cellranger_index = cellranger_index ? file(cellranger_index, checkIfExists: true) : []
ch_cellranger_index = params.cellranger_index ? file(params.cellranger_index, checkIfExists: true) : []

//cellrangermulti params
cellranger_vdj_index = params.cellranger_vdj_index ? file(params.cellranger_vdj_index, checkIfExists: true) : []
ch_multi_samplesheet = params.cellranger_multi_barcodes ? file(params.cellranger_multi_barcodes, checkIfExists: true) : []
empty_file = file("$projectDir/assets/EMPTY", checkIfExists: true)
cellranger_vdj_index = params.cellranger_vdj_index ? file(params.cellranger_vdj_index, checkIfExists: true) : []
ch_multi_samplesheet = params.cellranger_multi_barcodes ? file(params.cellranger_multi_barcodes, checkIfExists: true) : []
empty_file = file("$projectDir/assets/EMPTY", checkIfExists: true)

ch_versions = Channel.empty()
ch_mtx_matrices = Channel.empty()
// cellrangerarc params
ch_cellrangerarc_config = params.cellrangerarc_config ? file(params.cellrangerarc_config) : []

// Run FastQC
if (!params.skip_fastqc) {
Expand All @@ -108,8 +91,8 @@ workflow SCRNASEQ {
//
// Uncompress genome fasta file if required
//
if (genome_fasta) {
if (genome_fasta.endsWith('.gz')) {
if (params.fasta) {
if (params.fasta.endsWith('.gz')) {
ch_genome_fasta = GUNZIP_FASTA ( [ [:], ch_genome_fasta ] ).gunzip.map { it[1] }
ch_versions = ch_versions.mix(GUNZIP_FASTA.out.versions)
} else {
Expand All @@ -120,8 +103,8 @@ workflow SCRNASEQ {
//
// Uncompress GTF annotation file or create from GFF3 if required
//
if (gtf) {
if (gtf.endsWith('.gz')) {
if (params.gtf) {
if (params.gtf.endsWith('.gz')) {
ch_gtf = GUNZIP_GTF ( [ [:], ch_gtf ] ).gunzip.map { it[1] }
ch_versions = ch_versions.mix(GUNZIP_GTF.out.versions)
} else {
Expand All @@ -142,7 +125,7 @@ workflow SCRNASEQ {
kb_t1c,
kb_t2c,
protocol_config['protocol'],
kb_workflow,
params.kb_workflow,
ch_fastq
)
ch_versions = ch_versions.mix(KALLISTO_BUSTOOLS.out.ch_versions)
Expand Down Expand Up @@ -176,7 +159,7 @@ workflow SCRNASEQ {
protocol_config['protocol'],
ch_barcode_whitelist,
ch_fastq,
star_feature,
params.star_feature,
protocol_config.get('extra_args', ""),
)
ch_versions = ch_versions.mix(STARSOLO.out.ch_versions)
Expand Down

0 comments on commit 3fb71b1

Please sign in to comment.