[BioRuby] test and bioruby shell questions

Davide Rambaldi davide.rambaldi at ifom-ieo-campus.it
Mon Oct 13 16:05:06 UTC 2008


>
>
> There are getseq and getent:
> My feeling is that both the databases and libraries are growing
> to handles datatypes other than sequences,
> though the sequences have been the primary interest.
> So, I would assume getent might be used in more general purpose than  
> getting "sequences".
>
> I suppose that having a database with possible db parameter string and
> remote db and rettype combination is a extensible way to resolve the  
> need for possible different
> datatypes.
> knowndbparams={"gb" => {"db" => sequences, "rettype" =>"gbwithparts"},
> "gp" => {"db" => sequences, "rettype" => "gp"},
> ...
> }
>
> and call like
> fetch = Bio::NCBI::REST.efetch(entry_id, knwondbparams[db])
>

I have modified to patch (see below), including a knowndbparams Hash.

Now work with:

bioruby> test = getobj("gb:AAF63163")
bioruby> test = getobj("gp:AF237819")


Actually the Hash handle genbank and genPept.

How I can add more datatypes?

I should take the definition in  NSIDs (lib/bio/io/dbget.rb) as key  
for knowdbparams Hash?

Here is (from NCBI website) the list of available db params for efetch:

1. EFETCH for literature
    db=[pubmed|pmc|journals|omim]

2. EFETCH for sequences
    	• gene
	• genome
	• nucleotide
	• nuccore
	• nucest
	• nucgss
	• protein
	• popset
	• snp
	• sequences - Composite name including nucleotide, protein, popset  
and genome.

3. EFETCH for taxonomy
    db=taxonomy


Best Regards

Davide

-------------------------------------------------------
PATCH HERE
----------------------------------------------------

Oni:bioruby tucano$ git diff
diff --git a/lib/bio.rb b/lib/bio.rb
index b2b6f4f..bddc221 100644
--- a/lib/bio.rb
+++ b/lib/bio.rb
@@ -170,6 +170,7 @@ module Bio

    class NCBI
      autoload :SOAP,       'bio/io/ncbisoap'
+    autoload :REST,       'bio/io/ncbirest'
    end


diff --git a/lib/bio/shell/plugin/entry.rb b/lib/bio/shell/plugin/ 
entry.rb
index 6d36fb5..2408a95 100644
--- a/lib/bio/shell/plugin/entry.rb
+++ b/lib/bio/shell/plugin/entry.rb
@@ -88,8 +88,19 @@ module Bio::Shell

        # KEGG API at http://www.genome.jp/kegg/soap/
        else
-        puts "Retrieving entry from KEGG API (#{arg})"
          entry = bget(arg)
+        if entry.length != 0 then
+          puts "Retrieving entry from KEGG API (#{arg})"
+        else
+          # NCBI efecth
+          knowndbparams = {
+            "gb" => {"db" => "sequences", "rettype" =>"gbwithparts"},
+            "gp" => {"db" => "sequences", "rettype" => "gp"}
+          }
+          puts "Retrieving entry from NCBI (#{arg})"
+          fetch = Bio::NCBI::REST.efetch(entry_id, knowndbparams[db])
+          entry = fetch.to_s
+        end
        end
      end






More information about the BioRuby mailing list