-
Notifications
You must be signed in to change notification settings - Fork 83
Open
Labels
Milestone
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 :)