操作记录-2021-05-08: daizhongye_project

一、ChIP_seq 数据加工处理

1.建立相应目录

对新数据建立对应实验人员(daizhongye)、测序类型(ChIP_seq)和日期(2021_05_08)的目录。

# 建立后如下:
(base) zexing@DNA:~/projects/daizhongye/ChIP_seq/2021_05_08$

# 新建对应的目录
mkdir raw_data bam bam_bw bam_sort sam macs2_bdgdiff macs2_callpeak matrix_reference_point matrix_scale_regions fastqc_report MD5_txt scripts_log

2.检查数据完整性

(base) zexing@DNA:~/projects/zhaoyingying/ChIP_seq/2021_05_01$ cat md5sum.txt > check_md5sum.txt && md5sum -c check_md5sum.txt

3. 在Linux服务器中对ChIP_seq数据进行处理并常规call peak。

(base) zexing@DNA:~/projects/zhaoyingying/ChIP_seq/2021_05_01$ cd scripts_log
(base) zexing@DNA:~/projects/zhaoyingying/ChIP_seq/2021_05_01/scripts_log$ vim ChIP_seq_script_1

vim新建ChIP_seq_script_1将数据质控、比对、格式转换、排序、生成目录、bamCoverage命令转换文件格式和macs2 callpeak综合在一起。

#!/bin/bash
# 上面一行宣告这个script的语法使用bash语法,当程序被执行时,能够载入bash的相关环境配置文件。
# Program
#     This program is used for ChIP-seq data analysis.
# History
#     2021/05/01       zexing            First release
# 设置变量${dir}为常用目录
# 用户名称和日期需要更改
dir=/f/xudonglab/zexing/projects/daizhongye/ChIP_seq/2021_05_08

# 对数据进行质控
fastqc -t 16 -o ${dir}/fastqc_report/ ${dir}/clean_data/*.fq.gz

# 利用for循环进行后续操作
# 样品名称需要修改
for i in G1_119ub_FKDL210054243_1a G2M_119ub_FKDL210054245_1a S_119ub_FKDL210054244_1a
do
# 对数据进行比对
bowtie2 -t -p 16 -x /f/xudonglab/zexing/reference/UCSC_mm10/bowtie2_index/mm10 -1 ${dir}/clean_data/${i}_1.clean.fq.gz -2 ${dir}/clean_data/${i}_2.clean.fq.gz -S ${dir}/sam/${i}.sam

# 对数据进行格式转换
samtools view -@ 16 -S ${dir}/sam/${i}.sam -1b -o ${dir}/bam/${i}.bam

# 对数据进行排序
samtools sort -@ 16 -l 5 -o ${dir}/bam_sort/${i}.bam.sort ${dir}/bam/${i}.bam

# 对数据生成目录
samtools index -@ 16 ${dir}/bam_sort/${i}.bam.sort 

# bamCoverage命令转换文件格式
bamCoverage -p 16 -v -b ${dir}/bam_sort/${i}.bam.sort -o ${dir}/bam_bw/${i}.bam.sort.bw

# 使用macs2进行call broad peak
macs2 callpeak -t ${dir}/bam_sort/${i}.bam.sort -f BAM -g mm -B --broad -- broad-cutoff 1 --outdir ${dir}/macs2_callpeak/ -n ${i}

done

在后台运行ChIP_seq_script_1:

nohup bash ChIP_seq_script_1 > ChIP_seq_script_1_log &

4. 使用deeptools软件绘制热图/密度图

1.computeMatrix reference-point模式计算信号强度并用plotHeatmap/plotProfile作图

reference-point模式计算的是峰值高点模式,所以指定作图位置的BED或GTF格式文件为macs2 callpeak生成的后缀为summits.bed的BED文件。

vim新建ChIP_seq_script_2,脚本如下:

#! /bin/bash
# 上面一行宣告这个script的语法使用bash语法,当程序被执行时,能够载入bash的相关环境配置文件。
# Program:
#       This program is used for computeMatrix reference_point.
#History:
# 2021/05/09         zexing              First release
# Reference-point refers to a position within a BED region(e.g., the starting point). In this mode, only those genomicpositions before (upstream) and/or after(downstream) of the reference point will be plotted.
# 参数-R 指定作图位置的BED或GTF格式文件,可用#标记同一组区域,默认无。
# 参数-S 输入bigwig文件。
# 参数-o 指定输出为文件名用于plotHeatmap, plotProfile
# 参数-b上游(默认0bp),-a下游(默认0bp)设定感兴趣的区域,如果该区域是基因,则为基因TSS上游或TES下游。
# 参数--skipZeros设定0分区域的处理
# 参数-p 设置线程数

dir=/f/xudonglab/zexing/projects/daizhongye/ChIP_seq/2021_05_08
bed=${dir}/macs2_callpeak
bw=${dir}/bam_bw
results=${dir}/matrix_reference_point

computeMatrix reference-point \
--referencePoint TSS \
-R ${bed}/G1_119ub_FKDL210054243_1a_peaks.broadPeak \
-S ${bw}/G1_119ub_FKDL210054243_1a.bam.sort.bw ${bw}/S_119ub_FKDL210054244_1a.bam.sort.bw ${bw}/G2M_119ub_FKDL210054245_1a.bam.sort.bw \
-o ${results}/matrix_reference_threegroups.gz \
-b 3000 -a 3000 \
-p 16

# 使用plotHeatmap对结果绘制热图并聚类
plotHeatmap -m ${results}/matrix_reference_threegroups.gz \
-o ${results}/reference_threegroups_heatmap.png \
--dpi 750 \
--whatToShow 'heatmap and colorbar' \
--refPointLabel "Dist. to TSS" \
--samplesLabel G1 S G2

# 使用plotProfile对结果绘制密度图并聚类
plotProfile -m ${results}/matrix_reference_threegroups.gz \
-o ${results}/reference_threegroups_profile.png \
--dpi 750 \
--legendLocation upper-right \
--refPointLabel "Dist. to TSS" \
--samplesLabel G1 S G2 \
--perGroup

后台运行ChIP_seq_script_2脚本如下

nohup bash ChIP_seq_script_2 > ChIP_seq_script_2_log &
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值