├── .gitignore
├── seqio
├── organism.go
├── utils.go
├── testdata
│ └── NC_001422_part.fasta
├── dictionary_test.go
├── strings.go
├── contig.go
├── filetype_test.go
├── strings_test.go
├── filetype.go
├── dictionary.go
├── reference.go
├── writer.go
├── writer_test.go
├── fasta_test.go
├── scanner.go
├── date_test.go
├── origin_test.go
├── fasta.go
├── format_conversion_test.go
├── origin.go
├── genbank_subparsers_test.go
├── scanner_test.go
└── date.go
├── gts_test.go
├── version.go
├── cmd
├── terminal.go
├── gts
│ ├── hash.go
│ ├── main.go
│ ├── length.go
│ ├── reverse.go
│ ├── complement.go
│ ├── repair.go
│ ├── clear.go
│ ├── join.go
│ ├── rotate.go
│ ├── sort.go
│ ├── delete.go
│ ├── define.go
│ ├── annotate.go
│ ├── cache.go
│ └── select.go
└── cache
│ ├── header_test.go
│ ├── header.go
│ └── file.go
├── man
├── gts-seqin.7.ronn
├── gts-seqout.7.ronn
├── gts-cache-purge.1.ronn
├── gts-seqin.7
├── gts-seqout.7
├── gts-cache-path.1.ronn
├── gts-cache-list.1.ronn
├── gts-cache-purge.1
├── gts-cache-path.1
├── gts-cache-list.1
├── index.txt
├── gts-cache.1.ronn
├── gts-length.1.ronn
├── gts-cache.1
├── gts-length.1
├── gts-summary.1.ronn
├── gts-modifier.7.ronn
├── gts-selector.7.ronn
├── gts-summary.1
├── gts-reverse.1.ronn
├── gts-clear.1.ronn
├── gts-sort.1.ronn
├── gts-complement.1.ronn
├── gts-locator.7.ronn
├── gts-clear.1
├── gts-reverse.1
├── gts-repair.1.ronn
├── gts-sort.1
├── gts-join.1.ronn
├── gts-complement.1
├── gts-define.1.ronn
├── gts-repair.1
├── gts-annotate.1.ronn
├── gts-selector.7
├── gts-modifier.7
├── gts-join.1
├── gts-define.1
├── gts-annotate.1
├── gts-locator.7
├── gts-split.1.ronn
├── gts-rotate.1.ronn
├── gts-pick.1.ronn
├── gts-split.1
├── gts.1.ronn
├── gts-delete.1.ronn
├── gts-rotate.1
├── gts-pick.1
├── gts-extract.1.ronn
├── gts-cache.7.ronn
├── gts-select.1.ronn
├── gts-search.1.ronn
├── gts-infix.1.ronn
├── gts-cache.7
├── gts.1
├── gts-delete.1
├── gts-query.1.ronn
├── gts-extract.1
├── gts-infix.1
└── gts-search.1
├── docs
└── index.html
├── go.mod
├── conda
├── build.sh
└── meta.yaml
├── props_test.go
├── utils.go
├── molecule.go
├── molecule_test.go
├── LICENSE
├── modifier_test.go
├── topology.go
├── topology_test.go
├── utils_test.go
├── go.sum
├── props.go
├── nucleotide_test.go
├── locator_test.go
├── .goreleaser.yml
├── locator.go
├── internal
└── testutils
│ └── testutils.go
└── nucleotide.go
/.gitignore:
--------------------------------------------------------------------------------
1 | /dist/
2 | /man/*.html
3 | .DS_Store
4 |
--------------------------------------------------------------------------------
/seqio/organism.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | // Organism represents an organism of a record.
4 | type Organism struct {
5 | Species string
6 | Name string
7 | Taxon []string
8 | }
9 |
--------------------------------------------------------------------------------
/seqio/utils.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | func dig(err error) error {
4 | if v, ok := err.(interface{ Unwrap() error }); ok {
5 | return dig(v.Unwrap())
6 | }
7 | return err
8 | }
9 |
--------------------------------------------------------------------------------
/gts_test.go:
--------------------------------------------------------------------------------
1 | package gts
2 |
3 | import "encoding/json"
4 |
5 | func jsonify(v interface{}) string {
6 | p, err := json.Marshal(v)
7 | if err != nil {
8 | panic(err)
9 | }
10 | return string(p)
11 | }
12 |
--------------------------------------------------------------------------------
/version.go:
--------------------------------------------------------------------------------
1 | package gts
2 |
3 | import "github.com/go-gts/flags"
4 |
5 | // Version represents the GTS software version.
6 | var Version = flags.Version{
7 | Major: 0,
8 | Minor: 28,
9 | Patch: 1,
10 | }
11 |
--------------------------------------------------------------------------------
/seqio/testdata/NC_001422_part.fasta:
--------------------------------------------------------------------------------
1 | >NC_001422.1:2380-2512 Coliphage phi-X174, complete genome
2 | CTTAGGAGTTTAATCATGTTTCAGACTTTTATTTCTCGCCATAATTCAAACTTTTTTTCTGATAAGCTGG
3 | TTCTCACTTCTGTTACTCCAGCTTCTTCGGCACCTGTTTTACAGACACCTAAAGCTACATCGT
4 |
--------------------------------------------------------------------------------
/cmd/terminal.go:
--------------------------------------------------------------------------------
1 | package cmd
2 |
3 | import "github.com/mattn/go-isatty"
4 |
5 | // IsTerminal tests if the file descriptor is a terminal.
6 | func IsTerminal(fd uintptr) bool {
7 | return isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd)
8 | }
9 |
--------------------------------------------------------------------------------
/cmd/gts/hash.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "crypto/sha1"
5 | "encoding/hex"
6 | "hash"
7 | )
8 |
9 | func newHash() hash.Hash {
10 | return sha1.New()
11 | }
12 |
13 | func encodeToString(p []byte) string {
14 | return hex.EncodeToString(p)
15 | }
16 |
--------------------------------------------------------------------------------
/cmd/gts/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "os"
5 |
6 | "github.com/go-gts/flags"
7 | "github.com/go-gts/gts"
8 | )
9 |
10 | func main() {
11 | name, desc := "gts", "the genome transformation subprograms command line tool"
12 | os.Exit(flags.Run(name, desc, gts.Version, flags.Compile()))
13 | }
14 |
--------------------------------------------------------------------------------
/man/gts-seqin.7.ronn:
--------------------------------------------------------------------------------
1 | # gts-seqin(7) -- input sequence formats supported in GTS.
2 |
3 | ## SYNOPSIS
4 |
5 | * `GenBank`
6 | * `FASTA`
7 |
8 | ## DESCRIPTION
9 |
10 | GTS implements parsers for a number of sequence formats, and have plans for
11 | implementing more commonly used sequence formats.
12 |
13 | ## SEE ALSO
14 |
15 | gts(1), gts-seqout(7)
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | The page has been moved to gts.1.html
10 |
11 |
--------------------------------------------------------------------------------
/man/gts-seqout.7.ronn:
--------------------------------------------------------------------------------
1 | # gts-seqout(7) -- output sequence formats supported in GTS.
2 |
3 | ## SYNOPSIS
4 |
5 | * `GenBank`
6 | * `FASTA`
7 |
8 | ## DESCRIPTION
9 |
10 | GTS implements parsers for a number of sequence formats, and have plans for
11 | implementing more commonly used sequence formats.
12 |
13 | ## SEE ALSO
14 |
15 | gts(1), gts-seqin(7)
--------------------------------------------------------------------------------
/cmd/cache/header_test.go:
--------------------------------------------------------------------------------
1 | package cache
2 |
3 | import (
4 | "bytes"
5 | "crypto/sha1"
6 | "testing"
7 | )
8 |
9 | func TestHeaderFail(t *testing.T) {
10 | h := sha1.New()
11 | b := &bytes.Buffer{}
12 | b.Write(h.Sum(nil))
13 | if _, err := ReadHeader(b, h.Size()); err == nil {
14 | t.Fatal("expected error in ReadHeader for insufficient read")
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/seqio/dictionary_test.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/go-gts/gts/internal/testutils"
7 | )
8 |
9 | func TestPairList(t *testing.T) {
10 | d := Dictionary{}
11 | d.Set("foo", "foo")
12 | testutils.Equals(t, d.Get("foo"), []string{"foo"})
13 | d.Set("foo", "bar")
14 | testutils.Equals(t, d.Get("foo"), []string{"bar"})
15 | d.Del("foo")
16 | testutils.Equals(t, d.Get("foo"), []string{})
17 | }
18 |
--------------------------------------------------------------------------------
/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/go-gts/gts
2 |
3 | go 1.15
4 |
5 | require (
6 | github.com/dustin/go-humanize v1.0.0
7 | github.com/go-ascii/ascii v1.0.3
8 | github.com/go-flip/flip v1.1.0
9 | github.com/go-gts/flags v0.0.12
10 | github.com/go-pars/pars v1.1.6
11 | github.com/go-test/deep v1.0.7
12 | github.com/go-wrap/wrap v1.0.3
13 | github.com/mattn/go-isatty v0.0.12
14 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
15 | )
16 |
--------------------------------------------------------------------------------
/seqio/strings.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import "strings"
4 |
5 | // FlatFileSplit splits the string with the flatfile convention.
6 | func FlatFileSplit(s string) []string {
7 | s = strings.TrimSuffix(s, ".")
8 | if len(s) == 0 {
9 | return nil
10 | }
11 | return strings.Split(s, "; ")
12 | }
13 |
14 | // AddPrefix adds the given prefix after each newline.
15 | func AddPrefix(s, prefix string) string {
16 | return strings.ReplaceAll(s, "\n", "\n"+prefix)
17 | }
18 |
--------------------------------------------------------------------------------
/seqio/contig.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import (
4 | "fmt"
5 |
6 | "github.com/go-gts/gts"
7 | )
8 |
9 | // Contig represents a contig field.
10 | type Contig struct {
11 | Accession string
12 | Region gts.Segment
13 | }
14 |
15 | // String satisfies the fmt.Stringer interface.
16 | func (contig Contig) String() string {
17 | if contig.Accession == "" {
18 | return ""
19 | }
20 | head, tail := gts.Unpack(contig.Region)
21 | return fmt.Sprintf("join(%s:%d..%d)", contig.Accession, head+1, tail)
22 | }
23 |
--------------------------------------------------------------------------------
/man/gts-cache-purge.1.ronn:
--------------------------------------------------------------------------------
1 | # gts-cache-purge(1) -- delete all cache files
2 |
3 | ## SYNOPSIS
4 |
5 | gts-cache-purge [--version] [-h | --help]
6 |
7 | ## DESCRIPTION
8 |
9 | **gts-cache-purge** will remove all of the files contained in the cache
10 | directory.
11 |
12 | ## OPTIONS
13 |
14 | None.
15 |
16 | ## BUGS
17 |
18 | **gts-cache-purge** currently has no known bugs.
19 |
20 | ## AUTHORS
21 |
22 | **gts-cache-purge** is written and maintained by Kotone Itaya.
23 |
24 | ## SEE ALSO
25 |
26 | gts(1), gts-cache(1), gts-cache-list(1), gts-cache-path(1), gts-cache(7)
--------------------------------------------------------------------------------
/man/gts-seqin.7:
--------------------------------------------------------------------------------
1 | .\" generated with Ronn/v0.7.3
2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3
3 | .
4 | .TH "GTS\-SEQIN" "7" "October 2020" "" ""
5 | .
6 | .SH "NAME"
7 | \fBgts\-seqin\fR \- input sequence formats supported in GTS\.
8 | .
9 | .SH "SYNOPSIS"
10 | .
11 | .IP "\(bu" 4
12 | \fBGenBank\fR
13 | .
14 | .IP "\(bu" 4
15 | \fBFASTA\fR
16 | .
17 | .IP "" 0
18 | .
19 | .SH "DESCRIPTION"
20 | GTS implements parsers for a number of sequence formats, and have plans for implementing more commonly used sequence formats\.
21 | .
22 | .SH "SEE ALSO"
23 | gts(1), gts\-seqout(7)
24 |
--------------------------------------------------------------------------------
/man/gts-seqout.7:
--------------------------------------------------------------------------------
1 | .\" generated with Ronn/v0.7.3
2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3
3 | .
4 | .TH "GTS\-SEQOUT" "7" "October 2020" "" ""
5 | .
6 | .SH "NAME"
7 | \fBgts\-seqout\fR \- output sequence formats supported in GTS\.
8 | .
9 | .SH "SYNOPSIS"
10 | .
11 | .IP "\(bu" 4
12 | \fBGenBank\fR
13 | .
14 | .IP "\(bu" 4
15 | \fBFASTA\fR
16 | .
17 | .IP "" 0
18 | .
19 | .SH "DESCRIPTION"
20 | GTS implements parsers for a number of sequence formats, and have plans for implementing more commonly used sequence formats\.
21 | .
22 | .SH "SEE ALSO"
23 | gts(1), gts\-seqin(7)
24 |
--------------------------------------------------------------------------------
/man/gts-cache-path.1.ronn:
--------------------------------------------------------------------------------
1 | # gts-cache-path(1) -- print the cache directory path
2 |
3 | ## SYNOPSIS
4 |
5 | gts-cache-path [--version] [-h | --help]
6 |
7 | ## DESCRIPTION
8 |
9 | **gts-cache-path** will print the path of the directory containing the
10 | gts-cache(7) files.
11 |
12 | ## OPTIONS
13 |
14 | None.
15 |
16 | ## BUGS
17 |
18 | **gts-cache-path** currently has no known bugs.
19 |
20 | ## AUTHORS
21 |
22 | **gts-cache-path** is written and maintained by Kotone Itaya.
23 |
24 | ## SEE ALSO
25 |
26 | gts(1), gts-cache(1), gts-cache-list(1), gts-cache-purge(1), gts-cache(7)
--------------------------------------------------------------------------------
/seqio/filetype_test.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import "testing"
4 |
5 | var detectTests = []struct {
6 | in string
7 | out FileType
8 | }{
9 | {"foo", DefaultFile},
10 | {"foo.fasta", FastaFile},
11 | {"foo.fastq", FastqFile},
12 | {"foo.gb", GenBankFile},
13 | {"foo.genbank", GenBankFile},
14 | {"foo.emb", EMBLFile},
15 | {"foo.embl", EMBLFile},
16 | }
17 |
18 | func TestDetect(t *testing.T) {
19 | for _, tt := range detectTests {
20 | out := Detect(tt.in)
21 | if out != tt.out {
22 | t.Errorf("Detect(%q) = %v, want %v", tt.in, out, tt.out)
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/man/gts-cache-list.1.ronn:
--------------------------------------------------------------------------------
1 | # gts-cache-list(1) -- list the cache files
2 |
3 | ## SYNOPSIS
4 |
5 | gts-cache-list [--version] [-h | --help]
6 |
7 | ## DESCRIPTION
8 |
9 | **gts-cache-list** will print a list of existing gts-cache(7) files, along with
10 | its file size and the total size occupied by the files.
11 |
12 | ## OPTIONS
13 |
14 | None.
15 |
16 | ## BUGS
17 |
18 | **gts-cache-list** currently has no known bugs.
19 |
20 | ## AUTHORS
21 |
22 | **gts-cache-list** is written and maintained by Kotone Itaya.
23 |
24 | ## SEE ALSO
25 |
26 | gts(1), gts-cache(1), gts-cache-path(1), gts-cache-purge(1), gts-cache(7)
--------------------------------------------------------------------------------
/man/gts-cache-purge.1:
--------------------------------------------------------------------------------
1 | .\" generated with Ronn/v0.7.3
2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3
3 | .
4 | .TH "GTS\-CACHE\-PURGE" "1" "October 2020" "" ""
5 | .
6 | .SH "NAME"
7 | \fBgts\-cache\-purge\fR \- delete all cache files
8 | .
9 | .SH "SYNOPSIS"
10 | gts\-cache\-purge [\-\-version] [\-h | \-\-help]
11 | .
12 | .SH "DESCRIPTION"
13 | \fBgts\-cache\-purge\fR will remove all of the files contained in the cache directory\.
14 | .
15 | .SH "OPTIONS"
16 | None\.
17 | .
18 | .SH "BUGS"
19 | \fBgts\-cache\-purge\fR currently has no known bugs\.
20 | .
21 | .SH "AUTHORS"
22 | \fBgts\-cache\-purge\fR is written and maintained by Kotone Itaya\.
23 | .
24 | .SH "SEE ALSO"
25 | gts(1), gts\-cache(1), gts\-cache\-list(1), gts\-cache\-path(1), gts\-cache(7)
26 |
--------------------------------------------------------------------------------
/man/gts-cache-path.1:
--------------------------------------------------------------------------------
1 | .\" generated with Ronn/v0.7.3
2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3
3 | .
4 | .TH "GTS\-CACHE\-PATH" "1" "October 2020" "" ""
5 | .
6 | .SH "NAME"
7 | \fBgts\-cache\-path\fR \- print the cache directory path
8 | .
9 | .SH "SYNOPSIS"
10 | gts\-cache\-path [\-\-version] [\-h | \-\-help]
11 | .
12 | .SH "DESCRIPTION"
13 | \fBgts\-cache\-path\fR will print the path of the directory containing the gts\-cache(7) files\.
14 | .
15 | .SH "OPTIONS"
16 | None\.
17 | .
18 | .SH "BUGS"
19 | \fBgts\-cache\-path\fR currently has no known bugs\.
20 | .
21 | .SH "AUTHORS"
22 | \fBgts\-cache\-path\fR is written and maintained by Kotone Itaya\.
23 | .
24 | .SH "SEE ALSO"
25 | gts(1), gts\-cache(1), gts\-cache\-list(1), gts\-cache\-purge(1), gts\-cache(7)
26 |
--------------------------------------------------------------------------------
/conda/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | set -ex
4 |
5 | mkdir -p "$PREFIX/bin"
6 | mkdir -p "$PREFIX/share/man/man1"
7 | mkdir -p "$PREFIX/share/man/man7"
8 | mkdir -p "$PREFIX/share/bash-completion/completions"
9 | mkdir -p "$PREFIX/share/zsh/site-functions"
10 |
11 | cp "$SRC_DIR/gts" "$PREFIX/bin"
12 | cp "$SRC_DIR/togo" "$PREFIX/bin"
13 |
14 | chmod +x "$PREFIX/bin/gts"
15 | chmod +x "$PREFIX/bin/togo"
16 |
17 | for FILE in "$SRC_DIR"/man/*.1; do
18 | cp "$FILE" "$PREFIX/share/man/man1"
19 | done
20 |
21 | for FILE in "$SRC_DIR"/man/*.7; do
22 | cp "$FILE" "$PREFIX/share/man/man7"
23 | done
24 |
25 | cp "$SRC_DIR/completion/gts-completion.bash" "$PREFIX/share/bash-completion/completions"
26 | cp "$SRC_DIR/completion/gts-completion.bash" "$PREFIX/share/zsh/site-functions"
--------------------------------------------------------------------------------
/props_test.go:
--------------------------------------------------------------------------------
1 | package gts
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/go-gts/gts/internal/testutils"
7 | )
8 |
9 | func TestProps(t *testing.T) {
10 | p := Props{}
11 | testutils.Equals(t, p.Get("foo") == nil, true)
12 | p.Add("foo", "baz")
13 | testutils.Equals(t, p.Get("foo"), []string{"baz"})
14 | testutils.Equals(t, p.Has("foo"), true)
15 | p.Set("foo", "bar")
16 | testutils.Equals(t, p.Get("foo"), []string{"bar"})
17 | p.Add("foo", "baz")
18 | testutils.Equals(t, p.Get("foo"), []string{"bar", "baz"})
19 | testutils.Equals(t, p.Keys(), []string{"foo"})
20 | testutils.Equals(t, p.Items(), []Item{{"foo", "bar"}, {"foo", "baz"}})
21 | p.Del("foo")
22 | testutils.Equals(t, p.Get("foo") == nil, true)
23 | testutils.Equals(t, p.Has("foo"), false)
24 | }
25 |
--------------------------------------------------------------------------------
/seqio/strings_test.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import (
4 | "testing"
5 |
6 | "github.com/go-gts/gts/internal/testutils"
7 | )
8 |
9 | var flatfileSplitTests = []struct {
10 | in string
11 | out []string
12 | }{
13 | {".", nil},
14 | {"foo; bar.", []string{"foo", "bar"}},
15 | }
16 |
17 | func TestFlatfileSplit(t *testing.T) {
18 | for _, tt := range flatfileSplitTests {
19 | out := FlatFileSplit(tt.in)
20 | testutils.Equals(t, out, tt.out)
21 | }
22 | }
23 |
24 | var addPrefixTests = []struct {
25 | in, out string
26 | }{
27 | {"foo", "foo"},
28 | {"foo\nbar", "foo\n bar"},
29 | }
30 |
31 | func TestAddPrefix(t *testing.T) {
32 | for _, tt := range addPrefixTests {
33 | out := AddPrefix(tt.in, " ")
34 | testutils.DiffLine(t, out, tt.out)
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/man/gts-cache-list.1:
--------------------------------------------------------------------------------
1 | .\" generated with Ronn/v0.7.3
2 | .\" http://github.com/rtomayko/ronn/tree/0.7.3
3 | .
4 | .TH "GTS\-CACHE\-LIST" "1" "October 2020" "" ""
5 | .
6 | .SH "NAME"
7 | \fBgts\-cache\-list\fR \- list the cache files
8 | .
9 | .SH "SYNOPSIS"
10 | gts\-cache\-list [\-\-version] [\-h | \-\-help]
11 | .
12 | .SH "DESCRIPTION"
13 | \fBgts\-cache\-list\fR will print a list of existing gts\-cache(7) files, along with its file size and the total size occupied by the files\.
14 | .
15 | .SH "OPTIONS"
16 | None\.
17 | .
18 | .SH "BUGS"
19 | \fBgts\-cache\-list\fR currently has no known bugs\.
20 | .
21 | .SH "AUTHORS"
22 | \fBgts\-cache\-list\fR is written and maintained by Kotone Itaya\.
23 | .
24 | .SH "SEE ALSO"
25 | gts(1), gts\-cache(1), gts\-cache\-path(1), gts\-cache\-purge(1), gts\-cache(7)
26 |
--------------------------------------------------------------------------------
/man/index.txt:
--------------------------------------------------------------------------------
1 | gts(1) gts.1.ronn
2 | gts-annotate(1) gts-annotate.1.ronn
3 | gts-clear(1) gts-clear.1.ronn
4 | gts-complement(1) gts-complement.1.ronn
5 | gts-delete(1) gts-delete.1.ronn
6 | gts-extract(1) gts-extract.1.ronn
7 | gts-insert(1) gts-insert.1.ronn
8 | gts-length(1) gts-length.1.ronn
9 | gts-query(1) gts-query.1.ronn
10 | gts-reverse(1) gts-reverse.1.ronn
11 | gts-rotate(1) gts-rotate.1.ronn
12 | gts-search(1) gts-search.1.ronn
13 | gts-select(1) gts-select.1.ronn
14 | gts-summary(1) gts-summary.1.ronn
15 | gts-locator(7) gts-locator.7.ronn
16 | gts-modifier(7) gts-modifier.7.ronn
17 | gts-selector(7) gts-selector.7.ronn
18 | gts-seqin(7) gts-seqin.7.ronn
19 | gts-seqout(7) gts-seqout.7.ronn
20 |
21 | # external
22 | cut(1) http://man.cx/cut(1)
--------------------------------------------------------------------------------
/man/gts-cache.1.ronn:
--------------------------------------------------------------------------------
1 | # gts-cache -- manage gts cache files
2 |
3 | ## SYNOPSIS
4 |
5 | usage: gts cache [--version] [-h | --help] []
6 |
7 | ## DESCRIPTION
8 |
9 | **gts-cache** is a command set for interacting with gts-cache(7) files. For all
10 | detailed description of how gts(1) handles caches, refer to gts-cache(7).
11 |
12 | ## COMMANDS
13 |
14 | * `gts-cache-list(1)`:
15 | List the cache files.
16 |
17 | * `gts-cache-path(1)`:
18 | Print the cache directory path.
19 |
20 | * `gts-cache-purge(1)`:
21 | Delete all cache files.
22 |
23 | ## BUGS
24 |
25 | **gts-cache** currently has no known bugs.
26 |
27 | ## AUTHORS
28 |
29 | **gts-cache** is written and maintained by Kotone Itaya.
30 |
31 | ## SEE ALSO
32 |
33 | gts(1), gts-cache-list(1), gts-cache-path(1), gts-cache-purge(1), gts-cache(7)
--------------------------------------------------------------------------------
/utils.go:
--------------------------------------------------------------------------------
1 | package gts
2 |
3 | // Unpack the integer pair to its elements.
4 | func Unpack(p [2]int) (int, int) {
5 | return p[0], p[1]
6 | }
7 |
8 | const intSize = 32 << (^uint(0) >> 63)
9 |
10 | // Abs returns the absolute value of the given integer.
11 | func Abs(x int) int {
12 | y := x >> (intSize - 1)
13 | return (x ^ y) - y
14 | }
15 |
16 | // Compare the two integers and return the result.
17 | func Compare(i, j int) int {
18 | switch {
19 | case i < j:
20 | return -1
21 | case j < i:
22 | return 1
23 | default:
24 | return 0
25 | }
26 | }
27 |
28 | // Min returns the smaller integer.
29 | func Min(i, j int) int {
30 | if i < j {
31 | return i
32 | }
33 | return j
34 | }
35 |
36 | // Max returns the bigger integer.
37 | func Max(i, j int) int {
38 | if j < i {
39 | return i
40 | }
41 | return j
42 | }
43 |
--------------------------------------------------------------------------------
/seqio/filetype.go:
--------------------------------------------------------------------------------
1 | package seqio
2 |
3 | import "path/filepath"
4 |
5 | // FileType represents a file type.
6 | type FileType int
7 |
8 | // Available file types in GTS.
9 | const (
10 | DefaultFile FileType = iota
11 | FastaFile
12 | FastqFile
13 | GenBankFile
14 | EMBLFile
15 | )
16 |
17 | // Detect returns the FileType associated to extension of the given filename.
18 | func Detect(filename string) FileType {
19 | ext := filepath.Ext(filename)
20 | if ext != "" {
21 | ext = ext[1:]
22 | }
23 | return ToFileType(ext)
24 | }
25 |
26 | // ToFileType converts the file type name string to a FileType
27 | func ToFileType(name string) FileType {
28 | switch name {
29 | case "fasta":
30 | return FastaFile
31 | case "fastq":
32 | return FastqFile
33 | case "gb", "genbank":
34 | return GenBankFile
35 | case "emb", "embl":
36 | return EMBLFile
37 | default:
38 | return DefaultFile
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/man/gts-length.1.ronn:
--------------------------------------------------------------------------------
1 | # gts-length -- report the length of the sequence(s)
2 |
3 | ## SYNOPSIS
4 |
5 | gts-length [--version] [-h | --help] []
6 |
7 | ## DESCRIPTION
8 |
9 | **gts-length** takes a single sequence input and prints the length of each
10 | sequence in the given sequence file. If the sequence input is ommited, standard
11 | input will be read instead.
12 |
13 | ## OPTIONS
14 |
15 | * ``:
16 | Input sequence file (may be omitted if standard input is provided). See
17 | gts-seqin(7) for a list of currently supported list of sequence formats.
18 |
19 | * `--no-cache`:
20 | Do not use or create cache. See gts-cache(7) for details.
21 |
22 | * `-o