SHEPHARD 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- shephard/.DS_Store +0 -0
- shephard/__init__.py +31 -0
- shephard/_version.py +1 -0
- shephard/apis/__init__.py +13 -0
- shephard/apis/albatross_api.py +211 -0
- shephard/apis/fasta.py +432 -0
- shephard/apis/metapredict_api.py +373 -0
- shephard/apis/uniprot.py +1899 -0
- shephard/data/README.md +21 -0
- shephard/data/look_and_say.dat +15 -0
- shephard/data/test_data/TS1_domains_idr.tsv +21 -0
- shephard/data/test_data/TS1_domains_idr_and_others.tsv +22 -0
- shephard/data/test_data/TS1_domains_pscore.tsv +2 -0
- shephard/data/test_data/TS1_protein_attributes.tsv +2 -0
- shephard/data/test_data/TS1_protein_attributes_several.tsv +5 -0
- shephard/data/test_data/TS1_sites.tsv +209 -0
- shephard/data/test_data/TS1_small_proteins.tsv +3 -0
- shephard/data/test_data/TS1_tracks_pscore.tsv +9 -0
- shephard/data/test_data/names.txt +9 -0
- shephard/data/test_data/seqs.fasta +98 -0
- shephard/data/test_data/testset_1.fasta +96 -0
- shephard/data/test_data/testset_1.fasta.fai +9 -0
- shephard/data/test_data/testset_1_ptms.tsv +3 -0
- shephard/data/test_data/ts1_bonus_sites.tsv +5 -0
- shephard/data/test_data/ts1_bonus_sites_bad.tsv +6 -0
- shephard/data/test_data/ts1_bonus_sites_bad2.tsv +5 -0
- shephard/domain.py +600 -0
- shephard/exceptions.py +106 -0
- shephard/general_utilities.py +169 -0
- shephard/interfaces/__init__.py +15 -0
- shephard/interfaces/interface_tools.py +350 -0
- shephard/interfaces/si_domains.py +750 -0
- shephard/interfaces/si_protein_attributes.py +431 -0
- shephard/interfaces/si_proteins.py +369 -0
- shephard/interfaces/si_sites.py +495 -0
- shephard/interfaces/si_tracks.py +828 -0
- shephard/protein.py +2409 -0
- shephard/proteome.py +1435 -0
- shephard/py.typed +0 -0
- shephard/sequence_utilities.py +73 -0
- shephard/site.py +602 -0
- shephard/tests/.ipynb_checkpoints/test_scratchpad-checkpoint.ipynb +33 -0
- shephard/tests/__init__.py +13 -0
- shephard/tests/conftest.py +110 -0
- shephard/tests/example_test_function.py +30 -0
- shephard/tests/output_test/all_symbols_test.tsv +2 -0
- shephard/tests/output_test/all_values_test.tsv +9 -0
- shephard/tests/output_test/all_values_test_from_list.tsv +9 -0
- shephard/tests/output_test/out_tracks.tsv +9 -0
- shephard/tests/output_test/readme.md +1 -0
- shephard/tests/output_test/shephard_track_phosres.tsv +1 -0
- shephard/tests/output_test/shephard_track_pscore.tsv +9 -0
- shephard/tests/output_test/test_domains.tsv +27 -0
- shephard/tests/output_test/test_domains_types.tsv +18 -0
- shephard/tests/output_test/test_sites.tsv +773 -0
- shephard/tests/output_test/track_phospho_track.tsv +1 -0
- shephard/tests/output_test/track_random_vals.tsv +1 -0
- shephard/tests/test_DomainInterface.py +33 -0
- shephard/tests/test_ProteinAttributesInterface.py +35 -0
- shephard/tests/test_ProteinInterface.py +27 -0
- shephard/tests/test_SiteInterface.py +36 -0
- shephard/tests/test_TrackInterface.py +46 -0
- shephard/tests/test_add_remove_annotations.py +115 -0
- shephard/tests/test_api_albatross.py +74 -0
- shephard/tests/test_api_metapredict.py +206 -0
- shephard/tests/test_api_uniprot_annotation.py +1066 -0
- shephard/tests/test_api_uniprot_live.py +127 -0
- shephard/tests/test_apis_fasta.py +95 -0
- shephard/tests/test_attribute_tools.py +77 -0
- shephard/tests/test_bugfix_regressions.py +262 -0
- shephard/tests/test_bugfix_regressions_0_2_3.py +428 -0
- shephard/tests/test_comprehensive_apis.py +155 -0
- shephard/tests/test_comprehensive_domain.py +227 -0
- shephard/tests/test_comprehensive_interfaces.py +432 -0
- shephard/tests/test_comprehensive_protein.py +408 -0
- shephard/tests/test_comprehensive_proteome.py +356 -0
- shephard/tests/test_comprehensive_site.py +210 -0
- shephard/tests/test_comprehensive_tools.py +314 -0
- shephard/tests/test_comprehensive_track.py +220 -0
- shephard/tests/test_domain_tools.py +258 -0
- shephard/tests/test_domains.py +254 -0
- shephard/tests/test_interfaces.py +23 -0
- shephard/tests/test_protein.py +298 -0
- shephard/tests/test_protein_site_functions.py +173 -0
- shephard/tests/test_proteome.py +157 -0
- shephard/tests/test_scratchpad.ipynb +455 -0
- shephard/tests/test_sequence_tools.py +45 -0
- shephard/tests/test_shephard.py +18 -0
- shephard/tests/test_si_domains.py +191 -0
- shephard/tests/test_si_sites.py +153 -0
- shephard/tests/test_si_tracks.py +512 -0
- shephard/tests/test_sites.py +42 -0
- shephard/tests/test_track_tools.py +89 -0
- shephard/tests/test_tracks.py +16 -0
- shephard/tools/__init__.py +15 -0
- shephard/tools/attribute_tools.py +99 -0
- shephard/tools/attribute_tools.py~ +94 -0
- shephard/tools/domain_tools.py +587 -0
- shephard/tools/experimental.py +155 -0
- shephard/tools/sequence_tools.py +111 -0
- shephard/tools/site_tools.py +118 -0
- shephard/tools/track_tools.py +126 -0
- shephard/track.py +480 -0
- shephard-0.2.3.dist-info/METADATA +131 -0
- shephard-0.2.3.dist-info/RECORD +108 -0
- shephard-0.2.3.dist-info/WHEEL +5 -0
- shephard-0.2.3.dist-info/licenses/LICENSE +57 -0
- shephard-0.2.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
##
|
|
2
|
+
## API into metapredict
|
|
3
|
+
##
|
|
4
|
+
## For all APIS we do do not make hard dependencies, safe informative
|
|
5
|
+
## import checking should be done.
|
|
6
|
+
##
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import inspect
|
|
10
|
+
|
|
11
|
+
from shephard.exceptions import APIException
|
|
12
|
+
|
|
13
|
+
## Check metapredict is installed. Note we deliberately do NOT run a prediction
|
|
14
|
+
## here - importing this module should be free, so the version check happens
|
|
15
|
+
## lazily the first time one of the API functions is actually called.
|
|
16
|
+
try:
|
|
17
|
+
import metapredict as meta
|
|
18
|
+
|
|
19
|
+
except ModuleNotFoundError:
|
|
20
|
+
meta = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## ------------------------------------------------------------------------
|
|
24
|
+
##
|
|
25
|
+
def _check_metapredict():
|
|
26
|
+
"""
|
|
27
|
+
Internal function that ensures metapredict is installed and is a version
|
|
28
|
+
we can work with. Called at the top of every public function in this
|
|
29
|
+
module.
|
|
30
|
+
|
|
31
|
+
Returns
|
|
32
|
+
-----------------
|
|
33
|
+
None
|
|
34
|
+
No return type, but raises an APIException if metapredict is missing
|
|
35
|
+
or too old.
|
|
36
|
+
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
if meta is None:
|
|
40
|
+
raise APIException('Unable to import metapredict.\nTo use the metapredict API, make sure metapredict is installed. This can be done as follows:\n\npip install metapredict')
|
|
41
|
+
|
|
42
|
+
# metapredict V3 introduced the version keyword, so its absence tells us we
|
|
43
|
+
# are working with an older release
|
|
44
|
+
if 'version' not in inspect.signature(meta.predict_disorder).parameters:
|
|
45
|
+
raise APIException('SHEPHARD requires metapredict V3 or higher. Please upgrade:\n\npip install --upgrade metapredict')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
## ------------------------------------------------------------------------
|
|
49
|
+
##
|
|
50
|
+
def annotate_proteome_with_disorder_track(proteome,
|
|
51
|
+
name='disorder',
|
|
52
|
+
device=None,
|
|
53
|
+
version=3,
|
|
54
|
+
show_progress_bar=True,
|
|
55
|
+
safe=True):
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
Function that annotates a proteome with disorder Tracks
|
|
59
|
+
for every protein.
|
|
60
|
+
|
|
61
|
+
By default, disorder Tracks are named 'disorder', although
|
|
62
|
+
this can be changed by setting the `track_name` parameter.
|
|
63
|
+
|
|
64
|
+
Disorder prediction uses the batch mode in metapredict, which
|
|
65
|
+
leverages parallel predictions automatically on GPUs or CPUs.
|
|
66
|
+
However, if a specific device is requested, this can be passed
|
|
67
|
+
|
|
68
|
+
Parameters
|
|
69
|
+
-----------------
|
|
70
|
+
proteome : shephard.proteome.Proteome
|
|
71
|
+
Proteome object to be annotated.
|
|
72
|
+
|
|
73
|
+
track_name : str
|
|
74
|
+
Name of the Track added to each Protein.
|
|
75
|
+
Default = 'disorder'
|
|
76
|
+
|
|
77
|
+
device : int or str
|
|
78
|
+
Identifier for the device to be used for predictions.
|
|
79
|
+
Possible inputs: 'cpu', 'mps', 'cuda', or an int that corresponds to
|
|
80
|
+
the index of a specific cuda-enabled GPU. If 'cuda' is specified and
|
|
81
|
+
cuda.is_available() returns False, instead of falling back to CPU,
|
|
82
|
+
metapredict will raise an Exception so you know that you are not
|
|
83
|
+
using CUDA as you were expecting.
|
|
84
|
+
Default: None
|
|
85
|
+
When set to None, we will check if there is a cuda-enabled
|
|
86
|
+
GPU. If there is, we will try to use that GPU.
|
|
87
|
+
If you set the value to be an int, we will use cuda:int as the device
|
|
88
|
+
where int is the int you specify. The GPU numbering is 0 indexed, so 0
|
|
89
|
+
corresponds to the first GPU, and so on. Only specify this if you
|
|
90
|
+
know which GPU you want to use.
|
|
91
|
+
* Note: MPS is only supported in Pytorch 2.1 or later.
|
|
92
|
+
MPS is still fairly new, so use it at your own risk.
|
|
93
|
+
|
|
94
|
+
version : int
|
|
95
|
+
Defines the metapredict version to use (must be one of 1, 2
|
|
96
|
+
or 3).
|
|
97
|
+
|
|
98
|
+
show_progress_bar : bool
|
|
99
|
+
Flag which, if set to True, means a progress bar is printed as
|
|
100
|
+
predictions are made, while if False no progress bar is printed.
|
|
101
|
+
Default = True
|
|
102
|
+
|
|
103
|
+
safe : bool
|
|
104
|
+
Flag which, if set to False, means the function overwrites
|
|
105
|
+
existing tracks and domains if present. If True, overwriting
|
|
106
|
+
will trigger an exception.
|
|
107
|
+
Default = True.
|
|
108
|
+
|
|
109
|
+
Returns
|
|
110
|
+
-----------------
|
|
111
|
+
None
|
|
112
|
+
No return type, but the Protein objects in the Proteome
|
|
113
|
+
will be annotated with per-residue disorder Tracks.
|
|
114
|
+
|
|
115
|
+
"""
|
|
116
|
+
_check_metapredict()
|
|
117
|
+
|
|
118
|
+
uid2seq = {}
|
|
119
|
+
for p in proteome:
|
|
120
|
+
uid2seq[p.unique_ID] = p.sequence
|
|
121
|
+
|
|
122
|
+
# batch predict disorder
|
|
123
|
+
D = meta.predict_disorder(uid2seq, device=device, show_progress_bar=show_progress_bar, version=version)
|
|
124
|
+
|
|
125
|
+
for k in uid2seq:
|
|
126
|
+
proteome.protein(k).add_track(name, values=D[k][1], safe=safe)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
## ------------------------------------------------------------------------
|
|
131
|
+
##
|
|
132
|
+
def annotate_proteome_with_disordered_domains(proteome,
|
|
133
|
+
name='IDR',
|
|
134
|
+
disorder_threshold=None,
|
|
135
|
+
annotate_folded_domains=False,
|
|
136
|
+
folded_domain_name = 'FD',
|
|
137
|
+
device=None,
|
|
138
|
+
version=3,
|
|
139
|
+
show_progress_bar=True,
|
|
140
|
+
safe=True):
|
|
141
|
+
"""
|
|
142
|
+
Function that annotates a proteome with disordered
|
|
143
|
+
Domains (IDRs) for every protein.
|
|
144
|
+
|
|
145
|
+
By default, disordered Domains are named as 'IDR's, although
|
|
146
|
+
this can be changed by setting the `name` parameter.
|
|
147
|
+
|
|
148
|
+
In addition, if requested, folded domains can also be annotated
|
|
149
|
+
as those domains which are not IDRs. These folded domains are
|
|
150
|
+
named 'FD's by default, although this can be changed by setting
|
|
151
|
+
the `folded_domain_name` parameter.
|
|
152
|
+
|
|
153
|
+
Disorder prediction uses the batch mode in metapredict, which
|
|
154
|
+
leverages parallel predictions automatically on GPUs or CPUs.
|
|
155
|
+
However, if a specific device is requested this can be passed
|
|
156
|
+
|
|
157
|
+
Parameters
|
|
158
|
+
-----------------
|
|
159
|
+
proteome : shephard.proteome.Proteome
|
|
160
|
+
Proteome object to be annotated.
|
|
161
|
+
|
|
162
|
+
name : str
|
|
163
|
+
Name to give IDR domains.
|
|
164
|
+
|
|
165
|
+
disorder_threshold : float
|
|
166
|
+
Threshold to be used to define IDRs by the metapredict
|
|
167
|
+
domain decomposition algorithm. If set to None (default)
|
|
168
|
+
metapredict uses the threshold appropriate for the version
|
|
169
|
+
being used, which is what we strongly recommend.
|
|
170
|
+
|
|
171
|
+
annotate_folded_domains : bool
|
|
172
|
+
Flag which, if included, means we ALSO annotate
|
|
173
|
+
the regions that are not IDRs as 'FD' (folded
|
|
174
|
+
domains), where the name can be changed using
|
|
175
|
+
the folded_domain_name variable.
|
|
176
|
+
Default = False
|
|
177
|
+
|
|
178
|
+
folded_domain_name : str
|
|
179
|
+
String used to name Folded Domains. Only relevant
|
|
180
|
+
if annotate_folded_domains is set to True.
|
|
181
|
+
Default = 'FD'
|
|
182
|
+
|
|
183
|
+
device : int or str
|
|
184
|
+
Identifier for the device to be used for predictions.
|
|
185
|
+
Possible inputs: 'cpu', 'mps', 'cuda', or an int that corresponds to
|
|
186
|
+
the index of a specific cuda-enabled GPU. If 'cuda' is specified and
|
|
187
|
+
cuda.is_available() returns False, instead of falling back to CPU,
|
|
188
|
+
metapredict will raise an Exception so you know that you are not
|
|
189
|
+
using CUDA as you were expecting.
|
|
190
|
+
Default: None
|
|
191
|
+
When set to None, we will check if there is a cuda-enabled
|
|
192
|
+
GPU. If there is, we will try to use that GPU.
|
|
193
|
+
If you set the value to be an int, we will use cuda:int as the device
|
|
194
|
+
where int is the int you specify. The GPU numbering is 0 indexed, so 0
|
|
195
|
+
corresponds to the first GPU and so on. Only specify this if you
|
|
196
|
+
know which GPU you want to use.
|
|
197
|
+
* Note: MPS is only supported in Pytorch 2.1 or later.
|
|
198
|
+
MPS is still fairly new, so use it at your own risk.
|
|
199
|
+
|
|
200
|
+
version : int
|
|
201
|
+
Defines the metapredict version to use (must be one of 1, 2
|
|
202
|
+
or 3).
|
|
203
|
+
|
|
204
|
+
show_progress_bar : bool
|
|
205
|
+
Flag which, if set to True, means a progress bar is printed as
|
|
206
|
+
predictions are made, while if False no progress bar is printed.
|
|
207
|
+
Default = True
|
|
208
|
+
|
|
209
|
+
safe : bool
|
|
210
|
+
Flag which, if set to False, means the function overwrites
|
|
211
|
+
existing tracks and domains if present. If True, overwriting
|
|
212
|
+
will trigger an exception.
|
|
213
|
+
Default = True.
|
|
214
|
+
|
|
215
|
+
Returns
|
|
216
|
+
-----------------
|
|
217
|
+
None
|
|
218
|
+
No return type, but the Protein objects in the Proteome
|
|
219
|
+
will be annotated with disordered Domain annotations.
|
|
220
|
+
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
_check_metapredict()
|
|
224
|
+
|
|
225
|
+
uid2seq = {}
|
|
226
|
+
for p in proteome:
|
|
227
|
+
uid2seq[p.unique_ID] = p.sequence
|
|
228
|
+
|
|
229
|
+
# batch predict disorder
|
|
230
|
+
D = meta.predict_disorder(uid2seq, device=device, show_progress_bar=show_progress_bar, version=version, return_domains=True, disorder_threshold=disorder_threshold)
|
|
231
|
+
|
|
232
|
+
for k in uid2seq:
|
|
233
|
+
|
|
234
|
+
X = D[k]
|
|
235
|
+
|
|
236
|
+
for boundaries in X.disordered_domain_boundaries:
|
|
237
|
+
proteome.protein(k).add_domain(boundaries[0]+1, boundaries[1], name, safe=safe)
|
|
238
|
+
|
|
239
|
+
if annotate_folded_domains:
|
|
240
|
+
for boundaries in X.folded_domain_boundaries:
|
|
241
|
+
proteome.protein(k).add_domain(boundaries[0]+1, boundaries[1], folded_domain_name, safe=safe)
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
## ------------------------------------------------------------------------
|
|
246
|
+
##
|
|
247
|
+
def annotate_proteome_with_disorder_tracks_and_disordered_domains(proteome,
|
|
248
|
+
track_name='disorder',
|
|
249
|
+
domain_name='IDR',
|
|
250
|
+
disorder_threshold=None,
|
|
251
|
+
annotate_folded_domains=False,
|
|
252
|
+
folded_domain_name = 'FD',
|
|
253
|
+
device=None,
|
|
254
|
+
version=3,
|
|
255
|
+
show_progress_bar=True,
|
|
256
|
+
safe=True):
|
|
257
|
+
"""
|
|
258
|
+
Function that annotates a proteome with disorder Tracks and
|
|
259
|
+
disorder Domains for every protein.
|
|
260
|
+
|
|
261
|
+
By default, disorder Tracks are named 'disoder', although
|
|
262
|
+
this can be changed by setting the `track_name` parameter.
|
|
263
|
+
|
|
264
|
+
By default, disordered Domains are named as 'IDR's, although
|
|
265
|
+
this can be changed by setting the `name` parameter.
|
|
266
|
+
|
|
267
|
+
In addition, if requested, folded domains can also be annotated
|
|
268
|
+
as those domains which are not IDRs. These folded domains are
|
|
269
|
+
named 'FD's by default, although this can be changed by setting
|
|
270
|
+
the `folded_domain_name` parameter.
|
|
271
|
+
|
|
272
|
+
Disorder prediction uses the batch mode in metapredict, which
|
|
273
|
+
leverages parallel predictions automatically on GPUs or CPUs.
|
|
274
|
+
However, if a specific device is requested this can be passed
|
|
275
|
+
|
|
276
|
+
Parameters
|
|
277
|
+
-----------------
|
|
278
|
+
proteome : shephard.proteome.Proteome
|
|
279
|
+
Proteome object to be annotated.
|
|
280
|
+
|
|
281
|
+
track_name : str
|
|
282
|
+
Name of the Track added to each Protein.
|
|
283
|
+
Default = 'disorder'
|
|
284
|
+
|
|
285
|
+
domain_name : str
|
|
286
|
+
Name of the Domain added to each Protein.
|
|
287
|
+
Default = 'IDR'
|
|
288
|
+
|
|
289
|
+
disorder_threshold : float
|
|
290
|
+
Threshold to be used to define IDRs by the metapredict
|
|
291
|
+
domain decomposition algorithm. If set to None (default)
|
|
292
|
+
metapredict uses the threshold appropriate for the version
|
|
293
|
+
being used, which is what we strongly recommend.
|
|
294
|
+
|
|
295
|
+
annotate_folded_domains : bool
|
|
296
|
+
Flag which, if included, means we ALSO annotate
|
|
297
|
+
the regions that are not IDRs as 'FD' (folded
|
|
298
|
+
domains), where the name can be changed using
|
|
299
|
+
the folded_domain_name variable.
|
|
300
|
+
Default = False
|
|
301
|
+
|
|
302
|
+
folded_domain_name : str
|
|
303
|
+
String used to name Folded Domains. Only relevant
|
|
304
|
+
if annotate_folded_domains is set to True.
|
|
305
|
+
Default = 'FD'
|
|
306
|
+
|
|
307
|
+
device : int or str
|
|
308
|
+
Identifier for the device to be used for predictions.
|
|
309
|
+
Possible inputs: 'cpu', 'mps', 'cuda', or an int that corresponds to
|
|
310
|
+
the index of a specific cuda-enabled GPU. If 'cuda' is specified and
|
|
311
|
+
cuda.is_available() returns False, instead of falling back to CPU,
|
|
312
|
+
metapredict will raise an Exception so you know that you are not
|
|
313
|
+
using CUDA as you were expecting.
|
|
314
|
+
Default: None
|
|
315
|
+
When set to None, we will check if there is a cuda-enabled
|
|
316
|
+
GPU. If there is, we will try to use that GPU.
|
|
317
|
+
If you set the value to be an int, we will use cuda:int as the device
|
|
318
|
+
where int is the int you specify. The GPU numbering is 0 indexed, so 0
|
|
319
|
+
corresponds to the first GPU and so on. Only specify this if you
|
|
320
|
+
know which GPU you want to use.
|
|
321
|
+
* Note: MPS is only supported in Pytorch 2.1 or later.
|
|
322
|
+
MPS is still fairly new, so use it at your own risk.
|
|
323
|
+
|
|
324
|
+
version : int
|
|
325
|
+
Defines the metapredict version to use (must be one of 1, 2
|
|
326
|
+
or 3).
|
|
327
|
+
|
|
328
|
+
show_progress_bar : bool
|
|
329
|
+
Flag which, if set to True, means a progress bar is printed as
|
|
330
|
+
predictions are made, while if False no progress bar is printed.
|
|
331
|
+
Default = True
|
|
332
|
+
|
|
333
|
+
safe : bool
|
|
334
|
+
Flag which, if set to False, means the function overwrites
|
|
335
|
+
existing tracks and domains if present. If True, overwriting
|
|
336
|
+
will trigger an exception.
|
|
337
|
+
Default = True.
|
|
338
|
+
|
|
339
|
+
Returns
|
|
340
|
+
-----------------
|
|
341
|
+
None
|
|
342
|
+
No return type, but the Protein objects in the Proteome
|
|
343
|
+
will be annotated with per-residue disorder Tracks and
|
|
344
|
+
disordered Domain annotations.
|
|
345
|
+
|
|
346
|
+
"""
|
|
347
|
+
|
|
348
|
+
_check_metapredict()
|
|
349
|
+
|
|
350
|
+
uid2seq = {}
|
|
351
|
+
for p in proteome:
|
|
352
|
+
uid2seq[p.unique_ID] = p.sequence
|
|
353
|
+
|
|
354
|
+
# batch predict disorder annotations/scores
|
|
355
|
+
D = meta.predict_disorder(uid2seq, device=device, show_progress_bar=show_progress_bar, version=version, return_domains=True, disorder_threshold=disorder_threshold)
|
|
356
|
+
|
|
357
|
+
# for each unique ID
|
|
358
|
+
for k in uid2seq:
|
|
359
|
+
|
|
360
|
+
# X = DisorderObject
|
|
361
|
+
X = D[k]
|
|
362
|
+
|
|
363
|
+
# cycle through IDR boundaries
|
|
364
|
+
for boundaries in X.disordered_domain_boundaries:
|
|
365
|
+
proteome.protein(k).add_domain(boundaries[0]+1, boundaries[1], domain_name, safe=safe)
|
|
366
|
+
|
|
367
|
+
if annotate_folded_domains:
|
|
368
|
+
for boundaries in X.folded_domain_boundaries:
|
|
369
|
+
proteome.protein(k).add_domain(boundaries[0]+1, boundaries[1], folded_domain_name, safe=safe)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
proteome.protein(k).add_track(track_name, values=X.disorder, safe=safe)
|
|
373
|
+
|