Add quick start guide
#1
by
yairschiff
- opened
README.md
CHANGED
@@ -14,6 +14,31 @@ The motivation of the genomics long range benchmark (LRB) is to compile a set of
|
|
14 |
While serving as a strong basis of evaluation, the benchmark must also be efficient and user-friendly.
|
15 |
To achieve this we strike a balance between task complexity and computational cost through strategic decisions, such as down-sampling or combining datasets.
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
## Dataset Tasks
|
18 |
The Genomics LRB is a collection of tasks which can be loaded by passing in the corresponding `task_name` into the `load_dataset` function. All of the following datasets
|
19 |
allow the user to specify an arbitrarily long sequence length, giving more context to the task, by passing `sequence_length` kwarg to `load_dataset`. Additional task specific kwargs, if applicable,
|
|
|
14 |
While serving as a strong basis of evaluation, the benchmark must also be efficient and user-friendly.
|
15 |
To achieve this we strike a balance between task complexity and computational cost through strategic decisions, such as down-sampling or combining datasets.
|
16 |
|
17 |
+
## Quick Start Guide
|
18 |
+
Below is an example of how to use these benchmark datasets with the Huggingface `datasets` library:
|
19 |
+
|
20 |
+
```python
|
21 |
+
def find_variant_idx(examples):
|
22 |
+
"""Find token location that differs between reference and variant sequence.
|
23 |
+
|
24 |
+
Args:
|
25 |
+
examples: (batch of) items from the dataset.
|
26 |
+
Returns:
|
27 |
+
dict with values index of difference.
|
28 |
+
"""
|
29 |
+
idx = -1
|
30 |
+
for i, (ref, alt) in enumerate(zip(examples["ref_input_ids"], examples["alt_input_ids"])):
|
31 |
+
if ref != alt:
|
32 |
+
idx = i
|
33 |
+
rc_idx = -1
|
34 |
+
for i, (ref, alt) in enumerate(zip(examples["ref_rc_input_ids"], examples["alt_rc_input_ids"])):
|
35 |
+
if ref != alt:
|
36 |
+
rc_idx = i
|
37 |
+
return {"variant_idx": idx, "rc_variant_idx": rc_idx}
|
38 |
+
|
39 |
+
dataset = dataset.map(find_variant_idx, desc="Find variant idx")
|
40 |
+
```
|
41 |
+
|
42 |
## Dataset Tasks
|
43 |
The Genomics LRB is a collection of tasks which can be loaded by passing in the corresponding `task_name` into the `load_dataset` function. All of the following datasets
|
44 |
allow the user to specify an arbitrarily long sequence length, giving more context to the task, by passing `sequence_length` kwarg to `load_dataset`. Additional task specific kwargs, if applicable,
|