Class ResidueRangeAndLength

java.lang.Object
org.biojava.nbio.structure.ResidueRange
org.biojava.nbio.structure.ResidueRangeAndLength
Direct Known Subclasses:
AugmentedResidueRange

public class ResidueRangeAndLength extends ResidueRange
A chain, a start residue, and an end residue. Also stores a length. Because of insertion codes, this length is not necessarily end − start.
  • Constructor Details

  • Method Details

    • iterator

      public Iterator<ResidueNumber> iterator(AtomPositionMap map)
      Returns a new Iterator over every ResidueNumber in this ResidueRange. Stores the contents of map until the iterator is finished, so calling code should set the iterator to null if it did not finish.
      Overrides:
      iterator in class ResidueRange
    • calcLength

      public static int calcLength(List<ResidueRangeAndLength> rrs)
      Calculates the combined number of residues of the ResidueRanges in rrs. Assumes no overlap. If two or more ranges cover the same residues, will over-count the union of the residues.
      Parameters:
      rrs - A list of ResidueRanges
      Returns:
      The combined length
      Throws:
      IllegalArgumentException - If the length of one or more ResidueRange is null
      See Also:
    • parse

      public static ResidueRangeAndLength parse(String s, AtomPositionMap map)
      Parses a residue range. The AtomPositionMap is used to calculate the length and fill in missing information, such as for whole chains ('A:'). Supports the special chain name '_' for single-chain structures. If residues are specified outside of the range given in the map, attempts to decrease the input range to valid values. In extreme cases where this process fails fails to find any valid indices, returns null. For a function which more conservatively represents the input range, without chain inference and error fixes, use ResidueRange.parse(String).
      Parameters:
      s - A string of the form chain_start-end. For example: A.5-100.
      Returns:
      The unique ResidueRange corresponding to s.
    • parseMultiple

      public static List<ResidueRangeAndLength> parseMultiple(List<String> ranges, AtomPositionMap map)
    • parseMultiple

      public static List<ResidueRangeAndLength> parseMultiple(String s, AtomPositionMap map)
      Parameters:
      s - A string of the form chain_start-end,chain_start-end, ... For example: A.5-100,R_110-190,Z_200-250.
      Returns:
      The unique ResidueRange corresponding to s.
    • getLength

      public int getLength()
      Returns:
      The number of residues in this ResidueRange
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class ResidueRange
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class ResidueRange