Package psidev.psi.mi.jami.utils
Class PositionUtils
- java.lang.Object
-
- psidev.psi.mi.jami.utils.PositionUtils
-
public class PositionUtils extends Object
Utility class for Positions- Since:
19/12/12
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description PositionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
arePositionsOverlapping(long fromStart, long fromEnd, long toStart, long toEnd)
Checks if the interval positions are overlappingstatic boolean
areRangePositionsOutOfBounds(long start, long end, int sequenceLength)
A position is out of bound if superior to the sequence length.static boolean
areRangePositionsValid(long start, long end)
A range interval is invalid if the start is after the endstatic String
convertPositionToString(Position position)
Converts a given position in a String using specific mnemonic for encoding the position statusstatic int
convertStringToPositionValue(String rangeString)
convertStringToPositionValuestatic Position
createCertainPosition(int position)
createCertainPositionstatic Position
createCTerminalPosition(int lastPosition)
createCTerminalPositionstatic Position
createCTerminalRangePosition()
createCTerminalRangePositionstatic Position
createFuzzyPosition(int position)
createFuzzyPositionstatic Position
createFuzzyPosition(int start, int end)
createFuzzyPositionstatic Position
createGreaterThanPosition(int position)
createGreaterThanPositionstatic Position
createLessThanPosition(int position)
createLessThanPositionstatic Position
createNTerminalPosition()
createNTerminalPositionstatic Position
createNTerminalRangePosition()
createNTerminalRangePositionstatic Position
createPosition(String statusName, String statusMi, int start)
createPositionstatic Position
createPositionFromString(String pos)
createPositionFromStringstatic Position
createRaggedNTerminusPosition(int position)
createRaggedNTerminusPositionstatic Position
createUndeterminedPosition()
createUndeterminedPositionstatic boolean
isCertain(Position position)
Check if a position is certain (MI:0335)static boolean
isCTerminal(Position position)
Check if a position is C-terminal position (MI:0334)static boolean
isCTerminalRange(Position position)
Check if a position is C-terminal range (MI:1039)static boolean
isFuzzyRange(Position position)
Check if a position is fuzzy range (MI:0338)static boolean
isGreaterThan(Position position)
Check if a position is greater-than (MI:0336)static boolean
isLessThan(Position position)
Check if a position is less-than (MI:0337)static boolean
isNTerminal(Position position)
Check if a position is N-terminal position (MI:0340)static boolean
isNTerminalRange(Position position)
Check if a position is N-terminal range (MI:1040)static boolean
isRaggedNTerminal(Position position)
Check if a position is ragged N-terminal position (MI:0341)static boolean
isUndetermined(Position position)
Check if a position is undetermined (MI:0339)static List<String>
validateRangePosition(Position position, String sequence)
Check if the positions and the position status are consistent.
-
-
-
Method Detail
-
isUndetermined
public static boolean isUndetermined(Position position)
Check if a position is undetermined (MI:0339)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isNTerminalRange
public static boolean isNTerminalRange(Position position)
Check if a position is N-terminal range (MI:1040)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isCTerminalRange
public static boolean isCTerminalRange(Position position)
Check if a position is C-terminal range (MI:1039)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isNTerminal
public static boolean isNTerminal(Position position)
Check if a position is N-terminal position (MI:0340)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isCTerminal
public static boolean isCTerminal(Position position)
Check if a position is C-terminal position (MI:0334)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isRaggedNTerminal
public static boolean isRaggedNTerminal(Position position)
Check if a position is ragged N-terminal position (MI:0341)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isFuzzyRange
public static boolean isFuzzyRange(Position position)
Check if a position is fuzzy range (MI:0338)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isGreaterThan
public static boolean isGreaterThan(Position position)
Check if a position is greater-than (MI:0336)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isLessThan
public static boolean isLessThan(Position position)
Check if a position is less-than (MI:0337)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
isCertain
public static boolean isCertain(Position position)
Check if a position is certain (MI:0335)- Parameters:
position
- aPosition
object.- Returns:
- a boolean.
-
convertPositionToString
public static String convertPositionToString(Position position)
Converts a given position in a String using specific mnemonic for encoding the position status
-
createUndeterminedPosition
public static Position createUndeterminedPosition()
createUndeterminedPosition
- Returns:
- a
Position
object.
-
createNTerminalRangePosition
public static Position createNTerminalRangePosition()
createNTerminalRangePosition
- Returns:
- a
Position
object.
-
createCTerminalRangePosition
public static Position createCTerminalRangePosition()
createCTerminalRangePosition
- Returns:
- a
Position
object.
-
createNTerminalPosition
public static Position createNTerminalPosition()
createNTerminalPosition
- Returns:
- a
Position
object.
-
createCTerminalPosition
public static Position createCTerminalPosition(int lastPosition)
createCTerminalPosition
- Parameters:
lastPosition
- a int.- Returns:
- a
Position
object.
-
createCertainPosition
public static Position createCertainPosition(int position)
createCertainPosition
- Parameters:
position
- a int.- Returns:
- a
Position
object.
-
createGreaterThanPosition
public static Position createGreaterThanPosition(int position)
createGreaterThanPosition
- Parameters:
position
- a int.- Returns:
- a
Position
object.
-
createLessThanPosition
public static Position createLessThanPosition(int position)
createLessThanPosition
- Parameters:
position
- a int.- Returns:
- a
Position
object.
-
createRaggedNTerminusPosition
public static Position createRaggedNTerminusPosition(int position)
createRaggedNTerminusPosition
- Parameters:
position
- a int.- Returns:
- a
Position
object.
-
createFuzzyPosition
public static Position createFuzzyPosition(int position)
createFuzzyPosition
- Parameters:
position
- a int.- Returns:
- a
Position
object.
-
createFuzzyPosition
public static Position createFuzzyPosition(int start, int end)
createFuzzyPosition
- Parameters:
start
- a int.end
- a int.- Returns:
- a
Position
object.
-
createPosition
public static Position createPosition(String statusName, String statusMi, int start)
createPosition
-
createPositionFromString
public static Position createPositionFromString(String pos) throws IllegalRangeException
createPositionFromString
- Parameters:
pos
- aString
object.- Returns:
- a
Position
object. - Throws:
IllegalRangeException
- if any.
-
convertStringToPositionValue
public static int convertStringToPositionValue(String rangeString) throws IllegalRangeException
convertStringToPositionValue
- Parameters:
rangeString
- aString
object.- Returns:
- a int.
- Throws:
IllegalRangeException
- if any.
-
validateRangePosition
public static List<String> validateRangePosition(Position position, String sequence)
Check if the positions and the position status are consistent.- Parameters:
position
- : the position to checksequence
- : the sequence of the protein- Returns:
- empty list if the range positions and the position status are consistent. If there are some inconsistencies, it will return a list of error messages
-
arePositionsOverlapping
public static boolean arePositionsOverlapping(long fromStart, long fromEnd, long toStart, long toEnd)
Checks if the interval positions are overlapping- Parameters:
fromStart
- a long.fromEnd
- a long.toStart
- a long.toEnd
- a long.- Returns:
- true if the range intervals are overlapping
-
areRangePositionsOutOfBounds
public static boolean areRangePositionsOutOfBounds(long start, long end, int sequenceLength)
A position is out of bound if superior to the sequence length. Inferior to 0 is accepted for describing promotor regions- Parameters:
start
- : the start position of the intervalend
- : the end position of the intervalsequenceLength
- : the length of the sequence, 0 if the sequence is null- Returns:
- true if the start or the end is superior to the sequence length
-
areRangePositionsValid
public static boolean areRangePositionsValid(long start, long end)
A range interval is invalid if the start is after the end- Parameters:
start
- : the start position of the intervalend
- : the end position of the interval- Returns:
- true if the positions are valid, false otherwise
-
-