Skip to content

Commit

Permalink
WIP cleanup after tempalte update
Browse files Browse the repository at this point in the history
  • Loading branch information
grst committed Mar 6, 2024
1 parent 54c4780 commit 5da7682
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 114 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ First, prepare a samplesheet with your input data that looks as follows:

```csv
sample,fastq_1,fastq_2,expected_cells
pbmc8k,pbmc8k_S1_L007_R1_001.fastq.gz,pbmc8k_S1_L007_R2_001.fastq.gz,"10000"
pbmc8k,pbmc8k_S1_L008_R1_001.fastq.gz,pbmc8k_S1_L008_R2_001.fastq.gz,"10000"
pbmc8k,pbmc8k_S1_L007_R1_001.fastq.gz,pbmc8k_S1_L007_R2_001.fastq.gz,10000
pbmc8k,pbmc8k_S1_L008_R1_001.fastq.gz,pbmc8k_S1_L008_R2_001.fastq.gz,10000
```

Each row represents a fastq file (single-end) or a pair of fastq files (paired end).
Expand Down
28 changes: 25 additions & 3 deletions assets/schema_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces",
"meta": ["id"]
"meta": [
"id"
]
},
"fastq_1": {
"type": "string",
Expand All @@ -26,8 +28,28 @@
"exists": true,
"pattern": "^\\S+\\.f(ast)?q\\.gz$",
"errorMessage": "FastQ file for reads 2 cannot contain spaces and must have extension '.fq.gz' or '.fastq.gz'"
},
"expected_cells": {
"type": "integer",
"errorMessage": "Expected cells must be an Integer",
"meta": "expected_cells"
},
"seq_center": {
"type": "string",
"meta": "seq_center"
},
"sample_type": {
"type": "string",
"enum": [
"atac",
"gex"
]
}
},
"required": ["sample", "fastq_1"]
"required": [
"sample",
"fastq_1",
"fastq_2"
]
}
}
}
174 changes: 65 additions & 109 deletions workflows/scrnaseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,126 +4,87 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

include { FASTQC } from '../modules/nf-core/fastqc/main'
include { MULTIQC } from '../modules/nf-core/multiqc/main'
include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { MULTIQC } from '../modules/nf-core/multiqc/main'

include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { FASTQC_CHECK } from '../subworkflows/local/fastqc'
include { KALLISTO_BUSTOOLS } from '../subworkflows/local/kallisto_bustools'
include { SCRNASEQ_ALEVIN } from '../subworkflows/local/alevin'
include { STARSOLO } from '../subworkflows/local/starsolo'
include { CELLRANGER_ALIGN } from "../subworkflows/local/align_cellranger"
include { CELLRANGERARC_ALIGN } from "../subworkflows/local/align_cellrangerarc"
include { UNIVERSC_ALIGN } from "../subworkflows/local/align_universc"
include { MTX_CONVERSION } from "../subworkflows/local/mtx_conversion"
include { GTF_GENE_FILTER } from '../modules/local/gtf_gene_filter'

include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_scrnaseq_pipeline'
include { paramsSummaryLog; paramsSummaryMap } from 'plugin/nf-validation'

def summary_params = paramsSummaryMap(workflow)

def checkPathParamList = [
params.input, params.multiqc_config, params.fasta, params.gtf,
params.transcript_fasta, params.salmon_index, params.kallisto_index,
params.star_index, params.txp2gene, params.barcode_whitelist, params.cellranger_index,
params.universc_index
]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }


/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CONFIG FILES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

ch_multiqc_config = Channel.fromPath("$projectDir/assets/multiqc_config.yml", checkIfExists: true)
ch_multiqc_custom_config = params.multiqc_config ? Channel.fromPath( params.multiqc_config, checkIfExists: true ) : Channel.empty()
ch_multiqc_logo = params.multiqc_logo ? Channel.fromPath( params.multiqc_logo, checkIfExists: true ) : Channel.empty()
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT LOCAL MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { FASTQC_CHECK } from '../subworkflows/local/fastqc'
include { KALLISTO_BUSTOOLS } from '../subworkflows/local/kallisto_bustools'
include { SCRNASEQ_ALEVIN } from '../subworkflows/local/alevin'
include { STARSOLO } from '../subworkflows/local/starsolo'
include { CELLRANGER_ALIGN } from "../subworkflows/local/align_cellranger"
include { CELLRANGERARC_ALIGN } from "../subworkflows/local/align_cellrangerarc"
include { UNIVERSC_ALIGN } from "../subworkflows/local/align_universc"
include { MTX_CONVERSION } from "../subworkflows/local/mtx_conversion"
include { GTF_GENE_FILTER } from '../modules/local/gtf_gene_filter'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
IMPORT NF-CORE MODULES/SUBWORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

//
// MODULE: Installed directly from nf-core/modules
//
include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main'
include { MULTIQC } from '../modules/nf-core/multiqc/main'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN MAIN WORKFLOW
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

// Info required for completion email and summary
// TODO: Are this channels still necessary?
ch_output_docs = file("$projectDir/docs/output.md", checkIfExists: true)
ch_output_docs_images = file("$projectDir/docs/images/", checkIfExists: true)
protocol_config = WorkflowScrnaseq.getProtocol(workflow, log, params.aligner, params.protocol)
if (protocol_config['protocol'] == 'auto' && params.aligner != "cellranger") {
error "Only cellranger supports `protocol = 'auto'`. Please specify the protocol manually!"
}
workflow SCRNASEQ {

// general input and params
ch_input = file(params.input)
ch_genome_fasta = Channel.value(params.fasta ? file(params.fasta) : [])
ch_gtf = params.gtf ? file(params.gtf) : []
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 = params.txp2gene ? file(params.txp2gene) : []
ch_multiqc_alevin = Channel.empty()
ch_multiqc_star = Channel.empty()
ch_multiqc_cellranger = Channel.empty()
if (params.barcode_whitelist) {
ch_barcode_whitelist = file(params.barcode_whitelist)
} else if (protocol_config.containsKey("whitelist")) {
ch_barcode_whitelist = file("$projectDir/${protocol_config['whitelist']}")
} else {
ch_barcode_whitelist = []
}
take:
ch_samplesheet // channel: samplesheet read in from --input

main:

//kallisto params
ch_kallisto_index = params.kallisto_index ? file(params.kallisto_index) : []
kb_workflow = params.kb_workflow
// TODO: checks still necessary in favor of schema validation?
def checkPathParamList = [
params.input, params.multiqc_config, params.fasta, params.gtf,
params.transcript_fasta, params.salmon_index, params.kallisto_index,
params.star_index, params.txp2gene, params.barcode_whitelist, params.cellranger_index,
params.universc_index
]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }

// Info required for completion email and summary
// TODO: Are this channels still necessary?
protocol_config = WorkflowScrnaseq.getProtocol(workflow, log, params.aligner, params.protocol)
if (protocol_config['protocol'] == 'auto' && params.aligner != "cellranger") {
error "Only cellranger supports `protocol = 'auto'`. Please specify the protocol manually!"
}

//salmon params
ch_salmon_index = params.salmon_index ? file(params.salmon_index) : []
// general input and params
ch_input = file(params.input)
ch_genome_fasta = Channel.value(params.fasta ? file(params.fasta) : [])
ch_gtf = params.gtf ? file(params.gtf) : []
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 = params.txp2gene ? file(params.txp2gene) : []
ch_multiqc_alevin = Channel.empty()
ch_multiqc_star = Channel.empty()
ch_multiqc_cellranger = Channel.empty()
if (params.barcode_whitelist) {
ch_barcode_whitelist = file(params.barcode_whitelist)
} else if (protocol_config.containsKey("whitelist")) {
ch_barcode_whitelist = file("$projectDir/${protocol_config['whitelist']}")
} else {
ch_barcode_whitelist = []
}

//star params
ch_star_index = params.star_index ? file(params.star_index) : []
star_feature = params.star_feature

//cellranger params
ch_cellranger_index = params.cellranger_index ? file(params.cellranger_index) : []
//kallisto params
ch_kallisto_index = params.kallisto_index ? file(params.kallisto_index) : []
kb_workflow = params.kb_workflow

//universc params
ch_universc_index = params.universc_index ? file(params.universc_index) : []
//salmon params
ch_salmon_index = params.salmon_index ? file(params.salmon_index) : []

workflow SCRNASEQ {
//star params
ch_star_index = params.star_index ? file(params.star_index) : []
star_feature = params.star_feature

take:
ch_samplesheet // channel: samplesheet read in from --input
//cellranger params
ch_cellranger_index = params.cellranger_index ? file(params.cellranger_index) : []

main:
//universc params
ch_universc_index = params.universc_index ? file(params.universc_index) : []

ch_versions = Channel.empty()
ch_mtx_matrices = Channel.empty()
Expand Down Expand Up @@ -254,11 +215,6 @@ workflow SCRNASEQ {
//Add Versions from MTX Conversion workflow too
ch_versions.mix(MTX_CONVERSION.out.ch_versions)

// collect software versions
CUSTOM_DUMPSOFTWAREVERSIONS (
ch_versions.unique().collectFile(name: 'collated_versions.yml')
)

//
// MODULE: MultiQC
//
Expand All @@ -270,7 +226,7 @@ workflow SCRNASEQ {
ch_multiqc_custom_methods_description = params.multiqc_methods_description ? file(params.multiqc_methods_description, checkIfExists: true) : file("$projectDir/assets/methods_description_template.yml", checkIfExists: true)
ch_methods_description = Channel.value(methodsDescriptionText(ch_multiqc_custom_methods_description))
ch_multiqc_files = ch_multiqc_files.mix(ch_workflow_summary.collectFile(name: 'workflow_summary_mqc.yaml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_collated_versions)
ch_multiqc_files = ch_multiqc_files.mix(softwareVersionsToYAML(ch_versions).collectFile(name: 'versions.yml'))
ch_multiqc_files = ch_multiqc_files.mix(ch_methods_description.collectFile(name: 'methods_description_mqc.yaml', sort: false))

MULTIQC (
Expand Down

0 comments on commit 5da7682

Please sign in to comment.