chainfile

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package chainfile provides utilities for reading chain files. Chain files are used to describe alignments between two reference genomes. https://genome.ucsc.edu/goldenPath/help/chain.html

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment struct {
	RefOffset   int64 `db:"ref_offset"`   // Offset of the aligned block in the reference chromosome from the start of the chain.
	QueryOffset int64 `db:"query_offset"` // Offset of the aligned block in the query chromosome from the start of the chain.
	Size        int64 `db:"size"`         // Size of the aligned block in bases.
}

Alignment represents an Alignment block within a chain.

func (*Alignment) HighAtDimension

func (a *Alignment) HighAtDimension(dim uint64) int64

func (*Alignment) ID

func (a *Alignment) ID() uint64

func (*Alignment) LowAtDimension

func (a *Alignment) LowAtDimension(dim uint64) int64

func (*Alignment) OverlapsAtDimension

func (a *Alignment) OverlapsAtDimension(with augmentedtree.Interval, dim uint64) bool

type Chain

type Chain struct {
	Score       int64              // Alignment score.
	RefName     types.Chromosome   // Reference chromosome name.
	RefSize     int64              // Size of the reference chromosome.
	RefStrand   string             // Strand in the reference genome ('+' or '-').
	RefStart    int64              // Start position in the reference genome.
	RefEnd      int64              // End position in the reference genome.
	QueryName   types.Chromosome   // Query chromosome name.
	QuerySize   int64              // Size of the query chromosome.
	QueryStrand string             // Strand in the query genome ('+' or '-').
	QueryStart  int64              // Start position in the query genome.
	QueryEnd    int64              // End position in the query genome.
	ID_         int64              // Unique identifier for the chain.
	Alignments  augmentedtree.Tree // Interval tree of alignments.
}

Chain represents a single Chain in a Chain file.

func (*Chain) HighAtDimension

func (c *Chain) HighAtDimension(dim uint64) int64

func (*Chain) ID

func (c *Chain) ID() uint64

func (*Chain) LowAtDimension

func (c *Chain) LowAtDimension(dim uint64) int64

func (*Chain) OverlapsAtDimension

func (c *Chain) OverlapsAtDimension(with augmentedtree.Interval, dim uint64) bool

type ChainFile

type ChainFile struct {
	// ChainsByChromosome maps a chromosome name to an interval tree of chains.
	ChainsByChromosome map[types.Chromosome]augmentedtree.Tree
	// ChainByID maps a chain ID to a chain.
	ChainByID map[int64]*Chain
}

ChainFile represents a chain file.

func Read

func Read(reader io.Reader) (*ChainFile, error)

Read loads a chain file from an io.Reader.

func (*ChainFile) GetAlignment

func (cf *ChainFile) GetAlignment(ctx context.Context, chainID int64, offset int64) (*types.Alignment, error)

GetAlignment returns the alignment for the given chain and offset from the start of the chain.

func (*ChainFile) GetChain

func (cf *ChainFile) GetChain(ctx context.Context, from types.Reference, chromosome types.Chromosome, position int64) (*types.Chain, error)

GetChain returns the chain for the given chromosome and position.

type Interval

type Interval struct {
	Start int64
	End   int64
}

func (*Interval) HighAtDimension

func (i *Interval) HighAtDimension(dim uint64) int64

func (*Interval) ID

func (i *Interval) ID() uint64

func (*Interval) LowAtDimension

func (i *Interval) LowAtDimension(dim uint64) int64

func (*Interval) OverlapsAtDimension

func (i *Interval) OverlapsAtDimension(with augmentedtree.Interval, dim uint64) bool

Jump to

Keyboard shortcuts

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