Biskit :: XplorInput :: XplorInput :: Class XplorInput
[hide private]
[frames] | no frames]

Class XplorInput

source code

Create Xplor input file. addFromTemplate() might be usefull for non-xplor-stuff, too.


Note: The file is only flushed to disc when the object is destructed, or the flush() method is called!

Instance Methods [hide private]
  __init__(self, outName, mode='w')
  __del__(self)
  flush(self)
Flush output file (but keep it open).
  add(self, str)
Add String str and line break to xplor input file.
str _singleParam(self, param, value, indent)
return single parameter=value line with |indent| leading tabs.
str blockFromDic(self, title, paramDic, indent=0, priorityParams=None)
Returns block with parameters (as String).
str block(self, title, paramLst, indent=0)
As block() but takes parameters as list of strings without resorting to the clumpsy dictionary.
  addBlockFromDic(self, title, paramDic, indent=0)
Convenience implementation of block.
  addBlock(self, title, paramLst, indent=0)
create block and directly add it to growing input file.
str renameAtom(self, resname, oldName, newName)
append statement for renaming atoms:
  renameAtoms(self, atomDicLst)
Rename several atoms.
str renameRes(self, oldName, newName, select='')
Append statement for renaming residues:
  hbuild(self, selection)
Append hbuild block.
  patchSS(self, res1, res2)
Patch statement for disulfide bond between residue number 1 and 2.
  addAmberSegment(self, seg_id, fpdb)
Return string holding xplor input for segment consisting of one chain.
  addFromTemplate(self, fTemplate, valueDic)
Read template input file with formatstr placeholders, insert values from valueDic.

Method Details [hide private]

__init__(self, outName, mode='w')
(Constructor)

source code 
Parameters:
  • outName (str) - Folder to place output files in
  • mode (str) - open file with this mode, w=override, a=append

__del__(self)
(Destructor)

source code 

flush(self)

source code 

Flush output file (but keep it open).

add(self, str)

source code 

Add String str and line break to xplor input file.
Parameters:
  • str (str) - string to add to file

_singleParam(self, param, value, indent)

source code 

return single parameter=value line with |indent| leading tabs. (Used by blockFromDic)
Parameters:
  • param (str) - parameter
  • value (str) - value
  • indent (int) - number of tabs at begining of line
Returns: str
line vith indent+parameter+value

blockFromDic(self, title, paramDic, indent=0, priorityParams=None)

source code 

Returns block with parameters (as String). Use e.g. for minimize or paramter statement.
Parameters:
  • title (str) - first line of block
  • paramDic (dict) - dictionary of type {'param1':value1, 'param2':value2,...}
  • indent (int) - number of tabs to add before each line
  • priorityParams ([str]) - list of params to write first (in that order) e.g. [param1, param2] to have param1 and param2 come first
Returns: str
Will result in param1=value1, param2=value2. If e.g. value1 is an empty string or None just param is written in that line

block(self, title, paramLst, indent=0)

source code 

As block() but takes parameters as list of strings without resorting to the clumpsy dictionary.
Parameters:
  • title (string) - first line
  • paramLst ([str]) - list of strings, i.e. ['nsteps=10', 'eps=1']
  • indent (int) - number of tabs indentation
Returns: str
block with parameters.

addBlockFromDic(self, title, paramDic, indent=0)

source code 

Convenience implementation of block. This one directly appends the block to the growing file.
Parameters:
  • title (str) - first line of block
  • paramDic (dict) - dictionary of type {'param1':value1, 'param2':value2,...}
  • indent (int) - number of tabs to add before each line

addBlock(self, title, paramLst, indent=0)

source code 

create block and directly add it to growing input file.
Parameters:
  • title (string) - first line
  • paramLst ([str]) - list of strings, i.e. ['nsteps=10', 'eps=1']
  • indent (int) - number of tabs indentation

renameAtom(self, resname, oldName, newName)

source code 

append statement for renaming atoms:
Parameters:
  • resname (str) - name of residue to replace atom in
  • oldName (str) - atom name to replace
  • newName (str) - new atom name
Returns: str
Line: vector do (name=|newName|) (name |oldName| and resname |resname|)

renameAtoms(self, atomDicLst)

source code 

Rename several atoms.
Parameters:
  • atomDicLst (dict) - list of dictionaries wher each dictionary describs one renaming task e.g. :
     [{'res':'ALA', 'old':'HT1', 'new':'H1'},{...}]
    

renameRes(self, oldName, newName, select='')

source code 

Append statement for renaming residues:
Parameters:
  • oldName (str) - current residue name, to replace
  • newName (str) - new residue name
  • select (str) - optional additional selection for residue, e.g. 'and resid 10'
Returns: str
Line: 'vector do (resname=|newName|) (resname |oldName| |select|)'

hbuild(self, selection)

source code 

Append hbuild block. Example for how to use the block() method.
Parameters:
  • selection (str) - String with atom selection

patchSS(self, res1, res2)

source code 

Patch statement for disulfide bond between residue number 1 and 2.
Parameters:
  • res1 (dict) - dictionary with number and segid for the first residue e.g. {'res':19,'id':'SEGID'}
  • res2 (dict) - dictionary with number and segid for the second residue

addAmberSegment(self, seg_id, fpdb)

source code 

Return string holding xplor input for segment consisting of one chain. Example for nesting blocks with blockFromDic().
Parameters:
  • seg_id (str) - segment id
  • fpdb (str) - complete filename of pdb

addFromTemplate(self, fTemplate, valueDic)

source code 

Read template input file with formatstr placeholders, insert values from valueDic.
Parameters:
  • fTemplate (str) - filename for template
  • valueDic (dict) - {placeHolder:value}