Skip to content

Commit e957419

Browse files
committed
flake8 corrections
1 parent d78e99e commit e957419

3 files changed

Lines changed: 4 additions & 37 deletions

File tree

src/diffupy/process_input.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -266,32 +266,6 @@ def _codify_input_data(
266266
threshold
267267
)
268268

269-
# Standardize the title of the node column labeling column to 'Label', for later processing.
270-
if LABEL not in df.columns:
271-
for l in list(df.columns):
272-
if l in NODE_LABELING:
273-
df = df.rename(columns={l: LABEL})
274-
break
275-
276-
# If node type provided in a column, classify in a dictionary the input codification by its node type.
277-
if NODE_TYPE in df.columns:
278-
279-
node_types = list(set(df[NODE_TYPE])) # Get the node types list set.
280-
codified_by_type_dict = {}
281-
282-
for node_type in node_types:
283-
# Filter the nodes by the iterable type.
284-
df_by_type = df.loc[df[NODE_TYPE] == node_type]
285-
286-
# Codify the nodes for the iterable type.
287-
codified_by_type_dict[node_type] = _codify_method_check(df_by_type,
288-
method,
289-
binning,
290-
absolute_value,
291-
p_value,
292-
threshold
293-
)
294-
return codified_by_type_dict
295269

296270
def _codify_method_check(
297271
df: pd.DataFrame,
@@ -613,7 +587,6 @@ def mapping_statistics(
613587

614588
total_mapping.update(mapping)
615589

616-
617590
if subtotals:
618591
statistics_dict['total_mapping'] = total_mapping
619592
statistics_dict['total_input'] = total_input
@@ -782,7 +755,7 @@ def _map_label_dict(
782755
label_bck = _check_label_to_background_labels(label, background_labels, check_substrings)
783756
if label_bck is not None:
784757
mapped_dict[label_bck] = v
785-
758+
786759
elif isinstance(label, set) or isinstance(label, tuple) or isinstance(label, list):
787760
for sublabel in set(label):
788761
label_bck = _check_label_to_background_labels(sublabel, background_labels, check_substrings)

src/diffupy/utils.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"""Matrix/graph handling utils."""
2525

2626

27-
2827
def get_laplacian(graph: Graph, normalized: bool = False) -> np.ndarray:
2928
"""Return Laplacian matrix."""
3029
if nx.is_directed(graph):
@@ -145,9 +144,10 @@ def print_dict_dimensions(entities_db, title='Title', message=''):
145144
m += f'{k2} ({v2})\n'
146145
else:
147146
m += f'{v1}'
148-
147+
149148
print(f'{m}\n\n')
150149

150+
151151
def log_dict(dict_to_print: dict, message: str = ''):
152152
"""Print dictionary as list with a message."""
153153
for k1, v1 in dict_to_print.items():
@@ -300,12 +300,6 @@ def munge_cell(cell):
300300
else:
301301
raise TypeError(f'The cell "{cell}" could not be processed.')
302302

303-
def parse_xls_sheet_to_df(sheet: opxl.workbook,
304-
min_row: Optional[int] = 1,
305-
relevant_cols: Optional[list] = None,
306-
irrelevant_cols: Optional[list] = None) -> pd.DataFrame:
307-
"""Process/format excel sheets to DataFrame."""
308-
parsed_sheet_dict = {}
309303

310304
def parse_xls_sheet_to_df(sheet: opxl.workbook,
311305
min_row: Optional[int] = 1,

tests/test_input.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def test_format_input_for_diffusion_label_list(self):
271271
map_labels_input({'Metabolite': {'C': -1}, 'Gene': {'A': 2, 'B': 1}, 'mirnas': {'A': 1, 'T': 1}},
272272
self.kernel_test_1.rows_labels),
273273
self.kernel_test_1,
274-
274+
)
275275

276276
# TODO: Implement in Matrix equal, now if the col order is mixed it raises error
277277
# assert(np.allclose(processed_mapped_nodes_list.mat,

0 commit comments

Comments
 (0)