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

add branch in case of no fusions #388

Merged
merged 5 commits into from
Sep 4, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Set html files as optional in fusionreport [#380](https://github.com/nf-core/rnafusion/pull/380)
- Provide gene count file by default when running STAR_FOR_STARFUSION [#385](https://github.com/nf-core/rnafusion/pull/385)
- Fix fusion-report issue with MACOXS directories [#386](https://github.com/nf-core/rnafusion/pull/386)
- The fusion lists is updated to contain to branches, one in case no fusions are detected and one for if fusions are detected, that will be used to feed to fusioninspector, megafusion, arriba visualisation [#388](https://github.com/nf-core/rnafusion/pull/388)
rannick marked this conversation as resolved.
Show resolved Hide resolved

### Removed

Expand Down
12 changes: 8 additions & 4 deletions subworkflows/local/fusioninspector_workflow.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,23 @@ workflow FUSIONINSPECTOR_WORKFLOW {
main:
ch_versions = Channel.empty()
index ="${params.starfusion_ref}"
ch_fusion_list = params.fusioninspector_filter ? fusion_list_filtered : fusion_list
ch_fusion_list = ( params.fusioninspector_filter ? fusion_list_filtered : fusion_list )
.branch{
no_fusions: it[1].size() == 0
fusions: it[1].size() > 0
}

if (params.whitelist) {
ch_whitelist = ch_fusion_list.combine(Channel.value(file(params.whitelist, checkIfExists:true)))
ch_whitelist = ch_fusion_list.fusions.combine(Channel.value(file(params.whitelist, checkIfExists:true)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if there are no fusions here? It creates a ch_fusion_list.no_fusions above, but the here ch_fusion_list.fusions would be NULL, then this code would essentially output ch_whitelist = null. Then CAT_CAT(ch_whitelist) should lead to a NullPointerException or a similar error, is that correct?

Then maybe we could check first whether there are fusions?

if (ch_whitelist) {
    CAT_CAT(ch_whitelist)
} else {
    // some action when there are no fusions
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I understand: in case of no fusions, ch_fusion_list.fusions and ch_whitelist do not exist and the processes are not triggered. No error is thrown.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok awesome 👍

.map { meta, fusions, whitelist -> [ meta, [fusions, whitelist] ] }

CAT_CAT(ch_whitelist) // fusioninspector takes care of possible duplicates
ch_versions = ch_versions.mix(CAT_CAT.out.versions)

ch_fusion_list = CAT_CAT.out.file_out
ch_fusion_list.fusions = CAT_CAT.out.file_out
}

reads_fusion = reads.join(ch_fusion_list )
reads_fusion = reads.join(ch_fusion_list.fusions )

FUSIONINSPECTOR( reads_fusion, index)
ch_versions = ch_versions.mix(FUSIONINSPECTOR.out.versions)
Expand Down