[Bioperl-l] embl parser to extract exon lengths from feature table (FT)

Hilmar Lapp hlapp@gnf.org
Fri, 27 Sep 2002 09:55:13 -0700


use Bio::SeqIO;

my $seqin = Bio::SeqIO->new(-file => "<myinputfile", -format => "embl");

while(my $seq->next_seq()) {
	foreach my $feat ($seq->top_SeqFeatures()) {
		next unless $feat->primary_tag() eq "mRNA";
		my $i = 1;
		foreach my $loc ($feat->location()->each_location()) {
			print $seq->display_id(), 
                        ": exon $i has length ", $loc->length(),"\n";
		      $i++;
		}
	}
}

This will work for single-exon, multi-exon, plus-strand, and reverse-strand. It will even work for remote-location exons.

	-hilmar

> -----Original Message-----
> From: Zayed Albertyn [mailto:zayed@sanbi.ac.za]
> Sent: Friday, September 27, 2002 2:25 AM
> To: bioperl-l@bioperl.org
> Subject: [Bioperl-l] embl parser to extract exon lengths from feature
> table (FT)
> 
> 
> Hi there
> 
> I would like to know if there is a quick and neat way in perl 
> or bioperl
> to extract the lengths of exons from FT in EMBL format e.g.
> 
> FT   mRNA
> complement(join(501..977,1182..1358,3721..3871,6060..6147,
> FT                   8480..8591))
> FT                   /note=EST2genome
> FT                   /evidence=EXPERIMENTAL
> 
> 
> All I would like are the lengths. I could write a script to 
> do this but
> somehow I feel that it has already been done in bioperl.
> 
> Thanks
> Zayed
> 
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l@bioperl.org
> http://bioperl.org/mailman/listinfo/bioperl-l
>