结构变异SV的鉴定--smartie-sv与bayestyper

最近一直在折腾结构变异SV的鉴定,SV的鉴定软件虽然很多,但是在最近的两篇基因组文章里面,主要用的是smartie-sv和bayesTyper,其中smartie-sv主要用于基因组间的比较,也可以用于三代数据的比较;bayesTyper主要用于二代数据的SV鉴定,适用于群体,速度较快。

参考文献:
[1] Genome assembly of a tropical maize inbred line provides insights into structural variation and crop improvement
[2] Eight high-quality genomes reveal pan-genome architecture and ecotype differentiation of Brassica napus

smartie-sv的安装

  • smartie-sv的详细信息在这里.

1. smartie-sv的安装,需要依赖htslib和blasr

$ git clone --recursive https://github.com/zeeev/smartie-sv.git #获取samrtie-sv
$ cd smartie-sv && make

2. hstlib的安装

$ git clone https://github.com/samtools/htslib.git
$ autoconf 
$ ./configure
$ make
$ make install

3. blasr的安装

$ wget https://github.com/PacificBiosciences/blasr/archive/master.zip -O blasr.zip
$ unzip blasr.zip
$ mv blasr-master/ blasr
$ cd blasr
$ make -j 8

4. smartie-sv的配置

smartie-sv需要用到htslib的bgzip、htsfile、tabix,以及blasr的blasr、sawriter,所以我们需要把5个可执行文件链接到smartie-sv的bin文件夹下,以便smartie-sv对其的调用。

$ cd smartie-sv/bin
$ ln -s ../../htslib/bin/bgzip ./
$ ln -s ../../htslib/bin/htsfile ./
$ ln -s ../../htslib/bin/tabix ./
$ ln -s ../../blasr/alignment/bin/blasr ./
$ln -s ../../blasr/alignment/bin/sawriter ./
bin目录.png

5. smartie-sv的使用

smartie-sv的使用在官方的README.md有示例,它支持snakename的命令。

$ bin/sawriter target.fasta #利用sawriter对基因组进行index
# 本地运行时
$ snakemake -s Snakefile -w 50 -p -k -j 20

6. 运行结果

# Snakefile内容,在安装目录"smartie-sv/pipeline/Snakefile"位置,定义call SV等方法,便于流程使用
shell.prefix("source config.sh; set -eo pipefail ; ")

configfile: "config.json"

def _get_target_files(wildcards):
    return config["targets"][wildcards.target]

def _get_query_files(wildcards):
        return config["queries"][wildcards.query]

rule dummy:
     input: expand("variants/{target}-{query}.svs.bed", target=config["targets"], query=config["queries"])

rule callSVs:
     message: "Calling SVs"
     input  : SAM="mappings/{target}-{query}-aligned.sam", TARGET=_get_target_files, PG=config["install"] + "/bin/printgaps"
     output : "variants/{target}-{query}.svs.bed"
     shell  : """
            cat {input.SAM} | {input.PG} {input.TARGET} variants/{wildcards.target}-{wildcards.query}
     """

rule runBlasr:
     message: "Aligning query to target"
     input:   BL=config["install"] + "/bin/blasr", TARGET=_get_target_files, QUERY=_get_query_files
     output:  "mappings/{target}-{query}-aligned.sam", "unmappings/{target}-{query}-unaligned.fasta"
     shell:   """
              {input.BL} -clipping hard -alignContigs -sam -minMapQV 30 -nproc 6 -minPctIdentity 50 -unaligned {output[1]} {input.QUERY} {input.TARGET} -out {output[0]}
     """

我们需要修改的只有文件"config.json",主要包含smartie-sv的目录,参考基因组文件和比对基因组文件,以json格式存在。

{
"install":"smartie-sv",             #最好写绝对路径
"targets":{"zs11":"Darmor.fa"},
"queries":{"Darmor":"Darmor.fa"},
}

最后生成三个文件夹,mappings、unmappings和variants,sv信息主要在variants文件


结果文件.png

其中zs11-Darmor.svs.bed包含SV的信息,以bed格式存在。


zs11-Darmor.svs.bed.png

bayesTyper的安装

  • bayesTyper的详细信息在这里.
  • Platypus的详细信息在这里.
  • Manta的详细信息在这里.

bayesTyper的官网文档推荐使用三种方法鉴定变异(GATK、Platypus和manta),然后利用bayesTyperTools对变异文件进行合并,然后利用bayesTyper的cluster进行cluster,最后利用bayesTyper的genotype进行基因分型。

1. bayesTyper安装

bayesTyper的安装非常简单,安装完成后会在bin目录下生成bayesTyper 和bayesTyperTools两个可执行文件

$ git clone https://github.com/bioinformatics-centre/BayesTyper.git
$ cd BayesTyper && make -j 4

2. Platypus的安装

$ git clone https://github.com/andyrimmer/Platypus.git
$ cd Platypus && make -j 4
# 使用platypus的只需运行bin目录下的Platypus.py
$ python bin/Platypus.py --bamFiles=BAM.bam --refFile=REF.fa --output=variants.vcf

3. manta的安装:

manta采用的是cmake的方式,所以要另外新建一个安装目录,另外manta需采用python 2.7 版本,以及需要Cython模块。安装成功后会在bin目录下生成三个文件,configManta.py、configManta.py.ini和runMantaWorkflowDemo.py,我们主要用的就是configManta.py。

$ git clone https://github.com/Illumina/manta.git
$ make manta_build && cd manta_build
$ ../manta-1.6.0/configure --prefix=`pwd`
$ make -C /public/home/guocc/software/manta_build
$ make -j4 install

4. bayesTyper的使用

在官方文档中,鉴定变异的主要流程分为2大部分:

4.1:Generation of variant candidates(候选变异的生成)

以比对完的bam文件(推荐以bwa的mem)为起始,分为一下几个步骤:

  • 4.1.1 用GATK的HaplotypeCaller模块鉴定候选位点。
  • 4.1.2 用Platypus鉴定小的以及中等的变异
  • 4.1.3 用manta鉴定大的结构变异
  • 4.1.4 利用bayesTyperTools的combine功能对以上三种方法的结果进行合并,合并命令为:
$ bayesTyperTools combine -v GATK:<gatk_sample1>.vcf,GATK:<gatk_sample2>.vcf,PLATYPUS:<platypus_sample1>.vcf,PLATYPUS:<platypus_sample2>.vcf,MANTA:<manta_sample1>.vcf,...,prior:<prior>.vcf -o <candiate_variants_prefix> -z

注意这里-v参数后面接的是字符串,为gatk:sample.vcf格式,各个样品间用“,”分隔,参数-z 表示以压缩格式gz输出。
bayesTyper的combine格式需要一个参数文件–contigs.txt,里面包含基因组的所有contig信息。格式为##contig=<ID=8,length=146364022>.

4.2 Genotyping based on variant candidates(基于候选变异的基因分型)

4.2.1 计算测序数据的 k-mers

  • 这里主要用的KMC3来对比对后的bam文件进行kmer的统计,参数为(-k55 -ci1 -fbam)
  • 计算完kmer后,用bayesTyperTools makeBloom -k <kmc_output_prefix> -p <num_threads>生成bayesTyper需要的前提文件。
  • kmc生成的为<sample_id>.kmc_pre<sample_id>.kmc_suf两个文件,bayesTyperTools makeBloom生成的为<sample_id>.bloomMeta<sample_id>.bloomData两个文件,这里一定要在同一文件下运行,且前缀名一致。

4.2.2 鉴定变异的cluster

运行命令:

$ bayesTyper cluster -v <candiate_variants_prefix>.vcf.gz -s <samples>.tsv -g <ref_build>_canon.fa -d <ref_build>_decoy.fa -p <num_threads>
  • 所有的结果都会按cluster分成很多个unit,存在独立的文件
  • 文件<sample>.tsv包含的信息为<sample_id><sex><kmc_output_prefix>.
  • cluster的结果输出在bayestyper_cluster_data目录

4.2.3 对cluster进行genotype

bayesTyper genotype -v bayestyper_unit_<unit_id>/variant_clusters.bin -c bayestyper_cluster_data -s <samples>.tsv -g <ref_build>_canon.fa -d <ref_build>_decoy.fa -o bayestyper_unit_<unit_id>/bayestyper -z -p <num_threads>

4.2.4 利用bcftools对结果进行合并

bcftools concat -O z -o <output_prefix>.vcf.gz bayestyper_unit_1/bayestyper.vcf.gz bayestyper_unit_2/bayestyper.vcf.gz ...

此贴为记录我的爬坑之路,因为之前百度都没有找到任何与这两个软件相关的信息,所以很是头疼。希望能帮到大家,供大家参考。
以上就是全部步骤,最后两步还没跑通,等跑通后再做分享。


![image.png](https://upload-images.jianshu.io/upload_images/18925383-84b8f660f7f679fa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240 =100x30)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,088评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,715评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,361评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,099评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 60,987评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,063评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,486评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,175评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,440评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,518评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,305评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,190评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,550评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,880评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,152评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,451评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,637评论 2 335