前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ChAMP 分析甲基化芯片数据-数据导入篇

ChAMP 分析甲基化芯片数据-数据导入篇

作者头像
生信修炼手册
发布2020-05-11 10:49:39
1.9K1
发布2020-05-11 10:49:39
举报
文章被收录于专栏:生信修炼手册生信修炼手册

ChAMP 提供了完整的分析甲基化芯片的pipieline, 从数据导入到差异分析和下游的基因功能分析。首先来看下数据导入部分 通过champ.load 函数导入数据, 用法如下

代码语言:javascript
复制
myLoad <- champ.load(testDir,arraytype="450K")

第一个参数为原始的.idat文件和SampleSheet.csv 文件存放的目录,第二个参数为芯片的类型,包括450KEPIC两种,默认为450K

testDir目录下的文件结构如下

  1. lung_test_set.csv 就是SampleSheet.csv;
  2. .idat文件为样本的原始数据

lung_test_set内容如下:

对于自己的数据,只需要按照格式整理成testDir一样的文件结构即可,对于SampleSheet.csv文件,文件名称可以为其他的名字,但是后缀必须为.csv, 同时保证在原始数据存放的目录下只有1个.csv的文件。

champ.load函数实际上是由champ.importchamp.filter两个函数构成,下面我们通过读取过程中产生的log信息,看下在导入的过程中都做了些什么事情

第一步:确定导入的方法

champ.load函数提供了两种导入数据的方式,默认的为ChAMP,返回值是一个list的对象;另外一种方式是minfi, 返回值是rgSet或者mSetminfi中定义的对象;可以通过指定method参数的值改变导入的方法。

这两种方法的对于原始数据是没有影响的,但是会对归一化的方法造成影响。在归一化时,如果想要使用SWAN或者FunctionNormliazation算法,必须使用minfi的导入方式,如果使用了ChAMP的导入方式,就只能使用BMIQ或者PBC的归一化算法了。

>[ Loading Data with ChAMP Method ]

Note that ChAMP method will NOT return rgSet or mset, they object defined by minfi. Which means, if you use ChAMP method to load data, you can not use SWAN or FunctionNormliazation method in champ.norm() (you can use BMIQ or PBC still). But All other function should not be influenced. ```

第二步:读取SampleSheet.csv 文件

在目录下,寻找后缀为.csv的文件,将这个文件作为Samplesheet.csv文件,读取进来,这里的PDphenotypes的意思,表示样本的信息

[ Section 1: Read PD Files Start ] CSV Directory: D:/work/R-3.4.3/library/ChAMPdata/extdata/lung_test_set.csv Find CSV Success Reading CSV File Replace Sentrix_Position into Array Replace Sentrix_ID into Slide [ Section 1: Read PD file Done ]

第三步: 读取样本对应的idat文件

通过SampleSheet.csv文件中的Sentrix_IDSentrix_Position字段的信息,找到样本原始数据,由于是双通道,每个样本有红绿两个通道的原始文件

[ Section 2: Read IDAT files Start ] Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R03C02_Grn.idat —— (1/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R05C02_Grn.idat —— (2/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/9247377086_R01C01_Grn.idat —— (3/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/9247377086_R02C01_Grn.idat —— (4/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7766130112_R06C01_Grn.idat —— (5/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7766130112_R01C02_Grn.idat —— (6/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R01C01_Grn.idat —— (7/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R01C02_Grn.idat —— (8/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R03C02_Red.idat —— (1/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R05C02_Red.idat —— (2/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/9247377086_R01C01_Red.idat —— (3/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/9247377086_R02C01_Red.idat —— (4/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7766130112_R06C01_Red.idat —— (5/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7766130112_R01C02_Red.idat —— (6/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R01C01_Red.idat —— (7/8) Loading:D:/work/R-3.4.3/library/ChAMPdata/extdata/7990895118_R01C02_Red.idat —— (8/8) Extract Mean value for Green and Red Channel Success Your Red Green Channel contains 622399 probes. [ Section 2: Read IDAT Files Done ]

第四步: 计算探针表达谱

这一步会通过芯片对应的注释文件,去除control 探针,然后计算表达谱,会计算下列6种矩阵

  1. Meth and UnMeth Matrix
  2. beta Matrix
  3. M Matrix
  4. intenisty Matrix
  5. Detect P value Matrix
  6. beadscoun Matrix

这一步执行完之后,champ.import函数就执行完毕了。

[ Section 3: Use Annotation Start ] Reading 450K Annotation >> Fetching NEGATIVE ControlProbe. Totally, there are 613 control probes in Annotation. Your data set contains 613 control probes. Generating Meth and UnMeth Matrix Extracting Meth Matrix… Totally there are 485512 Meth probes in 450K Annotation. Your data set contains 485512 Meth probes. Extracting UnMeth Matrix… Totally there are 485512 UnMeth probes in 450K Annotation. Your data set contains 485512 UnMeth probes. Generating beta Matrix Generating M Matrix Generating intensity Matrix Calculating Detect P value Counting Beads [ Section 3: Use Annotation Done ] [<<<<< ChAMP.IMPORT END >>>>>>] [===========================] [You may want to process champ.filter() next.]

第五步:检查参数设置,确定过滤的步骤

确定需要做的过滤的步骤,如果是从原始数据开始导入的,会做以下6种过滤

  1. filterDetP
  2. filterBeads
  3. filterMultiHit
  4. filterSNPs
  5. filterNoCG
  6. filterXY

[ Section 1: Check Input Start ] You have inputed beta,intensity for Analysis. pd file provided, checking if it’s in accord with Data Matrix… pd file check success. Parameter filterDetP is TRUE, checking if detP in accord with Data Matrix… detP check success. Parameter filterBeads is TRUE, checking if beadcount in accord with Data Matrix… beadcount check success. parameter autoimpute is TRUE. Checking if the conditions are fulfilled… !!! ProbeCutoff is 0, which means you have no needs to do imputation. autoimpute has been reset FALSE. Checking Finished :filterDetP,filterBeads,filterMultiHit,filterSNPs,filterNoCG,filterXY would be done on beta,intensity. You also provided :detP,beadcount . [ Section 1: Check Input Done ]

第六步:进行过滤

1. 过滤探针的P值

0.01作为阈值进行过滤,如果想要修改默认的阈值,设置detPcut

Filtering Detect P value Start The fraction of failed positions per sample You may need to delete samples with high proportion of failed probes: Failed CpG Fraction. C1 0.0013429122 C2 0.0022162171 C3 0.0003563249 C4 0.0002842360 T1 0.0003831007 T2 0.0011946152 T3 0.0014953286 T4 0.0015447610 Filtering probes with a detection p-value above 0.01. Removing 2728 probes. If a large number of probes have been removed, ChAMP suggests you to identify potentially bad samples

2.过滤beadcounts < 3的探针

探针与DNA序列杂交,这里的beadcouns 就是结合上探针的reads 数,如果beadcount 小于3,认为这个探针的信号是不可靠的。

在实际处理中,默认如果这个探针在至少5%的样本中, beadcount < 3 会被过滤掉,如果想要修改5%这个阈值,可以设置beadCutoff参数的值,这个参数的默认值为0.05

Filtering BeadCount Start Filtering probes with a beadcount <3 in at least 5% of samples. Removing 9291 probes

3.过滤掉非CpG位点的探针

对于甲基化的C而言,有CpG, CHG, CHH 等甲基化的C, 这一步过滤掉非CpG的探针,如果不想进行这一步过滤,可以设置filterNoCG=FALSE

Filtering NoCG Start Only Keep CpGs, removing 2959 probes from the analysis.

4.过滤掉SNP位点附近的探针

根据Zhou's Nucleic Acids Research Paper 2016这篇文章中指出的位于SNP位点附近的探针进行过滤,如果不想进行这一步过滤,可以设置filterSNPs=FALSE

Filtering SNPs Start Using general 450K SNP list for filtering. Filtering probes with SNPs as identified in Zhou’s Nucleic Acids Research Paper 2016. Removing 49231 probes from the analysis.

5.过滤掉非特异性的探针

探针的特异性对于结果的准确性特别的重要,Nordlund等研究人员使用bwa将探针序列与基因组进行比对,如果是唯一比对,说明探针的特异性非常好。 这一步根据上述的比对结果,去除那些比对到基因组上多个位置的探针,如果你不想进行这一步顾虑,可以设置filterMultiHit=FALSE

Filtering MultiHit Start Filtering probes that align to multiple locations as identified in Nordlund et al Removing 7003 probes from the analysis.

6.过滤掉位于性染色体上的探针

不同性别的样本在做差异分析时,由于性染色体本身的差别,鉴定到的位于性染色体上的差异CpG位点是不准确的,无法解释这个差异是否是实验处理造成的,所以会过滤掉这部分染色体。

如果样本相同性别的情况下,就不需要做这个过滤,此时可以指定参数filterXY = FALSE, 这样就不会过滤性染色体上的探针了。

Filtering XY Start Filtering probes located on X,Y chromosome, removing 9917 probes from the analysis.

虽然使用起来很简单,但是里面包含的步骤很多,需要认真深入的了解一下。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-04-01,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 生信修炼手册 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 第一步:确定导入的方法
  • >[ Loading Data with ChAMP Method ]
    • 第二步:读取SampleSheet.csv 文件
      • 第三步: 读取样本对应的idat文件
        • 第四步: 计算探针表达谱
          • 第五步:检查参数设置,确定过滤的步骤
            • 第六步:进行过滤
              • 1. 过滤探针的P值
              • 2.过滤beadcounts < 3的探针
              • 3.过滤掉非CpG位点的探针
              • 4.过滤掉SNP位点附近的探针
              • 5.过滤掉非特异性的探针
              • 6.过滤掉位于性染色体上的探针
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档