api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 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",
		"homology_symbol":          "homology_symbol",
	},
	"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 added in v0.0.2

func LoadAPIData() (map[string]any, error)

Types

type Endpoint added in v0.0.2

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

func (Endpoint) FindParam added in v0.0.2

func (ae Endpoint) FindParam(name string) (Param, 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 Param added in v0.0.2

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

type Request

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

func MakeRequest

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

type Table

type Table map[string][]Endpoint
var Data Table

func (Table) FindEndpoint added in v0.0.2

func (at Table) FindEndpoint(section, name string) (*Endpoint, error)

Jump to

Keyboard shortcuts

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