Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
[scanpy] Add multi-sample QC workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
dweemx committed Jul 8, 2021
1 parent 46c35f1 commit 7f7c630
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 10 deletions.
29 changes: 26 additions & 3 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -273,15 +273,15 @@ workflow single_sample_qc {

include {
single_sample_qc as SINGLE_SAMPLE_QC;
} from './main' params(params)
} from './src/scanpy/main' params(params)
include {
PUBLISH as PUBLISH_SINGLE_SAMPLE_SCOPE;
PUBLISH;
} from "./src/utils/workflows/utils" params(params)

getDataChannel | SINGLE_SAMPLE_QC

if(params.utils?.publish) {
PUBLISH_SINGLE_SAMPLE_SCOPE(
PUBLISH(
SINGLE_SAMPLE_QC.out.filtered,
"SINGLE_SAMPLE_QC",
"h5ad",
Expand All @@ -292,6 +292,29 @@ workflow single_sample_qc {

}

workflow multi_sample_qc {

include {
multi_sample_qc as MULTI_SAMPLE_QC;
} from './src/scanpy/main' params(params)
include {
PUBLISH;
} from "./src/utils/workflows/utils" params(params)

getDataChannel | MULTI_SAMPLE_QC

if(params.utils?.publish) {
PUBLISH(
MULTI_SAMPLE_QC.out.filtered,
"MULTI_SAMPLE_QC",
"h5ad",
null,
false
)
}

}

workflow multi_sample {

include {
Expand Down
52 changes: 45 additions & 7 deletions src/scanpy/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ import static groovy.json.JsonOutput.*

//////////////////////////////////////////////////////
// Import sub-workflows from the modules:

include {
getBaseName;
} from '../utils/processes/files.nf'
include {
FILTER_AND_ANNOTATE_AND_CLEAN;
} from '../utils/workflows/filterAnnotateClean.nf' params(params)
include {
INIT;
getDataChannel;
} from '../utils/workflows/utils' params(params)
INIT(params)
include {
SC__FILE_CONVERTER
SC__FILE_CONVERTER;
SC__FILE_CONCATENATOR;
} from '../utils/processes/utils' params(params)
include {
getDataChannel
Expand All @@ -25,7 +30,6 @@ include {
SINGLE_SAMPLE
} from './workflows/single_sample.nf' params(params)


workflow single_sample {

main:
Expand All @@ -38,9 +42,43 @@ workflow single_sample {

workflow single_sample_qc {

take:
data

main:
getDataChannel | \
SC__FILE_CONVERTER | \
QC_FILTER
out = SC__FILE_CONVERTER( data )
out = FILTER_AND_ANNOTATE_AND_CLEAN( out )
QC_FILTER( out )

}

workflow multi_sample_qc {

take:
data

main:
if(!params?.sc?.scanpy?.filter) {
throw new Exception("VSN ERROR: Missing params.sc.scanpy.filter config.")
}
if(!params?.sc?.file_concatenator) {
throw new Exception("VSN ERROR: Missing params.sc.file_concatenator config.")
}

out = data | \
SC__FILE_CONVERTER | \
FILTER_AND_ANNOTATE_AND_CLEAN

out = QC_FILTER( out ).filtered
out = SC__FILE_CONCATENATOR(
out.map {
it -> it[1]
}.toSortedList(
{ a, b -> getBaseName(a, "SC") <=> getBaseName(b, "SC") }
)
)

emit:
filtered = out

}

0 comments on commit 7f7c630

Please # to comment.