def __init__(self, full=0, mode='w', verbose=1, **kw ): """ @param mode: open file with this mode, w=override, a=append @type mode: str @param full: dispaly pymol structures in fill screen mode:: 0 - normal mode 1 - full screen mode 2 - full screen and no menues @type full: 0|1|2 """ self.verbose = verbose # name of .pml file self.foutName = tempfile.mktemp() + '.pml' # open for <appending|writing|reading> self.fgenerate = open(self.foutName, mode) # will contain PymolModels or lists of PymolModels self.dic = {} ## add startup commands self.initPymol() ## set arguments for display options (normal, full, all) arg = '-q %s'%self.foutName if full == 1: arg = '-qe %s'%self.foutName if full == 2: arg = '-qei %s'%self.foutName Executor.__init__( self, 'pymol', args=arg, catch_err=1, catch_out=1, **kw )
def __init__(self, target, hmmdb=settings.hmm_db, noSearch=None, **kw): """ @param target: fasta sequence, fasta file, or PDBModel @type target: PDBModel or str (fasta file) or [ str ] (fasta lines) @param hmmdb: Pfam hmm database @type hmmdb: str @param noSearch: don't perform a seach @type noSearch: 1 OR None """ self.hmmdb = hmmdb Executor.__init__(self, 'hmmpfam', f_in=tempfile.mktemp('.fasta'), catch_out=1, **kw) self.target = target self.fastaID = '' if noSearch: if self.verbose: self.log.writeln( 'Profiles provided - No search will be performed.')
def __init__(self, ref_model, models, **kw): """ @param ref_model: reference @type ref_model: PDBModel @param models: structures to be compared with reference @type models: [PDBModel] @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) """ Executor.__init__(self, 'icmbrowser', template=self.inp_head, **kw) self.f_ref = tempfile.mktemp('_icmcad_ref.pdb') self.f_pdb = tempfile.mktemp('_icmcad_%i.pdb') self.ref_model = ref_model self.models = models if not isinstance(self.models, list): self.models = [self.models]
def __init__(self, model, **kw ): """ @param model: reference PDBModel @type model: PDBModel @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.temp_pdb = tempfile.mktemp('_foldx_.pdb') self.temp_command = tempfile.mktemp('_foldx_.command') self.temp_option = tempfile.mktemp('_foldx_.option') self.temp_result = tempfile.mktemp('_foldx_.result') self.temp_runlog = tempfile.mktemp('_foldx_.log') self.temp_errlog = tempfile.mktemp('_foldx_.err') Executor.__init__( self, 'fold_X', args='-manual %s %s %s'\ %(self.temp_pdb, self.temp_option, self.temp_command), **kw ) self.model = model.clone() ## fold-X-allowed atoms for each res in standard order self.aminoAcidDict = molUtils.aaAtoms for k in self.aminoAcidDict: if 'HN' not in self.aminoAcidDict[ k ]: self.aminoAcidDict[ k ] += ['HN']
def __init__( self, model, **kw ): """ @param model: PDBModel @type model: @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.f_xyzrn = tempfile.mktemp('_msms.xyzrn') ## output file from MSMS, will add .area exiension to file self.f_surf = tempfile.mktemp( ) arg =' -surface ases -if %s -af %s'%( self.f_xyzrn, self.f_surf ) Executor.__init__( self, 'msms', args=arg, **kw ) self.model = model.clone()
def __init__(self, model, **kw): """ @param model: model analyze @type model: PDBModel @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.model = model # self.model = model.clone( deepcopy=1 ) ## temporary pdb-file self.f_pdb = tempfile.mktemp('_dssp.pdb') self.f_out = tempfile.mktemp('_dssp.out') Executor.__init__(self, 'dsspcmbi', args='-i %s' % self.f_pdb, catch_err=1, **kw)
def __init__(self, model, **kw): """ @param model: PDBModel @type model: @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) """ Executor.__init__(self, 'whatif', template=self.whatif_script, f_out='/dev/null', **kw) self.f_pdb = tempfile.mktemp('_whatif.pdb') self.f_relativeASA = tempfile.mktemp('_whatif_relative.log') self.f_residueASA = tempfile.mktemp('_whatif_residue.log') self.model = model.clone()
def __init__( self, ref_model, models, **kw ): """ @param ref_model: reference @type ref_model: PDBModel @param models: structures to be compared with reference @type models: [PDBModel] @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) """ Executor.__init__( self, 'icmbrowser', template=self.inp_head, **kw ) self.f_ref = tempfile.mktemp('_icmcad_ref.pdb') self.f_pdb = tempfile.mktemp('_icmcad_%i.pdb') self.ref_model = ref_model self.models = models if not isinstance( self.models, list ): self.models = [ self.models ]
def __init__( self, model, refmodel, **kw ): """ @param model: structure to be aligned to reference @type model: PDBModel @param refmodel: reference structure @type refmodel: PDBModel @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.f_pdbin = tempfile.mktemp( '_tmalign_in.pdb' ) self.f_pdbref= tempfile.mktemp( '_tmalign_ref.pdb' ) self.f_matrix= tempfile.mktemp( '_tmalign_matrix.out' ) Executor.__init__( self, 'tmalign', args= '%s %s -m %s' % (self.f_pdbin, self.f_pdbref, self.f_matrix), **kw ) self.refmodel = refmodel self.model = model
def __init__( self, model, **kw ): """ @param model: model analyze @type model: PDBModel @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.model = model # self.model = model.clone( deepcopy=1 ) ## temporary pdb-file self.f_pdb = tempfile.mktemp( '_dssp.pdb') self.f_out = tempfile.mktemp( '_dssp.out') Executor.__init__( self, 'dsspcmbi', args='-na %s'%self.f_pdb, catch_err=1, **kw )
def __init__(self, model, refmodel, **kw): """ @param model: structure to be aligned to reference @type model: PDBModel @param refmodel: reference structure @type refmodel: PDBModel @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.f_pdbin = tempfile.mktemp('_tmalign_in.pdb') self.f_pdbref = tempfile.mktemp('_tmalign_ref.pdb') self.f_matrix = tempfile.mktemp('_tmalign_matrix.out') Executor.__init__(self, 'tmalign', args='%s %s -m %s' % (self.f_pdbin, self.f_pdbref, self.f_matrix), **kw) self.refmodel = refmodel self.model = model
def __init__(self, model, tempdir=None, args='', autocap=False, capN=[], capC=[], **kw): """ @param model: structure to be aligned to reference @type model: PDBModel @param tempdir: create dedicated temporary folder (default: None) see Executor @param tempdir: str | 0|1 @param args: additional command line arguments for reduce (default:'') example: '-OLDpdb' @type args: str @param autocap: add capping NME and ACE residues to any (auto-detected) false N- or C-terminal (default: False) @type autocap: bool @param capN: cap N-terminal of these chains (indices) with ACE ([]) @type capN: [ int ] @param capC: cap C-terminal of these chains (indices) with NME ([]) @type capN: [ int ] @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) """ tempdir = self.newtempfolder(tempdir) self.f_pdbin = tempfile.mktemp('_in.pdb', 'reduce_', dir=tempdir) f_out = tempfile.mktemp('_out.pdb', 'reduce_', dir=tempdir) self.f_db = T.dataRoot() + '/reduce/reduce_wwPDB_het_dict.txt' self.autocap = autocap self.capN = capN self.capC = capC lenchains = model.lenChains() Executor.__init__( self, 'reduce', args= '%s -BUILD -Nterm%i -DB %s %s' %\ (args, lenchains, self.f_db, self.f_pdbin), f_out=f_out, catch_err=True, tempdir=tempdir, **kw ) self.model = model
def __init__( self, model, tempdir=None, args='', autocap=False, capN=[], capC=[], **kw ): """ @param model: structure to be aligned to reference @type model: PDBModel @param tempdir: create dedicated temporary folder (default: None) see Executor @param tempdir: str | 0|1 @param args: additional command line arguments for reduce (default:'') example: '-OLDpdb' @type args: str @param autocap: add capping NME and ACE residues to any (auto-detected) false N- or C-terminal (default: False) @type autocap: bool @param capN: cap N-terminal of these chains (indices) with ACE ([]) @type capN: [ int ] @param capC: cap C-terminal of these chains (indices) with NME ([]) @type capN: [ int ] @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) """ tempdir = self.newtempfolder( tempdir ) self.f_pdbin = tempfile.mktemp( '_in.pdb', 'reduce_', dir=tempdir ) f_out= tempfile.mktemp( '_out.pdb', 'reduce_', dir=tempdir) self.f_db = T.dataRoot() + '/reduce/reduce_wwPDB_het_dict.txt' self.autocap = autocap self.capN = capN self.capC = capC lenchains = model.lenChains() Executor.__init__( self, 'reduce', args= '%s -BUILD -Nterm%i -DB %s %s' %\ (args, lenchains, self.f_db, self.f_pdbin), f_out=f_out, catch_err=True, tempdir=tempdir, **kw ) self.model = model
def __init__( self, hmmFile, fastaFile, fastaID, **kw ): """ @param hmmFile: path to hmm file (profile) @type hmmFile: str @param fastaFile: path to fasta search sequence @type fastaFile: str @param fastaID: fasta id of search sequence @type fastaID: str """ self.fastaID = fastaID Executor.__init__( self, 'hmmalign', args=' -q %s %s'%(hmmFile, fastaFile), **kw )
def __init__( self, hmmName, hmmdb, **kw ): """ @param hmmName: hmm profile name @type hmmName: str @param hmmdb: Pfam hmm database @type hmmdb: str """ self.hmmName = hmmName Executor.__init__( self, 'hmmfetch', args=' %s %s'%(hmmdb, hmmName), **kw ) self.f_out = tempfile.mktemp('.hmm')
def __init__( self, hmmdb, **kw ): """ @param hmmdb: Pfam hmm database @type hmmdb: str """ Executor.__init__( self, 'hmmindex', args='%s'%hmmdb, **kw ) if not os.path.exists(hmmdb+'.ssi'): if self.verbose: self.log.writeln( 'HMMINDEX: Indexing hmm database. This will take a while') self.run()
def __init__(self, hmmdb, **kw): """ @param hmmdb: Pfam hmm database @type hmmdb: str """ Executor.__init__(self, 'hmmindex', args='%s' % hmmdb, **kw) if not os.path.exists(hmmdb + '.ssi'): if self.verbose: self.log.writeln( 'HMMINDEX: Indexing hmm database. This will take a while') self.run()
def __init__(self, model, cr=[0], cl=None, mode=2, breaks=0, catch_err=1, **kw): """ Create a new Intervor instance for a given protein-protein complex. @param model: Structure of receptor, ligand and water @type model: Biskit.PDBModel @param cr: receptor chains (default: [0] = first chain) @type cr: [ int ] @param cl: ligand chains (default: None = all remaining protein chains) @type cl: [ int ] @param breaks: consider chain breaks (backbone gaps) (default: 0) @type breaks: bool or 1|0 @param mode: what to calculate (default 2, = all with shelling order) @type mode: int @param catch_err: deviate STDERR to temporary file (default 1) @type catch_err: bool or 0|1 @param **kw: any other keyword=value pair recognized by Executor """ Executor.__init__(self, 'intervor', catch_err=catch_err, **kw) assert isinstance( model, B.PDBModel ), \ 'requires PDBModel instance' assert model is not None, 'requires PDBModel instance' self.model = model self.breaks = breaks self.chains_rec = cr self.chains_lig = cl or self.__getLigandChains(model, cr) self.local_model = None #: will hold modified copy of model self.mode = mode ## intervor puts several output files into current working directory ## but respect cwd from Executor.__init__ or ExeConfig/exe_intervor.dat self.cwd = self.cwd or tempfile.gettempdir() #: will be used by intervor for different output files self.f_prefix = tempfile.mktemp(dir=self.exe.cwd) self.f_pdb = self.f_prefix + '_intervor.pdb' self.result = {}
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, template, leaprc=None, **kw ): """ @param template: template for leap input file (file or string) @type template: str @param leaprc: forcefield code (leaprc file ending, e.g. 'ff99') OR leaprc file name (e.g, 'leaprc.f99') OR leaprc path witin $AMBERHOME OR leaprc path default: take value from exe_tleap.dat @type leaprc: str @param f_in: complete leap input file -- existing or not, to be kept (default: create from template and then discard) @type f_in: str @param f_out: file for leap log output (default: discard) @type f_out: str @param out_parm: parm output file name (default: 'top.parm') @type out_parm: str @param out_crd : coordinate output file name (default '0.crd' ) @type out_crd : str @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) """ # override some Executor defaults unless they are freshly given kw['catchout'] = kw.get('catchout',0) Executor.__init__( self, 'tleap', template=template, **kw ) self.args = '-f %s' % self.f_in self.leaprc = self.findLeaprc( leaprc or self.exe.leaprc ) ## set some defaults that may or may not have been specified self.out_parm = kw.get('out_parm', 'top.parm' ) self.out_crd = kw.get('out_crd', '0.crd')
def __init__( self, hmmName, hmmdb=settings.hmm_db, **kw ): """ @param hmmName: hmm profile name @type hmmName: str @param hmmdb: Pfam hmm database @type hmmdb: str **kw - all Executor parameters, in particular: @param f_out: target file name for profile.hmm, prevents its deletion @type f_out: str @param debug: @param log: @param ... """ self.hmmName = hmmName Executor.__init__( self, 'hmmfetch', args=' %s %s'%(hmmdb, hmmName), **kw )
def __init__( self, hmmFile, fastaFile, fastaID, **kw ): """ @param hmmFile: path to hmm file (profile) @type hmmFile: str @param fastaFile: path to fasta search sequence @type fastaFile: str @param fastaID: fasta id of search sequence @type fastaID: str """ self.fastaID = fastaID self.hmmFile = hmmFile self.fastaFile = fastaFile assert T.fileLength( self.hmmFile ) > 10, \ 'input HMM file missing or empty' Executor.__init__( self, 'hmmalign', args=' -q %s %s'%(hmmFile, fastaFile), **kw )
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, template, leaprc=None, **kw): """ @param template: template for leap input file (file or string) @type template: str @param leaprc: forcefield code (leaprc file ending, e.g. 'ff99') OR leaprc file name (e.g, 'leaprc.f99') OR leaprc path witin $AMBERHOME OR leaprc path default: take value from exe_tleap.dat @type leaprc: str @param f_in: complete leap input file -- existing or not, to be kept (default: create from template and then discard) @type f_in: str @param f_out: file for leap log output (default: discard) @type f_out: str @param out_parm: parm output file name (default: 'top.parm') @type out_parm: str @param out_crd : coordinate output file name (default '0.crd' ) @type out_crd : str @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) """ # override some Executor defaults unless they are freshly given kw['catchout'] = kw.get('catchout', 0) Executor.__init__(self, 'tleap', template=template, **kw) self.args = '-f %s' % self.f_in self.leaprc = self.findLeaprc(leaprc or self.exe.leaprc) ## set some defaults that may or may not have been specified self.out_parm = kw.get('out_parm', 'top.parm') self.out_crd = kw.get('out_crd', '0.crd')
def __init__( self, model, cr=[0], cl=None, mode=2, breaks=0, catch_err=1, **kw ): """ Create a new Intervor instance for a given protein-protein complex. @param model: Structure of receptor, ligand and water @type model: Biskit.PDBModel @param cr: receptor chains (default: [0] = first chain) @type cr: [ int ] @param cl: ligand chains (default: None = all remaining protein chains) @type cl: [ int ] @param breaks: consider chain breaks (backbone gaps) (default: 0) @type breaks: bool or 1|0 @param mode: what to calculate (default 2, = all with shelling order) @type mode: int @param catch_err: deviate STDERR to temporary file (default 1) @type catch_err: bool or 0|1 @param **kw: any other keyword=value pair recognized by Executor """ Executor.__init__( self, 'intervor', catch_err=catch_err, **kw ) assert isinstance( model, B.PDBModel ), \ 'requires PDBModel instance' assert model is not None, 'requires PDBModel instance' self.model = model self.breaks= breaks self.chains_rec = cr self.chains_lig = cl or self.__getLigandChains( model, cr ) self.local_model = None #: will hold modified copy of model self.mode = mode ## intervor puts several output files into current working directory ## but respect cwd from Executor.__init__ or ExeConfig/exe_intervor.dat self.cwd = self.cwd or tempfile.gettempdir() #: will be used by intervor for different output files self.f_prefix = tempfile.mktemp( dir=self.exe.cwd ) self.f_pdb = self.f_prefix + '_intervor.pdb' self.result = {}
def __init__(self, hmmName, hmmdb=settings.hmm_db, **kw): """ @param hmmName: hmm profile name @type hmmName: str @param hmmdb: Pfam hmm database @type hmmdb: str **kw - all Executor parameters, in particular: @param f_out: target file name for profile.hmm, prevents its deletion @type f_out: str @param debug: @param log: @param ... """ self.hmmName = hmmName Executor.__init__(self, 'hmmfetch', args=' %s %s' % (hmmdb, hmmName), **kw)
def __init__(self, hmmFile, fastaFile, fastaID, **kw): """ @param hmmFile: path to hmm file (profile) @type hmmFile: str @param fastaFile: path to fasta search sequence @type fastaFile: str @param fastaID: fasta id of search sequence @type fastaID: str """ self.fastaID = fastaID self.hmmFile = hmmFile self.fastaFile = fastaFile assert T.fileLength( self.hmmFile ) > 10, \ 'input HMM file missing or empty' Executor.__init__(self, 'hmmalign', args=' -q %s %s' % (hmmFile, fastaFile), **kw)
def __init__(self, seq1, seq2, **kw ): """ @param seq1: sequence string @type seq1: str @param seq2: sequence string @type seq2: str """ self.seq1 = seq1 self.seq2 = seq2 self.inp1 = tempfile.mktemp('_seq1.fasta') self.inp2 = tempfile.mktemp('_seq2.fasta') # Blast Identities and Expext value self.ex_identity = re.compile('.+ Identities = (\d+)/(\d+) ') self.ex_expect = re.compile('.+ Expect = ([\d\-e\.]+)') blastcmd = '-i %s -j %s -M BLOSUM62 -p blastp -F F'\ %(self.inp1, self.inp2) Executor.__init__( self, 'bl2seq', blastcmd, catch_out=1, **kw )
def __init__(self, seq1, seq2, **kw): """ @param seq1: sequence string @type seq1: str @param seq2: sequence string @type seq2: str """ self.seq1 = seq1 self.seq2 = seq2 self.inp1 = tempfile.mktemp('_seq1.fasta') self.inp2 = tempfile.mktemp('_seq2.fasta') # Blast Identities and Expext value self.ex_identity = re.compile('.+ Identities = (\d+)/(\d+) ') self.ex_expect = re.compile('.+ Expect = ([\d\-e\.]+)') blastcmd = '-i %s -j %s -M BLOSUM62 -p blastp -F F'\ %(self.inp1, self.inp2) Executor.__init__(self, 'bl2seq', blastcmd, catch_out=1, **kw)
def __init__( self, target, hmmdb=settings.hmm_db, noSearch=None, **kw ): """ @param target: fasta sequence, fasta file, or PDBModel @type target: PDBModel or str (fasta file) or [ str ] (fasta lines) @param hmmdb: Pfam hmm database @type hmmdb: str @param noSearch: don't perform a seach @type noSearch: 1 OR None """ self.hmmdb = hmmdb Executor.__init__( self, 'hmmpfam', f_in= tempfile.mktemp('.fasta'), catch_out=1, **kw ) self.target = target self.fastaID = '' if noSearch: if self.verbose: self.log.writeln( 'Profiles provided - No search will be performed.')
def __init__( self, target, hmmdb, noSearch=None, **kw ): """ @param target: sequence @type target: PDBModel or fasta file @param hmmdb: Pfam hmm database @type hmmdb: str @param noSearch: don't perform a seach @type noSearch: 1 OR None """ self.fName = tempfile.mktemp('.fasta') self.hmmdb = hmmdb Executor.__init__( self, 'hmmpfam', catch_out=1, args=' %s %s'%(hmmdb, self.fName), **kw ) self.target = target self.fastaID = '' if noSearch: if self.verbose: self.log.writeln( 'Profiles provided - No search will be performed.')
def __init__( self, model, **kw ): """ @param model: PDBModel @type model: @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) """ Executor.__init__( self, 'whatif', template=self.whatif_script, f_out='/dev/null', **kw ) self.f_pdb = tempfile.mktemp('_whatif.pdb') self.f_relativeASA = tempfile.mktemp('_whatif_relative.log') self.f_residueASA = tempfile.mktemp('_whatif_residue.log') self.model = model.clone()
def __init__( self, model, **kw ): """ @param model: reference @type model: PDBModel @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.f_pdb = tempfile.mktemp('_pdb_to_xyzrn.pdb') ## gpdb_to_xyzrn have to be run i the local directory where ## it resides. Otherwise it will not find the data file ## called "atmtypenumbers". if not os.path.exists( T.dataRoot() + '/msms/'): raise Pdb2xyzrnError, 'Cannot find msms directory. This should reside in ~biskit/Biskit/data/msms' fmsms = T.dataRoot() + '/msms/' ## use biskit-version of pdb_to_xyzrn by default exe = ExeConfigCache.get('pdb2xyzrn', strict=1) try: exe.validate() except ExeConfigError: exe.bin = fmsms + '/gpdb_to_xyzrn' Executor.__init__( self, 'pdb2xyzrn', f_in=self.f_pdb, cwd=fmsms, **kw ) self.model = model
def __init__(self, full=0, mode='w', verbose=1, **kw): """ @param mode: open file with this mode, w=override, a=append @type mode: str @param full: dispaly pymol structures in fill screen mode:: 0 - normal mode 1 - full screen mode 2 - full screen and no menues @type full: 0|1|2 """ self.verbose = verbose # name of .pml file self.foutName = tempfile.mktemp() + '.pml' # open for <appending|writing|reading> self.fgenerate = open(self.foutName, mode) # will contain PymolModels or lists of PymolModels self.dic = {} ## add startup commands self.initPymol() ## set arguments for display options (normal, full, all) arg = '-q %s' % self.foutName if full == 1: arg = '-qe %s' % self.foutName if full == 2: arg = '-qei %s' % self.foutName Executor.__init__(self, 'pymol', args=arg, catch_err=1, catch_out=1, **kw)
def __init__( self, model, probe, vdw_set=1, mode=3, mask=None, **kw ): """ SurfaceRacer creates three output files:: result.txt - contains breakdown of surface areas and is writen to the directory where the program resides. This file is discarded here. <file>.txt - contains the accessible, molecular surface areas and average curvature information parsed here. The filename is that of the input pdb file but with a .txt extension. <file>_residue.txt - new in version 5.0 and not used by this wrapper stdout - some general information about the calculation. Redirected to /dev/null @param model: model analyze @type model: PDBModel @param probe: probe radii, Angstrom @type probe: float @param vdw_set: Van del Waals radii set (default: 1):: 1 - Richards (1977) 2 - Chothia (1976) @type vdw_set: 1|2 @param mode: calculation mode (default: 3):: 1- Accessible surface area only 2- Accessible and molecular surface areas 3- Accessible, molecular surface areas and average curvature @type mode: 1|2|3 @param mask: optional atom mask to apply before calling surface racer (default: heavy atoms AND NOT solvent) @type mask: [ bool ] @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) """ Executor.__init__( self, 'surfaceracer', template=self.inp,\ **kw ) self.model = model.clone() self.mask = mask if mask is not None else \ model.maskHeavy() * N0.logical_not( model.maskSolvent()) self.model = self.model.compress( self.mask ) ## will be filled in by self.prepare() after the temp folder is ready self.f_pdb = None self.f_pdb_name = None self.f_out_name = None ## parameters that can be changed self.probe = probe self.vdw_set = vdw_set self.mode = mode ## random data dictionaries self.ranMS = SRT.ranMS self.ranAS = SRT.ranAS self.ranMS_Nter = SRT.ranMS_N self.ranAS_Nter = SRT.ranAS_N self.ranMS_Cter = SRT.ranMS_C self.ranAS_Cter = SRT.ranAS_C ## count failures self.i_failed = 0
def __init__(self, model, template=None, topologies=None, f_charges=None, f_map=None, addcharge=True, protonate=True, autocap=False, indi=4.0, exdi=80.0, salt=0.15, ionrad=2, prbrad=1.4, bndcon=4, scale=2.3, perfil=60, **kw): """ @param model: structure for which potential should be calculated @type model: PDBModel @param template: delphi command file template [None=use default] @type template: str @param f_radii: alternative delphi atom radii file [None=use default] @type f_radii: str @param topologies: alternative list of residue charge/topology files [default: amber/residues/all*] @type topologies: [ str ] @param f_charges: alternative delphi charge file [default: create custom] @type f_charges: str @param f_map : output file name for potential map [None= discard] @type f_map : str @param addcharge: build atomic partial charges with AtomCharger [default: True] @type addcharge: bool @param protonate: (re-)build hydrogen atoms with reduce program (True) see L{Biskit.Reduce} @type protonate: bool @param autocap: add capping NME and ACE residues to any (auto-detected) false N- or C-terminal and chain breaks (default: False) see L{Biskit.Reduce} and L{Biskit.PDBCleaner} @type autocap: bool @param indi: interior dilectric (4.0) @param exdi: exterior dielectric (80.0) @param salt: salt conc. in M (0.15) @param ionrad: ion radius (2) @param prbrad: probe radius (1.4) @param bndcon: boundary condition (4, delphi default is 2) @param scale: grid spacing (2.3) @param perfil: grid fill factor in % (for automatic grid, 60) @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) """ template = template or T.dataRoot() + '/delphi/' + self.F_PARAMS tempdir = self.newtempfolder(tempdir=True) ## create new temp folder f_in = tempfile.mktemp('.inp', 'delphi_', dir=tempdir) self.f_pdb = tempfile.mktemp('.pdb', 'delphi_', dir=tempdir) self.keep_map = f_map != None self.f_map = f_map or \ tempfile.mktemp( '_mapout.phi', 'delphi_', dir=tempdir ) ## self.f_map = None self.f_radii = None self.topologies = topologies or self.F_RESTYPES self.f_charges = f_charges or tempfile.mktemp( '.crg', 'delphi_', dir=tempdir) self.protonate = protonate self.autocap = autocap self.addcharge = addcharge ## DELPHI run parameters self.indi = indi # interior dilectric(4.0) self.exdi = exdi # exterior dielectric(80.0) self.salt = salt # salt conc. in M (0.15) self.ionrad = ionrad # ion radius (2) self.prbrad = prbrad # probe radius (1.4) self.bndcon = bndcon # boundary condition (4, delphi default is 2) ## DELPHI parameters for custom grid self.scale = scale # grid spacing (2.3) self.perfil = perfil # grid fill factor in % (for automatic grid, 60) self.gsize = None self.acenter = None self.strcenter = '(0.0,0.0,0.0)' kw['tempdir'] = tempdir kw['cwd'] = tempdir Executor.__init__(self, 'delphi', template=template, f_in=f_in, args=f_in, catch_err=True, **kw) self.model = model self.delphimodel = None
def __init__( self, model, template=None, topologies=None, f_charges=None, f_map=None, addcharge=True, protonate=True, autocap=False, indi=4.0, exdi=80.0, salt=0.15, ionrad=2, prbrad=1.4, bndcon=4, scale=2.3, perfil=60, **kw ): """ @param model: structure for which potential should be calculated @type model: PDBModel @param template: delphi command file template [None=use default] @type template: str @param f_radii: alternative delphi atom radii file [None=use default] @type f_radii: str @param topologies: alternative list of residue charge/topology files [default: amber/residues/all*] @type topologies: [ str ] @param f_charges: alternative delphi charge file [default: create custom] @type f_charges: str @param f_map : output file name for potential map [None= discard] @type f_map : str @param addcharge: build atomic partial charges with AtomCharger [default: True] @type addcharge: bool @param protonate: (re-)build hydrogen atoms with reduce program (True) see L{Biskit.Reduce} @type protonate: bool @param autocap: add capping NME and ACE residues to any (auto-detected) false N- or C-terminal and chain breaks (default: False) see L{Biskit.Reduce} and L{Biskit.PDBCleaner} @type autocap: bool @param indi: interior dilectric (4.0) @param exdi: exterior dielectric (80.0) @param salt: salt conc. in M (0.15) @param ionrad: ion radius (2) @param prbrad: probe radius (1.4) @param bndcon: boundary condition (4, delphi default is 2) @param scale: grid spacing (2.3) @param perfil: grid fill factor in % (for automatic grid, 60) @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) """ template = template or T.dataRoot() + '/delphi/' + self.F_PARAMS tempdir = self.newtempfolder( tempdir=True ) ## create new temp folder f_in = tempfile.mktemp( '.inp', 'delphi_', dir=tempdir ) self.f_pdb = tempfile.mktemp( '.pdb', 'delphi_', dir=tempdir) self.keep_map = f_map != None self.f_map = f_map or \ tempfile.mktemp( '_mapout.phi', 'delphi_', dir=tempdir ) ## self.f_map = None self.f_radii = None self.topologies = topologies or self.F_RESTYPES self.f_charges = f_charges or tempfile.mktemp( '.crg', 'delphi_', dir=tempdir ) self.protonate = protonate self.autocap = autocap self.addcharge = addcharge ## DELPHI run parameters self.indi=indi # interior dilectric(4.0) self.exdi=exdi # exterior dielectric(80.0) self.salt=salt # salt conc. in M (0.15) self.ionrad=ionrad # ion radius (2) self.prbrad=prbrad # probe radius (1.4) self.bndcon=bndcon # boundary condition (4, delphi default is 2) ## DELPHI parameters for custom grid self.scale=scale # grid spacing (2.3) self.perfil=perfil # grid fill factor in % (for automatic grid, 60) self.gsize = None self.acenter = None self.strcenter = '(0.0,0.0,0.0)' kw['tempdir'] = tempdir kw['cwd'] = tempdir Executor.__init__( self, 'delphi', template=template, f_in=f_in, args=f_in, catch_err=True, **kw ) self.model = model self.delphimodel = None
def __init__( self, model, probe, vdw_set=1, mode=3, mask=None, **kw ): """ SurfaceRacer creates three output files:: result.txt - contains breakdown of surface areas and is writen to the directory where the program resides. This file is discarded here. <file>.txt - contains the accessible, molecular surface areas and average curvature information parsed here. The filename is that of the input pdb file but with a .txt extension. <file>_residue.txt - new in version 5.0 and not used by this wrapper stdout - some general information about the calculation. Redirected to /dev/null @param model: model analyze @type model: PDBModel @param probe: probe radii, Angstrom @type probe: float @param vdw_set: Van del Waals radii set (default: 1):: 1 - Richards (1977) 2 - Chothia (1976) @type vdw_set: 1|2 @param mode: calculation mode (default: 3):: 1- Accessible surface area only 2- Accessible and molecular surface areas 3- Accessible, molecular surface areas and average curvature @type mode: 1|2|3 @param mask: optional atom mask to apply before calling surface racer (default: heavy atoms AND NOT solvent) @type mask: [ bool ] @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) """ Executor.__init__( self, 'surfaceracer', template=self.inp,\ **kw ) self.model = model.clone() self.mask = mask if mask is not None else \ model.maskHeavy() * N.logical_not( model.maskSolvent()) self.model = self.model.compress( self.mask ) ## will be filled in by self.prepare() after the temp folder is ready self.f_pdb = None self.f_pdb_name = None self.f_out_name = None ## parameters that can be changed self.probe = probe self.vdw_set = vdw_set self.mode = mode ## random data dictionaries self.ranMS = SRT.ranMS self.ranAS = SRT.ranAS self.ranMS_Nter = SRT.ranMS_N self.ranAS_Nter = SRT.ranAS_N self.ranMS_Cter = SRT.ranMS_C self.ranAS_Cter = SRT.ranAS_C ## count failures self.i_failed = 0