Skip to content

Commit

Permalink
preparing for version 0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesKersting committed Jul 19, 2023
1 parent 2bea301 commit e6b9d1a
Show file tree
Hide file tree
Showing 7 changed files with 541 additions and 123 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ data.get_results()

data.get_results_binary()

# get R2 values, coefficients, and coefficient p-values for all models/edges
data.get_model_stats()

```

The expected run time for the installation and running the demo dataset on a "normal" desktop computer is around 3~5 minutes.
Expand Down
49 changes: 20 additions & 29 deletions dev_tests.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,20 @@
"cells": [
{
"cell_type": "code",
"execution_count": 94,
"execution_count": 1,
"id": "d03d274e-6792-4bbf-93bf-b8c7259c1d7f",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"The autoreload extension is already loaded. To reload it, use:\n",
" %reload_ext autoreload\n"
]
}
],
"outputs": [],
"source": [
"%load_ext autoreload\n",
"%autoreload 2\n",
"import pandas as pd\n",
"from dysregnet.dysregnet import run"
"from src.dysregnet.dysregnet import run"
]
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 2,
"id": "b6408bef-4768-42c3-88e3-21e250102240",
"metadata": {},
"outputs": [],
Expand All @@ -36,7 +27,7 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 3,
"id": "0b876315-e883-450e-95a4-88b7caf76085",
"metadata": {},
"outputs": [],
Expand All @@ -53,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 4,
"id": "208046d3-5d5f-4ea4-aae7-c575094bc88e",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -266,7 +257,7 @@
"[5 rows x 38 columns]"
]
},
"execution_count": 49,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -277,7 +268,7 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 5,
"id": "35febb56-1441-4049-a452-450c25afebb1",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -490,7 +481,7 @@
"[5 rows x 22579 columns]"
]
},
"execution_count": 50,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -501,7 +492,7 @@
},
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 6,
"id": "9dd72783-5b5d-488d-937e-f1d34535b29a",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -569,7 +560,7 @@
"4 AHR FOS"
]
},
"execution_count": 51,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -580,7 +571,7 @@
},
{
"cell_type": "code",
"execution_count": 82,
"execution_count": 7,
"id": "abda2742-f17d-440c-b5b2-e021d2c26f9c",
"metadata": {},
"outputs": [],
Expand All @@ -591,15 +582,15 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": 8,
"id": "62b921d3-27e0-4f54-a77b-d3b35d5eedfb",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"14979it [00:42, 354.63it/s]\n"
"14979it [00:45, 332.12it/s]\n"
]
}
],
Expand All @@ -614,7 +605,7 @@
},
{
"cell_type": "code",
"execution_count": 96,
"execution_count": 9,
"id": "c3aede6a-7044-456e-affd-3804f54eb9d7",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1044,7 +1035,7 @@
"[515 rows x 14979 columns]"
]
},
"execution_count": 96,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1055,7 +1046,7 @@
},
{
"cell_type": "code",
"execution_count": 97,
"execution_count": 10,
"id": "e719292a-4d97-426a-b1aa-c64e1f0b1837",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1272,7 +1263,7 @@
"[14979 rows x 9 columns]"
]
},
"execution_count": 97,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -1283,7 +1274,7 @@
},
{
"cell_type": "code",
"execution_count": 98,
"execution_count": 11,
"id": "3aacbc4e-8f13-48ef-849a-7404f45e9573",
"metadata": {},
"outputs": [
Expand Down Expand Up @@ -1713,7 +1704,7 @@
"[515 rows x 14979 columns]"
]
},
"execution_count": 98,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


setup(name='dysregnet',
version='0.0.3',
version='0.0.4',
description='DysRegNet',
long_description=README,
long_description_content_type="text/markdown",
Expand All @@ -27,7 +27,8 @@
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
packages=find_packages(),
package_dir = {'': 'src'},
packages=['dysregnet'],
include_package_data=True,
python_requires='>=3.7',
install_requires=[
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion dysregnet/dysregnet.py → src/dysregnet/dysregnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self,
List of continuous covariates. They should match the name of their columns in meta Dataframe.
zscoring: boolean, default: True
zscoring: boolean, default: False
zscoring of expression data (if needed).
bonferroni_alpha: Float
Expand Down
4 changes: 3 additions & 1 deletion dysregnet/functions.py → src/dysregnet/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ def dyregnet_model(data):
# fit the model
model = sm.OLS(y_train, x_train)
results = model.fit()

model_stats[edge] = [results.rsquared] + list(results.params.values) + list(results.pvalues.values)


# get residuals of control
resid_control = results.predict(x_train) - y_train
Expand Down Expand Up @@ -162,7 +165,6 @@ def dyregnet_model(data):


edges[edge] = np.round(zscore, 1)
model_stats[edge] = [results.rsquared] + list(results.params.values) + list(results.pvalues.values)



Expand Down
Loading

0 comments on commit e6b9d1a

Please sign in to comment.