[Bioperl-l] Genbank files

Smithies, Russell Russell.Smithies at agresearch.co.nz
Wed Dec 14 03:17:02 UTC 2011


Something like this:

use strict;
use Bio::SeqIO;

my @V;
open (LIST1, 'list') ||die;
while (<LIST1>){
    push @V, (split(/\t/, $_))[0];
}
close(LIST1);

my $seqio_object = Bio::SeqIO->new(-file=>"Contig100.gb");
my $seq_object = $seqio_object->next_seq;

for my $feat_object ($seq_object->get_SeqFeatures){
    if ($feat_object->primary_tag eq "CDS"){
        if ($feat_object->has_tag('locus_tag')){
            for my $V3 ($feat_object->get_tag_values('locus_tag')){
                for my $V1 (@V) {
                    if ($V1 eq $V3){
                        #ADD NEW FEATURES
                        $feat_object->add_tag_value('color','blue');
                    }
                }
            }
        }
    }
}
#write the new annotations
my $io = Bio::SeqIO->new(-format => "genbank", -file => ">new.gb" );
$io->write_seq($seq_object);

Take another look at http://www.bioperl.org/wiki/HOWTO:Feature-Annotation#Building_Your_Own_Sequences

--Russell




> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of BForde
> Sent: Tuesday, 13 December 2011 6:21 a.m.
> To: Bioperl-l at lists.open-bio.org
> Subject: Re: [Bioperl-l] Genbank files
> 
> 
> Than you for the replies.
> 
> I am unsure as to how to use the line below with my script. My script so far
> reads
> 
> use strict;
> use Bio::SeqIO;
> 
> my @V;
> open (LIST1, 'list') ||die;
> while (<LIST1>){
>     push @V, (split(/\t/, $_))[0];
> }
> close(LIST1);
> 
> my $seqio_object = Bio::SeqIO->new(-file=>"Contig100.gb");
> my $seq_object = $seqio_object->next_seq;
> 
> for my $feat_object ($seq_object->get_SeqFeatures){
>     if ($feat_object->primary_tag eq "CDS"){
>         if ($feat_object->has_tag('locus_tag')){
>             for my $V3 ($feat_object->get_tag_values('locus_tag')){
>                 for my $V1 (@V) {
>                     if ($V1 eq $V3){
>                         ADD NEW FEATURES
> 
>                     }
>                 }
>             }
>         }
>     }
> }
> 
> The script works down as far as the comparison point where locus_tags in the
> genbankfile "Contig100.gb" are compared against a list of locus_tags from a
> delimited txt file.
> I possbile could you show me how to amend my script so I can add new
> features
> 
> regards
> 
> Brian
> 
> Jason Stajich-5 wrote:
> >
> > $feature->add_tag_value('color','blue');
> >
> > On Dec 9, 2011, at 8:52 AM, BForde wrote:
> >
> >>
> >> Hello all,
> >>
> >> I am new to Bioperl so I apologise if this is stupid question.
> >>
> >> For CDS features I which to add additional qualifiers e.g. /colour
> >> and /note qualifiers. I have looked at the BioPerl wiki but am still
> >> unsure as how to do this?
> >>
> >> regards
> >>
> >> Brian
> >> --
> >> View this message in context:
> >> http://old.nabble.com/Genbank-files-tp32941955p32941955.html
> >> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
> >>
> >> _______________________________________________
> >> Bioperl-l mailing list
> >> Bioperl-l at lists.open-bio.org
> >> http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >
> > Jason Stajich
> > jason.stajich at gmail.com
> > jason at bioperl.org
> >
> >
> > _______________________________________________
> > Bioperl-l mailing list
> > Bioperl-l at lists.open-bio.org
> > http://lists.open-bio.org/mailman/listinfo/bioperl-l
> >
> >
> 
> --
> View this message in context: http://old.nabble.com/Genbank-files-
> tp32941955p32959999.html
> Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l
=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================




More information about the Bioperl-l mailing list