Skip to content

Commit ab88353

Browse files
committed
Refactored analysis
1 parent aaeddb4 commit ab88353

File tree

6 files changed

+39
-14
lines changed

6 files changed

+39
-14
lines changed

autoprot/analysis/PCA.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import seaborn as sns
1616

1717
from sklearn.decomposition import PCA
18-
from .. import r_helper
18+
from autoprot import r_helper
1919

2020
from gprofiler import GProfiler
2121

@@ -25,6 +25,8 @@
2525
# check where this is actually used and make it local
2626
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
2727

28+
__all__ = ["AutoPCA"]
29+
2830

2931
class AutoPCA:
3032
# noinspection PyUnresolvedReferences

autoprot/analysis/clustering.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@
3030
davies_bouldin_score,
3131
)
3232

33-
from .. import r_helper
33+
from autoprot import r_helper
3434

3535
gp = GProfiler(user_agent="autoprot", return_dataframe=True)
3636
RFUNCTIONS, R = r_helper.return_r_path()
3737

3838
# check where this is actually used and make it local
3939
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
4040

41+
__all__ = ["HCA", "KMeans"]
42+
4143

4244
class _Cluster:
4345
r"""

autoprot/analysis/functional.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
import matplotlib.pylab as plt
1717
import seaborn as sns
1818

19-
from .. import visualization as vis
20-
from .. import r_helper
19+
from autoprot import visualization as vis
20+
from autoprot import r_helper
2121

2222
from gprofiler import GProfiler
2323

@@ -27,6 +27,8 @@
2727
# check where this is actually used and make it local
2828
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
2929

30+
__all__ = ["go_analysis", "KSEA"]
31+
3032

3133
def go_analysis(
3234
gene_list: list[str],

autoprot/analysis/qc.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from operator import itemgetter
1818
import missingno as msn
1919

20-
from .. import r_helper
20+
from autoprot import r_helper
2121

2222
from gprofiler import GProfiler
2323

@@ -27,6 +27,15 @@
2727
# check where this is actually used and make it local
2828
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
2929

30+
__all__ = [
31+
"miss_analysis",
32+
"missed_cleavages",
33+
"enrichment_specificity",
34+
"SILAC_labeling_efficiency",
35+
"dimethyl_labeling_efficieny",
36+
"tmt6plex_labeling_efficiency",
37+
]
38+
3039

3140
def miss_analysis(
3241
df,
@@ -234,17 +243,21 @@ def missed_cleavages(df_evidence, enzyme="Trypsin/P", save=True, ax=None, title=
234243
today = date.today().isoformat()
235244

236245
if "Experiment" not in df_evidence.columns.tolist():
237-
print("Warning: Column [Experiment] either not unique or missing,\n\
238-
column [Raw file] used")
246+
print(
247+
"Warning: Column [Experiment] either not unique or missing,\n\
248+
column [Raw file] used"
249+
)
239250
experiments = list(set((df_evidence["Raw file"])))
240251
else:
241252
experiments = list(set((df_evidence["Experiment"])))
242253

243254
rawfiles = list(set((df_evidence["Raw file"])))
244255
if len(experiments) != len(rawfiles):
245256
experiments = rawfiles
246-
print("Warning: Column [Experiment] either not unique or missing,\n\
247-
column [Raw file] used")
257+
print(
258+
"Warning: Column [Experiment] either not unique or missing,\n\
259+
column [Raw file] used"
260+
)
248261

249262
# calculate miss cleavage for each raw file in df_evidence
250263
df_missed_cleavage_summary = pd.DataFrame()
@@ -601,8 +614,10 @@ def dimethyl_labeling_efficieny(df_evidence, label, save=True) -> pd.DataFrame:
601614
experiments = list((df_evidence["Experiment"].unique()))
602615
else:
603616
experiments = list((df_evidence["Raw file"].unique()))
604-
print("Warning: Column [Experiment] either not unique or missing,\n\
605-
column [Raw file] used")
617+
print(
618+
"Warning: Column [Experiment] either not unique or missing,\n\
619+
column [Raw file] used"
620+
)
606621

607622
df_labeling_eff = pd.DataFrame()
608623

autoprot/analysis/stat_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@
1717
from scipy.stats import ttest_1samp, ttest_ind
1818
from statsmodels.stats import multitest as mt
1919

20-
from .. import preprocessing as pp
21-
from .. import r_helper
20+
from autoprot import preprocessing as pp
21+
from autoprot import r_helper
2222

2323
gp = GProfiler(user_agent="autoprot", return_dataframe=True)
2424
RFUNCTIONS, R = r_helper.return_r_path()
2525

2626
# check where this is actually used and make it local
2727
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
2828

29+
__all__ = ["ttest", "adjust_p", "cohen_d", "limma", "rank_prod"]
30+
2931

3032
def ttest(
3133
df,

autoprot/analysis/stats.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import matplotlib.pylab as plt
1313
import seaborn as sns
1414

15-
from .. import r_helper
15+
from autoprot import r_helper
1616

1717
from gprofiler import GProfiler
1818

@@ -22,6 +22,8 @@
2222
# check where this is actually used and make it local
2323
cmap = sns.diverging_palette(150, 275, s=80, l=55, n=9)
2424

25+
__all__ = ["edm", "loess", "make_psm"]
26+
2527

2628
def edm(matrix_a, matrix_b):
2729
"""

0 commit comments

Comments
 (0)