pKarun/WI_tools.py
def do_fulchk(pdbfile):
    """Run a fulchk on a pdbfile"""
    import tempfile, os
    topdir=os.getcwd()
    tdir=tempfile.mkdtemp(dir=topdir)
    import shutil
    pdbname=os.path.join(tdir,os.path.split(pdbfile)[1])
    shutil.copyfile(pdbfile,pdbname)
    #
    os.chdir(tdir)
    newpdb=pdbname+'_delhyd'
    # First delete hydrogens
    com =' $pwd \n $ls \n getmol %s \n set1 \n 1 \n Y \n 1 \n %%dellig \n soup \n %%makmol \n %s \n %s \n \n tot 0 \n' %(pdbname,pdbname,newpdb)
    log=RunWI(com)
    for line in log:
        print line,
    print '*********'
    com=' check \n fulchk \n %s \n \n \n Y \n' %newpdb
    log=RunWI(com)
    record=False
    scores={}
    for line in log:
        print line,
        if len(line.strip())==0:
            continue
        elif line.split()[0]=='RMS':
            continue
        if line[:6]=='SCRIPT'and record:
            break
        if record:
            sp=line.split(':')
            scores[sp[0].strip()]=float(sp[1].split()[0])
        if line.strip()=='Structure Z-scores, positive is better than average:':
            record=True
    os.chdir(topdir)
    shutil.rmtree(tdir)
    if scores=={}:
        raise Exception('WHATCHECK failed')
    return scores
Run a fulchk on a pdbfile
Run a fulchk on a pdbfile
Run a fulchk on a pdbfile
def do_fulchk(pdbfile):
    import tempfile, os
    topdir=os.getcwd()
    tdir=tempfile.mkdtemp(dir=topdir)
    import shutil
    pdbname=os.path.join(tdir,os.path.split(pdbfile)[1])
    shutil.copyfile(pdbfile,pdbname)
    os.chdir(tdir)
    newpdb=pdbname+'_delhyd'
     First delete hydrogens
    com =' $pwd \n $ls \n getmol %s \n set1 \n 1 \n Y \n 1 \n %%dellig \n soup \n %%makmol \n %s \n %s \n \n tot 0 \n' %(pdbname,pdbname,newpdb)
    log=RunWI(com)
    for line in log:
        print line,
    print '*********'
    com=' check \n fulchk \n %s \n \n \n Y \n' %newpdb
    log=RunWI(com)
    record=False
    scores={}
    for line in log:
        print line,
        if len(line.strip())==0:
            continue
        elif line.split()[0]=='RMS':
            continue
        if line[:6]=='SCRIPT'and record:
            break
        if record:
            sp=line.split(':')
            scores[sp[0].strip()]=float(sp[1].split()[0])
        if line.strip()=='Structure Z-scores, positive is better than average:':
            record=True
    os.chdir(topdir)
    shutil.rmtree(tdir)
    if scores=={}:
        raise Exception('WHATCHECK failed')
    return scores
def do_fulchk ( pdbfile ) : import tempfile , os topdir = os . getcwd ( ) tdir = tempfile . mkdtemp ( dir = topdir ) import shutil pdbname = os . path . join ( tdir , os . path . split ( pdbfile ) [ 1 ] ) shutil . copyfile ( pdbfile , pdbname ) os . chdir ( tdir ) newpdb = pdbname + '_delhyd' com = ' $pwd \n $ls \n getmol %s \n set1 \n 1 \n Y \n 1 \n %%dellig \n soup \n %%makmol \n %s \n %s \n \n tot 0 \n' % ( pdbname , pdbname , newpdb ) log = RunWI ( com ) for line in log : print line , print '*********' com = ' check \n fulchk \n %s \n \n \n Y \n' % newpdb log = RunWI ( com ) record = False scores = { } for line in log : print line , if len ( line . strip ( ) ) == 0 : continue elif line . split ( ) [ 0 ] == 'RMS' : continue if line [ : 6 ] == 'SCRIPT' and record : break if record : sp = line . split ( ':' ) scores [ sp [ 0 ] . strip ( ) ] = float ( sp [ 1 ] . split ( ) [ 0 ] ) if line . strip ( ) == 'Structure Z-scores, positive is better than average:' : record = True os . chdir ( topdir ) shutil . rmtree ( tdir ) if scores == { } : raise Exception ( 'WHATCHECK failed' ) return scores
Run a fulchk on a pdbfile
Run a fulchk on a pdbfile
"""Run a fulchk on a pdbfile""" # # First delete hydrogens
pdbfile