If you want to rename multiple chains at once, make a selection like (chain A+B+C). This list selection syntax is documented here: https://pymolwiki.org/index.php/Property_Selectors
cmd.load(pdb) cmd.alter('chain ' + '+'.join(chains_array), 'chain=""') cmd.save('output.pdb') Cheers, Thomas > On Jun 25, 2019, at 4:14 PM, James Starlight <jmsstarli...@gmail.com> wrote: > > thanks so much Thomas, for this example! > > Actually, your python script does exactly what my bash script - > produces number of pdbs for each of the renamed chain. > I would like rather to produce at the end ONE pdb with all chains > renamed to empty chain... > I guess I need to save the result outside of the loop something like this > > ################ hop hey lalaley ##### > from pymol import cmd > pdb = "Ev_complex_model_final.pdb" > chains_array = ["A", "B"] # add more chains in case of more complex pdb > > # loop over chains to rename it > for chain in chains_array: > cmd.load(pdb) > cmd.alter('chain ' + chain, 'chain=""') > cmd.delete('*') > ###################################### > > # save output as pdb > # I need to add something in the name of output indicating how much > chains have been renamed > # like output_withoutAB.pdb > cmd.save('output_' + '.pdb') > > thanks in advance for help! -- Thomas Holder PyMOL Principal Developer Schrödinger, Inc. _______________________________________________ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net Unsubscribe: https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe