snippy icon indicating copy to clipboard operation
snippy copied to clipboard

`--targets` option only works if absolute path is given

Open pmagwene opened this issue 2 years ago • 3 comments

When trying to run snippy with calls to target sites of interest (in the form of a bed file), the freebayes-parallel part of the pipeline only works if the absolute path to the bed file is provide as the argument to the --targets option, otherwise snippy creates the path to the bedfile as a subfile within the specified --outdir.

For example,

snippy --targets my_sites.bed --outdir SAMPLE1 --R1 r1.fq --R2 r2.fq --ref myref.fa

Will create a freebayes command line with the following --targets specification:

--targets '/path/to/where/snippy/was/run/SAMPLE1/my_sites.bed

whereas the correct specification should be:

--targets '/path/to/where/snippy/was/run/my_sites.bed

I'm not a perl hacker, but the problem seems to be this line in the snippy source:

$fbopt .= sprintf " --targets '%s'", abs_path($targets) if $targets;

I think the fix is for abs_path to be called before changing to outdir.

A temporary work around is for the user or calling script to call snippy with the full path to the target bedfile.

pmagwene avatar Aug 01 '21 13:08 pmagwene

@pmagwene you claim not to be a hacker but you have found both the source of the error and the fix for it :)

Very few people use that option it seems! I've never used it - it was a user request.

Thank you - will fix in next release.

tseemann avatar Aug 01 '21 22:08 tseemann

@tseemann Well, not a perl hacker, but I've been programming in Python (and C++ before that!) since the late 90s. ;) Would have tried to submit a pull request but didn't trust myself not to write non-idiomatic perl code. Thanks for the quick fix!

pmagwene avatar Aug 01 '21 23:08 pmagwene

I have this problem too, thanks.

BjoerlingTaul avatar Jun 07 '22 12:06 BjoerlingTaul