utils

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BZExtension added in v0.3.4

func BZExtension(name string) (bzipped bool)

func CloseWriteFile added in v0.3.6

func CloseWriteFile(f io.Closer, filename string)

func GetReader

func GetReader(inputfile string) (io.Closer, *bufio.Reader, error)

Returns the opened file and a buffered reader (gzip or not) for the file

func GetReaderFromReader added in v0.2.4

func GetReaderFromReader(gzipped bool, rd io.Reader) (reader *bufio.Reader, err error)

Returns a buffered reader (gzip or not) for the given reader

func GzipExtension added in v0.2.4

func GzipExtension(name string) (gzipped bool)

func OpenFile

func OpenFile(inputfile string) (*os.File, error)

func ParseAlignmentAuto added in v0.2.4

func ParseAlignmentAuto(r *bufio.Reader, rootinputstrict bool) (al align.Alignment, format int, err error)

Parses the input buffer while automatically detecting the format between Newick, Phylip, and Nexus

If several alignments are present in the onput file, only the first will be parsed.

Returned format may be align.FORMAT_PHYLIP, align.FORMAT_FASTA, or align.FORMAT_NEXUS

rootinpustrict: In the case of phylip detected format: should we consider it as strict or not?

There is no new go routine here because only 1 alignment is parsed. No need to give a closer. If the reader comes from a file, the file must be closed in the calling function.

func ParseMultiAlignmentsAuto added in v0.2.4

func ParseMultiAlignmentsAuto(f io.Closer, r *bufio.Reader, rootinputstrict bool) (alchan *align.AlignChannel, format int, err error)

Parses the input buffer while automatically detecting the format between Newick, Phylip, and Nexus

If several alignments are present in the input file, they are queued in the channel

rootinpustrict: In the case of phylip detected format: should we consider it as strict or not?

If there is something to close ( f!=nil) after the parsing (like input file, etc.), f will be closed after parsing is finished (even in the go routine in the case of several input alignments). If the alignment comes from a file for exemple, the file will be closed by this function, so no need to do it in the calling function

func ReadAlign added in v0.3.4

func ReadAlign(file string, format int) (outAlign align.Alignment, err error)

ReadAlign reads a single multiple sequence alignment in the given format from the given file name.

format is defined in github.com/evolbioinfo/goalign/align/ and may be: - align.FORMAT_PHYLIP - align.FORMAT_NEXUS - align.FORMAT_CLUSTAL - align.FORMAT_FASTA - any other value is interpreted as align.FORMAT_FASTA

func Readln added in v0.3.4

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.

func XZExtension added in v0.3.4

func XZExtension(name string) (xzipped bool)

Types

type StringWriterCloser added in v0.3.6

type StringWriterCloser interface {
	io.Writer
	io.Closer
	io.StringWriter
}

func OpenWriteFile added in v0.3.6

func OpenWriteFile(file string) (f StringWriterCloser, err error)

Jump to

Keyboard shortcuts

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