美文网首页
MAnorm2 使用

MAnorm2 使用

作者: 余绕 | 来源:发表于2022-01-12 12:04 被阅读0次

MAnorm2 is designed for quantitatively comparingChIP-seq signals between individual samples or groups of samples.
Here we will use MAnorm2 to analyze the ChIP-seq data.

  1. Generate the reads count matrix from sam and peak files using MAnorm2_utils.
  1. Install MAnorm2_utils.
 pip install MAnorm2-utils # for sever, pip install shloud be  in conda under base enviroment. pip comes from conda.
  1. Transforming SAM into BED files.
for i in `ls *.sam`
do
name=${i%%.*} #  截取 i 中 . 以前的字符。
sam2bed -i $i -o ${name}_reads.bed 
done

3)Prepare the peaks files
For narrow peaks, the software should be [MACS 1.4],for broad peaks (e.g., H3K9me3 and H3K27me3), they recommend SICER as the peak caller.

image.png
MACs2 or 3 is the latest version now. If they were used, use bed files generated by them. The xls files were not supported(cause this is not a standard bed file).

4)Generate the reads counts matrix for calculating the differential peaks between samples with replicates.

 profile_bins  --peaks=../peaks_bed/N1_peaks.bed, ../peaks_bed/N2_peaks.bed, \
../peaks_bed/F1_peaks.bed, ../peaks_bed/F2_peaks.bed  \
 --reads=../redas_bed/N1_reads.bed,../redas_bed/N2_reads.bed, \
../redas_bed/F1_reads.bed,../redas_bed/F2_reads.bed  \          
 --labs=N1,N2,F1,F2   \           
-n=example    \         
 --summits=../peaks_bed/N1_summits.bed, ../peaks_bed/N2_summits.bed, \
../peaks_bed/F1_summits.bed, ../peaks_bed/F2_summits.bed    \         
--paired    \        
--keep-dup=1 
  1. Calculate the differential peaks between samples with replicates using MAnorm2.
    The reads count matrix generated by MAnorm2_utils was first imported into the R, then analyzed by MAnorm2.

devtools::install_local("C:/Users/TAO/Documents/MAnorm2-master.zip", repos = NULL)

library(ggplot2)
library(MAnorm2)
rm(list=ls())

Test<-read.table('MAnorm2_1.txt',header = T)
head(Test)

# Perform within-group normalization.
Norm1 <- normalize(Test, count = 4:5, occupancy = 8:9)


Norm1 <- normalize(Norm1, count = 6:7, occupancy = 10:11)

# Construct a bioCond for each group of samples.
conds <- list(Normal = bioCond(Norm1[4:5], Norm1[8:9], name = "Normal"),
              Flood = bioCond(Norm1[6:7], Norm1[10:11], name = "Flood"))

# Perform between-group normalization.
# Restrict common peak regions to autosomes only when the two groups
# being compared are associated with different genders.
autosome <- !(H3K27Ac$chrom %in% c("ChrSy", "ChrUn"))
conds <- normBioCond(conds, common.peak.regions = autosome)
# Fit a mean-variance curve.
# If the following function call raises an error,
# set init.coef = c(0.1, 10) or try method = "local". THIS IS VERY IMPORT IF fitMeanVarCurve REPORTS ERRORS.
conds <- fitMeanVarCurve(conds, method = "parametric", occupy.only = TRUE,init.coef = c(0.1, 10))
res <- diffTest(conds[[1]], conds[[2]])

MAplot(res, padj = 0.05)
abline(h = 0, lwd = 2, lty = 5, col = "green3")

write.csv(res,file="results_kbu")

ggplot(data=res,mapping = aes(x=res$Mval,y=res$pval))+geom_point(size=1.0)

image.png

相关文章

网友评论

      本文标题:MAnorm2 使用

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