Class 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 Detail

      • ResidueRangeAndLength

        public ResidueRangeAndLength​(java.lang.String chain,
                                     ResidueNumber start,
                                     ResidueNumber end,
                                     int length)
      • ResidueRangeAndLength

        public ResidueRangeAndLength​(java.lang.String chain,
                                     java.lang.String start,
                                     java.lang.String end,
                                     int length)
    • Method Detail

      • iterator

        public java.util.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​(java.util.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:
        java.lang.IllegalArgumentException - If the length of one or more ResidueRange is null
        See Also:
        getLength()
      • parse

        public static ResidueRangeAndLength parse​(java.lang.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 java.util.List<ResidueRangeAndLength> parseMultiple​(java.lang.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​(java.lang.Object o)
        Overrides:
        equals in class ResidueRange