pwwang / vcfstats

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

new error message #2

Closed plrlhb12 closed 4 years ago

plrlhb12 commented 4 years ago

Tried 0.6.0 using pip install -U vcfstats , but got new error message as below.

$ vcfstats --vcf examples/sample.vcf \

--outdir examples/ \ --formula 'COUNT(1) ~ CONTIG' \ --title 'Number of variants on each chromosome' \ --config examples/config.toml

Traceback (most recent call last): File "/Users/pengl7/opt/anaconda3/envs/genomics/bin/vcfstats", line 8, in sys.exit(main()) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/vcfstats/init.py", line 167, in main load_config(opts['config'], opts) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/vcfstats/init.py", line 122, in load_config configs._load(config) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/simpleconf.py", line 269, in _load cached[rname] = LOADERS[ext](conf, with_profile).conf File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/simpleconf.py", line 55, in init self.conf = self.load(cfile) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/simpleconf.py", line 190, in load conf = toml.load(fconf) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/toml/decoder.py", line 156, in load return loads(f.read(), _dict, decoder) File "/Users/pengl7/opt/anaconda3/envs/genomics/lib/python3.7/site-packages/toml/decoder.py", line 262, in loads original, i) toml.decoder.TomlDecodeError: Found invalid character in key name: '!'. Try quoting the key name. (line 6 column 2 char 6)

pwwang commented 4 years ago

I just ran that without any errors:

> vcfstats --vcf examples/sample.vcf \        
    --outdir examples/ \
    --formula 'COUNT(1) ~ CONTIG' \
    --title 'Number of variants on each chromosome'  \
    --config examples/config.toml
[09/28/20 22:39:24] INFO     Combining regions, remind that regions should not be overlapping ...
                    INFO     Getting vcf handler by given regions ...
[W::bcf_hdr_check_sanity] GL should be declared as Number=G
                    INFO     Getting instances ...
                    INFO     INSTANCE: 'Number of variants on each chromosome'
                    INFO     [Number of variants on each chromosome] Parsing formulas ...
                    INFO     [Number of variants on each chromosome] plot type: col
                    INFO     Start reading variants ...
[W::vcf_parse] Contig '1' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '2' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '3' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '4' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '5' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '6' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '7' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '8' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '9' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig '10' is not defined in the header. (Quick workaround: index the file with tabix.)
[W::vcf_parse] Contig 'X' is not defined in the header. (Quick workaround: index the file with tabix.)
                    INFO     105 variants read.
                    INFO     [Number of variants on each chromosome] Summarizing aggregations ...
                    INFO     [Number of variants on each chromosome] Composing R code ...
                    INFO     [Number of variants on each chromosome] Running R code to plot ...
                    INFO     [Number of variants on each chromosome] Data will be saved to: examples/Number_of_variants_on_each_chromosome.txt
                    INFO     [Number of variants on each chromosome] Plot will be saved to: examples/Number_of_variants_on_each_chromosome.col.png

It's weird that we don't have ! in examples/config.toml. This is how it should look like:

# generate smaller figures for demonstration
devpars = { width = 600, height = 600, res = 100}

How about yours?

plrlhb12 commented 4 years ago

It works now. The config file I downloaded before was wrong for unknown reason. Thank you so much!

pwwang commented 4 years ago

Great! Thanks for reporting.