Skip to content

Commit

Permalink
Removed deprication warning in latest version of pyarrow.
Browse files Browse the repository at this point in the history
  • Loading branch information
bramvds committed Nov 5, 2018
1 parent e1b4dc2 commit b8a3176
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pandas>=0.20.1
cloudpickle
dask>=0.18.1
distributed>=1.21.6
pyarrow
pyarrow>=0.11.1
arboreto
boltons
setuptools
Expand Down
4 changes: 2 additions & 2 deletions src/pyscenic/rnkdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,10 @@ def genes(self) -> Tuple[str]:
return tuple(reader.get_column_name(idx) for idx in range(self.total_genes) if reader.get_column_name(idx) != INDEX_NAME)

def load_full(self) -> pd.DataFrame:
return FeatherReader(self._fname).read().set_index(INDEX_NAME)
return FeatherReader(self._fname).read_pandas().set_index(INDEX_NAME)

def load(self, gs: Type[GeneSignature]) -> pd.DataFrame:
return FeatherReader(self._fname).read(columns=(INDEX_NAME,) + gs.genes).set_index(INDEX_NAME)
return FeatherReader(self._fname).read_pandas(columns=(INDEX_NAME,) + gs.genes).set_index(INDEX_NAME)


class MemoryDecorator(RankingDatabase):
Expand Down
30 changes: 13 additions & 17 deletions tests/test_aucell.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,27 @@ def gs():
gene_separator="\t", field_separator="\t", )


def test_create_rankings():
ex_mtx = exp_matrix()
df_rnk = create_rankings(ex_mtx)
n_genes = ex_mtx.shape[1]
def test_create_rankings(exp_matrix):
df_rnk = create_rankings(exp_matrix)
n_genes = exp_matrix.shape[1]
assert len(df_rnk.sum(axis=1).unique()) == 1
assert (df_rnk + 1).sum(axis=1).unique()[0] == (n_genes * (n_genes+1))/2.0


def test_aucell_w1():
ex_mtx = exp_matrix()
percentiles = derive_auc_threshold(ex_mtx)
aucs_mtx = aucell(ex_mtx, gs(), auc_threshold=percentiles[0.01], num_workers=1)
def test_aucell_w1(exp_matrix, gs):
percentiles = derive_auc_threshold(exp_matrix)
aucs_mtx = aucell(exp_matrix, gs, auc_threshold=percentiles[0.01], num_workers=1)


def test_aucell_w2():
ex_mtx = exp_matrix()
percentiles = derive_auc_threshold(ex_mtx)
aucs_mtx = aucell(ex_mtx, gs(), auc_threshold=percentiles[0.01], num_workers=4)
def test_aucell_w2(exp_matrix, gs):
percentiles = derive_auc_threshold(exp_matrix)
aucs_mtx = aucell(exp_matrix, gs, auc_threshold=percentiles[0.01], num_workers=4)


def test_aucell_mismatch():
ex_mtx = exp_matrix()
percentiles = derive_auc_threshold(ex_mtx)
gss = [GeneSignature(name="test", gene2weight=list(map("FAKE{}".format, range(100))))] + gs()
aucs_mtx = aucell(ex_mtx, gss, auc_threshold=percentiles[0.01], num_workers=1)
def test_aucell_mismatch(exp_matrix, gs):
percentiles = derive_auc_threshold(exp_matrix)
gss = [GeneSignature(name="test", gene2weight=list(map("FAKE{}".format, range(100))))] + gs
aucs_mtx = aucell(exp_matrix, gss, auc_threshold=percentiles[0.01], num_workers=1)
print(aucs_mtx.head())


Expand Down
4 changes: 2 additions & 2 deletions tests/test_recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def gs():
gene_separator="\t", field_separator="\t", )[0]


def test_enrichment():
df = enrichment(db(), gs())
def test_enrichment(db, gs):
df = enrichment(db, gs)


def test_auc1d_1():
Expand Down

0 comments on commit b8a3176

Please sign in to comment.