cmd

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2016 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "goalign",
	Short: "goalign: A set of tools to handle sequence alignments",
	Long: `goalign: A set of tools to handle sequence alignments.

It allows to :
1 - Convert formats
2 - Shuffle alignments
3 - Sample alignments
4 - Print informations about alignments
5 - Generate bootstrap alignments

`,
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		runtime.GOMAXPROCS(rootcpus)
		rootaligns = make(chan align.Alignment, 15)
		var fi *os.File
		var r *bufio.Reader
		var err error
		if infile == "stdin" || infile == "-" {
			fi = os.Stdin
		} else {
			fi, err = os.Open(infile)
			if err != nil {
				io.ExitWithMessage(err)
			}
		}
		if strings.HasSuffix(infile, ".gz") {
			if gr, err := gzip.NewReader(fi); err != nil {
				io.ExitWithMessage(err)
			} else {
				r = bufio.NewReader(gr)
			}
		} else {
			r = bufio.NewReader(fi)
		}
		var al align.Alignment
		var err2 error
		if rootphylip {
			go func() {
				err2 = phylip.NewParser(r).ParseMultiple(rootaligns)
				if err2 != nil {
					io.ExitWithMessage(err2)
				}
			}()
		} else {
			al, err2 = fasta.NewParser(r).Parse()
			if err2 != nil {
				io.ExitWithMessage(err2)
			}
			rootaligns <- al
			close(rootaligns)
		}
	},
}

RootCmd represents the base command when called without any subcommands

View Source
var Version string = "Unset"

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

func Readln added in v0.1.2

func Readln(r *bufio.Reader) (string, error)

Readln returns a single line (without the ending \n) from the input buffered reader. An error is returned iff there is an error with the buffered reader.

Types

This section is empty.

Jump to

Keyboard shortcuts

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