hashmap

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Overview

Package hashmap is a collection of defined biological alphabets such as DNA, RNA, and Protein

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dna

type Dna struct {
	*Struct
}

Dna is the four letter standard encoding

func NewDna

func NewDna() *Dna

NewDna generates a standard DNA alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewDna()
	fmt.Println(a)
}
Output:

ACGT

func (*Dna) Complement

func (*Dna) Complement(c string) string

Complement produces the standard DNA complement

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewDna()
	fmt.Println(a.Complement("A"))
}
Output:

T

type DnaIupac

type DnaIupac struct {
	*Struct
}

DnaIupac is the sixteen letter IUPAC encoding

func NewDnaIupac

func NewDnaIupac() *DnaIupac

NewDnaIupac generates an IUPAC DNA alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewDnaIupac()
	fmt.Println(a)
}
Output:

-ABCDGHKMNRSTVWY

func (*DnaIupac) Complement

func (*DnaIupac) Complement(c string) string

Complement produces the IUPAC DNA complement

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewDnaIupac()
	fmt.Println(a.Complement("N"))
}
Output:

N

type Protein

type Protein struct {
	*Struct
}

Protein is the twenty letter standard encoding

func NewProtein

func NewProtein() *Protein

NewProtein generates a protein alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewProtein()
	fmt.Println(a)
}
Output:

ACDEFGHIKLMNPQRSTVWY

type ProteinGapped

type ProteinGapped struct {
	*Struct
}

ProteinGapped is the twenty letter standard encoding plus a gap letter

func NewProteinGapped

func NewProteinGapped() *ProteinGapped

NewProteinGapped generates a gapped protein alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewProteinGapped()
	fmt.Println(a)
}
Output:

-ACDEFGHIKLMNPQRSTVWY

type Rna

type Rna struct {
	*Struct
}

Rna is the four letter standard encoding

func NewRna

func NewRna() *Rna

NewRna generates a standard RNA alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewRna()
	fmt.Println(a)
}
Output:

ACGU

func (*Rna) Complement

func (*Rna) Complement(c string) string

Complement produces the standard RNA complement

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewRna()
	fmt.Println(a.Complement("A"))
}
Output:

U

type RnaIupac

type RnaIupac struct {
	*Struct
}

RnaIupac is the sixteen letter IUPAC encoding

func NewRnaIupac

func NewRnaIupac() *RnaIupac

NewRnaIupac generates an IUPAC RNA alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewRnaIupac()
	fmt.Println(a)
}
Output:

-ABCDGHKMNRSUVWY

func (*RnaIupac) Complement

func (*RnaIupac) Complement(c string) string

Complement produces the IUPAC complement

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.NewRnaIupac()
	fmt.Println(a.Complement("N"))
}
Output:

N

type Struct

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

Struct is a collection of letters

func New

func New(letters string) *Struct

New is a Struct generator

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.New("QWERTY")
	fmt.Println(a)
}
Output:

EQRTWY

func (Struct) Contains

func (a Struct) Contains(letters ...string) []bool

Contains confirms whether a potential letters are in the Alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.New("QWERTY")
	fmt.Println(a.Contains([]string{"Q", "WERTY", "A"}...))
}
Output:

[true false false]

func (Struct) Length

func (a Struct) Length() int

Length is numbers of letters in the Alphabet

Example
package main

import (
	"fmt"

	"github.com/bio-ext/bio-go/bio/alphabet/hashmap"
)

func main() {
	a := hashmap.New("QWERTY")
	fmt.Println(a.Length())
}
Output:

6

func (Struct) String

func (a Struct) String() string

String generates a stringified copy of the Alphabet

Jump to

Keyboard shortcuts

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