Skip to content

Commit

Permalink
v0.3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
shenwei356 committed Nov 3, 2016
1 parent 3cd6bb1 commit 4210208
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -93,7 +93,7 @@ Categories |Features |seqkit |fasta_utilities|fastx_tool

Go to [Download Page](http://bioinf.shenwei.me/seqkit/download) for more download options and changelogs.

`seqkit` is implemented in [Golang](https://golang.org/) programming language,
`SeqKit` is implemented in [Go](https://golang.org/) programming language,
executable binary files **for most popular operating systems** are freely available
in [release](https://github.com/shenwei356/seqkit/releases) page.

Expand Down
60 changes: 32 additions & 28 deletions doc/docs/download.md
@@ -1,49 +1,49 @@
# Download

SeqKit is implemented in [Golang](https://golang.org/) programming language,
SeqKit is implemented in [Go](https://golang.org/) programming language,
executable binary files **for most popular operating systems** are freely available
in [release](https://github.com/shenwei356/seqkit/releases) page.

## Latest Version

[SeqKit v0.3.5](https://github.com/shenwei356/seqkit/releases/tag/v0.3.5)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/seqkit/v0.3.5/total.svg)](https://github.com/shenwei356/seqkit/releases/download/v0.3.4.1)
[SeqKit v0.3.6](https://github.com/shenwei356/seqkit/releases/tag/v0.3.6)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/seqkit/v0.3.6/total.svg)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6)

- fig bug of `seqkit grep`: flag `-i` (`--ignore-case`) did not work when not using regular expression
- add new feature for `seqkit grep`: new flag `-R` (`--region`) for specifing sequence region for searching.

***64-bit versions are highly recommended.***

### Links

- **Linux**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_386.tar.gz)
[seqkit_linux_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_amd64.tar.gz)
[seqkit_linux_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_arm.tar.gz)
[seqkit_linux_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_linux_arm.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_386.tar.gz)
[seqkit_linux_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_amd64.tar.gz)
[seqkit_linux_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_linux_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_arm.tar.gz)
[seqkit_linux_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_linux_arm.tar.gz)
- **Mac OS X**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_darwin_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_darwin_386.tar.gz)
[seqkit_darwin_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_darwin_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_darwin_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_darwin_amd64.tar.gz)
[seqkit_darwin_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_darwin_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_darwin_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_darwin_386.tar.gz)
[seqkit_darwin_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_darwin_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_darwin_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_darwin_amd64.tar.gz)
[seqkit_darwin_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_darwin_amd64.tar.gz)
- **Windows**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_windows_386.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_windows_386.exe.tar.gz)
[seqkit_windows_386.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_windows_386.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_windows_amd64.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_windows_amd64.exe.tar.gz)
[seqkit_windows_amd64.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_windows_amd64.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_windows_386.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_windows_386.exe.tar.gz)
[seqkit_windows_386.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_windows_386.exe.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_windows_amd64.exe.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_windows_amd64.exe.tar.gz)
[seqkit_windows_amd64.exe.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_windows_amd64.exe.tar.gz)
- **FreeBSD**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_386.tar.gz)
[seqkit_freebsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_amd64.tar.gz)
[seqkit_freebsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_arm.tar.gz)
[seqkit_freebsd_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_freebsd_arm.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_386.tar.gz)
[seqkit_freebsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_amd64.tar.gz)
[seqkit_freebsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_freebsd_arm.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_arm.tar.gz)
[seqkit_freebsd_arm.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_freebsd_arm.tar.gz)
- **OpenBSD**
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_openbsd_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_openbsd_386.tar.gz)
[seqkit_openbsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_openbsd_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_openbsd_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_openbsd_amd64.tar.gz)
[seqkit_openbsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.5/seqkit_openbsd_amd64.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_openbsd_386.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_openbsd_386.tar.gz)
[seqkit_openbsd_386.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_openbsd_386.tar.gz)
- [![Github Releases (by Asset)](https://img.shields.io/github/downloads/shenwei356/seqkit/latest/seqkit_openbsd_amd64.tar.gz.svg?maxAge=3600)](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_openbsd_amd64.tar.gz)
[seqkit_openbsd_amd64.tar.gz](https://github.com/shenwei356/seqkit/releases/download/v0.3.6/seqkit_openbsd_amd64.tar.gz)

### Mirror site for Chinese users

Expand Down Expand Up @@ -90,6 +90,10 @@ For Go developer, just one command:
go get -u github.com/shenwei356/seqkit/seqkit

## Release History

- [SeqKit v0.3.5](https://github.com/shenwei356/seqkit/releases/tag/v0.3.5)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/seqkit/v0.3.5/total.svg)](https://github.com/shenwei356/seqkit/releases/download/v0.3.5)
- fig bug of `seqkit grep`: flag `-i` (`--ignore-case`) did not work when not using regular expression
- [SeqKit v0.3.4.1](https://github.com/shenwei356/seqkit/releases/tag/v0.3.4.1)
[![Github Releases (by Release)](https://img.shields.io/github/downloads/shenwei356/seqkit/v0.3.4.1/total.svg)](https://github.com/shenwei356/seqkit/releases/download/v0.3.4.1)
- improve performance of reading (~10%) and writing (100%) gzip-compressed file
Expand Down
24 changes: 22 additions & 2 deletions doc/docs/usage.md
Expand Up @@ -99,7 +99,7 @@ Usage
```
SeqKit -- a cross-platform and ultrafast toolkit for FASTA/Q file manipulation
Version: 0.3.4.1
Version: 0.3.6
Author: Wei Shen <shenwei356@gmail.com>
Expand Down Expand Up @@ -635,6 +635,22 @@ Usage
```
search sequences by pattern(s) of name or sequence motifs
You can specify the sequence region for searching with flag -R/--region.
The definition of region is 1-based and with some custom design.
Examples:
1-based index 1 2 3 4 5 6 7 8 9 10
negative index 0-9-8-7-6-5-4-3-2-1
seq A C G T N a c g t n
1:1 A
2:4 C G T
-4:-2 c g t
-4:-1 c g t n
-1:-1 n
2:-2 C G T N a c g t
1:-1 A C G T N a c g t n
Usage:
seqkit grep [flags]
Expand All @@ -645,8 +661,9 @@ Flags:
--delete-matched delete matched pattern to speedup
-i, --ignore-case ignore case
-v, --invert-match invert the sense of matching, to select non-matching records
-p, --pattern value search pattern (multiple values supported) (default [])
-p, --pattern stringSlice search pattern (multiple values supported)
-f, --pattern-file string pattern file
-R, --region string specify sequence region for searching. e.g 1:12 for first 12 bases, -12:-1 for last 12 bases
-r, --use-regexp patterns are regular expression
```
Expand Down Expand Up @@ -694,6 +711,9 @@ Examples

$ zcat hairpin.fa.gz | seqkit grep -s -r -i -p TT[CG]AA

1. Specify sequence regions for searching. e.g., leading 30 bases.

$ seqkit grep -s -R 1:30 -i -r -p GCTGG

## locate

Expand Down
2 changes: 1 addition & 1 deletion doc/site
Submodule site updated from 5f3eec to 0d536b
45 changes: 42 additions & 3 deletions seqkit/cmd/grep.go
Expand Up @@ -25,6 +25,7 @@ import (
"io"
"regexp"
"runtime"
"strconv"
"strings"

"github.com/shenwei356/bio/seq"
Expand All @@ -38,9 +39,14 @@ import (
var grepCmd = &cobra.Command{
Use: "grep",
Short: "search sequences by pattern(s) of name or sequence motifs",
Long: `search sequences by pattern(s) of name or sequence motifs
Long: fmt.Sprintf(`search sequences by pattern(s) of name or sequence motifs
`,
You can specify the sequence region for searching with flag -R/--region.
The definition of region is 1-based and with some custom design.
Examples:
%s
`, regionExample),
Run: func(cmd *cobra.Command, args []string) {
config := getConfigs(cmd)
alphabet := config.Alphabet
Expand All @@ -60,6 +66,7 @@ var grepCmd = &cobra.Command{
byName := getFlagBool(cmd, "by-name")
ignoreCase := getFlagBool(cmd, "ignore-case")
degenerate := getFlagBool(cmd, "degenerate")
region := getFlagString(cmd, "region")

if len(pattern) == 0 && patternFile == "" {
checkError(fmt.Errorf("one of flags -p (--pattern) and -f (--pattern-file) needed"))
Expand All @@ -68,6 +75,31 @@ var grepCmd = &cobra.Command{
checkError(fmt.Errorf("could not give both flags -d (--degenerat) and -r (--use-regexp)"))
}

var start, end int
var err error
var limitRegion bool
if region != "" {
limitRegion = true
if !bySeq {
log.Infof("when flag -R (--region) given, flag -s (--by-seq) is automatically on")
bySeq = true
}
if !reRegion.MatchString(region) {
checkError(fmt.Errorf(`invalid region: %s. type "seqkit grep -h" for more examples`, region))
}
r := strings.Split(region, ":")
start, err = strconv.Atoi(r[0])
checkError(err)
end, err = strconv.Atoi(r[1])
checkError(err)
if start == 0 || end == 0 {
checkError(fmt.Errorf("both start and end should not be 0"))
}
if start < 0 && end > 0 {
checkError(fmt.Errorf("when start < 0, end should not > 0"))
}
}

files := getFileList(args)

// prepare pattern
Expand Down Expand Up @@ -156,7 +188,11 @@ var grepCmd = &cobra.Command{
if byName {
subject = record.Name
} else if bySeq {
subject = record.Seq.Seq
if limitRegion {
subject = record.Seq.SubSeq(start, end).Seq
} else {
subject = record.Seq.Seq
}
} else {
subject = record.ID
}
Expand Down Expand Up @@ -210,4 +246,7 @@ func init() {
grepCmd.Flags().BoolP("by-seq", "s", false, "match by seq")
grepCmd.Flags().BoolP("ignore-case", "i", false, "ignore case")
grepCmd.Flags().BoolP("degenerate", "d", false, "pattern/motif contains degenerate base")
grepCmd.Flags().StringP("region", "R", "", "specify sequence region for searching. "+
"e.g 1:12 for first 12 bases, -12:-1 for last 12 bases")

}
2 changes: 1 addition & 1 deletion seqkit/cmd/helper.go
Expand Up @@ -43,7 +43,7 @@ import (
)

// VERSION of seqkit
const VERSION = "0.3.5"
const VERSION = "0.3.6"

func checkError(err error) {
if err != nil {
Expand Down

0 comments on commit 4210208

Please sign in to comment.