
Hi Dominik, Glad you got things working. If you know which "bonds" actually should be missing-structure pseudobonds, you can sidestep connect_structure() and create them yourself with: pbg = structure.pseudobond_group(structure.PBG_MISSING_STRUCTURE) pbg.new_pseudobond(atom1, atom2) --Eric
On Jun 13, 2023, at 1:07 AM, Dominik Sordyl via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Hi Eric, Thanks a lot for your help. connect_structure() worked. It produced some mess in the bonds but after calling it, deleting bonds created by it and later creating my bonds, it worked.
Wish you all the best, Dominik From: Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> Sent: Monday, June 12, 2023 11:59 PM To: Dominik Sordyl <dsordyl@iimcb.gov.pl <mailto:dsordyl@iimcb.gov.pl>> Cc: ChimeraX Users Help <chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu>> Subject: Re: [chimerax-users] No chains in AtomicStructure
Hi Dominik, If some of the “bonds” in your structure are not in fact covalent bonds but instead represent the fact that those atoms “connect” through other atoms/bonds that are missing, then you need to use a “missing structure” pseudobond to represent that rather than a normal covalent bond. Try this: don’t add any bonds to the structure yourself, but after you’ve created all the atoms and residues, call structure.connect_structure(). Are there any polymers/chains after you do that? Color by chain probably works because it uses chain IDs, whereas rainbow fails because it iterates through the residues of chains.
—Eric
On Jun 12, 2023, at 3:15 AM, Dominik Sordyl via ChimeraX-users <chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu>> wrote:
Hi Eric, Thanks, for your advices. Yes, I have created bonds between atoms. But one thing that I did not mention was that it is a coarse-grained representation containing only some heavy atoms of each residue. I think I am putting the residues in the right order. Unfortunately I still cannot get chains. structure.polymers() returns an empty list. structure.bonded_group() returns a list of all atoms in the structure
I don't know if I can show you the whole code but this is the part I am using for creating a structure: s = AtomicStructure(session, name=file_name, auto_style=True) from chimerax.atomic.struct_edit import add_atom from chimerax.atomic.struct_edit import add_bond last_residue_id = 0
for i, v in enumerate(res_atom_set): coord_id = 0 for x in range(len(v)): atom_num = list(v.values())[x] #number of atoms in each residue new_r = s.new_residue(pdb_residues[last_residue_id],chains[last_residue_id], x) #adds new residue - of name pdb_residues[x], as a part of chain chain[chain_id], position x in chain last_residue_id += 1 for _ in range(atom_num): # iterate the 'number of atoms in residue' times add_atom(pdb_atoms.pop(0), pdb_elements.pop(0), new_r,np.array(coords[0][coord_id])) #adds atoms to the residues coord_id += 1
#Create bonds if "LIGAND" in molecule_type_lookup_dict.values(): for x in pdb.pdb_connect: s.new_bond(s.atoms[x[0]], s.atoms[x[1]]) else: for x in bonds: s.new_bond(s.atoms[x[0]], s.atoms[x[1]])
s.add_coordsets(np.array(coords), replace=True) coordset_slider(session, [s], pause_frames=speed)
return [s], ""
"res_atom_set" is a dictionary {residue_id: num of atoms} "pdb_residues" is a list with residues' names - earlier obtained from pdb "chains" is a list of length of number of residues, which contains chain for every residue "[A, A, A, A, B, B, B, B]"
Most of the features work - it is displayed correctly, the trajectory can be "played" and so on. But actually just now I noticed that when I print(len(s.chains)) it return 0, but color bychain works fine somehow. And if this coloring option works, then why rainbow is not?
Best, Dominik From: Eric Pettersen <pett@cgl.ucsf.edu <mailto:pett@cgl.ucsf.edu>> Sent: Friday, June 9, 2023 9:08 PM To: ChimeraX Users Help <chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu>> Cc: Dominik Sordyl <dsordyl@iimcb.gov.pl <mailto:dsordyl@iimcb.gov.pl>> Subject: Re: [chimerax-users] No chains in AtomicStructure
On Jun 9, 2023, at 12:01 PM, Eric Pettersen via ChimeraX-users <chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu>> wrote:
use the insert/precedes keyword
Should just be the "precedes" keyword. "Insert" is for specifying an insertion code.
--Eric _______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu> To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu <mailto:chimerax-users-leave@cgl.ucsf.edu> Manage subscription:
_______________________________________________ ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu <mailto:chimerax-users@cgl.ucsf.edu> To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu <mailto:chimerax-users-leave@cgl.ucsf.edu> Manage subscription: