API reference
KEGGAPI.kegg_conv — Method
kegg_conv(target_db::String, source_db::String)Convert KEGG identifiers to/from outside identifiers.
Arguments
target_db::String: Target databasesource_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
KEGGAPI.kegg_conv — Method
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 numberFor chemical substance identifiers:
<dbentries> = database entries of the following <database>
<database> = compound | glycan | drug | pubchem | chebiArguments
target_db::String: Target databasedbentries::Vector{String}: Database entries of the available databasestimeout::Float64: Time to wait between requests (default: 0.4 seconds)
Examples
using KEGGAPI
KEGGAPI.conv("ncbi-proteinid", ["hsa:10458", "ece:Z5100"])KEGGAPI.kegg_ddi — Method
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 | yjArguments
dbentry::String/dbentries::Vector{String}: KEGG DRUG (dr:/Dnumbers), 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 theurl, thedataretrieved, and thecolnames. The columns are["Entry 1", "Entry 2", "Interaction Type", "Mechanism"], where the interaction type isCI(contraindication) orP(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
KEGGAPI.kegg_find — Function
kegg_find(database::String, query::String, option::String = "") -> KeggTupleListFind 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 | dgroupAllowed option values (only for the compound and drug databases):
formula | exact_mass | mol_weight | nopArguments
database::String: The KEGG database to search.query::String: The query keyword or data. Spaces are converted to+.option::String: For thecompound/drugdatabases, restrict the search to a chemical field.nopdisables keyword pre-processing.
Returns
data::KeggTupleList: A data structure containing theurl, thedataretrieved, and thecolnames.
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
KEGGAPI.kegg_get — Function
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_jaAllowed option for retrieval of selected fields:
:aaseq | :ntseq | :mol | :kcf | :image | :image2x | :conf | :kgml | :json | nothingArguments
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. Ifnothing, 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 specifiedoption.
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
KEGGAPI.kegg_info — Method
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 | dgroupArguments
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#infoKEGGAPI.kegg_link — Function
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 | ykArguments
target_db::String, target databasedbentries::Vector{String}, KEGG database entries of the available databasesoption::String, optional refinement of the query. A taxonomic rank (species | genus | family | order | class | phylum) forgenome/taxonomylinks, or an RDF output format (turtle | n-triple) for thedrug/atc/jtcdatabases (in which case the raw response text is returned).timeout::Float64, time to wait between requests (default: 0.4 seconds)
KEGGAPI.kegg_link — Function
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 | ykArguments
target_db::String: Target databasesource_db::String: Source databaseoption::String: Optional refinement of the query. Forgenome/taxonomylinks a taxonomic rank may be given (species | genus | family | order | class | phylum). For thedrug/atc/jtcdatabases an RDF output format may be requested (turtle | n-triple), in which case the raw response text is returned instead of aKeggTupleList.
Examples
using KEGGAPI
KEGGAPI.kegg_link("pathway", "hsa")
KEGGAPI.kegg_link("atc", "D00564", "turtle") # raw RDF (turtle) StringExtended 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.
KEGGAPI.kegg_list — Function
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 | dgroupReturns
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
```
KEGGAPI.kegg_list — Method
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 theurl, thedataretrieved, and thecolumnsnames 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).
KEGGAPI.request — Function
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")KEGGAPI.request_other — Method
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")KEGGAPI.@kegg_str — Macro
@kegg_strMacro 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"