external

package module
v0.0.0-...-d8338d2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: BSD-3-Clause Imports: 7 Imported by: 6

README

bíogo

#External

Build Status

##Installation

    $ go get github.com/biogo/external/...

##Overview

External provides a mechanism to add struct-based APIs to commad-line tools.

Citing

If you use bíogo, please cite Kortschak and Adelson "bíogo: a simple high-performance bioinformatics toolkit for the Go language", doi:10.1101/005033.

##Library Structure and Coding Style

The coding style should be aligned with normal Go idioms as represented in the Go core libraries.

##Copyright and License

Copyright ©2011-2013 The bíogo Authors except where otherwise noted. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

The bíogo logo is derived from Bitstream Charter, Copyright ©1989-1992 Bitstream Inc., Cambridge, MA.

BITSTREAM CHARTER is a registered trademark of Bitstream Inc.

Documentation

Overview

Package external allows uniform interaction with external tools based on a config struct.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(cb CommandBuilder, funcs ...template.FuncMap) (args []string, err error)

Build builds a set of command line args from cb, which must be a struct. cb's fields are inspected for struct tags "buildarg" key. The value for buildarg tag should be a valid text template. Build applies executes the template using the value of the field or each element of the value of the field if the field is a slice or an array. An argument split tag, "\x00", can be used to denote separation of elements of the args array within any single parameter specification. Template functions can be provided via funcs.

Four convenience functions are provided:

 args
	Joins %v representation of elements of an array, slice or map, or reference to any of
	these, using split tag as a separator. Otherwise it returns the %v representation of the
	underlying value.
 join
	Joins %v representation of elements of an array, slice or map, or reference to any of
	these, using the the value of the first argument as a separator. Otherwise it returns the
	%v representation of the underlying value.
 mprintf
	Applies fmt.Sprintf, given a format string, to a value or each element of an array, slice
	or map, or reference to any of these.
 quote
	Wraps in quotes a value or each element of an array, slice or map, or reference to any
	of these.
 split
	Includes a split tag in a pipeline.

 Note that args, join, mprintf and quote will return randomly ordered arguments if a map is used
 as a template input.

func Must

func Must(args []string, err error) []string

Must is a helper that wraps a call to a function returning ([]string, error) and panics if the error is non-nil.

Types

type CommandBuilder

type CommandBuilder interface {
	BuildCommand() (*exec.Cmd, error)
}

CommandBuilder is an interface that assembles a set of command line arguments, and creates an *exec.Cmd that can run the command. The method BuildCommand is responsible for handling set up of redirections and parameter sanity checking if required.

Directories

Path Synopsis
Package kmeans implements interaction with the kmeans clustering tool.
Package kmeans implements interaction with the kmeans clustering tool.
Package last implements interaction with the last alignment tool.
Package last implements interaction with the last alignment tool.
Package mafft implements interaction with the MAFFT multiple alignment tool.
Package mafft implements interaction with the MAFFT multiple alignment tool.
Package muscle implements interaction with the MUSCLE multiple alignment tool.
Package muscle implements interaction with the MUSCLE multiple alignment tool.

Jump to

Keyboard shortcuts

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