Error in contig clustering 'DataFrame' object has no attribute 'ix'

Issue #67 resolved
Jeffrey Blanchard created an issue

Hi, This is similar to one reported earlier by Laura.

I am running through the test data

vcontact2 --raw-proteins test_data/VIRSorter_genomes.faa --rel-mode Diamond --proteins-fp test_data/VIRSorter_genomes_g2g.csv --db 'ProkaryoticViralRefSeq94-Merged' --pcs-mode MCL --vcs-mode ClusterONE --output-dir vConTACT2_Results-none

The cluster_one.1.0.jar file is in /home/jlb_umass_edu/.conda/envs/vContact2/bin

?[1;42mINFO?[1;0m:vcontact2: Found ClusterONE: /home/jlb_umass_edu/.conda/envs/vContact2/bin/cluster_one-1.0.jar
?[1;42mINFO?[1;0m:vcontact2: Found Diamond: /home/jlb_umass_edu/.conda/envs/vContact2/bin/diamond
?[1;42mINFO?[1;0m:vcontact2: Found MCL: /home/jlb_umass_edu/.conda/envs/vContact2/bin/mcxload

….

Detected 348 complexes
?[1;42mINFO?[1;0m:vcontact2.contig_clusters: 348 clusters loaded (singletons and non-connected nodes are dropped).
?[1;42mINFO?[1;0m:vcontact2.contig_clusters: Computing membership matrix...
?[1;41mERROR?[1;0m:vcontact2: Error in contig clustering
?[1;41mERROR?[1;0m:vcontact2: 'DataFrame' object has no attribute 'ix'
Traceback (most recent call last):
File "/home/jlb_umass_edu/.conda/envs/vContact2/bin/vcontact2", line 615, in main
gc = vcontact2.contig_clusters.ContigCluster(pcp, output_dir, cluster_one_fp, cluster_one_args,
File "/home/jlb_umass_edu/.conda/envs/vContact2/lib/python3.8/site-packages/vcontact2/contig_clusters.py", line 102, in init
self.matrix["B"] = matrices.bool_membership(self.contigs)
File "/home/jlb_umass_edu/.conda/envs/vContact2/lib/python3.8/site-packages/vcontact2/matrices.py", line 70, in bool_membership
xy = contigs.reset_index().ix[:, ["pos", "pos_cluster"]].dropna(subset=["pos_cluster"]).values # pos?, # membership
File "/home/jlb_umass_edu/.local/lib/python3.8/site-packages/pandas/core/generic.py", line 5487, in getattr
return object.getattribute(self, name)
AttributeError: 'DataFrame' object has no attribute 'ix'

Comments (5)

  1. Jeffrey Blanchard reporter

    This issue is related to the pandas version. After 1.0.0, pandas removed the series.ix and dataframe.ix methods. I made changes from .ix to .loc in 2 different files and was able to complete the run with the test data for genomes.

    File "/home/jlb_umass_edu/.conda/envs/vContact2/lib/python3.8/site-packages/vcontact2/matrices.py", line 70, in bool_membership
    xy = contigs.reset_index().ix[:, ["pos", "pos_cluster"]].dropna(subset=["pos_cluster"]).values # pos?, # membership

    File "/home/jlb_umass_edu/.conda/envs/vContact2/lib/python3.8/site-packages/vcontact2/modules.py", line 252, in link_modules_and_clusters
    xy = contigs.reset_index().ix[:, ["pos_cluster", "pos"]].dropna(subset=["pos_cluster"]).sort_values(by="pos").values

  2. George

    Hi,Jeffrey, I met the same error, just change the .ix to .loc for these two lines in these two flies?

  3. George

    wow, I made it ! thanks, Jeffrey. But there is a question, one of my two jobs worked before I made this change, is it because the job itself doesn't require .ix?

  4. Log in to comment