Closed zeffii closed 9 years ago
just to be clear, this means all files with N conformations, only import N - 1 of those? It's not just the 06_1L2Y_4LGE.pdb
exactly: all tested files import all conformations -1
The last version 273_compatible, downloaded 10 minutes ago, does import all conformations, in some cases (I still have not clear which are OK and which are not)
I think it may be something simple, but haven't tracked it down yet.
problem case
The 06_1L2Y_4LGE.pdb
test pdb, has 4 conformations (named 1,3,4,5) but only keyframes 1,3,4 are created
time for some process of elimination and some assumptions.
key
for conformation 5 is stored, but the associated value is empty.06DEBUG_1L2Y_4LGE.pdb
i renamed the conformations to 1,2,3,4, and then only 1,2,3 are created. This was to see if perhaps the bug was related to the sequence of names.core_createModels()
but earlier, probably in the construction of pdbIDmodelsDictionary[pdbID]
in def core_parsePDB(filePath)
I think that when BB 'make preview' of a file, it makes a copy that is stored in some temporarty file. This is because sometimes pdb files are fetched directly from the databank, and it is useful to have a local copy. The copy might also be used for the subsequent steps of adding charge value to each atom (done by PDB2PQR)
Right! The importPreview
function (when successful) will either obtain the pdb from [pdb.org]() or read the local file . The function does not edit the file, merely gather information. The error isn't there (at least, i've read it carefully, and it appears OK)
it's narrowed down to the core_parsePDB
function. It's not a big function, so I expect progress today.
cool. I'm pretty sure it's this, the last line flattens the dict..
# when the end of a tmpPDBmodelDictionary is reached, add the tmpPDBmodelDictionary dictionary to the list
if tag == "ENDMDL" or tag=="END" or tag == "MODEL" and (tmpPDBmodelID in tmpPDBmodelImportOrder):
# We add a new MODEL entry to the global pdbIDmodelsDictionary[pdbID],
# based on the current MODEL ID, and we assign the tmpPDBmodelDictionary to this entry.
(pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] = tmpPDBmodelDictionary
# So now pdbIDmodelsDictionary[pdbID] is a Dictionary: model-dict; the second dict is [atomName]-BBInfo
tmpPDBmodelDictionary = {}
When there are more conformations to follow, the tmpPDBmodelDictionary gets repopulated, but if it's the last one, then the reference is overwritten with an empty dict one time too many.
Great! I have no doubt that having found the problem you also have the solution! (always thankful)
yeah, fixing is the easy part! finding, can be a slow process (but i should really have found this sooner)
Will have to read slowly: http://www.biostat.jhsph.edu/~iruczins/teaching/260.655/links/pdbformat.pdf http://deposit.rcsb.org/adit/docs/pdb_atom_format.html
OK, fixing might be a little slower, it will need to take into consideration the various permutations that these pdb files can have. I'd like to be a bit more confident about knowing the permutations before committing to a fix.
if the pdb is always formatted in a certain way (for multiple conformations), like:
MODEL 1
ATOM
ATOM
ATOM
...
TER
ENDMOL
MODEL 2
ATOM
ATOM
ATOM
...
TER
ENDMOL
END
it would be easy.. but as mentioned, i'm assuming there are deviations possible to the way programs write this sequences.
@MonZop can you show other permutations or is this the only valid way to encode multiple conformations in one file?
To my knowledge all pdb files should be formatted as you show. The committee that run the repository ( Protein Data Bank), check that all submissions comply. there are discussions about new pdb formats, especially for huge molecular complexes (millions of atoms), but for now the known pdb format shiuld be safe
For data obtained by molecular dynamics there is a different format, which includes a single pdb descrption and the trajectory for each atom. Readers for this format are available, but i would leave this issue for a next development of bioblender
OK, then the current branch https://github.com/MonZop/BioBlender/tree/master_mff_experiments is reasonably the next pull request. Try it.
Yes, tomorrow
oh oh, something's wrong..
Maybe this helps?
Everything will be OK :)
The problem here luckily is not the addon, but how the addon is installed. In my opinion this is a general flaw in the add-on installation / storage mechanism of Blender itself. Hopefully I can explain.
This has to do with how to test Branches.
I've just pushed a change to BioBlender-master-mmf-experiments
which allows you to name the folder whatever you want. But having multiple version of BioBlender in the addons directory is a headache I avoid by using the GitHub desktop application.
I've moved my answer to : https://github.com/MonZop/BioBlender/issues/9#issuecomment-74071711
C:\blender_trunk\blender-2.73-8cd106f-win64\2.73\scripts\addons
C:\Program Files\Blender Foundation\blender-2.73a-windows64\2.73\scripts\addons
C:\Program Files\Blender Foundation\Blender\2.73\scripts\addons
C:\Users\Monica\AppData\Roaming\Blender Foundation\Blender\2.73\scripts\addons
I have looked for BioBlender AddOn in all these places, but found it nowhere. All the zip BioBlender versions are in another folder, that does not contain Blender. I finally renamed the very latest (just downloaded) version to BioBlender2, and it still get the warining, but it does install BB2.
Now I can test it!
if it imports all conformations from 01 and 06 pdb, then you know it's running the right versions. Hopefully the EP lines are also more accurate
Import is OK, all confomrations (up to 38, just tested)
EP lines also look good
Will have to check line animation (re-calculation of lines during protein motion)
in function core_parsePDB
, the solution which is simplest and seems to behave well for the demo .pdb files is, instead of this
# when the end of a tmpPDBmodelDictionary is reached, add the tmpPDBmodelDictionary dictionary to the list
if tag == "ENDMDL" or tag=="END" or tag == "MODEL" and (tmpPDBmodelID in tmpPDBmodelImportOrder):
# We add a new MODEL entry to the global pdbIDmodelsDictionary[pdbID],
# based on the current MODEL ID, and we assign the tmpPDBmodelDictionary to this entry.
(pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] = tmpPDBmodelDictionary
# So now pdbIDmodelsDictionary[pdbID] is a Dictionary: model-dict; the second dict is [atomName]-BBInfo
tmpPDBmodelDictionary = {}
it's this:
# when the end of a tmpPDBmodelDictionary is reached, add the tmpPDBmodelDictionary dictionary to the list
if tag == "ENDMDL" or tag=="END" or tag == "MODEL" and (tmpPDBmodelID in tmpPDBmodelImportOrder):
# We add a new MODEL entry to the global pdbIDmodelsDictionary[pdbID],
# based on the current MODEL ID, and we assign the tmpPDBmodelDictionary to this entry.
if tmpPDBmodelDictionary:
# don't push an empty tmpPDBmodelDictionary onto pdbIDmodelsDictionary.
(pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] = tmpPDBmodelDictionary
# So now pdbIDmodelsDictionary[pdbID] is a Dictionary: model-dict; the second dict is [atomName]-BBInfo
tmpPDBmodelDictionary = {}
this fixes multi-conformation pdb import and doesn't appear to have negative side effects with other kinds of pdb. Closing for now
@MonZop found:
This seems like an off by one error or other indexing mistake.