Class: Bio::NCBI

Inherits:
Object show all
Defined in:
lib/bio/io/ncbirest.rb

Defined Under Namespace

Classes: REST

Constant Summary

ENTREZ_DEFAULT_PARAMETERS =

(Hash) Default parameters for Entrez (eUtils). They may also be used for other NCBI services.

{
  # Cited from
  # http://www.ncbi.nlm.nih.gov/books/NBK25499/#chapter4.Release_Notes
  #  tool:
  #  Name of application making the E-utility call.
  #  Value must be a string with no internal spaces.
  'tool' => "bioruby",
  # Cited from
  # http://www.ncbi.nlm.nih.gov/books/NBK25497/
  # The value of email should be a complete and valid e-mail address
  # of the software developer and not that of a third-party end user.
  'email' => 'staff@bioruby.org',
}

Class Method Summary collapse

Class Method Details

.default_emailObject

Gets default email address for Entrez (eUtils).


Returns

String or nil



50
51
52
# File 'lib/bio/io/ncbirest.rb', line 50

def self.default_email
  ENTREZ_DEFAULT_PARAMETERS['email']
end

.default_email=(str) ⇒ Object

Sets default email address used for Entrez (eUtils). It may also be used for other NCBI services.

In www.ncbi.nlm.nih.gov/books/NBK25497/ NCBI says: “The value of email should be a complete and valid e-mail address of the software developer and not that of a third-party end user.”

By default, email address of BioRuby staffs is set.

From the above NCBI documentation, the tool and email value is used only for unblocking IP addresses blocked by NCBI due to excess requests. For the purpose, NCBI says: “Please be aware that merely providing values for tool and email in requests is not sufficient to comply with this policy; these values must be registered with NCBI.”

Please use your own email address and tool name when registering tool and email values to NCBI.


Arguments:

  • (required) str: (String) email address

Returns

same as given argument



78
79
80
# File 'lib/bio/io/ncbirest.rb', line 78

def self.default_email=(str)
  ENTREZ_DEFAULT_PARAMETERS['email'] = str
end

.default_toolObject

Gets default tool name for Entrez (eUtils).


Returns

String or nil



85
86
87
# File 'lib/bio/io/ncbirest.rb', line 85

def self.default_tool
  ENTREZ_DEFAULT_PARAMETERS['tool']
end

.default_tool=(str) ⇒ Object

Sets default tool name for Entrez (eUtils). It may also be used for other NCBI services.

In www.ncbi.nlm.nih.gov/books/NBK25497/ NCBI says: “The value of tool should be a string with no internal spaces that uniquely identifies the software producing the request.”

“bioruby” is set by default. Please use your own tool name when registering to NCBI.

See the document of default_email= for more information.


Arguments:

  • (required) str: (String) tool name

Returns

same as given argument



106
107
108
# File 'lib/bio/io/ncbirest.rb', line 106

def self.default_tool=(str)
  ENTREZ_DEFAULT_PARAMETERS['tool'] = str
end

.reset_entrez_default_parametersObject

Resets Entrez (eUtils) default parameters.


Returns

(Hash) default parameters



38
39
40
41
42
43
44
45
# File 'lib/bio/io/ncbirest.rb', line 38

def self.reset_entrez_default_parameters
  h = {
    'tool'  => "bioruby",
    'email' => 'staff@bioruby.org',
  }
  ENTREZ_DEFAULT_PARAMETERS.clear
  ENTREZ_DEFAULT_PARAMETERS.update(h)
end