base

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package base is a basic implementation of FASTA reading

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dna

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

Dna is a Fasta containing a DNA sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated DNA #1
TTCGGCCGAAGGCGCCCTCAGTGTATCTATTAAGCGATTGGAAGTTGCTTTACTCAGTCGCAGGTTAATTAATCCCTTGTGCTGTGTCCACCAAAGTTAGGAGGTCAATTTCCCTGTTGTTTCCGGAACTCAGGAAACAGTCTACGCTTGGCATCTTACTGTGCGTACAAATCTTTGCTAAAGAACTAAACTTCTGGCGA

func ReadDna

func ReadDna(r io.ReadCloser) (Dna, error)

ReadDna reads in a FASTA file that should contain only valid Dna letters

func ReadMultiDna

func ReadMultiDna(r io.ReadCloser) ([]Dna, error)

ReadMultiDna reads in a multi-record FASTA file that should contain only valid Dna letters

func (*Dna) Header

func (x *Dna) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated DNA #1

func (*Dna) Sequence

func (x *Dna) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

TTCGGCCGAAGGCGCCCTCAGTGTATCTATTAAGCGATTGGAAGTTGCTTTACTCAGTCGCAGGTTAATTAATCCCTTGTGCTGTGTCCACCAAAGTTAGGAGGTCAATTTCCCTGTTGTTTCCGGAACTCAGGAAACAGTCTACGCTTGGCATCTTACTGTGCGTACAAATCTTTGCTAAAGAACTAAACTTCTGGCGA

type DnaIupac

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

DnaIupac is a Fasta containing a DnaIupac sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated DNA IUPAC #1
YHKWMMTKTASCWGWCGCRNHGNDHM-RTNCYTGWCDMDBWDVVAYTCAHATYSMKAHMCABASMVRMMKSSVM-CYTYVTYBRVCWKBGWAMWVNHATCWMCYMGS--WBAATAHVKWGRKMRTBRVHDDYTBDCRKAHSHRYBTR-SSBAYTKTCMBSSHBYCNGHKNTNWATTSABMTYYDBBMKVBYGHMYSRCVK

func ReadDnaIupac

func ReadDnaIupac(r io.ReadCloser) (DnaIupac, error)

ReadDnaIupac reads in a FASTA file that should contain only valid DnaIupac letters

func ReadMultiDnaIupac

func ReadMultiDnaIupac(r io.ReadCloser) ([]DnaIupac, error)

ReadMultiDnaIupac reads in a multi-record FASTA file that should contain only valid DnaIupac letters

func (*DnaIupac) Header

func (x *DnaIupac) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated DNA IUPAC #1

func (*DnaIupac) Sequence

func (x *DnaIupac) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/dna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadDnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

YHKWMMTKTASCWGWCGCRNHGNDHM-RTNCYTGWCDMDBWDVVAYTCAHATYSMKAHMCABASMVRMMKSSVM-CYTYVTYBRVCWKBGWAMWVNHATCWMCYMGS--WBAATAHVKWGRKMRTBRVHDDYTBDCRKAHSHRYBTR-SSBAYTKTCMBSSHBYCNGHKNTNWATTSABMTYYDBBMKVBYGHMYSRCVK

type Protein

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

Protein is a Fasta containing a Protein sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProtein(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated Protein #1
HEWKEYFVQKELDPTWVQLYCWYCLFWAMCVWRHIITWAFTHPMHHFNAHGQAGKMMIYTVAFFVSTTIWMVHTRGHPAMPFKPHWCNQYSGAIYKYPYPRLYNCSCGHDGWLCQGHRATQFTLNHYTFWIEPDLPMEMAGYNGTHTSARNSTKWYQDMANRPHREIFQQMKQTSIMDTYQKWTYRKNNAIKCSQRMKQI

func ReadMultiProtein

func ReadMultiProtein(r io.ReadCloser) ([]Protein, error)

ReadMultiProtein reads in a multi-record FASTA file that should contain only valid Protein letters

func ReadProtein

func ReadProtein(r io.ReadCloser) (Protein, error)

ReadProtein reads in a FASTA file that should contain only valid Protein letters

func (*Protein) Header

func (x *Protein) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProtein(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated Protein #1

func (*Protein) Sequence

func (x *Protein) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProtein(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

HEWKEYFVQKELDPTWVQLYCWYCLFWAMCVWRHIITWAFTHPMHHFNAHGQAGKMMIYTVAFFVSTTIWMVHTRGHPAMPFKPHWCNQYSGAIYKYPYPRLYNCSCGHDGWLCQGHRATQFTLNHYTFWIEPDLPMEMAGYNGTHTSARNSTKWYQDMANRPHREIFQQMKQTSIMDTYQKWTYRKNNAIKCSQRMKQI

type ProteinGapped

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

ProteinGapped is a Fasta containing a ProteinGapped sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein_gapped.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProteinGapped(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated Protein Gapped #1
HEWKEYFVQKELDPT---LYCWYCLFWAMCVWRHIITWAF-HPMHHFNAHGQAGKMMIYTVAFFVSTTIWMVHTRGH-AMPFKPHWCNQYSGAIYKYPYP-LYNCSCGHDGWLCQGHRATQFTLNHYTFWIEPDLPM-MAGYNGTHTSARNSTKWYQDMA-RPHREIFQQMKQTSIMDTYQKWTYRKNNAIKCSQRM-QI

func ReadMultiProteinGapped

func ReadMultiProteinGapped(r io.ReadCloser) ([]ProteinGapped, error)

ReadMultiProteinGapped reads in a multi-record FASTA file that should contain only valid ProteinGapped letters

func ReadProteinGapped

func ReadProteinGapped(r io.ReadCloser) (ProteinGapped, error)

ReadProteinGapped reads in a FASTA file that should contain only valid ProteinGapped letters

func (*ProteinGapped) Header

func (x *ProteinGapped) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein_gapped.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProteinGapped(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated Protein Gapped #1

func (*ProteinGapped) Sequence

func (x *ProteinGapped) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/protein_gapped.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadProteinGapped(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

HEWKEYFVQKELDPT---LYCWYCLFWAMCVWRHIITWAF-HPMHHFNAHGQAGKMMIYTVAFFVSTTIWMVHTRGH-AMPFKPHWCNQYSGAIYKYPYP-LYNCSCGHDGWLCQGHRATQFTLNHYTFWIEPDLPM-MAGYNGTHTSARNSTKWYQDMA-RPHREIFQQMKQTSIMDTYQKWTYRKNNAIKCSQRM-QI

type Rna

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

Rna is a Fasta containing a Rna sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated RNA #1
UGAUGCAUGAUAACUACAUGCCUAUAGUUAGUGAAGGAAGGCUGUUCCACAUUGACCGUGCUGCGUACAGAUUCACUGGGUUGAGCAACCCAACGAGGUAGUGUAUGUUGGUUAGUCUAGGAACCCGGUCUCGUGUCGAUGUUUGGGGGGUCGCCGUAAGUAGAAAAUUUCGGUCGAGAUAUCCUUCCAGCUUUUAUCCG

func ReadMultiRna

func ReadMultiRna(r io.ReadCloser) ([]Rna, error)

ReadMultiRna reads in a multi-record FASTA file that should contain only valid Rna letters

func ReadRna

func ReadRna(r io.ReadCloser) (Rna, error)

ReadRna reads in a FASTA file that should contain only valid Rna letters

func (*Rna) Header

func (x *Rna) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated RNA #1

func (*Rna) Sequence

func (x *Rna) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRna(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

UGAUGCAUGAUAACUACAUGCCUAUAGUUAGUGAAGGAAGGCUGUUCCACAUUGACCGUGCUGCGUACAGAUUCACUGGGUUGAGCAACCCAACGAGGUAGUGUAUGUUGGUUAGUCUAGGAACCCGGUCUCGUGUCGAUGUUUGGGGGGUCGCCGUAAGUAGAAAAUUUCGGUCGAGAUAUCCUUCCAGCUUUUAUCCG

type RnaIupac

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

RnaIupac is a Fasta containing a RnaIupac sequence

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n%s\n", f.Header(), f.Sequence())
}
Output:

>Generated RNA IUPAC #1
YHKWMMUKUASCWGWCGCRNHGNDHM-RUNCYUGWCDMDBWDVVAYUCAHAUYSMKAHMCABASMVRMMKSSVM-CYUYVUYBRVCWKBGWAMWVNHAUCWMCYMGS--WBAAUAHVKWGRKMRUBRVHDDYUBDCRKAHSHRYBUR-SSBAYUKUCMBSSHBYCNGHKNUNWAUUSABMUYYDBBMKVBYGHMYSRCVK

func ReadMultiRnaIupac

func ReadMultiRnaIupac(r io.ReadCloser) ([]RnaIupac, error)

ReadMultiRnaIupac reads in a multi-record FASTA file that should contain only valid RnaIupac letters

func ReadRnaIupac

func ReadRnaIupac(r io.ReadCloser) (RnaIupac, error)

ReadRnaIupac reads in a FASTA file that should contain only valid RnaIupac letters

func (*RnaIupac) Header

func (x *RnaIupac) Header() string

Header is the header line

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Header())
}
Output:

>Generated RNA IUPAC #1

func (*RnaIupac) Sequence

func (x *RnaIupac) Sequence() string

Sequence is the body lines with newlines removed

Example
package main

import (
	"fmt"
	"os"

	"github.com/bio-ext/bio-go/bio/io/fasta/base"
)

func main() {
	x, err := os.Open("../testdata/rna_iupac.fasta")
	if err != nil {
		panic(err)
	}
	f, err := base.ReadRnaIupac(x)
	if err != nil {
		panic(err)
	}

	fmt.Printf("%s\n", f.Sequence())
}
Output:

YHKWMMUKUASCWGWCGCRNHGNDHM-RUNCYUGWCDMDBWDVVAYUCAHAUYSMKAHMCABASMVRMMKSSVM-CYUYVUYBRVCWKBGWAMWVNHAUCWMCYMGS--WBAAUAHVKWGRKMRUBRVHDDYUBDCRKAHSHRYBUR-SSBAYUKUCMBSSHBYCNGHKNUNWAUUSABMUYYDBBMKVBYGHMYSRCVK

type Struct

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

Struct is the generalization of two-line FASTA format

func New

func New(header string, seq sequence.Interface) *Struct

New is an Struct generator

func (*Struct) Header

func (f *Struct) Header() string

Header is the header line

func (*Struct) Sequence

func (f *Struct) Sequence() string

Sequence is the body lines with newlines removed

Jump to

Keyboard shortcuts

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