from datetime import datetime
"%Y-%m-%d %H:%M:%S") datetime.today().strftime(
'2022-09-25 00:36:28'
Human blastoids provide a readily accessible, scalable, versatile and perturbable alternative to blastocysts for studying early human development, understanding early pregnancy loss and gaining insights into early developmental defects.
from datetime import datetime
"%Y-%m-%d %H:%M:%S") datetime.today().strftime(
'2022-09-25 00:36:28'
import sys
"/Users/jialei/Dropbox/Data/Projects/UTSW/Scripts/utilities")
sys.path.append(
from pathlib import Path
import anndata as ad
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import scipy.sparse
import seaborn as sns
from matplotlib import __version__ as mpl_version
print(sys.version)
print("numpy", np.__version__)
print("pandas", pd.__version__)
print("scipy", scipy.__version__)
print("matplotlib", mpl_version)
print("seaborn", sns.__version__)
3.9.13 | packaged by conda-forge | (main, May 27 2022, 17:00:33)
[Clang 13.0.1 ]
numpy 1.22.4
pandas 1.4.4
scipy 1.9.1
matplotlib 3.5.3
seaborn 0.12.0
= {
params "pdf.fonttype": 42,
"font.family": "sans-serif",
"font.sans-serif": "Arial",
"mathtext.default": "regular",
"figure.dpi": 96 * 1.5,
} plt.rcParams.update(params)
from utilities import (
calc_mt_percentage,
plot_barplot_mt_distribution,
read_10x_matrix, )
= "/Users/jialei/Dropbox/Data/Projects/UTSW/Human_blastoid"
PROJECT_DIR = Path(PROJECT_DIR) PROJECT_DIR
= ["LW36", "LW58", "LW59", "LW60", "LW61"]
batches
= [
scrublet_files "cells_singlet_log_0.235_9129_637.txt",
"cells_singlet_log_0.162_5628_874.txt",
"cells_singlet_log_0.174_5494_626.txt",
"cells_singlet_log_0.196_5512_189.txt",
"cells_singlet_log_0.195_6611_707.txt"
]
= dict()
mt_ratio
for i, j in zip(batches, scrublet_files):
print(i, j)
= read_10x_matrix(
m =PROJECT_DIR / "raw" / i / "filtered_feature_bc_matrix",
data_directory=i,
cell_id_prefix="Gene Expression",
features_selected
)
= [
cells_included + "_" + ii.rstrip().replace("-1", "")
i for ii in open(file=PROJECT_DIR / "raw" / i / "scrublet" / j, mode="r")
]
= ad.AnnData(
adata =m["matrix"].T,
X=pd.DataFrame(m["barcodes"], index=m["barcodes"], columns=["cell"]),
obs=pd.DataFrame(
var"features"], index=m["features"], columns=["features"]
m[
),=np.int64,
dtype
)
= adata[cells_included, :]
adata = calc_mt_percentage(adata.X.T, adata.var.index)
mt_ratio[i]
del m
del adata
LW36 cells_singlet_log_0.235_9129_637.txt
LW58 cells_singlet_log_0.162_5628_874.txt
LW59 cells_singlet_log_0.174_5494_626.txt
LW60 cells_singlet_log_0.196_5512_189.txt
LW61 cells_singlet_log_0.195_6611_707.txt
for i in mt_ratio:
print(i)
= plt.subplots(nrows=1, ncols=1, figsize=(4 * 1, 3 * 1))
fig, ax =mt_ratio[i], ax=ax)
plot_barplot_mt_distribution(x
plt.tight_layout()
plt.show()
=fig) plt.close(fig
LW36
LW58
LW59
LW60
LW61
= ["LW49", "LW50", "LW51", "LW52"] batches
= list()
adatas
for i in batches:
print(i)
= read_10x_matrix(
m =PROJECT_DIR / "raw" / i / "filtered_feature_bc_matrix",
data_directory=i,
cell_id_prefix="Gene Expression",
features_selected
)
= ad.AnnData(
adata =m["matrix"].T,
X=pd.DataFrame(m["barcodes"], index=m["barcodes"], columns=["cell"]),
obs=pd.DataFrame(
var"features"], index=m["features"], columns=["features"]
m[
),=np.int64,
dtype
)
adatas.append(adata)
del m
del adata
LW49
LW50
LW51
LW52
= [
cells_included for i in
i.rstrip() open(PROJECT_DIR
/ "raw"
/ "feeder_cell_detection"
/ "filtered_feature_bc_matrix_scrublet"
/ "clustering"
/ "LW49_LW50_LW51_LW52/cells_included.txt")
]
= ad.concat(adatas)
adata = adata[cells_included, :]
adata adata
View of AnnData object with n_obs × n_vars = 10842 × 33538
obs: 'cell'
= calc_mt_percentage(adata.X.T, adata.var.index)
mt_ratio
= plt.subplots(nrows=1, ncols=1, figsize=(4 * 1, 3 * 1))
fig, ax =mt_ratio, ax=ax)
plot_barplot_mt_distribution(x
plt.tight_layout()
plt.show()
=fig) plt.close(fig
@article{yu,
author = {Leqian Yu and Yulei Wei and Jialei Duan and Daniel A.
Schmitz and Masahiro Sakurai and Lei Wang and Kunhua Wang and Shuhua
Zhao and Gary C. Hon and Jun Wu},
editor = {},
publisher = {Nature Publishing Group},
title = {Blastocyst-Like Structures Generated from Human Pluripotent
Stem Cells},
journal = {Nature},
volume = {591},
number = {7851},
pages = {620 - 626},
date = {},
url = {https://doi.org/10.1038/s41586-021-03356-y},
doi = {10.1038/s41586-021-03356-y},
langid = {en},
abstract = {Human blastoids provide a readily accessible, scalable,
versatile and perturbable alternative to blastocysts for studying
early human development, understanding early pregnancy loss and
gaining insights into early developmental defects.}
}