Skip to content

Instantly share code, notes, and snippets.

@jhannah
Created January 25, 2010 21:38
Show Gist options
  • Save jhannah/286277 to your computer and use it in GitHub Desktop.
Save jhannah/286277 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use Bio::SeqIO;
my @files = `find /home/obcarter/2010/bacteria/ -name "*.gbk"`;
foreach my $file (@files) {
chomp $file;
my $in = Bio::SeqIO->new(-file => $file, -format => 'genbank');
while (my $seq = $in->next_seq) {
my @features = $seq->get_SeqFeatures(); # just top level
foreach my $feat ( @features ) {
next unless ($feat->primary_tag eq "CDS");
my ($gene) = $feat->get_tag_values("gene");
next unless ($gene);
my ($translation) = $feat->get_tag_values("translation");
my $start = $feat->location->start;
my $end = $feat->location->end;
print join "\t",
$seq->id, $gene, $start, $end,
entropy($translation),
#$translation,
;
print "\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment