Skip to content

Commit 7d324f8

Browse files
authored
Merge pull request #131 from JonathanShor/dev-v2.5.2
Fixes #129 by ensuring proper dependencies in setup.py Fixes #130
2 parents 267f510 + 0882322 commit 7d324f8

File tree

5 files changed

+40
-24
lines changed

5 files changed

+40
-24
lines changed

README.md

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
# DoubletDetection
2+
23
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.2678042.svg)](https://doi.org/10.5281/zenodo.2678042)
34
[![Documentation Status](https://readthedocs.org/projects/doubletdetection/badge/?version=latest)](https://doubletdetection.readthedocs.io/en/latest/?badge=latest)
45

5-
66
DoubletDetection is a Python3 package to detect doublets (technical errors) in single-cell RNA-seq count matrices.
77

8+
## Installing DoubletDetection
89

9-
To install DoubletDetection:
10-
11-
```
10+
```bash
1211
git clone https://github.com/JonathanShor/DoubletDetection.git
1312
cd DoubletDetection
1413
pip3 install .
1514
```
1615

17-
To run basic doublet classification:
16+
If you are using `pipenv` as your virtual environment, it may struggle installing from the setup.py due to our custom Phenograph requirement.
17+
If so, try the following in the cloned repo:
1818

19+
```bash
20+
pipenv run pip3 install .
1921
```
22+
23+
## Running DoubletDetection
24+
25+
To run basic doublet classification:
26+
27+
```Python
2028
import doubletdetection
2129
clf = doubletdetection.BoostClassifier()
2230
# raw_counts is a cells by genes count matrix
@@ -27,6 +35,7 @@ labels = clf.fit(raw_counts).predict()
2735
- `labels` is a 1-dimensional numpy ndarray with the value 1 representing a detected doublet, 0 a singlet, and `np.nan` an ambiguous cell.
2836

2937
The classifier works best when
38+
3039
- There are several cell types present in the data
3140
- It is applied individually to each run in an aggregated count matrix
3241

@@ -35,10 +44,11 @@ In `v2.5` we have added a new experimental clustering method (`scanpy`'s Louvain
3544
See our [jupyter notebook](https://nbviewer.jupyter.org/github/JonathanShor/DoubletDetection/blob/master/tests/notebooks/PBMC_8k_vignette.ipynb) for an example on 8k PBMCs from 10x.
3645

3746
## Obtaining data
38-
Data can be downloaded from the [10x website](https://support.10xgenomics.com/single-cell/datasets).
3947

48+
Data can be downloaded from the [10x website](https://support.10xgenomics.com/single-cell/datasets).
4049

4150
## Citations
51+
4252
bioRxiv submission and journal publication expected in the coming months. Please use the following for now:
4353

4454
Gayoso, Adam, & Shor, Jonathan. (2018, July 17). DoubletDetection (Version v2.4). Zenodo. http://doi.org/10.5281/zenodo.2678042

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
author = "Adam Gayoso and Jonathan Shor"
2424

2525
# The full version, including alpha/beta/rc tags
26-
release = "2.5.0"
26+
release = "2.5.2"
2727

2828

2929
# -- General configuration ---------------------------------------------------

doubletdetection/doubletdetection.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33
import collections
44
import warnings
55

6+
import anndata
67
import numpy as np
7-
from sklearn.utils import check_array
8-
from sklearn.utils.sparsefuncs_fast import inplace_csr_row_normalize_l1
9-
from scipy.io import mmread
10-
from scipy.stats import hypergeom
8+
import phenograph
119
import scipy.sparse as sp_sparse
12-
from scipy.sparse import csr_matrix
1310
import tables
1411
import scanpy as sc
15-
import anndata
12+
from scipy.io import mmread
13+
from scipy.sparse import csr_matrix
14+
from scipy.stats import hypergeom
15+
from sklearn.utils import check_array
16+
from sklearn.utils.sparsefuncs_fast import inplace_csr_row_normalize_l1
1617
from tqdm.auto import tqdm
17-
import phenograph
1818

1919

2020
def load_10x_h5(file, genome):
@@ -346,14 +346,17 @@ def _one_fit(self):
346346
sc.tl.pca(aug_counts, n_comps=self.n_components, random_state=self.random_state)
347347
if self.verbose:
348348
print("Clustering augmented data set...\n")
349-
sc.pp.neighbors(
350-
aug_counts, random_state=self.random_state, method="umap", n_neighbors=10
351-
)
352349
if self.use_phenograph:
353350
fullcommunities, _, _ = phenograph.cluster(
354351
aug_counts.obsm["X_pca"], **self.phenograph_parameters
355352
)
356353
else:
354+
sc.pp.neighbors(
355+
aug_counts,
356+
random_state=self.random_state,
357+
method="umap",
358+
n_neighbors=10,
359+
)
357360
sc.tl.louvain(
358361
aug_counts, random_state=self.random_state, resolution=4, directed=False
359362
)

doubletdetection/plot.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from sklearn.decomposition import PCA
2-
import umap
3-
41
import os
52
import warnings
6-
import numpy as np
7-
from sklearn.utils import check_array
83

94
import matplotlib
5+
import numpy as np
6+
import umap
7+
from sklearn.decomposition import PCA
8+
from sklearn.utils import check_array
109

1110
try:
1211
os.environ["DISPLAY"]

setup.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
setup(
1818
name="doubletdetection",
19-
version="2.5.0",
19+
version="2.5.2",
2020
description="Method to detect and enable removal of doublets from single-cell RNA-sequencing "
2121
"data",
2222
url="https://github.com/JonathanShor/DoubletDetection",
@@ -31,7 +31,11 @@
3131
"scikit-learn",
3232
"tables>=3.4.2",
3333
"umap-learn>=0.3.7",
34-
"matplotlib>=2.2.2",
34+
"matplotlib>=3.1",
3535
"phenograph @ https://api.github.com/repos/JonathanShor/PhenoGraph/tarball/v1.6",
36+
"scanpy>=1.4.4",
37+
"louvain",
38+
"tqdm",
39+
"anndata",
3640
],
3741
)

0 commit comments

Comments
 (0)