-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
143 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
__module_name__ = "setup.py" | ||
__doc__ = """PYPI package distribution setup.""" | ||
__author__ = ", ".join(["Michael E. Vinyard"]) | ||
__email__ = ", ".join(["[email protected]"]) | ||
__email__ = ", ".join(["[email protected]"]) | ||
|
||
|
||
# -- import packages: ---------------------------------------------------------- | ||
|
@@ -15,10 +15,10 @@ | |
# -- run setup: ---------------------------------------------------------------- | ||
setuptools.setup( | ||
name="torch-adata", | ||
version="0.0.23", | ||
version="0.0.24rc0", | ||
python_requires=">3.9.0", | ||
author="Michael E. Vinyard", | ||
author_email="mvinyard@g.harvard.edu", | ||
author_email="mvinyard[email protected]", | ||
url=None, | ||
long_description=open("README.md", encoding="utf-8").read(), | ||
long_description_content_type="text/markdown", | ||
|
@@ -28,11 +28,15 @@ | |
"anndata>=0.9.1", | ||
"licorice_font>=0.0.3", | ||
"lightning>=2.0.1", | ||
"torch>=2.0", | ||
"torch>=2.0", | ||
"numpy==1.24", | ||
"scanpy==1.9.3", | ||
"scikit-learn==1.2.2", | ||
"webfiles", | ||
], | ||
classifiers=[ | ||
"Development Status :: 2 - Pre-Alpha", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.9", | ||
"Intended Audience :: Science/Research", | ||
"Topic :: Scientific/Engineering :: Bio-Informatics", | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
|
||
from ._plot_umap import PlotUMAP | ||
from ._plot_umap import PlotUMAP | ||
from ._pbmc_3k import PBMC3k | ||
from ._larry import LARRY | ||
from ._demo_data import DemoData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
|
||
|
||
from .. import _utils as utils | ||
from ._pbmc_3k import PBMC3k | ||
from ._larry import LARRY | ||
|
||
|
||
class DemoData(utils.ABCParse): | ||
def __init__(self): | ||
"""""" | ||
|
||
@property | ||
def PBMC3k(self): | ||
if not hasattr(self, "_pbmcs"): | ||
self._pbmcs = PBMC3k() | ||
else: | ||
self._pbmcs.plot() | ||
return self._pbmcs.adata | ||
|
||
@property | ||
def LARRY(self): | ||
if not hasattr(self, "_larry"): | ||
self._larry = LARRY() | ||
else: | ||
self._larry.plot() | ||
return self._larry.adata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
|
||
import vinplots | ||
import anndata | ||
import os | ||
import web_files | ||
|
||
from .. import _utils as utils | ||
from ._plot_umap import PlotUMAP | ||
|
||
class LARRY(utils.ABCParse): | ||
_HTTP_ADDRESS = "https://figshare.com/ndownloader/files/38171943" | ||
|
||
def __init__(self, filename="adata.LARRY.h5ad", data_dir="data", silent=False): | ||
self._config(locals()) | ||
|
||
def _config(self, kwargs): | ||
"""""" | ||
|
||
self.__parse__(kwargs, public=[None]) | ||
|
||
self._INFO = utils.InfoMessage() | ||
|
||
if not os.path.exists(self._data_dir): | ||
os.mkdir(self._data_dir) | ||
|
||
def _download(self): | ||
msg = "Downloading {:.<10}...".format(self._filename) | ||
self._INFO(msg, end=" ") | ||
f = web_files.WebFile( | ||
http_address=self._HTTP_ADDRESS, | ||
local_path=self.local_path, | ||
) | ||
f.download() | ||
print("Done.") | ||
|
||
@property | ||
def local_path(self): | ||
return os.path.join(self._data_dir, self._filename) | ||
|
||
@property | ||
def adata(self): | ||
if not hasattr(self, "_adata"): | ||
if not os.path.exists(self.local_path): | ||
self._download() | ||
self._adata = anndata.read_h5ad(self.local_path) | ||
self._adata.uns["cmap"] = vinplots.colors.LARRY_in_vitro | ||
if not self._silent: | ||
print(self._adata) | ||
self.plot() | ||
return self._adata | ||
|
||
def plot(self): | ||
umap_plot = PlotUMAP( | ||
self._adata, title="LARRY hematopoiesis" | ||
) | ||
umap_plot(groupby="Cell type annotation") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
# -- import packages: -------------------------------------------------------- | ||
import scanpy as sc | ||
import pandas as pd | ||
import vinplots | ||
|
||
|
||
from .. import _utils as utils | ||
from ._plot_umap import PlotUMAP | ||
|
||
class PBMC3k(utils.ABCParse): | ||
def __init__(self, silent=False): | ||
self.__parse__(locals(), public=[None]) | ||
|
||
def _configure(self): | ||
_adata = sc.datasets.pbmc3k_processed() | ||
cell_type_df = pd.DataFrame(_adata.obs["louvain"].unique()).reset_index() | ||
cell_type_df.columns = ["cell_type_idx", "louvain"] | ||
df_obs = _adata.obs.merge(cell_type_df, on="louvain", how="left") | ||
df_obs.index = df_obs.index.astype(str) | ||
_adata.obs = df_obs | ||
_adata.uns["cmap"] = vinplots.colors.pbmc3k | ||
return _adata | ||
|
||
@property | ||
def adata(self): | ||
if not hasattr(self, "_adata"): | ||
self._adata = self._configure() | ||
if not self._silent: | ||
print(self._adata) | ||
self.plot() | ||
return self._adata | ||
|
||
def plot(self): | ||
umap_plot = PlotUMAP( | ||
self._adata, title="10x PBMCs (~3k cells)" | ||
) | ||
umap_plot(groupby="louvain") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters