goblast

package module
v0.0.0-...-caddab6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2018 License: MIT Imports: 7 Imported by: 1

README

GoBlast

GoDoc

Project Status

Work in progress.

Documentation

Overview

Package goblast provides a high level interface for accessing the NCBI BLAST API.

API documentation can be found here: https://ncbi.github.io/blast-cloud/dev/api.html

Code Example:

TODO: example code

Index

Constants

View Source
const (
	// Timeout determines how long to wait for every API call before timing out
	Timeout = 10
	// MaxRequestFrequency determines the frequency with which API calls can be made
	MaxRequestFrequency = 10
)

These package level constants are used to enforce compliance with the NCBI Usage Guidelines at https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=DeveloperInfo

Variables

View Source
var (

	// ErrNoRID indicates a missing response identifier in a function call or API response
	ErrNoRID = errors.New("no RID found or provided")
)

Functions

func GetResultsByRID

func GetResultsByRID(rid RID)

GetResultsByRID takes a response ID (`RID') and prints the URL that lists the BLAST results associated with that `RID'

func Request

func Request(params *BlastParams) (*http.Response, error)

Request makes an API call to the NCBI BLAST API with a set of `params'

Types

type BlastParams

type BlastParams struct {
	// query sequence which can be an accession or
	// GI identifier or FASTA formatted
	Query string

	// database to query, defaults to `nt'
	DB string

	// the BLAST program to use, one of `blastn', `megablast', `blastp',
	// `blastx', `tblastn', or `tblastx'
	Program string

	// the server request type, one of `PUT' or `GET'
	CMD string

	// the response format, one of `HTML', `Text', `XML', `XML2',
	// `JSON2', or `Tabular'
	Format string

	// whether to use filtering, use `F' to disable, `T' or `L' to enable
	// and prepend `m' for mask at lookup (e.g., `mL')
	Filter string

	// a number greater than zero indicating the expected value
	Expect float64

	// reward for matching bases (BLASTN and megaBLAST), an integer greater
	// than zero
	Reward int

	// cost mismatched bases (BLASTN and megaBLAST), an integer less than zero
	Penalty int

	// gap existence and extension costs, space-separated positive integers
	// (e.g., '11 1')
	GapCost string

	// scoring matrix to use, one of `BLOSUM45', `BLOSUM50', `BLOSUM62' (default),
	// `BLOSUM80', `BLOSUM90', `PAM250', `PAM30' or `PAM70'
	ScoringMatrix string

	// number of database sequences to keep, an integer greater than zero
	HitListSize int

	// number of descriptions to print, an integer greater than zero
	NumberOfDescriptions int

	// number of alignments to print, an integer greater than zero
	Alignments int

	// whether or not to show NCBI GIs in report string (`T' or `F')
	NCBIGI string

	// Neighboring score for initial words, an integer greater than zero (BLASTP default is 11,
	// this value does not apply to BLASTN or MegaBLAST)
	Threshold int

	// size of word for initial matches, an integer greater than zero
	WordSize int

	// Composition based statistics algorithm to use, one of `0', `1', `2', or `3'
	CompBasedStats int

	// report formatting, one of `SearchInfo' (status check) or `Alignment'
	FormatObject string

	// response ID that can be used in a GET request to retrieve query results
	RID RID
}

BlastParams holds all possible API parameters and is used in func `Request' to construct the request URL

type RID

type RID string

RID is of base type string and represents a response ID a RID can be used to retrieve results via the API

func ParseResponse

func ParseResponse(resp *http.Response) (RID, error)

ParseResponse takes a `*http.Response' and parses and returns a `RID' (response ID) that can be used in an API GET request to retrieve the results of the initial query in `resp'

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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