Skip to content

Commit 27e262e

Browse files
committed
add unit tests for keggCompounds
1 parent c251881 commit 27e262e

File tree

4 files changed

+35
-7
lines changed

4 files changed

+35
-7
lines changed

NEWS

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGES IN VERSION 1.42.0
22
-----------------------
33

4+
SIGNIFICANT USER-VISIBLE CHANGES
5+
6+
o `keggCompounds` lists compound IDs for a given pathway (@KristinaRiemer,
7+
#6).
8+
49
BUG FIXES
510

611
o Update URL path in `.get.kegg.url` from `tmp` to `kegg` subfolder.
@@ -11,13 +16,13 @@ CHANGES IN VERSION 1.37.0
1116
BUG CORRECTION
1217

1318
o 1.37.1 Fixes new endpoint
14-
o 1.37.2 http to https fixes windows error
19+
o 1.37.2 http to https fixes windows error
1520

1621
CHANGES IN VERSION 1.0.0
1722
-----------------------
1823

1924
SIGNIFICANT USER-VISIBLE CHANGES
20-
25+
2126
o Package introduced.
2227

2328
NEW FEATURES

R/KEGGREST.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ keggGet <- function(dbentries,
6666
.getUrl(url, .flatFileParser)
6767
}
6868

69-
keggCompounds <- function(pathway_id)
69+
keggCompounds <- function(pathwayID)
7070
{
71-
url <- sprintf("%s/link/cpd/%s", .getRootUrl(), pathway_id)
71+
url <- sprintf("%s/link/cpd/%s", .getRootUrl(), pathwayID)
7272
.getUrl(url, .compoundParser)
7373
}
7474

inst/unitTests/test_KEGGREST.R

+23
Original file line numberDiff line numberDiff line change
@@ -246,3 +246,26 @@ test_reference_parser <- function()
246246
refs <- res$REFERENCE[[1]]
247247
checkTrue(length(refs) > 0)
248248
}
249+
250+
test_keggCompounds <- function() {
251+
result <- c(
252+
"C00011", "C00042", "C00090", "C00146", "C00160", "C00530",
253+
"C00682", "C01407", "C02124", "C02222", "C02375", "C02575", "C02625",
254+
"C02814", "C02933", "C03434", "C03572", "C03585", "C03664", "C03918",
255+
"C04091", "C04431", "C04522", "C04706", "C04729", "C05618", "C06328",
256+
"C06329", "C06594", "C06596", "C06597", "C06598", "C06599", "C06600",
257+
"C06601", "C06602", "C06603", "C06755", "C06988", "C06989", "C06990",
258+
"C07075", "C07088", "C07089", "C07090", "C07091", "C07092", "C07093",
259+
"C07094", "C07095", "C07096", "C07097", "C07098", "C07099", "C07100",
260+
"C07101", "C07102", "C07103", "C11352", "C12831", "C12832", "C12833",
261+
"C12834", "C12835", "C12836", "C12837", "C12838", "C14419", "C14450",
262+
"C16181", "C16182", "C16266", "C18236", "C18238", "C18240", "C18241",
263+
"C18242", "C18243", "C18244", "C18933", "C21103", "C21104", "C21105"
264+
)
265+
checkTrue(
266+
all(
267+
result %in% keggCompounds("map00361")
268+
)
269+
)
270+
}
271+

man/keggCompounds.Rd

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ Get list of compounds IDs for pathway
77
Get list of compounds IDs for pathway.
88
}
99
\usage{
10-
keggCompounds(pathway_id)
10+
keggCompounds(pathwayID)
1111
}
1212
\arguments{
13-
\item{target}{
13+
\item{pathwayID}{
1414
A KEGG pathway identifier with the prefix \code{map} and 5 digit number.
1515
}
1616

@@ -22,7 +22,7 @@ A list of KEGG compound identifiers
2222
\url{https://www.genome.jp/kegg/pathway.html}
2323
}
2424
\author{
25-
Dan Tenenbaum
25+
Dan Tenenbaum, Kristina Riemer
2626
}
2727
\examples{
2828
keggCompounds("map00361")

0 commit comments

Comments
 (0)