Skip to content

Commit 945f310

Browse files
committed
update ncbi query
1 parent cc94a78 commit 945f310

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

api/cmd/ncbi.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ func init() {
5454
setGlobalFlag(ncbiCmd, &BapiClis)
5555
ncbiCmd.Flags().StringVarP(&ncbiClis.NcbiDB, "db", "d", "pubmed", "Db specifies the database to search")
5656
ncbiCmd.Flags().IntVarP(&ncbiClis.NcbiRetmax, "per-size", "m", 100, "Retmax specifies the number of records to be retrieved per request.")
57-
//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.")
5857
ncbiCmd.Flags().IntVarP(&BapiClis.Thread, "thread", "t", 2, "Thread to process.")
59-
//ncbiCmd.Flags().BoolVarP(&BapiClis.CallCor, "call-cor", "", false, "Wheather to calculate the corelated keywords, and return the sentence contains >=2 keywords.")
6058
ncbiCmd.Flags().StringVarP(&BapiClis.Email, "email", "e", "[email protected]", "Email specifies the email address to be sent to the server (NCBI website is required).")
6159

6260
ncbiCmd.Example = ` # query pubmed with 'B-ALL'

api/fetch/ncbi.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ func Ncbi(BapiClis *types.BapiClisT, ncbiClis *types.NcbiClisT) {
2727
log.Fatalf("error: %v\n", err)
2828
}
2929
log.Infof("Available retrieve %d records.", s.Count)
30+
if s.Count == 0 {
31+
return
32+
}
3033
from, end := cnet.SetQueryFromEnd(BapiClis.From, BapiClis.Size, s.Count)
31-
log.Infof("Will retrieve %d records, from %d to %d.", end-from+1, from+1, end+1)
34+
log.Infof("Will retrieve %d records, from %d to %d.", end-from, from+1, end)
3235

3336
of := cio.NewOutStream(BapiClis.Outfn, "")
3437
defer of.Close()
@@ -38,7 +41,7 @@ func Ncbi(BapiClis *types.BapiClisT, ncbiClis *types.NcbiClisT) {
3841
bn, n int64
3942
)
4043
if p.RetMax > end-from {
41-
p.RetMax = end - from + 1
44+
p.RetMax = end - from
4245
}
4346
for p.RetStart = from; p.RetStart < end; p.RetStart += p.RetMax {
4447
log.Infof("Attempting to retrieve %d records: %d-%d with %d retries.", p.RetMax, p.RetStart+1, p.RetMax+p.RetStart, BapiClis.Retries)

cmd/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
package cmd
22

3-
var version = "v0.2.4"
3+
var version = "v0.2.4-1"

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ require (
1717
github.com/olekukonko/tablewriter v0.0.4
1818
github.com/onsi/ginkgo v1.11.0 // indirect
1919
github.com/onsi/gomega v1.8.1 // indirect
20-
github.com/openbiox/ligo v0.0.0-20200118071238-d342cb716c4e
20+
github.com/openbiox/ligo v0.0.0-20200119135627-2571ec0d416e
2121
github.com/sirupsen/logrus v1.4.2
2222
github.com/spf13/cobra v0.0.5
2323
github.com/spf13/pflag v1.0.5 // indirect

0 commit comments

Comments
 (0)