diff --git a/api/cmd/ncbi.go b/api/cmd/ncbi.go index 6451386..e5134af 100644 --- a/api/cmd/ncbi.go +++ b/api/cmd/ncbi.go @@ -54,9 +54,7 @@ func init() { setGlobalFlag(ncbiCmd, &BapiClis) ncbiCmd.Flags().StringVarP(&ncbiClis.NcbiDB, "db", "d", "pubmed", "Db specifies the database to search") ncbiCmd.Flags().IntVarP(&ncbiClis.NcbiRetmax, "per-size", "m", 100, "Retmax specifies the number of records to be retrieved per request.") - //ncbiCmd.Flags().StringVarP(&ncbiClis.NcbiKeywords, "keywords", "w", "algorithm, tool, model, pipleline, method, database, workflow, dataset, bioinformatics, sequencing, http, github.com, gitlab.com, bitbucket.org", "Keywords to extracted from abstract.") ncbiCmd.Flags().IntVarP(&BapiClis.Thread, "thread", "t", 2, "Thread to process.") - //ncbiCmd.Flags().BoolVarP(&BapiClis.CallCor, "call-cor", "", false, "Wheather to calculate the corelated keywords, and return the sentence contains >=2 keywords.") ncbiCmd.Flags().StringVarP(&BapiClis.Email, "email", "e", "your_email@domain.com", "Email specifies the email address to be sent to the server (NCBI website is required).") ncbiCmd.Example = ` # query pubmed with 'B-ALL' diff --git a/api/fetch/ncbi.go b/api/fetch/ncbi.go index 0f9aa99..52d77ae 100644 --- a/api/fetch/ncbi.go +++ b/api/fetch/ncbi.go @@ -27,8 +27,11 @@ func Ncbi(BapiClis *types.BapiClisT, ncbiClis *types.NcbiClisT) { log.Fatalf("error: %v\n", err) } log.Infof("Available retrieve %d records.", s.Count) + if s.Count == 0 { + return + } from, end := cnet.SetQueryFromEnd(BapiClis.From, BapiClis.Size, s.Count) - log.Infof("Will retrieve %d records, from %d to %d.", end-from+1, from+1, end+1) + log.Infof("Will retrieve %d records, from %d to %d.", end-from, from+1, end) of := cio.NewOutStream(BapiClis.Outfn, "") defer of.Close() @@ -38,7 +41,7 @@ func Ncbi(BapiClis *types.BapiClisT, ncbiClis *types.NcbiClisT) { bn, n int64 ) if p.RetMax > end-from { - p.RetMax = end - from + 1 + p.RetMax = end - from } for p.RetStart = from; p.RetStart < end; p.RetStart += p.RetMax { log.Infof("Attempting to retrieve %d records: %d-%d with %d retries.", p.RetMax, p.RetStart+1, p.RetMax+p.RetStart, BapiClis.Retries) diff --git a/cmd/version.go b/cmd/version.go index ce9fe6a..1352ee7 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -1,3 +1,3 @@ package cmd -var version = "v0.2.4" +var version = "v0.2.4-1" diff --git a/go.mod b/go.mod index c346250..5e75be5 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/olekukonko/tablewriter v0.0.4 github.com/onsi/ginkgo v1.11.0 // indirect github.com/onsi/gomega v1.8.1 // indirect - github.com/openbiox/ligo v0.0.0-20200118071238-d342cb716c4e + github.com/openbiox/ligo v0.0.0-20200119135627-2571ec0d416e github.com/sirupsen/logrus v1.4.2 github.com/spf13/cobra v0.0.5 github.com/spf13/pflag v1.0.5 // indirect