Skip to content

Commit 4eabae5

Browse files
committed
Added outputs to regression example
1 parent 838391c commit 4eabae5

2 files changed

Lines changed: 20 additions & 7 deletions

File tree

tutorials/regression_mpra_example/download_data.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import io
22
import gzip
33
import os
4-
import urllib
4+
import urllib.request
55
import tarfile
66

7+
import numpy
78
import pandas
89
import scipy.io
910
import selene_sdk.sequences
@@ -14,7 +15,7 @@ def run():
1415
local_file = "sample_et_al.tar"
1516

1617
# Download the data.
17-
urllib.retrieve("https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE114002&format=file", local_file)
18+
urllib.request.urlretrieve("https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE114002&format=file", local_file)
1819
with tarfile.open(local_file, "r") as archive:
1920
contents = archive.extractfile("GSM3130435_egfp_unmod_1.csv.gz").read()
2021
contents = gzip.decompress(contents).decode("utf-8")

tutorials/regression_mpra_example/regression_mpra_example.ipynb

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"Selene is a flexible framework, and can be used for tasks beyond simple classification.\n",
1010
"This tutorial serves as an introduction to training regression models with Selene.\n",
1111
"For this tutorial, we will predict mean ribosomal load (MRL) from 50 base pair 5' UTR sequences using models and data from [*Human 5′ UTR design and variant effect prediction from a massively parallel translation assay*](https://doi.org/10.1101/310375) by Sample et al.\n",
12-
"This data was generated from a massively parallel reporter assay (MPRA), which you can read more about in the preprint [on *bioRxiv*](https://doi.org/10.1101/310375).\n",
12+
"This data was generated from a massively parallel reporter assay (MPRA), which you can read more about it in the preprint [on *bioRxiv*](https://doi.org/10.1101/310375).\n",
1313
"\n",
1414
"## Setup\n",
1515
"\n",
@@ -62,7 +62,7 @@
6262
},
6363
{
6464
"cell_type": "code",
65-
"execution_count": null,
65+
"execution_count": 6,
6666
"metadata": {},
6767
"outputs": [],
6868
"source": [
@@ -71,9 +71,21 @@
7171
},
7272
{
7373
"cell_type": "code",
74-
"execution_count": null,
74+
"execution_count": 7,
7575
"metadata": {},
76-
"outputs": [],
76+
"outputs": [
77+
{
78+
"name": "stdout",
79+
"output_type": "stream",
80+
"text": [
81+
"Outputs and logs saved to ./2018-12-08-22-08-14\n",
82+
"[VALIDATE] average r2: 0.8641705948994154\n",
83+
"[VALIDATE] average r2: 0.8767916124114791\n",
84+
"[VALIDATE] average r2: 0.8817297326343803\n",
85+
"[TEST] average r2: 0.9232683662644537\n"
86+
]
87+
}
88+
],
7789
"source": [
7890
"parse_configs_and_run(configs, lr=0.001)"
7991
]
@@ -95,7 +107,7 @@
95107
"name": "python",
96108
"nbconvert_exporter": "python",
97109
"pygments_lexer": "ipython3",
98-
"version": "3.6.3"
110+
"version": "3.6.5"
99111
}
100112
},
101113
"nbformat": 4,

0 commit comments

Comments
 (0)