Biopython 翻译()错误

Biopython translate() error

我有一个看起来像这样的文件:

Type    Variant_class   ACC_NUM dbsnp   genomic_coordinates_hg18    genomic_coordinates_hg19    HGVS_cdna   HGVS_protein    gene    disease sequence_context_hg18   sequence_context_hg19   codon_change    codon_number    intron_number   site    location    location_reference_point    author  journal vol page    year    pmid    entrezid    sift_score  sift_prediction mutpred_score
1   DM  CM920001    rs1800433   null    chr12:9232351:- NM_000014.4 NP_000005.2:p.C972Y A2M Chronicobstructivepulmonarydisease  null    CACAAAATCTTCTCCAGATGCCCTATGGCT[G/A]TGGAGAGCAGAATATGGTCCTCTTTGCTCC   TGT TAT 972 null    null    2   null    Poller  HUMGENET    88  313 1992    1370808 2   0   DAMAGING    0.594315245478036
1   DM  CM004784    rs74315453  null    chr22:43089410:-    NM_017436.4 NP_059132.1:p.M183K A4GALT  Pksynthasedeficiency(pphenotype)    null    TGCTCTCCGACGCCTCCAGGATCGCACTCA[T/A]GTGGAAGTTCGGCGGCATCTACCTGGACAC   ATG AAG 183 null    null    2   null    Steffensen  JBC 275 16723   2000    10747952    53947   0   DAMAGING    0.787878787878788

我想将第 13 列和第 14 列的信息翻译成它们对应的氨基酸。这是我生成的脚本:

from Bio.Seq import Seq
from Bio.Alphabet import generic_dna

InFile = open("disease_mut_splitfinal.txt", 'rU')

InFile.readline()
OriginalSeq_list = []
MutSeq_list = []

import csv
with open("disease_mut_splitfinal.txt") as f:
    reader = csv.DictReader(f, delimiter= "\t")
    for row in reader: 
        OriginalSeq = row['codon_change']
        MutSeq = row['codon_number']
        region = row["genomic_coordinates_hg19"]
        gene = row["gene"]
        OriginalSeq_list.append(OriginalSeq)
        MutSeq_list.append(MutSeq)

OutputFileName = "Translated.txt"
OutputFile = open(OutputFileName, 'w')
OutputFile.write(''+region+'\t'+gene+'\n')


for i in range(0, len(OriginalSeq_list)):
    OrigSeq = OriginalSeq_list[i]
    MutSEQ = MutSeq_list[i]
    print OrigSeq
    translated_original = OrigSeq.translate()
    translated_mut= MutSEQ.translate()

    OutputFile.write("\n" + OriginalSeq_list[i]+ "\t" + str(translated_original) + "\t" +MutSeq_list[i] + "\t" + str(translated_mut)+ "\n")

但是,我不断收到此错误:

TypeError: translate expected at least 1 arguments, got 0

我对自己做错的事情有点不知所措。有什么建议吗?

https://www.dropbox.com/s/cd8chtacj3glb8d/disease_mut_splitfinal.txt?dl=0

(即使您没有保管箱,文件仍然可以下载)

您正在使用字符串方法 "translate" 而不是 biopython seq 对象方法 translate,这是我假设您想要做的。您需要将字符串转换为 seq 对象,然后进行翻译。尝试

from Bio import Seq    
OrigSeq = Seq.Seq(OriginalSeq_list[i])
translated_original = OrigSeq.translate()

或者

from Bio.Seq import Seq
OrigSeq = Seq(OriginalSeq_list[i])
translated_original = OrigSeq.translate()