欢迎关注公众号:oddxix
1.介绍
CNVkit是研究CNV(Copy number variation, CNV)拷贝数变异的软件。它是由python编写的,安装比较麻烦。下载地址:Github地址
2.下载相应数据
去 UCSC Genome Bioinformatics 下载参考数据:
1.物种的参考基因组序列,采用FASTA格式[必填]
2.基因注释数据库,通过RefSeq或Ensembl,以BED或“RefFlat”格式(例如refFlat.txt)[可选]
参考基因组序列和注释数据库都必须是单个未压缩文件。如果测序是WGS,那么不需要“目标”BED文件,但您可能仍然需要refFlat.txt。
3.比对到参考数据组
使用BWA将测序数据比对到参考数据组
4.流程图
- Copy number calling pipeline下面是它的一些子命令,可以点开看具体参数
流程代码如下:
cnvkit.py access hg19.fa -o access.hg19.bed
cnvkit.py autobin *.bam -t baits.bed -g access.hg19.bed [--annotate refFlat.txt --short-names]
# For each sample...
cnvkit.py coverage Sample.bam baits.target.bed -o Sample.targetcoverage.cnn
cnvkit.py coverage Sample.bam baits.antitarget.bed -o Sample.antitargetcoverage.cnn
# With all normal samples...
cnvkit.py reference *Normal.{,anti}targetcoverage.cnn --fasta hg19.fa -o my_reference.cnn
# For each tumor sample...
cnvkit.py fix Sample.targetcoverage.cnn Sample.antitargetcoverage.cnn my_reference.cnn -o Sample.cnr
cnvkit.py segment Sample.cnr -o Sample.cns
# Optionally, with --scatter and --diagram
cnvkit.py scatter Sample.cnr -s Sample.cns -o Sample-scatter.pdf
cnvkit.py diagram Sample.cnr -s Sample.cns -o Sample-diagram.pdf
可以看到软件提供的命令基本上的都用到了,coverage—>fix—>segment—>segment
运行之后会产生.cnn,.cns文件
结果文件
实际使用cnvkit时,可以简单用下面的batch命令,下面的很多参数设置就能实现以上要求。
cnvkit.py batch *Tumor.bam --normal *Normal.bam \
--targets my_baits.bed --fasta hg19.fasta \
--access data/access-5kb-mappable.hg19.bed \
--output-reference my_reference.cnn --output-dir example/
- cnvkit.py为运行的脚本
- batch是脚本内的一个整合了很多命令的方法
- Tumor.bam 和Normal.bam都是相应样本的bam文件,建议用bwa通过ucsc的hg19参考基因组做mapping,并用samtool排序转换成bam格式。这里可以输入多个tumor.bam和normal.bam
- --targets 想要分析的区域信息
- --annotate refFlat格式的基因注释信息,可以从UCSC上下载
- --fasta 参考基因组
- --access 需要跟bed文件,可用过cnvkit.py access mm10.fasta -s 10000 -o access-10kb.mm10.bed 生成
- --output-reference 输出的reference.cnn可以作为下一批tumor数据分析的输入文件,reference.cnn和输入的normal.bam有关
- --output-dir 输出目录名
--diagram –scatter 两个都是顺带绘图的参数
5.画图
cnvkit.py scatter Sample.cnr -s Sample.cns
# Shell shorthand
cnvkit.py scatter -s TR_95_T.cn{s,r}
- Selection and highlighting指定区域或具有指定名称的基因将在图中突出显示并标记。
Chromosome-level views are controlled with the --chromosome/-c and --gene/-g options
# Show a chromosome arm, highlight one gene
cnvkit.py scatter -s Sample.cn{s,r} -c chr5:100-50000000 -g TERT
# Show the whole chromosome, highlight two genes
cnvkit.py scatter -s Sample.cn{s,r} -c chr7 -g BRAF,MET
# Highlight two genes in a specified range
cnvkit.py scatter -s TR_95_T.cn{s,r} -c chr12:50000000-80000000 -g CDK4,MDM2
在染色体上绘制拷贝数(单个区域(.cnn,.cnr)或区段(.cns))
cnvkit.py diagram Sample.cnr
cnvkit.py diagram -s Sample.cns
cnvkit.py diagram -s Sample.cns Sample.cnr
cnvkit.py heatmap *.cns
6.实例操作
代码如下:
python cnvkit.py batch *.tumor.sort.bam --normal *.normal.sort.bam --targets /database/capture_bed/agilent_v6_urt_Regions_simple.bed --annotate /database/cnvkit-required_files/refFlat.txt --fasta /database/hg19_fasta/ucsc.hg19.fasta --access /database/cnvkit-required_files/access-5k-mappable.hg19.bed --output-reference reference.cnn --output-dir results --diagram --scatter;
for i in *.sort.targetcoverage.cnn ; do python ~/software/cnvkit-0.9.5/cnvkit.py call $i -o $i.call.cns;
for i in *.sort.cnr; do python ~/software/cnvkit-0.9.5/cnvkit.py gainloss $i -s ${i%%.*}.tumor.sort.targetcoverage.cnn.call.cns > $i.CNV ;done;
python cnvkit.py heatmap *.cns
结果展示:
参考:
https://cnvkit.readthedocs.io/en/stable/quickstart.html
https://www.plob.org/article/10931.html
转载请注明出处
欢迎关注公众号:oddxix
网友评论