Skip to content

Commit

Permalink
Finish preparations for chromHMM
Browse files Browse the repository at this point in the history
  • Loading branch information
nictru committed Mar 26, 2024
1 parent 814eb4a commit 19a2dc0
Show file tree
Hide file tree
Showing 8 changed files with 203 additions and 12 deletions.
8 changes: 7 additions & 1 deletion assets/schema_input_bam.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
"items": {
"type": "object",
"properties": {
"sample": {
"type": "string",
"pattern": "^\\S+$",
"errorMessage": "Sample name must be provided and cannot contain spaces",
"meta": ["id"]
},
"condition": {
"type": "string",
"pattern": "^\\S+$",
Expand Down Expand Up @@ -34,6 +40,6 @@
"errorMessage": "Control file must be provided and must be a .bam file"
}
},
"required": ["condition", "antibody", "signal", "control"]
"required": ["sample", "condition", "antibody", "signal", "control"]
}
}
7 changes: 7 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ process {
ext.prefix = {"${meta.id}.merged"}
}

withName: ".*:CHROMHMM:REHEADER.*" {
ext.args = "-c 'sed -e \"s/SN:\\([0-9XY]*\\)/SN:chr\\\\1/\" -e \"s/SN:MT/SN:chrM/\"'"
}

withName: ".*:CHROMHMM:REHEADER_CONTROL" {
ext.prefix = {"${meta.id}_control"}
}
withName: ".*DYNAMITE:FILTER" {
ext.args = {"'BEGIN{OFS=\"\\t\"} NR==1 || (\$2 >= ${params.dynamite_min_regression} || \$2 <= -${params.dynamite_min_regression} )'"}
ext.prefix = {"${meta.id}.filtered"}
Expand Down
49 changes: 38 additions & 11 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,58 @@
"atlasgeneannotationmanipulation/gtf2featureannotation": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"bedtools/merge": {
"branch": "master",
"git_sha": "575e1bc54b083fb15e7dd8b5fcc40bea60e8ce83",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"bedtools/sort": {
"branch": "master",
"git_sha": "575e1bc54b083fb15e7dd8b5fcc40bea60e8ce83",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"bedtools/subtract": {
"branch": "master",
"git_sha": "3b248b84694d1939ac4bb33df84bf6233a34d668",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"cat/cat": {
"branch": "master",
"git_sha": "9437e6053dccf4aafa022bfd6e7e9de67e625af8",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"deseq2/differential": {
"branch": "master",
"git_sha": "9326d73af3fbe2ee90d9ce0a737461a727c5118e",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"gawk": {
"branch": "master",
"git_sha": "dc3527855e7358c6d8400828754c0caa5f11698f",
"installed_by": ["modules"]
"installed_by": [
"modules"
]
},
"samtools/reheader": {
"branch": "master",
"git_sha": "f4596fe0bdc096cf53ec4497e83defdb3a94ff62",
"installed_by": [
"modules"
]
}
}
},
Expand All @@ -47,20 +68,26 @@
"utils_nextflow_pipeline": {
"branch": "master",
"git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa",
"installed_by": ["subworkflows"]
"installed_by": [
"subworkflows"
]
},
"utils_nfcore_pipeline": {
"branch": "master",
"git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa",
"installed_by": ["subworkflows"]
"installed_by": [
"subworkflows"
]
},
"utils_nfvalidation_plugin": {
"branch": "master",
"git_sha": "5caf7640a9ef1d18d765d55339be751bb0969dfa",
"installed_by": ["subworkflows"]
"installed_by": [
"subworkflows"
]
}
}
}
}
}
}
}
8 changes: 8 additions & 0 deletions modules/nf-core/samtools/reheader/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions modules/nf-core/samtools/reheader/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions modules/nf-core/samtools/reheader/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions subworkflows/local/chromhmm.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Modules
include { SAMTOOLS_REHEADER as REHEADER_SIGNAL } from '../../modules/nf-core/samtools/reheader'
include { SAMTOOLS_REHEADER as REHEADER_CONTROL } from '../../modules/nf-core/samtools/reheader'

workflow CHROMHMM {

take:
ch_samplesheet_bam

main:

ch_versions = Channel.empty()

ch_bams = ch_samplesheet_bam.map{meta, signal, control -> [meta, ["signal", "control"], [signal, control]]}
.transpose()
.map{meta, type, bam -> [meta + [type: type], bam]}
.branch {meta, bam ->
control: meta.type == "control"
signal: meta.type == "signal"
}

def remove_type = {meta, bam -> [[ id: meta.id,
condition: meta.condition,
antibody: meta.antibody],
bam]}

ch_signal = REHEADER_SIGNAL (ch_bams.signal ).bam.map{meta, bam -> remove_type(meta, bam)}
ch_control = REHEADER_CONTROL(ch_bams.control).bam.map{meta, bam -> remove_type(meta, bam)}
ch_combined = ch_signal.join(ch_control)
ch_table = ch_combined .map{meta, signal, control -> [meta.condition, meta.antibody, signal.name, control.name]}
.collectFile() {
["cellmarktable.txt", it.join("\t") + "\n"]
}
ch_table.view()


emit:

versions = ch_versions // channel: [ versions.yml ]
}

3 changes: 3 additions & 0 deletions subworkflows/local/peaks.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ include { COMBINE_TABLES as AFFINITY_SUM } from '../../modules/local/combine_ta
// Subworkflows
include { FOOTPRINTING } from './footprinting'
include { MERGE_SAMPLES } from './merge_samples'
include { CHROMHMM } from './chromhmm'

workflow PEAKS {

Expand Down Expand Up @@ -56,6 +57,8 @@ workflow PEAKS {
ch_versions = ch_versions.mix(SORT_PEAKS.out.versions)
}

CHROMHMM(ch_samplesheet_bam)

FILTER_PWMS(tfs, pwms)

STARE(
Expand Down

0 comments on commit 19a2dc0

Please sign in to comment.