Skip to content

Commit

Permalink
updating plumber
Browse files Browse the repository at this point in the history
  • Loading branch information
tsheils committed Apr 30, 2024
1 parent d2189de commit fb2340a
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions apps/ramp-server/plumber.R
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,19 @@ function(analyte) {
analytes_df <- RaMP::rampFastCata(
db = rampDB,
analytes = analyte,
NamesOrIds = "ids"
NameOrIds = "ids"
)

hmdbMatches <- unlist(unique(analytes_df[[1]]$input_analyte))
rheaMatches <- unlist(unique(analytes_df[[2]]$input_analyte))
idMatches = length(union(hmdbMatches, rheaMatches))

# this is the return object from the try/catch
# with ramp v3.0, the result is a dataframe of HMDB results and a second dataframe of Rhea results
list(data=analytes_df, idMatchCount=idMatches)
},
error = function(cond) {
idMatches = 0
return(data.frame(stringsAsFactors = FALSE))
})

Expand All @@ -347,15 +356,19 @@ function(analyte) {
# }
# )
# analytes_df <- rbind(analytes_df_ids, analytes_df_names)
return(
list(
data = unique(analytes_df_ids),
function_call = makeFunctionCall(analyte,"rampFastCata"),
numFoundIds = length(unique(analytes_df_ids$Input_Analyte))
)

return(
# note... currently we're just returning the HMDB results.
# RaMP v3 also has Rhea results that can be displayed
# It would be referenced like this in this method: analytes_df_ids$data$Rhea_Analyte_Associations
# note below we only reference the HMDB result until the UI can process both dataframes.
list(
data = unique(analytes_df_ids$data$HMDB_Analyte_Associations),
function_call = makeFunctionCall(analyte,"rampFastCata"),
numFoundIds = analytes_df_ids$idMatchCount
)
)
}

#####
#' Return combined Fisher's test results
#' from given list of analytes query results
Expand Down

0 comments on commit fb2340a

Please sign in to comment.