美文网首页
格式转化 genbank to fasta

格式转化 genbank to fasta

作者: Sister_Ruth | 来源:发表于2020-05-07 16:47 被阅读0次

    https://warwick.ac.uk/fac/sci/moac/people/students/peter_cock/python/genbank2fasta

    from Bio import SeqIO

    gbk_filename = "NC_005213.gbk"

    faa_filename = "NC_005213_converted.faa"

    input_handle  = open(gbk_filename, "r")

    output_handle = open(faa_filename, "w")

    for seq_record in SeqIO.parse(input_handle, "genbank") :

        print "Dealing with GenBank record %s" % seq_record.id

        for seq_feature in seq_record.features :

            if seq_feature.type=="CDS" :

                assert len(seq_feature.qualifiers['translation'])==1

                output_handle.write(">%s from %s\n%s\n" % (

                      seq_feature.qualifiers['locus_tag'][0],

                      seq_record.name,

                      seq_feature.qualifiers['translation'][0]))

    output_handle.close()

    input_handle.close()


    https://github.com/combogenomics/regtools/blob/master/gbk2fna

    相关文章

      网友评论

          本文标题:格式转化 genbank to fasta

          本文链接:https://www.haomeiwen.com/subject/zheaghtx.html