bíogo/ncbi
bíogo/ncbi: interfaces to NCBI services for the Go language - Published in JOSS (2017)
Science Score: 95.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: biorxiv.org, ncbi.nlm.nih.gov -
✓Committers with academic emails
1 of 4 committers (25.0%) from academic institutions -
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Repository
bíogo ncbi utilities repository
Basic Info
- Host: GitHub
- Owner: biogo
- License: bsd-3-clause
- Language: Go
- Default Branch: master
- Size: 393 KB
Statistics
- Stars: 20
- Watchers: 5
- Forks: 10
- Open Issues: 2
- Releases: 0
Metadata Files
README.md

NCBI
Installation
The NCBI package requires a functioning Go compiler installation.
$ go get github.com/biogo/ncbi/...
Overview
ncbi provides API interfaces to NCBI services.
Citing
If you use bíogo/ncbi, please cite Kortschak and Adelson "bíogo/ncbi: interfaces to NCBI services for the Go language", doi:10.21105/joss.00234, and Kortschak and Adelson "bíogo: a simple high-performance bioinformatics toolkit for the Go language", doi:10.1101/005033.
Example usage
Entrez
This is a simple illustration of using the Entrez Utility Programs to retrieve a large set of sequences to a file. The complete code is here.
``` package main
import ( "bytes" "flag" "io" "log" "os"
"github.com/biogo/ncbi"
"github.com/biogo/ncbi/entrez"
)
const ( tool = "entrez.example" )
var ( clQuery = flag.String("query", "", "query specifies the search query for record retrieval (required).") db = flag.String("db", "protein", "db specifies the database to search") rettype = flag.String("rettype", "fasta", "rettype specifies the format of the returned data.") retmax = flag.Int("retmax", 500, "retmax specifies the number of records to be retrieved per request.") out = flag.String("out", "", "out specifies destination of the returned data (default to stdout).") email = flag.String("email", "", "email specifies the email address to be sent to the server (required).") retries = flag.Int("retry", 5, "retry specifies the number of attempts to retrieve the data.") help = flag.Bool("help", false, "help prints this message.") )
func main() { ncbi.SetTimeout(0)
flag.Parse()
if *help {
flag.Usage()
os.Exit(0)
}
if *email == "" || *clQuery == "" {
flag.Usage()
os.Exit(1)
}
h := entrez.History{}
s, err := entrez.DoSearch(*db, *clQuery, nil, &h, tool, *email)
if err != nil {
log.Printf("error: %v\n", err)
os.Exit(1)
}
log.Printf("will retrieve %d records.\n", s.Count)
var of *os.File
if *out == "" {
of = os.Stdout
} else {
of, err = os.Create(*out)
if err != nil {
log.Printf("error: %v\n", err)
os.Exit(1)
}
defer of.Close()
}
var (
buf = &bytes.Buffer{}
p = &entrez.Parameters{RetMax: *retmax, RetType: *rettype, RetMode: "text"}
bn, n int64
)
for p.RetStart = 0; p.RetStart < s.Count; p.RetStart += p.RetMax {
log.Printf("attempting to retrieve %d records starting from %d with %d retries.\n", p.RetMax, p.RetStart, *retries)
var t int
for t = 0; t < *retries; t++ {
buf.Reset()
var (
r io.ReadCloser
_bn int64
)
r, err = entrez.Fetch(*db, p, tool, *email, &h)
if err != nil {
if r != nil {
r.Close()
}
log.Printf("failed to retrieve on attempt %d... error: %v ... retrying.\n", t, err)
continue
}
_bn, err = io.Copy(buf, r)
bn += _bn
r.Close()
if err == nil {
break
}
log.Printf("failed to buffer on attempt %d... error: %v ... retrying.\n", t, err)
}
if err != nil {
os.Exit(1)
}
log.Printf("retrieved records with %d retries... writing out.\n", t)
_n, err := io.Copy(of, buf)
n += _n
if err != nil {
log.Printf("Error: %v\n", err)
os.Exit(1)
}
}
if bn != n {
log.Printf("writethrough mismatch: %d != %d\n", bn, n)
}
} ```
BLAST
The following example provides a simple function used to perform a BLAST search from within a larger program. A complete example is available here.
``` // tool is required by the BLAST server. const tool = "blast.example"
// BLAST submits a query to the BLAST server, waits for the server's estimated time of // execution and retrieves the search status. If the search is ready the results are then // retrieved and returned. If errors are returned during data retrieval from the server, // retrieval is retried with up to retry attempts; all server requests honour the request // frequency policy specified in the BLAST usage guidelines. func BLAST(query string, retry int, pp blast.PutParameters, gp *blast.GetParameters, email string) (blast.Output, error) { // Put the query request to the BLAST server. r, err := blast.Put(query, pp, tool, email) if err != nil { return nil, err }
var o *blast.Output
for k := 0; k < retry; k++ {
// Wait for RTOE to elapse and get search status.
var s *blast.SearchInfo
s, err = r.SearchInfo(tool, email)
if err != nil {
return nil, err
}
// Output search status.
fmt.Println(s)
switch s.Status {
case "WAITING":
continue
case "FAILED":
return nil, fmt.Errorf("search: %s failed", r)
case "UNKNOWN":
return nil, fmt.Errorf("search: %s expired", r)
case "READY":
if !s.HaveHits {
return nil, fmt.Errorf("search: %s no hits", r)
}
default:
return nil, errors.New("unknown error")
}
// We have hits, so get the BLAST output.
o, err = r.GetOutput(gp, tool, email)
if err == nil {
return o, err
}
}
return nil, fmt.Errorf("%s exceeded retries", r)
} ```
Getting help
Help or similar requests are preferred on the biogo-user Google Group.
https://groups.google.com/forum/#!forum/biogo-user
Contributing
If you find any bugs, feel free to file an issue on the github issue tracker. Pull requests are welcome, though if they involve changes to API or addition of features, please first open a discussion at the biogo-dev Google Group.
https://groups.google.com/forum/#!forum/biogo-dev
Library Structure and Coding Style
The coding style should be aligned with normal Go idioms as represented in the Go core libraries.
Copyright and License
Copyright ©2011-2013 The bíogo Authors except where otherwise noted. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
The bíogo logo is derived from Bitstream Charter, Copyright ©1989-1992 Bitstream Inc., Cambridge, MA.
BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
Owner
- Name: bíogo
- Login: biogo
- Kind: organization
- Repositories: 14
- Profile: https://github.com/biogo
bíogo is a bioinformatics library collection for Go
JOSS Publication
bíogo/ncbi: interfaces to NCBI services for the Go language
Authors
Tags
bioinformatics toolkit golangCodeMeta (codemeta.json)
{
"@context": "https://raw.githubusercontent.com/mbjones/codemeta/master/codemeta.jsonld",
"@type": "Code",
"author": [
{
"@id": "http://orcid.org/0000-0001-8295-2301",
"@type": "Person",
"email": "dan.kortschak@adelaide.edu.au",
"name": "R Daniel Kortschak",
"affiliation": "School of Biological Sciences, The University of Adelaide"
},
{
"@id": "http://orcid.org/0000-0003-2404-5636",
"@type": "Person",
"email": "david.adelson@adelaide.edu.au",
"name": "David L Adelson",
"affiliation": "School of Biological Sciences, The University of Adelaide"
}
],
"identifier": "",
"codeRepository": "https://github.com/biogo/ncbi",
"datePublished": "2017-03-03",
"dateModified": "2017-03-03",
"dateCreated": "2017-03-03",
"description": "interfaces to NCBI services for the Go language",
"keywords": "bioinformatics, NCBI, EUtilities, BLAST, golang",
"license": "BSD-3 like",
"title": "bíogo/ncbi",
"version": "v1.0.0"
}
GitHub Events
Total
- Watch event: 2
Last Year
- Watch event: 2
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| kortschak | d****k@a****u | 108 |
| Josh Bleecher Snyder | j****n@g****m | 2 |
| Harry Scells | h****s@g****m | 2 |
| daniel-anavaino | d****l@a****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 4
- Total pull requests: 14
- Average time to close issues: 2 days
- Average time to close pull requests: 2 days
- Total issue authors: 4
- Total pull request authors: 6
- Average comments per issue: 4.0
- Average comments per pull request: 1.57
- Merged pull requests: 12
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- hscells (1)
- corburn (1)
- elucify (1)
- comatrion (1)
Pull Request Authors
- kortschak (8)
- hscells (2)
- daniel-anavaino (1)
- corburn (1)
- arfon (1)
- josharian (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
- Total downloads: unknown
-
Total dependent packages: 10
(may contain duplicates) -
Total dependent repositories: 5
(may contain duplicates) - Total versions: 6
proxy.golang.org: github.com/biogo/ncbi
Package ncbi provides support for interaction with the NCBI services, Entrez and Blast. Please check the relevant usage policy when using these services. Note that the Blast and Entrez server requests are subject to frequency limits. Required parameters are specified by name in the function call. The following two parameters should be included in all requests.
- Homepage: https://github.com/biogo/ncbi
- Documentation: https://pkg.go.dev/github.com/biogo/ncbi#section-documentation
- License: BSD-3-Clause
-
Latest release: v1.0.2
published about 7 years ago
Rankings
proxy.golang.org: github.com/BioGo/ncbi
Package ncbi provides support for interaction with the NCBI services, Entrez and Blast. Please check the relevant usage policy when using these services. Note that the Blast and Entrez server requests are subject to frequency limits. Required parameters are specified by name in the function call. The following two parameters should be included in all requests.
- Homepage: https://github.com/BioGo/ncbi
- Documentation: https://pkg.go.dev/github.com/BioGo/ncbi#section-documentation
- License: BSD-3-Clause
-
Latest release: v1.0.2
published about 7 years ago
Rankings
Dependencies
- github.com/ajstarks/svgo v0.0.0-20181006003313-6ce6a3bcf6cd
- github.com/go-gl/gl v0.0.0-20181026044259-55b76b7df9d2
- github.com/go-gl/glfw v0.0.0-20181213070059-819e8ce5125f
- github.com/kortschak/utter v0.0.0-20181020070522-d57bf3064fe6
- github.com/kr/pretty v0.1.0
- github.com/kr/pty v1.1.3
- github.com/llgcode/draw2d v0.0.0-20180825133448-f52c8a71aff0
- golang.org/x/exp v0.0.0-20190123073158-f1c91bc264ca
- golang.org/x/image v0.0.0-20190118043309-183bebdce1b2
- golang.org/x/net v0.0.0-20190119204137-ed066c81e75e
- golang.org/x/tools v0.0.0-20190124004107-78ee07aa9465
- gonum.org/v1/gonum v0.0.0-20190123113241-dd4cc715c58a
- gonum.org/v1/plot v0.0.0-20190124062938-5260e111b590
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
- github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af
- github.com/ajstarks/svgo v0.0.0-20181006003313-6ce6a3bcf6cd
- github.com/go-gl/gl v0.0.0-20180407155706-68e253793080
- github.com/go-gl/gl v0.0.0-20181026044259-55b76b7df9d2
- github.com/go-gl/glfw v0.0.0-20180426074136-46a8d530c326
- github.com/go-gl/glfw v0.0.0-20181213070059-819e8ce5125f
- github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
- github.com/jung-kurt/gofpdf v1.0.0
- github.com/kortschak/utter v0.0.0-20181020070522-d57bf3064fe6
- github.com/kr/pretty v0.1.0
- github.com/kr/pty v1.1.1
- github.com/kr/pty v1.1.3
- github.com/kr/text v0.1.0
- github.com/llgcode/draw2d v0.0.0-20180817132918-587a55234ca2
- github.com/llgcode/draw2d v0.0.0-20180825133448-f52c8a71aff0
- github.com/llgcode/ps v0.0.0-20150911083025-f1443b32eedb
- golang.org/x/exp v0.0.0-20180321215751-8460e604b9de
- golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f
- golang.org/x/exp v0.0.0-20190123073158-f1c91bc264ca
- golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81
- golang.org/x/image v0.0.0-20190118043309-183bebdce1b2
- golang.org/x/net v0.0.0-20190119204137-ed066c81e75e
- golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b
- golang.org/x/tools v0.0.0-20190124004107-78ee07aa9465
- gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4
- gonum.org/v1/gonum v0.0.0-20190123113241-dd4cc715c58a
- gonum.org/v1/plot v0.0.0-20190123092404-18bcd5ccd1fc
- gonum.org/v1/plot v0.0.0-20190124062938-5260e111b590
- gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127
- rsc.io/pdf v0.1.1
