Skip to content

Commit

Permalink
Switch to RData based approach in ehmm
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed Nov 30, 2023
1 parent 35108ec commit 424f200
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
1 change: 0 additions & 1 deletion bin/split_datasets.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env Rscript

library(ehmm)
library(argparser)
library(rtracklayer)
library(GenomicRanges)
Expand Down
18 changes: 7 additions & 11 deletions modules/local/ehmm/construct_model.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,22 @@ process CONSTRUCT_MODEL {
container 'registry.hub.docker.com/bigdatainbiomedicine/inspect-ehmm'

input:
tuple path(background_model, stageAs: 'background.model'), path(background_counts, stageAs: 'background.counts'), path(background_bed, stageAs: 'background.bed')
tuple path(enhancer_model, stageAs: 'enhancers.model'), path(enhancers_counts, stageAs: 'enhancers.counts'), path(enhancers_bed, stageAs: 'enhancers.bed')
tuple path(promoter_model, stageAs: 'promoters.model'), path(promoters_counts, stageAs: 'promoters.counts'), path(promoters_bed, stageAs: 'promoters.bed')
path(background_model, stageAs: 'background.RData')
path(enhancer_model, stageAs: 'enhancers.RData')
path(promoter_model, stageAs: 'promoters.RData')

output:
path('model'), emit: model_dir
path('model/model.txt'), emit: model
path('model/model.RData'), emit: model

script:
"""
mkdir -p model
ehmm constructModel \\
--model.e ${enhancer_model} \\
--counts.e ${enhancers_counts} \\
--regions.e ${enhancers_bed} \\
--model.p ${promoter_model} \\
--counts.p ${promoters_counts} \\
--regions.p ${promoters_bed} \\
--model.bg ${background_model} \\
--enhancers ${enhancer_model} \\
--promoters ${promoter_model} \\
--background ${background_model} \\
--nthreads ${task.cpus} \\
--outdir model
"""
Expand Down
2 changes: 1 addition & 1 deletion modules/local/ehmm/learn_model.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ process LEARN_MODEL {
val(pseudocount)

output:
tuple path("${meta.model}/model.txt"), path("${meta.model}/countmatrix.txt"), path("${meta.model}/segmentation.bed"), emit: model
path("${meta.model}/model.RData"), emit: model

script:
marks_string = ""
Expand Down
2 changes: 1 addition & 1 deletion modules/local/ehmm/split_datasets.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ process SPLIT_DATASETS {
tag "split_datasets"
label 'process_high_memory'

container 'registry.hub.docker.com/bigdatainbiomedicine/inspect-ehmm'
container 'registry.hub.docker.com/bigdatainbiomedicine/inspect-r'

input:
tuple val(meta), path(background)
Expand Down
8 changes: 4 additions & 4 deletions subworkflows/local/ehmm.nf
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ workflow EHMM {
)

ch_enhancers = APPLY_MODEL.out.enhancers
.map{meta, regions -> [[id: meta["state"] + "_enhancers",
state: meta["state"],
.map{meta, regions -> [[id: meta["id"] + "_enhancers",
state: meta["id"],
antibody: "enhancers"], regions]}
.filter{meta, regions -> regions.size() > 0}
ch_promoters = APPLY_MODEL.out.promoters
.map{meta, regions -> [[id: meta["state"] + "_promoters",
state: meta["state"],
.map{meta, regions -> [[id: meta["id"] + "_promoters",
state: meta["id"],
antibody: "promoters"], regions]}
.filter{meta, regions -> regions.size() > 0}

Expand Down

0 comments on commit 424f200

Please sign in to comment.