未提供项目说明

pyVIA的Python项目详细描述


通过

VIA是一种轨迹推断(TI)方法,它提供拓扑结构、伪时间、自动终端状态预测和沿谱系的时间基因动态自动绘图。VIA结合了延迟传送随机游动和蒙特卡罗马尔可夫链模拟,以克服常见的挑战,如1)精确的终端状态和血统推断,2)捕获循环、断开和树状结构组合的能力,3)特征和样本空间的可扩展性。在

入门

使用pip安装

我们建议设置一个新的conda环境

conda create --name ViaEnv pip 
pip install pyVIA // tested on linux

通过克隆存储库并运行设置.py(确保安装了依赖项)

^{pr2}$

如果需要,单独安装依赖项(linux)

如果pip安装不起作用,通常只需先安装所有需求(使用pip),然后再通过(同样使用pip)进行安装 我们注意到最新版本的leidenalg(0.8.0。发布于2020年4月)比它的前任慢。请确保安装的leidenalg暂时是0.7.0版本。一些示例使用umap和/或phate,因此我们在下面对其进行说明

pip install python-igraph, leidenalg==0.7.0, hnswlib, umap-learn, numpy>=1.17, scipy, pandas>=0.25, sklearn, termcolor, pygam, phate
pip install pyVIA

示例

人胚状体

Raw data矩阵另存为'电子数据表'. 此文件中的单元格已被Moon et al. 2019筛选为太小/太大的库

函数main_EB_clean()预处理单元(通过库大小、sqrt转换进行规范化)。然后它调用VIA来:绘制伪时间、终端状态、谱系路径和基因簇图。在

import pyVia.core as via
via.main_EB_clean(ncomps=30, knn=20, p0_random_seed=20, foldername = '') # Most reasonable parameters of ncomps (10-200) and knn (15-50) work well

如果希望使用UMAP或tsne运行数据,或需要对参数/输出进行更多控制,请使用以下代码:

import pyVia.core as via
#pre-process the data as needed and provide to via as a numpy array
#root_user is the index of the cell corresponding to a suitable start/root cell

v0 = via.VIA(input_data, time_labels, jac_std_global=0.15, dist_std_local=1, knn=knn,too_big_factor=p0_too_big, 
root_user=1, dataset='EB', random_seed=p0_random_seed, do_magic_bool=True, is_coarse=True, preserve_disconnected=True) 
v0.run_VIA()

tsi_list = get_loc_terminal_states(v0, input_data) #translate the terminal clusters found in v0 to the fine-grained run in v1

v1 = VIA(input_data, time_labels, jac_std_global=0.15, dist_std_local=1, knn=knn,
             too_big_factor=v1_too_big,super_cluster_labels=p0.labels, super_node_degree_list=v0.node_degree_list,
             super_terminal_cells=tsi_list, root_user=1,x_lazy=0.99, alpha_teleport=0.99, preserve_disconnected=True, dataset='EB',
             super_terminal_clusters=v0.terminal_clusters, random_seed=p0_random_seed)
v1.run_VIA()

#Plot the true and inferred times and pseudotimes
#Replace Y_phate with UMAP, TSNE embedding
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.scatter(Y_phate[:, 0], Y_phate[:, 1], c=time_labels, s=5, cmap='viridis', alpha=0.5)
ax2.scatter(Y_phate[:, 0], Y_phate[:, 1], c=p1.single_cell_pt_markov, s=5, cmap='viridis', alpha=0.5)
ax1.set_title('Embyroid Data: Days')
ax2.set_title('Embyroid Data: Randomseed' + str(p0_random_seed))
plt.show()

#obtain the single-cell locations of the terminal clusters to be used for visualization of trajectories/lineages 
super_clus_ds_PCA_loc = via.sc_loc_ofsuperCluster_PCAspace(v0, v1, np.arange(0, len(v1.labels)))
#draw the overall lineage paths on the embedding
via.draw_trajectory_gams(Y_phate, super_clus_ds_PCA_loc, p1.labels, v0.labels, v0.edgelist_maxout,
                     v1.x_lazy, v1.alpha_teleport, v1.single_cell_pt_markov, time_labels, knn=v0.knn,
                     final_super_terminal=v1.revised_super_terminal_clusters,
                     sub_terminal_clusters=v1.terminal_clusters,
                     title_str='Markov Hitting Times (Gams)', ncomp=ncomps)

2D_knn_hnsw = via.make_knn_embeddedspace(Y_phate)
#draw the individual lineage paths and cell-fate probabilities at single-cell level 
via.draw_sc_evolution_trajectory_dijkstra(v1, Y_phate, 2D_knn_hnsw, v0.full_graph_shortpath,
                                      idx=np.arange(0, input_data.shape[0]), X_data=input_data)

plt.show()

Output of VIA on Human Embryoid

玩具数据(多重购买和断开连接)

使用DynToy生成了两个带有注释的示例toy datasets。在

import pyVia.core as via
via.main_Toy(ncomps=10, knn=30,dataset='Toy3', random_seed=2,foldername = ".../Trajectory/Datasets/") #multifurcation
via.main_Toy(ncomps=10, knn=30,dataset='Toy4',random_seed=2,foldername =".../Trajectory/Datasets/") #2 disconnected trajectories

多源玩具数据集的输出

Output of VIA on Human Embryoid

断开连接的玩具数据集的输出

Output of VIA on Human Embryoid

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
JFrame中的Java多线程   java Servlet异常映射   java无法从输出流读取   swing Java带来的小程序GUI问题   java什么原因导致错误“'void'类型此处不允许”以及如何修复它?   Java选择器select(长)与selectNow的区别   java自定义arraylist<mygames>获得不同   java Icepdf注释让页面消失   java反向整数数组   java I在生成同步“无法解析配置的所有依赖项”时遇到此错误:app:debugRuntimeClasspath   多个虚拟机上的java线程访问单个DB实例上的表,有时会导致性能低下和异常   swing更改Java中的默认按钮,使其看起来“更好”   java慢速MQ主题订阅。并行化不能提高性能   java运行Boggle Solver需要一个多小时。我的代码怎么了?   数据库中的java循环与应用程序中的java循环   正则表达式匹配${123…456}并在Java中提取2个数字?   java如何制作我们软件的试用版   Java内存参数计算   从另一个类调用方法时出现java问题