pwwang / vcfstats

Powerful statistics for VCF files
https://pwwang.github.io/vcfstats/
MIT License
65 stars 15 forks source link

error running the docker implementation of vcfstats #33

Closed mglgc closed 1 year ago

mglgc commented 1 year ago

Hi all, After a successful docker instalation of the vcfstats image, the command line 'docker run --rm justold/vcfstats:latest vcfstats --vcf myfile.vcf -o outputs --formula 'COUNT(1) ~ CONTIG' --title 'Number of variants on each chromosome' shows next error: [01/16/23 09:11:23] INFO Combining regions, be reminded that regions should NOT be overlapping ...
[01/16/23 09:11:23] INFO Getting vcf handler by given regions ...
[01/16/23 09:11:23] WARNING (cyvcf2) [E::hts_open_format] Failed to open file
"myfile.vcf" : No such file or directory
Traceback (most recent call last): File "/usr/local/bin/vcfstats", line 6, in sys.exit(main()) File "/vcfstats/vcfstats/cli.py", line 214, in main vcf, samples = get_vcf_by_regions( File "/vcfstats/vcfstats/cli.py", line 46, in get_vcf_by_regions vcf = VCF(str(vcffile), gts012=True) File "cyvcf2/cyvcf2.pyx", line 258, in cyvcf2.cyvcf2.VCF.init File "cyvcf2/cyvcf2.pyx", line 190, in cyvcf2.cyvcf2.HTSFile._open_htsfile OSError: Error opening myfile.vcf

Of course, 'myfile.vcf' is in the path. Please, some help to fix that issue will be welcome. Thanks in advance.

pwwang commented 1 year ago

You have to map your current path to the container.

docker run \
  -v $(pwd):/vcfstats/workdir \
  --rm justold/vcfstats:latest \
  vcfstats \
  --vcf /vcfstats/workdir/myfile.vcf \
  -o /vcfstats/workdir/outputs \
  --formula 'COUNT(1) ~ CONTIG' \
  --title 'Number of variants on each chromosome'

If you want to pass the relative path, you need to set the working directory:

docker run \
  -w /vcfstats/workdir \
  -v $(pwd):/vcfstats/workdir \
  --rm justold/vcfstats:latest \
  vcfstats \
  --vcf myfile.vcf \
  -o outputs \
  --formula 'COUNT(1) ~ CONTIG' \
  --title 'Number of variants on each chromosome'

Note that outputs has to be created manually.

mglgc commented 1 year ago

You have to map your current path to the container.

docker run \
  -v $(pwd):/vcfstats/workdir \
  --rm justold/vcfstats:latest \
  vcfstats \
  --vcf /vcfstats/workdir/myfile.vcf \
  -o /vcfstats/workdir/outputs \
  --formula 'COUNT(1) ~ CONTIG' \
  --title 'Number of variants on each chromosome'

If you want to pass the relative path, you need to set the working directory:

docker run \
  -w /vcfstats/workdir \
  -v $(pwd):/vcfstats/workdir \
  --rm justold/vcfstats:latest \
  vcfstats \
  --vcf myfile.vcf \
  -o outputs \
  --formula 'COUNT(1) ~ CONTIG' \
  --title 'Number of variants on each chromosome'

Note that outputs has to be created manually.

It work super now. It would be pretty useful to include such an indications in the corresponding github installation page section. Thanks a lot for your promptly reply.

pwwang commented 1 year ago

Updated at 0.4.3.