Skip to content

Commit

Permalink
Merge pull request #92 from mitre/fix-batch
Browse files Browse the repository at this point in the history
Correct comparison of location prefix
  • Loading branch information
mattrbianchi authored May 3, 2018
2 parents 928617b + 26823f8 commit 850cd94
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions fusera.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ func NewFusera(ctx context.Context, opt *Options) (*Fusera, error) {
if strings.HasPrefix(opt.Loc, "s3") {
batch = opt.AwsBatch
}
if strings.HasPrefix(opt.Loc, "gcp") {
if strings.HasPrefix(opt.Loc, "gs") {
batch = opt.GcpBatch
}
accessions, err := nr.ResolveNames(opt.ApiEndpoint, opt.Loc, opt.Ngc, batch, opt.Acc)
if err != nil {
fmt.Println(err.Error())
// return nil, err
return nil, err
}
fs := &Fusera{
accs: accessions,
Expand Down
6 changes: 3 additions & 3 deletions nr/nr.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ func makeBatchRequest(url string, writer *multipart.Writer, body io.Reader) ([]P
// accs: the accessions to resolve names for.
func ResolveNames(url, loc string, ngc []byte, batch int, accs map[string]bool) (map[string]*Accession, error) {
if accs == nil {
return nil, errors.New("must provide accs to ResolveNames")
return nil, errors.New("must provide accessions to pass to Name Resolver API")
}
if loc == "" {
return nil, errors.New("must provide a location to ResolveNames")
return nil, errors.New("must provide a location to pass to Name Resolver API")
}
if batch < 1 {
return nil, errors.Errorf("must provide a batch number greater than 0: %d", batch)
return nil, errors.Errorf("must provide a valid batch number, gave: %d", batch)
}
if url == "" {
url = "https://www.ncbi.nlm.nih.gov/Traces/sdl/1/retrieve"
Expand Down

0 comments on commit 850cd94

Please sign in to comment.