From d5f03c1da98ee9d930c0d2577af851a1167c9194 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 14:34:51 -0400 Subject: [PATCH 01/10] Updated github actions version, testing documentation examples --- .github/workflows/CI.yml | 4 ++-- src/Get.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bcce707..879ffd2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,7 +25,7 @@ jobs: arch: - x64 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: ${{ matrix.version }} @@ -44,7 +44,7 @@ jobs: contents: write statuses: write steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v1 with: version: '1' diff --git a/src/Get.jl b/src/Get.jl index 0f8184d..be470dd 100644 --- a/src/Get.jl +++ b/src/Get.jl @@ -8,7 +8,7 @@ and returns a vector containing the urls used and the data returned. The get function will split the vector into groups of 10 and make a request for each chunk. # Examples -```julia-repl +```@examples kegg_get_genes = KEGGAPI.kegg_get( ["hsa:10458", "hsa:10458", "hsa:10458", "hsa:10458"], From b7676ca5ab2eedfbefd02a21e86e2a2c1107385b Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 15:37:02 -0400 Subject: [PATCH 02/10] Added structure to documentation --- docs/src/index.md | 11 ++++++----- docs/src/man/functions.md | 5 +++++ src/Conv.jl | 3 ++- src/Find.jl | 3 ++- src/Get.jl | 9 ++++++--- src/Images.jl | 4 ++-- src/Info.jl | 2 +- src/Link.jl | 2 +- src/List.jl | 2 +- 9 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 docs/src/man/functions.md diff --git a/docs/src/index.md b/docs/src/index.md index 44df08c..5a480a2 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -9,8 +9,9 @@ Documentation for [KEGGAPI](https://github.com/bwbioinfo/KEGGAPI.jl). ```@index ``` -## Functions - -```@autodocs -Modules = [KEGGAPI] -``` +```@contents +Pages = [ + "man/functions.md", +] +Depth = 1 +``` \ No newline at end of file diff --git a/docs/src/man/functions.md b/docs/src/man/functions.md new file mode 100644 index 0000000..0af6f3c --- /dev/null +++ b/docs/src/man/functions.md @@ -0,0 +1,5 @@ +# KEGGAPI.jl Functions + +```@autodocs +Modules = [KEGGAPI] +``` \ No newline at end of file diff --git a/src/Conv.jl b/src/Conv.jl index f2c92ce..a58bfa7 100644 --- a/src/Conv.jl +++ b/src/Conv.jl @@ -5,7 +5,8 @@ KEGGAPI.conv(, ) Convert KEGG identifiers to/from outside identifiers. # Examples -```julia-repl +```@example +using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") KEGGAPI.conv("ncbi-geneid", "eco") KEGGAPI.conv("hsa:10458+ece:Z5100", "ncbi-proteinid") diff --git a/src/Find.jl b/src/Find.jl index 030763a..8466a10 100644 --- a/src/Find.jl +++ b/src/Find.jl @@ -5,7 +5,8 @@ KEGGAPI.find(database, query) -> KeggTupleList Find entries in a specific database from the KEGG API. # Examples -```julia-repl +```@example +using KEGGAPI KEGGAPI.find("compound","glucose") ``` """ diff --git a/src/Get.jl b/src/Get.jl index be470dd..494ffa0 100644 --- a/src/Get.jl +++ b/src/Get.jl @@ -8,16 +8,19 @@ and returns a vector containing the urls used and the data returned. The get function will split the vector into groups of 10 and make a request for each chunk. # Examples -```@examples +```@example +using KEGGAPI kegg_get_genes = KEGGAPI.kegg_get( ["hsa:10458", "hsa:10458", "hsa:10458", "hsa:10458"], "ntseq" - ) + ); +first(kegg_get_genes) kegg_get_compounds = KEGGAPI.kegg_get( ["C01290","G00092"] - ) + ); +first(kegg_get_compounds) ``` """ function kegg_get(query::Vector{String}, option::String = "") diff --git a/src/Images.jl b/src/Images.jl index 860dadf..27ab555 100644 --- a/src/Images.jl +++ b/src/Images.jl @@ -4,7 +4,7 @@ KEGGAPI.get_image(pathway) -> Image Get an image of a specific pathway from the KEGG API. # Examples -```julia-repl +```@example KEGGAPI.get_image("hsa00010") ``` """ @@ -20,7 +20,7 @@ KEGGAPI.save_image(image, filename) -> filename Save an image to a file. # Examples -```julia-repl +```example image = KEGGAPI.get_image("hsa00010") KEGGAPI.save_image(image, "glycolysis.png") ``` diff --git a/src/Info.jl b/src/Info.jl index 1641b0b..7252bcd 100644 --- a/src/Info.jl +++ b/src/Info.jl @@ -4,7 +4,7 @@ KEGGAPI.info(database) -> String Get information about a specific database from the KEGG API. # Examples -```julia-repl +```example KEGGAPI.info("kegg") ``` """ diff --git a/src/Link.jl b/src/Link.jl index 2eba253..295c10e 100644 --- a/src/Link.jl +++ b/src/Link.jl @@ -5,7 +5,7 @@ KEGGAPI.conv(, ) Find related entries by using database cross-references # Examples -```julia-repl +```example KEGGAPI.link("pathway", "hsa") ``` """ diff --git a/src/List.jl b/src/List.jl index 94cf636..fa702a0 100644 --- a/src/List.jl +++ b/src/List.jl @@ -5,7 +5,7 @@ KEGGAPI.list(database) Get a list of entries from a specific database from the KEGG API. # Examples -```julia-repl +```example KEGGAPI.list("pathway") ``` """ From 71ba5ca0d5153380c4572df5f53d507a479e9403 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 15:51:46 -0400 Subject: [PATCH 03/10] Create examples.md --- docs/src/man/examples.md | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 docs/src/man/examples.md diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md new file mode 100644 index 0000000..243f270 --- /dev/null +++ b/docs/src/man/examples.md @@ -0,0 +1,8 @@ +# Some Examples + +```@repl +KEGGAPI.conv("eco", "ncbi-geneid") +KEGGAPI.conv("ncbi-geneid", "eco") +KEGGAPI.conv("hsa:10458+ece:Z5100", "ncbi-proteinid") +KEGGAPI.conv("ncbi-geneid:948364", "genes") +``` From dda40b9090e3e13cdae8cff4673ed0c618226f48 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 15:57:01 -0400 Subject: [PATCH 04/10] ENVY-2 testing documentation structure. --- docs/src/index.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 5a480a2..f6cbf14 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -6,12 +6,14 @@ CurrentModule = KEGGAPI Documentation for [KEGGAPI](https://github.com/bwbioinfo/KEGGAPI.jl). -```@index -``` - ```@contents Pages = [ "man/functions.md", + "man/examples.md", ] Depth = 1 +``` + + +```@index ``` \ No newline at end of file From d5dca7871eabe6276684a9e1e6f75404e1424b86 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:02:35 -0400 Subject: [PATCH 05/10] ENVY-2 testing documentation structure. --- docs/src/man/examples.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index 243f270..a0ac686 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -1,6 +1,9 @@ # Some Examples +## Getting + ```@repl +using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") KEGGAPI.conv("ncbi-geneid", "eco") KEGGAPI.conv("hsa:10458+ece:Z5100", "ncbi-proteinid") From 2e641b633c910bb2e42b2558d3c4d5fc9ba5d47b Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:13:58 -0400 Subject: [PATCH 06/10] ENVY-2 Corrected problem with conv examples. --- docs/src/man/examples.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index a0ac686..05ff65d 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -2,10 +2,10 @@ ## Getting -```@repl +```@example using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") KEGGAPI.conv("ncbi-geneid", "eco") -KEGGAPI.conv("hsa:10458+ece:Z5100", "ncbi-proteinid") -KEGGAPI.conv("ncbi-geneid:948364", "genes") +KEGGAPI.conv("ncbi-proteinid", "hsa:10458+ece:Z5100") +KEGGAPI.conv("genes", "ncbi-geneid:948364") ``` From 05af9eb9058b9459d753ab3d4d9c31fa12c061a4 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:19:50 -0400 Subject: [PATCH 07/10] ENVY-2 Corrected problem with conv examples. --- docs/src/index.md | 4 +++- docs/src/man/examples.md | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index f6cbf14..39b5ec0 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -6,12 +6,14 @@ CurrentModule = KEGGAPI Documentation for [KEGGAPI](https://github.com/bwbioinfo/KEGGAPI.jl). +[KEGG](https://www.genome.jp/kegg/) + ```@contents Pages = [ "man/functions.md", "man/examples.md", ] -Depth = 1 +Depth = 2 ``` diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index 05ff65d..d798c8a 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -1,11 +1,25 @@ # Some Examples -## Getting +## Basics + +Examples analogous to [KEGG Conv](https://www.kegg.jp/kegg/rest/keggapi.html#conv) ```@example using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") +``` + +```@example +using KEGGAPI KEGGAPI.conv("ncbi-geneid", "eco") +``` + +```@example +using KEGGAPI KEGGAPI.conv("ncbi-proteinid", "hsa:10458+ece:Z5100") +``` + +```@example +using KEGGAPI KEGGAPI.conv("genes", "ncbi-geneid:948364") ``` From 2f07ad692857122f7d77df26063a164f9b49994f Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:37:04 -0400 Subject: [PATCH 08/10] ENVY-2 Testing examples. --- docs/src/man/examples.md | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index d798c8a..eceb69c 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -4,22 +4,50 @@ Examples analogous to [KEGG Conv](https://www.kegg.jp/kegg/rest/keggapi.html#conv) +Querying the API for a simple conversion: + ```@example using KEGGAPI -KEGGAPI.conv("eco", "ncbi-geneid") +output = KEGGAPI.conv("eco", "ncbi-geneid"); +``` + +Outputs a list with +1. The API call +2. The column headers of the call ( if the result is tabular ) +3. The data + +This allows to easily convert to a data frame: + +```@example +DataFrame( + output.data, + output.colnames +) ``` ```@example using KEGGAPI -KEGGAPI.conv("ncbi-geneid", "eco") +output = KEGGAPI.conv("ncbi-geneid", "eco"); +DataFrame( + output.data, + output.colnames +) ``` ```@example using KEGGAPI -KEGGAPI.conv("ncbi-proteinid", "hsa:10458+ece:Z5100") +output = KEGGAPI.conv("ncbi-proteinid", "hsa:10458+ece:Z5100"); +DataFrame( + output.data, + output.colnames +) ``` ```@example using KEGGAPI -KEGGAPI.conv("genes", "ncbi-geneid:948364") +output = KEGGAPI.conv("genes", "ncbi-geneid:948364"); +DataFrame( + output.data, + output.colnames +) ``` From 244a8e611ee4d5bb5f9b740b1c18e71c4884b48c Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:39:44 -0400 Subject: [PATCH 09/10] ENVY-2 Testing examples. --- src/Conv.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Conv.jl b/src/Conv.jl index a58bfa7..d4d865c 100644 --- a/src/Conv.jl +++ b/src/Conv.jl @@ -9,8 +9,8 @@ Convert KEGG identifiers to/from outside identifiers. using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") KEGGAPI.conv("ncbi-geneid", "eco") -KEGGAPI.conv("hsa:10458+ece:Z5100", "ncbi-proteinid") -KEGGAPI.conv("ncbi-geneid:948364", "genes") +KEGGAPI.conv("ncbi-proteinid", "hsa:10458+ece:Z5100") +KEGGAPI.conv("genes", "ncbi-geneid:948364") ``` """ function conv(target_db::String, source_db::String) From f03e96c18d38496e2afec1d5334555f0a1805690 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Fri, 3 May 2024 16:43:12 -0400 Subject: [PATCH 10/10] ENVY-2 Testing examples. --- docs/src/man/examples.md | 1 + src/Conv.jl | 3 ++- src/Find.jl | 1 - src/Images.jl | 3 ++- src/Info.jl | 3 ++- src/Link.jl | 3 ++- src/List.jl | 3 ++- 7 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/src/man/examples.md b/docs/src/man/examples.md index eceb69c..b9f0a50 100644 --- a/docs/src/man/examples.md +++ b/docs/src/man/examples.md @@ -19,6 +19,7 @@ Outputs a list with This allows to easily convert to a data frame: ```@example +using DataFrames DataFrame( output.data, output.colnames diff --git a/src/Conv.jl b/src/Conv.jl index d4d865c..5401cfe 100644 --- a/src/Conv.jl +++ b/src/Conv.jl @@ -4,7 +4,8 @@ KEGGAPI.conv(, ) Convert KEGG identifiers to/from outside identifiers. -# Examples +Example: + ```@example using KEGGAPI KEGGAPI.conv("eco", "ncbi-geneid") diff --git a/src/Find.jl b/src/Find.jl index 8466a10..37751ac 100644 --- a/src/Find.jl +++ b/src/Find.jl @@ -4,7 +4,6 @@ KEGGAPI.find(database, query) -> KeggTupleList Find entries in a specific database from the KEGG API. -# Examples ```@example using KEGGAPI KEGGAPI.find("compound","glucose") diff --git a/src/Images.jl b/src/Images.jl index 27ab555..dc8ecb4 100644 --- a/src/Images.jl +++ b/src/Images.jl @@ -3,7 +3,8 @@ KEGGAPI.get_image(pathway) -> Image Get an image of a specific pathway from the KEGG API. -# Examples +Example: + ```@example KEGGAPI.get_image("hsa00010") ``` diff --git a/src/Info.jl b/src/Info.jl index 7252bcd..35beac4 100644 --- a/src/Info.jl +++ b/src/Info.jl @@ -3,7 +3,8 @@ KEGGAPI.info(database) -> String Get information about a specific database from the KEGG API. -# Examples +Example: + ```example KEGGAPI.info("kegg") ``` diff --git a/src/Link.jl b/src/Link.jl index 295c10e..235d372 100644 --- a/src/Link.jl +++ b/src/Link.jl @@ -4,7 +4,8 @@ KEGGAPI.conv(, ) Find related entries by using database cross-references -# Examples +Example: + ```example KEGGAPI.link("pathway", "hsa") ``` diff --git a/src/List.jl b/src/List.jl index fa702a0..fd7aee6 100644 --- a/src/List.jl +++ b/src/List.jl @@ -4,7 +4,8 @@ KEGGAPI.list(database) Get a list of entries from a specific database from the KEGG API. -# Examples +Example: + ```example KEGGAPI.list("pathway") ```