Re: [PyMOL] PDB post-processing and TER records
Awesome, thanks so much Jared for your usefull suggestions! all the best james вт, 25 июн. 2019 г. в 22:00, Jared Sampson : > > Hi James - Glad you got it working. > > > chains_array = ["A", "B"] > > If you want a list of chains without having to hard-code them, try the > `get_chains` command. > > ``` > chains_array = cmd.get_chains() > ``` > > > cmd.load('${pdb}') > > cmd.alter('chain ' + '+'.join(chains_array), 'chain=\"\"') > > Alternatively, if you want to remove all the chain IDs (which it appears you > might), you don't need a list of chains at all, and can just do: > > ``` > alter all, chain='' > ``` > > Hope that helps. > > Cheers, > Jared > > > On June 25, 2019 at 11:48:32 AM, James Starlight (jmsstarli...@gmail.com) > wrote: > > I have got it, it works now! > in my example the double quotes were not escaped in pymol script :-) > > the only (more python-oriented) question, would it be possible to > indicate chains_array for all letters A-Z (e.g. using some python > regex, rather just for A and B, chains_array = ["A", "B"], like in my > example? > > > вт, 25 июн. 2019 г. в 17:22, James Starlight : > > > > I actually tried to do like that still defining chains_array = ["A", > > "B"] inside of pymol script and use external bash loop to loop over > > pdbs > > but it does not works ;( > > > > #!/bin/bash > > # this script rename chains in pdb to "empty" chain > > home=$(pwd) > > pdb_folder=$home/pdbs > > output=$home/output > > rm -r $output > > mkdir $output > > > > #pymol -cQkd " > > for pdb in "${pdb_folder}"/*.pdb ; do > > pdb_name2=$(basename "${pdb}") > > pdb_name="${pdb_name2/pdb}" > > pymol -c -d " > > from pymol import cmd > > chains_array = ["A", "B"] > > 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}/output_without'+"".join(chains_array) + '.pdb') > > " > $output/pymol_${pdb_name}.log > > done > > > > вт, 25 июн. 2019 г. в 16:58, James Starlight : > > > > > > 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 > > > : > > > > > > > > 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 > > > > > 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 ___ 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
Re: [PyMOL] PDB post-processing and TER records
Hi James - Glad you got it working. > chains_array = ["A", "B"] If you want a list of chains without having to hard-code them, try the `get_chains` command. ``` chains_array = cmd.get_chains() ``` > cmd.load('${pdb}') > cmd.alter('chain ' + '+'.join(chains_array), 'chain=\"\"') Alternatively, if you want to remove all the chain IDs (which it appears you might), you don't need a list of chains at all, and can just do: ``` alter all, chain='' ``` Hope that helps. Cheers, Jared On June 25, 2019 at 11:48:32 AM, James Starlight (jmsstarli...@gmail.com) wrote: I have got it, it works now! in my example the double quotes were not escaped in pymol script :-) the only (more python-oriented) question, would it be possible to indicate chains_array for all letters A-Z (e.g. using some python regex, rather just for A and B, chains_array = ["A", "B"], like in my example? вт, 25 июн. 2019 г. в 17:22, James Starlight : > > I actually tried to do like that still defining chains_array = ["A", > "B"] inside of pymol script and use external bash loop to loop over > pdbs > but it does not works ;( > > #!/bin/bash > # this script rename chains in pdb to "empty" chain > home=$(pwd) > pdb_folder=$home/pdbs > output=$home/output > rm -r $output > mkdir $output > > #pymol -cQkd " > for pdb in "${pdb_folder}"/*.pdb ; do > pdb_name2=$(basename "${pdb}") > pdb_name="${pdb_name2/pdb}" > pymol -c -d " > from pymol import cmd > chains_array = ["A", "B"] > 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}/output_without'+"".join(chains_array) + '.pdb') > " > $output/pymol_${pdb_name}.log > done > > вт, 25 июн. 2019 г. в 16:58, James Starlight : > > > > 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 : > > > > > > 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 > > > > 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___ 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
Re: [PyMOL] PDB post-processing and TER records
I have got it, it works now! in my example the double quotes were not escaped in pymol script :-) the only (more python-oriented) question, would it be possible to indicate chains_array for all letters A-Z (e.g. using some python regex, rather just for A and B, chains_array = ["A", "B"], like in my example? вт, 25 июн. 2019 г. в 17:22, James Starlight : > > I actually tried to do like that still defining chains_array = ["A", > "B"] inside of pymol script and use external bash loop to loop over > pdbs > but it does not works ;( > > #!/bin/bash > # this script rename chains in pdb to "empty" chain > home=$(pwd) > pdb_folder=$home/pdbs > output=$home/output > rm -r $output > mkdir $output > > #pymol -cQkd " > for pdb in "${pdb_folder}"/*.pdb ; do > pdb_name2=$(basename "${pdb}") > pdb_name="${pdb_name2/pdb}" > pymol -c -d " > from pymol import cmd > chains_array = ["A", "B"] > 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}/output_without'+"".join(chains_array) + '.pdb') > " > $output/pymol_${pdb_name}.log > done > > вт, 25 июн. 2019 г. в 16:58, James Starlight : > > > > 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 : > > > > > > 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 > > > > 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
Re: [PyMOL] PDB post-processing and TER records
I actually tried to do like that still defining chains_array = ["A", "B"] inside of pymol script and use external bash loop to loop over pdbs but it does not works ;( #!/bin/bash # this script rename chains in pdb to "empty" chain home=$(pwd) pdb_folder=$home/pdbs output=$home/output rm -r $output mkdir $output #pymol -cQkd " for pdb in "${pdb_folder}"/*.pdb ; do pdb_name2=$(basename "${pdb}") pdb_name="${pdb_name2/pdb}" pymol -c -d " from pymol import cmd chains_array = ["A", "B"] 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}/output_without'+"".join(chains_array) + '.pdb') " > $output/pymol_${pdb_name}.log done вт, 25 июн. 2019 г. в 16:58, James Starlight : > > 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 : > > > > 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 > > > 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
Re: [PyMOL] PDB post-processing and TER records
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 : > > 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 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
Re: [PyMOL] PDB post-processing and TER records
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 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
Re: [PyMOL] PDB post-processing and TER records
in python version I have got it # to be run with PyMOL: #pymol -ckqr pymol_cut_off.py cut_off.py # from pymol import cmd pdb = "final.pdb" chains_array = ["A", "B"] # two chains will be cuted for chain in chains_array: cmd.load(pdb) cmd.alter('chain ' + chain, 'chain=""') cmd.set('pdb_use_ter_records', 1) cmd.set('retain_order', 1) cmd.save('output_without'+"".join(chains_array) + '.pdb') now the question would it be possible to do the same but in my bash script? вт, 25 июн. 2019 г. в 16:20, James Starlight : > > OK Lorenzo, thank you ! > > As an alternative question, would it be possible to put that loop > while renaming of the chains in the processed PBD within the bash > loop? > > Here is an idea > > #!/bin/bash > # this script rename chains in pdb to "empty" chain > pdb="my.pdb" > output=$(pwd) > > # chain array is provided in a shell array > chains=('A' 'B') > > # create several pdbs without individual chains > #pymol -cQkd " > pymol -c -d " > # I need to add loop within PYMOL over the elements of external arrays > for chains > # mb for i in chains: > cmd.load('${pdb}') > cmd.alter('(chain $i)', 'chain=\"\"') > cmd.set('pdb_use_ter_records', 1) > cmd.set('retain_order', 1) > # close the loop and save final output as 1 pdb > cmd.save('${output}/output_withoutAB.pdb','all') > " > > вт, 25 июн. 2019 г. в 16:14, James Starlight : > > > > 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! > > > > вт, 25 июн. 2019 г. в 16:03, Thomas Holder : > > > > > > > generally if I integrate a pymol silent script inside my > > > > bash script, I do not need to use cmd.* syntax, right? > > > > > > Correct. The -d argument takes PyMOL commands, like a .pml script. Python > > > syntax is optional. > > > > > > Python syntax (cmd.*) is necessary and most useful if you write a Python > > > script (.py extension) and run that with PyMOL. You could write your > > > multi-chains loop as a Python script: > > > > > > example.py ## > > > from pymol import cmd > > > pdb = "my.pdb" > > > chains_arrays = ["A", "B", "C", "D", "E", "F", "G"] > > > > > > for chain in chains_array: > > > cmd.load(pdb) > > > cmd.alter('chain ' + chain, 'chain=""') > > > cmd.save('output_' + chain + '.pdb') > > > cmd.delete('*') > > > ## > > > > > > Then run it with PyMOL: > > > pymol -ckqr example.py > > > > > > See also: > > > https://pymolwiki.org/index.php/Launching_From_a_Script > > > https://pymolwiki.org/index.php/Python_Integration > > > > > > Cheers, > > > Thomas > > > > > > > On Jun 25, 2019, at 3:08 PM, James Starlight > > > > wrote: > > > > > > > > one extra programming question: > > > > > > > > imagine now in my pdb I have severals chain which I would like to > > > > rename to blank chain. > > > > > > > > I can do it simply like this > > > > # a case for 3 chains to be renamed > > > > > > > > #!/bin/bash > > > > pdb="my.pdb" > > > > output=$(pwd) > > > > pymol -c -d " > > > > cmd.load('${pdb}') > > > > cmd.alter('(chain A)', 'chain=\"\"') > > > > cmd.alter('(chain B)', 'chain=\"\"') > > > > cmd.alter('(chain C)', 'chain=\"\"') > > > > cmd.save('${output}/output.pdb','all') > > > > " > > > > > > > > or for multi-chain protein I can alternatively create external loop, > > > > thus running pymol 3 times iteratively (which is not good realization) > > > > providin array info from external shell session > > > > > > > > # this example save 7 different pdbs renaming one chain in each of them > > > > #!/bin/bash > > > > pdb="my.pdb" > > > > output=$(pwd) > > > > chains_arrays=( A B C D E F G ) > > > > > > > > for i in "$chains_array[@]}"; do > > > > pymol -c -d " > > > > cmd.load('${pdb}') > > > > cmd.alter('(chain $i)', 'chain=\"\"') > > > > cmd.save('${output}/output_$i.pdb','all') > > > > " > > > > done > > > > > > > > would it be possible rather to make an array and loop inside the pymol > > > > to rename all chains into the blank chain during one execution of > > > > pymol? > > > > > > > > Thanks in advance! > > > > > >
Re: [PyMOL] PDB post-processing and TER records
OK Lorenzo, thank you ! As an alternative question, would it be possible to put that loop while renaming of the chains in the processed PBD within the bash loop? Here is an idea #!/bin/bash # this script rename chains in pdb to "empty" chain pdb="my.pdb" output=$(pwd) # chain array is provided in a shell array chains=('A' 'B') # create several pdbs without individual chains #pymol -cQkd " pymol -c -d " # I need to add loop within PYMOL over the elements of external arrays for chains # mb for i in chains: cmd.load('${pdb}') cmd.alter('(chain $i)', 'chain=\"\"') cmd.set('pdb_use_ter_records', 1) cmd.set('retain_order', 1) # close the loop and save final output as 1 pdb cmd.save('${output}/output_withoutAB.pdb','all') " вт, 25 июн. 2019 г. в 16:14, James Starlight : > > 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! > > вт, 25 июн. 2019 г. в 16:03, Thomas Holder : > > > > > generally if I integrate a pymol silent script inside my > > > bash script, I do not need to use cmd.* syntax, right? > > > > Correct. The -d argument takes PyMOL commands, like a .pml script. Python > > syntax is optional. > > > > Python syntax (cmd.*) is necessary and most useful if you write a Python > > script (.py extension) and run that with PyMOL. You could write your > > multi-chains loop as a Python script: > > > > example.py ## > > from pymol import cmd > > pdb = "my.pdb" > > chains_arrays = ["A", "B", "C", "D", "E", "F", "G"] > > > > for chain in chains_array: > > cmd.load(pdb) > > cmd.alter('chain ' + chain, 'chain=""') > > cmd.save('output_' + chain + '.pdb') > > cmd.delete('*') > > ## > > > > Then run it with PyMOL: > > pymol -ckqr example.py > > > > See also: > > https://pymolwiki.org/index.php/Launching_From_a_Script > > https://pymolwiki.org/index.php/Python_Integration > > > > Cheers, > > Thomas > > > > > On Jun 25, 2019, at 3:08 PM, James Starlight > > > wrote: > > > > > > one extra programming question: > > > > > > imagine now in my pdb I have severals chain which I would like to > > > rename to blank chain. > > > > > > I can do it simply like this > > > # a case for 3 chains to be renamed > > > > > > #!/bin/bash > > > pdb="my.pdb" > > > output=$(pwd) > > > pymol -c -d " > > > cmd.load('${pdb}') > > > cmd.alter('(chain A)', 'chain=\"\"') > > > cmd.alter('(chain B)', 'chain=\"\"') > > > cmd.alter('(chain C)', 'chain=\"\"') > > > cmd.save('${output}/output.pdb','all') > > > " > > > > > > or for multi-chain protein I can alternatively create external loop, > > > thus running pymol 3 times iteratively (which is not good realization) > > > providin array info from external shell session > > > > > > # this example save 7 different pdbs renaming one chain in each of them > > > #!/bin/bash > > > pdb="my.pdb" > > > output=$(pwd) > > > chains_arrays=( A B C D E F G ) > > > > > > for i in "$chains_array[@]}"; do > > > pymol -c -d " > > > cmd.load('${pdb}') > > > cmd.alter('(chain $i)', 'chain=\"\"') > > > cmd.save('${output}/output_$i.pdb','all') > > > " > > > done > > > > > > would it be possible rather to make an array and loop inside the pymol > > > to rename all chains into the blank chain during one execution of > > > pymol? > > > > > > Thanks in advance! > > > > > > вт, 25 июн. 2019 г. в 14:50, James Starlight : > > >> > > >> I have got the idea! > > >> thank you so much Thomas! > > >> One question: generally if I integrate a pymol silent script inside my > > >> bash script, I do not need to use cmd.* syntax, right? In what cases > > >> cmd.* sytax might be usefull? > > >> > > >> Thank you again! > > >> > > >> вт, 25 июн. 2019 г. в 12:05, Thomas Holder > > >> : > > >>> > > >>> > > On Jun 25, 2019, at 11:48 AM, James Starlight > > wrote: > > > > so what I need is just to update my pymol, keep using the same command? > > >>> > > >>> Yes > > >>> > > P.S.would the following integration of the code into bash script be > > usefull to remove chains in no gui mode? > > > > pymol -cQkd " > > from pymol import cmd > > fetch $pdb, t
Re: [PyMOL] PDB post-processing and TER records
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! вт, 25 июн. 2019 г. в 16:03, Thomas Holder : > > > generally if I integrate a pymol silent script inside my > > bash script, I do not need to use cmd.* syntax, right? > > Correct. The -d argument takes PyMOL commands, like a .pml script. Python > syntax is optional. > > Python syntax (cmd.*) is necessary and most useful if you write a Python > script (.py extension) and run that with PyMOL. You could write your > multi-chains loop as a Python script: > > example.py ## > from pymol import cmd > pdb = "my.pdb" > chains_arrays = ["A", "B", "C", "D", "E", "F", "G"] > > for chain in chains_array: > cmd.load(pdb) > cmd.alter('chain ' + chain, 'chain=""') > cmd.save('output_' + chain + '.pdb') > cmd.delete('*') > ## > > Then run it with PyMOL: > pymol -ckqr example.py > > See also: > https://pymolwiki.org/index.php/Launching_From_a_Script > https://pymolwiki.org/index.php/Python_Integration > > Cheers, > Thomas > > > On Jun 25, 2019, at 3:08 PM, James Starlight wrote: > > > > one extra programming question: > > > > imagine now in my pdb I have severals chain which I would like to > > rename to blank chain. > > > > I can do it simply like this > > # a case for 3 chains to be renamed > > > > #!/bin/bash > > pdb="my.pdb" > > output=$(pwd) > > pymol -c -d " > > cmd.load('${pdb}') > > cmd.alter('(chain A)', 'chain=\"\"') > > cmd.alter('(chain B)', 'chain=\"\"') > > cmd.alter('(chain C)', 'chain=\"\"') > > cmd.save('${output}/output.pdb','all') > > " > > > > or for multi-chain protein I can alternatively create external loop, > > thus running pymol 3 times iteratively (which is not good realization) > > providin array info from external shell session > > > > # this example save 7 different pdbs renaming one chain in each of them > > #!/bin/bash > > pdb="my.pdb" > > output=$(pwd) > > chains_arrays=( A B C D E F G ) > > > > for i in "$chains_array[@]}"; do > > pymol -c -d " > > cmd.load('${pdb}') > > cmd.alter('(chain $i)', 'chain=\"\"') > > cmd.save('${output}/output_$i.pdb','all') > > " > > done > > > > would it be possible rather to make an array and loop inside the pymol > > to rename all chains into the blank chain during one execution of > > pymol? > > > > Thanks in advance! > > > > вт, 25 июн. 2019 г. в 14:50, James Starlight : > >> > >> I have got the idea! > >> thank you so much Thomas! > >> One question: generally if I integrate a pymol silent script inside my > >> bash script, I do not need to use cmd.* syntax, right? In what cases > >> cmd.* sytax might be usefull? > >> > >> Thank you again! > >> > >> вт, 25 июн. 2019 г. в 12:05, Thomas Holder : > >>> > >>> > On Jun 25, 2019, at 11:48 AM, James Starlight > wrote: > > so what I need is just to update my pymol, keep using the same command? > >>> > >>> Yes > >>> > P.S.would the following integration of the code into bash script be > usefull to remove chains in no gui mode? > > pymol -cQkd " > from pymol import cmd > fetch $pdb, type=pdb, tmp > cmd.alter('(chain A)',chain='') > " > I am not sure whether I used here cmd.alter in correct way .. > >>> > >>> > >>> With fetch, use "async=0" or use Python syntax. And keyword arguments > >>> (type=) must be after positional arguments (tmp). > >>> > >>> It's easier if you don't use Python syntax for alter, otherwise you'll > >>> need three levels of nested quotes, which gets ugly: > >>> > >>> pymol -cQkd " > >>> fetch $pdb, tmp, type=pdb, async=0 > >>> alter (chain A), chain='' > >>> " > >>> > >>> With Python syntax (note the ugly escaping of quotes): > >>> > >>> pymol -cQkd " > >>> cmd.fetch('$pdb', 'tmp', type='pdb') > >>> cmd.alter('(chain A)', 'chain=\"\"') > >>> " > >>> > >>> Cheers, > >>> Thomas > >>> > >>> -- > >>> Thomas Holder > >>> PyMOL Principal Developer > >>> Schrödinger, Inc. > >>> > > -- > Thomas Holder > PyMOL Principal Developer > Schrödinger, Inc. > ___ PyMOL-users mailing list Archives: http://www.mail-archive.com/pymol-users@lists.sourceforg
Re: [PyMOL] PDB post-processing and TER records
Hi James, not sure if it's relevant in this case, but you might also want to use retain_order, to avoid messing up your pdbs. https://pymolwiki.org/index.php/Retain_order Cheers, Lorenzo Il giorno mar 25 giu 2019 alle ore 16:04 Thomas Holder < thomas.hol...@schrodinger.com> ha scritto: > > generally if I integrate a pymol silent script inside my > > bash script, I do not need to use cmd.* syntax, right? > > Correct. The -d argument takes PyMOL commands, like a .pml script. Python > syntax is optional. > > Python syntax (cmd.*) is necessary and most useful if you write a Python > script (.py extension) and run that with PyMOL. You could write your > multi-chains loop as a Python script: > > example.py ## > from pymol import cmd > pdb = "my.pdb" > chains_arrays = ["A", "B", "C", "D", "E", "F", "G"] > > for chain in chains_array: > cmd.load(pdb) > cmd.alter('chain ' + chain, 'chain=""') > cmd.save('output_' + chain + '.pdb') > cmd.delete('*') > ## > > Then run it with PyMOL: > pymol -ckqr example.py > > See also: > https://pymolwiki.org/index.php/Launching_From_a_Script > https://pymolwiki.org/index.php/Python_Integration > > Cheers, > Thomas > > > On Jun 25, 2019, at 3:08 PM, James Starlight > wrote: > > > > one extra programming question: > > > > imagine now in my pdb I have severals chain which I would like to > > rename to blank chain. > > > > I can do it simply like this > > # a case for 3 chains to be renamed > > > > #!/bin/bash > > pdb="my.pdb" > > output=$(pwd) > > pymol -c -d " > > cmd.load('${pdb}') > > cmd.alter('(chain A)', 'chain=\"\"') > > cmd.alter('(chain B)', 'chain=\"\"') > > cmd.alter('(chain C)', 'chain=\"\"') > > cmd.save('${output}/output.pdb','all') > > " > > > > or for multi-chain protein I can alternatively create external loop, > > thus running pymol 3 times iteratively (which is not good realization) > > providin array info from external shell session > > > > # this example save 7 different pdbs renaming one chain in each of them > > #!/bin/bash > > pdb="my.pdb" > > output=$(pwd) > > chains_arrays=( A B C D E F G ) > > > > for i in "$chains_array[@]}"; do > > pymol -c -d " > > cmd.load('${pdb}') > > cmd.alter('(chain $i)', 'chain=\"\"') > > cmd.save('${output}/output_$i.pdb','all') > > " > > done > > > > would it be possible rather to make an array and loop inside the pymol > > to rename all chains into the blank chain during one execution of > > pymol? > > > > Thanks in advance! > > > > вт, 25 июн. 2019 г. в 14:50, James Starlight : > >> > >> I have got the idea! > >> thank you so much Thomas! > >> One question: generally if I integrate a pymol silent script inside my > >> bash script, I do not need to use cmd.* syntax, right? In what cases > >> cmd.* sytax might be usefull? > >> > >> Thank you again! > >> > >> вт, 25 июн. 2019 г. в 12:05, Thomas Holder < > thomas.hol...@schrodinger.com>: > >>> > >>> > On Jun 25, 2019, at 11:48 AM, James Starlight > wrote: > > so what I need is just to update my pymol, keep using the same > command? > >>> > >>> Yes > >>> > P.S.would the following integration of the code into bash script be > usefull to remove chains in no gui mode? > > pymol -cQkd " > from pymol import cmd > fetch $pdb, type=pdb, tmp > cmd.alter('(chain A)',chain='') > " > I am not sure whether I used here cmd.alter in correct way .. > >>> > >>> > >>> With fetch, use "async=0" or use Python syntax. And keyword arguments > (type=) must be after positional arguments (tmp). > >>> > >>> It's easier if you don't use Python syntax for alter, otherwise you'll > need three levels of nested quotes, which gets ugly: > >>> > >>> pymol -cQkd " > >>> fetch $pdb, tmp, type=pdb, async=0 > >>> alter (chain A), chain='' > >>> " > >>> > >>> With Python syntax (note the ugly escaping of quotes): > >>> > >>> pymol -cQkd " > >>> cmd.fetch('$pdb', 'tmp', type='pdb') > >>> cmd.alter('(chain A)', 'chain=\"\"') > >>> " > >>> > >>> Cheers, > >>> Thomas > >>> > >>> -- > >>> Thomas Holder > >>> PyMOL Principal Developer > >>> Schrödinger, Inc. > >>> > > -- > 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 ___ 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
[PyMOL] `selection` argument in load_traj
Dear pymol users, What is the purpose of the `selection` argument in the `load_traj` command? My intuition would say that it allows to somehow select which atoms to load into pymol before the actual loading happens. However, it seems to do nothing whatsoever. What am I missing? Thanks, Lorenzo ___ 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
Re: [PyMOL] PDB post-processing and TER records
> generally if I integrate a pymol silent script inside my > bash script, I do not need to use cmd.* syntax, right? Correct. The -d argument takes PyMOL commands, like a .pml script. Python syntax is optional. Python syntax (cmd.*) is necessary and most useful if you write a Python script (.py extension) and run that with PyMOL. You could write your multi-chains loop as a Python script: example.py ## from pymol import cmd pdb = "my.pdb" chains_arrays = ["A", "B", "C", "D", "E", "F", "G"] for chain in chains_array: cmd.load(pdb) cmd.alter('chain ' + chain, 'chain=""') cmd.save('output_' + chain + '.pdb') cmd.delete('*') ## Then run it with PyMOL: pymol -ckqr example.py See also: https://pymolwiki.org/index.php/Launching_From_a_Script https://pymolwiki.org/index.php/Python_Integration Cheers, Thomas > On Jun 25, 2019, at 3:08 PM, James Starlight wrote: > > one extra programming question: > > imagine now in my pdb I have severals chain which I would like to > rename to blank chain. > > I can do it simply like this > # a case for 3 chains to be renamed > > #!/bin/bash > pdb="my.pdb" > output=$(pwd) > pymol -c -d " > cmd.load('${pdb}') > cmd.alter('(chain A)', 'chain=\"\"') > cmd.alter('(chain B)', 'chain=\"\"') > cmd.alter('(chain C)', 'chain=\"\"') > cmd.save('${output}/output.pdb','all') > " > > or for multi-chain protein I can alternatively create external loop, > thus running pymol 3 times iteratively (which is not good realization) > providin array info from external shell session > > # this example save 7 different pdbs renaming one chain in each of them > #!/bin/bash > pdb="my.pdb" > output=$(pwd) > chains_arrays=( A B C D E F G ) > > for i in "$chains_array[@]}"; do > pymol -c -d " > cmd.load('${pdb}') > cmd.alter('(chain $i)', 'chain=\"\"') > cmd.save('${output}/output_$i.pdb','all') > " > done > > would it be possible rather to make an array and loop inside the pymol > to rename all chains into the blank chain during one execution of > pymol? > > Thanks in advance! > > вт, 25 июн. 2019 г. в 14:50, James Starlight : >> >> I have got the idea! >> thank you so much Thomas! >> One question: generally if I integrate a pymol silent script inside my >> bash script, I do not need to use cmd.* syntax, right? In what cases >> cmd.* sytax might be usefull? >> >> Thank you again! >> >> вт, 25 июн. 2019 г. в 12:05, Thomas Holder : >>> >>> On Jun 25, 2019, at 11:48 AM, James Starlight wrote: so what I need is just to update my pymol, keep using the same command? >>> >>> Yes >>> P.S.would the following integration of the code into bash script be usefull to remove chains in no gui mode? pymol -cQkd " from pymol import cmd fetch $pdb, type=pdb, tmp cmd.alter('(chain A)',chain='') " I am not sure whether I used here cmd.alter in correct way .. >>> >>> >>> With fetch, use "async=0" or use Python syntax. And keyword arguments >>> (type=) must be after positional arguments (tmp). >>> >>> It's easier if you don't use Python syntax for alter, otherwise you'll need >>> three levels of nested quotes, which gets ugly: >>> >>> pymol -cQkd " >>> fetch $pdb, tmp, type=pdb, async=0 >>> alter (chain A), chain='' >>> " >>> >>> With Python syntax (note the ugly escaping of quotes): >>> >>> pymol -cQkd " >>> cmd.fetch('$pdb', 'tmp', type='pdb') >>> cmd.alter('(chain A)', 'chain=\"\"') >>> " >>> >>> Cheers, >>> Thomas >>> >>> -- >>> Thomas Holder >>> PyMOL Principal Developer >>> Schrödinger, Inc. >>> -- 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
Re: [PyMOL] PDB post-processing and TER records
one extra programming question: imagine now in my pdb I have severals chain which I would like to rename to blank chain. I can do it simply like this # a case for 3 chains to be renamed #!/bin/bash pdb="my.pdb" output=$(pwd) pymol -c -d " cmd.load('${pdb}') cmd.alter('(chain A)', 'chain=\"\"') cmd.alter('(chain B)', 'chain=\"\"') cmd.alter('(chain C)', 'chain=\"\"') cmd.save('${output}/output.pdb','all') " or for multi-chain protein I can alternatively create external loop, thus running pymol 3 times iteratively (which is not good realization) providin array info from external shell session # this example save 7 different pdbs renaming one chain in each of them #!/bin/bash pdb="my.pdb" output=$(pwd) chains_arrays=( A B C D E F G ) for i in "$chains_array[@]}"; do pymol -c -d " cmd.load('${pdb}') cmd.alter('(chain $i)', 'chain=\"\"') cmd.save('${output}/output_$i.pdb','all') " done would it be possible rather to make an array and loop inside the pymol to rename all chains into the blank chain during one execution of pymol? Thanks in advance! вт, 25 июн. 2019 г. в 14:50, James Starlight : > > I have got the idea! > thank you so much Thomas! > One question: generally if I integrate a pymol silent script inside my > bash script, I do not need to use cmd.* syntax, right? In what cases > cmd.* sytax might be usefull? > > Thank you again! > > вт, 25 июн. 2019 г. в 12:05, Thomas Holder : > > > > > > > On Jun 25, 2019, at 11:48 AM, James Starlight > > > wrote: > > > > > > so what I need is just to update my pymol, keep using the same command? > > > > Yes > > > > > P.S.would the following integration of the code into bash script be > > > usefull to remove chains in no gui mode? > > > > > > pymol -cQkd " > > > from pymol import cmd > > > fetch $pdb, type=pdb, tmp > > > cmd.alter('(chain A)',chain='') > > > " > > > I am not sure whether I used here cmd.alter in correct way .. > > > > > > With fetch, use "async=0" or use Python syntax. And keyword arguments > > (type=) must be after positional arguments (tmp). > > > > It's easier if you don't use Python syntax for alter, otherwise you'll need > > three levels of nested quotes, which gets ugly: > > > > pymol -cQkd " > > fetch $pdb, tmp, type=pdb, async=0 > > alter (chain A), chain='' > > " > > > > With Python syntax (note the ugly escaping of quotes): > > > > pymol -cQkd " > > cmd.fetch('$pdb', 'tmp', type='pdb') > > cmd.alter('(chain A)', 'chain=\"\"') > > " > > > > Cheers, > > Thomas > > > > -- > > 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
Re: [PyMOL] Thermal ellipsoid plot
Dear Mr. Thomas Holder, Thank you very much for your kind reply. I am very happy to know the scale factor for the 50% probability, but I don't understand well. >From the table, can I take a value the scale? For example, in case of 30% probability, is it ok to set " set sphere_scale, 1.1932"? or not? I am sorry for bothering you again. Best regards, Koji 2019年6月25日(火) 18:49 Thomas Holder : > Hi Koji, > > Interesting question, I wasn't aware of the ellipsoid_probability setting. > > The probability to radius conversion is done with a lookup table, see: > > https://github.com/schrodinger/pymol-open-source/blob/d1359f125d/layer2/RepEllipsoid.cpp#L114 > > To get sphere scaling equivalent of ellipsoid_probability=0.5, you can do: > > set sphere_scale, 1.53820 > > I calculated this value with the following script: > > problevel = [ \ > 0.4299, 0.5479, 0.6334, 0.7035, 0.7644, \ > 0.8192, 0.8694, 0.9162, 0.9605, 1.0026, \ > 1.0430, 1.0821, 1.1200, 1.1570, 1.1932, \ > 1.2288, 1.2638, 1.2985, 1.3330, 1.3672, \ > 1.4013, 1.4354, 1.4695, 1.5037, 1.5382, \ > 1.5729, 1.6080, 1.6436, 1.6797, 1.7164, \ > 1.7540, 1.7924, 1.8318, 1.8724, 1.9144, \ > 1.9580, 2.0034, 2.0510, 2.1012, 2.1544, \ > 2.2114, 2.2730, 2.3404, 2.4153, 2.5003, \ > 2.5997, 2.7216, 2.8829, 3.1365, 6. ] > > iprob = int((cmd.get_setting_float('ellipsoid_probability') + 0.01) * 50 - > 1) > pradius = problevel[iprob] > > cmd.set('sphere_scale', pradius * cmd.get_setting_float('ellipsoid_scale')) > > Hope this helps. > > Cheers, > Thomas > > > > On Jun 24, 2019, at 7:21 AM, koji naka wrote: > > > > Dear all, > > > > The size of isotropic atoms plotted by using "alter all, vdw = > sqrt(b/8)/pi" and "show sphere" looks small compared with the size of > anisotropic atoms displayed by "show ellipsoid" in PyMOL default setting > with 50% probability. > > > > How can I plot the isotropic atoms with 50% probability? > > > > The data is a pdb file converted from a cif through Mercury software. > > > > Thank you very much for your help. > > > > Best regards, > > Koji > > > > > > ___ > > 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 > > -- > 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
Re: [PyMOL] Thermal ellipsoid plot
Hi Koji, Interesting question, I wasn't aware of the ellipsoid_probability setting. The probability to radius conversion is done with a lookup table, see: https://github.com/schrodinger/pymol-open-source/blob/d1359f125d/layer2/RepEllipsoid.cpp#L114 To get sphere scaling equivalent of ellipsoid_probability=0.5, you can do: set sphere_scale, 1.53820 I calculated this value with the following script: problevel = [ \ 0.4299, 0.5479, 0.6334, 0.7035, 0.7644, \ 0.8192, 0.8694, 0.9162, 0.9605, 1.0026, \ 1.0430, 1.0821, 1.1200, 1.1570, 1.1932, \ 1.2288, 1.2638, 1.2985, 1.3330, 1.3672, \ 1.4013, 1.4354, 1.4695, 1.5037, 1.5382, \ 1.5729, 1.6080, 1.6436, 1.6797, 1.7164, \ 1.7540, 1.7924, 1.8318, 1.8724, 1.9144, \ 1.9580, 2.0034, 2.0510, 2.1012, 2.1544, \ 2.2114, 2.2730, 2.3404, 2.4153, 2.5003, \ 2.5997, 2.7216, 2.8829, 3.1365, 6. ] iprob = int((cmd.get_setting_float('ellipsoid_probability') + 0.01) * 50 - 1) pradius = problevel[iprob] cmd.set('sphere_scale', pradius * cmd.get_setting_float('ellipsoid_scale')) Hope this helps. Cheers, Thomas > On Jun 24, 2019, at 7:21 AM, koji naka wrote: > > Dear all, > > The size of isotropic atoms plotted by using "alter all, vdw = sqrt(b/8)/pi" > and "show sphere" looks small compared with the size of anisotropic atoms > displayed by "show ellipsoid" in PyMOL default setting with 50% probability. > > How can I plot the isotropic atoms with 50% probability? > > The data is a pdb file converted from a cif through Mercury software. > > Thank you very much for your help. > > Best regards, > Koji > > > ___ > 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 -- 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
Re: [PyMOL] PDB post-processing and TER records
Hi James, pdb_use_ter_records works in PyMOL 2.3.0, but not in previous versions (was broken and then removed). See https://pymolwiki.org/index.php/pdb_use_ter_records Cheers, Thomas > On Jun 25, 2019, at 10:25 AM, James Starlight wrote: > > Dear Pymol Users! > > I need to process input PDB via pymol (this time no need to do it via > no-gui mode!!) to remove chain id from PDB. > > I am using alter command to do it with the following syntax > #rename chain A to phantom chain :-) > alter (chain A),chain='' > > the problem that in my initial PDBs there are many TER records (e.g. > to separate protein from ligand etc), which should be keeped after > such post-processing in the form of original PDB (with chain A). > > I have tried to do this before saving of the PDB > get pdb_use_ter_records > > however, as the result, all the TER records were removed from the > processed pdb. How I could fix it? > > Many thanks in advance! > > > ___ > 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 -- 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
[PyMOL] PDB post-processing and TER records
Dear Pymol Users! I need to process input PDB via pymol (this time no need to do it via no-gui mode!!) to remove chain id from PDB. I am using alter command to do it with the following syntax #rename chain A to phantom chain :-) alter (chain A),chain='' the problem that in my initial PDBs there are many TER records (e.g. to separate protein from ligand etc), which should be keeped after such post-processing in the form of original PDB (with chain A). I have tried to do this before saving of the PDB get pdb_use_ter_records however, as the result, all the TER records were removed from the processed pdb. How I could fix it? Many thanks in advance! ___ 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
Re: [PyMOL] counting number of standard amino acids in PDB
Thank so much Jared! So here is modified script: #!/bin/bash pdb="./NpXynWT_apo_340K_MD_multi_0434.pdb" LENGTH="$(pymol -cQ -d " from pymol import cmd load ${pdb}, tmp sel = 'tmp and polymer' print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))) ")" echo $LENGTH I guess it's a problem with the -cQ flag because without it your script gives me the full output, while I echoes the variable: PyMOL(TM) Molecular Graphics System, Version 1.7.2.1. Copyright (c) Schrodinger, LLC. All Rights Reserved. Created by Warren L. DeLano, Ph.D. PyMOL is user-supported open-source software. Although some versions are freely available, PyMOL is not in the public domain. If PyMOL is helpful in your work or study, then please volunteer support for our ongoing efforts to create open and affordable scientific software by purchasing a PyMOL Maintenance and/or Support subscription. More information can be found at "http://www.pymol.org";. Enter "help" for a list of commands. Enter "help " for information on a specific command. Hit ESC anytime to toggle between text and graphics. Command mode. No graphics front end. Detected 20 CPU cores. Enabled multithreaded rendering. PyMOL> PyMOL>from pymol import cmd PyMOL>load ./NpXynWT_apo_340K_MD_multi_0434.pdb, tmp CmdLoad: "./NpXynWT_apo_340K_MD_multi_0434.pdb" loaded as "tmp". PyMOL>sel = 'tmp and polymer' PyMOL>print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))) 219 PyMOL: normal program termination. however with -cQ it gives me nothing :-) Hey Blaine, your script is very usefull but it does not work in my case. 1) fetch command gives me an error (which is not the case of "load" probably because I have outdated pymol). 2) I need to load pdbs inside of my shell script, meaning that I am looping a folder by bash routine and use it then with pymol to measure the length of PDB and save it as the variable (in bash!!), which is expected to be used on the next step... james пн, 24 июн. 2019 г. в 18:53, Jared Sampson : > > Hi James - > > Try this, assigning to new variable LENGTH by using -Q flag to suppress other > output, and running in a subshell (untested, and assuming Bash): > > ``` > pdb="./NpXynWT_apo_340K_MD_multi_0434.pdb" > LENGTH=$(pymol -cQ -d " > from pymol import cmd > load ${pdb}, tmp > sel = 'tmp and polymer' > print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))) > ") > ``` > > Hopefully that works, or at least gives you an idea of how it might be done. > > Best, > Jared > > > On June 24, 2019 at 12:08:07 PM, James Starlight (jmsstarli...@gmail.com) > wrote: > > pdb="./NpXynWT_apo_340K_MD_multi_0434.pdb" > pymol -c -d " > from pymol import cmd > load ${pdb}, tmp > sel = 'tmp and polymer' > print(len(set([(i.chain, i.resi, i.resn) for i in cmd.get_model(sel).atom]))) > " ___ 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