brentp / peddy

genotype :: ped correspondence check, ancestry check, sex check. directly, quickly on VCF

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Peddy run error: AttributeError: 'DataFrame' object has no attribute 'ix'

yusmile0618 opened this issue · comments

Hi , everyone, I install peddy through conda [ conda install -y peddy ]

  1. $ python -m peddy --plot -p 4 --prefix merge4fam merge4fam.vcf.gz merge4fam.ped
    VCF header:
    #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT A24173 A24173F A24173M C5140 C5140F C5140M P8491 P8491F P8491M P8505 P8505F P8505M
    ped file:
    A24173fam A24173 A24173F A24173M 2 1
    A24173fam A24173F 0 0 1 0
    A24173fam A24173M 0 0 2 0
    C5140fam C5140 C5140F C5140M 2 1
    C5140fam C5140F 0 0 1 0
    C5140fam C5140M 0 0 2 0
    P8491fam P8491 P8491F P8491M 2 1
    P8491fam P8491F 0 0 1 0
    P8491fam P8491M 0 0 2 0
    P8505fam P8505 P8505F P8505M 1 1
    P8505fam P8505F 0 0 1 0
    P8505fam P8505M 0 0 2 0

Then I got the following error:

2020-03-20 10:40:48 dell-PowerEdge-R930 peddy.cli[31318] INFO Running Peddy version 0.4.3
Traceback (most recent call last):
File "/home/yu/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/yu/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/yu/anaconda3/lib/python3.7/site-packages/peddy/main.py", line 14, in
sys.exit(cli())
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/yu/anaconda3/lib/python3.7/site-packages/peddy/cli.py", line 198, in peddy
ped_df = ped_df.ix[samples, :]
File "/home/yu/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py", line 5274, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'ix'

Is there anything wrong with my vcf or ped file?

  1. $ python -m peddy --plot -p 4 --prefix merge4fam merge4fam.vcf.gz merge.plink.fam
    with same vcf
    fam file:
    A24173fam A24173 A24173F A24173M 2 1
    A24173fam A24173F 0 0 1 0
    A24173fam A24173M 0 0 2 0
    C5140fam C5140 C5140F C5140M 2 1
    C5140fam C5140F 0 0 1 0
    C5140fam C5140M 0 0 2 0
    P8491fam P8491 P8491F P8491M 2 1
    P8491fam P8491F 0 0 1 0
    P8491fam P8491M 0 0 2 0
    P8505fam P8505 P8505F P8505M 1 1
    P8505fam P8505F 0 0 1 0
    P8505fam P8505M 0 0 2 0

Then I got the following same? error:

2020-03-20 10:56:48 dell-PowerEdge-R930 peddy.cli[31423] INFO Running Peddy version 0.4.3
2020-03-20 10:56:48 dell-PowerEdge-R930 peddy.cli[31423] WARNING 12 samples in vcf not in ped:
A24173,C5140,P8491,A24173F,P8491M,P8505,P8505M,P8505F,C5140F,C5140M,P8491F,A24173M

2020-03-20 10:56:48 dell-PowerEdge-R930 peddy.cli[31423] WARNING 1 samples in ped not in vcf:
nan

Traceback (most recent call last):
File "/home/yu/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/home/yu/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/yu/anaconda3/lib/python3.7/site-packages/peddy/main.py", line 14, in
sys.exit(cli())
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/yu/anaconda3/lib/python3.7/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/yu/anaconda3/lib/python3.7/site-packages/peddy/cli.py", line 198, in peddy
ped_df = ped_df.ix[samples, :]
File "/home/yu/anaconda3/lib/python3.7/site-packages/pandas/core/generic.py", line 5274, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'ix'

Actually the ped and fam files are same content, and I use same vcf files, but why the error info showed 2 more line than the first command?
please help me figure out the error reason, thanks!

hi, this is fixed in master, it happens due to deprecated use of ix. But master has conflicts in conda which I don't know how to fix. You can clone the repo and run python setup.py install

@brentp Thanks a lot. I download and reinstall peddy (v0.4.5), this bug was fixed!