[Bioperl-l] Question on whole-genome comparisions

Andreas Bernauer andreas.bernauer at gmx.de
Fri Dec 12 14:55:08 EST 2003


Steven Lembark wrote:
> Q: Is there any doc on processing whole-genome GenBank files?
> 
> 	#!/opt/bin/perl
> 
> 	use strict;
> 	use warnings;
> 
> 	use Bio::Seq;
> 
> 	sub read_genome
> 	{
> 		use Bio::SeqIO;
> 
> 		my $in = Bio::SeqIO->new( qw( -format genbank -file ), shift 
> 		);
> 
> 		my @a = ();
> 
> 		# whole genome gives an array of all genes as a feature of 
> 		the
> 		# first sequence...
> 
> 		my $genome = $in->next_seq;
> 
> 		# this includes the whole genome as the first item,
> 		# followed by individual genes.
> 
> 		my @genz = $genome->get_SeqFeatures;
#            ***
> 	}
> 
> 	# q: at this point what is the best way to iterate the
> 	# DNA sequences for each of the genes?
> 


I am not sure if I understood you correctly.  Do you think this will
work at the place marked by *** ?


@features = $genome->get_SeqFeatures(); # just top level
foreach my $feat ( @features ) {
  print "Feature ",$feat->primary_tag," starts ",$feat->start," ends ",
        $feat->end," strand ",$feat->strand,"\n";
        # features retain link to underlying sequence object
        print "Feature sequence is ",$feat->seq->seq(),"\n"
    }


(This is from the Seq man
page. http://doc.bioperl.org/releases/bioperl-1.2.3/Bio/Seq.html) 


  foreach $feat ( $seq->top_SeqFeatures() ) {
    print "Feature from ", $feat->start, "to ", 
      $feat->end, " Primary tag  ", $feat->primary_tag, 
	", produced by ", $feat->source_tag(), "\n";
    if ( $feat->strand == 0 ) {
      print "Feature applicable to either strand\n";
    } else {
      print "Feature on strand ", $feat->strand,"\n"; # -1,1
    }
    foreach $tag ( $feat->all_tags() ) {
      print "Feature has tag ", $tag, "with values, ",
	join(' ',$feat->each_tag_value($tag)), "\n";
    }
    print "new feature\n" if $feat->has_tag('new');
    # features can have sub features
    my @subfeat = $feat->get_SeqFeatures();
  }


(This is from the SeqFeatureI man page.
http://doc.bioperl.org/releases/bioperl-1.2.3/Bio/SeqFeatureI.html)


The man pages contain further informations on how to acccess the
tags.  I don't think you need the subfeature feature.

Hope this helps.

Andreas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://portal.open-bio.org/pipermail/bioperl-l/attachments/20031212/0b0ca8b2/attachment.bin


More information about the Bioperl-l mailing list