Skip to content

Commit

Permalink
Merge pull request #224 from aristoteleo/dzhu_dev
Browse files Browse the repository at this point in the history
Merging Daniel's developmental branch
  • Loading branch information
dzhu8 authored Feb 7, 2024
2 parents 341d023 + 42baf3e commit 951b711
Show file tree
Hide file tree
Showing 94 changed files with 371,614 additions and 734,183 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
spateo/tools/database/human_GRN.csv filter=lfs diff=lfs merge=lfs -text
spateo/tools/database/mouse_GRN.csv filter=lfs diff=lfs merge=lfs -text
26 changes: 0 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,6 @@
[Installation](https://spateo-release.readthedocs.io/en/latest/installation.html) - [Tutorials](https://spateo-release.readthedocs.io/en/latest/tutorials/index.html) - [API](https://spateo-release.readthedocs.io/en/latest/autoapi/spateo/index.html) - [Citation](https://www.biorxiv.org/content/10.1101/2022.12.07.519417v1) - [Technical](https://spateo-release.readthedocs.io/en/latest/technicals/index.html)
# Installation Notes
A few notes on installation: Spateo utilizes the `mpi4py` package and a working MPI implementation.
This can be most easily installed by first using `conda`. There are three options for MPI implementation:
1. OpenMPI (Linux and macOS)
2. MPICH (Linux and macOS)
3. Microsoft MPI (Windows)
To use MPICH:
```
conda install -c conda-forge mpich
```
To use OpenMPI:
```
conda install -c conda-forge openmpi
```
To use Microsoft MPI:
```
conda install -c conda-forge msmpi
```
On Linux, this can also be achieved using `sudo apt-get install libopenmpi-dev` or `sudo apt-get install mpich`.
mpi4py can also be installed at this time using the same command, however the version Spateo uses may differ from
the most current version.
# Citation
Xiaojie Qiu1$\*, Daniel Y. Zhu3$, Jiajun Yao2, 4, 5, 6$, Zehua Jing2, 4,7$, Lulu Zuo8$, Mingyue Wang2, 4, 9, 10$, Kyung Hoi (Joseph) Min11, Hailin Pan2, 4, Shuai Wang2, 4, 7, Sha Liao4, Yiwei Lai4, Shijie Hao2, 4, 7, Yuancheng Ryan Lu1, Matthew Hill17, Jorge D. Martin-Rufino17, Chen Weng1, Anna Maria Riera-Escandell18, Mengnan Chen2, 4, Liang Wu4, Yong Zhang4, Xiaoyu Wei2, 4, Mei Li4, Xin Huang4, Rong Xiang2, 4, 7, Zhuoxuan Yang4, 12, Chao Liu4, Tianyi Xia4, Yingxin Liang10, Junqiang Xu4,7, Qinan Hu9, 10, Yuhui Hu9, 10, Hongmei Zhu8, Yuxiang Li4, Ao Chen4, Miguel A. Esteban4, Ying Gu2, 4,7, Douglas A. Lauffenburger3, Xun Xu2, 4, 13, Longqi Liu2, 4, 14, 15\*, Jonathan S. Weissman1,19, 20\*, Shiping Liu2, 4, 14, 15, 16\*, Yinqi Bai2, 4\* $Co-first authors; *:Corresponding authors
Expand Down
28 changes: 0 additions & 28 deletions docs/extensions/typed_returns.py

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
adjustText
anndata>=0.8.0
colorcet>=2.0.1
cvxopt>=1.2.3
Expand Down Expand Up @@ -25,6 +26,7 @@ pandas>=0.25.1
paste-bio>=1.4.0
plotly>=5.1.0
POT>=0.8.1
psutil>=5.6.3
pynndescent>=0.4.8
pysal>=1.14.4
pyro-ppl
Expand Down
4 changes: 4 additions & 0 deletions spateo/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
from .errors import ConfigurationError
from .logging import logger_manager as lm

# Global tolerance value:
EPS = np.finfo(float).eps
MAX = np.finfo(np.float32).max


class SpateoConfig:
def __init__(
Expand Down
2 changes: 0 additions & 2 deletions spateo/digitization/boundary_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def identify_boundary(
min_area=30,
dilate_k_size: int = 3,
):

lm.main_info(f"Setting up source and target area.")
adata_tmp = adata.copy()
adata_tmp.obs["tmp_boundary"] = 0
Expand Down Expand Up @@ -88,7 +87,6 @@ def boundary_gridding(
spatial_key: str = "spatial",
init: bool = False,
):

bdl_seg_inner_list = []
bdl_seg_outer_list = []

Expand Down
4 changes: 0 additions & 4 deletions spateo/digitization/utils_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ def fill_grid_label(
column_label_key: str = "column_label",
init: bool = False,
):

# mask image should be 2 pixels wider and higher, according to cv2.floodFill
layer_grid_img = seg_grid_img.copy()
layer_mask = np.zeros((layer_grid_img.shape[0] + 2, layer_grid_img.shape[1] + 2), dtype=np.uint8)
Expand Down Expand Up @@ -104,7 +103,6 @@ def draw_seg_grid(
gridline_width=1,
mode="grid",
):

seg_grid_img = np.zeros_like(boundary_line_img, dtype=np.uint8)

if len(bdl_seg_coor_x) != len(bdl_seg_coor_y):
Expand Down Expand Up @@ -187,7 +185,6 @@ def extend_layer(
boundary_line_list,
extend_width=10,
):

lm.main_info(f"Generating layer area.")
extend_layer_mask = np.zeros_like(boundary_line_img, dtype=np.uint8)
extend_layer_img = np.zeros_like(boundary_line_img, dtype=np.uint8)
Expand Down Expand Up @@ -226,7 +223,6 @@ def field_contour_line(
min_pnt,
max_pnt,
):

ctr_seq_rev = ctr_seq[::-1].copy()
min_idx = ctr_seq.index(min_pnt)
max_idx = ctr_seq.index(max_pnt) + 1
Expand Down
2 changes: 1 addition & 1 deletion spateo/io/nanostring.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from ..configuration import SKM
from ..logging import logger_manager as lm
from .utils import get_points_props
from .utils import bin_indices, get_bin_props, get_points_props

try:
import ngs_tools as ngs
Expand Down
3 changes: 2 additions & 1 deletion spateo/io/slideseq.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""IO functions for Slide-seq technology.
"""
from typing import List, NamedTuple, Optional, Union
from typing import NamedTuple, Optional

import numpy as np
import pandas as pd
Expand All @@ -10,6 +10,7 @@

from ..configuration import SKM
from ..logging import logger_manager as lm
from .utils import bin_indices, get_bin_props

try:
import ngs_tools as ngs
Expand Down
2 changes: 1 addition & 1 deletion spateo/io/tenx.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def read_10x(matrix_dir: str, positions_path: str, version: Literal["visium"] =
SKM.init_adata_type(adata, SKM.ADATA_UMI_TYPE)
SKM.init_uns_pp_namespace(adata)
SKM.init_uns_spatial_namespace(adata)
SKM.set_uns_spatial_attribute(adata, SKM.UNS_SPATIAL_BINSIZE_KEY, binsize)
# SKM.set_uns_spatial_attribute(adata, SKM.UNS_SPATIAL_BINSIZE_KEY, binsize)
SKM.set_uns_spatial_attribute(adata, SKM.UNS_SPATIAL_SCALE_KEY, scale)
SKM.set_uns_spatial_attribute(adata, SKM.UNS_SPATIAL_SCALE_UNIT_KEY, scale_unit)
return adata
7 changes: 3 additions & 4 deletions spateo/plotting/interactive/agg.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
"""Interactive plotting functions for aggregated UMI counts.
"""
from typing import Dict, List, Optional, Tuple, Union
from typing import List, Optional, Tuple, Union

import anndata
import cv2
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import plotly.graph_objects as go
from anndata import AnnData
from matplotlib.axes import Axes
from matplotlib.figure import Figure
from matplotlib.widgets import PolygonSelector
from skimage.color.colorlabel import DEFAULT_COLORS, color_dict
from typing_extensions import Literal
from skimage.color.colorlabel import DEFAULT_COLORS

from ...configuration import SKM
from ...errors import PlottingError
Expand Down
1 change: 0 additions & 1 deletion spateo/plotting/static/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from .align import multi_slices
from .bbs import delaunay, polygon
from .colorlabel import color_label
from .contour import spatial_domains
from .dotplot import dotplot
from .geo import geo
from .glm import glm_fit, glm_heatmap
Expand Down
43 changes: 43 additions & 0 deletions spateo/plotting/static/colorlabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,3 +280,46 @@ def color_label(
"#A4E804",
"#324E72",
]

# D. Zhu's color scheme for categorical data- used in plotting interaction-related things:
interaction_colors = [
"#FF0000", # Red
"#FF69B4", # Hot Pink
"#FFF68F", # Khaki
"#FF8C00", # Dark Orange
"#C71585", # Medium Violet Red
"#00CED1", # Dark Turquoise
"#1874CD", # Dodger Blue
"#8B4726", # Saddle Brown
"#9400D3", # Dark Violet
"#00C957", # Medium Spring Green
"#8EE5EE", # Sky Blue
"#CDC673", # Dark Khaki
"#7CFC00", # Lawn Green
"#8A2BE2", # Blue Violet
"#FFD700", # Gold
"#FF1493", # Deep Pink
"#008000", # Green
"#4682B4", # Steel Blue
"#B22222", # Fire Brick
"#FF00FF", # Magenta
"#32CD32", # Lime Green
"#1E90FF", # Dodger Blue
"#FFD700", # Gold
"#9AFF9A", # Pale Green
"#EE0000", # Crimson
"#808080", # Gray
"#C1FFC1", # Light Green
"#B22222", # Fire Brick
"#FFFF00", # Yellow
"#FFFFFF", # White
"#FA8072", # Salmon
"#FFC1C1", # Light Pink
"#836FFF", # Medium Slate Blue
"#FF4500", # Orange Red
"#698B22", # Olive Drab
"#7CCD7C", # Pale Green
"#C6E2FF", # Powder Blue
"#FFA500", # Orange
"#00FFFF", # Cyan
]
68 changes: 0 additions & 68 deletions spateo/plotting/static/contour.py

This file was deleted.

Loading

0 comments on commit 951b711

Please sign in to comment.