0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

複数種のSNPを含むvcfファイルの分割方法[備忘録]

Last updated at Posted at 2022-04-25

GATKを用いて複数種に対してSNP callingすると、1つのvcfファイルに複数種のSNPが記される。
例えば、種間でSNPを比較したいときには、GATKやbcftoolsで比較するが、その際に比較したいvcfファイルはそれぞれ分割されている必要がある。そこで、以下のスクリプトにより複数種のSNP情報を含むvcfファイルを分割した。

$ for sample in `bcftools query -l merged_snps_filtered.vcf.gz`
  do
  bcftools view -c1 -Oz -s $sample -o $sample.vcf.gz merged_snps_filtered.vcf.gz
  done

bcftools: ver. 1.14を使用。

 
 

2023年3月17日追記
コードを修正しました。

また、分割後は以下のvcftoolsを用いたスクリプトにより、vcfファイルをまとめることが可能。

vcf-merge sample1.vcf.gz sample2.vcf.gz sample3.vcf.gz | bgzip -c > output.vcf.gz
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?