This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Modifying Genbank File To Visualize Genes Using Artemis

Hi all, I'm trying to visualize certain genes using sanger's genome visualization tool Artemis.For that I want to modify a Genbank file by adding misc_features and their value as the sequnece start..end and /colour=2 identifier between FEATURES and SOURCE identifiers as follows:

FEATURES             Location/Qualifiers
     misc_feature     3360096..3361436
                      /colour=2
     misc_feature     2931510..2932826
                      /colour=2
     misc_feature     904348..906762
                      /colour=2
source          1..3544776
                     /organism="Geobacillus kaustophilus HTA426"
                     /mol_type="genomic DNA"
                     /strain="HTA426"
                     /isolation_source="isolated from the deepest Ocean"
                     /db_xref="taxon:235909"
                     /note="thermophile"

As this is going to be implemented with a lot of genes and genomes therefore could anybody suggest me a perl script which does this job by taking sequence coordinate(start..end) and the genbank file (to be modified) as input and outputing the desired Genbank file.Any help is highly appreciated.

genome visualization perl genbank

1 answer

Take a look at the Bioperl Feature Annotation HOW-TO, in particular the section Building Your Own Sequences. It should make your task very easy.

Briefly, you read in the GenBank file like this:

use strict;
use Bio::SeqIO;

my $seqio = Bio::SeqIO->new(-file => "myfile.gb", -format => "genbank");
my $gb    = $seqio->next_seq;

Then you can create your feature like this (assuming you can get start/end from somewhere):

use Bio::SeqFeature::Generic;
my $feat = Bio::SeqFeature::Generic->new(-start       => 3360096,
                                         -end         => 3361436,
                                         -primary_tag => 'misc_feature',
                                         -tag         => {colour => "2"});

Add it to the sequence object:

$gb->add_SeqFeature($feat);

And write out a new GenBank file:

my $outseq = Bio::SeqIO->new(-format => "genbank", -file => ">mynewfile.gb" );
$outseq->write_seq($gb);

Log in to answer this question.