cleanUrl: "usage/biotite-structure-usage"
description: "단백질 구조 데이터를 쉽게 다루게 도와주는 biotite.structure 모듈 사용법을 정리합니다."

PDB 파일을 읽고, 단백질 구조의 geometry를 다루는 것을 도와주는 biotite.structure 패키지의 사용법을 정리합니다.

Installation

$ conda install -c conda-forge biotite

Quickstart

주요 import

import biotite.structure as struc

from biotite.structure.io.pdb import PDBFile

PDB 파일 읽고 구조 불러오기 [PDBFile.read](<http://PDBFile.read>) , get_structure

pdb = PDBFile.read('my_pdb_file.pdb')

# Get AtomArray (or structure) of the first model
structure = pdb.get_structure(model=1)

[PDBFile.read](<http://PDBFile.read>) 메서드는 PDBFile object를 반환한다. PDBFile object는 말 그대로 PDB 파일이 가진 정보들을 다 담고 있다고 보면 되는데, 유용한 메서드들은 아래와 같다.

  1. pdb.get_structure() :
    1. model : int (optional) → 모델 번호를 주면 이에 해당하는 모델의 AtomArray만 리턴한다. 없으면 모든 모델 정보가 있는 AtomArrayStack이 리턴된다.
  2. pdb.get_model_count() : PDB 파일 내에 담겨 있는 model의 개수를 리턴한다.
  3. pdb.write(file) : 해당 PDBFile object 내의 정보를 PDB 포맷으로 저장한다.

구조에 존재하는 chain ID 확인하기 struc.get_chains(atom_array)

struc.get_chains(structure)

예시 출력

array(['R', 'S', 'T', 'X', 'Y', 'Z', 'B', 'F', 'G', 'I', 'J', 'K', 'M',
       'N', 'O', 'P', 'Q', 'U', 'V', 'W', 'a', 'b', 'c', 'd', 'e', 'f',
       'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 'A',
       'C', 'D', 'E', 'H', 'L'], dtype='<U4')

원하는 chain만 선택하기