Created
February 12, 2015 20:54
-
-
Save zeffii/4fd275912024f8506102 to your computer and use it in GitHub Desktop.
last_lines.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not (tag == 'END'): | |
(pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] = tmpPDBmodelDictionary | |
else: | |
# ugly test: run through the file again and | |
# look at the last 2 lines. | |
# if the current tag is END and the last 2 lines are | |
# TER, END. or 'MASTER and END' then the format is all ATOMs and no MODEL. | |
with open(filePath,"r") as sfile: | |
lines = [l[:3] for l in sfile if l.strip()][-2:] | |
lines = '|'.join(lines) | |
if lines in {'TER|END', 'MAS|END'}: | |
(pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] = tmpPDBmodelDictionary | |
''' f test ''' | |
f = (pdbIDmodelsDictionary[pdbID])[tmpPDBmodelID] | |
print('tmpPDBmodelID', tmpPDBmodelID, ':', len(f)) | |
# So now pdbIDmodelsDictionary[pdbID] is a Dictionary: model-dict; the second dict is [atomName]-BBInfo | |
tmpPDBmodelDictionary = {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment