pals

package
v0.0.0-...-25502c3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2012 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package implementing functions required for PALS sequence alignment

Index

Constants

This section is empty.

Variables

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

Default values for filter and alignment.

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 ContainQuery

type ContainQuery struct {
	Start, End int
	Slop       int
	Location   string
}

func (*ContainQuery) ID

func (q *ContainQuery) ID() uintptr

func (*ContainQuery) Overlap

func (q *ContainQuery) Overlap(b interval.IntRange) bool

func (*ContainQuery) Range

func (q *ContainQuery) Range() interval.IntRange

type FeaturePair

type FeaturePair struct {
	A, B   *feat.Feature
	Score  int     // Score of alignment between features.
	Error  float64 // Identity difference between feature sequences.
	Strand int8    // Strand relationship: positive indicates same strand, negative indicates opposite strand.
}

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

func ExpandFeature

func ExpandFeature(f *feat.Feature) (*FeaturePair, error)

Expand a feat.Feature containing a PALS-type feature attribute into a FeaturePair.

func NewFeaturePair

func NewFeaturePair(target, query *seq.Seq, hit dp.DPHit, comp bool) (*FeaturePair, error)

Convert a DPHit and two packed sequences into a FeaturePair.

func (*FeaturePair) Invert

func (fp *FeaturePair) Invert() *FeaturePair

Invert returns a reversed copy of the feature pair such that A', B' = B, A.

type Logger

type Logger interface {
	Print(v ...interface{})
	Printf(format string, v ...interface{})
	Println(v ...interface{})
	Fatal(v ...interface{})
	Fatalf(format string, v ...interface{})
	Fatalln(v ...interface{})
}

Interface for logger used by PALS.

type PALS

type PALS struct {
	FilterParams *filter.Params
	DPParams     *dp.Params
	MaxIGap      int
	DiffCost     int
	SameCost     int
	MatchCost    int
	BlockCost    int
	RMatchCost   float64
	// 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 *seq.Seq, selfComp bool, m *morass.Morass, threads, tubeOffset int, mem *uintptr, log Logger) *PALS

Return a new PALS aligner. Requires

func (*PALS) Align

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

Perform filtering and alignment for one strand of query.

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 filesystem 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.

type Packer

type Packer struct {
	Packed *seq.Seq
	// 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()

Finalise the sequence packing.

func (*Packer) Pack

func (pa *Packer) Pack(sequence *seq.Seq) string

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

type Pile

type Pile struct {
	Pile   *feat.Feature
	Images []*FeaturePair
}

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.

type PileFilter

type PileFilter func(a, b *feat.Feature, pa, pb *PileInterval) bool

A PileFilter is used to determine whether a FeaturePair is included in a Pile

type PileInterval

type PileInterval struct {
	Start, End int
	Location   string
	Pairs      []*FeaturePair
	// contains filtered or unexported fields
}

func (*PileInterval) ID

func (i *PileInterval) ID() uintptr

func (*PileInterval) Overlap

func (i *PileInterval) Overlap(b interval.IntRange) bool

func (*PileInterval) Range

func (i *PileInterval) Range() interval.IntRange

type Piler

type Piler struct {
	// 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 *FeaturePair) error

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

func (*Piler) Pile

func (p *Piler) Pile(q *ContainQuery) (*PileInterval, error)

Pile returns the interval representation of the pile containing i. An error is returned if more than one pile would be returned.

func (*Piler) Piles

func (p *Piler) Piles(f PileFilter) ([]*Pile, error)

We use the Features' Meta field to point back to the containing Pile, so Meta cannot be used for other things here.

type Writer

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

PALS pair writer type.

func NewWriter

func NewWriter(f io.WriteCloser, v, width int, header bool) (w *Writer)

Returns a new PALS writer using f.

func NewWriterName

func NewWriterName(name string, v, width int, header bool) (*Writer, error)

Returns a new PALS writer using a filename, truncating any existing file. If appending is required use NewWriter and os.OpenFile.

func (*Writer) Close

func (w *Writer) Close() (err error)

Close the writer, flushing any unwritten data.

func (*Writer) Write

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

Write 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