#리눅스 -> Variant calling 총 정리 [#1~#12]

NGS 결과물로 획득된, 데이터의 Mutation calling 총 정리


#데이터 획득의 순서

Bcl -> fasta -> sam -> bam -> vcf -> txt

---------------------------------------------------------------------------------------

bcl-> fasta [illumina 기계 자체내에서 generate fastaq  진행]
fasta -> mapping [BWA]
sam/bam file -> samtool 이용
vcf -> GATK 이용하여 mutation calling
txt -> Annovar이용하여 annotation

---------------------------------------------------------------------------------------


#설치해야하는 프로그램

(설치하기 전에 update 해야 함. sudo apt-get update)

sudo apt-get y install bwa
sudo apt-get install samtools
sudo apt-get install aptitude
sudo apt-get install python-is-python3

-----------------------------------------------------------------------------------------------------

sudo apt-get install openjdk-17-jdk
sudo gedit ~/.bashrc

텍스트 편집기가 나타나면 하단의 명령어 추가 입력

#JAVA home setting
export JAVA_HOME=$(dirname $(dirname $(readlink -f $(which java))))
export PATH=$PATH:$JAVA_HOME/bin

저장하기 누른 후, 텍스트 편집기 닫기


현재 켜져있는 터미널 창에 바로 적용하기
$ source ~/.bashrc


설정 확인
$ echo $JAVA_HOME
/usr/lib/jvm/java-17-openjdk-am64

-------------------------------------------------------------------------------------------------

#다운받아야하는 파일

GATK 파일

https://github.com/broadinstitute/gatk/releases
gatk-4.4.0.0.zip  

다운 받은 경로로 이동하여, 압축 해제
unzip gatk-4.4.0.0

human reference 파일

case 1) chromosome 전체

wget https://hgdownload.soe.ucsc.edu/goldenPath/hg38/bigZips/hg38.fa.gz

다운 받은 경로로 이동하여,
unzip hg38.fa.gz


case 2) chromosome 별로 나눠서
wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/chromaFa.tar.gz

다운 받은 경로로 이동하여,  압축 해제
tar xvzf chromFa.tar.gz


#Reference file에 indexing 하기 

1) .fai 파일 생성하기

 samtools faidx ~reference 있는 경로


예를 들어, 내 chr1.fa 파일이  /home/sj/Desktop/demo/supporting_files/hg38_chr1/chr1.fa여기에 위치할 경우, 아래와 같이 명령어 작성

samtools faidx ~/home/sj/Desktop/demo/supporting_files/hg38_chr1/chr1.fa

위의 명령어가 제대로 작동하면, chr1.fa.fai 파일이 생성됨. 


2) .dict 파일 생성하기

GATK 다운로드 받은 경로로 이동하기 

예시) cd /home/sj/Desktop/Downloads/gatk-4.4.0.0

 

그 후 아래의 두 개 파일 활성화

java -jar gatk-package-4.4.0.0.local.jar
java -jar gatk-package-4.4.0.0.spark.jar


위의 두 개가 각각 잘 작동한다면, 수많은 명령의 내용이 쭉 나타날 것임
만약에 no~ 와 같은 명령어가 뜬다면, 명령어에 오타가 있을 수 있으니 확인해야함.


활성화가 끝나고 나면 아래 경로 지정 

alias gatk="/home/sj/Downloads/gatk-4.3.0.0/gatk"


그 후 아래의 명령어 한 줄로 작성 

gatk CreateSequenceDictionary R=~[내가 reference file, 그러니까 chr1.fa 파일이 저장된 경로]  O=~[내가 reference file, 그러니까 chr1.fa 파일이 저장된 경로].dict 


예시)

gatk CreateSequenceDictionary R=~/home/sj/Desktop/demo/supporting_files/hg38_chr1/chr1.fa O=~/home/sj/Desktop/demo/supporting_files/hg38_chr1/chr1.dict


위의 명령어가 제대로 작동하면, chr1.dict 파일이 생성됨. 


3) BWA indexing

경로 지정 명령어 (ref 다음에 띄어쓰기 없음!)

ref="내가 reference file, 그러니까 chr1.fa 파일이 저장된 경로"

예시) ref="/home/sj/Desktop/demo/supporting_files/hg38_chr1/chr1.fa"

bwa index ${ref}

위의 명령어가 제대로 작동하면, 6개의 파일이 생성됨. 


# BWA mapping 

경로 지정 명령어

(아래는 예시!!!!!!, 본인의 저장하고 싶은 경로, 각각 파일이 저장된 경로에 맞게 설정 바람!!!)

aligned_reads="/home/sj/Desktop/demo/VC/aligned_reads"
reads="/home/sj/Desktop/demo/VC/reads"
results="/home/sj/Desktop/demo/VC/result"
data="/home/sj/Desktop/demo/VC/data"

 

BWA 작동 명령어

(\표시는 /와 반대되는 슬래시 모양 백스페이스 아래를 누르면 됨)

bwa mem -t 4 -R "@RG\tID:1\tPL:ILLUMINA\tSM:1" ${ref} ${reads}foward 파일 이름 ${reads}reverse 파일 이름 | samtools sort > ${aligned_reads}/1.bam


예시)

bwa mem -t 4 -R "@RG\tID:1\tPL:ILLUMINA\tSM:1" ${ref} ${reads}/1_S1_L001_R1_001.fastq.gz ${reads}/1_S1_L001_R2_001.fastq.gz | samtools sort > ${aligned_reads}/1.bam


# Bai file 생성

samtools index ${aligned_reads}/1.bam


 돌연변이 calling - GATK haployercalling
하단의 예시보고, 본인들의 파일 이름에 맞게 이름 변경하여 적용하기!

gatk HaplotypeCaller -R ${ref} -I ${aligned_reads}/1.bam -O ${results}/1_variants.vcf

#8 돌연변이 calling - GATK Muteck2


- 일반 normal과 mathed sample이 있는 경우

gatk Mutect2 \

     -R reference.fa \

     -I tumor.bam \

     -I normal.bam \

     -normal normal_sample_name \

     --germline-resource af-only-gnomad.vcf.gz \

     --panel-of-normals pon.vcf.gz \

     -O somatic.vcf.gz


-tumor-only mode

  gatk Mutect2  -R ${ref} -I ${aligned_reads}/1.bam -O ${results}/1_raw_variants.vcf.gz


- FFPE sample mode

gatk Mutect2 -R ${ref} -I ${aligned_reads}/1.bam --f1r2-tar-gz fir2.tar.gz -O ${results}/1_FFPE_raw_variants.vcf


이렇게 하면 끝!!!!

댓글

이 블로그의 인기 게시물

#single cell sequencing 기초 분석 - #1 R 설치 및 package 설치

리눅스 기초 #10 GATK calling을 사용하기 위하여, reference file indexing하는 방법

Single cell 분석을 위한 package 소개