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

Filter and intersect #94

Merged
merged 6 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Added a second BEDTools intersect step to allow filtering and overlapping in the same workflow.

### Changed

### Fixed

- Updated PINTS version from 1.1.6 to 1.1.8 ([Fixes an issue where PINTS fails if one of the predictions was empty](https://github.com/hyulab/PINTS/issues/12))

### Deprecated

### Removed
Expand Down
7 changes: 6 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,12 @@ process {

withName: BEDTOOLS_INTERSECT_FILTER {
ext.prefix = { "${meta.id}_filtered" }
ext.args = { params.no_overlap ? "-v": "" }
ext.args = "-v"
}

withName: BEDTOOLS_INTERSECT {
ext.prefix = { "${meta.id}_intersect" }
ext.args = "-wa"
}

}
10 changes: 2 additions & 8 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ params {
assay_type = "GROseq"
skip_grohmm = true // FIXME Fails due to higher memory requirements
tuning_file = "${projectDir}/tests/subworkflows/local/grohmm/tuningparams_small.csv"
filter_bed = "${projectDir}/tests/samplesheets/region.bed"
}

process {
// FIXME https://github.com/hyulab/PINTS/issues/12
withName: PINTS_CALLER {
ext.when = false
}
filter_bed = "${projectDir}/tests/samplesheets/unwanted_region.bed"
intersect_bed = "${projectDir}/tests/samplesheets/wanted_region.bed"
}
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
},
"pints/caller": {
"branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905"
"git_sha": "a8c6d338a76df3736215c93c27d9ccc7b88e9cf4"
},
"preseq/ccurve": {
"branch": "master",
Expand Down
15 changes: 8 additions & 7 deletions modules/nf-core/pints/caller/main.nf

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

7 changes: 7 additions & 0 deletions modules/nf-core/pints/caller/meta.yml

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

2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ params {
tuning_file = null

filter_bed = null
no_overlap = true
intersect_bed = null

// MultiQC options
multiqc_config = null
Expand Down
15 changes: 9 additions & 6 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,16 @@
"filter_bed": {
"type": "string",
"fa_icon": "fas fa-filter",
"pattern": "^\\S+\\.bed(\\.gz)?$"
"pattern": "^\\S+\\.bed(\\.gz)?$",
"description": "Undesired regions, that transcripts should not overlap with",
"help_text": "Promoter regions, or gene regions are a good example"
},
"no_overlap": {
"type": "boolean",
"default": true,
"fa_icon": "far fa-chart-bar",
"description": "Only report those entries in A that have no overlap in B"
"intersect_bed": {
"type": "string",
"fa_icon": "fas fa-sort-amount-desc",
"pattern": "^\\S+\\.bed(\\.gz)?$",
"description": "Desired regions, that transcripts should overlap with",
"help_text": "Histone Modifications(H3K4me1 and H3K27ac), or known TREs from the PINTS element matrix are examples"
}
},
"required": ["assay_type"],
Expand Down
11 changes: 7 additions & 4 deletions subworkflows/local/transcript_identification.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include { CAT_CAT } from '../../modules/nf-core/cat/cat/main'
include { BEDTOOLS_MERGE } from '../../modules/nf-core/bedtools/merge/main'
include { BEDTOOLS_SORT } from '../../modules/nf-core/bedtools/sort/main'
include { BEDTOOLS_INTERSECT as BEDTOOLS_INTERSECT_FILTER } from '../../modules/nf-core/bedtools/intersect/main'
include { BEDTOOLS_INTERSECT } from '../../modules/nf-core/bedtools/intersect/main'

include { HOMER_GROSEQ } from '../nf-core/homer/groseq/main'

Expand Down Expand Up @@ -58,12 +59,14 @@ workflow TRANSCRIPT_INDENTIFICATION {
if(params.filter_bed) {
ch_filter_bed = Channel.from(params.filter_bed)
BEDTOOLS_INTERSECT_FILTER ( ch_identification_bed.combine(ch_filter_bed), "bed" )
ch_identification_bed = BEDTOOLS_INTERSECT_FILTER.out.intersect
ch_versions = ch_versions.mix(BEDTOOLS_INTERSECT_FILTER.out.versions.first())
}

// Use non-filtered bed files if we skip filtering
if(!params.filter_bed) {
ch_identification_bed = BEDTOOLS_INTERSECT_FILTER.out.intersect
if(params.intersect_bed) {
ch_intersect_bed = Channel.from(params.intersect_bed)
BEDTOOLS_INTERSECT ( ch_identification_bed.combine(ch_intersect_bed), "bed" )
ch_identification_bed = BEDTOOLS_INTERSECT.out.intersect
ch_versions = ch_versions.mix(BEDTOOLS_INTERSECT_FILTER.out.versions.first())
}

ch_identification_bed
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions tests/samplesheets/wanted_region.bed
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
chr21 37267780 37267800
chr21 41362070 41362130