def newtempfolder( self, tempdir=None ): """ Create a new unique file name for a temporary folder or return the system-wide existing tempfolder. @param tempdir: folder for temporary files, will be created if not existing (default: None ... use system default) if set to True: create a new tempdir within default @type tempdir: str | True """ if tempdir is True: return tempfile.mktemp( '', self.__class__.__name__.lower() + '_', t.tempDir() ) else: return tempdir or t.tempDir()
def newtempfolder(self, tempdir=None): """ Create a new unique file name for a temporary folder or return the system-wide existing tempfolder. @param tempdir: folder for temporary files, will be created if not existing (default: None ... use system default) if set to True: create a new tempdir within default @type tempdir: str | True """ if tempdir is True: return tempfile.mktemp('', self.__class__.__name__.lower() + '_', t.tempDir()) else: return tempdir or t.tempDir()
def __prepareFolder( self ): """ The surfrace binary, radii files and the PDB have to be in the current working directory. Otherwise we get a pretty silent segmentation fault. @return temp folder @rtype str """ try: folder = T.tempDir() binlnk = os.path.join( folder, self.exe.name ) if not os.path.exists( binlnk ): os.symlink( self.exe.bin, binlnk ) radii_txt = T.dataRoot() + '/surface_racer_3/radii.txt' target = os.path.join(folder, 'radii.txt') if not os.path.exists( target ): os.symlink( radii_txt, target ) self.exe.bin = binlnk return folder + '/' except OSError, error: raise SurfaceRacer_Error, \ 'Error preparing temporary folder for SurfaceRacer\n'+\ 'Error: %r\n' % error +\ 'folder: %r\n' % folder +\ 'binary: %r\n' % self.exe.bin +\ 'binary link: %r' % binlnk
def __minimize_complex( self, com ): """ Use Xplor to rigid body minimize the random complex. @param com: random complex @type com: Complex """ xp = ComplexMinimizer( com, t.tempDir(), log=self.xp_log ) xp.run()
def __minimize_complex(self, com): """ Use Xplor to rigid body minimize the random complex. @param com: random complex @type com: Complex """ xp = ComplexMinimizer(com, t.tempDir(), log=self.xp_log) xp.run()
def __init__(self, models, **kw): """ @param models: if more than one model is given they are concatenated and the energy is calculated for the two together. @type models: PDBModels @param kw: additional key=value parameters for Executor: @type kw: key=value pairs :: debug - 0|1, keep all temporary files (default: 0) verbose - 0|1, print progress messages to log (log != STDOUT) node - str, host for calculation (None->local) NOT TESTED (default: None) nice - int, nice level (default: 0) log - Biskit.LogFile, program log (None->STOUT) (default: None) """ self.models = models ## Potentials to use, pII3.0 is the default setting self.pairPot = 'prosa2003.pair-cb' # default: pII3.0.pair-cb self.surfPot = 'prosa2003.surf-cb' # default: pII3.0.surf-cb ## temp files for prosa pdb file and prosa output file self.prosaPdbFile = tempfile.mktemp('_prosa2003.pdb') self.prosaOutput = tempfile.mktemp('_prosa2003.out') self.temp_dir = T.tempDir() prosaInput = tempfile.mktemp('_prosa2003.inp') ## set default values self.objectName = 'obj1' self.lower_k = 1 self.upper_k = 600 self.pot_lb = 0. self.pot_ub = 15. Executor.__init__(self, 'prosa2003', template=self.inp, f_in=prosaInput, **kw) ## check the path to the potential files self.checkPotentials()
def __init__(self, models, **kw ): """ @param models: if more than one model is given they are concatenated and the energy is calculated for the two together. @type models: PDBModels @param kw: additional key=value parameters for Executor: @type kw: key=value pairs :: debug - 0|1, keep all temporary files (default: 0) verbose - 0|1, print progress messages to log (log != STDOUT) node - str, host for calculation (None->local) NOT TESTED (default: None) nice - int, nice level (default: 0) log - Biskit.LogFile, program log (None->STOUT) (default: None) """ self.models = models ## Potentials to use, pII3.0 is the default setting self.pairPot = 'prosa2003.pair-cb' # default: pII3.0.pair-cb self.surfPot = 'prosa2003.surf-cb' # default: pII3.0.surf-cb ## temp files for prosa pdb file and prosa output file self.prosaPdbFile = tempfile.mktemp('_prosa2003.pdb') self.prosaOutput = tempfile.mktemp('_prosa2003.out') self.temp_dir = T.tempDir() prosaInput = tempfile.mktemp('_prosa2003.inp') ## set default values self.objectName = 'obj1' self.lower_k = 1 self.upper_k = 600 self.pot_lb = 0. self.pot_ub = 15. Executor.__init__( self, 'prosa2003', template=self.inp, f_in=prosaInput, **kw ) ## check the path to the potential files self.checkPotentials()
def test_SettingsManager(self): """SettingsManager test""" f_in = T.dataRoot() + '/defaults/settings.cfg' self.f_out = T.tempDir() + '/settings.cfg' self.m = SettingsManager( f_in, self.f_out, createmissing=True, verbose=self.local ) ns = locals() ## fetch local namespace self.m.updateNamespace( ns ) ## parse and insert options into namespace if self.local: globals().update( locals() ) ## publish namespace for debugging r = self.m.settings2dict()['testparam'] self.assertEqual( r, 42) ## from 'int-testparam = 42' in settings.cfg
def test_SettingsManager(self): """SettingsManager test""" f_in = T.dataRoot() + '/defaults/settings.cfg' self.f_out = T.tempDir() + '/settings.cfg' self.m = SettingsManager(f_in, self.f_out, createmissing=True, verbose=self.local) ns = locals() ## fetch local namespace self.m.updateNamespace(ns) ## parse and insert options into namespace if self.local: globals().update(locals()) ## publish namespace for debugging r = self.m.settings2dict()['testparam'] self.assertEqual(r, 42) ## from 'int-testparam = 42' in settings.cfg
def prepare(self): self.fname = T.testRoot() + '/com/1BGS_original.pdb' self.outPath = T.tempDir()