Skip to content

Commit

Permalink
Minor idist api improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-bushuiev committed Dec 4, 2024
1 parent f983df6 commit fea5bad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ppiref/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ def compare_all_against_all(
self.embed_parallel(ppis)

# Compare PPIs pairwise
df = [self.compare(*x) for x in ppi_pairs]
df = [self.compare(*x) for x in tqdm(ppi_pairs, desc='Comparing PPIs with iDist')]
df = pd.DataFrame(df)
return df

Expand Down
4 changes: 3 additions & 1 deletion scripts/idist.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def main(split, fold, pairs, pdb_dir, out_dir, max_workers, partition_beg, parti
ppis0, ppis1 = pickle.load(f)
pairs = list(zip(ppis0, ppis1))
pairs = get_partition(pairs, partition_beg, partition_end)
inputs = {'ppi_pairs': pairs}
if verbose:
print(f'Read {len(pairs)} PPI pairs')
else: # Split and fold provided
Expand All @@ -62,6 +63,7 @@ def main(split, fold, pairs, pdb_dir, out_dir, max_workers, partition_beg, parti
ppis1 = read_fold(split, fold)
ppis0 = get_partition(ppis0, partition_beg, partition_end)
ppis1 = get_partition(ppis1, partition_beg, partition_end)
inputs = {'ppis0': ppis0, 'ppis1': ppis1}
if verbose:
print(f'Read {len(ppis0)} and {len(ppis1)} PPIs')

Expand All @@ -85,7 +87,7 @@ def main(split, fold, pairs, pdb_dir, out_dir, max_workers, partition_beg, parti
df_embeddings.to_csv(out_dir / f'idist_emb_{name}_{partition_beg}-{partition_end}{out_file_suff}.csv')

# Compare
df_comp = idist.compare_all_against_all(ppis0, ppis1, embed=False)
df_comp = idist.compare_all_against_all(**inputs, embed=False)
df_comp.to_csv(out_dir / f'idist_distmat_{name}_{partition_beg}-{partition_end}{out_file_suff}.csv', index=False)


Expand Down

0 comments on commit fea5bad

Please sign in to comment.