两年了还是没有R包,所以就得在Linux操作啦,而这在Windows的RStudio操作是满屏的error呀!

先Git clone一下,总是下载不了:git clone https://github.com/edroaldo/cellrouter.git

看来只能弄一下wget直接下载压缩包了,多次尝试都失败,下载的文件不完整:wget https://github.com/edroaldo/cellrouter/archive/master.zip

最终还是git clone搞定,大小也匹配:

https://static-content.springer.com/esm/art%3A10.1038%2Fs41467-018-03214-y/MediaObjects/41467_2018_3214_MOESM14_ESM.txt

先一步一步运行作者的tutorial:

edroaldo/cellrouter: Reconstruction of complex single-cell trajectories using CellRouter

https://github.com/edroaldo/cellrouter

list.of.packages 'reshape',new.packages list.of.packages[!(if(length(new.packages)) install.packages(new.packages, repos=c("http://cran.rstudio.com/", "https://bioconductor.org/biocLite.R"))install.packages("Vennerable", repos="http://R-Forge.R-project.org")

很多包安装失败:

因此自己一个个安装:

if (!requireNamespace("BiocManager", quietly = TRUE))    install.packages("BiocManager")BiocManager::install("")

愣是没搞定,因此sudo R之后继续运行代码:

成功!我安装了三个小时呀!方法错误就是坑爹!

然后继续:

遇到同样的问题,然后作者的意思是版本更新?

于是去看看新的:

cellrouter/CellRouter_Paul_Tutorial.md at master · edroaldo/cellrouter

https://github.com/edroaldo/cellrouter/blob/master/Myeloid_Progenitors/CellRouter_Paul_Tutorial.md

设置工作目录。

缺什么包就安装什么包:

可以运行:

代码的全过程:

在工作目录中,创建一个名为“ results”的文件夹。然后,在文件夹results中,创建一个名为“ paths”的文件夹。

先sudo R以管理员权限进行分析:

#新建文件夹results,然后在results里建立paths文件夹。setwd("/data/yudonglin/Cellrouter/cellrouter/Myeloid_Progenitors")#设置工作目录source('/data/yudonglin/Cellrouter/cellrouter/CellRouter_Class.R')#加载这个CellRouter类,从而能够使用里面的函数library(magrittr) # needs to be run every time you start R and want to use %>%library(dplyr)    # alternatively, this also loads %>%samples 'Paul_Cell_samples.R'))cellrouter 'Paul_Cell_data.R', min.cells=3, min.genes=0)cellrouter 'celltype', metadata.column=cellrouter 'celltype2', metadata.column=## Example regarding how to filter out cells based on a list of variables. This is not used in this tutorial.#mito.genes #percent.mito #cellrouter #cellrouter cellrouter #归一化cellrouter #缩放数据cellrouter #主成分分析build knn graph on the PCA/DC space

plot(cellrouter@pca$sdev, xlab='PC', ylab='Standard deviation of PC')

选择11个主要成分进行tSNE分析。类似于肘部图(碎石图),基于每个主成分对方差解释率的排名。看一个碎石图,看那个点主要在哪个地方没有什么下降趋势。

plotReducedDimension(cellrouter, reduction.type = 'tsne', dims.use = c(1,2), annotation = "celltype", annotation.color = 'celltype_color', showlabels = TRUE, 4.5, 3.5, filename='results/tSNE_1.pdf')

plotReducedDimension(cellrouter, reduction.type = 'pca', dims.use = c(1,2), annotation = "celltype", annotation.color = 'celltype_color', showlabels = FALSE, 4.5, 3.5, filename='results/PCA_1.pdf')

plotReducedDimension(cellrouter, reduction.type = 'tsne', dims.use = c(1,2), annotation = "celltype2", annotation.color = 'celltype2_color', showlabels = TRUE, 4.5, 3.5, filename='results/tSNE_2.pdf')

plotReducedDimension(cellrouter, reduction.type = 'pca', dims.use = c(1,2), annotation = "celltype2", annotation.color = 'celltype2_color', showlabels = FALSE, 4.5, 3.5, filename='results/PCA_2.pdf')

plotReducedDimension(cellrouter, reduction.type = 'dr.custom', dims.use = c(1,2), annotation = "celltype2", annotation.color = 'celltype2_color', showlabels = FALSE, 4.5, 3.5, filename='results/custom_1.pdf')

在xshell运行成功,只是不能直接展示,但是有输出的文件。

### signatures based on sorted populationsmarkers "celltype", pos.only = TRUE, fc.threshold = 

top10 <- markers %>% group_by(population) %>% top_n(10, fc)filename <- 'results/heatmap_top_10_genes_sorted_populations.png'plotSignaturesHeatmap(cellrouter, markers = top10, column.ann = 'celltype', column.color = 'celltype_color', threshold = 2, width = 7, height = 7, filename=filename)

### signatures based on clusters identified by Paul et al.markers <- findSignatures(cellrouter, column = "celltype2", pos.only = TRUE, fc.threshold = 0.5)top10 <- markers %>% group_by(population) %>% top_n(10, fc)filename <- 'results/heatmap_top_10_genes_original_clusters.png'plotSignaturesHeatmap(cellrouter, markers = top10, column.ann = 'celltype2', column.color = 'celltype2_color', num.cells = 100, threshold = 3, width = 15, height = 12, filename=filename)

#Graph-based clustering基于图的聚类cellrouter <- findClusters(cellrouter, method="graph.clustering", num.pcs=15, k=20)plotReducedDimension(cellrouter, reduction.type = 'tsne', annotation="population", annotation.color = 'colors',showlabels = TRUE, width = 4.5, height = 3.5, filename='results/tSNE_graphClustering_clusters.pdf')

#model-based clustering基于模型的聚类cellrouter <- findClusters(cellrouter, method='model.clustering', num.pcs = 15)plotReducedDimension(cellrouter, reduction.type = 'tsne', annotation="population", annotation.color = 'colors',showlabels = TRUE, width = 4.5, height = 3.5, filename='results/tSNE_modelClustering_clusters.pdf')

##Signatures based on clusters identified by CellRoutermarkers <- findSignatures(cellrouter, column = 'population', pos.only = TRUE, fc.threshold = 0.5)filename <- 'results/heatmap_all_genes_CellRouter_clusters.png' #select how many cells to plot as well!plotSignaturesHeatmap(cellrouter, markers, column.ann = 'population', column.color  = 'colors', num.cells=100, threshold =  2.5, width = 15, height = 13, filename = filename)

top10 <- markers %>% group_by(population) %>% top_n(10, fc)filename <- 'results/heatmap_top_10_genes_CellRouter_clusters.png' #select how many cells to plot as well!plotSignaturesHeatmap(cellrouter, top10, column.ann = 'population', column.color  = 'colors', threshold =  2.5, width = 15, height = 13, filename = filename)

#用CellRouter开始轨迹分析libdir '/data/yudonglin/Cellrouter/cellrouter/CellRouter/'#Trajectories can be identified between clusters identified by Paul et al using:cellrouter 10, column.ann = plotKNN(cellrouter, reduction.type = 'tsne', column.ann = 'celltype2', column.color = 'celltype2_color', width = 5, height = 4, filename='results/knn_tsne_original_clusters.pdf')

暂时安装失败。

plotReducedDimension(cellrouter, reduction.type = 'tsne', annotation="celltype2", annotation.color = 'celltype2_color',showlabels = TRUE, width = 4.5, height = 3.5, filename='results/tSNE_original_clusters.pdf')

filename "results/paths/cell_edge_weighted_network.txt"write.table(cellrouter@graph$edges, file=filename, sep='\t', row.names=FALSE, col.names = FALSE, quote=FALSE) #input network#Select population 6. Change sources and targets accordingly, depending on the annotation used (celltype, celltype2 or population, for example)sources '6')targets as.vector(cellrouter@sampTab$population), sources)methods "euclidean", ##Identify trajectoriescellrouter 'population', libdir, paste(getwd(), 

library(igraph)#Preprocess trajectoriesranks 'path_cost', cellrouter 3], num.cells = 

names @pathsinfo##Identify genes regulated along each trajectory (up or down-regulated)cellrouter 'spearman')cellrouter 0.

cellrouter cellrouter 5)save(cellrouter, file='results/CellRouter_Processed.R')

#Create gene regulatory networkgrn.data <- buildGRN(cellrouter, species = 'Mm', genes.use = rownames(cellrouter@ndata), zscore = 5, filename = 'results/GRN.R')#plot clusters of kinetic changes along trajectoriesplotClusterHeatmap(cellrouter, names, 10, 10, 2, 'results/dynamics.pdf')

#Transition from 6.2 in the enrythroid branchplotClusters(cellrouter, names[2], 2, 400, 450, 'results/cluster_dynamics.png')

#Erythroid branch (transition from cluster 6 to 2)cellrouter@top.correlations包含与每个轨迹高度相关或反相关的基因genelist 'Gata2', plottrajectories(cellrouter, '6.2', genelist, rescale = TRUE, columns=1, width=5, height=2, filename='results/dynamics_curve.pdf')

plotPathHeatmap(cellrouter, c('6.2'), genelist, 2, 4, 2, 'results/')

plotDRExpression(cellrouter, genelist, reduction.type='tsne',title="tsne", columns = 4, width=6, height=3, filename='results/tsne_selected_genes_known_Ery.pdf')

#GMP branch (transition from cluster 6 to 7)genelist 'Mpo', plottrajectories(cellrouter, '6.7', genelist, rescale = TRUE, columns=1, width=5, height=2, filename='results/dynamics_curve.pdf')

plotPathHeatmap(cellrouter, c('6.7'), genelist, 2, 4, 2, 'results/')
plotDRExpression(cellrouter, genelist, reduction.type='tsne', columns = 4, width=6, height=3, title="tsne",filename='results/tsne_selected_genes_known_GMP.pdf')

plotbranch(cellrouter, 'up','6.2', '6.7', 1, width=3, height=4, filename='results/6.2_6.7_branch_dynamics.png')

grn.data 'results/GRN.R'))transitions '6.1',grn.scores 'both', flip=               dir.targets='up', columns=2, width=5, height=7, filename='results/GRN_scores')

library('geomnet')p '6.2'plottr(cellrouter, p, grn.scores[[p]]$scores, cluster=FALSE, 2, 4.5, 5.5, paste('results/', p, 'Regulators_6.2_transition.pdf',sep=''))

regulators 'Sphk1',nets1 $GRN,regulators, 

暂时安装不了这个包。

#dynamics of regulators along the transistion from cluster 6 to cluster 7 (GMP branch).p '6.7'plottr(cellrouter, p, grn.scores[[p]]$scores, cluster=FALSE, 2, 4.5, 5.5, paste('results/', p, 'Regulators_6.2_transition.pdf',sep=''))

regulators 'Gfi1', nets2 $GRN,regulators, 

由于这个包安装不了,所以没有结果。

大部分结果都重复出来啦~

参考资料:

master·edroaldo/cellrouter/ CellRouter_Paul_Tutorial.md

https://github.com/edroaldo/cellrouter/blob/master/Myeloid_Progenitors/CellRouter_Paul_Tutorial.md

sql的的over不能和group by一起使用吧_CellRouter的使用相关推荐

  1. 一道SQL语句面试题,关于group by

    一道SQL语句面试题,关于group by 表内容:2005-05-09 胜 2005-05-09 胜 2005-05-09 负 2005-05-09 负 2005-05-10 胜 2005-05-1 ...

  2. 【4 - 分组】Sql Server - 郝斌(分组group by、过滤having、聚合函数max() / count()、排序order by、select语句的执行顺序)

    课程地址:数据库 SQLServer 视频教程全集(99P)| 22 小时从入门到精通_哔哩哔哩_bilibili ​ 目录 group by(分组) group by a,b 的用法 having( ...

  3. SQL 聚合函数一定要跟group by以及NULL的关系的案例精讲

    SQL 聚合函数与GROUP BY NULL的关系及ALL的使用说明 需求说明 有如下一道SQL题,网友咨询: 1 为啥正确答案是第二项? 2 聚合函数是否一定要跟GROUP BY PARTITION ...

  4. 【SQL】分组数据,过滤分组-group by , having

    学习笔记,原文来自http://blog.csdn.net/robinjwong/article/details/24845125 创建分组 - GROUP BY 分组是在SELECT语句的GROUP ...

  5. sql注入语句示例大全_SQL Group By语句用示例语法解释

    sql注入语句示例大全 GROUP BY gives us a way to combine rows and aggregate data. GROUP BY为我们提供了一种合并行和汇总数据的方法. ...

  6. sql的sum函数(与group by,having子句混合使用)

    SELECT Customer,SUM(OrderPrice) FROM Orders WHERE Customer='Bush' OR Customer='Adams' GROUP BY Custo ...

  7. Excel 2010 SQL应用117 分组统计之GROUP BY 与First

    目录 数据源 解决方案 GROUP BY+FIRST函数+LAST函数的使用 数据源 单位编号 拨款月 享受月份 姓名 性别 个人编码 医保卡号 退款总额 基本 补充 补助 异地城市 TCC1001 ...

  8. 当一个SQL语句同时出现了where,group by,having,order by的时候,执行顺序和编写顺序...

    当一个查询语句同时出现了where,group by,having,order by的时候,执行顺序和编写顺序 1.执行where xx对全表数据做筛选,返回第1个结果集. 2.针对第1个结果集使用g ...

  9. Excel 2010 SQL应用116 分组统计之GROUP BY续

    目录 源数据表 解决方案一IIF 解决方案二CHOOSE 解决方案三PARTITION 源数据表 学号 姓名 性别 得分 A0001 卢本导 男 88 A0002 林志雄 男 65 A0003 林雅仪 ...

最新文章

  1. HR收到Dota天梯2000分玩家的简历,给不给面试的机会呢?
  2. 最短JS判断是否为IE6(IE的写法)
  3. torch cpu版加载权重
  4. InnoDB多版本控制实现
  5. Android-6步教你自定义View
  6. 怎么进行数据平滑滤波_气相色谱数据处理方法 EWG1990仪器学习网
  7. 解构里面再次解构_解构后的咖啡:焙炒,研磨和分层,以获得更浓的意式浓缩咖啡
  8. 利用对象池优化数据库操作
  9. Python-Flask构建微信小程序订餐系统-Flask打造高可用flask mvc框架-08
  10. 你该怎么去学软件测试,过来人告诉你
  11. Java和Go的GC差异
  12. 前端想要了解的Nginx
  13. 转载:Windows Phone 7 资源汇总(超全)
  14. 2021-08-06MATLAB深度学习简单应用
  15. WAP PUSH的SMS PDU解析
  16. 谷歌生物医学专用翻译_翻译软件的六大测评,请专家来支招
  17. Linux驱动开发|PWM驱动
  18. 网站html源代码如何修改,如何修改网页源代码
  19. MapKit框架的使用
  20. 家用空调什么牌子好又省电质量又好

热门文章

  1. Spring Boot和SSM本质上的区别
  2. 校招生大规模涨薪、再扩招10000人?大厂抢人有多野?
  3. 从Nacos客户端视角来分析一下配置中心实现原理
  4. Java如何实现后端分页
  5. UP及按照UP进行软件开发的流程
  6. Springboot自动配置原理入门
  7. Spring框架----代理的分析
  8. 必知必会SQL(贰) --索引(聚集[簇]索引和非聚[簇]集索引) vs 全文本索引
  9. 20190501-整数翻转
  10. Android组件系列-----Activity保存状态