|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbaobab.bio.permutation.PermutationUtil
public class PermutationUtil
The PermutationUtil class contains utility methods which deal with permutations as arrays of int
Constructor Summary | |
---|---|
PermutationUtil()
|
Method Summary | |
---|---|
static int |
calculateSignedReversalDistance(int[] permutation)
Calculates the reversal distance between a given signed permutation and the identity |
static int |
calculateSignedReversalDistance(int[] permutation,
boolean isLinear)
Calculates the reversal distance between a given signed permutation and the identity |
static int |
calculateSignedReversalDistance(int[] origin,
int[] target)
Calculates the reversal distance between the given origin and target signed permutations |
static int |
calculateSignedReversalDistance(int[] origin,
int[] target,
boolean isLinear)
Calculates the reversal distance between the given origin and target signed permutations |
static java.util.Hashtable<java.lang.String,java.lang.Integer> |
canonizePermutations(java.util.Vector<java.lang.String> origin,
java.util.Vector<java.lang.String> target)
Canonize the origin and the target permutations - eliminate insertions/deletions, replace each gene by a number between 1 and n (n is the number of common elements between the origin and the target permutations) |
static java.util.Vector<int[]> |
collapse(int[] permutation,
boolean isLinear)
Collapses a permutation (eliminating the adjacencies) |
static int[] |
collapseBk(int[] permutation,
boolean isLinear)
Collapses a permutation (eliminating the adjacencies) |
static boolean |
containsUnorientedComponent(int[] permutation,
boolean isLinear)
Tests whether the permutation contains an unoriented component (hurdle) |
static java.util.Vector<int[]> |
generateAllPermutations(int size)
|
static java.util.Vector<int[]> |
generateAllPermutations(int size,
int distance,
boolean isLinear)
|
static int[] |
getIdentityPermutation(int size)
Generates the identity permutation of a given size |
static boolean |
isValidPermutation(int[] permutation,
boolean isLinear)
Tests whether the permutation is valid |
static int[] |
mapPermutation(int[] origin,
int[] target)
Maps the origin permutation, respecting a direct map between the target and the identity permutation |
static int |
OLD_calculateSignedReversalDistance(int[] origin,
int[] target,
boolean isLinear)
Calculates the reversal distance between the given origin and target signed permutations |
static int[][] |
revertSigned(int[] permutation,
int[] positions,
int start,
int end,
boolean isLinear)
Make a new permutation, by reverting the permutation between the specified positions |
static int[] |
revertSigned(int[] permutation,
int start,
int end,
boolean isLinear)
Make a new permutation, by reverting the permutation between the specified positions |
static int[] |
revertUnsigned(int[] permutation,
int start,
int end,
boolean isLinear)
Make a new permutation, by reverting the permutation between the specified positions |
static int[] |
transpose(int[] permutation,
int start,
int middle,
int end)
Make a new permutation, by transposing blocks at the permutation between the specified positions |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PermutationUtil()
Method Detail |
---|
public static int[] getIdentityPermutation(int size)
size
- the given size
public static boolean isValidPermutation(int[] permutation, boolean isLinear)
permutation
- the given permutation
public static java.util.Vector<int[]> collapse(int[] permutation, boolean isLinear)
permutation
- the given permutationisLinear
-
public static int[] collapseBk(int[] permutation, boolean isLinear)
permutation
- the given permutationisLinear
-
public static int[] mapPermutation(int[] origin, int[] target)
origin
- the origin permutationtarget
- the target permutation
public static java.util.Hashtable<java.lang.String,java.lang.Integer> canonizePermutations(java.util.Vector<java.lang.String> origin, java.util.Vector<java.lang.String> target)
origin
- the origin permutationtarget
- the target permutation
public static int[] revertSigned(int[] permutation, int start, int end, boolean isLinear)
start
- the beginning of the reversion blockend
- the end of the reversion block
public static int[][] revertSigned(int[] permutation, int[] positions, int start, int end, boolean isLinear)
start
- the beginning of the reversion blockend
- the end of the reversion block
public static int[] revertUnsigned(int[] permutation, int start, int end, boolean isLinear)
start
- the beginning of the reversion blockend
- the end of the reversion block
public static int[] transpose(int[] permutation, int start, int middle, int end)
start
- the beginning of the first blockmiddle
- the end of the first block / beginning of the second blockend
- the end of the second block
public static int calculateSignedReversalDistance(int[] permutation)
permutation
- the origin permutation, as an array of int
public static int calculateSignedReversalDistance(int[] permutation, boolean isLinear)
permutation
- the origin permutation, as an array of intisLinear
- indicates whether the permutation is linear or circular
public static int calculateSignedReversalDistance(int[] origin, int[] target)
origin
- the origin permutation, as an array of inttarget
- the target permutation, as an array of int
public static int calculateSignedReversalDistance(int[] origin, int[] target, boolean isLinear)
origin
- the origin permutation, as an array of inttarget
- the target permutation, as an array of intisLinear
- indicates whether the permutation is linear or circular
public static boolean containsUnorientedComponent(int[] permutation, boolean isLinear)
permutation
- the origin permutation, as an array of intisLinear
- indicates whether the permutation is linear or circular
public static int OLD_calculateSignedReversalDistance(int[] origin, int[] target, boolean isLinear)
origin
- the origin permutation, as an array of inttarget
- the target permutation, as an array of intisLinear
- indicates whether the permutation is linear or circular
public static java.util.Vector<int[]> generateAllPermutations(int size)
public static java.util.Vector<int[]> generateAllPermutations(int size, int distance, boolean isLinear)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |