API reference

KEGGAPI.kegg_convMethod
kegg_conv(target_db::String, source_db::String)

Convert KEGG identifiers to/from outside identifiers.

Arguments

  • target_db::String: Target database
  • source_db::String: Source database

Examples

using KEGGAPI

KEGGAPI.conv("eco", "ncbi-geneid")
KEGGAPI.conv("ncbi-geneid", "eco")
KEGGAPI.conv("genes", "ncbi-geneid:948364")

Extended help

This operation can be used to convert entry identifiers (accession numbers) of outside databases to KEGG identifiers, and vice versa. The first form allows database to database mapping, while the second form allows conversion of a selected number of entries. The database name "genes" may be used only in the second form.

References

source
KEGGAPI.kegg_convMethod
kegg_conv(target_db::String, dbentries::Vector{String}; [timeout::Float64 = 0.4])

Convert KEGG identifiers to/from outside identifiers.

For gene identifiers:

<dbentries> = database entries of the following <database>
<database>  = <org> | genes | ncbi-geneid | ncbi-proteinid | uniprot
<org>       = KEGG organism code or T number

For chemical substance identifiers:

<dbentries> = database entries of the following <database>
<database>  = compound | glycan | drug | pubchem | chebi

Arguments

  • target_db::String: Target database
  • dbentries::Vector{String}: Database entries of the available databases
  • timeout::Float64: Time to wait between requests (default: 0.4 seconds)

Examples

using KEGGAPI

KEGGAPI.conv("ncbi-proteinid", ["hsa:10458", "ece:Z5100"])
source
KEGGAPI.kegg_ddiMethod
kegg_ddi(dbentry::String)
kegg_ddi(dbentries::Vector{String}; [timeout::Float64 = 0.4])

Find adverse drug-drug interactions (DDI).

The available databases are:

drug | ndc | yj

Arguments

  • dbentry::String / dbentries::Vector{String}: KEGG DRUG (dr:/D numbers), NDC or YJ code entries to query for interactions.
  • timeout::Float64: Time to wait between requests when more than 10 entries are provided (default: 0.4 seconds).

Returns

  • data::KeggTupleList: A data structure containing the url, the data retrieved, and the colnames. The columns are ["Entry 1", "Entry 2", "Interaction Type", "Mechanism"], where the interaction type is CI (contraindication) or P (precaution).

Examples

using KEGGAPI

KEGGAPI.kegg_ddi("D00564")
KEGGAPI.kegg_ddi(["D00564", "D00100"])

Extended help

This operation searches against the KEGG DDI database, which contains known adverse drug-drug interactions. When multiple entries are given, all pairwise interactions among them are also reported. The input is limited up to 10 entries; if more are provided the query will be split into chunks of 10 entries and multiple requests will be made with a timeout between each request (KEGG API indicates that the maximum API calls per second is 3, so a default timeout of 0.4 seconds is set to ensure that).

Reference

  • https://www.kegg.jp/kegg/rest/keggapi.html#ddi
source
KEGGAPI.kegg_findFunction
kegg_find(database::String, query::String, option::String = "") -> KeggTupleList

Find entries with a matching query keyword or other query data.

Allowed database values are:

kegg    | pathway | brite    | module | ko       | genes  | <org>  |
ag      | vg      | vp       | genome | vtax     | vgenome| compound|
glycan  | reaction| rclass   | rmodule| enzyme   | network| ntmap  |
variant | disease | drug     | dgroup

Allowed option values (only for the compound and drug databases):

formula | exact_mass | mol_weight | nop

Arguments

  • database::String: The KEGG database to search.
  • query::String: The query keyword or data. Spaces are converted to +.
  • option::String: For the compound/drug databases, restrict the search to a chemical field. nop disables keyword pre-processing.

Returns

  • data::KeggTupleList: A data structure containing the url, the data retrieved, and the colnames.

Examples

using KEGGAPI

KEGGAPI.kegg_find("compound", "glucose")
KEGGAPI.kegg_find("compound", "C7H10O5", "formula")
KEGGAPI.kegg_find("ko", "kinase")

Extended help

This operation searches KEGG databases for entries matching the given query. The option argument is only meaningful for chemical databases (compound, drug) and is used to search by molecular formula, exact_mass or mol_weight (ranges may be given with a minus sign, e.g. "300-310"); nop disables the keyword pre-processing. Any recognized KEGG database (or an organism code) is accepted; unrecognized database names emit a warning but are still passed through to the API.

Reference

  • https://www.kegg.jp/kegg/rest/keggapi.html#find
source
KEGGAPI.kegg_getFunction
kegg_get(dbentries::Vector{String}, option::Union{Symbol, Nothing} = nothing; timeout::Float64 = 0.4)
kegg_get(dbentry::String, args...; kwargs...)

Retrieve given database entries.

Allowed dbentries (database entries):

pathway   | brite    | module   | ko       | <org>    | ag         | vg      |
vp        | genome   | vtax     | vgenome  | compound | glycan     | reaction|
rclass    | rmodule  | enzyme   | network  | ntmap    | variant    | disease |
drug      | dgroup   | disease_ja| drug_ja | dgroup_ja| compound_ja

Allowed option for retrieval of selected fields:

:aaseq | :ntseq | :mol | :kcf | :image | :image2x | :conf | :kgml | :json | nothing

Arguments

  • dbentries::Vector{String}: A vector of KEGG database entries to retrieve.
  • option::Union{Symbol, Nothing}: An optional symbol specifying the format of the retrieved data. If nothing, the default format is used.
  • timeout::Float64: A float specifying the time to wait between API requests when retrieving more than 10 entries. Default is 0.4 seconds.

Returns

A tuple containing:

  • url::Vector{String}: A vector of URLs used for the API requests.
  • data::Vector{Any}: A vector of retrieved data corresponding to the provided database entries, processed according to the specified option.

Example

dbentries = ["hsa:10458", "hsa:10459", "hsa:10460"]
option = :aaseq
urls, data = kegg_get(dbentries, option)

Extended help

This operation retrieves given database entries in a flat file format or in other formats with option. Flat file formats are available for all KEGG databases except brite. The input is limited up to 10 entries; if more are provided the query will be split into chunks of 10 entries and multiple requests will be made with a timeout between each request (KEGG API indicates that the maximum API calls per seconds is 3, so a default timeout of 0.4 seconds is set to ensure that).

Options allow retrieval of selected fields, including sequence data from genes entries, chemical structure data or GIF image files from compound, glycan and drug entries, PNG image files or KGML files from pathway entries. The :image2x option retrieves the doubled-size PNG image of a reference pathway map.

The input is limited to one compound/glycan/drug entry with the :image option, and to one pathway entry with the :image, :image2x or :kgml option.

Reference

  • https://www.kegg.jp/kegg/rest/keggapi.html#get
source
KEGGAPI.kegg_infoMethod
KEGGAPI.kegg_info(database::String)

Get information about a specific database from the KEGG API.

Allowed database values are:

kegg     | pathway | brite   | module  | ko      | genes    | <org>   |
ag       | vg      | vp      | genome  | vtax    | vgenome  | ligand  |
compound | glycan  | reaction| rclass  | rmodule | enzyme   | network |
ntmap    | variant | disease | drug    | dgroup

Arguments

  • database::String: The KEGG database for which to retrieve information.

Returns

  • data::String: A string containing the information about the specified database.

Example

KEGGAPI.kegg_info("kegg")

# Extended help

This operation displays the database release information with statistics for the
databases shown in the table. Except for :kegg, :genes and :ligand, this operation
also retrieves the list of linked databases that can be used in the link operation.

# Reference

- https://www.kegg.jp/kegg/rest/keggapi.html#info
source
KEGGAPI.kegg_linkFunction
kegg_link(target_db::String, dbentries::Vector{String}, option::String = ""; [timeout::Float64 = 0.4])

Find related entries by using database cross-references.

The available KEGG databases are:

pathway | brite    | module | ko      | <org>   | ag     | vg      |
vp      | genome   | vtax   | vgenome | compound| glycan | reaction|
rclass  | rmodule  | enzyme | network | ntmap   | variant | disease |
drug    | dgroup   | <outside_db>

and the available external databases are:

pubmed | taxonomy | atc | jtc | ndc | yk

Arguments

  • target_db::String, target database
  • dbentries::Vector{String}, KEGG database entries of the available databases
  • option::String, optional refinement of the query. A taxonomic rank (species | genus | family | order | class | phylum) for genome/taxonomy links, or an RDF output format (turtle | n-triple) for the drug/atc/jtc databases (in which case the raw response text is returned).
  • timeout::Float64, time to wait between requests (default: 0.4 seconds)
source
KEGGAPI.kegg_linkFunction
kegg_link(target_db::String, source_db::String, option::String = "")

Find related entries by using database cross-references.

The available KEGG databases are:

pathway | brite    | module | ko      | <org>   | ag     | vg      |
vp      | genome   | vtax   | vgenome | compound| glycan | reaction|
rclass  | rmodule  | enzyme | network | ntmap   | variant | disease |
drug    | dgroup   | <outside_db>

and the available external databases are:

pubmed | taxonomy | atc | jtc | ndc | yk

Arguments

  • target_db::String: Target database
  • source_db::String: Source database
  • option::String: Optional refinement of the query. For genome/taxonomy links a taxonomic rank may be given (species | genus | family | order | class | phylum). For the drug/atc/jtc databases an RDF output format may be requested (turtle | n-triple), in which case the raw response text is returned instead of a KeggTupleList.

Examples

using KEGGAPI

KEGGAPI.kegg_link("pathway", "hsa")
KEGGAPI.kegg_link("atc", "D00564", "turtle")   # raw RDF (turtle) String

Extended help

This operation allows retrieval of cross-references within all KEGG databases, as well as between KEGG databases and outside databases. It is useful for finding various relationships, such as relationships between genes and pathways. This form allows retrieval of database to database cross-references.

source
KEGGAPI.kegg_listFunction
kegg_list(database::String)
kegg_list(pathway::String, org::String)
kegg_list(brite::String, option::String)
kegg_list(genome::String, option::String)

Get a list of entry identifiers and associated names

Allowed database values are:

pathway  | brite   | module   | ko      | <org>    | ag     | vg      |
vp       | genome  | vtax     | vgenome | compound | glycan | reaction|
rclass   | rmodule | enzyme   | network | ntmap    | variant| disease |
drug     | dgroup

Returns

  • data::Vector{Tuple{String, String}}: A vector of tuples containing the entry identifiers and associated names for the specified database. If the data is not available, an empty vector is returned.

Extended help

This operation can be used to obtain a list of all entries in each database. The database names shown in the tables above, excluding the composite database names of genes and kegg, may be given. To obtain a list of KEGG organisms with their three- or four-letter organism codes, use the genome database.

When the organism code is known, the second form can be used to obtain a list of organism-specific pathways.

The third form is a similar option for brite hierarchies (br | jp | ko | <org>).

The fourth form lists the genomes for a KEGG organism group name or a taxonomy <rank_id> (phylum, class, order, family, genus or species).

References

  • https://www.kegg.jp/kegg/rest/keggapi.html#list

```

source
KEGGAPI.kegg_listMethod
kegg_list(dbentries::Vector{String}; timeout::Float64 = 0.4)

Get a list of entry identifiers and associated names

Arguments

  • dbentries::Vector{String}: The list of entries to list.

Returns

  • data::KeggTupleList: A data structure containing the url, the data retrieved, and the columns names for the data.

Extended help

The input is limited up to 10 entries; if more are provided the query will be split into chunks of 10 entries and multiple requests will be made with a timeout between each request (KEGG API indicates that the maximum API calls per seconds is 3, so a default timeout of 0.4 seconds is set to ensure that).

source
KEGGAPI.requestFunction

request(url)

Make a request to the specified URL and return the response body as a string. If an error occurs, a RequestError is thrown. This function is not intended for direct use. Instead, use the info, list, and find, etc. functions.

Examples

request("https://rest.kegg.jp/info/kegg")
source
KEGGAPI.request_otherMethod

request_other(url)

Make a request to the specified URL and return the response body as a vector. If an error occurs, a RequestError is thrown. This function is not intended for direct use.

Examples

request_other("https://rest.kegg.jp/image/hsa00010")
source
KEGGAPI.@kegg_strMacro
@kegg_str

Macro to retrieve a KEGG database entry flat file from a string. This is intended for interactive use in the REPL.

See kegg_get for more details on allowed database entries.

Example

using KEGGAPI
entry = kegg"hsa:10458"
source