Skip to content

Commit

Permalink
delayed function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalin Nonchev committed Jun 30, 2021
1 parent fba0343 commit 9595152
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion gnomad_db/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ def get_maf_from_df(self, var_df: pd.DataFrame, query: str="AF") -> pd.Series:
if self.parallel and len(var_df) > 100 * self.cpu_count:
out = np.array_split(var_df, self.cpu_count)
assert len(out) == self.cpu_count
out = Parallel(self.cpu_count, prefer="threads")(delayed(self._get_maf_from_df)(df, query) for df in out)

delayed_get_maf_from_df = delayed(self._get_maf_from_df)

out = Parallel(self.cpu_count, prefer="threads")(delayed_get_maf_from_df(df, query) for df in out)
out = pd.concat(out)
out.set_index(var_df.index, inplace=True)
assert len(var_df) == len(out)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages

setup(name='gnomad_db',
version='0.0.6',
version='0.0.7',
description='This package scales the huge gnomAD files to a SQLite database, which is easy and fast to query. It extracts from a gnomAD vcf the minor allele frequency for each variant.',
author='KalinNonchev',
author_email='[email protected]',
Expand Down

0 comments on commit 9595152

Please sign in to comment.