graik / biskit

A Python platform for Structural Bioinformatics
http://biskit.pasteur.fr
Other
54 stars 20 forks source link

DSSP.py mask & compress fail, returing KeyError 4 and 5 #11

Closed neb9 closed 7 years ago

neb9 commented 7 years ago

With 1AM7:

Traceback (most recent call last):
  File "1.py", line 11, in <module>
    m = m.compress(m.maskProtein())
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/PDBModel.py", line 2309, in compress
    return self.take( N0.nonzero( mask ), *initArgs, **initKw )
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/PDBModel.py", line 2249, in take
    r.biounit = self.biounit.take(i)
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/BioUnit.py", line 107, in take
    r.biomol = dict([ (bm , self.biomol[bm]) for bm in remaining_biomols ])
KeyError: 4

With 1CA1:

  File "1.py", line 11, in <module>
    m = m.compress(m.maskProtein())
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/PDBModel.py", line 2309, in compress
    return self.take( N0.nonzero( mask ), *initArgs, **initKw )
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/PDBModel.py", line 2249, in take
    r.biounit = self.biounit.take(i)
  File "/usr/local/lib/python2.7/dist-packages/biskit-2.4.3-py2.7.egg/Biskit/BioUnit.py", line 107, in take
    r.biomol = dict([ (bm , self.biomol[bm]) for bm in remaining_biomols ])
KeyError: 5
neb9 commented 7 years ago

I set m.biomol = None in the line before, by the way

graik commented 7 years ago

There is a radical / pragmatic solution here which is to delete the following lines in PDBModel.take:

    ## copy the biounit
    try:
        r.biounit = self.biounit.take(i)
        r.biounit.model = r
    except AttributeError:
        pass

This should pretty much solve all your problems with biounit.

When I have the time to look into it, I will probably end up doing exactly that anyway and restrict the BioUnit functionality to a separate module that is less integrated with PDBModel.

Greetings Raik

On Sat, Nov 19, 2016 at 8:41 PM, neb9 notifications@github.com wrote:

I set m.biomol = None in the line before, by the way

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/graik/biskit/issues/11#issuecomment-261727965, or mute the thread https://github.com/notifications/unsubscribe-auth/ABxs3Xu7VupJeyyYAtItpj4qlsR84Tw7ks5q_zTagaJpZM4K3UHQ .


Raik Grünberg http://www.raiks.de/contact.html


graik commented 7 years ago

biomol take / compress / concat is now deactivated by default.