Skip to content

Commit cad4ec8

Browse files
authored
Merge pull request #4 from BioinfoMachineLearning/develop
[Bugfix] Correct and Simplify Filename Matching during Pair Postprocessing
2 parents d52304b + 2b531e8 commit cad4ec8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

project/utils/deepinteract_utils.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -733,14 +733,12 @@ def convert_input_pdb_files_to_pair(left_pdb_filepath: str, right_pdb_filepath:
733733
pair_filepath = pair_filepaths[0]
734734
else:
735735
# Manually construct the already-postprocessed input pair's filepath since no pairs needed postprocessing
736-
pruned_pairs_dir = os.path.join(input_dataset_dir, 'interim', 'pairs')
737736
output_dir = os.path.join(input_dataset_dir, 'final', 'raw')
738737
produced_filenames = db.get_structures_filenames(output_dir, extension='.dill')
739-
produced_keys = [db.get_pdb_name(x) for x in produced_filenames if db.get_pdb_name(x) in left_pdb_filepath]
740-
pdb_filename = [os.path.join(pruned_pairs_dir, db.get_pdb_code(key)[1:3], key)
741-
for key in produced_keys][0]
742-
sub_dir = output_dir + '/' + db.get_pdb_code(pdb_filename)[1:3]
743-
pair_filepath = sub_dir + '/' + db.get_pdb_name(pdb_filename)
738+
produced_keys = [db.get_pdb_name(x) for x in produced_filenames
739+
if db.get_pdb_code(x).upper() in db.get_pdb_code(left_pdb_filepath).upper()]
740+
pair_filepath = [os.path.join(output_dir, db.get_pdb_code(key)[1:3], key)
741+
for key in produced_keys][0]
744742
# Impute any missing feature values in the postprocessed input pairs
745743
impute_missing_feature_values(output_dir=os.path.join(input_dataset_dir, 'final', 'raw'))
746744
# Load preprocessed pair

0 commit comments

Comments
 (0)