CUT&Tag 数据处理和分析教程(7)

简介: CUT&Tag 数据处理和分析教程(7)

过滤

某些项目可能需要对比对质量分数进行更严格的过滤。本文细讨论了bowtie如何分配质量分数,并举例说明。

MAPQ(x) = -10 log10log10(P(x is mapped wrongly)) = -10 log10(p)

其范围从0到37、40或42。

使用samtools view -q minQualityScore命令将剔除所有低于定义的minQualityScore的对齐结果。

##== linux command ==##
minQualityScore=2
samtools view -q $minQualityScore ${projPath}/alignment/sam/${histName}_bowtie2.sam >${projPath}/alignment/sam/${histName}_bowtie2.qualityScore$minQualityScore.sam

文件格式转换

本节是为峰值调用和可视化做准备所需的内容,其中需要进行一些过滤和文件格式转换。

##== linux command ==##
## Filter and keep the mapped read pairs
samtools view -bS -F 0x04 $projPath/alignment/sam/${histName}_bowtie2.sam >$projPath/alignment/bam/${histName}_bowtie2.mapped.bam

## Convert into bed file format
bedtools bamtobed -i $projPath/alignment/bam/${histName}_bowtie2.mapped.bam -bedpe >$projPath/alignment/bed/${histName}_bowtie2.bed

## Keep the read pairs that are on the same chromosome and fragment length less than 1000bp.
awk '$1==$4 && $6-$2 < 1000 {print $0}' $projPath/alignment/bed/${histName}_bowtie2.bed >$projPath/alignment/bed/${histName}_bowtie2.clean.bed

## Only extract the fragment related columns
cut -f 1,2,6 $projPath/alignment/bed/${histName}_bowtie2.clean.bed | sort -k1,1 -k2,2n -k3,3n  >$projPath/alignment/bed/${histName}_bowtie2.fragments.bed

评估可重复性

为了研究重复样本之间以及不同条件下的可重复性,将基因组分成500 bp的片段,并计算每个片段中读取计数的log2转换值在重复数据集之间的皮尔逊相关性。多个重复样本和IgG对照数据集以层次聚类相关性矩阵的形式展示。

##== linux command ==##
## We use the mid point of each fragment to infer which 500bp bins does this fragment belong to.
binLen=500
awk -v w=$binLen '{print $1, int(($2 + $3)/(2*w))*w + w/2}' $projPath/alignment/bed/${histName}_bowtie2.fragments.bed | sort -k1,1V -k2,2n | uniq -c | awk -v OFS="\t" '{print $2, $3, $1}' |  sort -k1,1V -k2,2n  >$projPath/alignment/bed/${histName}_bowtie2.fragmentsCount.bin$binLen.bed
##== R command ==##
reprod = c()
fragCount = NULL
for(hist in sampleList){

  if(is.null(fragCount)){

    fragCount = read.table(paste0(projPath, "/alignment/bed/", hist, "_bowtie2.fragmentsCount.bin500.bed"), header = FALSE) 
    colnames(fragCount) = c("chrom", "bin", hist)

  }else{

    fragCountTmp = read.table(paste0(projPath, "/alignment/bed/", hist, "_bowtie2.fragmentsCount.bin500.bed"), header = FALSE)
    colnames(fragCountTmp) = c("chrom", "bin", hist)
    fragCount = full_join(fragCount, fragCountTmp, by = c("chrom", "bin"))

  }
}

M = cor(fragCount %>% select(-c("chrom", "bin")) %>% log2(), use = "complete.obs") 

corrplot(M, method = "color", outline = T, addgrid.col = "darkgray", order="hclust", addrect = 3, rect.col = "black", rect.lwd = 3,cl.pos = "b", tl.col = "indianred4", tl.cex = 1, cl.cex = 1, addCoef.col = "black", number.digits = 2, number.cex = 1, col = colorRampPalette(c("midnightblue","white","darkred"))(100))

相关文章
|
C++
如何使用MACS进行peak calling
MACS2是peak calling最常用的工具。 callpeak用法 这是MACS2的主要功能,因为MACS2的目的就是找peak,其他功能都是可有可无,唯独callpeak不可取代。
4635 0
|
9月前
|
数据可视化 数据处理
CUT&Tag 数据处理和分析教程(8)
CUT&Tag 数据处理和分析教程(8)
547 12
|
安全 Linux Shell
【内网安全-CS】Cobalt Strike启动运行&上线方法&插件
【内网安全-CS】Cobalt Strike启动运行&上线方法&插件
3023 0
【内网安全-CS】Cobalt Strike启动运行&上线方法&插件
|
机器学习/深度学习 存储 SQL
全栈开发之MySQL主从同步,读写分离后可能引发的问题
全栈开发之MySQL主从同步,读写分离后可能引发的问题
657 0
全栈开发之MySQL主从同步,读写分离后可能引发的问题
|
8月前
|
数据处理
CUT&Tag 分析教程 | 完结撒花
CUT&Tag 分析教程 | 完结撒花
CUT&Tag 分析教程 | 完结撒花
|
8月前
|
数据可视化 数据处理
CUT&Tag 数据处理和分析教程(9)
CUT&Tag 数据处理和分析教程(9)
278 15
CUT&Tag 数据处理和分析教程(9)
|
10月前
|
数据处理
CUT&Tag 数据处理和分析教程(2)
CUT&Tag 数据处理和分析教程(2)
CUT&Tag 数据处理和分析教程(2)
|
7月前
|
人工智能 分布式计算 大数据
构建AI时代的大数据基础设施-MaxCompute多模态数据处理最佳实践
本文介绍了大数据与AI一体化架构的演进及其实现方法,重点探讨了Data+AI开发全生命周期的关键步骤。文章分析了大模型开发中的典型挑战,如数据管理混乱、开发效率低下和运维管理困难,并提出了解决方案。同时,详细描述了MaxCompute在构建AI时代数据基础设施中的作用,包括其强大的计算能力、调度能力和易用性特点。此外,还展示了MaxCompute在多模态数据处理中的应用实践以及具体客户案例,最后提供了体验MaxFrame解决方案的方式。
845 2
|
9月前
|
数据处理
CUT&Tag 数据处理和分析教程(6)
CUT&Tag 数据处理和分析教程(6)
CUT&Tag 数据处理和分析教程(6)