api

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const Server = "https://rest.ensembl.org"

Variables

View Source
var FiletypeMap = map[string]MimeType{
	"compgen":  Json,
	"info":     Json,
	"lookup":   Json,
	"mapping":  Json,
	"sequence": Fasta,
	"ontology": Json,
	"overlap":  Json,
	"taxonomy": Json,
}
View Source
var ModuleMap = map[string]map[string]string{
	"compgen": {
		"homology_species_gene_id": "homology_id",
	},
	"info": {
		"species": "species",
	},
	"lookup": {
		"symbol_post": "symbol",
		"lookup_post": "id",
	},
	"mapping": {
		"assembly_cdna":        "cdna2gen",
		"assembly_cds":         "cds2gen",
		"assembly_translation": "prot2gen",
		"assembly_map":         "asm2asm",
	},
	"ontology": {
		"ontology_id":   "id",
		"ontology_name": "name",
	},
	"overlap": {
		"overlap_id":     "id",
		"overlap_region": "region",
	},
	"taxonomy": {
		"taxonomy_classification": "classification",
		"taxonomy_id":             "term",
	},
	"sequence": {
		"sequence_id_post": "id",
		"sequence_region":  "region",
	},
}

Functions

func Do

func Do(r Request) (io.ReadCloser, error)

func LoadApiData

func LoadApiData() (res map[string]any, err error)

Types

type ApiEndpoint

type ApiEndpoint struct {
	Name, Description, Method, Path string
	ParamsReq                       []ApiParam `json:"params_req"`
	ParamsOpt                       []ApiParam `json:"params_opt"`
}

func (ApiEndpoint) FindParam

func (ae ApiEndpoint) FindParam(name string) (res ApiParam, err error)

type ApiParam

type ApiParam struct {
	Name, Description, Example string
	ValType                    string `json:"type"`
	Def                        string `json:"default"`
}

type ApiTable

type ApiTable map[string][]ApiEndpoint
var Table ApiTable

func (ApiTable) FindEndpoint

func (at ApiTable) FindEndpoint(section, name string) (res *ApiEndpoint, err error)

type MimeType

type MimeType int
const (
	Fasta MimeType = iota
	Gff3
	Bed
	Json
	Newick
	Seqxml
	Phyloxml
	Xml
	Yaml
)

func (MimeType) Extension

func (mt MimeType) Extension() string

func (MimeType) Name

func (mt MimeType) Name() string

func (MimeType) String

func (mt MimeType) String() string

type Request

type Request struct {
	Endpoint    *ApiEndpoint
	Params      map[string]any
	ContentType MimeType
}

func MakeRequest

func MakeRequest(
	endpoint *ApiEndpoint,
	params map[string]any,
	contentType MimeType,
) (Request, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL