[BioRuby] test and bioruby shell questions

Naohisa GOTO ngoto at gen-info.osaka-u.ac.jp
Fri Sep 26 13:37:33 UTC 2008


Hi, 

On Thu, 25 Sep 2008 09:35:54 +0200
Davide Rambaldi <davide.rambaldi at ifom-ieo-campus.it> wrote:

> On Aug 30, 2008, at 2:16 PM, Toshiaki Katayama wrote:
> 
> > The demo above was designed to utilize the KEGG API, which is a  
> > SOAP based web service,
> > so we need to change the default data source to obtain this entry.
> > We can fix this by switching to use NCBI's efetch method instead.
> 
> 
> 
> I manage to write a fix for this... is really horrible actually (but  
> it works)
> I have inserted my code in the nested if/else that retrieve the  
> entry, so after the KEGG API try, the shell try NCBI::REST.efetch
> 
> Oni:~/src/bioruby tucano$ git diff lib/bio/shell/plugin/entry.rb
> diff --git a/lib/bio/shell/plugin/entry.rb b/lib/bio/shell/plugin/ 
> entry.rb
> index 6d36fb5..0a45ecd 100644
> --- a/lib/bio/shell/plugin/entry.rb
> +++ b/lib/bio/shell/plugin/entry.rb
> @@ -88,8 +88,16 @@ module Bio::Shell
> 
>         # KEGG API at http://www.genome.jp/kegg/soap/
>         else
> -        puts "Retrieving entry from KEGG API (#{arg})"
>           entry = bget(arg)
> +        if $?.exitstatus == 0 and str.length != 0
> +          puts "Retrieving entry from KEGG API (#{arg})"
> +        else
> +          # efetch from NCBI
> +          puts "Retrieving entry from NCBI (#{arg})"
> +          require 'bio/io/ncbirest.rb'
> +          fetch = Bio::NCBI::REST.efetch("AF237819",  
> {"db"=>"nuccore", "rettype"=>"gb"})
> +          entry = fetch.to_s
> +        end
>         end
>       end

Thank you for a patch, but it has some problems:
For KEGG API, $?.exitstatus has no mean, and no need to check $?.
The "AF237819" should not be hardcoded because the method is
not only for demo, but a bioruby-shell command to fetch entry
specified by a user. Also note that "db" => "nuccore" would
not always be good. (If result is empty, switching to another
database and trying again would be the best way.)

> So the questions/comments:
> 
> 1. I have added the require 'bio/io/ncbirest.rb' beacuse in bio.rb  
> ncbirest.rb is not loaded (only SOAP). Is a bug or a feature?

This is a bug, and it will soon be fixed.

> 2. the standard demo command now is able to retrieve the genbank  
> entry, but generate an error in the MIDI file generation:
> 
> bioruby> midifile("data/AF237819.mid", kuma.naseq)
> Saving MIDI file (data/AF237819.mid) ... Error: Failed to save (data/ 
> AF237819.mid) : No such file or directory - data/AF237819.mid
> 
>   any clue for this FAil?

The error may be caused because directory named "data"
did not exist, and the program cannot save the file.
To solve this, simply do "mkdir data".

> by the way: wow a module to translate a sequence in music? I really  
> wont to test it also! I have made a software that do something similar:
> 
> http://recipient.cc/playgene/
> 
> Is made with a perl (?!) script to efetch sequence from NCBI, and a  
> flash application for the interface and to load the music library... :-)

Yes, you can enjoy music.

Thanks,

Naohisa Goto
ngoto at gen-info.osaka-u.ac.jp / ng at bioruby.org



More information about the BioRuby mailing list