示例#1
0
    pdb = basename(pdb)
    tag = "_trim"
    outfn = pdb[:-4] + tag

    while exists( outfn+".pdb" ):
        outfn += tag
        print outfn

    outfn = outfn+".pdb"
    '''

    buf = open( outfn, "w" )
    buf.write( outfn_lines )
    buf.close()


if __name__=="__main__":
    parser = ArgumentParser()
    parser.add_argument("pdbs", nargs="+", help="")
    parser.add_argument("-r", "--to_trim", nargs="+", required=True,  help="format: 123B-134B 156B-167B")
    parser.add_argument("--save_hetatm",  action="store_true", help="save heteroatoms")
    parser.add_argument("--n_processors", type=int, default=20, help="numbers of CPUs you are going to use, default=20")
    args = parser.parse_args()

    resnum_to_trim_dict = pdb_util.get_resnum_dict( args.to_trim )
    joblist = [ (pdb, resnum_to_trim_dict, args.save_hetatm) for pdb in args.pdbs ]

    myPool    = Pool( processes = args.n_processors )
    myResults = myPool.map_async( trim_pdb, joblist )
    myResults.get()
示例#2
0
                        print "WARNING:", resnum, "is not present in the pdb"
                        continue
                    else:
                        print "NOT"
                        return False
            outfn_lines += "TER\n" # end of a chain
    outfn_lines += "END\n"

    assert outfn_lines, "nothing is going to be sliced, check your chain definition while selecting residues"

    outfn = pdb_util.get_uniq_outpdbname( pdb, "_sliced")
    buf = open( outfn, "w" )
    buf.write( outfn_lines )
    buf.close()


if __name__=="__main__":
    parser = ArgumentParser()
    parser.add_argument("pdbs", nargs="+", help="")
    parser.add_argument("-r", "--to_slice", nargs="+", required=True,  help="format: 123B-134B 156B-167B")
    parser.add_argument("--n_processors", type=int, default=20, help="numbers of CPUs you are going to use, default=20")
    parser.add_argument("--save_hetatm", action="store_true")
    args = parser.parse_args()

    resnum_to_slice_dict = pdb_util.get_resnum_dict( args.to_slice )
    joblist = [ (pdb, resnum_to_slice_dict, args.save_hetatm) for pdb in args.pdbs ]

    myPool    = Pool( processes = args.n_processors )
    myResults = myPool.map_async( slice_pdb, joblist )
    myResults.get()