Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: dsBaseClient
Title: DataSHIELD Client Functions
Version: 5.0.0-01
Version: 5.0.0-02
Author: DataSHIELD Developers <datashield@newcastle.ac.uk>
Maintainer: DataSHIELD Developers <datashield@newcastle.ac.uk>
Description: DataSHIELD client functions for the client site.
Expand Down
137 changes: 75 additions & 62 deletions R/ds.listClientsideFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,75 +6,88 @@
#' dsStatsClient, or userDefinedClient. Operates by directly interrogating
#' the R objects stored in the input client packages and objects with name
#' "ds. ....." in .GlobalEnv
#' @param all.functions logical, if TRUE will list all client-side functions
#' in the input client-side packages and/or in .GlobalEnv. Default = TRUE
#' @param dsBaseClient logical, if TRUE will selectively list client-side functions
#' in "package:dsBaseClient". Default = FALSE.
#' @param dsGraphicsClient logical, if TRUE will selectively list client-side functions
#' in "package:dsGraphicsClient". Default = FALSE.
#' @param dsModellingClient logical, if TRUE will selectively list client-side functions
#' in "package:dsModellingClient". Default = FALSE.
#' @param dsStatsClient logical, if TRUE will selectively list client-side functions
#' in "package:dsStatsClient". Default = FALSE.
#' @param dsBetaTestClient logical, if TRUE will selectively list client-side functions
#' in "package:dsBetaTestClient". Default = FALSE.
#' @param userDefinedClient logical, if TRUE will selectively list user defined
#' client-side functions held as R objects with name "ds. ..." in .Global.env". Default = FALSE.
#' @return list containing all functions in each or all of these five classes
#' @author Paul Burton for DataSHIELD Development Team
#' @export
ds.listClientsideFunctions <-function(all.functions=TRUE,
dsBaseClient=FALSE,
dsGraphicsClient=FALSE,
dsModellingClient=FALSE,
dsStatsClient=FALSE,
dsBetaTestClient=FALSE,
userDefinedClient=FALSE
){
#THIS IS UNDERLYING SEARCH FUNCTION IN R IF NEEDED: search()
if(all.functions==TRUE&&dsBaseClient==FALSE&&dsGraphicsClient==FALSE&&
dsModellingClient==FALSE&&dsStatsClient==FALSE&&dsBetaTestClient==FALSE&&
userDefinedClient==FALSE){
cat("\n### dsBaseClient functions \n")
print(ls(pos="package:dsBaseClient"))
cat("\n\n### dsGraphicsClient functions \n")
print(ls(pos="package:dsGraphicsClient"))
cat("\n\n### dsModellingClient functions \n")
print(ls(pos="package:dsModellingClient"))
cat("\n\n### dsStatsClient functions \n")
print(ls(pos="package:dsStatsClient"))
cat("\n\n### dsBetaTestClient functions \n")
print(ls(pos="package:dsBetaTestClient"))
cat("\n\n### userDefinedClient functions \n")
print(ls(pos=".GlobalEnv",pattern="ds.*"))
ds.listClientsideFunctions <-function(){

}else{
if(dsBaseClient==TRUE){
cat("\n### dsBaseClient functions \n")
print(ls(pos="package:dsBaseClient"))}
if(dsGraphicsClient==TRUE){
cat("\n### dsBaseGraphics functions \n")
print(ls(pos="package:dsGraphicsClient"))}
if(dsModellingClient==TRUE){
cat("\n### dsModellingClient functions \n")
print(ls(pos="package:dsModellingClient"))}
if(dsStatsClient==TRUE){
cat("\n### dsStatsClient functions \n")
print(ls(pos="package:dsStatsClient"))}
if(dsBetaTestClient==TRUE){
cat("\n### dsBetaTestClient functions \n")
print(ls(pos="package:dsBetaTestClient"))}
if(userDefinedClient==TRUE){
cat("\n### userDefinedClient functions \n")
print(ls(pos=".GlobalEnv",pattern="ds.*"))}
search.path<-search()

print.text.full<-NULL

test.dsBaseClient<-FALSE
test.dsBetaTestClient<-FALSE
test.userDefinedClient<-FALSE
test.no.functions<-TRUE
potential.clientside.repositories<-NULL

if(dsBaseClient==FALSE&&dsGraphicsClient==FALSE&&dsModellingClient==FALSE&&
dsStatsClient==FALSE&&dsStatsClient==FALSE&&dsBetaTestClient==FALSE&&userDefinedClient==FALSE){
for(j in 1:length(search.path))
{

print("ALL OPTIONS DECLARED FALSE SO NO OUTPUT")
if(search.path[j]=="package:dsBaseClient")
{
test.dsBaseClient<-TRUE
test.no.functions<-FALSE
}

if(search.path[j]=="package:dsBetaTestClient")
{
test.dsBetaTestClient<-TRUE
test.no.functions<-FALSE
}

if(search.path[j]==".GlobalEnv")
{
test.userDefinedClient<-TRUE
test.no.functions<-FALSE
}
}
}


cat("\n### Full search path \n")
print.search.list<-search()
print(print.search.list)


if(test.userDefinedClient==TRUE)
{
cat("\n### userDefinedClient functions \n")
print.text<-ls(pos=".GlobalEnv",pattern="ds.*")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}

if(test.dsBetaTestClient==TRUE)
{
cat("\n### dsBetaTestClient functions \n")
print.text<-ls(pos="package:dsBetaTestClient")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}

if(test.dsBaseClient==TRUE)
{
cat("\n### dsBaseClient functions \n")
print.text<-ls(pos="package:dsBaseClient")
if(identical(print.text,character(0)))print.text<-"No clientside functions in this repository"
print(print.text)
print.text.full<-c(print.text.full,print.text)
}

if(test.no.functions==TRUE)
{
cat("\n### No standard clientside functions identified \n")
}

cat("\nIf you cannot see one or more of the clientside functions you expected to find",
"please see above for the full search path. If one of the paths is a possible clientside repository",
"issue the R command ls(pos='package:dsPackageName')",
"where 'package:dsPackageName' is the full name stated in the search path\n\n")

return(print.text.full)
}
#ds.listClientsideFunctions
# ds.listClientsideFunctions()


27 changes: 1 addition & 26 deletions man/ds.listClientsideFunctions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

154 changes: 154 additions & 0 deletions tests/testthat/atest-smk-ds.listClientsideFunctions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
#-------------------------------------------------------------------------------
# Copyright (c) 2019 University of Newcastle upon Tyne. All rights reserved.
#
# This program and the accompanying materials
# are made available under the terms of the GNU Public License v3.0.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------

#
# Set up
#

connect.studies.dataset.cnsim(list("LAB_TSC", "LAB_HDL"))

#
# Tests
#

context("ds.listClientsideFunctions::smk::check results")
test_that("check results", {
output <- paste(
[1] "ds.test_env"
[2] "checkClass"
[3] "colPercent"
[4] "ds.asCharacter"
[5] "ds.asDataMatrix"
[6] "ds.asFactor"
[7] "ds.asInteger"
[8] "ds.asList"
[9] "ds.asLogical"
[10] "ds.asMatrix"
[11] "ds.asNumeric"
[12] "ds.assign"
[13] "ds.Boole"
[14] "ds.c"
[15] "ds.cbind"
[16] "ds.changeRefGroup"
[17] "ds.class"
[18] "ds.colnames"
[19] "ds.contourPlot"
[20] "ds.cor"
[21] "ds.corTest"
[22] "ds.cov"
[23] "ds.dataFrame"
[24] "ds.dataFrameSort"
[25] "ds.dataFrameSubset"
[26] "ds.densityGrid"
[27] "ds.dim"
[28] "ds.exists"
[29] "ds.exp"
[30] "ds.gee"
[31] "ds.glm"
[32] "ds.glmSLMA"
[33] "ds.heatmapPlot"
[34] "ds.histogram"
[35] "ds.isNA"
[36] "ds.isValid"
[37] "ds.length"
[38] "ds.levels"
[39] "ds.lexis"
[40] "ds.list"
[41] "ds.listClientsideFunctions"
[42] "ds.listDisclosureSettings"
[43] "ds.listOpals"
[44] "ds.listServersideFunctions"
[45] "ds.log"
[46] "ds.look"
[47] "ds.ls"
[48] "ds.make"
[49] "ds.matrix"
[50] "ds.matrixDet"
[51] "ds.matrixDet.report"
[52] "ds.matrixDiag"
[53] "ds.matrixDimnames"
[54] "ds.matrixInvert"
[55] "ds.matrixMult"
[56] "ds.matrixTranspose"
[57] "ds.mean"
[58] "ds.meanByClass"
[59] "ds.meanSdGp"
[60] "ds.merge"
[61] "ds.message"
[62] "ds.names"
[63] "ds.numNA"
[64] "ds.quantileMean"
[65] "ds.rbind"
[66] "ds.rBinom"
[67] "ds.recodeLevels"
[68] "ds.recodeValues"
[69] "ds.replaceNA"
[70] "ds.reShape"
[71] "ds.rm"
[72] "ds.rNorm"
[73] "ds.rowColCalc"
[74] "ds.rPois"
[75] "ds.rUnif"
[76] "ds.scatterPlot"
[77] "ds.seq"
[78] "ds.setDefaultOpals"
[79] "ds.setSeed"
[80] "ds.subset"
[81] "ds.subsetByClass"
[82] "ds.summary"
[83] "ds.table1D"
[84] "ds.table2D"
[85] "ds.tapply"
[86] "ds.tapply.assign"
[87] "ds.testObjExists"
[88] "ds.unList"
[89] "ds.var"
[90] "ds.vectorCalc"
[91] "extract"
[92] "findLoginObjects"
[93] "geeChecks"
[94] "geehelper1"
[95] "geehelper2"
[96] "getOpals"
[97] "getPooledMean"
[98] "getPooledVar"
[99] "glmChecks"
[100] "init.object.list.global.environment"
[101] "init.object.list.testing.environment"
[102] "init.opal.list"
[103] "isAssigned"
[104] "isDefined"
[105] "library.dynam.unload"
[106] "logical2int"
[107] "meanByClassHelper0a"
[108] "meanByClassHelper0b"
[109] "meanByClassHelper1"
[110] "meanByClassHelper2"
[111] "meanByClassHelper3"
[112] "meanByClassHelper4"
[113] "rowPercent"
[114] "subsetHelper"
[115] "system.file"
)

res <- ds.listClientsideFunctions()

print("======")
print(res)
print("======")

expect_equal(res, output)
})

#
# Done
#

disconnect.studies.dataset.cnsim()
5 changes: 0 additions & 5 deletions tests/testthat/libraries/load_libraries.R

This file was deleted.

4 changes: 1 addition & 3 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ source("connection_to_datasets/login_details.R")
source("connection_to_datasets/init_all_datasets.R")
source("connection_to_datasets/init_studies_datasets.R")
source("connection_to_datasets/init_discordant_datasets.R")
#source("libraries/load_libraries.R")


init.all.datasets()
Expand All @@ -37,7 +36,6 @@ test_that("The virtual machine is loaded. ",
#define test_environment variables - connection to data shield and read from local files


#load.libraries()
#load the packages required for datashield to work
#test_that(" The packages dsBase, dsModelling, dsGraphics, dsStats are installed and loaded.",
#{
Expand All @@ -48,7 +46,7 @@ test_that("The virtual machine is loaded. ",
#})


print ("connect to server")
#print ("connect to server")
if (ds.test_env$context == ds.test_env$contexts[1])
{
#ds.test_env$connection.opal <- datashield.login(logins=ds.test_env$login.data, assign=TRUE,variables=ds.test_env$stats.var)
Expand Down
Loading