def extract_acc(pdb_id): atoms = prody.performDSSP(pdb_id) map_atom_group(atoms) uid2acc = {} for uid, uresnum, acc in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getData('dssp_acc')): if uid is None: continue if uid not in uid2acc: uid2acc[uid] = [] if uresnum-1 >= len(uid2acc[uid]): uid2acc[uid] += [-1]*(uresnum-len(uid2acc[uid])) uid2acc[uid][uresnum-1] = acc return uid2acc
def extract_secondary_structures(pdb_id, uid2data): atoms = prody.performDSSP(pdb_id) map_atom_group(atoms) uid2structure = {} for uid in uid2data: uid2structure[uid] = ["_"] * len(uid2data[uid]['sequence']) for uid, uresnum, secstr in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getSecstrs()): if uid is None: continue if secstr == "": secstr = "-" uid2structure[uid][uresnum-1] = secstr uid2structure = dict((uid, "".join(seq)) for uid, seq in uid2structure.iteritems()) return uid2structure
def extract_acc(pdb_id): atoms = prody.performDSSP(pdb_id) map_atom_group(atoms) uid2acc = {} for uid, uresnum, acc in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getData('dssp_acc')): if uid is None: continue if uid not in uid2acc: uid2acc[uid] = [] if uresnum - 1 >= len(uid2acc[uid]): uid2acc[uid] += [-1] * (uresnum - len(uid2acc[uid])) uid2acc[uid][uresnum - 1] = acc return uid2acc
def extract_secondary_structures(pdb_id, uid2data): atoms = prody.performDSSP(pdb_id) map_atom_group(atoms) uid2structure = {} for uid in uid2data: uid2structure[uid] = ["_"] * len(uid2data[uid]['sequence']) for uid, uresnum, secstr in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getSecstrs()): if uid is None: continue if secstr == "": secstr = "-" uid2structure[uid][uresnum - 1] = secstr uid2structure = dict( (uid, "".join(seq)) for uid, seq in uid2structure.iteritems()) return uid2structure
atoms = prody.performDSSP(pdb_id) map_atom_group(atoms) uid2acc = {} for uid, uresnum, acc in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getData('dssp_acc')): if uid is None: continue if uid not in uid2acc: uid2acc[uid] = [] if uresnum-1 >= len(uid2acc[uid]): uid2acc[uid] += [-1]*(uresnum-len(uid2acc[uid])) uid2acc[uid][uresnum-1] = acc return uid2acc if __name__ == "__main__": atoms = prody.performDSSP('104l') uids, uresnums = map_atom_group(atoms) for res in atoms.iterResidues(): print(res.getResname(), res.getData('uids')[0], res.getData('uresnums')[0], res.getSecstrs()[0]) structures = extract_secondary_structures('104l') print(structures)
uid2acc = {} for uid, uresnum, acc in izip(atoms.getData('uids'), atoms.getData('uresnums'), atoms.getData('dssp_acc')): if uid is None: continue if uid not in uid2acc: uid2acc[uid] = [] if uresnum - 1 >= len(uid2acc[uid]): uid2acc[uid] += [-1] * (uresnum - len(uid2acc[uid])) uid2acc[uid][uresnum - 1] = acc return uid2acc if __name__ == "__main__": atoms = prody.performDSSP('104l') uids, uresnums = map_atom_group(atoms) for res in atoms.iterResidues(): print(res.getResname(), res.getData('uids')[0], res.getData('uresnums')[0], res.getSecstrs()[0]) structures = extract_secondary_structures('104l') print(structures)