Class RangeUtils


  • public class RangeUtils
    extends Object
    Utility methods for Ranges
    Since:
    11/02/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • RangeUtils

        public RangeUtils()
    • 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
        Parameters:
        range - a Range object.
        Returns:
        a String object.
      • createRangeFromString

        public static Range createRangeFromString​(String rangeString,
                                                  boolean linked)
                                           throws IllegalRangeException
        Create a range with a given linked property from a String
        Parameters:
        rangeString - a String 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 check
        sequence - : 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 - a Range 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

        Parameters:
        statusName - a String object.
        statusMi - a String object.
        position - a int.
        Returns:
        a Range object.
      • createLinkedRange

        public static Range createLinkedRange​(String statusName,
                                              String statusMi,
                                              int position)

        createLinkedRange

        Parameters:
        statusName - a String object.
        statusMi - a String object.
        position - a int.
        Returns:
        a Range object.
      • createRange

        public static Range createRange​(String statusName,
                                        String statusMi,
                                        int start,
                                        int end)

        createRange

        Parameters:
        statusName - a String object.
        statusMi - a String object.
        start - a int.
        end - a int.
        Returns:
        a Range object.
      • createLinkedRange

        public static Range createLinkedRange​(String statusName,
                                              String statusMi,
                                              int start,
                                              int end)

        createLinkedRange

        Parameters:
        statusName - a String object.
        statusMi - a String object.
        start - a int.
        end - a int.
        Returns:
        a Range object.
      • extractRangeSequence

        public static String extractRangeSequence​(Range range,
                                                  String sequence)
        Extract a sub-sequence from the sequence given a Range object
        Parameters:
        range - a Range object.
        sequence - a String object.
        Returns:
        the sub-sequence, null if the range or sequence is null