Exemple #1
0
def whats_in_pdb( pdb ):
    pdbline_dict = pdb_util.create_xyzDict_bychain( pdb )[1]
    total_rsds = 0
    chains = sorted( pdbline_dict.keys() )
    check_chainbreak=False
    for chain in chains:
        res_list = pdbline_dict[ chain ]
        first_rsn = min( res_list )
        last_rsn  = max( res_list )
        n_rsd     = len( res_list )
        print "%s: chain:%s, from %4s to %4s, %4s rsds" %( pdb, chain, min( res_list ), max( res_list ), len( res_list ))
        if first_rsn + n_rsd - 1 != last_rsn: # there is a chainbreak
            check_chainbreak=True
        total_rsds += len( res_list )

    print
    print "found chainbreak(s):"
    print pdb_util.detect_chainbreaks_in_pdb( pdb )
    print "[Summary] %s: %s chains (%s) and %s rsds" %( pdb, len(chains), " ".join(chains), total_rsds )
#!/usr/bin/env python2.7
from argparse import ArgumentParser
from os.path import exists
from sys import exit, stderr, stdout, path
import sys
import pdb_util

if __name__=='__main__':
    parser = ArgumentParser()
    parser.add_argument("pdbs", nargs="+", help="")
    parser.add_argument("-t", "--chainbreak_distcut", default=4.0, type=float, help="")
    opts = parser.parse_args()

    for pdb in opts.pdbs:
        if not exists( pdb ):
            sys.stderr.write("ERROR: %s doesn't exist.\n" % pdb )
            continue
        print pdb_util.detect_chainbreaks_in_pdb( pdb, opts.chainbreak_distcut )