
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> Sent: Friday, June 9, 2023 9:08 PM To: ChimeraX Users Help <chimerax-users@cgl.ucsf.edu> Cc: Dominik Sordyl <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