美文网首页
跟着Nature Communications学作图:R语言ph

跟着Nature Communications学作图:R语言ph

作者: 小明的数据分析笔记本 | 来源:发表于2022-04-24 17:28 被阅读0次

    论文

    Microbiome differential abundance methods produce different results across 38 datasets

    数据链接

    https://figshare.com/articles/dataset/16S_rRNA_Microbiome_Datasets/14531724

    代码链接

    https://github.com/nearinj/Comparison_of_DA_microbiome_methods

    这个人的github主页还有其他论文的数据和代码

    https://github.com/jnmacdonald/differential-abundance-analysis 这个链接有很多关于差异丰度分析的代码

    今天的推文我们重复一下论文中的Figure1b

    image.png

    首先是读取数据集

    热图数据集

    order_raw_count_df<-read.csv(file = "20220424/Figure1_filt_sig_counts.csv",
                                 row.names = 1,
                                 check.names = FALSE)
    order_raw_count_df
    

    他这里的处理方式是把数据集标准化以后映射颜色,然后添加数字标签展示真实的数据

    热图数据标准化

    Alpha_order_filt<-scale(order_raw_count_df,
                            center = TRUE,
                            scale = TRUE)
    

    读取注释数据

    fixed_hackathon_metadata_filt<-read.csv(file = "20220424/Figure1_filt_dataset_char.csv",
                                            row.names = 1,
                                            check.names = FALSE)
    fixed_hackathon_metadata_filt
    

    作图代码

    library(pheatmap)
    
    pheatmap(t(Alpha_order_filt),
             clustering_method = "complete",
             legend=TRUE,
             display_numbers=t(order_raw_count_df),
             annotation_row=fixed_hackathon_metadata_filt[, c("log(Sample size)", "log(Aitch. dist. effect size)", 
                                                              "Sparsity", "Richness", "Read depth variation", 
                                                              "log(Read depth range)"), drop=FALSE],
             annotation_legend=FALSE,
             legend_labels = "% sig. features",
             treeheight_col = 0,
             cluster_cols = FALSE,
             cluster_rows = TRUE,
             main="Filtered",
             angle_col=315)
    
    image.png

    今天推文的示例数据和代码可以在公众号后台回复20220424获取

    欢迎大家关注我的公众号

    小明的数据分析笔记本

    小明的数据分析笔记本 公众号 主要分享:1、R语言和python做数据分析和数据可视化的简单小例子;2、园艺植物相关转录组学、基因组学、群体遗传学文献阅读笔记;3、生物信息学入门学习资料及自己的学习笔记!

    相关文章

      网友评论

          本文标题:跟着Nature Communications学作图:R语言ph

          本文链接:https://www.haomeiwen.com/subject/lmityrtx.html