snakemake-workflows / dna-seq-varlociraptor

A Snakemake workflow for calling small and structural variants under any kind of scenario (tumor/normal, tumor/normal/relapse, germline, pedigree, populations) via the unified statistical model of Varlociraptor.
MIT License
82 stars 38 forks source link

modify the rule filter_offtarget_variants or fix_delly_calls #216

Closed user-tq closed 1 year ago

user-tq commented 1 year ago

get erro

[E::idx_find_and_load] Could not retrieve index file for 'results/candidate-calls/2022NC.delly.no_bnds.bcf'
Failed to read from results/candidate-calls/2022NC.delly.no_bnds.bcf: could not load index

image Maybe it can be changed to

rule fix_delly_calls:
    input:
        "results/candidate-calls/{group}.delly.bcf",
    output:
        "results/candidate-calls/{group}.delly.no_bnds.bcf",
    log:
        "logs/fix_delly_calls/{group}.log",
    conda:
        "../envs/bcftools.yaml"
    shell:
        """bcftools view -e 'INFO/SVTYPE="BND"' {input} -Ob > {output} 2> {log} && bcftools index   {output} """
dlaehnemann commented 1 year ago

I think, contrary to the [E:: at the start of the message, this is not actually an error, but only a warning, and bcftools filter works without the index file. Or are you seeing this rule fail because of this error?

And should this really be a hard failure, we would need to fix this in the bcftools filter wrapper, requiring the bcf index file as an input there. Here, in the workflow, this would then mean adjusting the input to rule filter_offtarget_variants to also include the index file, which should then automatically be created by the rule bcftools_index in workflow/rules/utils.smk:

https://github.com/snakemake-workflows/dna-seq-varlociraptor/blob/9d271ef3bf235f2dd63616d08d3b4e3f22cbe019/workflow/rules/utils.smk#L1-L11

dlaehnemann commented 1 year ago

Do you have any follow-up info here, or can we close this? Namely, is this really just an irritating warning that sounds like an error, but does not actually stop/fail the workflow.

user-tq commented 1 year ago

Do you have any follow-up info here, or can we close this? Namely, is this really just an irritating warning that sounds like an error, but does not actually stop/fail the workflow.

image I conducted some simple tests. I found that if there is no index, when the bcftools filter uses the --regions-file option, this error will be triggered and the program will be interrupted image

dlaehnemann commented 1 year ago

One little meta-suggestion: You can paste in verbatim code and error messages as blocks here on GitHub, using a line with three backticks () to start a block and a line with three backticks () to close the block. That way the code / error message is nicely rendered (the screenshots have very small text) and can also be searched. For more detailed docs, see here: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

dlaehnemann commented 1 year ago

As for the problem at hand, the quick fix is to also include the respective index file as a third input to the bcftools filter rule. I've created a pull request for this, as it involves modifying the input function of the respective rule, see PR #220

And the proper solution to this is to actually require an input: index="" entry, if an input: regions="" file is specified. This should go into the snakemake-wrapper-utils function for the bcftools wrappers, right here:

https://github.com/snakemake/snakemake-wrapper-utils/blob/4018852c4708c7e1604d512bfe39d1ef5df66adf/snakemake_wrapper_utils/bcftools.py#L62-L69

So I'll keep this issue here open, until we have addressed it over there.

Many thanks again for investigating and reporting!

user-tq commented 1 year ago

One little meta-suggestion: You can paste in verbatim code and error messages as blocks here on GitHub, using a line with three backticks () to start a block and a line with three backticks () to close the block. That way the code / error message is nicely rendered (the screenshots have very small text) and can also be searched. For more detailed docs, see here: https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#quoting-code

Thanks for your suggestion!I learned a lot from talking with you!

dlaehnemann commented 1 year ago

Thanks. As the thorough fix over with the snakemake wrapper is now merged, I'll close this issue here, as well.

But please do report any other issues that come up for you. These workflows always have so many corner cases that are not necessarily covered by the CI, so this kind of feedback is really important for everybody using these workflows!