pals

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: BSD-3-Clause Imports: 19 Imported by: 9

Documentation

Overview

Package pals implements functions and methods required for PALS sequence alignment.

Index

Constants

View Source
const (
	MaxIGap    = 5
	DiffCost   = 3
	SameCost   = 1
	MatchCost  = DiffCost + SameCost
	BlockCost  = DiffCost * MaxIGap
	RMatchCost = float64(DiffCost) + 1
)

Default filter and dynamic programming Cost values.

Variables

View Source
var (
	DefaultLength      = 400
	DefaultMinIdentity = 0.94
	MaxAvgIndexListLen = 15.0
	TubeOffsetDelta    = 32
)

Default thresholds for filter and alignment.

View Source
var (
	MinWordLength = 4  // For minimum word length, choose k=4 arbitrarily.
	MaxKmerLen    = 15 // Currently limited to 15 due to 32 bit int limit for indexing slices
)

Default word characteristics.

Functions

This section is empty.

Types

type Contig

type Contig string

A Contig is a base feature type. Other features in the pals package point to this type in their location fields.

func (Contig) Description

func (c Contig) Description() string

Description returns the string "contig".

func (Contig) End

func (c Contig) End() int

End returns the value 0.

func (Contig) Len

func (c Contig) Len() int

Len returns the value 0.

func (Contig) Location

func (c Contig) Location() feat.Feature

Location returns a nil feat.Feature.

func (Contig) Name

func (c Contig) Name() string

Name returns the value of the receiver as a string.

func (Contig) Start

func (c Contig) Start() int

Start returns the value 0.

func (Contig) String

func (c Contig) String() string

String returns the value of the receiver as a string.

type Feature

type Feature struct {
	ID   string
	From int
	To   int
	Loc  feat.Feature
	Pair *Pair
}

A Feature is a description of a pals feature interval.

func (*Feature) Description

func (f *Feature) Description() string

Description returns the string "pals feature".

func (*Feature) End

func (f *Feature) End() int

func (*Feature) Len

func (f *Feature) Len() int

func (*Feature) Location

func (f *Feature) Location() feat.Feature

func (*Feature) Mate

func (f *Feature) Mate() *Feature

Mate returns the feature pair mate of the receiver.

func (*Feature) Name

func (f *Feature) Name() string

func (*Feature) Start

func (f *Feature) Start() int

func (*Feature) String

func (f *Feature) String() string

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
}

Interface for logger used by PALS.

type PALS

type PALS struct {
	FilterParams *filter.Params
	DPParams     *dp.Params
	dp.Costs
	// contains filtered or unexported fields
}

PALS is a type that can perform pairwise alignments of large sequences based on the papers:

PILER: identification and classification of genomic repeats.
 Robert C. Edgar and Eugene W. Myers. Bioinformatics Suppl. 1:i152-i158 (2005)
Efficient q-gram filters for finding all 𝛜-matches over a given length.
 Kim R. Rasmussen, Jens Stoye, and Eugene W. Myers. J. of Computational Biology 13:296–308 (2006).

func New

func New(target, query *linear.Seq, selfComp bool, m *morass.Morass, tubeOffset int, mem *uintptr, log Logger) *PALS

Return a new PALS aligner. Requires

func (*PALS) Align

func (p *PALS) Align(complement bool) (dp.Hits, error)

Align performs filtering and alignment for one strand of query.

func (*PALS) AlignFrom

func (p *PALS) AlignFrom(traps filter.Trapezoids, complement bool) (dp.Hits, error)

AlignFrom performs filtering and alignment for one strand of query using the provided filter trapezoids as seeds.

func (*PALS) AvgIndexListLength

func (p *PALS) AvgIndexListLength(filterParams *filter.Params) float64

Return an estimate of the average number of hits for any given kmer.

func (*PALS) BuildIndex

func (p *PALS) BuildIndex() error

Build the kmerindex for filtering.

func (*PALS) CleanUp

func (p *PALS) CleanUp() error

Remove file system components of filter. This should be called after the last use of the aligner.

func (*PALS) MemRequired

func (p *PALS) MemRequired(filterParams *filter.Params) uintptr

Return an estimate of the total amount of memory required.

func (*PALS) Optimise

func (p *PALS) Optimise(minHitLen int, minId float64) error

Optimise the PALS parameters for given memory, kmer length, hit length and sequence identity. An error is returned if no satisfactory parameters can be found.

func (*PALS) Share

func (p *PALS) Share(m *PALS)

Share allows the receiver to use the index and parameters of m.

func (*PALS) Trapezoids

func (p *PALS) Trapezoids() filter.Trapezoids

Trapezoids returns the filter trapezoids identified during a call to Align.

type Packed

type Packed struct {
	*linear.Seq
	// contains filtered or unexported fields
}

type Packer

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

A Packer collects a set of sequence into a Packed sequence.

func NewPacker

func NewPacker(id string) *Packer

Create a new Packer.

func (*Packer) FinalisePack

func (pa *Packer) FinalisePack() *Packed

Finalise the sequence packing.

func (*Packer) Pack

func (pa *Packer) Pack(seq *linear.Seq) (string, error)

Pack a sequence into the Packed sequence. Returns a string giving diagnostic information.

type Pair

type Pair struct {
	A, B   *Feature
	Score  int        // Score of alignment between features.
	Error  float64    // Identity difference between feature sequences.
	Strand seq.Strand // Strand relationship: seq.Plus indicates same strand, seq.Minus indicates opposite strand.
}

A Pair holds a pair of features with additional information relating the two.

func ExpandFeature

func ExpandFeature(f *gff.Feature) (*Pair, error)

ExpandFeature converts a *gff.Feature containing PALS-type feature attributes into a Pair.

func NewPair

func NewPair(target, query *Packed, hit dp.Hit, comp bool) (*Pair, error)

NewPair converts a dp.Hit and two packed sequences into a Pair.

func (*Pair) String

func (fp *Pair) String() string

type PairFilter

type PairFilter func(*Pair) bool

A PairFilter is used to determine whether a Pair's images are included in a Pile.

type Pile

type Pile struct {
	From   int
	To     int
	Strand seq.Strand
	Loc    feat.Feature
	Images []*Feature
	graph.Node
}

A Pile is a collection of features covering a maximal (potentially contiguous, depending on the value of overlap used for creation of the Piler) region of copy count > 0.

The graph.Node interface support of Pile is subject to change. TODO(kortschak): Replace biogo/graph use with gonum/graph.

func (*Pile) Description

func (p *Pile) Description() string

Description returns the string "pile".

func (*Pile) End

func (p *Pile) End() int

func (*Pile) Len

func (p *Pile) Len() int

func (*Pile) Location

func (p *Pile) Location() feat.Feature

func (*Pile) Name

func (p *Pile) Name() string

func (*Pile) Start

func (p *Pile) Start() int

func (*Pile) String

func (p *Pile) String() string

type Piler

type Piler struct {
	// Logger logs pile construction during
	// Piles calls if non-nil.
	Logger *log.Logger
	// LogFreq specifies how frequently
	// log lines are witten if not zero.
	LogFreq int
	// contains filtered or unexported fields
}

A Piler performs the aggregation of feature pairs according to the description in section 2.3 of Edgar and Myers (2005) using an interval tree, giving O(nlogn) time but better space complexity and flexibility with feature overlap.

func NewPiler

func NewPiler(overlap int) *Piler

NewPiler creates a Piler object ready for piling feature pairs.

func (*Piler) Add

func (p *Piler) Add(fp *Pair) error

Add adds a feature pair to the piler incorporating the features into piles where appropriate.

func (*Piler) Piles

func (p *Piler) Piles(f PairFilter) []*Pile

Piles returns a slice of piles determined by application of the filter function f to the feature pairs that have been added to the piler. Piles may be called more than once, but the piles returned in earlier invocations will be altered by subsequent calls.

type Writer

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

Writer is a type that writes PALS pair feature in GFFv2 format.

func NewWriter

func NewWriter(w io.Writer, prec, width int, header bool) *Writer

NewWriter returns a new PALS writer that write PALS alignment features to the io.Writer w.

func (*Writer) Write

func (w *Writer) Write(pair *Pair) (n int, err error)

Write writes a single feature and return the number of bytes written and any error.

Directories

Path Synopsis
Package providing PALS dynamic programming alignment routines.
Package providing PALS dynamic programming alignment routines.
Package providing PALS sequence hit filter routines based on 'Efficient q-gram filters for finding all 𝛜-matches over a given length.' Kim R. Rasmussen, Jens Stoye, and Eugene W. Myers.
Package providing PALS sequence hit filter routines based on 'Efficient q-gram filters for finding all 𝛜-matches over a given length.' Kim R. Rasmussen, Jens Stoye, and Eugene W. Myers.

Jump to

Keyboard shortcuts

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