Skip to content

SAM #

Find similar titles

10회 업데이트 됨.

Edit
  • 최초 작성자
  • 최근 업데이트
    Dragon

Structured data

Category
Analysis

SAM 파일이란? #

SAM 파일은 Sequence alignment data를 담고 있는 텍스트 파일(.txt)로 각 내용은 탭(tab)으로 분리되어 alignment, mapping 정보를 담고 있다. Next-generation sequencing (NGS) 을 통해 시퀀싱 된 서열의 전사체 혹은 유전체 서열(Reference, @로 시작되는)에 FASTQ 파일을 다시 mapping 시킨 형태의 파일이다.

SAM 파일은 텍스트 파일의 문자열 형식으로 저장하여 바로 열람할 수 있으며, 이를 압축하고 색인화하여 바이너리 형식으로 변환한 것이 BAM 파일이다.

NGS의 발달로 불특정 다수의 organism에서 유전체 혹은 전사체 서열이 대량으로 시퀀싱 되고 있다. Human의 경우는 개인차에 의한 다수의 변이 정보를 밝히고 이것이 질병과 연관된 변이인지를 밝히기 위해 시퀀싱 된 reads는 유전체 서열에 다시 remapping 되기도 하고, 새로운 organism의 유전체 정보를 밝히기 위해서도 remapping이 이뤄지고 있다. SAM 파일은 '1000 genome project'를 진행하면서 공동 연구의 효율성을 위해 데이터의 공유를 표준화 하려는 방안으로 채택된 remapping의 표준 포맷이다.

Remapping을 위해 많이 이용하는 software인 BWA, Bowtie, CLCAssemblyCell 등은 모두 mapping output으로 SAM 파일을 형성한다.

SAM 파일들을 다루는데 필요한 software package로는 SAMtools 가 있다.

SAM 파일 구성 #

Header 부분에는 각 Chromosome에 mapping 된 정보를 가지고 있으며, Align 된 read 들은 각 alignment 당 한 줄로 보여지게 된다.

Figure1

@HEADER : Reference로 이용된 서열의 정보, @ 표시로 시작
read_id : read name
flag : sam flag, mapping information로 2bit로 정의되어 있음, 아래참조
mapping reference id : 만약에 align된 read가 없으면 "*"로 표시
mapping position : 1-based index, read의 왼쪽 끝
mapping quality : alignment의 특이성(uniqueness)을 묘사, 0=특이성 없음, >10 아마도 특이함
CIGAR tag : mapping 형태, alignment 안의 insertions/deletions/matches의 위치 묘사 및 splice junctions의 부호화
mapping 횟수
MPOS/PNEXT : mate pair의 position 정보
ISIZE/TLEN : Template length
SEQ : Read Sequence
QUAL : Read Quality
TAGs

SAM workflow #

  • SAM 파일을 binary 형태인 BAM 파일로 전환

    • samtools view를 이용해서 변환한다.
      samtools view -Sb -h -@ [threads] [SAM] -o [BAM]
      
      -S : input file 포맷 자동으로 확인함.
      -b : output file 포맷 BAM
      -h : SAM file header 출력 (사용하지 않으면, 매핑 결과부터 전환)
      -@ : 사용할 multi-core 수
      -o : samtools view의 결과 파일 (사용하지 않으면, STDOUT)
      
  • Data processing을 간소화하기 위한 sorting

    • 시퀀싱 리드 매핑 결과를 참조 유전체 서열의 포지션 별로 정렬하는 프로그램이다.
    • samtools sort를 이용해서 변환한다.
      samtools sort -@ [threads] -o [sorted.bam] [BAM]
      
      -o : samtools sort의 결과 파일 (사용하지 않으면, STDOUT)
      -@ : 사용할 multi-core 수
      
  • sorted.bam file 내의 매핑 결과를 빠르게 접근하기 위한 index

    samtool index -b -@ [threads] [sorted.bam] [out.index]
    
    -b : BAM file의 index (.bai 파일 생성)
    -@ : 사용할 multi-core 수
    

SAM file 내의 flag 정보 #

Flag Chr Description
0x0001 p the read is paired in sequencing
0x0002 P the read is mapped in a proper pair
0x0004 u the query sequence itself is unmapped
0x0008 U the mate is unmapped
0x0010 r strand of the query (1 for reverse)
0x0020 R strand of the mate
0x0040 1 the read is the first read in a pair
0x0080 2 the read is the second read in a pair
0x0100 s the alignment is not primary
0x0200 f the read fails platform/vendor quality checks
0x0400 d the read is either a PCR or an optical duplicate

Figure2

관련 페이지 #

(http://www.incodom.kr/SAMtools)

Incoming Links #

Related Data Sciences #

Related Bioinformaticses #

Suggested Pages #

0.0.1_20240318_1_v95