Skip to content

SmallMol issue with writing multiple frames #46

@stefdoerr

Description

@stefdoerr
from moleculekit.smallmol.smallmol import SmallMol
sm = SmallMol('CCOO')
sm.generateConformers(10)
for i in range(10):
  sm.write(f'/tmp/stefan{i}.pdb', frames=i)

crashes with

NameError                                 Traceback (most recent call last)
<ipython-input-17-aeef6cceb0cb> in <module>
      1 for i in range(10):
----> 2     sm.write(f'/tmp/stefan{i}.pdb', frames=[i,])
      3 

~/Work/moleculekit/moleculekit/smallmol/smallmol.py in write(self, fname, frames, merge)
    601         else:
    602             mol = self.toMolecule()
--> 603             mol.write(fname, frames)
    604 
    605     def view(self, *args, **kwargs):

~/Work/moleculekit/moleculekit/molecule.py in write(self, filename, sel, type, **kwargs)
   1309         if not (sel is None or (isinstance(sel, str) and sel == "all")):
   1310             src = self.copy()
-> 1311             src.filter(sel, _logger=False)
   1312 
   1313         if type in _WRITERS:

~/Work/moleculekit/moleculekit/molecule.py in filter(self, sel, _logger)
    784 
    785         if not isinstance(s, np.ndarray) or s.dtype != bool:
--> 786             raise NameError("Filter can only work with string inputs or boolean arrays")
    787         return self.remove(np.invert(s), _logger=_logger)
    788 

NameError: Filter can only work with string inputs or boolean arrays

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions