Skip to contents

Computes the minimal number of inversions required to sort a signed permutation using the Hannenhalli and Pevzner algorithm.

Usage

inversionDistance(gb)

Arguments

gb

A GBreaks object containing genome data from which a permutation vector can be extracted using the permutationVector() function.

Value

An integer: the minimal number of inversions needed to sort the permutation.

Details

This function uses several internal helper functions (e.g., extendedPermutation, breakpoint_graph, hurdles_count, superhurdles_count, and others) to compute properties of the breakpoint graph and identify cycles, hurdles and superhurdles. It also depends on permutationVector(), which is defined in another .R file.

This algorithm was designed to work in a single, linear chromosome alignment. Although the function still works if the GBreaks object involves more than one chromosome, the returned value for the minimal number of inversions will imply in non-usual inversions if different chromosomes have orthologous regions.

See also

permutationVector for generating the permutation vector.

Author

Bruna Fistarol