Package psidev.psi.mi.jami.utils
Class RangeUtils
- java.lang.Object
-
- psidev.psi.mi.jami.utils.RangeUtils
-
public class RangeUtils extends Object
Utility methods for Ranges- Since:
11/02/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description RangeUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
areRangePositionsOverlapping(Range range)
Checks if the interval positions of the range are overlappingstatic boolean
areRangeStatusInconsistent(Range range)
areRangeStatusInconsistentstatic String
convertRangeToString(Range range)
Converts a range in a String.static Range
createCertainRange(int position)
createCertainRangestatic Range
createCertainRange(int start, int end)
createCertainRangestatic Range
createCTerminalRange()
createCTerminalRangestatic Range
createCTerminusRange(int lastPosition)
createCTerminusRangestatic Range
createFuzzyRange(int position)
createFuzzyRangestatic Range
createFuzzyRange(int start, int end)
createFuzzyRangestatic Range
createFuzzyRange(int fromStart, int fromEnd, int toStart, int toEnd)
createFuzzyRangestatic Range
createGreaterThanRange(int position)
createGreaterThanRangestatic Range
createGreaterThanRange(int start, int end)
createGreaterThanRangestatic Range
createLessThanRange(int position)
createLessThanRangestatic Range
createLessThanRange(int start, int end)
createLessThanRangestatic Range
createLinkedCertainRange(int position)
createLinkedCertainRangestatic Range
createLinkedCertainRange(int start, int end)
createLinkedCertainRangestatic Range
createLinkedFuzzyRange(int position)
createLinkedFuzzyRangestatic Range
createLinkedFuzzyRange(int start, int end)
createLinkedFuzzyRangestatic Range
createLinkedFuzzyRange(int fromStart, int fromEnd, int toStart, int toEnd)
createLinkedFuzzyRangestatic Range
createLinkedRaggedNTerminusRange(int position)
createLinkedRaggedNTerminusRangestatic Range
createLinkedRaggedNTerminusRange(int start, int end)
createLinkedRaggedNTerminusRangestatic Range
createLinkedRange(String statusName, String statusMi, int position)
createLinkedRangestatic Range
createLinkedRange(String statusName, String statusMi, int start, int end)
createLinkedRangestatic Range
createNTerminalRange()
createNTerminalRangestatic Range
createNTerminusRange()
createNTerminusRangestatic Range
createRaggedNTerminusRange(int position)
createRaggedNTerminusRangestatic Range
createRaggedNTerminusRange(int start, int end)
createRaggedNTerminusRangestatic Range
createRange(String statusName, String statusMi, int position)
createRangestatic Range
createRange(String statusName, String statusMi, int start, int end)
createRangestatic Range
createRangeFromString(String rangeString)
Create a Range from a Stringstatic Range
createRangeFromString(String rangeString, boolean linked)
Create a range with a given linked property from a Stringstatic Range
createUndeterminedRange()
createUndeterminedRangestatic String
extractRangeSequence(Range range, String sequence)
Extract a sub-sequence from the sequence given a Range objectstatic List<String>
validateRange(Range range, String sequence)
Method to check if the range is valid or not.
-
-
-
Method Detail
-
convertRangeToString
public static String convertRangeToString(Range range)
Converts a range in a String. Undetermined position is represented with ? N-terminal range is represented with n C-terminal range is represented with c fuzzy ranges are represented with x1..x2
-
createRangeFromString
public static Range createRangeFromString(String rangeString) throws IllegalRangeException
Create a Range from a String- Parameters:
rangeString
- aString
object.- Returns:
- a
Range
object. - Throws:
IllegalRangeException
- if any.
-
createRangeFromString
public static Range createRangeFromString(String rangeString, boolean linked) throws IllegalRangeException
Create a range with a given linked property from a String- Parameters:
rangeString
- aString
object.linked
- a boolean.- Returns:
- a
Range
object. - Throws:
IllegalRangeException
- if any.
-
validateRange
public static List<String> validateRange(Range range, String sequence)
Method to check if the range is valid or not. If the range is valid, the method returns null otherwise it returns a message.- Parameters:
range
- : the range to checksequence
- : the sequence of the polymer- Returns:
- empty list if the range is within the sequence, coherent with its fuzzy type and not overlapping. If the range is not valid, it will return a list of error messages describing why the range is invalid
-
areRangePositionsOverlapping
public static boolean areRangePositionsOverlapping(Range range)
Checks if the interval positions of the range are overlapping- Parameters:
range
- aRange
object.- Returns:
- true if the range intervals are overlapping
-
areRangeStatusInconsistent
public static boolean areRangeStatusInconsistent(Range range)
areRangeStatusInconsistent
- Parameters:
range
- : the range to check- Returns:
- true if the range status are inconsistent (n-terminal is the end, c-terminal is the beginning)
-
createUndeterminedRange
public static Range createUndeterminedRange()
createUndeterminedRange
- Returns:
- a
Range
object.
-
createNTerminalRange
public static Range createNTerminalRange()
createNTerminalRange
- Returns:
- a
Range
object.
-
createCTerminalRange
public static Range createCTerminalRange()
createCTerminalRange
- Returns:
- a
Range
object.
-
createNTerminusRange
public static Range createNTerminusRange()
createNTerminusRange
- Returns:
- a
Range
object.
-
createCTerminusRange
public static Range createCTerminusRange(int lastPosition)
createCTerminusRange
- Parameters:
lastPosition
- a int.- Returns:
- a
Range
object.
-
createCertainRange
public static Range createCertainRange(int position)
createCertainRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createLinkedCertainRange
public static Range createLinkedCertainRange(int position)
createLinkedCertainRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createGreaterThanRange
public static Range createGreaterThanRange(int position)
createGreaterThanRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createLessThanRange
public static Range createLessThanRange(int position)
createLessThanRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createRaggedNTerminusRange
public static Range createRaggedNTerminusRange(int position)
createRaggedNTerminusRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createLinkedRaggedNTerminusRange
public static Range createLinkedRaggedNTerminusRange(int position)
createLinkedRaggedNTerminusRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createFuzzyRange
public static Range createFuzzyRange(int position)
createFuzzyRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createCertainRange
public static Range createCertainRange(int start, int end)
createCertainRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createLinkedFuzzyRange
public static Range createLinkedFuzzyRange(int position)
createLinkedFuzzyRange
- Parameters:
position
- a int.- Returns:
- a
Range
object.
-
createLinkedCertainRange
public static Range createLinkedCertainRange(int start, int end)
createLinkedCertainRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createGreaterThanRange
public static Range createGreaterThanRange(int start, int end)
createGreaterThanRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createLessThanRange
public static Range createLessThanRange(int start, int end)
createLessThanRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createRaggedNTerminusRange
public static Range createRaggedNTerminusRange(int start, int end)
createRaggedNTerminusRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createFuzzyRange
public static Range createFuzzyRange(int start, int end)
createFuzzyRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createFuzzyRange
public static Range createFuzzyRange(int fromStart, int fromEnd, int toStart, int toEnd)
createFuzzyRange
- Parameters:
fromStart
- a int.fromEnd
- a int.toStart
- a int.toEnd
- a int.- Returns:
- a
Range
object.
-
createLinkedRaggedNTerminusRange
public static Range createLinkedRaggedNTerminusRange(int start, int end)
createLinkedRaggedNTerminusRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createLinkedFuzzyRange
public static Range createLinkedFuzzyRange(int start, int end)
createLinkedFuzzyRange
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Range
object.
-
createLinkedFuzzyRange
public static Range createLinkedFuzzyRange(int fromStart, int fromEnd, int toStart, int toEnd)
createLinkedFuzzyRange
- Parameters:
fromStart
- a int.fromEnd
- a int.toStart
- a int.toEnd
- a int.- Returns:
- a
Range
object.
-
createRange
public static Range createRange(String statusName, String statusMi, int position)
createRange
-
createLinkedRange
public static Range createLinkedRange(String statusName, String statusMi, int position)
createLinkedRange
-
createRange
public static Range createRange(String statusName, String statusMi, int start, int end)
createRange
-
createLinkedRange
public static Range createLinkedRange(String statusName, String statusMi, int start, int end)
createLinkedRange
-
-