コード例 #1
0
def main():
    pdb = parse_PDB(sys.argv[1])
    for name, xyz in zip(['B', 'C', 'X'], [XYZ(7.5, 0, 0), XYZ(0, 7.5, 0), XYZ(7.5, 7.5, 7.5)]):
        new_chain = copy.deepcopy(pdb.chains['A'])
        new_chain.change_chain_name(name)
        new_chain.translate_xyz(xyz)
        pdb.add_chain(new_chain)
        pdb.renumber()
    write_PDB('test.pdb', pdb)
コード例 #2
0
def setup_db(args):
    rost_db = parse_rost_db()
    failed = []
    logger = Logger('./db_setup.log')
    for k, v in rost_db.items():
        # if k != 'q9u6b8': continue
        logger.create_header('working on %s' % k)
        logger.log('seq: %s' % v['seq'])
        logger.log('pdb: %s' % v['pdb'])
        logger.log('chain: %s' % v['chain'])
        logger.log('ts: %s' % v['ts'])
        os.mkdir(k)
        os.chdir(k)

        # get pdb and extract chain
        download_pdb({'name': v['pdb'], 'path': './'})
        empty_pdb = MyPDB(name=v['pdb'])
        pdb = parse_PDB('pdb%s.ent' % v['pdb'])
        chain = pdb.chains[v['chain']]
        empty_pdb.add_chain(chain)
        write_PDB('%s_%s.pdb' % (k, v['chain']), empty_pdb)
        pdb_seq = extract_seq(empty_pdb)
        rdb_seq = AASeq(v['seq'])
        score, start, end = pdb_seq[v['chain']].align(rdb_seq)
        logger.log('pdb seq: %s' % pdb_seq[v['chain']].aligned)
        logger.log('rst seq: %s' % rdb_seq.aligned)

        # get spans and print xml
        spans = find_topo(v['ts'])

        new_spans = []
        for sp in spans:
            start = pdb_seq[v['chain']].aligned_position_at_non_aligned(
                sp[0]) + 1
            end = pdb_seq[v['chain']].aligned_position_at_non_aligned(
                sp[1]) + 1
            logger.log('span %i->%i %s moving to %i->%i' %
                       (sp[0], sp[1], sp[2], start, end))
            new_spans.append([start, end, sp[2]])
        create_AddMembrane_xml(new_spans, '%s_AddMembrane.xml' % v['pdb'])

        # create flags file
        with open('embed.flags', 'w+') as fout:
            fout.write(
                '-parser:protocol /home/labs/fleishman/jonathaw/elazaridis/protocols/embed_in_membrane.xml\n'
            )
            fout.write('-s %s\n' % '%s_%s.pdb' % (k, v['chain']))
            fout.write('-parser:script_vars add_memb_xml=%s\n' %
                       '%s_AddMembrane.xml' % v['pdb'])
            fout.write('-overwrite\n')
            fout.write('-score::elec_memb_sig_die\n')
            fout.write('-corrections::beta_nov15\n')
            fout.write('-score::memb_fa_sol\n')
        os.chdir('../')
コード例 #3
0
def main():
    pdb = parse_PDB(sys.argv[1])
    for name, xyz in zip(
        ['B', 'C', 'X'],
        [XYZ(7.5, 0, 0), XYZ(0, 7.5, 0),
         XYZ(7.5, 7.5, 7.5)]):
        new_chain = copy.deepcopy(pdb.chains['A'])
        new_chain.change_chain_name(name)
        new_chain.translate_xyz(xyz)
        pdb.add_chain(new_chain)
        pdb.renumber()
    write_PDB('test.pdb', pdb)
コード例 #4
0
def setup_db(args):
    rost_db = parse_rost_db()
    failed = []
    logger = Logger('./db_setup.log')
    for k, v in rost_db.items():
        # if k != 'q9u6b8': continue
        logger.create_header('working on %s' % k)
        logger.log('seq: %s' % v['seq'])
        logger.log('pdb: %s' % v['pdb'])
        logger.log('chain: %s' % v['chain'])
        logger.log('ts: %s' % v['ts'])
        os.mkdir(k)
        os.chdir(k)

        # get pdb and extract chain
        download_pdb({'name': v['pdb'], 'path': './'})
        empty_pdb = MyPDB(name=v['pdb'])
        pdb = parse_PDB('pdb%s.ent' % v['pdb'])
        chain = pdb.chains[v['chain']]
        empty_pdb.add_chain(chain)
        write_PDB('%s_%s.pdb' % (k, v['chain']), empty_pdb)
        pdb_seq = extract_seq(empty_pdb)
        rdb_seq = AASeq(v['seq'])
        score, start, end = pdb_seq[v['chain']].align(rdb_seq)
        logger.log('pdb seq: %s' % pdb_seq[v['chain']].aligned)
        logger.log('rst seq: %s' % rdb_seq.aligned)


        # get spans and print xml
        spans = find_topo(v['ts'])

        new_spans = []
        for sp in spans:
            start = pdb_seq[v['chain']].aligned_position_at_non_aligned(sp[0]) + 1
            end = pdb_seq[v['chain']].aligned_position_at_non_aligned(sp[1]) + 1
            logger.log('span %i->%i %s moving to %i->%i' %(sp[0], sp[1], sp[2], start, end))
            new_spans.append([start, end, sp[2]])
        create_AddMembrane_xml(new_spans, '%s_AddMembrane.xml' % v['pdb'])

        # create flags file
        with open('embed.flags', 'w+') as fout:
            fout.write('-parser:protocol /home/labs/fleishman/jonathaw/elazaridis/protocols/embed_in_membrane.xml\n')
            fout.write('-s %s\n' % '%s_%s.pdb' % (k, v['chain']))
            fout.write('-parser:script_vars add_memb_xml=%s\n' % '%s_AddMembrane.xml' % v['pdb'])
            fout.write('-overwrite\n')
            fout.write('-score::elec_memb_sig_die\n')
            fout.write('-corrections::beta_nov15\n')
            fout.write('-score::memb_fa_sol\n')
        os.chdir('../')
コード例 #5
0
def repalce_Bfactor(pdb: MyPDB, resnum_occupancy_dict_: dict, args: dict,
                    new_name: str) -> None:
    resnum_occupancy_dict = {}
    min_ = min(resnum_occupancy_dict_.values())
    max_ = max(resnum_occupancy_dict_.values())
    for k, v in resnum_occupancy_dict_.items():
        resnum_occupancy_dict[k] = (v - min_) / (max_ - min_) * 50.0

    for cid in sorted(pdb.chains.keys()):
        for rid in sorted(pdb[cid].residues.keys()):
            for aid in sorted(pdb[cid][rid].keys()):
                if pdb[cid][rid].res_num in resnum_occupancy_dict.keys():
                    pdb[cid][rid][aid].set_temp(
                        resnum_occupancy_dict[pdb[cid][rid].res_num])
                else:
                    pdb[cid][rid][aid].set_temp(0.0)

    write_PDB(new_name, pdb)
    print('writing the pdb into %s' % new_name)