yes, actually it is better because we avoid looping! and how it would be possible to use array provided in the externall shell?
#!/bin/bash pdb="final.pdb" output=$(pwd) # array given in bash chains_array=('A' 'B') # chains are cutted by pymol pymol -c -d " cmd.load('${pdb}') cmd.alter('chain ' + '+'.join($chains_array), 'chain=\"\"') cmd.set('pdb_use_ter_records', 1) cmd.set('retain_order', 1) cmd.save('output_without'+"".join($chains_array) + '.pdb') " вт, 25 июн. 2019 г. в 16:47, Thomas Holder <thomas.hol...@schrodinger.com>: > > 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