添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account test_tree . render ( 'tree.png' )

And getting an error:

File ~/miniconda3/envs/periodic_phyla/lib/python3.10/site-packages/ete3-3.1.2-py3.7.egg/ete3/treeview/main.py:752, in save(scene, imgName, w, h, dpi, take_region, units)
    750 else:
    751     targetRect = QRectF(0, 0, w, h)
--> 752     ii= QImage(w, h, QImage.Format_ARGB32)
    753     ii.fill(QColor(Qt.white).rgb())
    754     ii.setDotsPerMeterX(dpi / 0.0254) # Convert inches to meters
TypeError: arguments did not match any overloaded call:
  QImage(): too many arguments
  QImage(QSize, QImage.Format): argument 1 has unexpected type 'float'
  QImage(int, int, QImage.Format): argument 1 has unexpected type 'float'
  QImage(bytes, int, int, QImage.Format): argument 1 has unexpected type 'float'
  QImage(sip.voidptr, int, int, QImage.Format): argument 1 has unexpected type 'float'
  QImage(bytes, int, int, int, QImage.Format): argument 1 has unexpected type 'float'
  QImage(sip.voidptr, int, int, int, QImage.Format): argument 1 has unexpected type 'float'
  QImage(List[str]): argument 1 has unexpected type 'float'
  QImage(str, format: str = None): argument 1 has unexpected type 'float'
  QImage(QImage): argument 1 has unexpected type 'float'
  QImage(Any): too many arguments

Following the suggestion in #616 , I provide ints to h and w , but get a related error, which I think is caused by the failure to cast the result of dpi / 0.0254 as an int .

test_tree.render('tree.png', h=200, w=200)
---------------------------------------------------------------------------
File ~/miniconda3/envs/periodic_phyla/lib/python3.10/site-packages/ete3-3.1.2-py3.7.egg/ete3/treeview/main.py:754, in save(scene, imgName, w, h, dpi, take_region, units)
    752 ii= QImage(w, h, QImage.Format_ARGB32)
    753 ii.fill(QColor(Qt.white).rgb())
--> 754 ii.setDotsPerMeterX(dpi / 0.0254) # Convert inches to meters
    755 ii.setDotsPerMeterY(dpi / 0.0254)
    756 pp = QPainter(ii)
TypeError: setDotsPerMeterX(self, int): argument 1 has unexpected type 'float'

The PyQt version I am using is 5.12.9. I think this problem is related to the incompatibility introduced in pyqt v5.12 mentioned here . I was able to fix this problem by switching to a conda environment with the same version of ete3 (v3.1.2) but different versions of pyqt / qt (5.9.7).

There might be a quick solution if the line PyQt5.sip.enableoverflowchecking(False) is added to treeview/qt.py , but I haven't been able to test this myself. Attached are the specs for the environment where this issue occurred, the specs of the environment where rendering worked, my newick tree file (as txt). The code to test for this error is above.

broken_environment_spec.txt
functional_environment_spec.txt
test_file.txt

Second this. Adding PyQt5.sip.enableoverflowchecking(False) to treeview/qt.py and treeview/main.py did not fix the problem. Got the following error:

File ~/scratch-midway3/miniconda3/envs/zeqian/lib/python3.11/site-packages/ete3/treeview/main.py:571, in _FaceAreas. setattr (self, attr, val)
569 if attr not in FACE_POSITIONS:
570 raise AttributeError("Face area [%s] not in %s" %(attr, FACE_POSITIONS) )
--> 571 return super(_FaceAreas, self). setattr (attr, val)

TypeError: super(type, obj): obj must be an instance or subtype of type

TypeError: arguments did not match any overloaded call and QImage(variant: Any): too many arguments scverse/pertpy#214 sync with maintenance changes in ete3 branch. Fixes problems with Qt >= 5.12 due to Overflow checking