Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to python3 and work with dssp version 4 #18

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions DOC.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, func=str, num=1, default=None, description=""):
self.value = default
self.description = description

def __nonzero__(self):
def __bool__(self):
if self.func == bool:
return self.value != False
return bool(self.value)
Expand All @@ -30,11 +30,11 @@ def setvalue(self, v):

# Parameters can be defined for multiple forcefields
# We look for them within the script...
forcefields = [str(ff).split('.')[-1] for ff in globals().values() if (type(ff) == types.ClassType and hasattr(ff,"ff"))]
forcefields = [str(ff).split('.')[-1] for ff in list(globals().values()) if (type(ff) == type and hasattr(ff,"ff"))]
# ... in the local directory, ....
forcefields += [ff[:-3] for ff in os.listdir(".") if ff[-6:] == "_ff.py"]
# ... and in the GMXDATA dir.
if os.environ.has_key("GMXDATA"):
if "GMXDATA" in os.environ:
forcefields += [ff[:-3] for ff in os.listdir(os.environ["GMXDATA"]+"/top/") if ff[-6:] == "_ff.py"]

# Lists for gathering arguments to options that can be specified
Expand Down Expand Up @@ -238,9 +238,9 @@ def help():
import sys
for item in options:
if type(item) == str:
print item
print(item)
for item in options:
if type(item) != str:
print "%10s %s" % (item[0], item[1].description)
print
print("%10s %s" % (item[0], item[1].description))
print()
sys.exit()
2 changes: 1 addition & 1 deletion FUNC.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def nsplit(*x):

# Make a dictionary from two lists
def hash(x, y):
return dict(zip(x, y))
return dict(list(zip(x, y)))


# Function to reformat pattern strings
Expand Down
14 changes: 7 additions & 7 deletions ForceFields/elnedyn22_BBbonds_ff.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,26 @@ def __init__(self):
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in list(self.bbtyp.keys())])

## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
self.bbBondDictD = FUNC.hash(SS.bbss,list(zip(self.bbldef,self.bbkb)))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbltyp[i],self.bbkbtyp[i])))) for i in list(self.bbltyp.keys())])
# This is tricky to read, but it gives the right bondlength/force constant

## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
self.bbAngleDictD = FUNC.hash(SS.bbss,list(zip(self.bbadef,self.bbka)))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbatyp[i],self.bbkatyp[i])))) for i in list(self.bbatyp.keys())])

## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
self.bbDihedDictD = FUNC.hash(SS.bbss,list(zip(self.bbddef,self.bbkd,self.bbdmul)))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbdtyp[i],self.bbkdtyp[i])))) for i in list(self.bbdtyp.keys())])

# The following function returns the backbone bead for a given residue and
# secondary structure type.
Expand Down
14 changes: 7 additions & 7 deletions ForceFields/elnedyn22_BBconstr_ff.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,26 +195,26 @@ def __init__(self):
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in list(self.bbtyp.keys())])

## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
self.bbBondDictD = FUNC.hash(SS.bbss,list(zip(self.bbldef,self.bbkb)))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbltyp[i],self.bbkbtyp[i])))) for i in list(self.bbltyp.keys())])
# This is tricky to read, but it gives the right bondlength/force constant

## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
self.bbAngleDictD = FUNC.hash(SS.bbss,list(zip(self.bbadef,self.bbka)))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbatyp[i],self.bbkatyp[i])))) for i in list(self.bbatyp.keys())])

## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
self.bbDihedDictD = FUNC.hash(SS.bbss,list(zip(self.bbddef,self.bbkd,self.bbdmul)))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbdtyp[i],self.bbkdtyp[i])))) for i in list(self.bbdtyp.keys())])

# The following function returns the backbone bead for a given residue and
# secondary structure type.
Expand Down
14 changes: 7 additions & 7 deletions ForceFields/elnedyn22_ff.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,26 +194,26 @@ def __init__(self):
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in list(self.bbtyp.keys())])

## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
self.bbBondDictD = FUNC.hash(SS.bbss,list(zip(self.bbldef,self.bbkb)))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbltyp[i],self.bbkbtyp[i])))) for i in list(self.bbltyp.keys())])
# This is tricky to read, but it gives the right bondlength/force constant

## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
self.bbAngleDictD = FUNC.hash(SS.bbss,list(zip(self.bbadef,self.bbka)))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbatyp[i],self.bbkatyp[i])))) for i in list(self.bbatyp.keys())])

## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
self.bbDihedDictD = FUNC.hash(SS.bbss,list(zip(self.bbddef,self.bbkd,self.bbdmul)))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbdtyp[i],self.bbkdtyp[i])))) for i in list(self.bbdtyp.keys())])

# The following function returns the backbone bead for a given residue and
# secondary structure type.
Expand Down
14 changes: 7 additions & 7 deletions ForceFields/elnedyn22p_BBbonds_ff.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,26 @@ def __init__(self):
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in list(self.bbtyp.keys())])

## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
self.bbBondDictD = FUNC.hash(SS.bbss,list(zip(self.bbldef,self.bbkb)))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbltyp[i],self.bbkbtyp[i])))) for i in list(self.bbltyp.keys())])
# This is tricky to read, but it gives the right bondlength/force constant

## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
self.bbAngleDictD = FUNC.hash(SS.bbss,list(zip(self.bbadef,self.bbka)))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbatyp[i],self.bbkatyp[i])))) for i in list(self.bbatyp.keys())])

## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
self.bbDihedDictD = FUNC.hash(SS.bbss,list(zip(self.bbddef,self.bbkd,self.bbdmul)))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbdtyp[i],self.bbkdtyp[i])))) for i in list(self.bbdtyp.keys())])

# The following function returns the backbone bead for a given residue and
# secondary structure type.
Expand Down
14 changes: 7 additions & 7 deletions ForceFields/elnedyn22p_BBconstr_ff.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,26 +200,26 @@ def __init__(self):
# Dictionary of default bead types (*D)
self.bbBeadDictD = FUNC.hash(SS.bbss,self.bbdef)
# Dictionary of dictionaries of types for specific residues (*S)
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in self.bbtyp.keys()])
self.bbBeadDictS = dict([(i,FUNC.hash(SS.bbss,self.bbtyp[i])) for i in list(self.bbtyp.keys())])

## BB BOND TYPE ##
# Dictionary of default abond types (*D)
self.bbBondDictD = FUNC.hash(SS.bbss,zip(self.bbldef,self.bbkb))
self.bbBondDictD = FUNC.hash(SS.bbss,list(zip(self.bbldef,self.bbkb)))
# Dictionary of dictionaries for specific types (*S)
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbltyp[i],self.bbkbtyp[i]))) for i in self.bbltyp.keys()])
self.bbBondDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbltyp[i],self.bbkbtyp[i])))) for i in list(self.bbltyp.keys())])
# This is tricky to read, but it gives the right bondlength/force constant

## BBB ANGLE TYPE ##
# Dictionary of default angle types (*D)
self.bbAngleDictD = FUNC.hash(SS.bbss,zip(self.bbadef,self.bbka))
self.bbAngleDictD = FUNC.hash(SS.bbss,list(zip(self.bbadef,self.bbka)))
# Dictionary of dictionaries for specific types (*S)
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbatyp[i],self.bbkatyp[i]))) for i in self.bbatyp.keys()])
self.bbAngleDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbatyp[i],self.bbkatyp[i])))) for i in list(self.bbatyp.keys())])

## BBBB DIHEDRAL TYPE ##
# Dictionary of default dihedral types (*D)
self.bbDihedDictD = FUNC.hash(SS.bbss,zip(self.bbddef,self.bbkd,self.bbdmul))
self.bbDihedDictD = FUNC.hash(SS.bbss,list(zip(self.bbddef,self.bbkd,self.bbdmul)))
# Dictionary of dictionaries for specific types (*S)
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,zip(self.bbdtyp[i],self.bbkdtyp[i]))) for i in self.bbdtyp.keys()])
self.bbDihedDictS = dict([(i,FUNC.hash(SS.bbss,list(zip(self.bbdtyp[i],self.bbkdtyp[i])))) for i in list(self.bbdtyp.keys())])

# The following function returns the backbone bead for a given residue and
# secondary structure type.
Expand Down
Loading