ChIP-Seq数据挖掘系列-4: liftOver - 基因组坐标在不同基因组注释版本间转换
https://www.jianshu.com/p/75758684b9cf
source activate rna
(rna) [zhangyong@cluster liftover]$ liftOver
liftOver - Move annotations from one assembly to another
usage:
liftOver oldFile map.chain newFile unMapped
oldFile and newFile are in bed format by default, but can be in GFF and
maybe eventually others with the appropriate flags below.
The map.chain file has the old genome as the target and the new genome
as the query.
(rna) [zhangyong@cluster liftover]$ liftOver ce.bed mm10ToMm9.over.chain.gz mm9.bed ummap
Reading liftover chains
Mapping coordinates
(rna) [zhangyong@cluster liftover]$
liftOver转换坐标并保留bed文件所有信息
https://cloud.tencent.com/developer/article/1645421
运行如下代码:
liftOver human.bed ~/liftover/hg19ToHg38.over.chain.gz human_hg38.bed unmap
这里会报错:
Reading liftover chains
Mapping coordinates
invalid signed integer: “+”
第四列及后边存在制表符和空格等都会报错,但是我们需要后边的信息怎么办呢?
这里我们可以用":"或者其他字符将制表符和空格替换掉,然后运行liftOver:
sed -i ‘s/\t/:/g’ human.bed
sed -i ‘s/ /#/g’ human.bed
liftOver human.bed ~/liftover/hg19ToHg38.over.chain.gz human_hg38.bed unmap
替换之后文件如下:
这样就可以运行liftOver了,最后得到转换过的坐标文件之后,将:和#再替换回来即可。