Skip to content

Commit

Permalink
Better help function :)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Peltzer authored and Alexander Peltzer committed Nov 19, 2018
1 parent 38c333e commit 3a52c83
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ def helpMessage() {
--bwamem Turn on BWA Mem instead of CM/BWA aln for mapping
BAM Filtering
--bam_retain_unmapped Keep all reads in BAM file for downstream analysis
--bam_mapping_quality_threshold Minimum mapping quality for reads filter
--bam_retain_unmapped Retains all unmapped reads in the BAM file (default)
--bam_separate_unmapped Separates mapped and unmapped reads, keep mapped BAM for downstream analysis.
--bam_unmapped_to_fastq Converts unmapped reads in BAM format to fastq.gz format.
--bam_discard_unmapped Discards unmapped reads in either FASTQ or BAM format, depending on choice in --bam_unmapped_rm_type

This comment has been minimized.

Copy link
@jfy133

jfy133 Nov 19, 2018

Member

What do you mean by --bam_discard_unmapped? To me discard means to throw away (i.e. delete). Why would you have an file format for stuff that is deleted.

Is not the first four flags enough? But where: --bam_discard_unmapped just removes the unmapped reads entirely from all files; --bam_separate_unmapped puts the unmapped reads in a BAM file, and --bam_unmapped_to_fastq overrides the default of the previous flag and instead puts it in FASTQ?

Or even, you could simplify further by requiring two options for --bam_separate_unmapped so if the user decides to do this they must specify what format?

Maybe this does work with the code, but I'm thinking from a users perspective ;)

This comment has been minimized.

Copy link
@apeltzer

apeltzer Nov 20, 2018

Member

Yeah I guess I'm thinking more from a programmers perspective :-P

This comment has been minimized.

Copy link
@jfy133

jfy133 Nov 20, 2018

Member

Hm, ok. If you want to keep it the way it is then we need to consider changing the description slightly

      --bam_discard_unmapped        Discard an unmapped read file, depending on choice in --

Removing references to bam or fastq in the description makes it clearer you are not trying to actually define the file type in this flag.

That said, I still don't think this makes complete sense/is unnecessarily over complicated.

In principle I think it makes it simpler to just have a single: --bam_discard_unmapped_bam.

Use cases would be, assuming someone wants the unmapped reads:

  1. does the user want unmapped reads in only bam format? Yes: use --bam_separate_unmapped
  2. does the user want unmapped reads in both bam and fastq? Do above but with --bam_unmapped_to_fastq
  3. does the user want unmapped reads in only fastq format? Do both 1) and 2) with --bam_unmapped_discard_bam

I think this would also work programatically. The current system in this commit I think has mixed messages with the one flag saying you do want to discard something but then an entire other flag that saying you also want to discard something, but additionally which one. The messages behind the flags are sort of overlapping.

Does this make sense? Or do you disagree?

This comment has been minimized.

Copy link
@apeltzer

apeltzer Nov 20, 2018

Member

No I honestly agree, my statement was just short because I'm jumping from meeting to meeting atm :-D

  1. would then require specifiying three parameters however, which is a bit much but I see no possibility to add that without these :-)

This comment has been minimized.

Copy link
@apeltzer

apeltzer Nov 20, 2018

Member

I'll copy this to an issue. Feels better to have this discussion there as well :-)

--bam_unmapped_rm_type Defines which unmapped read format to discard, options are "bam" or "fastq.gz".
--bam_mapping_quality_threshold Minimum mapping quality for reads filter, default 0.
DeDuplication
--dedupper Deduplication method to use
Expand Down Expand Up @@ -175,7 +179,7 @@ params.bwamem = false
params.bam_retain_unmapped = false
params.bam_discard_unmapped = false
params.bam_unmapped_to_fastq = false
params.bam_unmapped_keep_type = 'bam'
params.bam_unmapped_rm_type = 'bam'

params.bam_mapping_quality_threshold = 0

Expand Down Expand Up @@ -719,7 +723,7 @@ process samtools_filter {

script:
prefix="$bam" - ~/(\.bam)?/
rm_type = "${params.bam_unmapped_keep_type}" == 'bam' ? 'bam' : 'fastq.gz'
rm_type = "${params.bam_unmapped_rm_type}" == 'bam' ? 'bam' : 'fastq.gz'
rm_unmapped = "${params.bam_discard_unmapped}" ? "rm *.unmapped.${rm_type}" : ''
fq_convert = "${params.bam_unmapped_to_fastq}" ? "samtools fastq -tn ${prefix}.unmapped.bam | pigz -p ${task.cpus} > ${prefix}.unmapped.fq.gz" : ''

Expand Down

0 comments on commit 3a52c83

Please sign in to comment.