Skip to content
Draft
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
14 changes: 5 additions & 9 deletions subworkflows/local/per_group.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,28 @@ include { LIANA_RANKAGGREGATE } from '../../modules/local/liana/rankaggregate

workflow PER_GROUP {
take:
ch_h5ad_both // channel: [ integration, h5ad ]
ch_h5ad_with_neighbors // channel: [ integration, h5ad ]
ch_h5ad_no_neighbors // channel: [ merged, h5ad ]
ch_h5ad_with_neighbors // channel: [ meta, h5ad ], anndata objects with neighbors, one per embedding and annotation
ch_h5ad_no_neighbors // channel: [ meta, h5ad ], anndata objects without neighbors, one per annotation

main:
ch_versions = Channel.empty()
ch_uns = Channel.empty()
ch_multiqc_files = Channel.empty()

ch_with_neighbors = ch_h5ad_both.mix(ch_h5ad_with_neighbors)
ch_no_neighbors = ch_h5ad_both.mix(ch_h5ad_no_neighbors)

SCANPY_PAGA(ch_with_neighbors)
SCANPY_PAGA(ch_h5ad_with_neighbors)
ch_versions = ch_versions.mix(SCANPY_PAGA.out.versions)
// ch_obsp = ch_obsp.mix(SCANPY_PAGA.out.obsp)
ch_uns = ch_uns.mix(SCANPY_PAGA.out.uns)
ch_multiqc_files = ch_multiqc_files.mix(SCANPY_PAGA.out.multiqc_files)

if (!params.skip_liana) {
LIANA_RANKAGGREGATE(ch_no_neighbors)
LIANA_RANKAGGREGATE(ch_h5ad_no_neighbors)
ch_versions = ch_versions.mix(LIANA_RANKAGGREGATE.out.versions)
ch_uns = ch_uns.mix(LIANA_RANKAGGREGATE.out.uns)
}

if (!params.skip_rankgenesgroups) {
SCANPY_RANKGENESGROUPS(ch_no_neighbors)
SCANPY_RANKGENESGROUPS(ch_h5ad_no_neighbors)
ch_versions = ch_versions.mix(SCANPY_RANKGENESGROUPS.out.versions)
ch_uns = ch_uns.mix(SCANPY_RANKGENESGROUPS.out.uns)
ch_multiqc_files = ch_multiqc_files.mix(SCANPY_RANKGENESGROUPS.out.multiqc_files)
Expand Down
15 changes: 12 additions & 3 deletions workflows/scdownstream.nf
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,19 @@ workflow SCDOWNSTREAM {
ch_versions = ch_versions.mix(PSEUDOBULKING.out.versions)
}

ch_h5ad_both = CLUSTER.out.h5ad_clustering.map { meta, h5ad -> [meta + [obs_key: "${meta.id}_leiden"], h5ad] }

PER_GROUP(
CLUSTER.out.h5ad_clustering.map { meta, h5ad -> [meta + [obs_key: "${meta.id}_leiden"], h5ad] },
CLUSTER.out.h5ad_neighbors.map { meta, h5ad -> [meta + [obs_key: grouping_col], h5ad] },
ch_label_grouping.map { meta, h5ad -> [meta + [obs_key: grouping_col], h5ad] },
// Run on each clustering resolution for each embedding
ch_h5ad_both.mix(
// And on the label column for each embedding
CLUSTER.out.h5ad_neighbors.map { meta, h5ad -> [meta + [obs_key: grouping_col], h5ad] }
),
// Run on each clustering (there is one clustering per embedding and resolution)
ch_h5ad_both.mix(
// And on the label column
ch_label_grouping.map { meta, h5ad -> [meta + [obs_key: grouping_col], h5ad] }
),
)
ch_versions = ch_versions.mix(PER_GROUP.out.versions)
ch_uns = ch_uns.mix(PER_GROUP.out.uns)
Expand Down