Beispiel #1
0
    def fetchPDB( self, id ):

        try:
            h = self.getLocalPDBHandle( id )
        except:
            h = self.getRemotePDBHandle( id )

        fname = tempfile.mktemp( '.pdb', 'ncbiparser_' )

        lines, infos = self.parsePdbFromHandle( h, first_model_only=1 )

        ## close if it is a handle
        try: h.close()
        except:
            pass

        f = open( fname, 'w', 1 )
        f.writelines( lines )
        f.close()

        m = B.PDBModel( fname )
        m.disconnect()
        m.pdbCode = id
        m.info.update( infos )

        T.tryRemove( fname )

        return m
Beispiel #2
0
    def load_locked(self, fname):
        """
        wait with unpickling until another Entropist has finished.

        @param fname: file name
        @type  fname: str

        @return: trajectroy
        @rtype: Trajectroy
        """
        flock = fname + '__locked'

        while os.path.exists(flock):
            if self.verbose: self.log.write('~')
            time.sleep(random.random() * 10)
        if self.verbose: self.log.add('')

        try:
            f = open(flock, 'w')
            f.write('1')
            f.close()

            r = t.load(fname)

        finally:
            t.tryRemove(flock)

        return r
Beispiel #3
0
    def fetchPDB(self, id):

        try:
            h = self.getLocalPDBHandle(id)
        except:
            h = self.getRemotePDBHandle(id)

        fname = tempfile.mktemp('.pdb', 'ncbiparser_')

        lines, infos = self.parsePdbFromHandle(h, first_model_only=1)

        ## close if it is a handle
        try:
            h.close()
        except:
            pass

        f = open(fname, 'w', 1)
        f.writelines(lines)
        f.close()

        m = B.PDBModel(fname)
        m.disconnect()
        m.pdbCode = id
        m.info.update(infos)

        T.tryRemove(fname)

        return m
Beispiel #4
0
    def load_locked( self, fname ):
        """
        wait with unpickling until another Entropist has finished.

        @param fname: file name
        @type  fname: str

        @return: trajectroy
        @rtype: Trajectroy
        """
        flock = fname + '__locked'

        while os.path.exists( flock ):
            if self.verbose: self.log.write('~')
            time.sleep( random.random() * 10 )
        if self.verbose: self.log.add('')

        try:
            f = open( flock, 'w' )
            f.write('1')
            f.close()

            r = t.load(fname)

        finally:
            t.tryRemove( flock )

        return r
Beispiel #5
0
 def testCleanup( self, tree=True ):
     """
     Remove files marked as 'cleanup' by setTest(). 
     @param tree: try also removing directories
     @type tree: bool
     """
     for f in self.test_cleanup:
         T.tryRemove( f, tree=tree )
Beispiel #6
0
 def cleanup(self):
     """
     remove temp files
     """
     if not self.debug:
         del_lst = [self.sub_fastaFile, self.hmmFile, self.fastaFile]
         for d in del_lst:
             T.tryRemove(d)
Beispiel #7
0
    def cleanup( self ):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_pdb )
Beispiel #8
0
 def testCleanup(self, tree=True):
     """
     Remove files marked as 'cleanup' by setTest(). 
     @param tree: try also removing directories
     @type tree: bool
     """
     for f in self.test_cleanup:
         T.tryRemove(f, tree=tree)
Beispiel #9
0
 def cleanup( self ):
     """
     remove temp files
     """
     if not self.debug:
         del_lst = [ self.sub_fastaFile, self.hmmFile, self.fastaFile ]
         for d in del_lst:
             T.tryRemove( d )
Beispiel #10
0
    def cleanup(self):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup(self)

        if not self.debug:
            T.tryRemove(self.f_pdb)
Beispiel #11
0
    def cleanup( self ):
        """
        Remove temp files.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_xyzrn )
            T.tryRemove( self.f_surf + '.area' )
Beispiel #12
0
    def cleanup( self ):
        """
        Remove temp files.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_xyzrn )
            T.tryRemove( self.f_surf + '.area' )
Beispiel #13
0
 def cleanup( self ):
     """
     Tidy up the mess you created.
     Does nothing. No temporary files are created.
     """        
     Executor.cleanup( self )
     if not self.debug:
         T.tryRemove( self.f_pdbin )
         T.tryRemove( self.f_out)
Beispiel #14
0
 def cleanup(self):
     """
     Tidy up the mess you created.
     Does nothing. No temporary files are created.
     """
     Executor.cleanup(self)
     if not self.debug:
         T.tryRemove(self.f_pdbin)
         T.tryRemove(self.f_out)
Beispiel #15
0
    def cleanup(self):
        """
        Tidy up the mess we created. Called after program execution.
        """
        Executor.cleanup(self)

        if not self.debug:
            ## remove all files created by intervor
            for f in glob.glob(self.f_prefix + '*'):
                T.tryRemove(f)
Beispiel #16
0
    def cleanup( self ):
        """
        Clean up after external program has finished (failed or not).
        Override, but call in child method!
        """
        if not self.keep_inp and not self.debug:
            T.tryRemove( self.f_in )

        if self.f_err and not self.debug:
            T.tryRemove( self.f_err )
Beispiel #17
0
 def cleanup( self ):
     """
     Tidy up the mess we created. Called after program execution.
     """
     Executor.cleanup( self )
     
     if not self.debug:
         ## remove all files created by intervor
         for f in glob.glob( self.f_prefix + '*' ):
             T.tryRemove( f )
Beispiel #18
0
    def cleanup( self ):
        """
        Tidy up the mess you created.
        """        
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_ref )

            for i in range( len(self.models)):
                T.tryRemove( self.f_pdb % i )
Beispiel #19
0
    def cleanup(self):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup(self)

        if not self.debug:
            T.tryRemove(self.f_ref)

            for i in range(len(self.models)):
                T.tryRemove(self.f_pdb % i)
Beispiel #20
0
    def cleanup(self):
        """
        Clean up after external program has finished (failed or not).
        Note: a temporary folder, if it has been created, is only deleted if
        it empty.
        Override, but call in (preferably at the end of) child method!
        """
        if not self.keep_out and not self.debug and self.f_out:
            t.tryRemove(self.f_out)

        if not self.keep_inp and not self.debug:
            t.tryRemove(self.f_in)

        if self.f_err and not self.debug:
            t.tryRemove(self.f_err)

        if not self.keep_tempdir and not self.debug:
            if self.verbose:
                if os.listdir(self.tempdir):
                    self.log.writeln('Removing non-empty temporary folder %s'\
                                     % self.tempdir )
                else:
                    self.log.writeln( 'Removing temporary folder %s'\
                                      % self.tempdir )
            t.tryRemove(self.tempdir, tree=True)
Beispiel #21
0
    def cleanup( self ):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_pdb, verbose=self.verbose )
            T.tryRemove( self.f_out_name, verbose=self.verbose )
            T.tryRemove( os.path.join(self.cwd, 'result.txt'), 
                         verbose=self.verbose )
            T.tryRemove( self.f_pdb[:-4]+'_residue.txt', verbose=self.verbose)
Beispiel #22
0
    def cleanup( self ):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_pdb, verbose=self.verbose )
            T.tryRemove( self.f_out_name, verbose=self.verbose )
            T.tryRemove( os.path.join(self.cwd, 'result.txt'), 
                         verbose=self.verbose )
            T.tryRemove( self.f_pdb[:-4]+'_residue.txt', verbose=self.verbose)
Beispiel #23
0
    def cleanup( self ):
        """
        Remove temporary files.
        """
        Xplorer.cleanup( self )

        if not self.debug:

            t.tryRemove( self.rec_in )
            t.tryRemove( self.lig_in )

            t.tryRemove( self.rec_out )
            t.tryRemove( self.lig_out )
Beispiel #24
0
    def cleanup(self):
        """
        Remove temporary files.
        """
        Xplorer.cleanup(self)

        if not self.debug:

            t.tryRemove(self.rec_in)
            t.tryRemove(self.lig_in)

            t.tryRemove(self.rec_out)
            t.tryRemove(self.lig_out)
Beispiel #25
0
    def cleanCache( self ):
        """
        Remove left-over cache files
        """
        fs = [ self.ref_frec, self.ref_flig, self.ref_com, self.ref_brec,
               self.ref_blig ]
        fs.extend( self.members_frec + self.members_flig )
        fs.extend( self.members_brec + self.members_blig )
        fs.extend( self.members_com )

        for f in fs:
            self.log.add('removing %s: %i' % (f, T.tryRemove(f)) )
Beispiel #26
0
    def cleanCache( self ):
        """
        Remove left-over cache files
        """
        fs = [ self.ref_frec, self.ref_flig, self.ref_com, self.ref_brec,
               self.ref_blig ]
        fs.extend( self.members_frec + self.members_flig )
        fs.extend( self.members_brec + self.members_blig )
        fs.extend( self.members_com )

        for f in fs:
            self.log.add('removing %s: %i' % (f, T.tryRemove(f)) )
Beispiel #27
0
    def cleanup(self):
        Executor.cleanup(self)

        if not self.debug:
            T.tryRemove(self.prosaPdbFile)
            T.tryRemove(self.f_in)
            T.tryRemove(self.prosaOutput + '.ana')
Beispiel #28
0
    def cleanup( self ):
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.prosaPdbFile )
            T.tryRemove( self.f_in)
            T.tryRemove( self.prosaOutput + '.ana' )
Beispiel #29
0
    def cleanup(self):
        """
        Remove temporary files.
        """
        AmberCrdEntropist.cleanup(self)

        if not self.debug:
            t.tryRemove(self.parmcrd)

            if not self.keep_crd:
                t.tryRemove(self.f_crd)
            if not self.keep_parm:
                t.tryRemove(self.f_parm)
Beispiel #30
0
    def cleanup( self ):
        """
        Remove temporary files.
        """
        AmberCrdEntropist.cleanup( self )

        if not self.debug:
            t.tryRemove( self.parmcrd )

            if not self.keep_crd:
                t.tryRemove( self.f_crd )
            if not self.keep_parm:
                t.tryRemove( self.f_parm )
Beispiel #31
0
    def cleanup( self ):
        """
        Clean up after external program has finished (failed or not).
        Note: a temporary folder, if it has been created, is only deleted if
        it empty.
        Override, but call in (preferably at the end of) child method!
        """
        if not self.keep_out and not self.debug and self.f_out:
            t.tryRemove( self.f_out )

        if not self.keep_inp and not self.debug:
            t.tryRemove( self.f_in )

        if self.f_err and not self.debug:
            t.tryRemove( self.f_err )
        
        if not self.keep_tempdir and not self.debug and self.verbose:
            if os.listdir( self.tempdir ):  
                self.log.add('Warning: Removing non-empty temporary folder %s'%\
                             self.tempdir )
            self.log.writeln( 'Removing temporary folder %s' % self.tempdir )
            t.tryRemove( self.tempdir, tree=True )
Beispiel #32
0
 def cleanUp(self):
     import Biskit.tools as T
     T.tryRemove( self.fout )
Beispiel #33
0
 def cleanUp(self):
     T.tryRemove( self.out_folder, tree=1 )
Beispiel #34
0
 def cleanUp(self):
     t.tryRemove( self.f_pfb )
     t.tryRemove( self.f_crd )
Beispiel #35
0
 def cleanUp(self):
     t.tryRemove(self.fout)
Beispiel #36
0
 def cleanUp(self):
     if T.tryRemove(self.f_out) and self.local:
         print 'log file removed.'
Beispiel #37
0
    def parmSolvated( self, f_out, f_out_crd=None, f_out_pdb=None,
                      hetatm=0, norun=0,
                      cap=0, capN=[], capC=[],
                      fmod=['frcmod.ionsjc_tip3p'], fprep=[],
                      box=10.0, center=True, **kw ):
        """
        @param f_out: target file for parm (topology)
        @type  f_out: str
        @param f_out_crd: target file for crd (coordinates)
                          (default:|f_out_base|.crd)
        @type  f_out_crd: str
        @param f_out_pdb: target file for pdb (default:|f_out_base|.pdb)
        @type  f_out_pdb: str
        @param hetatm: keep hetero atoms (default: 0)
        @type  hetatm: 1|0
        @param cap: put ACE and NME capping residue on chain breaks 
                    (default: 0)
        @type  cap: 1|0
        @param capN: indices of chains that should get ACE cap (default: [])
        @type  capN: [int]
        @param capC: indices of chains that should get NME cap (default: [])
        @type  capC: [int]
        @param box: minimal distance of solute from box edge (default: 10.0)
        @type  box: float
        @param center: re-center coordinates (default: True)
        @type  center: bool
        @param fmod: list of files with amber parameter modifications
                     to be loaded into leap with loadAmberParams
                    (default:['frcmod.ionsjc_tip3p'] ... mod file needed for 
                    default Amber ff10 ions -- topology saving will fail if this 
                    one is missing)
        @type  fmod: [str]
        @param fprep: list of files with amber residue definitions
                    (to be loaded into leap with loadAmberPrep) (default: [])
        @type  fprep: [str]
        @param kw: additional key=value pairs for leap input template
        @type  kw: key=value

        @raise IOError:
        """
        f_out = t.absfile( f_out )
        f_out_crd = t.absfile( f_out_crd ) or t.stripSuffix( f_out ) + '.crd'
        f_out_pdb = t.absfile( f_out_pdb ) or t.stripSuffix( f_out ) +\
                    '_leap.pdb'

        ## removed: (bugfix 3434136)
        #fmod  = [ t.absfile( f ) for f in t.toList( fmod )  ]
        #fprep = [ t.absfile( f ) for f in t.toList( fprep ) ]

        try:
            if self.verbose: self.log.add( '\nCleaning PDB file for Amber:' )
            m = self.leapModel( hetatm=hetatm, center=center )

            if cap:
                end_broken = m.atom2chainIndices( m.chainBreaks() )
                capC = MU.union( capC, end_broken )
                capN = MU.union( capN, N.array( end_broken ) + 1 )

            for i in capN:
                if self.verbose:
                    self.log.add( 'Adding ACE cap to chain %i' % i )
                m = self.capACE( m, i )

            for i in capC:
                if self.verbose:
                    self.log.add( 'Adding NME cap to chain %i' % i )
                m = self.capNME( m, i )

            m.renumberResidues( addChainId=1 )  ## again, to accomodate capping

            template = open( self.leap_template ).read()

            leap_mod = self.__fLines( 'm = loadAmberParams %s\n', fmod )
            leap_prep= self.__fLines( 'loadAmberPrep %s\n', fprep )

            ss = self.__ssBonds( m, cutoff=4. )
            self.__cys2cyx( m, ss )
            leap_ss  = self.__fLines( self.ss_bond, ss )
            if self.verbose:
                self.log.add('Found %i disulfide bonds: %s' % (len(ss),str(ss)))

            if self.verbose:
                self.log.add( 'writing cleaned PDB to %s'  % self.leap_pdb )
            m.writePdb( self.leap_pdb, ter=3 )

            self.__runLeap( template, in_pdb=self.leap_pdb,
                            out_parm=f_out, out_crd=f_out_crd,
                            ss_bonds=leap_ss, fmod=leap_mod,
                            fprep=leap_prep, norun=norun,
                            box=box, **kw )

            if not norun:
                parm_pdb = self.parm2pdb( f_out, f_out_crd, f_out_pdb )

            if not self.keep_leap_pdb and not self.debug:
                t.tryRemove( self.leap_pdb )

        except IOError, why:
            raise IOError, why
Beispiel #38
0
 def cleanUp(self):
     T.tryRemove( self.fparm )
     T.tryRemove( self.flog )
Beispiel #39
0
 def cleanUp(self):
     T.tryRemove( self.sep.log.fname ) 
Beispiel #40
0
 def cleanUp(self):
     import Biskit.tools as T
     T.tryRemove(self.fout)
Beispiel #41
0
 def cleanUp(self):
     t.tryRemove(self.f_pfb)
     t.tryRemove(self.f_crd)
Beispiel #42
0
 def cleanUp(self):
     T.tryRemove(  self.cl_out )
Beispiel #43
0
    def cleanup( self ):
        """
        Tidy up the mess you created.
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.f_pdb )
            T.tryRemove( self.f_relativeASA )
            T.tryRemove( self.f_residueASA )

            T.tryRemove('FOR???.DAT', wildcard=1)
            T.tryRemove('pdbout.tex')
            T.tryRemove('pdbout.txt')
            T.tryRemove('TEXSTORE.DAT')
            T.tryRemove('TEXTABLE.DAT')
Beispiel #44
0
    def parmMirror( self, f_out, f_out_crd=None, fmod=['frcmod.ionsjc_tip3p'], 
                    fprep=[], **kw ):
        """
        Create a parm7 file whose atom content (and order) exactly mirrors
        the given PDBModel. This requires two leap runs. First we get a
        temporary topology, then we identify all atoms added by leap and
        build a final topology where these atoms are deleted.
        This parm is hence NOT suited for simulations but can be used to parse
        e.g. a trajectory or PDB into ptraj.

        @param f_out: target parm file
        @type  f_out: str
        @param f_out_crd: target crd file (default: f_out but ending .crd)
        @type  f_out_crd: str
        @param fmod : list of amber Mod files (loaded with loadAmberParams)
        @type  fmod : [str]
        @param fmod : list of amber Prep files (loaded with loadAmberPrep)
        @type  fmod : [str]
        """
        f_out = t.absfile( f_out )
        f_out_crd = t.absfile( f_out_crd ) or t.stripSuffix( f_out ) + '.crd'

        ## if there are hydrogens, recast them to standard amber names
        aatm = 'HA' in self.m.atomNames() ## 'HB2' in self.m.atomNames()

        ## First leap round ##
        m_ref = self.m.clone()
        m_ref.xplor2amber( aatm=aatm, parm10=True )
        tmp_in = tempfile.mktemp( 'leap_in0.pdb' )
        m_ref.writePdb( tmp_in, ter=3 )

        tmp_parm = tempfile.mktemp( '_parm0' )
        tmp_crd  = tempfile.mktemp( '_crd0' )

        leap_mod = self.__fLines( 'm = loadAmberParams %s\n', fmod )
        leap_prep= self.__fLines( 'loadAmberPrep %s\n', fprep )

        self.__runLeap( self.script_mirror_pdb,
                        leaprc=self.leaprc, fmod=leap_mod, fprep=leap_prep,
                        in_pdb=tmp_in, out_parm=tmp_parm, out_crd=tmp_crd,
                        delete_atoms='' )

        tmp_pdb = self.parm2pdb( tmp_parm, tmp_crd,
                                 tempfile.mktemp( 'leap_out.pdb' ), aatm=aatm )

        if not self.debug:
            t.tryRemove( tmp_parm )
            t.tryRemove( tmp_crd )
            t.tryRemove( tmp_in )

        ## load model with missing atoms added by leap
        m_leap = PDBModel( tmp_pdb  )

        ## compare atom content
        iLeap, iRef = m_leap.compareAtoms( m_ref )

        ## check that ref model doesn't need any change
        if iRef != range( len( m_ref ) ):
            uLeap, uRef = m_leap.unequalAtoms( m_ref, iLeap, iRef )
            atms = m_ref.reportAtoms( uRef, n=6 )
            raise AmberError, "Cannot create exact mirror of %s.\n" % tmp_in +\
                  "Leap has renamed/deleted original atoms in %s:\n"% tmp_pdb+\
                  atms

        ## indices of atoms that were added by leap
        delStr = self.__deleteAtoms( m_leap,
                                     self.__inverseIndices( m_leap, iLeap ) )

        ## Second leap round ##
        self.__runLeap( self.script_mirror_pdb, leaprc=self.leaprc,
                        in_pdb=tmp_pdb, fmod=leap_mod, fprep=leap_prep,
                        out_parm=f_out, out_crd=f_out_crd,
                        delete_atoms=delStr )

        if not self.debug:
            t.tryRemove( tmp_pdb )
Beispiel #45
0
    def parmSolvated(self,
                     f_out,
                     f_out_crd=None,
                     f_out_pdb=None,
                     hetatm=0,
                     norun=0,
                     cap=0,
                     capN=[],
                     capC=[],
                     fmod=['frcmod.ionsjc_tip3p'],
                     fprep=[],
                     box=10.0,
                     center=True,
                     **kw):
        """
        @param f_out: target file for parm (topology)
        @type  f_out: str
        @param f_out_crd: target file for crd (coordinates)
                          (default:|f_out_base|.crd)
        @type  f_out_crd: str
        @param f_out_pdb: target file for pdb (default:|f_out_base|.pdb)
        @type  f_out_pdb: str
        @param hetatm: keep hetero atoms (default: 0)
        @type  hetatm: 1|0
        @param cap: put ACE and NME capping residue on chain breaks 
                    (default: 0)
        @type  cap: 1|0
        @param capN: indices of chains that should get ACE cap (default: [])
        @type  capN: [int]
        @param capC: indices of chains that should get NME cap (default: [])
        @type  capC: [int]
        @param box: minimal distance of solute from box edge (default: 10.0)
        @type  box: float
        @param center: re-center coordinates (default: True)
        @type  center: bool
        @param fmod: list of files with amber parameter modifications
                     to be loaded into leap with loadAmberParams
                    (default:['frcmod.ionsjc_tip3p'] ... mod file needed for 
                    default Amber ff10 ions -- topology saving will fail if this 
                    one is missing)
        @type  fmod: [str]
        @param fprep: list of files with amber residue definitions
                    (to be loaded into leap with loadAmberPrep) (default: [])
        @type  fprep: [str]
        @param kw: additional key=value pairs for leap input template
        @type  kw: key=value

        @raise IOError:
        """
        f_out = t.absfile(f_out)
        f_out_crd = t.absfile(f_out_crd) or t.stripSuffix(f_out) + '.crd'
        f_out_pdb = t.absfile( f_out_pdb ) or t.stripSuffix( f_out ) +\
                    '_leap.pdb'

        ## removed: (bugfix 3434136)
        #fmod  = [ t.absfile( f ) for f in t.toList( fmod )  ]
        #fprep = [ t.absfile( f ) for f in t.toList( fprep ) ]

        try:
            if self.verbose: self.log.add('\nCleaning PDB file for Amber:')
            m = self.leapModel(hetatm=hetatm, center=center)

            if cap:
                end_broken = m.atom2chainIndices(m.chainBreaks())
                capC = MU.union(capC, end_broken)
                capN = MU.union(capN, N.array(end_broken) + 1)

            for i in capN:
                if self.verbose:
                    self.log.add('Adding ACE cap to chain %i' % i)
                m = self.capACE(m, i)

            for i in capC:
                if self.verbose:
                    self.log.add('Adding NME cap to chain %i' % i)
                m = self.capNME(m, i)

            m.renumberResidues(addChainId=1)  ## again, to accomodate capping

            template = open(self.leap_template).read()

            leap_mod = self.__fLines('m = loadAmberParams %s\n', fmod)
            leap_prep = self.__fLines('loadAmberPrep %s\n', fprep)

            ss = self.__ssBonds(m, cutoff=4.)
            self.__cys2cyx(m, ss)
            leap_ss = self.__fLines(self.ss_bond, ss)
            if self.verbose:
                self.log.add('Found %i disulfide bonds: %s' %
                             (len(ss), str(ss)))

            if self.verbose:
                self.log.add('writing cleaned PDB to %s' % self.leap_pdb)
            m.writePdb(self.leap_pdb, ter=3)

            self.__runLeap(template,
                           in_pdb=self.leap_pdb,
                           out_parm=f_out,
                           out_crd=f_out_crd,
                           ss_bonds=leap_ss,
                           fmod=leap_mod,
                           fprep=leap_prep,
                           norun=norun,
                           box=box,
                           **kw)

            if not norun:
                parm_pdb = self.parm2pdb(f_out, f_out_crd, f_out_pdb)

            if not self.keep_leap_pdb and not self.debug:
                t.tryRemove(self.leap_pdb)

        except IOError, why:
            raise IOError, why
Beispiel #46
0
 def cleanUp(self):
     if not self.DEBUG:
         T.tryRemove( self.dryparm )
         T.tryRemove( self.drycrd )
         T.tryRemove( self.drypdb )
         T.tryRemove( self.wetparm )
         T.tryRemove( self.wetcrd )
         T.tryRemove( self.wetpdb )
         T.tryRemove( self.leapout )
Beispiel #47
0
 def cleanUp(self):
     try:
         T.tryRemove( self.f_plot )
     except:
         pass
Beispiel #48
0
 def cleanUp(self):
     T.tryRemove(self.dir_out, tree=1)
Beispiel #49
0
 def cleanup(self):
     """
     Tidy up.
     """
     T.tryRemove(self.outFolder, verbose=self.verbose, tree=1)
Beispiel #50
0
 def cleanUp(self):
     t.tryRemove( self.f_out )
Beispiel #51
0
    def cleanup( self ):
        """
        Remove files created for and by the calculation. 
        """
        Executor.cleanup( self )

        if not self.debug:
            T.tryRemove( self.temp_pdb )
            T.tryRemove( self.temp_command )
            T.tryRemove( self.temp_option )
            T.tryRemove( self.temp_result )
            T.tryRemove( self.temp_runlog )
            T.tryRemove( self.temp_errlog )
            ## Fold-X writes a file called "runlog.txt"
            ## to local directory. Try to remove it.
            T.tryRemove( 'runlog.txt' )
            ## and even though the error log is supposed
            ## to be written to self.temp_errlog, I get a
            ## 'errorfile.txt' in the local directory. Remove.
            T.tryRemove( 'errorfile.txt' )
Beispiel #52
0
 def cleanUp(self):
     if not self.DEBUG:
         T.tryRemove(self.dryparm)
         T.tryRemove(self.drycrd)
         T.tryRemove(self.drypdb)
         T.tryRemove(self.wetparm)
         T.tryRemove(self.wetcrd)
         T.tryRemove(self.wetpdb)
         T.tryRemove(self.leapout)
Beispiel #53
0
 def cleanUp(self):
     T.tryRemove(self.fparm)
     T.tryRemove(self.flog)
Beispiel #54
0
    def parmMirror(self,
                   f_out,
                   f_out_crd=None,
                   fmod=['frcmod.ionsjc_tip3p'],
                   fprep=[],
                   **kw):
        """
        Create a parm7 file whose atom content (and order) exactly mirrors
        the given PDBModel. This requires two leap runs. First we get a
        temporary topology, then we identify all atoms added by leap and
        build a final topology where these atoms are deleted.
        This parm is hence NOT suited for simulations but can be used to parse
        e.g. a trajectory or PDB into ptraj.

        @param f_out: target parm file
        @type  f_out: str
        @param f_out_crd: target crd file (default: f_out but ending .crd)
        @type  f_out_crd: str
        @param fmod : list of amber Mod files (loaded with loadAmberParams)
        @type  fmod : [str]
        @param fmod : list of amber Prep files (loaded with loadAmberPrep)
        @type  fmod : [str]
        """
        f_out = t.absfile(f_out)
        f_out_crd = t.absfile(f_out_crd) or t.stripSuffix(f_out) + '.crd'

        ## if there are hydrogens, recast them to standard amber names
        aatm = 'HA' in self.m.atomNames()  ## 'HB2' in self.m.atomNames()

        ## First leap round ##
        m_ref = self.m.clone()
        m_ref.xplor2amber(aatm=aatm, parm10=True)
        tmp_in = tempfile.mktemp('leap_in0.pdb')
        m_ref.writePdb(tmp_in, ter=3)

        tmp_parm = tempfile.mktemp('_parm0')
        tmp_crd = tempfile.mktemp('_crd0')

        leap_mod = self.__fLines('m = loadAmberParams %s\n', fmod)
        leap_prep = self.__fLines('loadAmberPrep %s\n', fprep)

        self.__runLeap(self.script_mirror_pdb,
                       leaprc=self.leaprc,
                       fmod=leap_mod,
                       fprep=leap_prep,
                       in_pdb=tmp_in,
                       out_parm=tmp_parm,
                       out_crd=tmp_crd,
                       delete_atoms='')

        tmp_pdb = self.parm2pdb(tmp_parm,
                                tmp_crd,
                                tempfile.mktemp('leap_out.pdb'),
                                aatm=aatm)

        if not self.debug:
            t.tryRemove(tmp_parm)
            t.tryRemove(tmp_crd)
            t.tryRemove(tmp_in)

        ## load model with missing atoms added by leap
        m_leap = PDBModel(tmp_pdb)

        ## compare atom content
        iLeap, iRef = m_leap.compareAtoms(m_ref)

        ## check that ref model doesn't need any change
        if iRef != range(len(m_ref)):
            uLeap, uRef = m_leap.unequalAtoms(m_ref, iLeap, iRef)
            atms = m_ref.reportAtoms(uRef, n=6)
            raise AmberError, "Cannot create exact mirror of %s.\n" % tmp_in +\
                  "Leap has renamed/deleted original atoms in %s:\n"% tmp_pdb+\
                  atms

        ## indices of atoms that were added by leap
        delStr = self.__deleteAtoms(m_leap,
                                    self.__inverseIndices(m_leap, iLeap))

        ## Second leap round ##
        self.__runLeap(self.script_mirror_pdb,
                       leaprc=self.leaprc,
                       in_pdb=tmp_pdb,
                       fmod=leap_mod,
                       fprep=leap_prep,
                       out_parm=f_out,
                       out_crd=f_out_crd,
                       delete_atoms=delStr)

        if not self.debug:
            t.tryRemove(tmp_pdb)
Beispiel #55
0
 def cleanUp(self):
     T.tryRemove(self.f_inp)
     T.tryRemove(self.f_out_inp)
Beispiel #56
0
 def cleanUp(self):
     try:
         T.tryRemove(self.f_plot)
     except:
         pass
Beispiel #57
0
 def cleanUp(self):
     T.tryRemove(self.cl_out)
Beispiel #58
0
 def cleanUp(self):
     T.tryRemove( self.f_inp )
     T.tryRemove( self.f_out_inp )