polyjson

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(file []byte) poly.Sequence

Parse parses a poly.Sequence JSON file and adds appropriate pointers to struct.

Example
file, _ := ioutil.ReadFile("../../data/sample.json")
sequence := Parse(file)

fmt.Println(sequence.Meta.Source)
Output:

Saccharomyces cerevisiae (baker's yeast)

func Read

func Read(path string) poly.Sequence

Read reads a poly.Sequence JSON file.

Example
sequence := Read("../../data/sample.json")

fmt.Println(sequence.Meta.Source)
Output:

Saccharomyces cerevisiae (baker's yeast)

func Write

func Write(sequence poly.Sequence, path string)

Write writes a poly.Sequence struct out to json.

Example
tmpDataDir, err := ioutil.TempDir("", "data-*")
if err != nil {
	fmt.Println(err.Error())
}
defer os.RemoveAll(tmpDataDir)

sequence := Read("../../data/sample.json")

tmpJSONFilePath := filepath.Join(tmpDataDir, "sample.json")
Write(sequence, tmpJSONFilePath)

testSequence := Read(tmpJSONFilePath)

fmt.Println(testSequence.Meta.Source)
Output:

Saccharomyces cerevisiae (baker's yeast)

Types

This section is empty.

Jump to

Keyboard shortcuts

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