-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Add CNV evidence plot and JSON table creation code to the API using the database schema and tables build in PedatricOpenTargets/OpenPedCan-api#81. This ticket is heavily based off the thorough example @logstar wrote for building the methylation database plots and tables in PedatricOpenTargets/OpenPedCan-api#70.
For the CNV evidence plot view, a plot API endpoint and a table API endpoint need to be developed. The endpoints and R functions can take any appropriate names that are not taken by existing endpoints or functions. Following are the steps to add example gene_disease_cnv_evidence plot and table endpoints:
- Install any additionally required programs or packages in
Dockerfile - Add
src/get_cnv_evidence_tbl.Rto define a function,get_cnv_evidence_tbl(ensg_id, efo_id)to retrieve a dataframe like object from the datase.src/get_gene_tpm_boxplot_tbl.Rcan be used as a reference for designing and implementingget_cnv_evidence_tbl.- Query should be sent to the schema and table built in PedatricOpenTargets/OpenPedCan-api#81. If there are issues, leave a comment there to document what the issues were.
- Add
src/get_cnv_evidence_plot.Rto define a function,get_cnv_evidence_plot(cnv_evidence_table), to use the table returned byget_cnv_evidence_tbl.Rto generate a plot, which will be transferred to MTP. - Add
src/get_cnv_evidence_plot_summary_tbl.Rto define a function,get_cnv_evidence_plot_summary_tbl(cnv_evidence_table), to use the table returned byget_cnv_evidence_tblto generate a summary table, which will be transferred to MTP. - Add the following code to
main.Rto source the defined functions in API HTTP server R runtime:
source("src/get_cnv_evidence_tbl.R")
source("src/get_cnv_evidence_plot_tbl.R")
source("src/get_cnv_evidence_plot_summary_tbl.R")
- Add the following code in
src/plumber.Rto define a plot endpoint and a table endpoint.
#* Get a single-gene single-disease CNV table
#*
#* @tag "CNV"
#* @param ensemblId:str one gene ENSG ID.
#* @param efoId:str one EFO ID.
#* @serializer json
#* @get /cnv/evidence/json
function(ensemblId, efoId) {
cnv_evidence_table <- get_cnv_evidence_tbl(
ensg_id = ensemblId, efo_id = efoId)
cnv_evidence_summary_table <- get_cnv_evidence_plot_summary_tbl(
cnv_evidence_table)
return(cnv_evidence_summary_table)
}
#* Get a single-gene single-disease CNV plot
#*
#* @tag "CNV"
#* @param ensemblId:str one gene ENSG ID.
#* @param efoId:str one EFO ID.
#* @serializer png list(res = 300, width = 6000, height = 2700)
#* @get /cnv/evidence/plot
function(ensemblId, efoId) {
cnv_evidence_table <- get_cnv_evidence_tbl(
ensg_id = ensemblId, efo_id = efoId)
cnv_evidence_plot <- get_cnv_evidence_plot(
cnv_evidence_table)
print(get_cnv_evidence_plot)
}
Metadata
Metadata
Assignees
Labels
No labels