Class PositionUtils


  • public class PositionUtils
    extends Object
    Utility class for Positions
    Since:
    19/12/12
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • PositionUtils

        public PositionUtils()
    • Method Detail

      • isUndetermined

        public static boolean isUndetermined​(Position position)
        Check if a position is undetermined (MI:0339)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isNTerminalRange

        public static boolean isNTerminalRange​(Position position)
        Check if a position is N-terminal range (MI:1040)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isCTerminalRange

        public static boolean isCTerminalRange​(Position position)
        Check if a position is C-terminal range (MI:1039)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isNTerminal

        public static boolean isNTerminal​(Position position)
        Check if a position is N-terminal position (MI:0340)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isCTerminal

        public static boolean isCTerminal​(Position position)
        Check if a position is C-terminal position (MI:0334)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isRaggedNTerminal

        public static boolean isRaggedNTerminal​(Position position)
        Check if a position is ragged N-terminal position (MI:0341)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isFuzzyRange

        public static boolean isFuzzyRange​(Position position)
        Check if a position is fuzzy range (MI:0338)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isGreaterThan

        public static boolean isGreaterThan​(Position position)
        Check if a position is greater-than (MI:0336)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isLessThan

        public static boolean isLessThan​(Position position)
        Check if a position is less-than (MI:0337)
        Parameters:
        position - a Position object.
        Returns:
        a boolean.
      • isCertain

        public static boolean isCertain​(Position position)
        Check if a position is certain (MI:0335)
        Parameters:
        position - a Position 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
        Parameters:
        position - a Position object.
        Returns:
        a String object.
      • 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

        Parameters:
        statusName - a String object.
        statusMi - a String object.
        start - a int.
        Returns:
        a Position object.
      • 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 check
        sequence - : 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 interval
        end - : the end position of the interval
        sequenceLength - : 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 interval
        end - : the end position of the interval
        Returns:
        true if the positions are valid, false otherwise