Adding Feature To Genbank In Biopython
0
0
Entering edit mode
12.2 years ago
Gorysko ▴ 100

Dear all now I'm writing small script for adding feature to genbank file

"

from Bio import SeqIO

from Bio.SeqFeature import SeqFeature, FeatureLocation

record = SeqIO.read("mirum.gbk", "genbank")

for sub_feature in record.features:

    for  seq_record in SeqIO.parse("mirum_ort.fasta", "fasta"):

      dbxref = sub_feature.qualifiers.get("db_xref")

          if dbxref == seq.record:

              dbxref.append("ortholog")

"

But in general it's working without appending new feature in bioperl I've written such script which is looking like

"

use Bio::SeqIO;

$| = 1;

my $seqio_object = Bio::SeqIO->new(-file => "mirum.gbk" );

my $seq_object = $seqio_object->next_seq;

for my $feat_object ($seq_object->get_SeqFeatures)

    {

    for my $tag ($feat_object->get_all_tags)

            {

            if ($tag eq "db_xref")

                    {

                    for my $value ($feat_object->get_tag_values($tag))

                            {

                            if ($value =~ m/^([0-9]+)/)

                                    {

                                    my $gi_gbk = "$1";

                                    my $seqio_object_fasta = Bio::SeqIO->new(-file =>"mirum_ort.fasta" );

                                    while (my $seq_object_fasta = $seqio_object_fasta->next_seq)

                                            {

                                            my $gi_fasta = $seq_object_fasta->id();

                                            $gi_fasta =~ s/^gi\|([0-9]+)\|ref.*$/$1/;

                                            if ($gi_gbk eq $gi_fasta)

                                                    {

                                                    my $misc_feat = new Bio::SeqFeature::Generic(-start => $feat_object->location->start(), -end => $feat_object->location->end(), -strand => $feat_object->location->strand(), -primary$

                                                    $seq_object->add_SeqFeature($misc_feat);



                                                    }

                                            }



                                    }

                            }

                    }

            }

    }

my $seqio_object_out = Bio::SeqIO->new(-file => ">mirum_ort.gbk" );

$seqio_object_out->write_seq($seq_object);

"

But my interest is to write it in Biopython

What could You advice me to change in this script

Thank You

genbank biopython • 4.0k views
ADD COMMENT
3
Entering edit mode

If you want to add a new feature, make a SeqFeature object. instead it looks like you are trying to add a database cross reference.

ADD REPLY
0
Entering edit mode

I really cannot answer, but I'm curious: why are you doing this? Thx

ADD REPLY
0
Entering edit mode

thnx you Peter ,you comment auiqte good in this situation

ADD REPLY

Login before adding your answer.

Traffic: 2072 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6