Skip to content

plot-vcfstats -s leads to IndexError: list index out of range #2353

@warthmann

Description

@warthmann

Hello,

bcftools view input.vcf.gz | bcftools stats -s - > file.vchk
plot-vcfstats -p outdir file.vchk

works perfectly, but when I want sample names instead of indices, ie use the -s flag, it throws an index error

(ngs-tools) norman@norman-Workstation:$ plot-vcfstats -s -p outdir file.vchk
Parsing bcftools stats output: file.vchk
Plotting graphs: python3 plot.py
Traceback (most recent call last):
  File "/mnt/data/norman/Analysis/banana/TR4_SEQ2020/Analysis-Aug2024/Results-SNP-Analysis/outdir/plot.py", line 601, in <module>
    plt.xticks([int(row[0]) for row in dat],[row[7] for row in dat],**sample_font)
                                             ~~~^^^
IndexError: list index out of range
The command exited with non-zero status 256:
	python3 plot.py

 at xxx/miniconda3/envs/ngs-tools/bin/plot-vcfstats line 116.
	main::error("The command exited with non-zero status 256:\x{a}\x{9}python3 plot.py\x{a}\x{a}") called at xxx/miniconda3/envs/ngs-tools/bin/plot-vcfstats line 311
	main::plot(HASH(0x56199d6bbed0)) called at xxx/miniconda3/envs/ngs-tools/bin/plot-vcfstats line 75

any help is greatly appreciated. My vcf file contains 5 samples, and it occurs whether or not I list them in the bcftools stats -s commandline.

I am on Ubuntu 20 in a conda environment with
bcftools 1.21
matplotlib 3.10.0
Python 3.13.1

thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions