pFasta

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllAreEqual

func AllAreEqual(a []PFasta, b []PFasta, precision float32) bool

AllAreEqual returns true if two []pFasta data structures are determined to be equal, false otherwise. Two []pFasta data structures are said to be equal if: (1) they are of the same length. (2) Each component pFasta struct in 'a' is equal to the pFasta struct at the corresponding index in 'b'. See the documentation for 'Equal' for a complete definition of the criterion for pFasta struct equality. Note that pFasta equality is parameterized by a user-specified relative 'precision'.

func IsEqual

func IsEqual(a PFasta, b PFasta, precision float32) bool

IsEqual returns true if two input pFasta structs are 'equal', false otherwise. Two input pFasta structs are said to be equal if they have the same name, have the same number of bases in their sequence, and for each base, the base probabilities are equal within a user-specified level of relative precision.

func ReadPfaHeader

func ReadPfaHeader(reader *bufio.Reader) []string

ReadPfaHeader parses the header of a pFasta format file from an input *bufio.Reader.

func Sample

func Sample(input []PFasta, chrom string) fasta.Fasta

Sample returns a new Fasta sampled from the given pFasta probability distribution

func Write

func Write(outFile string, records []PFasta)

Write takes an input []pFasta and writes to an output binary pFa file.

Types

type PFasta

type PFasta struct {
	Name string
	Seq  []pDna.Float32Base
}

PFasta is the probabilistic analog of fasta, which represents sequences of pDna bases rather than dna bases.

func Extract

func Extract(input []PFasta, start int, end int, outputName string, chrom string, takeCoords bool) PFasta

Extract returns a new pFa that is a subsequence of the input pFa, defined by a start (inclusive) and end (exclusive) position, like in bed; makes memory copy

func ExtractBed

func ExtractBed(input []PFasta, region []bed.Bed, takeCoords bool) []PFasta

ExtractBed returns a pFa that has a list of subsequences of the input pFa defined by the regions in the bed region takeCoords specifies if name fields in output should be original names in region or identified by ChromStart and ChromEnd

func Read

func Read(inFile string) []PFasta

Read parses a []PFasta from an input file handle in .pFa binary format.

Jump to

Keyboard shortcuts

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