Skip to content

Commit 4bfe94c

Browse files
committed
Black formatted
1 parent 50b245d commit 4bfe94c

File tree

7 files changed

+16
-23
lines changed

7 files changed

+16
-23
lines changed

ideeplc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""iDeepLC: A deep Learning-based retention time predictor for unseen modified peptides with a novel encoding system"""
2-
__version__ = "1.4.0"
32

3+
__version__ = "1.4.0"

ideeplc/data_initialize.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def data_initialize_chunked(
146146
raise
147147

148148
if errors:
149-
LOGGER.warning(f"Errors encountered during conversion in chunk {chunk_idx}: {errors}")
149+
LOGGER.warning(
150+
f"Errors encountered during conversion in chunk {chunk_idx}: {errors}"
151+
)
150152

151153
prediction_dataset = MyDataset(sequences, tr)
152154

@@ -160,9 +162,7 @@ def data_initialize_chunked(
160162
yield df, prediction_dataset, x_shape
161163

162164

163-
164165
def get_input_shape_from_first_chunk(csv_path: str, chunk_size: int = 10000, **kwargs):
165-
166166
"""
167167
Get the input shape from the first valid chunk of a CSV file.
168168
@@ -171,12 +171,10 @@ def get_input_shape_from_first_chunk(csv_path: str, chunk_size: int = 10000, **k
171171
:return: x_shape for model initialization.
172172
"""
173173
for _, dataset_chunk, x_shape in data_initialize_chunked(
174-
175174
csv_path=csv_path, chunk_size=chunk_size, **kwargs
176-
177175
):
178176
LOGGER.info(f"Detected input shape from first valid chunk: {x_shape}")
179177
return x_shape
180178

181179
LOGGER.error("No valid chunks found in the input file.")
182-
raise ValueError("No valid chunks found in the input file.")
180+
raise ValueError("No valid chunks found in the input file.")

ideeplc/fine_tuning.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,4 +169,4 @@ def fine_tune(self, layers_to_freeze=None):
169169
break
170170

171171
LOGGER.info("Fine-tuning complete.")
172-
return best_model
172+
return best_model

ideeplc/ideeplc_core.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ def main(args):
7575

7676
# For model initialization, only inspect the first valid chunk
7777
x_shape = get_input_shape_from_first_chunk(
78-
7978
csv_path=args.input,
8079
chunk_size=chunk_size,
8180
mod_features_csv=getattr(args, "mod_features", None),
82-
8381
)
8482

8583
# Initialize model
@@ -105,13 +103,11 @@ def main(args):
105103
if args.finetune:
106104
LOGGER.info("Fine-tuning the model")
107105

108-
109106
matrix_input, _ = data_initialize(
110107
csv_path=args.input,
111108
mod_features_csv=getattr(args, "mod_features", None),
112109
)
113110

114-
115111
fine_tuner = iDeepLCFineTuner(
116112
model=model,
117113
train_data=matrix_input,
@@ -139,7 +135,6 @@ def main(args):
139135
batch_size=batch_size,
140136
chunk_size=chunk_size,
141137
mod_features_csv=getattr(args, "mod_features", None),
142-
143138
)
144139
LOGGER.info("Prediction completed.")
145140

@@ -155,4 +150,4 @@ def main(args):
155150

156151
except Exception as e:
157152
LOGGER.error(f"An error occurred during execution: {e}")
158-
raise e
153+
raise e

ideeplc/mod_features.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ def main(argv=None):
3939
args = parser.parse_args(argv)
4040

4141
feature_table = build_user_mod_feature_table(args.input, args.output)
42-
LOGGER.info("Wrote %d modification feature rows to %s", len(feature_table), args.output)
42+
LOGGER.info(
43+
"Wrote %d modification feature rows to %s", len(feature_table), args.output
44+
)
4345

4446

4547
if __name__ == "__main__":
46-
main()
48+
main()

ideeplc/predict.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ def predict(
6868
chunk_size: int = 10000,
6969
dataloader_input: DataLoader = None,
7070
mod_features_csv: str = None,
71-
7271
):
7372
"""
7473
Load a trained model and evaluate it on test datasets in chunks.
@@ -132,7 +131,9 @@ def predict(
132131
return loss, correlation, all_predictions, all_ground_truth
133132

134133
if batch_size is None:
135-
raise ValueError("batch_size must be provided when dataloader_input is not used.")
134+
raise ValueError(
135+
"batch_size must be provided when dataloader_input is not used."
136+
)
136137

137138
if save_results:
138139
output_path.parent.mkdir(parents=True, exist_ok=True)
@@ -145,7 +146,6 @@ def predict(
145146
chunk_size=chunk_size,
146147
mod_features_csv=mod_features_csv,
147148
),
148-
149149
):
150150
LOGGER.info(
151151
f"Processing chunk {chunk_idx} with {len(dataset_chunk)} entries and shape {x_shape}."
@@ -234,4 +234,4 @@ def predict(
234234

235235
except Exception as e:
236236
LOGGER.error(f"An error occurred during prediction: {e}")
237-
raise e
237+
raise e

ideeplc/utilities.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -527,9 +527,7 @@ def df_to_matrix(
527527
if errors:
528528
print("Encoding errors encountered:")
529529
for peptide, idx, step, err in errors[:10]:
530-
print(
531-
f" - index {idx}, step {step}, peptide '{peptide}': {err}"
532-
)
530+
print(f" - index {idx}, step {step}, peptide '{peptide}': {err}")
533531

534532
if single_input:
535533
return seqs_stack[0]

0 commit comments

Comments
 (0)