Closed samirelanduk closed 7 years ago
Hi Gil, cheers for taking a look. I use snakeviz/cProfile on the parsing, but haven't yet put together anything similar for the saving, so this is good to know.
I can't see how line 36 would be be taking any time as it's all just simple lookup there, but I could see why the __len__
method would take a long time, as it has to call the resiudes()
method which probably takes a while. I will try and sort this out after 0.6 is released this week.
Cheers!
So this was driving me crazy because it turns out it was line 36, but it wasn't calling __len__
at all.
But, it turns out then when you convert an object to a bool, the __len__
will be called if it has one. So I replaced if chain
with if chain is not None
and now saving 1LOL takes 0.151 seconds instead of 6.33 seconds.
hey, I was having a look at why it takes so long to save a PDB file with line_profiler, and it seems like the issue is in the function
atom_to_atom_dict
instructure2pdbdatafile.py
. The issue seems to be on line 36chain_id = atom.chain().chain_id() if atom.chain() else None
. After looking more into it it seems like most of the time the code is calling the__len__
method ofResidueSequence
. I am not sure as to what is really happening, but I hope this helps narrowing it down!