Skip to content
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
4 changes: 2 additions & 2 deletions modules/local/combinebeds/reads/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ process COMBINEBEDS_READS {

output:
tuple val(meta), path("${prefix}.bed"), emit: combined
path "*.png" , emit: plots
path "*.json" , emit: multiqc
path "*.png" , emit: plots, optional: true
path "*.json" , emit: multiqc, optional: true
path "versions.yml" , emit: versions

script:
Expand Down
49 changes: 25 additions & 24 deletions modules/local/combinebeds/reads/templates/reads.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,31 +38,32 @@
# Investigate read-level agreement
df_bsj_groups = df.group_by(*bsj_columns, "reads").agg(pl.col("tool").unique()).collect()

# Plot read-level agreement
bsj_upset_data = from_memberships(df_bsj_groups["tool"].to_list())
bsj_upset = UpSet(bsj_upset_data, show_counts=True, subset_size="count")
bsj_upset.plot()
plot_file = "${prefix}:read_agreement.png"
plt.savefig(plot_file)
plt.close()

# MultiQC
image_string = base64.b64encode(open(plot_file, "rb").read()).decode("utf-8")
image_html = f'<div class="mqc-custom-content-image"><img src="data:image/png;base64,{image_string}" /></div>'

multiqc = {
'id': f"{meta_id}_read_agreement",
'parent_id': "read_agreement",
'parent_name': 'Read agreement',
'parent_description': 'While different tools may agree on the presence of a BSJ, they may disagree on the reads that support it. These plots show the read-level agreement between tools for each BSJ.',
'section_name': meta_id,
'description': f'UpSet plot showing the read-level agreement between tools for each BSJ in {meta_id}',
'plot_type': 'image',
'data': image_html
}
if len(tools) > 1:
# Plot read-level agreement
bsj_upset_data = from_memberships(df_bsj_groups["tool"].to_list())
bsj_upset = UpSet(bsj_upset_data, show_counts=True, subset_size="count")
bsj_upset.plot()
plot_file = "${prefix}:read_agreement.png"
plt.savefig(plot_file)
plt.close()

# MultiQC
image_string = base64.b64encode(open(plot_file, "rb").read()).decode("utf-8")
image_html = f'<div class="mqc-custom-content-image"><img src="data:image/png;base64,{image_string}" /></div>'

multiqc = {
'id': f"{meta_id}_read_agreement",
'parent_id': "read_agreement",
'parent_name': 'Read agreement',
'parent_description': 'While different tools may agree on the presence of a BSJ, they may disagree on the reads that support it. These plots show the read-level agreement between tools for each BSJ.',
'section_name': meta_id,
'description': f'UpSet plot showing the read-level agreement between tools for each BSJ in {meta_id}',
'plot_type': 'image',
'data': image_html
}

with open(f"{meta_id}_read_agreement_mqc.json", "w") as f:
f.write(json.dumps(multiqc, indent=4))
with open(f"{meta_id}_read_agreement_mqc.json", "w") as f:
f.write(json.dumps(multiqc, indent=4))

df_bsj_groups = df_bsj_groups.with_columns(
tool_count = pl.col("tool").list.len()
Expand Down
4 changes: 0 additions & 4 deletions subworkflows/local/combine_transcriptomes.nf
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ workflow COMBINE_TRANSCRIPTOMES {
)
ch_versions = ch_versions.mix(TRANSCRIPTOME.out.versions)

TRANSCRIPTOME.out.gffread_fasta.ifEmpty {
error 'No transcriptome fasta file produced.'
}

emit:
fasta = TRANSCRIPTOME.out.gffread_fasta
gtf = EXCLUDE_OVERLONG_TRANSCRIPTS.out.output
Expand Down
10 changes: 4 additions & 6 deletions subworkflows/local/prepare_genome.nf
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,10 @@ workflow PREPARE_GENOME {
SAMTOOLS_FAIDX(ch_fasta, [[], []])
ch_versions = ch_versions.mix(SAMTOOLS_FAIDX.out.versions)

ch_circexplorer2_reference = Channel.empty()
if (detection_tools.intersect(['circexplorer2', 'mapsplice']).size() > 0) {
CIRCEXPLORER2_REFERENCE(UCSC_GTFTOGENEPRED.out.genepred, [], false)
ch_circexplorer2_reference = CIRCEXPLORER2_REFERENCE.out.output.map { _meta, file -> file }.collect()
ch_versions = ch_versions.mix(CIRCEXPLORER2_REFERENCE.out.versions)
}
// Circexplorer2 reference is needed for annotation
CIRCEXPLORER2_REFERENCE(UCSC_GTFTOGENEPRED.out.genepred, [], false)
ch_circexplorer2_reference = CIRCEXPLORER2_REFERENCE.out.output.map { _meta, file -> file }.collect()
ch_versions = ch_versions.mix(CIRCEXPLORER2_REFERENCE.out.versions)

emit:
gtf = ch_gtf
Expand Down