giggle

package module
v0.0.0-...-18dc0b1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

README

go-giggle

golang wrapper to giggle

GoDoc


import (
    giggle "github.com/brentp/go-giggle"
    "fmt"
) 

func main() {

    index := giggle.Open("/path/to/index")
    res := index.Query("1", 565657, 567999)

    // all files in the index
    index.Files()

    // int showing total count
    res.TotalHits()

    // []uint32 giving number of hits for each file
    res.Hits()

    var lines []string
    # access results by index of file.
    lines = res.Of(0)
    fmt.Println(strings.Join(lines, "\n"))
    lines = res.Of(1)
}

setup

grep -l "int main" giggle/src/*.c | xargs -I{} rm {} giggle/src/$(basename {} .c).h
# timer start() conflicts with jsw start()
rm giggle/src/timer.h
grep -v "timer.h" giggle/src/giggle_index.c > $$.tmp; mv $$.tmp giggle/src/giggle_index.c

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// contains filtered or unexported fields
}

Index wraps the giggle index.

func New

func New(path string, glob string) (*Index, error)

New creates a new index in the given directory and files it with files matching the glob.

func Open

func Open(path string) (*Index, error)

Open an existing index at the given path.

func (*Index) Files

func (i *Index) Files() []string

Files returns the files associated with the index.

func (*Index) Query

func (i *Index) Query(chrom string, start, end int) *Result

Query gives the results for the given genomic location.

type Result

type Result struct {
	// contains filtered or unexported fields
}

Result is returned from a giggle query.

func (*Result) Hits

func (r *Result) Hits() []uint32

Hits returns the number of overlaps for each file in the result-set.

func (*Result) NFiles

func (r *Result) NFiles() int

NFiles returns the number of files in the result-set.

func (*Result) Of

func (r *Result) Of(i int) []string

Of returns a slice of strings for the given file index.

func (*Result) TotalHits

func (r *Result) TotalHits() int

TotalHits returns the total number of overlaps in the result-set.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL