sort

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: 12 Imported by: 0

Documentation

Overview

Package sort holds structs and functions for sorting genomic data types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GirafExternalMergeSort

func GirafExternalMergeSort(girafFile string, nodeIdSortOrder []uint32, linesPerChunk int, outFile string)

Sorts giraf by startposition and startnode given the node order defined in nodeIdSortOrder This was intended to be paired with a list of sorted nodes such as simpleGraph.GetSortOrder() so that the file result would be a topologically sorted giraf file, however this can be used with any given node sort order.

func GoExternalMergeSort

func GoExternalMergeSort[E any](data <-chan E, recordsPerTmpFile int, tmpDir string, less func(a, b E) bool) <-chan E

GoExternalMergeSort inputs generic data records from a channel and a function to compare multiple data records and outputs a channel of sorted data records. This function sorts externally via merge sort and therefore is appropriate for very large amounts of data.

Types

type MergeSort

type MergeSort interface {
	Len() int
	Swap(i, j int)
	Less(i, j int) bool
	Push(x interface{})
	Pop() interface{}
	Write(file string) // Write entire slice to file
}

Interface for generic merge sort of file types.

type MergeSortSingle

type MergeSortSingle interface {
	WriteToFileHandle(io.Writer)            // Write receiver to input file
	NextRealRecord(*fileio.EasyReader) bool // Must skip any comment lines, cannot return nil
	Copy() interface{}                      // Copies value in receiver pointer to the to interface
}

Jump to

Keyboard shortcuts

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