encode-toolkit 0.3.0__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.
- encode_connector/__init__.py +4 -0
- encode_connector/__main__.py +5 -0
- encode_connector/client/__init__.py +6 -0
- encode_connector/client/auth.py +262 -0
- encode_connector/client/constants.py +450 -0
- encode_connector/client/downloader.py +305 -0
- encode_connector/client/encode_client.py +586 -0
- encode_connector/client/models.py +367 -0
- encode_connector/client/tracker.py +1129 -0
- encode_connector/client/validation.py +226 -0
- encode_connector/server/__init__.py +1 -0
- encode_connector/server/__main__.py +5 -0
- encode_connector/server/main.py +1544 -0
- encode_toolkit-0.3.0.dist-info/METADATA +843 -0
- encode_toolkit-0.3.0.dist-info/RECORD +18 -0
- encode_toolkit-0.3.0.dist-info/WHEEL +4 -0
- encode_toolkit-0.3.0.dist-info/entry_points.txt +2 -0
- encode_toolkit-0.3.0.dist-info/licenses/LICENSE +661 -0
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
"""ENCODE API constants, endpoints, and known filter values."""
|
|
2
|
+
|
|
3
|
+
BASE_URL = "https://www.encodeproject.org"
|
|
4
|
+
SEARCH_ENDPOINT = "/search/"
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
# Rate limiting
|
|
8
|
+
MAX_REQUESTS_PER_SECOND = 10
|
|
9
|
+
DOWNLOAD_CONCURRENCY = 3
|
|
10
|
+
|
|
11
|
+
# Request defaults
|
|
12
|
+
DEFAULT_TIMEOUT = 30.0
|
|
13
|
+
DOWNLOAD_TIMEOUT = 300.0
|
|
14
|
+
DEFAULT_LIMIT = 25
|
|
15
|
+
try:
|
|
16
|
+
import importlib.metadata
|
|
17
|
+
|
|
18
|
+
_version = importlib.metadata.version("encode-toolkit")
|
|
19
|
+
except importlib.metadata.PackageNotFoundError:
|
|
20
|
+
_version = "0.3.0"
|
|
21
|
+
USER_AGENT = f"encode-toolkit/{_version} (MCP; +https://github.com/ammawla/encode-toolkit)"
|
|
22
|
+
|
|
23
|
+
# Keyring service name for credential storage
|
|
24
|
+
KEYRING_SERVICE = "encode-connector"
|
|
25
|
+
KEYRING_ACCESS_KEY = "access_key"
|
|
26
|
+
KEYRING_SECRET_KEY = "secret_key"
|
|
27
|
+
|
|
28
|
+
# -------------------------------------------------------------------
|
|
29
|
+
# Known ENCODE filter values (for metadata/autocomplete)
|
|
30
|
+
# -------------------------------------------------------------------
|
|
31
|
+
|
|
32
|
+
ASSAY_TITLES = [
|
|
33
|
+
# ChIP-seq family
|
|
34
|
+
"Histone ChIP-seq",
|
|
35
|
+
"TF ChIP-seq",
|
|
36
|
+
"Control ChIP-seq",
|
|
37
|
+
"Mint-ChIP-seq",
|
|
38
|
+
"Control Mint-ChIP-seq",
|
|
39
|
+
# Accessibility
|
|
40
|
+
"ATAC-seq",
|
|
41
|
+
"DNase-seq",
|
|
42
|
+
"GM DNase-seq",
|
|
43
|
+
"FAIRE-seq",
|
|
44
|
+
"MNase-seq",
|
|
45
|
+
"snATAC-seq",
|
|
46
|
+
# RNA-seq family
|
|
47
|
+
"total RNA-seq",
|
|
48
|
+
"polyA plus RNA-seq",
|
|
49
|
+
"polyA minus RNA-seq",
|
|
50
|
+
"small RNA-seq",
|
|
51
|
+
"long read RNA-seq",
|
|
52
|
+
"microRNA-seq",
|
|
53
|
+
"microRNA counts",
|
|
54
|
+
"shRNA RNA-seq",
|
|
55
|
+
"siRNA RNA-seq",
|
|
56
|
+
"CRISPR RNA-seq",
|
|
57
|
+
"CRISPRi RNA-seq",
|
|
58
|
+
# Single-cell
|
|
59
|
+
"scRNA-seq",
|
|
60
|
+
"long read scRNA-seq",
|
|
61
|
+
"snRNA-seq",
|
|
62
|
+
# Transcription / TSS
|
|
63
|
+
"CAGE",
|
|
64
|
+
"RAMPAGE",
|
|
65
|
+
"PRO-seq",
|
|
66
|
+
"PRO-cap",
|
|
67
|
+
"GRO-seq",
|
|
68
|
+
"GRO-cap",
|
|
69
|
+
"PAS-seq",
|
|
70
|
+
"Bru-seq",
|
|
71
|
+
"BruChase-seq",
|
|
72
|
+
"BruUV-seq",
|
|
73
|
+
# Methylation
|
|
74
|
+
"WGBS",
|
|
75
|
+
"RRBS",
|
|
76
|
+
"MeDIP-seq",
|
|
77
|
+
"MRE-seq",
|
|
78
|
+
"TAB-seq",
|
|
79
|
+
"DNAme array",
|
|
80
|
+
# 3D genome
|
|
81
|
+
"Hi-C",
|
|
82
|
+
"intact Hi-C",
|
|
83
|
+
"in situ Hi-C",
|
|
84
|
+
"dilution Hi-C",
|
|
85
|
+
"capture Hi-C",
|
|
86
|
+
"Micro-C",
|
|
87
|
+
"ChIA-PET",
|
|
88
|
+
"HiChIP",
|
|
89
|
+
"PLAC-seq",
|
|
90
|
+
"SPRITE",
|
|
91
|
+
"5C",
|
|
92
|
+
# CUT&RUN / CUT&Tag
|
|
93
|
+
"CUT&RUN",
|
|
94
|
+
"CUT&Tag",
|
|
95
|
+
# CLIP family
|
|
96
|
+
"eCLIP",
|
|
97
|
+
"Control eCLIP",
|
|
98
|
+
"iCLIP",
|
|
99
|
+
"RIP-seq",
|
|
100
|
+
"RIP-chip",
|
|
101
|
+
"RNA Bind-n-Seq",
|
|
102
|
+
# Functional screens
|
|
103
|
+
"STARR-seq",
|
|
104
|
+
"MPRA",
|
|
105
|
+
"CRISPR screen",
|
|
106
|
+
"proliferation CRISPR screen",
|
|
107
|
+
"FlowFISH CRISPR screen",
|
|
108
|
+
# Genotyping / Sequencing
|
|
109
|
+
"WGS",
|
|
110
|
+
"genotyping array",
|
|
111
|
+
"RNA microarray",
|
|
112
|
+
# Replication
|
|
113
|
+
"Repli-seq",
|
|
114
|
+
"Repli-chip",
|
|
115
|
+
# Other assays
|
|
116
|
+
"Switchgear",
|
|
117
|
+
"MS-MS",
|
|
118
|
+
"RNA-PET",
|
|
119
|
+
"DNA-PET",
|
|
120
|
+
"icSHAPE",
|
|
121
|
+
"icLASER",
|
|
122
|
+
"seqFISH",
|
|
123
|
+
"Circulome-seq",
|
|
124
|
+
"5' RLM RACE",
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
ORGANISMS = [
|
|
128
|
+
"Homo sapiens",
|
|
129
|
+
"Mus musculus",
|
|
130
|
+
"Drosophila melanogaster",
|
|
131
|
+
"Caenorhabditis elegans",
|
|
132
|
+
"Saccharomyces cerevisiae",
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
BIOSAMPLE_CLASSIFICATIONS = [
|
|
136
|
+
"cell line",
|
|
137
|
+
"tissue",
|
|
138
|
+
"primary cell",
|
|
139
|
+
"whole organisms",
|
|
140
|
+
"in vitro differentiated cells",
|
|
141
|
+
"cell-free sample",
|
|
142
|
+
"organoid",
|
|
143
|
+
"technical sample",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
ORGAN_SLIMS = [
|
|
147
|
+
"adipose tissue",
|
|
148
|
+
"adrenal gland",
|
|
149
|
+
"arterial blood vessel",
|
|
150
|
+
"blood",
|
|
151
|
+
"blood vessel",
|
|
152
|
+
"bodily fluid",
|
|
153
|
+
"bone element",
|
|
154
|
+
"bone marrow",
|
|
155
|
+
"brain",
|
|
156
|
+
"breast",
|
|
157
|
+
"bronchus",
|
|
158
|
+
"colon",
|
|
159
|
+
"connective tissue",
|
|
160
|
+
"ear",
|
|
161
|
+
"embryo",
|
|
162
|
+
"endocrine gland",
|
|
163
|
+
"epithelium",
|
|
164
|
+
"esophagus",
|
|
165
|
+
"exocrine gland",
|
|
166
|
+
"extraembryonic component",
|
|
167
|
+
"eye",
|
|
168
|
+
"gallbladder",
|
|
169
|
+
"gonad",
|
|
170
|
+
"hair follicle",
|
|
171
|
+
"heart",
|
|
172
|
+
"immune organ",
|
|
173
|
+
"intestine",
|
|
174
|
+
"kidney",
|
|
175
|
+
"large intestine",
|
|
176
|
+
"limb",
|
|
177
|
+
"liver",
|
|
178
|
+
"lung",
|
|
179
|
+
"lymph node",
|
|
180
|
+
"lymphatic vessel",
|
|
181
|
+
"lymphoid tissue",
|
|
182
|
+
"major salivary gland",
|
|
183
|
+
"mammary gland",
|
|
184
|
+
"mouth",
|
|
185
|
+
"musculature of body",
|
|
186
|
+
"nerve",
|
|
187
|
+
"nose",
|
|
188
|
+
"ovary",
|
|
189
|
+
"pancreas",
|
|
190
|
+
"pericardium",
|
|
191
|
+
"penis",
|
|
192
|
+
"placenta",
|
|
193
|
+
"prostate gland",
|
|
194
|
+
"skeleton",
|
|
195
|
+
"skin of body",
|
|
196
|
+
"skin of prepuce of penis",
|
|
197
|
+
"small intestine",
|
|
198
|
+
"spinal cord",
|
|
199
|
+
"spleen",
|
|
200
|
+
"stomach",
|
|
201
|
+
"testis",
|
|
202
|
+
"thymus",
|
|
203
|
+
"thyroid gland",
|
|
204
|
+
"tongue",
|
|
205
|
+
"tonsil",
|
|
206
|
+
"trachea",
|
|
207
|
+
"ureter",
|
|
208
|
+
"urinary bladder",
|
|
209
|
+
"uterus",
|
|
210
|
+
"vagina",
|
|
211
|
+
"vasculature",
|
|
212
|
+
"vein",
|
|
213
|
+
]
|
|
214
|
+
|
|
215
|
+
FILE_FORMATS = [
|
|
216
|
+
"fastq",
|
|
217
|
+
"bam",
|
|
218
|
+
"bed",
|
|
219
|
+
"bigWig",
|
|
220
|
+
"bigBed",
|
|
221
|
+
"tsv",
|
|
222
|
+
"csv",
|
|
223
|
+
"tar",
|
|
224
|
+
"hic",
|
|
225
|
+
"tagAlign",
|
|
226
|
+
"bedpe",
|
|
227
|
+
"pairs",
|
|
228
|
+
"fasta",
|
|
229
|
+
"gff",
|
|
230
|
+
"gtf",
|
|
231
|
+
"idat",
|
|
232
|
+
"CEL",
|
|
233
|
+
"rcc",
|
|
234
|
+
"sra",
|
|
235
|
+
"csfasta",
|
|
236
|
+
"csqual",
|
|
237
|
+
"2bit",
|
|
238
|
+
"database",
|
|
239
|
+
"vcf",
|
|
240
|
+
"bigInteract",
|
|
241
|
+
"idx",
|
|
242
|
+
"dat",
|
|
243
|
+
"txt",
|
|
244
|
+
]
|
|
245
|
+
|
|
246
|
+
OUTPUT_TYPES = [
|
|
247
|
+
# Raw data
|
|
248
|
+
"reads",
|
|
249
|
+
"index reads",
|
|
250
|
+
"filtered reads",
|
|
251
|
+
"subreads",
|
|
252
|
+
# Alignments
|
|
253
|
+
"alignments",
|
|
254
|
+
"unfiltered alignments",
|
|
255
|
+
"transcriptome alignments",
|
|
256
|
+
"redacted alignments",
|
|
257
|
+
"redacted unfiltered alignments",
|
|
258
|
+
"spike-in alignments",
|
|
259
|
+
# Signal tracks
|
|
260
|
+
"signal",
|
|
261
|
+
"signal of unique reads",
|
|
262
|
+
"signal of all reads",
|
|
263
|
+
"signal p-value",
|
|
264
|
+
"fold change over control",
|
|
265
|
+
"control normalized signal",
|
|
266
|
+
"read-depth normalized signal",
|
|
267
|
+
"raw signal",
|
|
268
|
+
"plus strand signal of unique reads",
|
|
269
|
+
"minus strand signal of unique reads",
|
|
270
|
+
"plus strand signal of all reads",
|
|
271
|
+
"minus strand signal of all reads",
|
|
272
|
+
# Peaks
|
|
273
|
+
"peaks",
|
|
274
|
+
"IDR thresholded peaks",
|
|
275
|
+
"conservative IDR thresholded peaks",
|
|
276
|
+
"optimal IDR thresholded peaks",
|
|
277
|
+
"pseudoreplicated peaks",
|
|
278
|
+
"pseudoreplicated IDR thresholded peaks",
|
|
279
|
+
"replicated peaks",
|
|
280
|
+
"stable peaks",
|
|
281
|
+
"hotspots",
|
|
282
|
+
"footprints",
|
|
283
|
+
"peaks and background as input for IDR",
|
|
284
|
+
"IDR ranked peaks",
|
|
285
|
+
"candidate Cis-Regulatory Elements",
|
|
286
|
+
"candidate enhancers",
|
|
287
|
+
"candidate promoters",
|
|
288
|
+
"DHS peaks",
|
|
289
|
+
"filtered peaks",
|
|
290
|
+
# Quantifications
|
|
291
|
+
"gene quantifications",
|
|
292
|
+
"transcript quantifications",
|
|
293
|
+
"exon quantifications",
|
|
294
|
+
"microRNA quantifications",
|
|
295
|
+
"element quantifications",
|
|
296
|
+
"guide quantifications",
|
|
297
|
+
"differential expression quantifications",
|
|
298
|
+
"splice junctions",
|
|
299
|
+
# References
|
|
300
|
+
"genome reference",
|
|
301
|
+
"genome index",
|
|
302
|
+
"transcriptome reference",
|
|
303
|
+
"transcriptome index",
|
|
304
|
+
"elements reference",
|
|
305
|
+
"TSS reference",
|
|
306
|
+
# 3D genome
|
|
307
|
+
"contact matrix",
|
|
308
|
+
"mapping quality thresholded contact matrix",
|
|
309
|
+
"contact domains",
|
|
310
|
+
"loops",
|
|
311
|
+
"genome compartments",
|
|
312
|
+
"genome subcompartments",
|
|
313
|
+
"chromatin stripes",
|
|
314
|
+
"thresholded links",
|
|
315
|
+
# Methylation
|
|
316
|
+
"methylation state at CpG",
|
|
317
|
+
"methylation state at CHG",
|
|
318
|
+
"methylation state at CHH",
|
|
319
|
+
"CpG sites coverage",
|
|
320
|
+
"plus strand methylation state at CpG",
|
|
321
|
+
"minus strand methylation state at CpG",
|
|
322
|
+
# Other
|
|
323
|
+
"enrichment",
|
|
324
|
+
"FDR cut rate",
|
|
325
|
+
"transcription start sites",
|
|
326
|
+
"element gene links",
|
|
327
|
+
"thresholded element gene links",
|
|
328
|
+
"semi-automated genome annotation",
|
|
329
|
+
"TF binding prediction model",
|
|
330
|
+
"enhancer prediction model",
|
|
331
|
+
"promoter prediction model",
|
|
332
|
+
"PWMs",
|
|
333
|
+
"kmer weights",
|
|
334
|
+
"perturbation signal",
|
|
335
|
+
"replication timing profile",
|
|
336
|
+
"fragments",
|
|
337
|
+
"pairs",
|
|
338
|
+
"contigs",
|
|
339
|
+
"variant calls",
|
|
340
|
+
"fine-mapped variants",
|
|
341
|
+
]
|
|
342
|
+
|
|
343
|
+
OUTPUT_CATEGORIES = [
|
|
344
|
+
"raw data",
|
|
345
|
+
"alignment",
|
|
346
|
+
"signal",
|
|
347
|
+
"annotation",
|
|
348
|
+
"quantification",
|
|
349
|
+
"reference",
|
|
350
|
+
"quality metric",
|
|
351
|
+
]
|
|
352
|
+
|
|
353
|
+
FILE_STATUSES = [
|
|
354
|
+
"released",
|
|
355
|
+
"archived",
|
|
356
|
+
"in progress",
|
|
357
|
+
"revoked",
|
|
358
|
+
"deleted",
|
|
359
|
+
"content error",
|
|
360
|
+
"upload failed",
|
|
361
|
+
]
|
|
362
|
+
|
|
363
|
+
EXPERIMENT_STATUSES = [
|
|
364
|
+
"released",
|
|
365
|
+
"archived",
|
|
366
|
+
"revoked",
|
|
367
|
+
"deleted",
|
|
368
|
+
"replaced",
|
|
369
|
+
"in progress",
|
|
370
|
+
"submitted",
|
|
371
|
+
"preliminary",
|
|
372
|
+
]
|
|
373
|
+
|
|
374
|
+
ASSEMBLIES = [
|
|
375
|
+
"GRCh38",
|
|
376
|
+
"hg19",
|
|
377
|
+
"mm10",
|
|
378
|
+
"mm9",
|
|
379
|
+
"GRCm39",
|
|
380
|
+
"dm6",
|
|
381
|
+
"dm3",
|
|
382
|
+
"ce11",
|
|
383
|
+
"ce10",
|
|
384
|
+
]
|
|
385
|
+
|
|
386
|
+
LIFE_STAGES = [
|
|
387
|
+
"embryonic",
|
|
388
|
+
"postnatal",
|
|
389
|
+
"newborn",
|
|
390
|
+
"child",
|
|
391
|
+
"adolescent",
|
|
392
|
+
"adult",
|
|
393
|
+
"unknown",
|
|
394
|
+
]
|
|
395
|
+
|
|
396
|
+
REPLICATION_TYPES = [
|
|
397
|
+
"isogenic",
|
|
398
|
+
"anisogenic",
|
|
399
|
+
"unreplicated",
|
|
400
|
+
]
|
|
401
|
+
|
|
402
|
+
# Map of metadata_type to its values for the get_metadata tool
|
|
403
|
+
METADATA_MAP = {
|
|
404
|
+
"assays": ASSAY_TITLES,
|
|
405
|
+
"organisms": ORGANISMS,
|
|
406
|
+
"organs": ORGAN_SLIMS,
|
|
407
|
+
"biosample_types": BIOSAMPLE_CLASSIFICATIONS,
|
|
408
|
+
"file_formats": FILE_FORMATS,
|
|
409
|
+
"output_types": OUTPUT_TYPES,
|
|
410
|
+
"output_categories": OUTPUT_CATEGORIES,
|
|
411
|
+
"assemblies": ASSEMBLIES,
|
|
412
|
+
"life_stages": LIFE_STAGES,
|
|
413
|
+
"replication_types": REPLICATION_TYPES,
|
|
414
|
+
"statuses": EXPERIMENT_STATUSES,
|
|
415
|
+
"file_statuses": FILE_STATUSES,
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
# ENCODE API parameter name mapping (user-friendly -> API param)
|
|
419
|
+
EXPERIMENT_FILTER_MAP = {
|
|
420
|
+
"assay_title": "assay_title",
|
|
421
|
+
"organism": "replicates.library.biosample.donor.organism.scientific_name",
|
|
422
|
+
"organ": "biosample_ontology.organ_slims",
|
|
423
|
+
"biosample_type": "biosample_ontology.classification",
|
|
424
|
+
"biosample_term_name": "biosample_ontology.term_name",
|
|
425
|
+
"target": "target.label",
|
|
426
|
+
"status": "status",
|
|
427
|
+
"lab": "lab.title",
|
|
428
|
+
"award": "award.project",
|
|
429
|
+
"assembly": "assembly",
|
|
430
|
+
"replication_type": "replication_type",
|
|
431
|
+
"life_stage": "replicates.library.biosample.life_stage",
|
|
432
|
+
"sex": "replicates.library.biosample.sex",
|
|
433
|
+
"perturbed": "replicates.library.biosample.perturbed",
|
|
434
|
+
"treatment": "replicates.library.biosample.treatments.treatment_term_name",
|
|
435
|
+
"genetic_modification": "replicates.library.biosample.applied_modifications.category",
|
|
436
|
+
"date_released": "date_released",
|
|
437
|
+
"searchTerm": "searchTerm",
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
FILE_FILTER_MAP = {
|
|
441
|
+
"file_format": "file_format",
|
|
442
|
+
"file_type": "file_type",
|
|
443
|
+
"output_type": "output_type",
|
|
444
|
+
"output_category": "output_category",
|
|
445
|
+
"assembly": "assembly",
|
|
446
|
+
"status": "status",
|
|
447
|
+
"biological_replicates": "biological_replicates",
|
|
448
|
+
"preferred_default": "preferred_default",
|
|
449
|
+
"dataset": "dataset",
|
|
450
|
+
}
|