美文网首页
wigToBigWig报错: item's end is lon

wigToBigWig报错: item's end is lon

作者: 尹小奥 | 来源:发表于2021-03-18 15:39 被阅读0次

从NCBI下载到由macs2生成的wig文件(wig file from macs),正在开心可以不用自己分析数据直接借用的时候,发现wig文件转bigwig时候(wigToBigWig),报错:item's end is longer than chromosome size。

/software/wigToBigWig  col.wig  arabidopsis.genome  col.bigwig 
#Line 3825834 of col.wig: chromosome 5 has 26975502 bases, but item ends at 26975550

答案1:
在网上找到有人在biostars上已经问了这个问题而且已经有答案了Question: Wig file obtained from MACS14 is longer than chromosome size?
macs2会把reads延伸300bp,导致有的片段会超出基因组范围,macs2生成的bedgraph文件也有相同问题。解决方法就是用UCSC的bedclip工具(点击到UCSC工具下载页面),先把超出的基因组的片段扔掉,或者把超出的部分去掉(parameter:-truncate)。但是下载后发现bedclip的输入对象是bed文件,要应用于我的wig文件,还要麻烦的转格式。
使用说明如下:

bedClip - Remove lines from bed file that refer to off-chromosome locations.
usage:
   bedClip [options] input.bed chrom.sizes output.bed
chrom.sizes is a two-column file/URL: <chromosome name> <size in bases>

答案2:
小白还是想偷个懒看看有没有人写好了脚本。
在简书上也有作者用bedclip解决相似问题,还写好了可以直接使用的脚本。但是输入文件是macs2的bedgraph文件。MACS2学习笔记

答案3:
继续找答案,在biostars上看到了另一个问题和回答。Question: item's end higher than chrom size, wigToBigWig。其实wigToBigWig有一个参数-clip,可以直接把有超出基因组部分的片段扔掉,而不报错。
使用说明如下:

options:
   -blockSize=N - Number of items to bundle in r-tree.  Default 256
   -itemsPerSlot=N - Number of data points bundled at lowest level. Default 1024
   -clip - If set just issue warning messages rather than dying if wig
                  file contains items off end of chromosome or chromosomes
                  that are not in the chrom.sizes file.

这个方法简单方便,可以直接输入wig文件,但是缺点就是不能像bedClip一样,只去超出的那部分,而是把有超出基因组部分的整个片段丢掉。
成功拿到想要的bigwig文件啦ヾ(≧▽≦*)o

/software/wigToBigWig  -clip  col.wig  arabidopsis.genome  col.bigwig 

写在后面:
如果有人写出了用bedClip解决wig转bigwig片段超出基因组的脚本,记得提醒小白,一起学习,谢谢!!☆⌒(*^-゜)v

相关文章

网友评论

      本文标题:wigToBigWig报错: item's end is lon

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