Dinh/Dinh 2012/NOTES/2012-3-21

From ZhangLabWiki
Jump to navigation Jump to search

Sequence dependent test on HAPMAP data[edit]

  • Working directory (genome-miner): /home/nplongth/Noi_scratch/ASM_HAPMAP1362-1454_2012_02_03/DD_SequenceDependentTest
  • Discussed this with Noi and Dr. Zhang
Sequence dependent means that there is a consistent preference of methylation on one allele versus another across multiple individuals.
  • Binomial test
  • Procedure for the binomial test:
1. Using all data from *cpg.txt file generated from Robert's pipeline (ignoring p-value)
2. Ignore data where the two alleles have exactly the same methylation fraction (no preference)
3. Identify the favored allele in each individual, and increment count for the favored allele at a SNP:CpG set.
4. Do not consider sites where there are more than 2 different favored alleles
5. Let x = the count for the least favored allele
6. Use Math::CDF qw(pbinom) with x, n = number of data, p = probability of preference on allele = 0.5
   Null hypothesis is that the sample prefer allele 1 and allele 2 both with probability 0.5
   Reject null if the p-value is low (more samples prefer one allele over the other)
7. Accept null if p value is greater than 0.05 (5%)
8. Resulted in 117 SNP:CPG (Sequence dependent ASM) / Tested 71,441 SNP:CPG
IMPORTANT UPDATE: As set up before, the binomial test would return p-value = 1 for when all the sites have preference toward 1 allele. Added in line:
$p_value = 0 if($p_value == 1); Now the analysis for the Binomial test needs to be repeated.
 8. Resulted in 45,022 SNP:CPG (Sequence dependent ASM) / Tested 71,441 SNP:CPG
  • Command:
dinh@genome-miner:/home/nplongth/Noi_scratch/ASM_HAPMAP1362-1454_2012_02_03$ DD_SequenceDependentTest/asmBinomialTest.pl MFASM.QValues-cpg.list.txt > DD_SequenceDependentTest/binomialtest.SequenceDependent
  • Noi suggested the T-test
  • Procedure for the t-test:
1. Using all data from *cpg.txt file generated from Robert's pipeline (ignoring p-value)
2. Get the difference in methylation level between the two alleles, making sure that the difference is always relative to the same allele.
3. Require minimum 5 data points
4. Calculate the t-statistic: (mean difference)/SEM (use Statistics::Descriptive)
   Null hypothesis is that the average of the differences is 0.
   Reject null if the p-value is low (the average of the differences is not 0)
5. Calculate the p-value using Math::CDF qw(pt) with t-stat, df = number of data - 1, and centered at 0.
6. Accept null if p value is greater than 0.05 (5%)
7. Resulted in 1244 SNP:CPG (Sequence dependent ASM) / Tested 17,525 SNP:CPG
  • Command:
dinh@genome-miner:/home/nplongth/Noi_scratch/ASM_HAPMAP1362-1454_2012_02_03$ DD_SequenceDependentTest/asmTTest.pl MFASM.QValues-cpg.list.txt > DD_SequenceDependentTest/ttest.SequenceDependent

Gene ontology: GREAT[edit]

  • Used awk and sort -u commands to get BED files of unique CpG sites with sequence dependent ASM.
binomialTest.cpgs = 113 (background have 64,030 CpGs)
tTest.cpgs = 1187 (background have 16,430 CpGs)
  • changed chr23/24/25 to chrX/Y/M with sed
  • Uploaded BED files to GREAT (default settings) and checked biological process.
  • Binomial test GO (NOTE: after repeating with bigger 45,022 SNP:CPG set, there are no significant enrichment!
  • TTest GO
File:TtestGO.png

Discussion[edit]

  • Binomial test is too stringent, higher number of data is required for counting while we cannot use data with difference = 0. The t-test allows us to use data with difference = 0.
  • Ttest is more powerful but have higher false discovery (type I error plus bias when there are outliers)
  • Binomial test seems to have lower type I error but also lower power.
  • A larger sample size will perform better with the binomial test.
  • A larger sample size will allow more sites to pass minimum 5 data points for the t-test.

Double check Binomial test with OpenOffice Math[edit]

10:127584276:127584265 3:2796414:2796339 17:21220301:21220322
0.271|0.591 0.786|0.417 0.865|0.000
0.228|0.629 0.562|0.468 0.733|0.000
0.296|0.439 0.906|0.825 0.816|0.027
NA 0.850|0.040 0.455|0.000
0.267|0.613 0.632|0.340 0.600|0.000
0.427|0.513 0.644|0.246 0.125|0.146
0.178|0.534 0.661|0.769 0.688|0.000
0.436|0.548 0.475|0.452 0.784|0.013
0.302|0.706 NA NA
0.145|0.681 0.532|0.529 1.000|0.074
0.411|0.403 NA 0.194|0.000
0.214|0.695 0.842|0.577 0.827|0.012
p=0.005859375 p=0.0107421875 p=0.005859375
  • First and last SNP:CPG have n=11 and k=1 (n is number of data and k is the least favored allele count)
  • Middle SNP:CPG have n=10 and k=1
' n 11 10
k 1 1
P(k=0) 0 0.0004882813 0.0009765625
P(k=1) 1 0.0053710938 0.009765625
SUM --- 0.005859375 0.0107421875
  • probabilities were calculated using: =(FACT(n)/(FACT(k)*FACT(n-k)))*0.5^k*(0.5)^(n-k)

Double check Ttest with OpenOffice Math[edit]

4:7319795:7319781 14:95874397:95874396 13:38445196:38445195
NA NA 0.000|0.714
0.000|0.303 0.000|0.952 0.000|0.700
NA NA NA
0.750|0.975 0.009|0.981 0.000|0.933
NA 0.005|0.950 0.048|0.867
0.292|0.851 NA 0.000|0.970
NA 0.000|0.947 0.000|0.361
NA NA NA
NA NA NA
0.718|0.930 NA NA
0.571|1.000 0.000|0.977 NA
NA NA NA
p=0.039493696 p=1.71390437762721e-07 p=0.009553314
  • Calculate the differences then t-statistics and pvalue
' 4:7319795:7319781 14:95874397:95874396 13:38445196:38445195
diff 0.303 0.952 0.714
diff 0.225 0.972 0.7
diff 0.559 0.945 0.933
diff 0.212 0.947 0.819
diff 0.429 0.977 0.97
diff 0.361
mean 0.3456 0.9586 0.7495
SEM 0.1472270356 0.0148425065 0.2198933833
T-stat 2.3473949515 64.584778741 3.4084699999
P-value 0.0393695698 1.72149891022281E-007 0.0095374811