【问题标题】:How can I find the number of the first base of a gene in a FASTA file?如何在 FASTA 文件中找到基因的第一个碱基的编号?
【发布时间】:2019-11-12 17:55:35
【问题描述】:
为了手动修改我拥有的 .gff 文件,我需要在我的动物的 FASTA 格式的基因组中找到我的基因的起始位置(即它在序列中的#碱基是什么?)。我有这个基因的序列。
我如何尽可能轻松地做到这一点(这不是一种在互联网上很容易获得基因组的动物)?
我拥有:基因组,FASTA 格式;一个 GFF 文件,其中包含该生物体基因组的注释(需要大量更新);这个基因的序列。
谢谢!
【问题讨论】:
标签:
bioinformatics
dna-sequence
gff
【解决方案1】:
如果您知道基因序列与参考中的相同,请执行
(使用python)
import re
match = re.search(your_gene_seq, your_genome_seq)
if match:
gene_start = match.start()
else:
print("no match")
否则,您需要将您的基因与参考进行成对比对
使用 Biopython:
python -m pip install biopython
from Bio import pairwise2
# alignment scores: match = 5, mismatch = -4, gap open = -2, gap extend = -0.5
alignment = pairwise2.align.globalms(your_gene_seq, your_genome_seq, 5, -4, -2, -0.5)[0]
gene_start = alignment[3]
更新gff
使用 biopython
https://biopython.org/wiki/GFF_Parsing