bioperl / bioperl-live-redmine

Legacy tickets migrated from the OBF Redmine issue tracker: http://redmine.open-bio.org
0 stars 0 forks source link

Bio::CodonUsage::Table from Bio::DB::CUTG lack relative frequencies #123

Open cjfields opened 8 years ago

cjfields commented 8 years ago

Author Name: Keith Robison (Keith Robison) Original Redmine Issue: 3292, https://redmine.open-bio.org/issues/3292 Original Date: 2011-09-20 Original Assignee: Bioperl Guts


The code below on a fresh install of BioPerl will print 0 for the relative frequency of ATG for Bacillus subtilis (or apparently any other organism). The Kasuza site is apparently not computing this any more & returning ‘0.00’ in all cases.

!/usr/bin/perl

use strict; use Bio::CodonUsage::Table; use Bio::DB::CUTG;

my $db=Bio::DB::CUTG->new(-sp =>‘Bacillus subtilis [’, -gc => 1); my $cut=$db->get_request(); print “Look! No Met!\t”,$cut->codon_rel_frequency(‘ATG’),“\n”;

  1. line which was parsed by Bio::CodonUsage::IO below; note 0.00 for frequency
  2. Met ATG 21424.00 26.27 0.00
cjfields commented 8 years ago

Original Redmine Comment Author Name: Chris Fields Original Date: 2011-09-20T14:13:29Z


This seems to be a problem with CUTG output and not bioperl. I have notified them of the issue, let’s see if they respond. Otherwise, there isn’t much we can do from our end beyond switch output (which will require rewriting the parser from scratch, not the best option).

cjfields commented 8 years ago

Original Redmine Comment Author Name: Keith Robison Original Date: 2011-09-20T18:01:47Z


Yeah, it’s clearly an upstream problem. But, these are easy to compute — some code I wrote after posting this last night to fix this (where $cut is the usage table)

foreach my $three(keys %{$cut->{’_table’}}) { my $sum=0; foreach my $hash(values %{$cut->{’_table’}->{$three}}) { $sum+=$hash->{’abs_count’}; } foreach my $hash(values %{$cut->{’_table’}->{$three}}) { $hash->{’rel_freq’}=$hash->{’abs_count’}/$sum; } }

cjfields commented 8 years ago

Original Redmine Comment Author Name: Keith Robison Original Date: 2011-09-20T18:07:54Z


What other thought — the code above is not rounding anything the way the current tables (and IO) do, so there is a risk of slightly different behavior between loading a file from disk & slurping one from the server if the code above is put in place