Skip to content
Open
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
3 changes: 2 additions & 1 deletion R/matrixDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#' @return Output is the matrix A written
#' to the serverside. For more details see help for ds.matrix
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
#'
matrixDS <- function(mdata.transmit, from, nrows.transmit, ncols.transmit, byrow, dimnames){
Expand Down Expand Up @@ -92,7 +93,7 @@ if(!is.null(dimnames))

if(from=="serverside.vector"||from=="serverside.scalar")
{
mdata<-eval(parse(text=mdata.transmit), envir = parent.frame())
mdata <- .loadServersideObject(mdata.transmit)
}


Expand Down
35 changes: 3 additions & 32 deletions R/matrixDetDS1.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,13 @@
#' @return Output is the determinant of the matrix identified by argument <M1>
#' which is returned to the clientside. For more details see help for ds.matrixDet
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export

matrixDetDS1 <- function(M1.name=NULL,logarithm){

#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.tab<-as.numeric(thr$nfilter.tab) #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
#nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
error.message<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(error.message, call. = FALSE)
}

#EVAL M1

M1<-eval(parse(text=M1.name), envir = parent.frame())

if(!is.matrix(M1)&&!is.data.frame(M1))
{
error.message<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(error.message, call. = FALSE)
}
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#coerce to matrix if a data.frame
if(is.data.frame(M1))
Expand Down
35 changes: 3 additions & 32 deletions R/matrixDetDS2.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,13 @@
#' @return Output is the determinant of the matrix identified by argument <M1>
#' which is written to the serverside. For more details see help for ds.matrixDet
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export

matrixDetDS2 <- function(M1.name=NULL,logarithm){

#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.tab<-as.numeric(thr$nfilter.tab) #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
#nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}

#EVAL M1

M1<-eval(parse(text=M1.name), envir = parent.frame())

if(!is.matrix(M1)&&!is.data.frame(M1))
{
studysideMessage<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#coerce to matrix if a data.frame
if(is.data.frame(M1))
Expand Down
3 changes: 2 additions & 1 deletion R/matrixDiagDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#' (or default name diag_<x1>) which is written to the serverside.
#' For more details see help for \code{ds.matrixDiag}.
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
matrixDiagDS <- function(x1.transmit,aim,nrows.transmit){
#########################################################################
Expand Down Expand Up @@ -65,7 +66,7 @@ if(aim=="serverside.vector.2.matrix"||aim=="serverside.scalar.2.matrix"||aim=="s
{
#x1 is name of the serverside vector, scalar or matrix

x1<-eval(parse(text=x1.transmit), envir = parent.frame())
x1 <- .loadServersideObject(x1.transmit)

#coerce to matrix if x1 is a data.frame
if(is.data.frame(x1))
Expand Down
26 changes: 4 additions & 22 deletions R/matrixDimnamesDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#' (or default name diag_<x1>) with specified dimnames (row and column
#' names) which is written to the serverside.
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
matrixDimnamesDS <- function(M1.name=NULL,dimnames){

Expand All @@ -28,23 +29,11 @@ thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}


#Check length of dimnames string not so long as to provide a risk of hidden code
#This could legitimately be quite long so allow 2*nfilter.string

Expand All @@ -61,15 +50,8 @@ if(!is.null(dimnames))
}
}

#EVAL M1

M1<-eval(parse(text=M1.name), envir = parent.frame())

if(!is.matrix(M1)&&!is.data.frame(M1))
{
studysideMessage<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#coerce to matrix if a data.frame
if(is.data.frame(M1))
Expand Down
36 changes: 3 additions & 33 deletions R/matrixInvertDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,13 @@
#' @return Output is the matrix representing the inverse of A which is written
#' to the serverside. For more details see help for ds.matrixInvert
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
#'
matrixInvertDS <- function(M1.name=NULL){

#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.tab<-as.numeric(thr$nfilter.tab) #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
#nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}

#EVAL M1


M1<-eval(parse(text=M1.name), envir = parent.frame())

if(!is.matrix(M1)&&!is.data.frame(M1))
{
studysideMessage<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#coerce to matrix if a data.frame
if(is.data.frame(M1))
Expand Down
55 changes: 5 additions & 50 deletions R/matrixMultDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,16 @@
#' @return Output is the matrix representing the product of M1 and M2 which is written
#' to the serverside. For more details see help for ds.matrixMult
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
#'
matrixMultDS <- function(M1.name=NULL, M2.name=NULL){

#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.tab<-as.numeric(thr$nfilter.tab) #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
#nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################
#EVAL M1 and M2
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}

#Check length of M2.name not so long as to provide a risk of hidden code
length.M2.name<-length(unlist(strsplit(M2.name,'')))

if(length.M2.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M2.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}

M1<-eval(parse(text=M1.name), envir = parent.frame())
M2<-eval(parse(text=M2.name), envir = parent.frame())



if(!is.matrix(M1)&&!is.data.frame(M1))
{
studysideMessage<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}

if(!is.matrix(M2)&&!is.data.frame(M2))
{
studysideMessage<-"FAILED: M2 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}
M2 <- .loadServersideObject(M2.name)
.checkClass(obj = M2, obj_name = M2.name, permitted_classes = c("matrix", "data.frame"))

if(is.data.frame(M1))
{
Expand Down
35 changes: 3 additions & 32 deletions R/matrixTransposeDS.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,42 +9,13 @@
#' @return Output is the matrix representing the transpose of A which is written
#' to the serverside. For more details see help for ds.matrixTranspose
#' @author Paul Burton for DataSHIELD Development Team
#' @author Tim Cadman, Genomics Coordination Centre, UMCG, Netherlands
#' @export
#'
matrixTransposeDS <- function(M1.name=NULL){
#########################################################################
# DataSHIELD MODULE: CAPTURE THE nfilter SETTINGS #
thr<-dsBase::listDisclosureSettingsDS() #
#nfilter.tab<-as.numeric(thr$nfilter.tab) #
#nfilter.glm<-as.numeric(thr$nfilter.glm) #
#nfilter.subset<-as.numeric(thr$nfilter.subset) #
#nfilter.string<-as.numeric(thr$nfilter.string) #
nfilter.stringShort<-as.numeric(thr$nfilter.stringShort) #
#nfilter.kNN<-as.numeric(thr$nfilter.kNN) #
#datashield.privacyLevel<-as.numeric(thr$datashield.privacyLevel) #
#########################################################################

#Check length of M1.name not so long as to provide a risk of hidden code
length.M1.name<-length(unlist(strsplit(M1.name,'')))

if(length.M1.name>nfilter.stringShort)
{
studysideMessage<-
paste0("FAILED: M1.name is too long it could hide concealed code, please shorten to <= nfilter.stringShort = ",
nfilter.stringShort," characters")
stop(studysideMessage, call. = FALSE)
}


#EVAL M1

M1<-eval(parse(text=M1.name), envir = parent.frame())

if(!is.matrix(M1)&&!is.data.frame(M1))
{
studysideMessage<-"FAILED: M1 must be of class matrix or data.frame, please respecify"
stop(studysideMessage, call. = FALSE)
}
M1 <- .loadServersideObject(M1.name)
.checkClass(obj = M1, obj_name = M1.name, permitted_classes = c("matrix", "data.frame"))

#coerce to matrix if a data.frame
if(is.data.frame(M1))
Expand Down
2 changes: 2 additions & 0 deletions man/matrixDS.Rd

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

2 changes: 2 additions & 0 deletions man/matrixDetDS1.Rd

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

2 changes: 2 additions & 0 deletions man/matrixDetDS2.Rd

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

2 changes: 2 additions & 0 deletions man/matrixDiagDS.Rd

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

2 changes: 2 additions & 0 deletions man/matrixDimnamesDS.Rd

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

2 changes: 2 additions & 0 deletions man/matrixInvertDS.Rd

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

2 changes: 2 additions & 0 deletions man/matrixMultDS.Rd

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

2 changes: 2 additions & 0 deletions man/matrixTransposeDS.Rd

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

Loading
Loading