Skip to content
Snippets Groups Projects
Commit 88be3040 authored by Jean-Karim Heriche's avatar Jean-Karim Heriche
Browse files

Fix a few bugs

parent 7d76b81d
No related branches found
No related tags found
No related merge requests found
......@@ -65,8 +65,7 @@ CompoundHandle <- R6Class(
name = df$name,
usage_class = df$usage_class,
dose = df$dose,
unit = df$unit,
well = well)
unit = df$unit)
compounds <- c(compounds, c)
}
return(compounds)
......
......@@ -38,9 +38,9 @@ Phenotype <- R6Class(
stop("DB connection obect required to create Phenotype object")
}
if(is.na(name)) { stop("Name required to create Phenotype object") }
if(is.na(xrefDB) || is.na(xrefID)) {
warning("Consider setting one xrefDB and xrefID crossreference for new Phenotype object")
}
# if(is.na(xrefDB) || is.na(xrefID)) {
# warning("Consider setting one xrefDB and xrefID crossreference for new Phenotype object")
# }
self$dbConnection <- dbConnection
if(is.na(ID)) {
ph <- PhenotypeHandle$new(self$dbConnection)
......
......@@ -31,6 +31,20 @@ ScreenHandle <- R6Class(
return(screen)
} else { return(NULL) }
},
#' @description Retrieve all screens
#' @return Vector of Screen objects
get_all_screens = function() {
query <- "SELECT DISTINCT ID FROM Screen"
df <- self$dbConnection$get_data(query)
if(length(df$ID)>0) {
screens <- list()
for(id in df$ID) {
sc <- self$get_by_id(id)
screens <- c(screens, sc)
}
return(screens)
}
},
#' @description Retrieve all screens with the given name
#' @param name A screen name
#' @return Vector of Screen objects
......@@ -39,7 +53,7 @@ ScreenHandle <- R6Class(
df <- self$dbConnection$get_data(query, list(name))
if(length(df$ID)>0) {
screens <- list()
for(id in df$dbID) {
for(id in df$ID) {
sc <- self$get_by_id(id)
screens <- c(screens, sc)
}
......
......@@ -36,10 +36,31 @@ WellHandle <- R6Class(
data <- self$dbConnection$get_data(query, list(plate$ID))
if(length(data$Plate_ID)>0) {
wells <- list()
df.list <- split(data, data$ID)
df.list <- split(data, data$position)
for(df in df.list) {
w <- Well$new(dbConnection = self$dbConnection,
ID = df$Plate_ID, position = df$Well_position,
ID = df$Plate_ID, position = df$position,
label = df$label, temperature = df$temperature)
wells <- c(wells, w)
}
return(wells)
} else { return(NULL) }
},
#' @description Retrieve all wells where a compound is found
#' @param compound A Compound object
#' @return Vector of Well objects
get_all_by_compound = function(compound) {
query <- "SELECT W.* FROM Well AS W, Well_has_Compound AS WhC
WHERE WhC.Compound_ID = ?
AND WhC.Plate_ID = W.Plate_ID
AND WhC.Well_position = W.position"
data <- self$dbConnection$get_data(query, list(compound$ID))
if(length(data$position)>0) {
wells <- list()
df.list <- split(data, paste0(data$Plate_ID, data$position))
for(df in df.list) {
w <- Well$new(dbConnection = self$dbConnection,
plate_ID = df$Plate_ID, position = df$position,
label = df$label, temperature = df$temperature)
wells <- c(wells, w)
}
......
......@@ -19,6 +19,7 @@ retrieval of Screen objects.
\itemize{
\item \href{#method-ScreenHandle-new}{\code{ScreenHandle$new()}}
\item \href{#method-ScreenHandle-get_by_id}{\code{ScreenHandle$get_by_id()}}
\item \href{#method-ScreenHandle-get_all_screens}{\code{ScreenHandle$get_all_screens()}}
\item \href{#method-ScreenHandle-get_all_by_name}{\code{ScreenHandle$get_all_by_name()}}
\item \href{#method-ScreenHandle-get_all_by_status}{\code{ScreenHandle$get_all_by_status()}}
\item \href{#method-ScreenHandle-get_new_ID}{\code{ScreenHandle$get_new_ID()}}
......@@ -65,6 +66,19 @@ A Screen object
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ScreenHandle-get_all_screens"></a>}}
\if{latex}{\out{\hypertarget{method-ScreenHandle-get_all_screens}{}}}
\subsection{Method \code{get_all_screens()}}{
Retrieve all screens
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{ScreenHandle$get_all_screens()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
Vector of Screen objects
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-ScreenHandle-get_all_by_name"></a>}}
\if{latex}{\out{\hypertarget{method-ScreenHandle-get_all_by_name}{}}}
\subsection{Method \code{get_all_by_name()}}{
......
......@@ -20,6 +20,7 @@ retrieval of Well objects.
\item \href{#method-WellHandle-new}{\code{WellHandle$new()}}
\item \href{#method-WellHandle-get_by_id}{\code{WellHandle$get_by_id()}}
\item \href{#method-WellHandle-get_all_by_plate}{\code{WellHandle$get_all_by_plate()}}
\item \href{#method-WellHandle-get_all_by_compound}{\code{WellHandle$get_all_by_compound()}}
\item \href{#method-WellHandle-store}{\code{WellHandle$store()}}
\item \href{#method-WellHandle-clone}{\code{WellHandle$clone()}}
}
......@@ -85,6 +86,26 @@ Vector of Well objects
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-WellHandle-get_all_by_compound"></a>}}
\if{latex}{\out{\hypertarget{method-WellHandle-get_all_by_compound}{}}}
\subsection{Method \code{get_all_by_compound()}}{
Retrieve all wells where a compound is found
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{WellHandle$get_all_by_compound(compound)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{compound}}{A Compound object}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
Vector of Well objects
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-WellHandle-store"></a>}}
\if{latex}{\out{\hypertarget{method-WellHandle-store}{}}}
\subsection{Method \code{store()}}{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment