1
$\begingroup$

We can use

color yellow, resi 3
color yellow, resi 3-8

to colour one residue or a range of residues. But what if I want to colour residue 3-8 and 10-20, how to write it?

Also, my protein has two chains, light chain (L) with 100 residues and heavy chain (H) with 100 residues. How to colour the residue 10-20, 30-40 of light chain, and the residue 5-10, 20-30 of heavy chain in one go?

$\endgroup$
7
  • $\begingroup$ What you’ve written isn’t valid Python code. Is this in Pymol or similar? $\endgroup$ Commented Nov 15, 2017 at 18:21
  • $\begingroup$ @KonradRudolph it is Pymol code (you can use python with pymol but in the GUI you can type pymol code) $\endgroup$
    – Mitra
    Commented Nov 15, 2017 at 18:28
  • $\begingroup$ I don't think that python is an appropriate tag for this post. This really isn't a bioinformatics question. $\endgroup$
    – Bioathlete
    Commented Nov 15, 2017 at 23:57
  • $\begingroup$ there is no tag called "pymol", and where else would you recommend? $\endgroup$
    – lanselibai
    Commented Nov 16, 2017 at 10:01
  • 2
    $\begingroup$ of course each software may have its own mailing list, like I use Gromacs as well. But we should still be able to ask questions here @Mitra thank you for changing it to tag pymol. I thought I do not have the authority as a newbie. $\endgroup$
    – lanselibai
    Commented Nov 16, 2017 at 18:28

1 Answer 1

3
$\begingroup$

Note: as I don't have any working version of pymol at the moment, I am not able to test the solution properly.
However, an easy way is to first create a selection, and then to color it:

select toBecolored, resi 3-8
color yellow, toBecolored

Regarding the L/H chain part, if they are effectively annotated as L and H, something like the following should work:

select toBeColored, ((i. 10-20 or i. 30-40) and c. L ) or ((i. 5-10+20-30) and c. H)
color yellow, toBeColored

Combining both commands is probably possible as:

color yellow, ((i. 10-20 or i. 30-40) and c. L ) or ((i. 5-10+20-30) and c. H)

Pymol allows synonyms (eg. resi and i. or chain and c.).

The following pages may be also helpful:

And the two following links, if you want to get a bit deeper in proper programming with python for pymol (as they can provide you with inspiration):

$\endgroup$
1
  • 1
    $\begingroup$ @Llopis: Thank you for the edit! It's a lot clearer now :) $\endgroup$
    – Mitra
    Commented Nov 16, 2017 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.