Skip to content

Commit

Permalink
Merge branch 'dev' for 0.11.1
Browse files Browse the repository at this point in the history
  • Loading branch information
cflerin committed Apr 16, 2021
2 parents 79b97ed + 1acff24 commit 21d6b18
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ RUN pip install --no-cache-dir --upgrade pip wheel && \
# use version from argument (--build-arg version=0.11.0), or a default:
ARG version="0.11.0"
RUN pip install --no-cache-dir pyscenic==$version && \
pip install --no-cache-dir scanpy==1.7.0
pip install --no-cache-dir scanpy==1.7.2


FROM python:3.7.9-slim AS build-image
Expand All @@ -42,3 +42,5 @@ COPY --from=compile-image /opt/venv /opt/venv
# Make sure we use the virtualenv:
ENV PATH="/opt/venv/bin:$PATH"

EXPOSE 8787

8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ in no time. The latter is achieved via the dask_ framework for distributed compu
News and releases
-----------------

0.11.1 | 2021-02-11
^^^^^^^^^^^^^^^^^^^

* Fix bug in motif url construction (#275)
* Fix for export2loom with sparse dataframe (#278)
* Fix sklearn t-SNE import (#285)
* Updates to Docker image (expose port 8787 for Dask dashboard)

0.11.0 | 2021-02-10
^^^^^^^^^^^^^^^^^^^

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ scipy
fsspec
requests
aiohttp
scikit-learn>=0.22.2
6 changes: 3 additions & 3 deletions requirements_docker.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
adjustText==0.7.3
aiohttp==3.7.3
aiohttp==3.7.4
anndata==0.7.5
ansiwrap==0.8.4
appdirs==1.4.4
Expand Down Expand Up @@ -81,7 +81,7 @@ pathspec==0.8.1
patsy==0.5.1
pexpect==4.8.0
pickleshare==0.7.5
Pillow==8.1.0
Pillow==8.1.1
prompt-toolkit==3.0.15
psutil==5.8.0
ptyprocess==0.7.0
Expand Down Expand Up @@ -122,7 +122,7 @@ traitlets==5.0.5
typed-ast==1.4.2
typing-extensions==3.7.4.3
umap-learn==0.5.1
urllib3==1.26.3
urllib3==1.26.4
wcwidth==0.2.5
webencodings==0.5.1
yarl==1.6.3
Expand Down
5 changes: 1 addition & 4 deletions src/pyscenic/aucell.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ def derive_auc_threshold(ex_mtx: pd.DataFrame) -> pd.DataFrame:
that when using this value as the AUC threshold for 99% of the cells all ranked genes used for AUC calculation will
have had a detected expression in the single-cell experiment.
"""
binary_mtx = ex_mtx.copy()
binary_mtx[binary_mtx != 0] = 1.0
n_genes = len(binary_mtx.columns)
return binary_mtx.sum(axis=1).quantile([.01, .05, .10, .50, 1])/n_genes
return pd.Series(np.count_nonzero(ex_mtx, axis=1)).quantile([.01, .05, .10, .50, 1])/ex_mtx.shape[1]


enrichment = enrichment4cells
Expand Down
8 changes: 3 additions & 5 deletions src/pyscenic/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import numpy as np
import pandas as pd
import loompy as lp
from sklearn.manifold.t_sne import TSNE
from sklearn.manifold import TSNE
from .aucell import aucell
from .genesig import Regulon
from typing import List, Mapping, Union, Sequence, Optional
Expand Down Expand Up @@ -95,9 +95,7 @@ def export2loom(ex_mtx: pd.DataFrame, regulons: List[Regulon], out_fname: str,
embeddings_Y = pd.merge(embeddings_Y, embedding['_Y'].to_frame().rename(columns={'_Y': str(embedding_id)}), left_index=True, right_index=True)

# Calculate the number of genes per cell.
binary_mtx = ex_mtx.copy()
binary_mtx[binary_mtx != 0] = 1.0
ngenes = binary_mtx.sum(axis=1).astype(int)
ngenes = np.count_nonzero(ex_mtx, axis=1)

# Encode genes in regulons as "binary" membership matrix.
genes = np.array(ex_mtx.columns)
Expand Down Expand Up @@ -127,7 +125,7 @@ def create_structure_array(df):
default_embedding.columns=['_X', '_Y']
column_attrs = {
"CellID": ex_mtx.index.values.astype('str'),
"nGene": ngenes.values,
"nGene": ngenes,
"Embedding": create_structure_array(default_embedding),
"RegulonsAUC": create_structure_array(auc_mtx),
"Clusterings": create_structure_array(clusterings),
Expand Down
2 changes: 1 addition & 1 deletion src/pyscenic/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def add_motif_url(df: pd.DataFrame, base_url: str):
:param base_url:
:return:
"""
df[("Enrichment", COLUMN_NAME_MOTIF_URL)] = list(map(partial(urljoin, base=base_url), df.index.get_level_values(COLUMN_NAME_MOTIF_ID)))
df[("Enrichment", COLUMN_NAME_MOTIF_URL)] = list(map(partial(urljoin, base_url), df.index.get_level_values(COLUMN_NAME_MOTIF_ID)))
return df


Expand Down

0 comments on commit 21d6b18

Please sign in to comment.