Skip to content

Add CNV Evidence Plot plot and table API endpoints #82

@kelseykeith

Description

@kelseykeith

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.R to 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.R can be used as a reference for designing and implementing get_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.R to define a function, get_cnv_evidence_plot(cnv_evidence_table), to use the table returned by get_cnv_evidence_tbl.Rto generate a plot, which will be transferred to MTP.
  • Add src/get_cnv_evidence_plot_summary_tbl.R to define a function, get_cnv_evidence_plot_summary_tbl(cnv_evidence_table), to use the table returned by get_cnv_evidence_tbl to generate a summary table, which will be transferred to MTP.
  • Add the following code to main.R to 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.R to 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions