Apologies! I've just realised I've overwritten the built in range function
with my variable naming. Fixed below.

def refine_ranges(imol, residue_ranges):
  residues = []
  for residue_range in residue_ranges:
    chain = residue_range[0]
    start = residue_range[1]
    end = residue_range[2]
    for i in range(start, end+1):
      residues.append([chain, i, ""])
  refine_residues(imol, residues)


On Wed, 16 Oct 2019 at 12:57, Paul Bond <[email protected]> wrote:

> Hi Daniel,
>
> Assuming you don't have insertion codes, would a function such as this
> work?
> (there may be typos I haven't checked this by running it)
>
> def refine_ranges(imol, ranges):
>   residues = []
>   for range in ranges:
>     chain = range[0]
>     start = range[1]
>     end = range[2]
>     for i in range(start, end+1):
>       residues.append([chain, i, ""])
>   refine_residues(imol, residues)
>
> Which could be called like this:
>
> refine_ranges(1, [["I", 1, 10], ["I", 100, 110]])
>
> to refine residues 1-10 and 100-110 in chain I of molecule 1.
>
> Kind regards,
> Paul
>
> On Wed, 16 Oct 2019 at 12:40, Daniel Larsson <[email protected]>
> wrote:
>
>> Hi all,
>>
>> Is there an easy way to select multiple ranges for refinement in coot? I
>> have some long-range (in sequence) interactions and want to refine two
>> different regions at the same time (e.g. residues 1-10 and 100-110). One
>> option is to use Sphere Refine, but I want to have more granular control of
>> exactly which residues to include. I found a command in the manual called
>> refine-residues (
>> https://www2.mrc-lmb.cam.ac.uk/personal/pemsley/coot/web/docs/coot.html#Refining-Specific-Residues)
>> which accepts a list of residues. I tried e.g. refine_residues(1,
>> [["I",1,""],["I",3,""]]) to refine residues 1 and 3, but it is too tedious
>> to type each residue separately in a list. Did anyone perhaps implement a
>> custom function to accept a list of ranges?
>>
>> Regards,
>> Daniel
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> När du har kontakt med oss på Uppsala universitet med e-post så innebär
>> det att vi behandlar dina personuppgifter. För att läsa mer om hur vi gör
>> det kan du läsa här: http://www.uu.se/om-uu/dataskydd-personuppgifter/
>>
>> E-mailing Uppsala University means that we will process your personal
>> data. For more information on how this is performed, please read here:
>> http://www.uu.se/en/about-uu/data-protection-policy
>>
>> ########################################################################
>>
>> To unsubscribe from the COOT list, click the following link:
>> https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=COOT&A=1
>>
>

########################################################################

To unsubscribe from the COOT list, click the following link:
https://www.jiscmail.ac.uk/cgi-bin/webadmin?SUBED1=COOT&A=1

Reply via email to