Skip to content

Commit

Permalink
Merge pull request #291 from cschlaffner/pre-commit-for-all-files
Browse files Browse the repository at this point in the history
Fix existing code style inconsistencies using pre-commit hooks
  • Loading branch information
JanniRoebbecke authored Nov 6, 2023
2 parents 252f8e4 + b8dd8df commit d4d7dac
Show file tree
Hide file tree
Showing 19 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions protzilla/constants/workflow_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@
}
},
{
"graph_type_quantites": {
"graph_type_quantities": {
"name": "Graph type Imputed Values:",
"type": "categorical",
"categories": [
Expand Down Expand Up @@ -522,7 +522,7 @@
}
},
{
"graph_type_quantites": {
"graph_type_quantities": {
"name": "Graph type Imputed Values:",
"type": "categorical",
"categories": [
Expand Down Expand Up @@ -569,7 +569,7 @@
}
},
{
"graph_type_quantites": {
"graph_type_quantities": {
"name": "Graph type Imputed Values:",
"type": "categorical",
"categories": [
Expand Down Expand Up @@ -619,7 +619,7 @@
}
},
{
"graph_type_quantites": {
"graph_type_quantities": {
"name": "Graph type Imputed Values:",
"type": "categorical",
"categories": [
Expand Down Expand Up @@ -666,7 +666,7 @@
}
},
{
"graph_type_quantites": {
"graph_type_quantities": {
"name": "Graph type - Imputed Values:",
"type": "categorical",
"categories": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import pandas as pd
import statsmodels.api as sm
from django.contrib import messages
from scipy import stats

from .differential_expression_helper import apply_multiple_testing_correction

Expand Down
1 change: 0 additions & 1 deletion protzilla/data_analysis/dimension_reduction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numpy as np
import pandas as pd
from django.contrib import messages
from sklearn.manifold import TSNE
Expand Down
1 change: 0 additions & 1 deletion protzilla/data_analysis/model_evaluation_plots.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import PrecisionRecallDisplay, RocCurveDisplay

from protzilla.data_analysis.classification_helper import encode_labels
Expand Down
4 changes: 2 additions & 2 deletions protzilla/data_integration/database_download.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json
import re
from datetime import date
from pathlib import Path

import requests
from requests.adapters import HTTPAdapter, Retry
from tqdm import tqdm
from datetime import date
import json

# cannot be imported form constants as package cannot be found
external_data_path = Path(__file__).parent.parent.parent / "user_data" / "external_data"
Expand Down
28 changes: 15 additions & 13 deletions protzilla/data_preprocessing/imputation.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,41 +221,43 @@ def by_min_per_dataset(
return intensity_df_copy, dict()


def by_knn_plot(df, result_df, current_out, graph_type, graph_type_quantites, group_by):
def by_knn_plot(
df, result_df, current_out, graph_type, graph_type_quantities, group_by
):
return _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
)


def by_simple_imputer_plot(
df, result_df, current_out, graph_type, graph_type_quantites, group_by
df, result_df, current_out, graph_type, graph_type_quantities, group_by
):
return _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
)


def by_min_per_sample_plot(
df, result_df, current_out, graph_type, graph_type_quantites, group_by
df, result_df, current_out, graph_type, graph_type_quantities, group_by
):
return _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
)


def by_min_per_protein_plot(
df, result_df, current_out, graph_type, graph_type_quantites, group_by
df, result_df, current_out, graph_type, graph_type_quantities, group_by
):
return _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
)


def by_min_per_dataset_plot(
df, result_df, current_out, graph_type, graph_type_quantites, group_by
df, result_df, current_out, graph_type, graph_type_quantities, group_by
):
return _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
)


Expand All @@ -264,7 +266,7 @@ def number_of_imputed_values(input_df, result_df):


def _build_box_hist_plot(
df, result_df, graph_type, graph_type_quantites, group_by
df, result_df, graph_type, graph_type_quantities, group_by
) -> list[Figure]:
"""
This function creates two visualisations:
Expand Down Expand Up @@ -300,13 +302,13 @@ def _build_box_hist_plot(
abs(len(df)),
number_of_imputed_values(df, result_df),
]
if graph_type_quantites == "Bar chart":
if graph_type_quantities == "Bar chart":
fig2 = create_bar_plot(
names_of_sectors=["Non-imputed values", "Imputed values"],
values_of_sectors=values_of_sectors,
heading="Number of Imputed Values",
)
elif graph_type_quantites == "Pie chart":
elif graph_type_quantities == "Pie chart":
fig2 = create_pie_plot(
names_of_sectors=["Non-imputed values", "Imputed values"],
values_of_sectors=values_of_sectors,
Expand Down
1 change: 0 additions & 1 deletion protzilla/history.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
import os
import shutil
from dataclasses import dataclass
from pathlib import Path
Expand Down
1 change: 0 additions & 1 deletion tests/protzilla/data_analysis/test_dimension_reduction.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import numpy as np
import pandas as pd
import pytest

Expand Down
4 changes: 2 additions & 2 deletions tests/protzilla/importing/test_ms_data_import.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from unittest.mock import patch

import numpy as np
import pandas as pd
import pytest
from unittest.mock import patch


from protzilla.constants.paths import PROJECT_PATH
from protzilla.importing import ms_data_import
Expand Down
4 changes: 3 additions & 1 deletion tests/protzilla/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,9 @@ def test_export_plot(tests_folder_name):
run.perform_calculation(data_preprocessing.imputation.by_min_per_sample, {})
run.create_plot(
data_preprocessing.imputation.by_min_per_sample_plot,
dict(graph_type="Boxplot", graph_type_quantites="Bar chart", group_by="Sample"),
dict(
graph_type="Boxplot", graph_type_quantities="Bar chart", group_by="Sample"
),
)
assert len(run.plots) > 1
for plot in run.export_plots("tiff"):
Expand Down
2 changes: 1 addition & 1 deletion tests/protzilla/test_run_helper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import copy
from unittest.mock import MagicMock, Mock, patch
from unittest.mock import MagicMock, Mock

import pandas as pd
import pytest
Expand Down
2 changes: 1 addition & 1 deletion tests/protzilla/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_serialize_workflow_graphs():
serial_imputation_graphs = {
"graph_type": "Bar chart",
"group_by": "Sample",
"graph_type_quantites": "Pie chart",
"graph_type_quantities": "Pie chart",
}

serial_filter_graphs = {"graph_type": "Pie chart"}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workflows/example_workflow.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Pie chart"
"graph_type_quantities": "Pie chart"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_workflows/wrong_parameters.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Bar chart"
"graph_type_quantities": "Bar chart"
}
]
}
Expand Down
5 changes: 3 additions & 2 deletions ui/main/views.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import shutil
import pandas
import json
import shutil
from datetime import date

import pandas
from django.contrib import messages
from django.http import HttpResponseRedirect
from django.shortcuts import redirect, render
Expand Down
2 changes: 1 addition & 1 deletion user_data/workflows/BA46_VolcanoPlot.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Pie chart"
"graph_type_quantities": "Pie chart"
}
],
"output_name": null
Expand Down
2 changes: 1 addition & 1 deletion user_data/workflows/enrichment_analysis.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Pie chart"
"graph_type_quantities": "Pie chart"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion user_data/workflows/standard.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Pie chart"
"graph_type_quantities": "Pie chart"
}
]
},
Expand Down
2 changes: 1 addition & 1 deletion user_data/workflows/workflow_gsea.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"group_by": "Sample"
},
{
"graph_type_quantites": "Pie chart"
"graph_type_quantities": "Pie chart"
}
],
"output_name": null
Expand Down

0 comments on commit d4d7dac

Please sign in to comment.