Skip to content

Commit

Permalink
Add module-level docstring stubs, cleanup (#40)
Browse files Browse the repository at this point in the history
Add module-level docstring stubs, cleanup
  • Loading branch information
dweindl authored Jan 13, 2025
1 parent 2264730 commit 2f81244
Show file tree
Hide file tree
Showing 17 changed files with 27 additions and 100 deletions.
20 changes: 2 additions & 18 deletions src/ccompass/CCMPS.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### CELLCOMPASS
"""C-COMPASS main window."""

from . import CCMPS_actions as action
from . import PPMS
Expand All @@ -10,34 +10,18 @@
from . import MOA
from . import SM
from . import RP


import copy
import pickle

# from NPC import NPC
# from MLO_01_function import MLO, first_prediction
# from CM_01_function import CM
# from MM_01_function import MM

from tkinter import messagebox


# import runpy

import FreeSimpleGUI as sg
import pandas as pd

import os

os.environ["TF_CPP_MIN_LOG_LEVEL"] = "2"

# -----------------------------------------------------------------------------------------------------------------------------

import os


def main():
"""The entry point for the C-COMPASS application."""
fract_paths, fract_tables, fract_data, fract_pos = action.resetinput()
fract_data, fract_std, fract_intermediate, fract_info, fract_conditions = (
action.reset_fract()
Expand Down
14 changes: 2 additions & 12 deletions src/ccompass/CCMPS_actions.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Actions related to the main window."""

import FreeSimpleGUI as sg
import numpy as np
import pandas as pd
Expand All @@ -7,14 +9,6 @@
import copy


## parameters:
# ------------------------------------------------------------------------------


## internal functions:
# ------------------------------------------------------------------------------


def fract_refreshtable(window, table):
window["-fractionation_table-"].Update(values=table)
return
Expand Down Expand Up @@ -140,10 +134,6 @@ def tp_clearinput(window):
return


## external functions:
# ------------------------------------------------------------------------------


def reset_infract():
fract_indata = {}
fract_identifiers = {}
Expand Down
2 changes: 1 addition & 1 deletion src/ccompass/CM.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### CLASS MANAGER
"""Class manager."""

import FreeSimpleGUI as sg
import numpy as np
Expand Down
10 changes: 1 addition & 9 deletions src/ccompass/FDP.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### FRACTIONATION DATA PROCESSING
"""Fractionation data processing."""

import copy
import numpy as np
Expand All @@ -10,10 +10,6 @@
from collections import Counter


## internal functions:
# ------------------------------------------------------------------------------


def create_dataset(
input_data, input_tables, identifiers, conditions, window_FDP, progress
):
Expand Down Expand Up @@ -471,10 +467,6 @@ def modify_structure(data_in):
return data_out


## run script::
# ------------------------------------------------------------------------------


def FDP_exec(
window,
input_tables,
Expand Down
6 changes: 1 addition & 5 deletions src/ccompass/FSD.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
##### FRACTIONATION SUMMARY DISPLAY
"""Fractionation summary display."""

import FreeSimpleGUI as sg


## internal functions:
# ------------------------------------------------------------------------------


def FSD_exec(preparams, data_ways):
class_string = ""
for condition in data_ways["class"]:
Expand Down
3 changes: 1 addition & 2 deletions src/ccompass/MOA.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
### MULTIPLE ORGANELLE ANALYSIS

"""Multiple organelle analysis."""

import pandas as pd
import numpy as np
Expand Down
21 changes: 7 additions & 14 deletions src/ccompass/MOP.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
##### MULTIPLE ORGANELLE PREDICTION
"""Multiple organelle prediction."""

import numpy as np
import pandas as pd
import random
import copy
from datetime import datetime
from scipy import stats

from sklearn import svm
from sklearn.metrics import (
accuracy_score,
Expand All @@ -14,7 +14,6 @@
f1_score,
confusion_matrix,
)

import tensorflow as tf
from tensorflow import keras
import keras_tuner as kt
Expand All @@ -23,16 +22,6 @@
# from tensorflow.keras.models import Model


import os

# Define the path to the 'Classifier_Models' folder within the user's data directory
classifier_directory = get_data_directory() / "CCOMPASS_Models"

# Create the folder if it does not exist
if not os.path.exists(classifier_directory):
os.makedirs(classifier_directory)


optimizer_classes = {
"adam": tf.keras.optimizers.Adam,
"rmsprop": tf.keras.optimizers.RMSprop,
Expand Down Expand Up @@ -822,6 +811,10 @@ def multi_predictions(
]
set_shapes = [np.shape(y_train_mixed_up)[1], np.shape(Z_train_mixed_up)[1]]

# Define the path to the 'Classifier_Models' folder within the user's data directory
classifier_directory = get_data_directory() / "CCOMPASS_Models"
classifier_directory.mkdir(exist_ok=True, parents=True)

now = datetime.now()
time = now.strftime("%Y%m%d%H%M%S")
FNN_tuner = kt.Hyperband(
Expand All @@ -830,7 +823,7 @@ def multi_predictions(
objective="val_mean_squared_error",
max_epochs=NN_params["NN_epochs"],
factor=3,
directory=classifier_directory,
directory=str(classifier_directory),
project_name=time + "_Classifier_" + condition + "_" + str(roundn),
)

Expand Down
2 changes: 1 addition & 1 deletion src/ccompass/MOP_stats.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## MULTI ORGANELLE PREDICTION STATISTICS
"""Multi-organelle prediction statistics."""

import numpy as np
import pandas as pd
Expand Down
6 changes: 2 additions & 4 deletions src/ccompass/NPC.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""Normalized profile creation"""

import copy
import numpy as np
import pandas as pd
import FreeSimpleGUI as sg
from tkinter import messagebox, simpledialog

from .NPC_func import (
create_dataset,
pre_scaling,
Expand All @@ -23,9 +24,6 @@
)

from datetime import datetime
# -----------------------------------------------------------------------------
## Local functions:
# -----------------------------------------------------------------------------


def create_data(path): # creates initial dataset with corresponding data table
Expand Down
5 changes: 0 additions & 5 deletions src/ccompass/NPC_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ def pre_process():
return


# -----------------------------------------------------------------------------
## Local functions:
# -----------------------------------------------------------------------------


def create_condition_dataset(
data_init, tables_init, conditions, idents
): # creates dictionary containing data sorted by condition
Expand Down
2 changes: 1 addition & 1 deletion src/ccompass/PPMS.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### PREPARAMETERS
"""Preparameters"""

import FreeSimpleGUI as sg
from . import PPMS_actions as action
Expand Down
11 changes: 1 addition & 10 deletions src/ccompass/PPMS_actions.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
## parameters:
# ------------------------------------------------------------------------------


## internal functions:
# ------------------------------------------------------------------------------


## external functions:
# ------------------------------------------------------------------------------
"""Preparameter GUI actions."""


def set_combinations(params):
Expand Down
3 changes: 2 additions & 1 deletion src/ccompass/RP.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### RESULT PLOTS
"""Result plots"""

import FreeSimpleGUI as sg
import pandas as pd
import seaborn as sns
Expand Down
3 changes: 1 addition & 2 deletions src/ccompass/SM.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## SHOW MARKERS

"""Show markers."""

import FreeSimpleGUI as sg
import pandas as pd
Expand Down
5 changes: 2 additions & 3 deletions src/ccompass/SOP.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
##### SINGLE ORGANELLE PREDICTION
"""Single organelle prediction."""

import pandas as pd
from sklearn import svm
from sklearn.metrics import (
Expand All @@ -8,11 +9,9 @@
f1_score,
confusion_matrix,
)

import matplotlib.pyplot as plt
import copy


clf = svm.SVC(kernel="rbf", probability=True)


Expand Down
2 changes: 1 addition & 1 deletion src/ccompass/TM.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### TEST MARKER
"""Test marker"""

import FreeSimpleGUI as sg
import pandas as pd
Expand Down
12 changes: 1 addition & 11 deletions src/ccompass/TPP.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##### TOTAL PROTEOME PROCESSING
"""Total proteome profiling."""

import copy
import math
Expand All @@ -9,10 +9,6 @@
from scipy.stats import pearsonr


## internal functions:
# ------------------------------------------------------------------------------


def create_dataset(
tp_indata, tp_tables, tp_identifiers, tp_conditions, window
):
Expand Down Expand Up @@ -169,12 +165,6 @@ def normalize_data(data, window):
return data


## run script::
# ------------------------------------------------------------------------------

# minrep = 2


def TPP_exec(
window,
tp_data,
Expand Down

0 comments on commit 2f81244

Please sign in to comment.