danimfernandes / tkgwv2

An ancient DNA relatedness pipeline for ultra-low coverage whole genome shotgun data
GNU General Public License v2.0
6 stars 2 forks source link

[bug][downsampleBam.R] Incorrect sampling argument when "mapLen <= downsampleN" #4

Open MaelLefeuvre opened 2 years ago

MaelLefeuvre commented 2 years ago

Hello Daniel,

I think I just noticed a small, easily fixable bug within one of your helper scripts, while manipulating extremely low coverage .bam files.

Bug description:

It looks like there's a small typo within the downsamplebam.R helper script, line 20, i.e.:

rat2 = 0.999999

This in turn returns an incorrect samtools view command, in the form of...

samtools view -s {seed}.0.999999 -b {bamfile}

Where, I'm suspecting the latter should instead be:

samtools view -s {seed}.999999 -b {bamfile}

This results in downsampleBam.R simply outputting samtools' error message (see example below) and continuing on

samtools view: Incorrect sampling argument "319.0.999999"

Bug reproducibility:

Proposed fix:

Change line downsampleBam.R:20 to:

rat2 = 999999

Anyway, hope this helps, and that I'm not mistaken!

Cheers,

Maël Lefeuvre

danimfernandes commented 2 years ago

Hi Maël, Sorry for the late reply, I was away, but that seems reasonable and I'll implement it once I test it. I might include some extra conditional checks beforehand too. Thanks very much for the improvement suggestion!