Documentation ¶
Overview ¶
Package api implements the back-end for PharmacoDB.
For more information about the API, visit https://github.com/bhklab/PharmacoDB
Index ¶
- Constants
- func BadRequest(c *gin.Context, description interface{})
- func CellCompoundIntersection(c *gin.Context)
- func CellCompounds(c *gin.Context)
- func CellDatasetIntersection(c *gin.Context)
- func CompoundCells(c *gin.Context)
- func CompoundTissues(c *gin.Context)
- func Count(table string) (int, error)
- func Database() (*sql.DB, error)
- func DatasetCells(c *gin.Context)
- func DatasetCompounds(c *gin.Context)
- func DatasetTissues(c *gin.Context)
- func GetEnvMode() string
- func GetEnvPort() string
- func GetEnvVersion() string
- func IndexCells(c *gin.Context)
- func IndexCellsHEAD(c *gin.Context)
- func IndexCompounds(c *gin.Context)
- func IndexDatasets(c *gin.Context)
- func IndexExperiments(c *gin.Context)
- func IndexIntersections(c *gin.Context)
- func IndexTissues(c *gin.Context)
- func Init(config *Config)
- func InternalServerError(c *gin.Context, description interface{})
- func LogSentry(err error)
- func NotFound(c *gin.Context, description interface{})
- func RenderJSON(c *gin.Context, indent bool, obj interface{})
- func RenderJSONwithMeta(c *gin.Context, indent bool, page int, limit int, total int, include string, ...)
- func RootHandler(c *gin.Context)
- func SetDB(version string)
- func SetVersion(version string)
- func ShowCell(c *gin.Context)
- func ShowCompound(c *gin.Context)
- func ShowDataset(c *gin.Context)
- func ShowExperiment(c *gin.Context)
- func ShowTissue(c *gin.Context)
- func StatDatasetsCells(c *gin.Context)
- func StatDatasetsCellsCompounds(c *gin.Context)
- func StatDatasetsCompounds(c *gin.Context)
- func StatDatasetsCompoundsCells(c *gin.Context)
- func StatDatasetsCompoundsTissues(c *gin.Context)
- func StatDatasetsExperiments(c *gin.Context)
- func StatDatasetsTissues(c *gin.Context)
- func StatDatasetsTissuesCells(c *gin.Context)
- func StatDatasetsTissuesCompounds(c *gin.Context)
- func StatTissuesCells(c *gin.Context)
- func TissueCells(c *gin.Context)
- func TissueCompounds(c *gin.Context)
- func Version() string
- func WriteHeader(c *gin.Context, endpoint string, page int, limit int, total int)
- type Annotation
- type Annotations
- type Cell
- type Cells
- type Comp
- type Compound
- type Compounds
- type Comps
- type Config
- type DBAuthInfo
- type DC
- type DCS
- type DT
- type DTS
- type Dataset
- type DatasetCount
- type DatasetCounts
- type Datasets
- type DoseResponse
- type DoseResponses
- type Error
- type Experiment
- type Experiments
- type Intersection
- type Intersections
- type Route
- type Routes
- type Tissue
- type TissueCount
- type TissueCounts
- type Tissues
Constants ¶
const ( DebugMode string = "debug" // for development ReleaseMode string = "release" // for production TestMode string = "test" // for testing )
API server environment modes.
const ( GET string = "GET" HEAD string = "HEAD" POST string = "POST" PUT string = "PUT" DELETE string = "DELETE" OPTION string = "OPTION" PATCH string = "PATCH" )
HTTP methods.
Variables ¶
This section is empty.
Functions ¶
func BadRequest ¶
BadRequest responds with error status code 400, Bad Request.
func CellCompoundIntersection ¶
CellCompoundIntersection returns a list of experiments where a cell line and a compound have been tested. Handles GET requests for /intersections/{id}/{cell_id}/{compound_id}.
func CellCompounds ¶
CellCompounds returns all distinct compounds where a cell line of interest has been tested. Handles GET requests for /cell_lines/{id}/compounds.
func CellDatasetIntersection ¶
CellDatasetIntersection returns a list of experiments where a cell line has been tested in a dataset. Handles GET requests for /intersections/{id}/{cell_id}/{dataset_id}.
func CompoundCells ¶
CompoundCells returns all cell lines tested with compound. Handles GET requests for /compounds/{id}/cell_lines.
func CompoundTissues ¶
CompoundTissues returns all tissues tested with compound. Handles GET requests for /compounds/{id}/tissues.
func DatasetCells ¶
DatasetCells returns a list of cell lines tested in dataset. Handles GET requests for /datasets/{id}/cell_lines.
func DatasetCompounds ¶
DatasetCompounds returns a list of compounds tested in dataset. Handles GET requests for /datasets/{id}/compounds.
func DatasetTissues ¶
DatasetTissues returns a list of tissues tested in dataset. Handles GET requests for /datasets/{id}/tissues.
func GetEnvVersion ¶
func GetEnvVersion() string
GetEnvVersion gets api version from environment variable VERSION.
func IndexCells ¶
IndexCells returns a list of cell lines. Handles GET requests for /cell_lines.
func IndexCellsHEAD ¶
IndexCellsHEAD returns header info for cell lines. Handles HEAD requests for /cell_lines.
func IndexCompounds ¶
IndexCompounds returns a list of compounds. Handles GET requests for /compounds.
func IndexDatasets ¶
IndexDatasets returns a list of datasets. Handles GET requests for /datasets.
func IndexExperiments ¶
IndexExperiments returns a list of experiments. Handles GET requests for /experiments.
func IndexIntersections ¶
IndexIntersections returns a list of all intersections. Handles GET requests for /intersections.
func IndexTissues ¶
IndexTissues returns a list of tissues. Handles GET requests for /tissues.
func InternalServerError ¶
InternalServerError responds with error status code 500, Internal Server Error.
func RenderJSON ¶
RenderJSON returns an indented, or non-indented, JSON output.
func RenderJSONwithMeta ¶
func RenderJSONwithMeta(c *gin.Context, indent bool, page int, limit int, total int, include string, obj interface{})
RenderJSONwithMeta adds metadata to response body.
func RootHandler ¶
RootHandler handles GET requests for root endpoint.
func ShowCell ¶
ShowCell returns a single cell line using id/name. Handles GET requests for /cell_lines/{id}.
func ShowCompound ¶
ShowCompound returns a single compound. Handles GET requests for /compounds/{id}.
func ShowDataset ¶
ShowDataset returns a single dataset. Handles GET requests for /datasets/{id}.
func ShowExperiment ¶
ShowExperiment returns a single experiment. Handles GET requests for /experiments/{id}.
func ShowTissue ¶
ShowTissue returns a single tissue. Handles GET requests for /tissues/{id}.
func StatDatasetsCells ¶
StatDatasetsCells returns a list of datasets, and the number of cell lines tested in each dataset. Handles GET requests for /stats/datasets/cell_lines.
func StatDatasetsCellsCompounds ¶
StatDatasetsCellsCompounds returns a list of datasets, and the number of compounds tested with a cell line per dataset. Handles GET requests for /stats/datasets/compounds/cell_lines/:id.
func StatDatasetsCompounds ¶
StatDatasetsCompounds returns a list of datasets, and the number of compounds tested in each dataset. Handles GET requests for /stats/datasets/compounds.
func StatDatasetsCompoundsCells ¶
StatDatasetsCompoundsCells returns a list of datasets, and the number of cell lines tested with a drug per dataset. Handles GET requests for /stats/datasets/cell_lines/compounds/{id}.
func StatDatasetsCompoundsTissues ¶
StatDatasetsCompoundsTissues returns a list of datasets, and the number of tissues tested with a compound per dataset. Handles GET requests for /stats/datasets/tissues/compounds/{id}.
func StatDatasetsExperiments ¶
StatDatasetsExperiments returns a list of datasets, and the number of experiments carried out in each dataset. Handles GET requests for /stats/datasets/experiments.
func StatDatasetsTissues ¶
StatDatasetsTissues returns a list of datasets, and the number of tissues tested in each dataset. Handles GET requests for /stats/datasets/tissues.
func StatDatasetsTissuesCells ¶
StatDatasetsTissuesCells returns a list of datasets, and the number of cell lines in a tissue per dataset. Handles GET requests for /stats/datasets/cell_lines/tissues/{id}.
func StatDatasetsTissuesCompounds ¶
StatDatasetsTissuesCompounds returns a list of datasets, and the number of compounds tested with a tissue per dataset. Handles GET requests for /stats/datasets/compounds/tissues/{id}.
func StatTissuesCells ¶
StatTissuesCells returns a list of tissues, and the number of cell lines per tissue. Handles GET requests for /stats/tissues/cell_lines.
func TissueCells ¶
TissueCells returns all cell lines of a tissue type. Handles GET requests for /tissues/{id}/cell_lines.
func TissueCompounds ¶
TissueCompounds returns all compounds tested with tissue. Handles GET requests for /tissues/{id}/compounds.
Types ¶
type Annotation ¶
Annotation models the name used by datasets for a resource item.
type Cell ¶
type Cell struct { ID int `json:"id"` ACC *string `json:"accession_id,omitempty"` Name string `json:"name"` Tissue *Tissue `json:"tissue,omitempty"` Annotations Annotations `json:"annotations,omitempty"` }
Cell is a resource model for cell_lines.
type Cells ¶
type Cells []Cell
Cells is a collection of Cell.
type Comp ¶
type Comp struct { Compound Compound `json:"compound"` Datasets []string `json:"datasets"` Count int `json:"experiment_count"` }
Comp models experiment data for a compound-resource pair test.
type Compound ¶
type Compound struct { ID int `json:"id"` Name string `json:"name"` Annotations Annotations `json:"annotations,omitempty"` }
Compound is a resource model for compounds.
func (*Compound) Cells ¶
Cells returns a paginated list of all distinct cell lines which have been tested with drug, along with experiments count and an array of datasets that tested each cell/drug combination.
type Compounds ¶
type Compounds []Compound
Compounds is a collection of Drug.
type Config ¶
Config is an API configuration struct.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns the default API configuration setting.
func (*Config) SetVersion ¶
SetVersion sets api version.
type DBAuthInfo ¶
type DBAuthInfo struct { User string // local mysql user Pass string // local mysql password Name string // database name Host string // mysql host }
DBAuthInfo contains local mysql username, password, and database name.
var DB DBAuthInfo
DB is a global datastore for database connection information.
type DC ¶
type DC struct { Cell Cell `json:"cell_line"` Datasets []string `json:"datasets"` Count int `json:"experiment_count"` }
DC models experiment data for a compound and a cell line.
type DT ¶
type DT struct { Tissue Tissue `json:"tissue"` Datasets []string `json:"datasets"` Count int `json:"experiment_count"` }
DT models experiment data for a compound and a tissue.
type Dataset ¶
Dataset is a resource model for datasets.
type DatasetCount ¶
DatasetCount models the number of compounds tested per dataset.
type DatasetCounts ¶
type DatasetCounts []DatasetCount
DatasetCounts is a collection of DatasetCount.
func CountItemsPerDataset ¶
func CountItemsPerDataset(query string) (DatasetCounts, error)
CountItemsPerDataset returns a list of all datasets, along with the number of required item tested in each dataset.
type Datasets ¶
type Datasets []Dataset
Datasets is a collection of Dataset.
type DoseResponse ¶
DoseResponse is a model for a dose/response data pair.
type DoseResponses ¶
type DoseResponses []DoseResponse
DoseResponses is a collection of DoseResponse.
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Description interface{} `json:"description,omitempty"` }
Error is a public error implementation.
type Experiment ¶
type Experiment struct { ID int `json:"experiment_id"` Cell Cell `json:"cell_line"` Tissue Tissue `json:"tissue"` Compound Compound `json:"compound"` Dataset Dataset `json:"dataset"` DoseResponses DoseResponses `json:"dose_responses,omitempty"` }
Experiment is a resource model for experiments.
func (*Experiment) DoseResponse ¶
func (experiment *Experiment) DoseResponse() error
DoseResponse updates receiver experiment with its corresponding dose/response data.
func (*Experiment) Find ¶
func (experiment *Experiment) Find(id string) error
Find updates receiver with a record for a single experiment.
type Experiments ¶
type Experiments []Experiment
Experiments is a collection of Experiment.
func (*Experiments) CellCompoundCombination ¶
func (experiments *Experiments) CellCompoundCombination(cellID string, compoundID string, typ string) error
CellCompoundCombination updates receiver with a list of all experiments where a cell line and a drug have been tested.
func (*Experiments) CellDatasetCombination ¶
func (experiments *Experiments) CellDatasetCombination(cellID string, datasetID string, typ string) error
CellDatasetCombination updates receiver with a list of all experiments where a cell line and dataset have been tested.
func (*Experiments) ListPaginated ¶
func (experiments *Experiments) ListPaginated(page int, limit int) error
ListPaginated updates receiver with a list of experiments using pagination.
type Intersection ¶
type Intersection struct { ID int `json:"id"` ResComb []string `json:"resources_combined"` Path string `json:"template_path"` Ex string `json:"example_path"` }
Intersection is a combination query model.
type Intersections ¶
type Intersections []Intersection
Intersections is a collection of Intersection.
func (*Intersections) List ¶
func (intersections *Intersections) List()
List lists all possible intersections.
type Route ¶
type Route struct { Endpoint string Handler gin.HandlerFunc }
Route is a routing model.
type Tissue ¶
type Tissue struct { ID int `json:"id"` Name *string `json:"name,omitempty"` Annotations Annotations `json:"annotations,omitempty"` }
Tissue is a resource model for tissues.
type TissueCount ¶
TissueCount models the number of cell lines per tissue.
type TissueCounts ¶
type TissueCounts []TissueCount
TissueCounts is a collection of TissueCount.
func CountCellsPerTissue ¶
func CountCellsPerTissue() (TissueCounts, error)
CountCellsPerTissue returns a list of all tissues, along with the number of cell lines of each tissue type.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This module is used for tranforming front-end database to back-end database, modifying/adding/dropping tables as needed.
|
This module is used for tranforming front-end database to back-end database, modifying/adding/dropping tables as needed. |