schema updates

This commit is contained in:
Sarah Griffiths 2022-12-01 21:05:01 +00:00
parent 14ee337036
commit 43e746f0ea
17 changed files with 313 additions and 412 deletions

View File

@ -51,12 +51,11 @@ body:
- type: dropdown - type: dropdown
id: profile id: profile
attributes: attributes:
label: Workflow Execution - Execution Profile label: Workflow Execution - CLI Execution Profile
description: If you're using the CLI to run the workflow, what profile are you using? description: If you're using the CLI to run the workflow, what profile are you using?
options: options:
- Docker - Docker
- Singularity - Singularity
- Conda
validations: validations:
required: false required: false
- type: input - type: input

View File

@ -9,6 +9,7 @@ variables:
--ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf \ --ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf \
--jaffal_refBase chr20/ --jaffal_genome hg38_chr20 --jaffal_annotation genCode22" --jaffal_refBase chr20/ --jaffal_genome hg38_chr20 --jaffal_annotation genCode22"
NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes
CI_FLAVOUR: "new"
docker-run: docker-run:
@ -31,13 +32,13 @@ docker-run:
- if: $MATRIX_NAME == "isoforms" - if: $MATRIX_NAME == "isoforms"
variables: variables:
NF_BEFORE_SCRIPT: wget -O test_data.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/wf-isoforms_test_data.tar.gz && tar -xzvf test_data.tar.gz NF_BEFORE_SCRIPT: wget -O test_data.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/wf-isoforms_test_data.tar.gz && tar -xzvf test_data.tar.gz
NF_WORKFLOW_OPTS: "--fastq ERR6053095_chr20.fastq \ NF_WORKFLOW_OPTS: "--fastq ERR6053095_chr20.fastq --transcriptome-source reference-guided \
--ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf" --ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf"
NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes
- if: $MATRIX_NAME == "fusions" - if: $MATRIX_NAME == "fusions"
variables: variables:
NF_BEFORE_SCRIPT: wget -O test_data.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/wf-isoforms_test_data.tar.gz && tar -xzvf test_data.tar.gz NF_BEFORE_SCRIPT: wget -O test_data.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/wf-isoforms_test_data.tar.gz && tar -xzvf test_data.tar.gz
NF_WORKFLOW_OPTS: "--fastq ERR6053095_chr20.fastq \ NF_WORKFLOW_OPTS: "--fastq ERR6053095_chr20.fastq --transcriptome-source reference-guided \
--ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf \ --ref_genome chr20/hg38_chr20.fa --ref_annotation chr20/gencode.v22.annotation.chr20.gtf \
--jaffal_refBase chr20/ --jaffal_genome hg38_chr20 --jaffal_annotation genCode22" --jaffal_refBase chr20/ --jaffal_genome hg38_chr20 --jaffal_annotation genCode22"
NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes
@ -46,7 +47,7 @@ docker-run:
NF_BEFORE_SCRIPT: wget -O differential_expression.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/differential_expression.tar.gz && tar -xzvf differential_expression.tar.gz NF_BEFORE_SCRIPT: wget -O differential_expression.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/differential_expression.tar.gz && tar -xzvf differential_expression.tar.gz
NF_WORKFLOW_OPTS: "--fastq differential_expression/differential_expression_fastq \ NF_WORKFLOW_OPTS: "--fastq differential_expression/differential_expression_fastq \
--de_analysis \ --de_analysis \
--ref_genome differential_expression/hg38_chr20.fa \ --ref_genome differential_expression/hg38_chr20.fa --transcriptome-source reference-guided \
--ref_annotation differential_expression/gencode.v22.annotation.chr20.gtf \ --ref_annotation differential_expression/gencode.v22.annotation.chr20.gtf \
--direct_rna --minimap_index_opts \\-k15" --direct_rna --minimap_index_opts \\-k15"
NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes NF_IGNORE_PROCESSES: preprocess_reads,merge_transcriptomes
@ -54,6 +55,7 @@ docker-run:
variables: variables:
NF_BEFORE_SCRIPT: wget -O differential_expression.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/differential_expression.tar.gz && tar -xzvf differential_expression.tar.gz NF_BEFORE_SCRIPT: wget -O differential_expression.tar.gz https://ont-exd-int-s3-euwst1-epi2me-labs.s3.amazonaws.com/wf-isoforms/differential_expression.tar.gz && tar -xzvf differential_expression.tar.gz
NF_WORKFLOW_OPTS: "--fastq differential_expression/differential_expression_fastq \ NF_WORKFLOW_OPTS: "--fastq differential_expression/differential_expression_fastq \
--transcriptome-source precomputed \
--de_analysis \ --de_analysis \
--ref_genome differential_expression/hg38_chr20.fa \ --ref_genome differential_expression/hg38_chr20.fa \
--ref_annotation differential_expression/gencode.v22.annotation.chr20.gtf \ --ref_annotation differential_expression/gencode.v22.annotation.chr20.gtf \

View File

@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 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). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [unreleased]
### Updated
- `-profile conda` is no longer supported, users should use `-profile standard` (Docker) or `-profile singularity` instead
- `nextflow run epi2me-labs/wf-transcriptomes --version` will now print the workflow version number and exit
- Use parameter `--transcriptome-source` to define precalculated, reference-based or denovo
## [v0.1.6] ## [v0.1.6]
### Updated ### Updated
- Removed sanitize option - Removed sanitize option

View File

@ -1,24 +0,0 @@
ARG BASEIMAGE=ontresearch/base-workflow-image:v0.2.0
FROM $BASEIMAGE
ARG ENVFILE=environment.yaml
COPY $ENVFILE $HOME/environment.yaml
RUN \
. $CONDA_DIR/etc/profile.d/micromamba.sh \
&& micromamba activate \
&& micromamba install -n base --file $HOME/environment.yaml \
&& micromamba clean --all --yes \
&& fix-permissions $CONDA_DIR \
&& fix-permissions $HOME \
&& rm -rf $CONDA_DIR/conda-meta \
&& rm -rf $CONDA_DIR/include \
&& rm -rf $CONDA_DIR/lib/python3.*/site-packages/pip \
&& find $CONDA_DIR -name '__pycache__' -type d -exec rm -rf '{}' '+'
USER $WF_UID
WORKDIR $HOME
# Install JAFFA
ADD subworkflows $HOME/subworkflows
RUN /bin/sh -c $HOME/subworkflows/JAFFAL/install_jaffa.sh

View File

@ -88,10 +88,9 @@ to run the workflow.
The workflow can currently be run using either The workflow can currently be run using either
[Docker](https://www.docker.com/products/docker-desktop), [Docker](https://www.docker.com/products/docker-desktop),
[Singularity](https://sylabs.io/singularity/) or [Singularity](https://sylabs.io/singularity/) to provide isolation of
[conda](https://docs.conda.io/en/latest/miniconda.html) to provide isolation of
the required software. Each method is automated out-of-the-box provided the required software. Each method is automated out-of-the-box provided
either docker, singularity or conda is installed. either docker or singularity is installed.
It is not required to clone or download the git repository in order to run the workflow. It is not required to clone or download the git repository in order to run the workflow.
For more information on running EPI2ME Labs workflows [visit out website](https://labs.epi2me.io/wfindex). For more information on running EPI2ME Labs workflows [visit out website](https://labs.epi2me.io/wfindex).
@ -290,7 +289,6 @@ in `${out_dir}/jaffal_output_${sample_id}` you will find:
* [nextflow](https://www.nextflow.io/) * [nextflow](https://www.nextflow.io/)
* [docker](https://www.docker.com/products/docker-desktop) * [docker](https://www.docker.com/products/docker-desktop)
* [Singularity](https://sylabs.io/singularity/) * [Singularity](https://sylabs.io/singularity/)
* [conda](https://docs.conda.io/en/latest/miniconda.html)
* [racon](https://github.com/isovic/racon) * [racon](https://github.com/isovic/racon)
* [spoa](https://github.com/rvaser/spoa) * [spoa](https://github.com/rvaser/spoa)
* [inONclust](https://github.com/ksahlin/isONclust) * [inONclust](https://github.com/ksahlin/isONclust)

View File

@ -511,7 +511,7 @@ def pychopper_plots(report, pychop_report):
### Pychopper summary statisitcs ### Pychopper summary statisitcs
The following plots summarize [pychopper] output The following plots summarize [pychopper] output
(https://github.com/nanoporetech/pychopper) (https://github.com/epi2me-labs/pychopper)
* **Pr.found**: Reads with primers found in correct orientation at * **Pr.found**: Reads with primers found in correct orientation at
both ends. both ends.
@ -604,7 +604,7 @@ def transcript_table(report, df_tmaps, max_rows):
""" """
section = report.add_section() section = report.add_section()
# Should wße put data from each sample into it's own table or have it # Should we put data from each sample into it's own table or have it
# all in single table and sample_id column? Currently it's the latter # all in single table and sample_id column? Currently it's the latter
# drop some columns for the big table and do some filtering # drop some columns for the big table and do some filtering
@ -932,7 +932,9 @@ def main():
[Path(x) for x in args.gffcompare_dir], [Path(x) for x in args.gffcompare_dir],
sample_ids) sample_ids)
transcript_table(report, df_tmaps, args.isoform_table_nrows) if df_tmaps is not None:
# Skip this section. This needs some work
transcript_table(report, df_tmaps, args.isoform_table_nrows)
if args.cluster_qc_dirs is not None: if args.cluster_qc_dirs is not None:
cluster_quality(args.cluster_qc_dirs, report, sample_ids) cluster_quality(args.cluster_qc_dirs, report, sample_ids)

View File

@ -53,19 +53,19 @@ def build_job_tree():
for x in batches] for x in batches]
levels = OrderedDict() levels = OrderedDict()
levels[0] = [] levels[0] = []
for k, bf in sorted(zip(batch_ids, batches), key=lambda x: x[0]): for id_, bf in sorted(zip(batch_ids, batches), key=lambda x: x[0]):
n = Node( n = Node(
k, id_,
"clusters/isONcluster_{}.cer".format(k), "clusters/isONcluster_{}.cer".format(id_),
None, None,
None, None,
None, None,
0) 0)
n.Done = True n.Done = True
job_tree[k] = n job_tree[id_] = n
levels[0].append(n) levels[0].append(n)
level = 0 level = 0
max_id = levels[0][-1].k max_id = levels[0][-1].Id
while len(levels[level]) != 1: # Final level will be link while len(levels[level]) != 1: # Final level will be link
next_level = level + 1 next_level = level + 1
levels[next_level] = [] levels[next_level] = []
@ -84,7 +84,7 @@ def build_job_tree():
levels[next_level].append(new_node) levels[next_level].append(new_node)
job_tree[max_id] = new_node job_tree[max_id] = new_node
level = next_level level = next_level
root = job_tree[len(job_tree) - 1].k root = job_tree[len(job_tree) - 1].Id
job_tree[root].RightSide = True job_tree[root].RightSide = True
return job_tree, levels return job_tree, levels
@ -121,7 +121,7 @@ def main():
sub.call(cmd, shell=True) sub.call(cmd, shell=True)
sub.call(( sub.call((
"ln -s `realpath clusters/isONcluster_{}.cer` " "ln -s `realpath clusters/isONcluster_{}.cer` "
"isONcluster_root.cer".format(n.Id)), shell=True) "isONcluster_ROOT.cer".format(n.Id)), shell=True)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -3,7 +3,6 @@
* [nextflow](https://www.nextflow.io/) * [nextflow](https://www.nextflow.io/)
* [docker](https://www.docker.com/products/docker-desktop) * [docker](https://www.docker.com/products/docker-desktop)
* [Singularity](https://sylabs.io/singularity/) * [Singularity](https://sylabs.io/singularity/)
* [conda](https://docs.conda.io/en/latest/miniconda.html)
* [racon](https://github.com/isovic/racon) * [racon](https://github.com/isovic/racon)
* [spoa](https://github.com/rvaser/spoa) * [spoa](https://github.com/rvaser/spoa)
* [inONclust](https://github.com/ksahlin/isONclust) * [inONclust](https://github.com/ksahlin/isONclust)

View File

@ -6,10 +6,9 @@ to run the workflow.
The workflow can currently be run using either The workflow can currently be run using either
[Docker](https://www.docker.com/products/docker-desktop), [Docker](https://www.docker.com/products/docker-desktop),
[Singularity](https://sylabs.io/singularity/) or [Singularity](https://sylabs.io/singularity/) to provide isolation of
[conda](https://docs.conda.io/en/latest/miniconda.html) to provide isolation of
the required software. Each method is automated out-of-the-box provided the required software. Each method is automated out-of-the-box provided
either docker, singularity or conda is installed. either docker or singularity is installed.
It is not required to clone or download the git repository in order to run the workflow. It is not required to clone or download the git repository in order to run the workflow.
For more information on running EPI2ME Labs workflows [visit out website](https://labs.epi2me.io/wfindex). For more information on running EPI2ME Labs workflows [visit out website](https://labs.epi2me.io/wfindex).

View File

@ -1,44 +0,0 @@
name: epi2melabs-wf-transcriptomes
channels:
- epi2melabs
- conda-forge
- bioconda
- defaults
dependencies:
- python==3.8.*
- bokeh==2.4.3
- aplanat>=0.6.15
- epi2melabs
- minimap2==2.24
- samtools==1.14
- bedtools==2.30.0
- pychopper>=2.7.0
- pandas==1.3.5
- gffread==0.12.7
- gffcompare==0.11.2
- gffutils==0.10.1
- seqkit==2.2.0
- stringtie==2.1.1
- curl
- pysam==0.17.0
- racon==1.4.20
- spoa==3.4.0
- fastcat==0.4.10
- isonclust2==2.3
- parallel
- scikit-learn==1.0.2
- natsort
# Fusion detection dependencies
# - bpipe=0.9.9.2
- java-jdk
- r-base
- gxx
# Differential expression dependencies
- bioconductor-genomicfeatures
- bioconductor-drimseq
- bioconductor-edger
- bioconductor-dexseq
- bioconductor-stager
- r-dplyr
- r-tidyr
- salmon==1.9.0

View File

@ -70,7 +70,6 @@ class NfcoreSchema {
'quiet', 'quiet',
'syslog', 'syslog',
'v', 'v',
'version',
// Options for `nextflow run` command // Options for `nextflow run` command
'ansi', 'ansi',

View File

@ -66,6 +66,25 @@ class NfcoreTemplate {
} }
} }
//
// Generate version string
//
public static String version(workflow) {
String version_string = ""
if (workflow.manifest.version) {
def prefix_v = workflow.manifest.version[0] != 'v' ? 'v' : ''
version_string += "${prefix_v}${workflow.manifest.version}"
}
if (workflow.commitId) {
def git_shortsha = workflow.commitId.substring(0, 7)
version_string += "-g${git_shortsha}"
}
return version_string
}
// //
// Construct and send completion email // Construct and send completion email
// //
@ -98,7 +117,7 @@ class NfcoreTemplate {
misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp misc_fields['Nextflow Compile Timestamp'] = workflow.nextflow.timestamp
def email_fields = [:] def email_fields = [:]
email_fields['version'] = workflow.manifest.version email_fields['version'] = NfcoreTemplate.version(workflow)
email_fields['runName'] = workflow.runName email_fields['runName'] = workflow.runName
email_fields['success'] = workflow.success email_fields['success'] = workflow.success
email_fields['dateComplete'] = workflow.complete email_fields['dateComplete'] = workflow.complete
@ -297,24 +316,23 @@ class NfcoreTemplate {
// //
public static String dashedLine(monochrome_logs) { public static String dashedLine(monochrome_logs) {
Map colors = logColours(monochrome_logs) Map colors = logColours(monochrome_logs)
return "-${colors.dim}----------------------------------------------------${colors.reset}-" return "${colors.dim}--------------------------------------------------------------------------------${colors.reset}"
} }
// // epi2me-labs logo
// nf-core logo
//
public static String logo(workflow, monochrome_logs) { public static String logo(workflow, monochrome_logs) {
Map colors = logColours(monochrome_logs) Map colors = NfcoreTemplate.logColours(monochrome_logs)
String workflow_name = workflow.manifest.name.split("/")[1]
String workflow_version = version(workflow)
String.format( String.format(
"""\n """
${dashedLine(monochrome_logs)} ${colors.igreen}|||||||||| ${colors.reset}${colors.dim}_____ ____ ___ ____ __ __ _____ _ _
${colors.green},--.${colors.black}/${colors.green},-.${colors.reset} ${colors.igreen}|||||||||| ${colors.reset}${colors.dim}| ____| _ \\_ _|___ \\| \\/ | ____| | | __ _| |__ ___
${colors.blue} ___ __ __ __ ___ ${colors.green}/,-._.--~\'${colors.reset} ${colors.yellow}||||| ${colors.reset}${colors.dim}| _| | |_) | | __) | |\\/| | _| _____| |/ _` | '_ \\/ __|
${colors.blue} |\\ | |__ __ / ` / \\ |__) |__ ${colors.yellow}} {${colors.reset} ${colors.yellow}||||| ${colors.reset}${colors.dim}| |___| __/| | / __/| | | | |__|_____| | (_| | |_) \\__ \\
${colors.blue} | \\| | \\__, \\__/ | \\ |___ ${colors.green}\\`-._,-`-,${colors.reset} ${colors.iblue}|||||||||| ${colors.reset}${colors.dim}|_____|_| |___|_____|_| |_|_____| |_|\\__,_|_.__/|___/
${colors.green}`._,._,\'${colors.reset} ${colors.iblue}|||||||||| ${colors.reset}${colors.bold}${workflow_name} ${workflow_version}${colors.reset}
${colors.purple} ${workflow.manifest.name} v${workflow.manifest.version}${colors.reset} ${NfcoreTemplate.dashedLine(monochrome_logs)}
${dashedLine(monochrome_logs)}
""".stripIndent() """.stripIndent()
) )
} }

View File

@ -10,22 +10,28 @@ class WorkflowMain {
" https://doi.org/10.1038/s41587-020-0439-x\n\n" " https://doi.org/10.1038/s41587-020-0439-x\n\n"
} }
// Print help to screen // Generate help string
public static String help(workflow, params, log) { public static String help(workflow, params, log) {
String line_sep = ' \\ \n\t' String line_sep = ' \\ \n\t'
def command_example = params.wf.example_cmd.join(line_sep) String command_example = params.wf.example_cmd.join(line_sep)
def command = 'nextflow run ' + workflow.manifest.name + line_sep + command_example String command = 'nextflow run ' + workflow.manifest.name + line_sep + command_example
def help_string = '' String help_string = ''
help_string += NfcoreTemplate.logo(workflow, params.monochrome_logs)
help_string += NfcoreSchema.paramsHelp(workflow, params, command) help_string += NfcoreSchema.paramsHelp(workflow, params, command)
help_string += '\n' + citation(workflow) + '\n' help_string += '\n' + citation(workflow) + '\n'
return help_string return help_string
} }
// Print parameter summary log to screen // Generate parameter summary log string
public static String paramsSummaryLog(workflow, params, log) { public static String paramsSummaryLog(workflow, params, log) {
def summary_log = '' String workflow_version = NfcoreTemplate.version(workflow)
String summary_log = ''
summary_log += NfcoreTemplate.logo(workflow, params.monochrome_logs)
summary_log += NfcoreSchema.paramsSummaryLog(workflow, params) summary_log += NfcoreSchema.paramsSummaryLog(workflow, params)
summary_log += '\n' + citation(workflow) + '\n' summary_log += '\n' + citation(workflow) + '\n'
summary_log += NfcoreTemplate.dashedLine(params.monochrome_logs)
summary_log += "\nThis is ${workflow.manifest.name} ${workflow_version}.\n"
summary_log += NfcoreTemplate.dashedLine(params.monochrome_logs)
return summary_log return summary_log
} }
@ -37,6 +43,23 @@ class WorkflowMain {
System.exit(0) System.exit(0)
} }
// Print workflow version and exit on --version
if (params.version) {
String workflow_version = NfcoreTemplate.version(workflow)
log.info "${workflow.manifest.name} ${workflow_version}"
System.exit(0)
}
// Explode on conda
// conda.enabled seems to be backward compatible but wrap this
// in a generic catch just in case
try {
if (workflow.session.config.conda.enabled) {
log.error "Sorry, this workflow is not compatible with Conda, please use -profile standard (Docker) or -profile singularity."
System.exit(1)
}
} catch(Exception e) {}
// Validate workflow parameters via the JSON schema // Validate workflow parameters via the JSON schema
if (params.validate_params) { if (params.validate_params) {
NfcoreSchema.validateParameters(workflow, params, log) NfcoreSchema.validateParameters(workflow, params, log)

33
main.nf
View File

@ -306,7 +306,6 @@ process makeReport {
input: input:
path versions path versions
path "params.json" path "params.json"
val denovo
path "pychopper_report/*" path "pychopper_report/*"
path"jaffal_csv/*" path"jaffal_csv/*"
val sample_ids val sample_ids
@ -322,7 +321,7 @@ process makeReport {
// Convert the sample_id arrayList. // Convert the sample_id arrayList.
sids = new BlankSeparatedList(sample_ids) sids = new BlankSeparatedList(sample_ids)
def report_name = "wf-transcriptomes-report.html" def report_name = "wf-transcriptomes-report.html"
def OPT_DENOVO = denovo ? "--denovo" : '' def OPT_DENOVO = params.transcriptome_source == "denovo" ? "--denovo" : ''
""" """
if [ -f "de_report/OPTIONAL_FILE" ]; then if [ -f "de_report/OPTIONAL_FILE" ]; then
dereport="" dereport=""
@ -432,15 +431,15 @@ workflow pipeline {
full_len_reads = summariseConcatReads.out.input_reads full_len_reads = summariseConcatReads.out.input_reads
pychopper_report = file("$projectDir/data/OPTIONAL_FILE") pychopper_report = file("$projectDir/data/OPTIONAL_FILE")
} }
if (params.transcriptome_assembly){ if (params.transcriptome_source != "precomputed"){
if (params.denovo){ if (params.transcriptome_source == "denovo"){
println("Doing de novo assembly") log.info("Doing de novo assembly")
assembly = denovo_assembly(full_len_reads, ref_genome) assembly = denovo_assembly(full_len_reads, ref_genome)
} else { } else {
build_minimap_index(ref_genome) build_minimap_index(ref_genome)
println("Doing reference based transcript analysis") log.info("Doing reference based transcript analysis")
assembly = reference_assembly(build_minimap_index.out.index, ref_genome, full_len_reads) assembly = reference_assembly(build_minimap_index.out.index, ref_genome, full_len_reads)
} }
assembly_stats = assembly.stats.map{ it -> it[1]}.collect() assembly_stats = assembly.stats.map{ it -> it[1]}.collect()
@ -455,7 +454,7 @@ workflow pipeline {
run_gffcompare(merge_gff_bundles.out.gff, ref_annotation) run_gffcompare(merge_gff_bundles.out.gff, ref_annotation)
if (params.denovo){ if (params.transcriptome_source == "denovo"){
// Use the per-sample, de novo-assembled CDS // Use the per-sample, de novo-assembled CDS
seq_for_transcriptome_build = assembly.cds seq_for_transcriptome_build = assembly.cds
}else { }else {
@ -463,7 +462,7 @@ workflow pipeline {
// So map this reference to all sample_ids // So map this reference to all sample_ids
seq_for_transcriptome_build = sample_ids.flatten().combine(Channel.fromPath(params.ref_genome)) seq_for_transcriptome_build = sample_ids.flatten().combine(Channel.fromPath(params.ref_genome))
} }
get_transcriptome( get_transcriptome(
merge_gff_bundles.out.gff merge_gff_bundles.out.gff
.join(run_gffcompare.out.gffcmp_dir) .join(run_gffcompare.out.gffcmp_dir)
@ -517,7 +516,6 @@ workflow pipeline {
makeReport( makeReport(
software_versions, software_versions,
workflow_params, workflow_params,
params.denovo,
pychopper_report, pychopper_report,
jaffal_out, jaffal_out,
summariseConcatReads.out.summary.map{it->it[0]}.collect(), summariseConcatReads.out.summary.map{it->it[0]}.collect(),
@ -541,19 +539,18 @@ workflow pipeline {
} }
if (!use_ref_ann && !params.denovo && params.transcriptome_assembly){ if (!use_ref_ann && params.transcriptome_source == "reference-guided"){
results = assembly.stats.concat( results = assembly.stats.concat(
get_transcriptome.out.transcriptome.flatMap(map_sample_ids_cls)) get_transcriptome.out.transcriptome.flatMap(map_sample_ids_cls))
.map {it -> it[1]} .map {it -> it[1]}
.concat(results) .concat(results)
} }
if (params.denovo){ if (params.transcriptome_source == "denovo"){
results = assembly.cds.concat( results = assembly.cds.concat(
assembly.stats, assembly.stats,
seq_for_transcriptome_build, seq_for_transcriptome_build,
get_transcriptome.out.transcriptome.flatMap(map_sample_ids_cls), get_transcriptome.out.transcriptome.flatMap(map_sample_ids_cls),
merge_gff_bundles.out.gff,
assembly.opt_qual_ch.flatMap { assembly.opt_qual_ch.flatMap {
it -> it ->
l = [] l = []
@ -596,10 +593,12 @@ workflow {
error = "--fastq: File doesn't exist, check path." error = "--fastq: File doesn't exist, check path."
} }
if (!params.denovo && !params.ref_genome){ if (params.transcriptome_source == "precomputed" && !params.ref_transcriptome){
error = "--ref_genome must be supplied unless doing de novo assembly (--denovo)" error = "As transcriptome source parameter is precomputed you must include a ref_transcriptome parameter"
}
if (params.transcriptome_source == "reference-guided" && !params.ref_genome){
error = "As transcriptome source is reference guided you must include a ref_genome parameter"
} }
if (params.ref_genome){ if (params.ref_genome){
ref_genome = file(params.ref_genome, type: "file") ref_genome = file(params.ref_genome, type: "file")
if (!ref_genome.exists()) { if (!ref_genome.exists()) {
@ -609,7 +608,7 @@ workflow {
ref_genome = file("$projectDir/data/OPTIONAL_FILE") ref_genome = file("$projectDir/data/OPTIONAL_FILE")
} }
if (params.denovo && params.ref_annotation) { if (params.transcriptome_source == "denovo" && params.ref_annotation) {
error = "Reference annotation with de denovo assembly is not supported" error = "Reference annotation with de denovo assembly is not supported"
} }
@ -648,7 +647,7 @@ workflow {
condition_sheet = file("$projectDir/data/OPTIONAL_FILE") condition_sheet = file("$projectDir/data/OPTIONAL_FILE")
} }
if (error){ if (error){
println(error) throw new Exception(error)
}else{ }else{
reads = fastq_ingress([ reads = fastq_ingress([
"input":params.fastq, "input":params.fastq,

View File

@ -15,10 +15,11 @@ params {
fastq = null fastq = null
ref_genome = null ref_genome = null
ref_annotation = null ref_annotation = null
transcriptome_assembly = true transcriptome_source = "reference-guided"
threads = 4 threads = 4
// Thresholds for viewing isoforms in report table // Thresholds for viewing isoforms in report table
isoform_table_nrows = 5000 isoform_table_nrows = 5000
out_dir = "output" out_dir = "output"
sample = null sample = null
@ -26,8 +27,9 @@ params {
wfversion = "v0.1.6" wfversion = "v0.1.6"
aws_image_prefix = null aws_image_prefix = null
aws_queue = null aws_queue = null
report_name = "report"
process_label = "isoforms" process_label = "isoforms"
analyse_unclassified = false
version = false
monochrome_logs = false monochrome_logs = false
validate_params = true validate_params = true
@ -72,52 +74,9 @@ params {
disable_ping = false disable_ping = false
//// Denovo-specific parameters //// Denovo-specific parameters
denovo = false
isOnClust2_batch_size = -1
// Batch size in kilobases (if -1 then it is calculated based on the number of cores and bases): isOnClust2_sort_options = "--batch-size -1 --kmer-size 11 --window-size 15 --min-shared 5 --min-qual 7.0 --mapped-threshold 0.65 --aligned-threshold 0.2 --min-fraction 0.8 --min-prob-no-hits 0.0 -M -1 -P 500 -g 50 -c 150 -F 2"
batch_size = -1
// Maximum sequences per input batch (-1 means no limit):
batch_max_seq = -1
// Clustering mode:
cls_mode = "sahlin"
// Kmer size:
kmer_size = 11
// Window size:
window_size = 15
// Minimum cluser size in the left batch:
min_left_cls = 2
// Consensus period (-1 means no consensus):
consensus_period = 500
// Minimum consensus sample size:
consensus_minimum = 50
// Maximum consensus sample size:
consensus_maximum = -150
// Minimum number of minimizers shared between read and cluster:
min_shared = 5
// Minimum average quality value:
min_qual = 7.0
// Minmum mapped fraction of read to be included in cluster:
mapped_threshold = 0.65
// Minimum aligned fraction of read to be included in cluster:
aligned_threshold = 0.2
// Minimum fraction of minimizers shared compared to best hit, in order to continue mapping:
min_fraction = 0.8
// Minimum probability for i consecutive minimizers to be different between read and representative:
min_prob_no_hits = 0.1
////// Fusion detection parameters ////// Fusion detection parameters
jaffal_refBase = null jaffal_refBase = null
@ -146,6 +105,8 @@ params {
"--jaffal_genome hg38", "--jaffal_genome hg38",
"--jaffal_annotation genCode22" "--jaffal_annotation genCode22"
] ]
agent = null
container_sha = "sha3d3c83523695550f398cbe095551b1192de5085a"
} }
} }
@ -153,10 +114,10 @@ manifest {
name = 'epi2me-labs/wf-transcriptomes' name = 'epi2me-labs/wf-transcriptomes'
author = 'Oxford Nanopore Technologies' author = 'Oxford Nanopore Technologies'
homePage = 'https://github.com/epi2me-labs/wf-transcriptomes' homePage = 'https://github.com/epi2me-labs/wf-transcriptomes'
description = 'RNA/cDNA isoform analysis workflow' description = 'Transcriptome analysis workflow including gene fusions and differential expression'
mainScript = 'main.nf' mainScript = 'main.nf'
nextflowVersion = '>=20.10.0' nextflowVersion = '>=20.10.0'
//version = 'v0.0.1' version = 'v0.1.6'
} }
executor { executor {
@ -166,11 +127,15 @@ executor {
} }
} }
epi2melabs {
tags = "isoforms, transcriptomics, denovo"
}
// used by default for "standard" (docker) and singularity profiles, // used by default for "standard" (docker) and singularity profiles,
// other profiles may override. // other profiles may override.
process { process {
withLabel:isoforms { withLabel:isoforms {
container = "ontresearch/wf-transcriptomes:${params.wfversion}" container = "ontresearch/wf-transcriptomes:${params.wf.container_sha}"
} }
shell = ['/bin/bash', '-euo', 'pipefail'] shell = ['/bin/bash', '-euo', 'pipefail']
} }
@ -197,21 +162,9 @@ profiles {
} }
// profile using conda environments
conda { conda {
docker.enabled = false conda.enabled = true
process {
withLabel:isoforms {
conda = "${projectDir}/environment.yaml"
}
shell = ['/bin/bash', '-euo', 'pipefail']
} }
conda {
enabled = true // required for 22.08
cacheDir = ""
useMamba = true
}
}
// Using AWS batch. // Using AWS batch.
// May need to set aws.region and aws.batch.cliPath // May need to set aws.region and aws.batch.cliPath
@ -221,7 +174,7 @@ profiles {
queue = "${params.aws_queue}" queue = "${params.aws_queue}"
memory = '8G' memory = '8G'
withLabel:isoforms { withLabel:isoforms {
container = "${params.aws_image_prefix}-wf-transcriptomes:${params.wfversion}" container = "${params.aws_image_prefix}-wf-transcriptomes:${params.wf.container_sha}-root"
} }
shell = ['/bin/bash', '-euo', 'pipefail'] shell = ['/bin/bash', '-euo', 'pipefail']
} }

File diff suppressed because one or more lines are too long

View File

@ -170,7 +170,7 @@ process make_batches {
minimum_batch_size = 2000 minimum_batch_size = 2000
""" """
b=0 b=0
if [ ${params.batch_size} -lt \$b ]; if [ ${params.isOnClust2_batch_size} -lt \$b ];
then then
nr_bases=\$(seqkit stats -T $fastq|cut -f 5| sed '2q;d') nr_bases=\$(seqkit stats -T $fastq|cut -f 5| sed '2q;d')
let batch_size=\$nr_bases/1000/$maxcpus let batch_size=\$nr_bases/1000/$maxcpus
@ -179,19 +179,13 @@ process make_batches {
batch_size=$minimum_batch_size batch_size=$minimum_batch_size
fi fi
else else
batch_size=${params.batch_size} batch_size=${params.isOnClust2_batch_size}
fi fi
echo "Batch size:\$batch_size"; echo "Batch size:\$batch_size";
echo "Num bases: \$nr_bases"; echo "Num bases: \$nr_bases";
init_cls_options="--batch-size \$batch_size --kmer-size ${params.kmer_size} --window-size ${params.window_size} \ mkdir -p sorted; isONclust2 sort $params.isOnClust2_sort_options -v -o sorted $fastq;
--min-shared ${params.min_shared} --min-qual ${params.min_qual} \
--mapped-threshold ${params.mapped_threshold} --aligned-threshold ${params.aligned_threshold} \
--min-fraction ${params.min_fraction} --min-prob-no-hits ${params.min_prob_no_hits} \
-M ${params.batch_max_seq} -P ${params.consensus_period} -g ${params.consensus_minimum} \
-c ${params.consensus_maximum} -F ${params.min_left_cls} "
mkdir -p sorted; isONclust2 sort \$init_cls_options -v -o sorted $fastq;
""" """
} }