Class CoordMath


  • public class CoordMath
    extends Object
    Static methods that encapsulate the standard SAM way of storing ranges: one-based, with both ends inclusive.
    • Constructor Summary

      Constructors 
      Constructor Description
      CoordMath()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean encloses​(int outerStart, int outerEnd, int innerStart, int innerEnd)
      Returns true if the "inner" coords and totally enclosed by the "outer" coords.
      static int getCycle​(boolean isNegativeStrand, int readLength, int readBaseIndex)
      Determines the read cycle number for the base
      static int getEnd​(int start, int length)  
      static int getLength​(int start, int end)  
      static int getOverlap​(int start, int end, int start2, int end2)
      Determines the amount of overlap between two coordinate ranges.
      static int getStart​(int end, int length)  
      static boolean overlaps​(int start, int end, int start2, int end2)
      Checks to see if the two sets of coordinates have any overlap.
    • Constructor Detail

      • CoordMath

        public CoordMath()
    • Method Detail

      • getLength

        public static int getLength​(int start,
                                    int end)
      • getStart

        public static int getStart​(int end,
                                   int length)
      • getEnd

        public static int getEnd​(int start,
                                 int length)
      • overlaps

        public static boolean overlaps​(int start,
                                       int end,
                                       int start2,
                                       int end2)
        Checks to see if the two sets of coordinates have any overlap.
      • encloses

        public static boolean encloses​(int outerStart,
                                       int outerEnd,
                                       int innerStart,
                                       int innerEnd)
        Returns true if the "inner" coords and totally enclosed by the "outer" coords.
      • getOverlap

        public static int getOverlap​(int start,
                                     int end,
                                     int start2,
                                     int end2)
        Determines the amount of overlap between two coordinate ranges. Assumes that the two ranges actually do overlap and therefore may produce strange results when they do not!
      • getCycle

        public static int getCycle​(boolean isNegativeStrand,
                                   int readLength,
                                   int readBaseIndex)
        Determines the read cycle number for the base
        Parameters:
        isNegativeStrand - true if the read is negative strand
        readLength -
        readBaseIndex - the 0-based index of the read base in question