Skip to content

Updating for rapids 22.08 #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BASE_IMAGE=rapidsai/rapidsai:22.02-cuda11.2-runtime-ubuntu18.04-py3.8
ARG BASE_IMAGE=rapidsai/rapidsai:22.08-cuda11.5-runtime-ubuntu18.04-py3.8

FROM ${BASE_IMAGE}
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
Expand All @@ -10,15 +10,15 @@ RUN git clone \


RUN /opt/conda/envs/rapids/bin/pip install \
scanpy==1.8.1 wget pytabix dash-daq \
scanpy==1.9.1 wget pytabix dash-daq \
dash-html-components dash-bootstrap-components dash-core-components

RUN cd atacworks && /opt/conda/envs/rapids/bin/pip install .

WORKDIR /workspace
ENV HOME /workspace
RUN git clone \
https://github.com/clara-parabricks/rapids-single-cell-examples.git \
https://github.com/NVIDIA-Genomics-Research/rapids-single-cell-examples.git \
rapids-single-cell-examples

ARG GIT_BRANCH=master
Expand All @@ -34,5 +34,5 @@ CMD jupyter-lab \
--NotebookApp.token="" \
--NotebookApp.password_required=False

# ENV LD_LIBRARY_PATH /usr/local/cuda-10.2/compat
# ENV LD_LIBRARY_PATH /usr/local/cuda-11.5/compat
# RUN echo "export PATH=$PATH:/workspace/data" >> ~/.bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ channels:
- defaults
dependencies:
- python=3.8
- cuml=22.02*
- cudf=22.02*
- cugraph=22.02*
- cuml=22.08*
- cudf=22.08*
- cugraph=22.08*
- tabix
- pytabix
- cudatoolkit=11.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ channels:
- defaults
dependencies:
- python=3.8
- cuml=22.02*
- cudf=22.02*
- cugraph=22.02*
- cuml=22.08*
- cudf=22.08*
- cugraph=22.08*
- cudatoolkit=11.5
- python-wget
- cupy=9*
Expand Down
12 changes: 6 additions & 6 deletions notebooks/rapids_scanpy_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def select_groups(labels, groups_order_subset='all'):
groups_ids = []
for name in groups_order_subset:
groups_ids.append(
cp.where(cp.array(labels.cat.categories.to_array().astype("int32")) == int(name))[0][0]
cp.where(cp.array(labels.cat.categories.to_numpy().astype("int32")) == int(name))[0][0]
)
if len(groups_ids) == 0:
# fallback to index retrieval
Expand All @@ -321,9 +321,9 @@ def select_groups(labels, groups_order_subset='all'):

groups_ids = [groups_id.item() for groups_id in groups_ids]
groups_masks = groups_masks[groups_ids]
groups_order_subset = labels.cat.categories[groups_ids].to_array().astype(int)
groups_order_subset = labels.cat.categories[groups_ids].to_numpy().astype(int)
else:
groups_order_subset = groups_order.to_array()
groups_order_subset = groups_order.to_numpy()
return groups_order_subset, groups_masks


Expand Down Expand Up @@ -427,7 +427,7 @@ def rank_genes_groups(
y = labels.loc[grouping]

clf = LogisticRegression(**kwds)
clf.fit(X.get(), grouping.to_array().astype('float32'))
clf.fit(X.get(), grouping.astype('float32').to_numpy())
scores_all = cp.array(clf.coef_).T

for igroup, group in enumerate(groups_order):
Expand Down Expand Up @@ -660,7 +660,7 @@ def highly_variable_genes_filter(client,
dispersion = variance / mean

df = pd.DataFrame()
df['genes'] = genes.to_array()
df['genes'] = genes.to_numpy()
df['means'] = mean.tolist()
df['dispersions'] = dispersion.tolist()
df['mean_bin'] = pd.cut(
Expand Down Expand Up @@ -699,7 +699,7 @@ def _cellranger_hvg(mean, mean_sq, genes, n_cells, n_top_genes):

df = pd.DataFrame()
# Note - can be replaced with cudf once 'cut' is added in 21.08
df['genes'] = genes.to_array()
df['genes'] = genes.to_numpy()
df['means'] = mean.tolist()
df['dispersions'] = dispersion.tolist()
df['mean_bin'] = pd.cut(
Expand Down
18 changes: 9 additions & 9 deletions notebooks/visualize.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ def start_graph(self, df):
gdf = df.query(query)
fig.add_trace(
go.Scattergl({
'x': gdf['x'].to_array(),
'y': gdf['y'].to_array(),
'text': gdf['labels'].to_array(),
'customdata': gdf['point_index'].to_array(),
'x': gdf['x'].to_numpy(),
'y': gdf['y'].to_numpy(),
'text': gdf['labels'].to_numpy(),
'customdata': gdf['point_index'].to_numpy(),
'name': 'Cluster ' + si,
'mode': 'markers',
'marker': {'size': 3, 'color': colors[i % len(colors)]}
Expand All @@ -286,10 +286,10 @@ def update_graph(self, df):
gdf = df.query(query)
fig = {
'type':'scattergl',
'x': gdf['x'].to_array(),
'y': gdf['y'].to_array(),
'text': gdf['labels'].to_array(),
'customdata': gdf['point_index'].to_array(),
'x': gdf['x'].to_numpy(),
'y': gdf['y'].to_numpy(),
'text': gdf['labels'].to_numpy(),
'customdata': gdf['point_index'].to_numpy(),
'name': 'Cluster ' + si,
'mode': 'markers',
'marker': {'size': 3, 'color': colors[i % len(colors)]} }
Expand Down Expand Up @@ -341,7 +341,7 @@ def graph_violin(self, df, marker):
query = 'labels == ' + si
gdf = df.query(query)

y = gdf[marker_val].to_array()
y = gdf[marker_val].to_numpy()
x = [i] * len(y)
fig.add_trace(
go.Violin({
Expand Down