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

Refactor workflows into subworkflows #87

Merged
merged 8 commits into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 0 additions & 139 deletions lib/Workflow.groovy

This file was deleted.

113 changes: 103 additions & 10 deletions lib/WorkflowScrnaseq.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ class WorkflowScrnaseq {
// Check and validate parameters
//
public static void initialise(params, log) {
genomeExistsError(params, log)
genomeExists(params, log)

if (!params.genome_fasta) {
log.error "Genome fasta file not specified with e.g. '--genome_fasta genome.fa' or via a detectable config file."
if (!params.input) {
log.error "Please provide an input samplesheet with --input"
System.exit(1)
}
}
Expand Down Expand Up @@ -43,18 +43,111 @@ class WorkflowScrnaseq {
return yaml_file_text
}

//

// Citation string
private static String citation(workflow) {
return "If you use ${workflow.manifest.name} for your analysis please cite:\n\n" +
'* The pipeline\n' +
' https://doi.org/10.5281/zenodo.3901628\n\n' +
'* The nf-core framework\n' +
' https://doi.org/10.1038/s41587-020-0439-x\n\n' +
'* Software dependencies\n' +
" https://github.com/${workflow.manifest.name}/blob/master/CITATIONS.md"
}

// Exit pipeline if incorrect --genome key provided
//
private static void genomeExistsError(params, log) {
static void genomeExists(params, log) {
if (params.genomes && params.genome && !params.genomes.containsKey(params.genome)) {
log.error '=============================================================================\n' +
" Genome '${params.genome}' not found in any config files provided to the pipeline.\n" +
' Currently, the available genome keys are:\n' +
" ${params.genomes.keySet().join(', ')}\n" +
'==================================================================================='
" Genome '${params.genome}' not found in any config files provided to the pipeline.\n" +
' Currently, the available genome keys are:\n' +
" ${params.genomes.keySet().join(', ')}\n" +
'==================================================================================='
System.exit(1)
}
}


/*
* Format the protocol
* Given the protocol paramter (params.protocol) and the aligner (params.aligner),
* this function formats the protocol such that it is fit for the respective
* subworkflow
*/
static formatProtocol(protocol, aligner) {
String new_protocol = protocol
String chemistry = ''

// alevin
if (aligner == 'alevin') {
switch (protocol) {
case '10XV1':
new_protocol = 'chromium'
chemistry = 'V1'
break
case '10XV2':
new_protocol = 'chromium'
chemistry = 'V2'
break
case '10XV3':
new_protocol = 'chromiumV3'
chemistry = 'V3'
break
case 'dropseq':
new_protocol = 'dropseq'
}
}

// star
else if (aligner == 'star') {
switch (protocol) {
case '10XV1':
new_protocol = 'CB_UMI_Simple'
chemistry = 'V1'
break
case '10XV2':
new_protocol = 'CB_UMI_Simple'
chemistry = 'V2'
break
case '10XV3':
new_protocol = 'CB_UMI_Simple'
chemistry = 'V3'
break
case 'dropseq':
new_protocol = 'CB_UMI_Simple'
break
case 'smartseq':
new_protocol = 'SmartSeq'
}
}

// kallisto bustools
else if (aligner = 'kallisto' ) {
switch (protocol) {
case '10XV1':
new_protocol = '10XV1'
chemistry = 'V1'
break
case '10XV2':
new_protocol = '10XV2'
chemistry = 'V2'
break
case '10XV3':
new_protocol = '10XV3'
chemistry = 'V3'
break
case 'dropseq':
new_protocol = 'DROPSEQ'
break
case 'smartseq':
new_protocol = 'SMARTSEQ'
}
}
else {
exit 1, 'Aligner not recognized.'
}

return [new_protocol, chemistry]
}

}
3 changes: 2 additions & 1 deletion modules/local/multiqc_alevin.nf → modules/local/multiqc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ process MULTIQC {
path multiqc_custom_config
path software_versions
path workflow_summary
path ('salmon_alevin/*')
path ("STAR/*")
path ("salmon_alevin/*")

output:
path "*multiqc_report.html" , emit: report
Expand Down
28 changes: 0 additions & 28 deletions modules/local/multiqc_kb.nf

This file was deleted.

29 changes: 0 additions & 29 deletions modules/local/multiqc_starsolo.nf

This file was deleted.

2 changes: 1 addition & 1 deletion modules/local/salmon_alevin.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ process SALMON_ALEVIN {
$args \\
-o ${prefix}_alevin_results

mv ${whitelist} ${prefix}_alevin_results/alevin/whitelist.txt
gzip -cdf ${whitelist} > ${prefix}_alevin_results/alevin/whitelist.txt

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion modules/local/star_align.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ process STAR_ALIGN {
--readFilesIn ${reads[1]} ${reads[0]} \\
--runThreadN $task.cpus \\
--outFileNamePrefix $prefix. \\
--soloCBwhitelist $whitelist \\
--soloCBwhitelist <(gzip -cdf $whitelist) \\
--soloType $protocol \\
$out_sam_type \\
$ignore_gtf \\
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ params {
kallisto_gene_map = null
kallisto_index = null
skip_bustools = false
kb_workflow = "standard"

// STARsolo parameters
star_index = null
Expand Down
Loading