库(NanoMethViz)

为了使用这个包,你的数据必须从甲基化软件调用的输出转换为一个tabix索引bgzipped格式。数据需要按照基因组排序位置尊重samtools的要求tabix索引的工具。在Linux上使用bash和macOS系统这样做排序实用程序,内存有效,但在Windows上这是通过加载整个表在R和排序。

我们目前支持的输出

如果你想进一步支持其他格式,请创建一个问题https://github.com/Shians/NanoMethViz/issues

数据的例子

转换可以使用完成create_tabix_file ()函数。我们提供示例数据中的nanopolish输出包中,我们可以看到里面的数据看起来nanopolish出来

methy_calls < -系统。文件(包= " NanoMethViz " c (“sample1_nanopolish.tsv。广州”、“sample2_nanopolish.tsv.gz”) #看看前十行methy_data methy_calls_example < -阅读。表(methy_calls [1], 9 = " \ t”,标题= TRUE, nrows = 6) methy_calls_example
# #染色体链开始结束read_name # # 1 chr1 - 127732476 127732476 e648c4e3 ca6a - 4671 af17 - 86 dab4c819eb # # 726 dd8b5 chr11 - 115423144 115423144 - 1531 - 4279 - 9 - cf0 a7e4d5ea0478 # # 3 chr11 + 69150806 69150814 34 f9ee3e - 4 - b27 d2d a203室- 4067 f0662044 # # 4 chr1 + 170484965 170484965 d8309c06 - 375 f - 4 - dfe b22e - 0 - 5 chrY c47af888cd9 # # 4082060 4082060 f68940f6 - 4236 - 4 - f0f - 9 - af7 a81b5c2911b6 # # 6 chr8 + 120733312 120733312 13 ae181f b88b - 4 - d6c a815 - 553 ff2e25312 # # log_lik_ratio log_lik_methylated log_lik_unmethylated num_calling_strands # # 1 -5.91 -100.38 -94.47 1 # # 2 -8.07 -115.21 -107.13 1 # # 3 -1.65 -183.12 -181.47 1 # 5 # 4 2.74 -112.14 -114.88 1 # # 1 # # 6 -1.78 -135.09 -133.32 5.02 -129.31 -134.33 1 # # 1 # # num_motifs序列1 CATTACGTTTC # 1 # 2 AACTTCGTTGA # # 3 2 GGTCACGGGAATCCGGTTC # # 4 1 AGAAGCGCTAA # # 5 1 CTCACCGTATA # # 6 1 TCTGACGTTGA

然后,我们创建一个临时路径来存储转换后的文件,这将被删除一旦你退出R会话。一次create_tabix_file ()运行时,它将创建一个.bgz文件连同其tabix指数。因为我们有少量的数据,我们可以阅读一小部分的检验,与大型数据集不这样做它解压缩数据和需要很长的运行。

Megalodon数据

从Megalodon导入数据的修改要求每次读取修改基地文件必须生成。可以通过添加——write-mods-text参数Megalodon运行或使用megalodon_extras per_read_text modified_bases实用程序。

导入数据

methy_tabix < - file.path (tempdir (),“methy_data.bgz”)样本< - c (“sample1”、“sample2”) #您应该看到消息当运行这个自己create_tabix_file (methy_calls methy_tabix,样本)与实际数据# #不这样做,我们必须用gzfile告诉R,我们有一个gzip压缩文件methy_data < -阅读。表(gzfile (methy_tabix) col.names = methy_col_names (), nrows = 6) methy_data
# #样品所对应pos链统计read_name sample2 chr1 5141051 - 6.93 # # 3818 f2e2 d520 - 4305 bbab - efad891f67f2 # # 2 sample1 chr1 6283068 - 1.05 36 e3c55f c41f - 4 - bd6 b371 - 54368 - d013008 # # 3 sample1 chr1 54368 - 1.39 6 f6cbc59-af4c-4dfa-8e48-ef4ac4eeb13b # # 4 sample1 chr1 10230293 - 2.19 fbe53b38 e264 - 4 - c7a - 824 - e - 2651 - c22f8ea6 # # 7660 ba1f sample1 chr1 13127128 - 2.51 - 9 - b44 - 4783 - b901 ed79b2f0481b # # 6 sample1 chr1 7660 - 2.51 13127135 ba1f - 9 - b44 - 4783 b901 ed79b2f0481b

现在methy_tabix将路径准备使用NanoMethViz tabix对象。请在“引入”装饰图案为可视化看到如何使用这些数据!

导出数据

甲基化数据可以导出到其它格式适合bsseq, DSS,或者磨边机。

bsseq和DSS

bsseq和DSS利用bsseq对象,这些可以从NanoMethResult获得对象使用methy_to_bsseq ()函数。

bss < - nmr < - load_example_nanomethresult () methy_to_bsseq bss (nmr)
# #一个“BSseq”类型的对象与# # # # # # 6样本4778个甲基化位点没有平滑# #内存中的所有化验

刨边机

磨边机还可以用于执行差异甲基化分析:https://f1000research.com/articles/6 - 2055。BSSeq对象可以被转换成适当的格式使用bsseq_to_edger ()函数。这可以用于计算读取每个网站的基础上或在区域。

gene_regions < - exons_to_genes (NanoMethViz::外显子(nmr)) edger_mat < - bsseq_to_edger edger_mat (bss, gene_regions)
# # B6Cast_Prom_1_bl6_Me B6Cast_Prom_1_bl6_Un B6Cast_Prom_1_cast_Me # # 2628 # # 12190 12189 3259 2033 2384 1349 1604 # # # # 17263 16210 2696 1173 1564 1752 1672 2156 # # # # 213742 18616 1812 595 1436 1264 803 848 # # B6Cast_Prom_1_cast_Un B6Cast_Prom_2_bl6_Me B6Cast_Prom_2_bl6_Un # # 1764 # # 12190 12189 1970 3380 1627 2564 1853 # # # # 17263 16210 1788 2544 895 1831 2027 1698 # # # # 213742 18616 1184 1690 573 1465 1012 596 # # B6Cast_Prom_2_cast_Me B6Cast_Prom_2_cast_Un B6Cast_Prom_3_bl6_Me # # 3658 # # 12190 12189 2663 2043 1860 1573 2110 # # # # 17263 16210 1630 1693 1955 1349 1153 1787 # # # # 213742 18616 1442 1520 3011 1072 1040 1432 # # B6Cast_Prom_3_bl6_Un B6Cast_Prom_3_cast_Me B6Cast_Prom_3_cast_Un # # 1968 # # 12190 12189 2341 2565 1502 1884 1663 # # # # 17263 16210 769 1466 1787 1880 1883 1694 # # # # 213742 18616 1331 948 931 728 653 1189