pwwang / vcfstats

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

TypeError: getattr(): attribute name must be string #21

Closed hojin9218 closed 2 years ago

hojin9218 commented 2 years ago

Hi @pwwang! I'm trying to use vcfstats on a multiple sample vcf file in conda environment. But the command line return some errors that I could not solve.

I got TypeError: getattr(): attribute name must be string

vcfstats --vcf sample.vcf -o example/ --formula 'COUNT(1) ~ CONTIG[1,2,3,4,5]' --title 'test'

[06/26/22 09:20:50] INFO     Combining regions, remind that regions should not be overlapping ...                                            
[06/26/22 09:20:50] INFO     Getting vcf handler by given regions ...                                                                        
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::bcf_hdr_check_sanity] GL should be declared as Number=G                                            
[06/26/22 09:20:50] INFO     Getting instances ...                                                                                           
[06/26/22 09:20:50] INFO     INSTANCE: 'test'                                                                                                
[06/26/22 09:20:50] INFO     test: Parsing formulas ...                                                                                      
[06/26/22 09:20:50] INFO     test: plot type: col                                                                                            
[06/26/22 09:20:50] INFO     Start reading variants ...                                                                                      
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '1' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '2' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '3' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '4' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '5' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '6' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '7' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '8' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '9' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig '10' is not defined in the header. (Quick workaround: index the file with tabix.)
[06/26/22 09:20:50] WARNING  (cyvcf2) [W::vcf_parse] Contig 'X' is not defined in the header. (Quick workaround: index the file with tabix.) 
[06/26/22 09:20:50] INFO     105 variants read.                                                                                              
[06/26/22 09:20:50] INFO     test: Summarizing aggregations ...                                                                              
Traceback (most recent call last):
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/bin/vcfstats", line 8, in <module>
    sys.exit(main())
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/vcfstats/[cli.py](http://cli.py/)", line 209, in main
    instance.plot()
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/vcfstats/[instance.py](http://instance.py/)", line 285, in plot
    self.save_plot(plt, theme_elems)
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/vcfstats/[instance.py](http://instance.py/)", line 318, in save_plot
    Diot(height=1000, width=1000, res=100, format=self.figfmt)
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/diot/[diot.py](http://diot.py/)", line 312, in __or__
    ret.update(other)
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/diot/[diot.py](http://diot.py/)", line 294, in update
    dict_to_update = dict(*value, **kwargs)
  File "/gpfs/ycga/project/lifton/jc2545/conda_envs/vcfstats/lib/python3.8/site-packages/pyparam/[utils.py](http://utils.py/)", line 46, in __getitem__
    return getattr(self, name)
TypeError: getattr(): attribute name must be string

And i used it in conda environment (python 3.8) python 3.9 also returns the same error.

Package Version ----------------------------- --------- aiohttp 3.8.1 aiosignal 1.2.0 aiosqlite3 0.3.0 asttokens 2.0.5 async-timeout 4.0.2 attrs 21.4.0 backcall 0.2.0 backports.functools-lru-cache 1.6.4 certifi 2022.6.15 chardet 5.0.0 charset-normalizer 2.0.12 click 8.1.3 coloredlogs 15.0.1 commonmark 0.9.1 cycler 0.11.0 cyvcf2 0.30.15 datar 0.8.5 decorator 5.1.1 descartes 1.1.0 diot 0.1.6 executing 0.8.3 fonttools 4.33.3 frozenlist 1.3.0 humanfriendly 10.0 idna 3.3 importlib-metadata 4.12.0 infi.systray 0.1.12 inflection 0.5.1 intervaltree 3.1.0 ipython 8.4.0 jedi 0.18.1 kiwisolver 1.4.3 lark-parser 0.12.0 Markdown 3.3.7 matplotlib 3.5.2 matplotlib-inline 0.1.3 mizani 0.7.4 multidict 6.0.2 numpy 1.23.0 open-cravat 2.0.1 oyaml 1.0 packaging 21.3 palettable 3.3.0 pandas 1.4.3 parso 0.8.3 patsy 0.5.2 pdtypes 0.0.4 pexpect 4.8.0 pickleshare 0.7.5 Pillow 9.1.1 pip 22.1.2 pipda 0.6.0 plotnine 0.8.0 plotnine-prism 0.0.0 prompt-toolkit 3.0.29 ptyprocess 0.7.0 pure-eval 0.2.2 py 1.11.0 Pygments 2.12.0 pyliftover 0.4 pyparam 0.5.3 pyparsing 3.0.9 python-dateutil 2.8.2 python-simpleconf 0.5.6 python-slugify 6.1.2 pytz 2022.1 PyYAML 6.0 requests 2.28.0 requests-toolbelt 0.9.1 rich 12.4.4 rtoml 0.8.0 scipy 1.8.1 setuptools 62.6.0 six 1.16.0 sortedcontainers 2.4.0 stack-data 0.3.0 statsmodels 0.13.2 text-unidecode 1.3 toml 0.10.2 traitlets 5.3.0 twobitreader 3.1.7 typing_extensions 4.2.0 urllib3 1.26.9 varname 0.8.3 vcfstats 0.4.0 wcwidth 0.2.5 websockets 10.3 wheel 0.37.1 XlsxWriter 3.0.3 yarl 1.7.2 zipp 3.8.0
mital14 commented 2 years ago

I am having almost same error! need help

pwwang commented 2 years ago

Fixed with 0.4.1