我有时候会对DIffBind的输出结果进行下修改,然后放到deeptools-computeMatrix里面去。跟之前的HOMER一样,computeMatrix要求的也是bed格式
chr1 3204562 3661579 NM_001011874 Xkr4 -
chr1 4481008 4486494 NM_011441 Sox17 -
chr1 4763278 4775807 NM_001177658 Mrpl15 -
chr1 4797973 4836816 NM_008866 Lypla1 +
然后我就正常按照awk的操作进行了提取
awk -F "," 'BEGIN {OFS="\t"} $9 < -1 && $11 < 0.05 {print $1,$2,$3,$12,$5}' diff.csv | sed 's/\"//g' | sort -k1,1 -k2,2n > test.bed
head -n 1 test.bed
Chr1 113 1134 peak_1 *
分别是提取Fold(即11) < 0.05,然后提取1,2,3,12,5列,然后排下序
原谅我的不正规的bed格式……这里关系不太大
但当我去使用computeMatrix的使用,总是会出现报错
computeMatrix reference-point -S a.bw -R ../test.bed -a 500 -b 500 --referencePoint center --binSize 10 -p 50 -o computerMatrix_Diff.gz
Traceback (most recent call last):
File "/opt/biosoft/deepTools2.0/bin/computeMatrix", line 14, in
main(args)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptools/computeMatrix.py", line 421, in main
hm.computeMatrix(scores_file_list, args.regionsFileName, parameters, blackListFileName=args.blackListFileName, verbose=args.verbose, allArgs=args)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptools/heatmapper.py", line 264, in computeMatrix
verbose=verbose)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptools/mapReduce.py", line 85, in mapReduce
bed_interval_tree = GTF(bedFile, defaultGroup=defaultGroup, transcriptID=transcriptID, exonID=exonID, transcript_id_designator=transcript_id_designator, keepExons=keepExons)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptoolsintervals/parse.py", line 595, in __init__
self.parseBED(fp, line, 3, labelColumn)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptoolsintervals/parse.py", line 362, in parseBED
self.parseBEDcore(line, ncols)
File "/opt/biosoft/deepTools2.0/lib/python2.7/site-packages/deeptoolsintervals/parse.py", line 225, in parseBEDcore
if int(cols[1]) < 0:
ValueError: invalid literal for int() with base 10: 'start'
根据网上的Question: ValueError: invalid literal for int() with base 10: 'start' computeMatrix of deeptools 问题,我认为是我的bed有header,即可能还留有seqnames、start、end这种表头。但刚才也看到了,我已经head过了,并没有表头的残留。不过我也想到了是否是因为我sort了一下,表头到了最后一行去了,果不其然。
tail -n 1 test.bed
seqnames start end feature_id strand
但这就很奇怪了,我明明是设定了 $9 < -1 && $11 < 0.05
,照理说并不会有错误的,因为不管是Fold还是FDR,照理说都是字符串,不应该会<-1或者<0.05。然后我在网上一查,发现了一个比较坑爹的事情:awk greater than why show string value?
里面提到了如果你要比较混合类型大小的话,那么数字就会自动转换成字符串,然后字符串之间就会进行比较了。
When comparing operands of mixed types, numeric operands are converted to strings using the value of CONVFMT. ... CONVFMT's default value is "%.6g", which prints a value with at least six significant digits.
但我感觉不仅仅是这个问题,因为如果我设定了
vim test.txt
Fold FDR
2 0.04
然后awk操作,并不会返回值
awk -F "\t" '$1 < -1 && $2 < 0.05' test.txt
而如果我是
vim test.txt
"Fold" "FDR"
2 0.04
就会返回值了
$ awk -F "\t" '$1 < -1 && $2 < 0.05' test.txt
"Fold" "FDR"
这样看起来似乎是引号的问题……具体原因我也不知道
不过如果要避免这个问题的话,要么一开始就用 sed 's/\"//g'
把双引号去掉,要么就是 sed 1d
去掉第一行