Skip to content

Commit

Permalink
fixed type issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonleandergrimm committed Dec 2, 2023
1 parent f989802 commit c0f5185
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion preprint_stats/cost_required_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import csv
from dataclasses import dataclass
from scipy.stats import gmean
from scipy.stats import gmean # type: ignore
import numpy as np

PERCENTILES = [5, 25, 50, 75, 95]
Expand Down
2 changes: 1 addition & 1 deletion preprint_stats/preprint_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import subprocess
import numpy as np
from scipy.stats import gmean
from scipy.stats import gmean # type: ignore


dashboard = os.path.expanduser("~/code/mgs-pipeline/dashboard/")
Expand Down
2 changes: 1 addition & 1 deletion preprint_stats/reads_required_stat.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import csv
from dataclasses import dataclass
from scipy.stats import gmean
from scipy.stats import gmean # type: ignore

import numpy as np

Expand Down
11 changes: 2 additions & 9 deletions preprint_stats/rothman_inter_site_comparison.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv
import pandas as pd
from scipy.stats import gmean
from scipy.stats import gmean # type: ignore
from math import log
from collections import defaultdict

Expand All @@ -13,12 +13,7 @@ def reads_df() -> pd.DataFrame:


def rothman_fits_data() -> pd.DataFrame:
data = {
"predictor_type": [],
"virus": [],
"study": [],
"location": [],
}
data = defaultdict(list)
for p in PERCENTILES:
data[f"{p}"] = []

Expand Down Expand Up @@ -63,9 +58,7 @@ def compute_geo_mean_ratio(df: pd.DataFrame) -> pd.DataFrame:
for quantile in PERCENTILES:
non_htp_quantile_gm = (gmean(non_htp_df[quantile].dropna()),)
htp_quantile = gmean(htp_df[quantile].dropna())
print(non_htp_quantile_gm, htp_quantile)
variance = float(htp_quantile - non_htp_quantile_gm)
# print(variance)

gmean_variance[f"variance_{quantile}"].append(round(variance, 2))

Expand Down
12 changes: 2 additions & 10 deletions preprint_stats/spurbeck_inter_site_comparison.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import csv
import pandas as pd
from scipy.stats import gmean
from scipy.stats import gmean # type: ignore
from math import log
from collections import defaultdict

Expand All @@ -13,13 +13,7 @@ def reads_df() -> pd.DataFrame:


def spurbeck_fits_data() -> pd.DataFrame:
data = {
"predictor_type": [],
"virus": [],
"study": [],
"location": [],
"enriched": [],
}
data = defaultdict(list)
for p in PERCENTILES:
data[f"{p}"] = []

Expand Down Expand Up @@ -59,7 +53,6 @@ def compute_geo_mean_ratio(df: pd.DataFrame) -> pd.DataFrame:
]
gmean_variance = defaultdict(list)
for virus in df["virus"].unique():
print(virus)
if virus not in target_viruses:
continue
virus_df = df[df["virus"] == virus]
Expand All @@ -72,7 +65,6 @@ def compute_geo_mean_ratio(df: pd.DataFrame) -> pd.DataFrame:
gmean(non_enriched_virus_df[quantile].dropna()),
)
variance = float(enriched_gm - non_enriched_gm)
print(variance)

gmean_variance[f"variance_{quantile}"].append(round(variance, 2))

Expand Down

0 comments on commit c0f5185

Please sign in to comment.