https://rosalind.info/problems/need/
ROSALIND | Pairwise Global Alignment
It appears that your browser has JavaScript disabled. Rosalind requires your browser to be JavaScript enabled. Pairwise Global Alignment solved by 1385 Comparing Strings Online Figure 1. An alignment of two human zinc finger proteins, identified by their G
rosalind.info
이 문제는 두 개의 아이디가 주어지고 두 아이디로 GenBank에서 DAN 서열을 찾고 그 두개로 Pairwsie alignment를 돌려 점수를 뽑는 문제이다.
이 문제는 직접 하자면 어려운 문제지만 문제의 의도는 바이오파이썬 Align 모듈을 활용하여 푸는 것이다. 직접 풀자면 https://jangbearbio.tistory.com/73 이 글을 참조하여 풀 수는 있다.
from Bio import Align
from Bio import SeqIO
from Bio.Align import substitution_matrices
from Bio import Entrez
Entrez.email = 'jangbear1109@gmail.com'
with open(r"파일경로",'r') as f:
IDs = f.readline().rstrip().split()
handle = Entrez.efetch(db='nucleotide',id=IDs,rettype= 'fasta')
records = list(SeqIO.parse(handle,'fasta'))
aligner = Align.PairwiseAligner()
aligner.open_gap_score = -10
aligner.extend_gap_score = -1
aligner.substitution_matrix = substitution_matrices.load('NUC.4.4')
score = aligner.score(records[0].seq,records[1].seq)
print(score)
바이오파이썬에서 Align의 특징은 aligner가 필요하다는 것이다. 내가 하고 싶은 align의 설정을 다 aligner에 설정해놓고 그 다음 서열만 넣어서 그대로 align을 돌리는 것이다.
'생물정보학 > 바이오파이썬' 카테고리의 다른 글
FASTQ 파일 다루기 (1) | 2024.11.30 |
---|---|
단백질 번역하기 (2) | 2024.11.29 |
FASTQ 형식 소개 (0) | 2024.11.24 |
MEME으로 protein motif 찾기 (0) | 2024.11.24 |
Entrez 모듈로 GenBank에 접근하기 (1) | 2024.11.24 |