Skip to content

Commit a943240

Browse files
committed
v0.3.2
1 parent 7b986b0 commit a943240

File tree

8 files changed

+50
-41
lines changed

8 files changed

+50
-41
lines changed

doc/docs/download.md

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ SeqKit is implemented in [Golang](https://golang.org/) programming language,
66

77
## Latest Version
88

9-
[SeqKit v0.3.1.1](https://github.com/shenwei356/seqkit/releases/tag/v0.3.1.1)
9+
[SeqKit v0.3.2](https://github.com/shenwei356/seqkit/releases/tag/v0.3.2)
1010

1111

1212
***64-bit versions are highly recommended.***
@@ -15,22 +15,22 @@ SeqKit is implemented in [Golang](https://golang.org/) programming language,
1515

1616

1717
- **Linux**
18-
- [seqkit_linux_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_linux_386.tar.gz)
19-
- [seqkit_linux_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_linux_amd64.tar.gz)
20-
- [seqkit_linux_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_linux_arm.tar.gz)
18+
- [seqkit_linux_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_linux_386.tar.gz)
19+
- [seqkit_linux_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_linux_amd64.tar.gz)
20+
- [seqkit_linux_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_linux_arm.tar.gz)
2121
- **Mac OS X**
22-
- [seqkit_darwin_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_darwin_386.tar.gz)
23-
- [seqkit_darwin_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_darwin_amd64.tar.gz)
22+
- [seqkit_darwin_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_darwin_386.tar.gz)
23+
- [seqkit_darwin_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_darwin_amd64.tar.gz)
2424
- **Windows**
25-
- [seqkit_windows_386.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_windows_386.exe.tar.gz)
26-
- [seqkit_windows_amd64.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_windows_amd64.exe.tar.gz)
25+
- [seqkit_windows_386.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_windows_386.exe.tar.gz)
26+
- [seqkit_windows_amd64.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_windows_amd64.exe.tar.gz)
2727
- **FreeBSD**
28-
- [seqkit_freebsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_freebsd_386.tar.gz)
29-
- [seqkit_freebsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_freebsd_amd64.tar.gz)
30-
- [seqkit_freebsd_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_freebsd_arm.tar.gz)
28+
- [seqkit_freebsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_freebsd_386.tar.gz)
29+
- [seqkit_freebsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_freebsd_amd64.tar.gz)
30+
- [seqkit_freebsd_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_freebsd_arm.tar.gz)
3131
- **OpenBSD**
32-
- [seqkit_openbsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_openbsd_386.tar.gz)
33-
- [seqkit_openbsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.1/seqkit_openbsd_amd64.tar.gz)
32+
- [seqkit_openbsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_openbsd_386.tar.gz)
33+
- [seqkit_openbsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.2/seqkit_openbsd_amd64.tar.gz)
3434

3535
### Mirror site for Chinese user
3636

@@ -78,6 +78,10 @@ For Go developer, just one command:
7878

7979
## Release History
8080

81+
- [SeqKit v0.3.2](https://github.com/shenwei356/seqkit/releases/tag/v0.3.2)
82+
- fix bug of `seqkit split`, error when target file is in a directory.
83+
- improve performance of `seqkit spliding` for big sequences, and output
84+
last part even if it's shorter than window sze.
8185
- [SeqKit v0.3.1.1](https://github.com/shenwei356/seqkit/releases/tag/v0.3.1.1)
8286
- compile with go1.7rc5, with ***higher performance and smaller size of binary file***
8387
- [SeqKit v0.3.1](https://github.com/shenwei356/seqkit/releases/tag/v0.3.1)

doc/docs/usage.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,11 @@ Examples
463463
ACGTac
464464
>seq_sliding:4-9
465465
TacgtN
466+
>seq_sliding:7-12
467+
gtNN
468+
>seq_sliding:10-15
469+
N
470+
466471

467472
2. Circular genome
468473

doc/site

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 035331a02e946c4a8574d2572ae48bc088e2a4c4
1+
Subproject commit b57dcfbb0fd4a90b2f19ee80d8fc36bd0f8f5690

seqkit/cmd/helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ import (
4343
)
4444

4545
// VERSION of seqkit
46-
const VERSION = "0.3.1.1"
46+
const VERSION = "0.3.2"
4747

4848
func checkError(err error) {
4949
if err != nil {

seqkit/cmd/replace.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ import (
2727
"runtime"
2828
"strconv"
2929

30-
"github.com/shenwei356/xopen"
3130
"github.com/shenwei356/bio/seq"
3231
"github.com/shenwei356/bio/seqio/fastx"
32+
"github.com/shenwei356/xopen"
3333
"github.com/spf13/cobra"
3434
)
3535

@@ -133,7 +133,7 @@ func init() {
133133
"replacement. supporting capture variables. "+
134134
" e.g. $1 represents the text of the first submatch. "+
135135
"ATTENTION: use SINGLE quote NOT double quotes in *nix OS or "+
136-
`use the \ escape character. record number is also supported by "{NR}"`)
136+
`use the \ escape character. Record number is also supported by "{NR}"`)
137137
// replaceCmd.Flags().BoolP("by-name", "n", false, "replace full name instead of just id")
138138
replaceCmd.Flags().BoolP("by-seq", "s", false, "replace seq")
139139
replaceCmd.Flags().BoolP("ignore-case", "i", false, "ignore case")

seqkit/cmd/sliding.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ import (
2626
"io"
2727
"runtime"
2828

29-
"github.com/shenwei356/xopen"
3029
"github.com/shenwei356/bio/seq"
3130
"github.com/shenwei356/bio/seqio/fastx"
3231
"github.com/shenwei356/util/byteutil"
32+
"github.com/shenwei356/xopen"
3333
"github.com/spf13/cobra"
3434
)
3535

@@ -69,7 +69,7 @@ var slidingCmd = &cobra.Command{
6969
checkError(err)
7070
defer outfh.Close()
7171

72-
var sequence []byte
72+
var sequence, s []byte
7373
var originalLen, l, end, e int
7474
var text []byte
7575
var b *bytes.Buffer
@@ -88,31 +88,31 @@ var slidingCmd = &cobra.Command{
8888

8989
originalLen = len(record.Seq.Seq)
9090
sequence = record.Seq.Seq
91-
if circular {
92-
sequence = append(sequence, sequence[0:window-1]...)
93-
}
94-
9591
l = len(sequence)
96-
end = l - window
92+
end = l - 1
9793
if end < 0 {
9894
end = 0
9995
}
10096
for i := 0; i <= end; i += step {
10197
e = i + window
102-
if e > originalLen {
98+
if e > originalLen && circular {
10399
e = e - originalLen
100+
s = sequence[i:]
101+
s = append(s, sequence[0:e]...)
102+
} else {
103+
s = sequence[i : i+window]
104104
}
105105
outfh.WriteString(fmt.Sprintf(">%s_sliding:%d-%d\n",
106106
record.ID, i+1, e))
107107

108108
// outfh.Write(byteutil.WrapByteSlice(sequence[i:i+window], lineWidth))
109109
if window <= pageSize {
110-
outfh.Write(byteutil.WrapByteSlice(sequence[i:i+window], lineWidth))
110+
outfh.Write(byteutil.WrapByteSlice(s, lineWidth))
111111
} else {
112112
if bufferedByteSliceWrapper == nil {
113113
bufferedByteSliceWrapper = byteutil.NewBufferedByteSliceWrapper2(1, window, lineWidth)
114114
}
115-
text, b = bufferedByteSliceWrapper.Wrap(sequence[i:i+window], lineWidth)
115+
text, b = bufferedByteSliceWrapper.Wrap(s, lineWidth)
116116
outfh.Write(text)
117117
outfh.Flush()
118118
bufferedByteSliceWrapper.Recycle(b)
@@ -130,5 +130,5 @@ func init() {
130130

131131
slidingCmd.Flags().IntP("step", "s", 0, "step size")
132132
slidingCmd.Flags().IntP("window", "W", 0, "window size")
133-
slidingCmd.Flags().BoolP("circular-genome", "C", false, "circular genome")
133+
slidingCmd.Flags().BoolP("circular-genome", "C", false, "circular genome.")
134134
}

seqkit/cmd/split.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -165,14 +165,14 @@ Examples:
165165
}
166166
records = append(records, record.Clone())
167167
if len(records) == size {
168-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, i, fileExt))
168+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), i, fileExt))
169169
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
170170
i++
171171
records = []*fastx.Record{}
172172
}
173173
}
174174
if len(records) > 0 {
175-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, i, fileExt))
175+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), i, fileExt))
176176
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
177177
}
178178

@@ -233,7 +233,7 @@ Examples:
233233

234234
n := 1
235235
if len(IDs) > 0 {
236-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, n, fileExt))
236+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), n, fileExt))
237237
if !dryRun {
238238
outfh, err = xopen.Wopen(outfile)
239239
checkError(err)
@@ -260,7 +260,7 @@ Examples:
260260
log.Infof("write %d sequences to file: %s\n", j, outfile)
261261
}
262262
n++
263-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, n, fileExt))
263+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), n, fileExt))
264264
if !dryRun {
265265
outfh.Close()
266266
outfh, err = xopen.Wopen(outfile)
@@ -323,14 +323,14 @@ Examples:
323323
}
324324
records = append(records, record)
325325
if len(records) == size {
326-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, i, fileExt))
326+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), i, fileExt))
327327
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
328328
i++
329329
records = []*fastx.Record{}
330330
}
331331
}
332332
if len(records) > 0 {
333-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, i, fileExt))
333+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), i, fileExt))
334334
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
335335
}
336336
return
@@ -402,7 +402,7 @@ Examples:
402402

403403
n := 1
404404
if len(IDs) > 0 {
405-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, n, fileExt))
405+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), n, fileExt))
406406
if !dryRun {
407407
outfh, err = xopen.Wopen(outfile)
408408
checkError(err)
@@ -429,7 +429,7 @@ Examples:
429429
log.Infof("write %d sequences to file: %s\n", j, outfile)
430430
}
431431
n++
432-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", fileName, n, fileExt))
432+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.part_%03d%s", filepath.Base(fileName), n, fileExt))
433433
if !dryRun {
434434
outfh.Close()
435435
outfh, err = xopen.Wopen(outfile)
@@ -488,7 +488,7 @@ Examples:
488488

489489
var outfile string
490490
for id, records := range recordsByID {
491-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.id_%s%s", fileName, id, fileExt))
491+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.id_%s%s", filepath.Base(fileName), id, fileExt))
492492
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
493493
}
494494
return
@@ -566,7 +566,7 @@ Examples:
566566
var record *fastx.Record
567567
for id, ids := range idsMap {
568568

569-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.id_%s%s", fileName, id, fileExt))
569+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.id_%s%s", filepath.Base(fileName), id, fileExt))
570570
if !dryRun {
571571
outfh, err = xopen.Wopen(outfile)
572572
checkError(err)
@@ -664,7 +664,7 @@ Examples:
664664

665665
var outfile string
666666
for subseq, records := range recordsBySeqs {
667-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.region_%d:%d_%s%s", fileName, start, end, subseq, fileExt))
667+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.region_%d:%d_%s%s", filepath.Base(fileName), start, end, subseq, fileExt))
668668
writeSeqs(records, outfile, lineWidth, quiet, dryRun)
669669
}
670670
return
@@ -753,7 +753,7 @@ Examples:
753753
var outfile string
754754
var record *fastx.Record
755755
for subseq, chrs := range region2name {
756-
outfile = filepath.Join(outdir, fmt.Sprintf("%s.region_%d:%d_%s%s", fileName, start, end, subseq, fileExt))
756+
outfile = filepath.Join(outdir, fmt.Sprintf("%s.region_%d:%d_%s%s", filepath.Base(fileName), start, end, subseq, fileExt))
757757
if !dryRun {
758758
outfh, err = xopen.Wopen(outfile)
759759
checkError(err)

seqkit/cmd/stat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ import (
2525
"io"
2626
"runtime"
2727

28-
"github.com/shenwei356/xopen"
2928
"github.com/dustin/go-humanize"
3029
"github.com/shenwei356/bio/seq"
3130
"github.com/shenwei356/bio/seqio/fastx"
3231
"github.com/shenwei356/util/math"
32+
"github.com/shenwei356/xopen"
3333
"github.com/spf13/cobra"
3434
"github.com/tatsushid/go-prettytable"
3535
)

0 commit comments

Comments
 (0)