IGV需要的文件:比对文件为                   bam和bam.bai文件

参考基因组文件为         .fa文件

比对文件处理:sam -> bam

-> bam.sorted

-> bam.bai

(三步)

代码:samtools view-bS abc.sam>abc.bam    (最终samtools view -Sb -T /mnt/S30/database/tair10/tair10.fa one_pair._2sam >sample_with_header.bam)

samtools sort tmp.bam -o tmp.bam.sort (最终 samtools sort sample_with_header.bam -o sample_with_header.bam.sort)

【修改:注意因为要从服务器下到windows上看,最好把它写成xxx.bam,不然windows识别不出】

samtools index abc.bam.sort (最终 samtools index sample_with_header.bam.sort)

实操:

问题1

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

需要header

解决方法:pysam有加header的方法,这次先手动复制。 不行

samtools view -Sb -T genome.fa sample_no_header.sam >sample_with_header.bam(https://flystar233.github.io/2018/11/20/sam-header/)  成功

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

sam无head则无法将sam转bam,但使用 -T(用参考基因组的)可解决

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

参考

另记:bam没header时也有办法加

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

samtools reheader 的方法

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

或者转时加上-h

不能用 -n

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

不能-n

否则会出以下错误:

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

sort时加 -n会有问题

IGV使用注意:

1.文件路径不能有中文

2.bam和.bai文件同时都需要,放一个文件夹比较好。

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

参考

全部加载后双击能查看

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

结果

6bd8de2cd866?utm_campaign=haruki&utm_content=note&utm_medium=seo_notes&utm_source=recommendation

结果看起来挺有意思

下一步是解读结果。目前看似乎是接近想要的结果。

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐