|
8 | 8 |
|
9 | 9 | PARAMS:
|
10 | 10 | needle (string)
|
11 |
| - the sequence of amino acids to match and select |
12 |
| - in the haystack. This can be a sequence of amino |
13 |
| - acids, or a string-style regular expression. See |
14 |
| - examples. |
| 11 | + the sequence of amino acids to match and select |
| 12 | + in the haystack. This can be a sequence of amino |
| 13 | + acids, or a string-style regular expression. See |
| 14 | + examples. |
15 | 15 |
|
16 |
| -hastack (string or PyMOL selection) |
17 |
| - name of the PyMOL object/selection in which |
18 |
| - to find the needle. |
| 16 | +haystack (string or PyMOL selection) |
| 17 | + name of the PyMOL object/selection in which |
| 18 | + to find the needle. |
19 | 19 |
|
20 | 20 | selName (string; defaults to None)
|
21 |
| - This is the name of the selection to return. If selName |
22 |
| - is left blank (None), then the selection name will be |
23 |
| - foundSeqXYZ where XYZ is some random number; if selName is |
24 |
| - "sele" the usual PyMOL "(sele)" will be used; and, lastly, |
25 |
| - if selName is anything else, that name will be used verbatim. |
| 21 | + This is the name of the selection to return. If selName |
| 22 | + is left blank (None), then the selection name will be |
| 23 | + foundSeqXYZ where XYZ is some random number; if selName is |
| 24 | + "sele" the usual PyMOL "(sele)" will be used; and, lastly, |
| 25 | + if selName is anything else, that name will be used verbatim. |
26 | 26 |
|
27 | 27 | het (0 or 1; defaults to 0)
|
28 |
| - This boolean flag allows (1) or disallows (0) heteroatoms |
29 |
| - from being considered. |
| 28 | + This boolean flag allows (1) or disallows (0) heteroatoms |
| 29 | + from being considered. |
30 | 30 |
|
31 | 31 | firstOnly (0 or 1; defaults to 0)
|
32 |
| - Subsequences or motifs might be repeated, this controls how we |
33 |
| - consider multiple matches. If firstOnly is False (0) then we return |
34 |
| - all found subsequences; if firstOnly is True (1), then we just return |
35 |
| - the first found sequence. |
| 32 | + Subsequences or motifs might be repeated, this controls how we |
| 33 | + consider multiple matches. If firstOnly is False (0) then we return |
| 34 | + all found subsequences; if firstOnly is True (1), then we just return |
| 35 | + the first found sequence. |
36 | 36 |
|
37 | 37 | RETURNS:
|
38 | 38 | a newly created selection with the atoms you sought. If there are
|
@@ -358,10 +358,14 @@ def findseq(needle, haystack, selName=None, het=0, firstOnly=0):
|
358 | 358 | i_chains = chains[start:stop]
|
359 | 359 | # are all residues from one chain?
|
360 | 360 | if len(set(i_chains)) != 1:
|
361 |
| - # now they are not, this match is not really a match, skip it |
362 |
| - continue |
| 361 | + # now they are not, this match is not really a match, skip it |
| 362 | + continue |
363 | 363 | chain = i_chains[0]
|
364 |
| - cmd.select(rSelName, rSelName + " or (__h and i. " + str(IDs[start]) + "-" + str(IDs[stop - 1]) + " and c. " + chain + " )") |
| 364 | + # Only apply chains to selection algebra if there are defined chains. |
| 365 | + if chain: |
| 366 | + cmd.select(rSelName, rSelName + " or (__h and i. " + str(IDs[start]) + "-" + str(IDs[stop - 1]) + " and c. " + chain + " )") |
| 367 | + else: |
| 368 | + cmd.select(rSelName, rSelName + " or (__h and i. " + str(IDs[start]) + "-" + str(IDs[stop - 1]) + ")") |
365 | 369 | if int(firstOnly):
|
366 | 370 | break
|
367 | 371 | cmd.delete("__h")
|
|
0 commit comments