transform

package
v0.25.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package transform provides functions for transforming sequences.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Complement

func Complement(sequence string) string

Complement returns the complement of sequence. In DNA each nucleotide (A, T, C or G) is has a deterministic pair. A is paired with T and C is paired with G. The complement of a sequence is formed by exchanging these letters for their pair:

'A' becomes 'T'
'T' becomes 'A'
'C' becomes 'G'
'G' becomes 'C'

This function expects byte characters in the range a-z and A-Z and will not check for non-byte characters, i.e. utf-8 encoding.

Example
package main

import (
	"fmt"

	"github.com/TimothyStiles/poly/transform"
)

func main() {
	sequence := "GATTACA"
	complement := transform.Complement(sequence)
	fmt.Println(complement)

}
Output:

CTAATGT

func ComplementBase

func ComplementBase(basePair rune) rune

ComplementBase accepts a base pair and returns its complement base pair. See Complement.

This function expects byte characters in the range a-z and A-Z and will return a space ' ' (U+0020) for characters that are not matched to any known base. This is subject to change.

func Reverse

func Reverse(sequence string) string

Reverse returns the reverse of sequence. It performs a basic string reversal by working on the bytes.

This function expects byte characters in the range a-z and A-Z and will not check for non-byte character, i.e. utf-8 encoding.

Example
package main

import (
	"fmt"

	"github.com/TimothyStiles/poly/transform"
)

func main() {
	sequence := "GATTACA"
	reverse := transform.Reverse(sequence)
	fmt.Println(reverse)

}
Output:

ACATTAG

func ReverseComplement

func ReverseComplement(sequence string) string

ReverseComplement returns the reversed complement of sequence. It is the equivalent of calling

revComplement := Reverse(Complement(sequence))

This function expects byte characters in the range a-z and A-Z and will not check for non-byte characters, i.e. utf-8 encoding.

Example
package main

import (
	"fmt"

	"github.com/TimothyStiles/poly/transform"
)

func main() {
	sequence := "GATTACA"
	reverseComplement := transform.ReverseComplement(sequence)
	fmt.Println(reverseComplement)

}
Output:

TGTAATC

Types

This section is empty.

Directories

Path Synopsis
Package variants contains a function for generating all variants of a sequence.
Package variants contains a function for generating all variants of a sequence.

Jump to

Keyboard shortcuts

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