DSL2 remove or change bamfiltering_genomicbamfilterflag
Nobody has claimed this yet.
- Dominant language
- Nextflow
- Stars
- 215
- Forks
- 91
- Avg merge
- 5m
- Merged PRs (30d)
- 1
Description
We have both the bamfiltering_genomicbamfilterflag and the bamfiltering_retainunmappedgenomicbam flags.
If I remember right, the idea at the beginning was to make the flag generic and restrain from named flags (e.g. set to 5 to remove unpaired reads and unmapped as desired).
However, we now have the situation that the bamfiltering_genomicbamfilterflag is conditioned on the bamfiltering_retainunmappedgenomicbam.
(in modules.conf)
withName: SAMTOOLS_VIEW_BAM_FILTERING {
tag = { "${meta.reference}|${meta.sample_id}_${meta.library_id}" }
ext.args = [
"-q ${params.bamfiltering_mappingquality}",
params.bamfiltering_retainunmappedgenomicbam ? '' : "-F ${params.bamfiltering_genomicbamfilterflag}",
].join(' ').trim()
ext.prefix = { "${meta.sample_id}_${meta.library_id}_${meta.reference}_filtered" }
publishDir = [
[
// data
path: { "${params.outdir}/read_filtering/filtered_bams/data/" },
mode: params.publish_dir_mode,
pattern: '*.bam',
enabled: params.bamfiltering_savefilteredbams
]
]
}
Problem
The bamfilter workflow will not behave as expected!
- If the filter flag is 1 (filter unpaired) but retain_unmapped is set, filtering will just not happen
- If the filter flag is 1 and retain_unmapped is not set, filtering will happen, but unmapped will still be retained.
Solutions
- Drop the filter-flag option (if its only used for mapped/unmapped)
- Update the filterflag based on the retain_unmapped flag (add 4 to if retain_unmapped is false) and only filter by flag
- make them independent (filter -F4 if not retain_unmapped and additionally -F filterflag) to allow for filtering weird flags like vendor-failed (etc.)
I think independent filtering would work best :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in modules.conf at the SAMTOOLS_VIEW_BAM_FILTERING configuration and trace how bamfiltering_genomicbamfilterflag and bamfiltering_retainunmappedgenomicbam become samtools arguments. Compare the current behavior with the three proposed solutions, focusing on the preferred independent filtering approach. Done means the two filtering choices work independently, including filtering additional flags such as vendor-failed reads.
Written by the indexing model from the issue text.
Assessment
- Domain
- bioinformatics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100