Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build scm pages #82

Merged
merged 28 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6f30be6
Basically nothing, just tinkering
AaronCooke2718 Apr 26, 2024
3be8ba2
Add run-dashboard to makefile
jvivian May 1, 2024
431f80d
John's updates
jvivian May 1, 2024
7f5c8f9
Started copying code over, need to identify if I am referring to the …
AaronCooke2718 May 1, 2024
df4752b
Update 4_SCM_Data_Selection.py
AaronCooke2718 May 3, 2024
0f7529f
Adding SCM ipynb
jvivian May 19, 2024
7f62ad5
Update data.h5ad
jvivian May 19, 2024
d8d6ee3
Add factors to output anndata object
jvivian May 19, 2024
804cf1f
Update page
jvivian May 19, 2024
8b0db49
Merge branch 'Build-SCM-Pages' of https://github.com/jvivian/covid19-…
jvivian May 19, 2024
eb1b2a2
Update notebook with working example
jvivian May 20, 2024
d6b229e
Remove buggy anndata code for now
jvivian May 20, 2024
ade8f81
Add option to parameterize dashboard inputs
jvivian May 22, 2024
8311537
Update SCM with data
jvivian May 23, 2024
78c4b1d
Update notebook
jvivian May 23, 2024
b08fb3d
shitty bugfixes, will clean up later
jvivian May 27, 2024
56454f6
Update deps
jvivian Jun 3, 2024
407db0f
Add if __name__ statement for debugger
jvivian Jun 3, 2024
86e59c3
Add data.h5ad write out
jvivian Jun 3, 2024
b649535
Swap to yaml for output
jvivian Jun 3, 2024
77c9d2b
Add failure statements to dashboard
jvivian Jun 3, 2024
96e659e
fix factor analysis page
jvivian Jun 3, 2024
bc2e038
Move work in progress pages
jvivian Jun 3, 2024
fa98b3c
Update SCM page
jvivian Jun 3, 2024
adeb704
Update launch with example
jvivian Jun 3, 2024
fb99127
Update example data
jvivian Jun 3, 2024
8c16dd9
Add SCM page
jvivian Jun 5, 2024
1df008e
FIx tests + update coverage
jvivian Jun 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
"justMyCode": true,
"args": [
"run",
"covid19_drdfm/data/processed/data.h5ad",
"./covid19_drdfm/data/example-data/full-global-2",
"--batch",
"State"
]
}
]
}
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,8 @@ docs: ## Build and serve the documentation
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

.PHONY: dashboard
dashboard:
@streamlit run covid19_drdfm/streamlit/Dashboard.py

.DEFAULT_GOAL := help
87 changes: 47 additions & 40 deletions coverage.xml
Original file line number Diff line number Diff line change
@@ -1,46 +1,51 @@
<?xml version="1.0" ?>
<coverage version="7.4.3" timestamp="1711594976212" lines-valid="308" lines-covered="297" line-rate="0.9643" branches-valid="92" branches-covered="80" branch-rate="0.8696" complexity="0">
<coverage version="7.4.3" timestamp="1717636032945" lines-valid="315" lines-covered="303" line-rate="0.9619" branches-valid="96" branches-covered="82" branch-rate="0.8542" complexity="0">
<!-- Generated by coverage.py: https://coverage.readthedocs.io/en/7.4.3 -->
<!-- Based on https://raw.githubusercontent.com/cobertura/web/master/htdocs/xml/coverage-04.dtd -->
<sources>
<source>/Users/jvivian/git/covid19-drDFM/covid19_drdfm</source>
<source>/home/jvivian/covid19-drDFM/covid19_drdfm</source>
</sources>
<packages>
<package name="." line-rate="0.9643" branch-rate="0.8696" complexity="0">
<package name="." line-rate="0.9619" branch-rate="0.8542" complexity="0">
<classes>
<class name="cli.py" filename="cli.py" complexity="0" line-rate="0.9" branch-rate="1">
<class name="cli.py" filename="cli.py" complexity="0" line-rate="0.8857" branch-rate="0.5">
<methods/>
<lines>
<line number="12" hits="1"/>
<line number="13" hits="1"/>
<line number="14" hits="1"/>
<line number="15" hits="1"/>
<line number="16" hits="1"/>
<line number="17" hits="1"/>
<line number="18" hits="1"/>
<line number="19" hits="1"/>
<line number="21" hits="1"/>
<line number="22" hits="1"/>
<line number="23" hits="1"/>
<line number="24" hits="1"/>
<line number="26" hits="1"/>
<line number="25" hits="1"/>
<line number="28" hits="1"/>
<line number="29" hits="1"/>
<line number="30" hits="1"/>
<line number="37" hits="1"/>
<line number="38" hits="1"/>
<line number="39" hits="1"/>
<line number="40" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="exit"/>
<line number="41" hits="1"/>
<line number="42" hits="1"/>
<line number="43" hits="1"/>
<line number="54" hits="1"/>
<line number="55" hits="1"/>
<line number="56" hits="1"/>
<line number="45" hits="1"/>
<line number="46" hits="1"/>
<line number="57" hits="1"/>
<line number="58" hits="1"/>
<line number="59" hits="1"/>
<line number="60" hits="1"/>
<line number="64" hits="1"/>
<line number="65" hits="1"/>
<line number="66" hits="1"/>
<line number="62" hits="1"/>
<line number="63" hits="1"/>
<line number="67" hits="1"/>
<line number="68" hits="1"/>
<line number="69" hits="1"/>
<line number="70" hits="1"/>
<line number="74" hits="0"/>
<line number="75" hits="0"/>
<line number="76" hits="0"/>
<line number="72" hits="1"/>
<line number="73" hits="1"/>
<line number="77" hits="0"/>
<line number="78" hits="0"/>
<line number="79" hits="0"/>
<line number="82" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="83"/>
<line number="83" hits="0"/>
</lines>
</class>
<class name="constants.py" filename="constants.py" complexity="0" line-rate="1" branch-rate="1">
Expand Down Expand Up @@ -109,7 +114,7 @@
<line number="139" hits="1"/>
</lines>
</class>
<class name="dfm.py" filename="dfm.py" complexity="0" line-rate="0.9692" branch-rate="0.9">
<class name="dfm.py" filename="dfm.py" complexity="0" line-rate="0.9701" branch-rate="0.9">
<methods/>
<lines>
<line number="3" hits="1"/>
Expand Down Expand Up @@ -146,9 +151,8 @@
<line number="75" hits="0"/>
<line number="77" hits="1"/>
<line number="92" hits="1"/>
<line number="93" hits="1"/>
<line number="94" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="95" hits="1"/>
<line number="94" hits="1"/>
<line number="95" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="96" hits="1"/>
<line number="97" hits="1"/>
<line number="98" hits="1"/>
Expand All @@ -161,22 +165,25 @@
<line number="105" hits="1"/>
<line number="106" hits="1"/>
<line number="107" hits="1"/>
<line number="108" hits="1"/>
<line number="109" hits="1"/>
<line number="110" hits="1"/>
<line number="117" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="118" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="119" hits="1"/>
<line number="121" hits="1"/>
<line number="128" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="129"/>
<line number="129" hits="0"/>
<line number="130" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="133" hits="1"/>
<line number="145" hits="1"/>
<line number="146" hits="1"/>
<line number="147" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="148" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="150"/>
<line number="149" hits="1"/>
<line number="112" hits="1"/>
<line number="113" hits="1"/>
<line number="115" hits="1"/>
<line number="122" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="123" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="124" hits="1"/>
<line number="126" hits="1"/>
<line number="133" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="134"/>
<line number="134" hits="0"/>
<line number="135" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="138" hits="1"/>
<line number="150" hits="1"/>
<line number="151" hits="1"/>
<line number="152" hits="1" branch="true" condition-coverage="100% (2/2)"/>
<line number="153" hits="1" branch="true" condition-coverage="50% (1/2)" missing-branches="155"/>
<line number="154" hits="1"/>
<line number="155" hits="1"/>
</lines>
</class>
<class name="io.py" filename="io.py" complexity="0" line-rate="1" branch-rate="1">
Expand Down Expand Up @@ -225,7 +232,7 @@
<lines>
<line number="2" hits="1"/>
<line number="3" hits="1"/>
<line number="4" hits="1"/>
<line number="5" hits="1"/>
<line number="6" hits="1"/>
<line number="7" hits="1"/>
<line number="8" hits="1"/>
Expand Down
13 changes: 10 additions & 3 deletions covid19_drdfm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,18 @@
Process data and generate parquet DataFrame
- `c19_dfm process ./outfile.xlsx`
"""
import anndata as ann

import subprocess
from pathlib import Path
from typing import Optional

import anndata as ann
import typer
from rich import print

from covid19_drdfm.covid19 import get_project_h5ad

from covid19_drdfm.io import DataLoader
from covid19_drdfm.dfm import ModelRunner
from covid19_drdfm.io import DataLoader

app = typer.Typer()

Expand All @@ -33,10 +32,14 @@
batch: str = typer.Option(help="Name of column in h5ad.obs to use as batch variable"),
global_multiplier: int = 1,
maxiter: int = 10_000,
update_h5ad: bool = True,
):
ad = ann.read_h5ad(h5ad)
model = ModelRunner(ad, outdir, batch)
model.run(maxiter, global_multiplier)
if update_h5ad:
print(f"[bold green]:heavy_check_mark: Updating H5ad {h5ad}")
model.ad.write_h5ad(h5ad)


@app.command("create_input_data")
Expand Down Expand Up @@ -74,3 +77,7 @@
current_dir = Path(__file__).resolve().parent
dashboard_path = current_dir / "streamlit" / "Dashboard.py"
subprocess.run(["streamlit", "run", dashboard_path])


if __name__ == "__main__":
app()

Check warning on line 83 in covid19_drdfm/cli.py

View check run for this annotation

Codecov / codecov/patch

covid19_drdfm/cli.py#L83

Added line #L83 was not covered by tests
Loading
Loading