LoginSignup
1
0

More than 1 year has passed since last update.

AWS Amazon Linux2 インスタンスに samtools・bcftools をインストールする

Posted at

初めに

今回は samtools と bcftools を Linux 2 インスタンスにインストールする手順について書きます。

ユーザーは ec2-user、ボリュームは 100 GiB の gp2 を使用しました。デフォルトの 8 GiB では前回足りなくなりました。

前回は BWA を Linux 2 インスタンスにインストールしました。

samtools をインストールする

以下のページからファイルをダウンロードします。

4.png

必要なパッケージをインストールします。

sudo yum install ncurses-devel
sudo yum install xz-devel
sudo yum install bzip2-devel
sudo yum install libcurl-devel

以下のコマンドを順に実行しビルドします。

tar -jxvf samtools-1.14.tar.bz2
cd samtools-1.14/
./configure --prefix=/usr/bin/
make
sudo cp samtools /usr/bin/

バージョンを確認し、インストールされたことを確認します。

$ samtools --version
samtools 1.14
Using htslib 1.14
Copyright (C) 2021 Genome Research Ltd.

bcftools をインストールする

先ほどと同様にビルドします。

tar -jxvf bcftools-1.14.tar.bz2
cd bcftools-1.14
./configure --prefix=/usr/bin/
make
sudo cp samtools /usr/bin/

こちらもバージョンを確認し、インストールされたことを確認します。

$ bcftools --version
bcftools 1.14
Using htslib 1.14
Copyright (C) 2021 Genome Research Ltd.
License Expat: The MIT/Expat license
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

リファレンスファイルをダウンロードする

今回はこちらのリファレンスファイルを使用します。

wget hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/chromFa.tar.gz
tar -zxvf chromFa.tar.gz
cat chr*.fa > hg19.fa
mkdir fa_files
cp chr*.fa fa_files

バリアントコール

samtools、bcftools を使用してバリアントコールをします。

まず ART を使用して FASTQ ファイルを作成します。

$ art_illumina -ss HS25 -sam -i fa_files/chr5.fa -p -l 150 -f 20 -m 200 -s 10 -o paired_dat
$ head -5000 paired_dat1.fq > paired_1.fq
$ head -5000 paired_dat2.fq > paired_2.fq

マッピングします。

$ bwa index fa_files/hg19.fa
$ bwa mem -t 8 -o output.sam fa_files/hg19.fa paired_1.fq paired_2.fq

ソートし、インデックスファイルを作成します。

$ samtools sort -@ 4 -o output.bam output.sam
$ samtools index output.bam

バリアントコールします。

$ samtools mpileup -uf fa_files/hg19.fa output.bam | bcftools call -mv > output.vcf

参考記事

  • Samtools 公式ページ

  • samtools のインストール

  • VCFやBCF を扱う bcftools

  • Generate an HG19 Reference

1
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
1
0