Bioinformatics/Metagenomics

[QIIME] Alpha rarefaction plotting

2021. 2. 8. 14:53

Alpha rarefaction curves

위 그래프는 다양성 분석시 적절한 sampling depth를 결정하기 위해 그려볼 필요가 있는 그래프이다.

2021/02/08 - [Bioinformatics/Microbiome] - [Diversity Analysis] Sampling depth를 결정하는 기준

 

본 포스팅에서는 QIIME을 이용하여 어떻게 위 그래프를 그리는지 알아보겠다.

 

Data set

먼저 다음의 임의의 데이터 셋을 준비한다 (Python 코드로 작성).

import csv
with open('test.tsv', 'wt') as out_file:
    tsv_writer = csv.writer(out_file, delimiter='\t')
    tsv_writer.writerow(['Counts', 'Sample1', 'Sample2', 'Sample3'])
    tsv_writer.writerow(['OTU1', 10, 20, 30])
    tsv_writer.writerow(['OTU2', 30, 20, 10])
    tsv_writer.writerow(['OTU3', 0, 15, 30])

혹은 다운받아서 사용하면 된다.

test.tsv
0.00MB

BIOM convert

QIIME에서는 tsv format 파일을 바로 import 시킬 수 없고, BIOM format을 먼저 거쳐야 한다.

BIOM format이란 Biological Observation Matrix의 약자로, OTU table을 나타낼 때 사용할 수 있다. 다양한 프로젝트에서 BIOM format을 사용하는데, 대표적으로 QIIME이 있다.

아래 코드로 BIOM convert가 가능하다.

! biom convert -i test.tsv -o test.biom --table-type="OTU table" --to-hdf5

QIIME

다음으로 QIIME에서 파일을 import하는데, 위에서 --to-hdf5로 convert를 했다면 아래의 코드로 import시킨다. 만약 --to-json로 convert를 했다면 --input-format BIOMV100Format으로 바꿔준다.

! qiime tools import \
  --input-path test.biom \
  --type 'FeatureTable[Frequency]' \
  --input-format BIOMV210Format \
  --output-path test.qza

다음으로 alpha-rarefaction plotting을 하여 visualization output을 얻어낸다: test.qzv

! qiime diversity alpha-rarefaction \
  --i-table test.qza \
  --p-max-depth 70 \
  --o-visualization alpha-rarefaction.qzv

이 파일을 아래 링크에 업로드 하면 rarefaction curve를 확인할 수 있다.

view.qiime2.org/

 

QIIME 2 View

( downloading site resources )

view.qiime2.org

Reference

  • biom-format.org/documentation/biom_conversion.html#general-usage-examples
  • docs.qiime2.org/2020.11/tutorials/importing/#feature-table-data
  • docs.qiime2.org/2020.11/tutorials/moving-pictures/#alpha-rarefaction-plotting
  • Bolyen, Evan et al. "Reproducible, interactive, scalable and extensible microbiome data science using QIIME 2". Nature Biotechnology 37. 8(2019): 852-857.
  • McDonald, Daniel et al. "The Biological Observation Matrix (BIOM) format or: how I learned to stop worrying and love the ome-ome". GigaScience 1. 1(2012): 7.

 

728x90
반응형