Class ResidueRange

  • Direct Known Subclasses:
    ResidueRangeAndLength

    public class ResidueRange
    extends java.lang.Object
    A chainName, a start residue, and an end residue. The chainName is matched to Chain.getName(), so for mmCIF files it indicates the authorId rather than the asymId. Chain may be null when referencing a single-chainName structure; for multi-chainName structures omitting the chainName is an error. Start and/or end may also be null, which is interpreted as the first and last residues in the chainName, respectively.
    Author:
    dmyerstu
    See Also:
    ResidueNumber, ResidueRangeAndLength
    • Field Detail

      • RANGE_REGEX

        public static final java.util.regex.Pattern RANGE_REGEX
      • CHAIN_REGEX

        public static final java.util.regex.Pattern CHAIN_REGEX
    • Constructor Detail

      • ResidueRange

        public ResidueRange​(java.lang.String chainName,
                            java.lang.String start,
                            java.lang.String end)
    • Method Detail

      • parse

        public static ResidueRange parse​(java.lang.String s)
        Parse the residue range from a string. Several formats are accepted:
        • chainName.start-end
        • chainName.residue
        • chain_start-end (for better filename compatibility)

        Residues can be positive or negative and may include insertion codes. See ResidueNumber.fromString(String).

        Examples:

        • A:5-100
        • A_5-100
        • A_-5
        • A:-12I-+12I
        • A:^-$
        Parameters:
        s - residue string to parse
        Returns:
        The unique ResidueRange corresponding to s
      • parseMultiple

        public static java.util.List<ResidueRange> parseMultiple​(java.lang.String s)
        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.
        See Also:
        parse(String)
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • getChainName

        public java.lang.String getChainName()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getResidue

        public ResidueNumber getResidue​(int positionInRange,
                                        AtomPositionMap map)
        Returns the ResidueNumber that is at position positionInRange in this ResidueRange.
        Returns:
        The ResidueNumber, or false if it does not exist or is not within this ResidueRange
      • contains

        public boolean contains​(ResidueNumber residueNumber,
                                AtomPositionMap map)
        Returns:
        True if and only if residueNumber is within this ResidueRange
      • 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.
      • multiIterator

        public static java.util.Iterator<ResidueNumber> multiIterator​(AtomPositionMap map,
                                                                      ResidueRange... rrs)
        Returns a new Iterator over every ResidueNumber in the list of ResidueRanges. Stores the contents of map until the iterator is finished, so calling code should set the iterator to null if it did not finish.
      • multiIterator

        public static java.util.Iterator<ResidueNumber> multiIterator​(AtomPositionMap map,
                                                                      java.util.List<? extends ResidueRange> rrs)
        Returns a new Iterator over every ResidueNumber in the list of ResidueRanges. Stores the contents of map until the iterator is finished, so calling code should set the iterator to null if it did not finish.
      • parseMultiple

        public static java.util.List<ResidueRange> parseMultiple​(java.util.List<java.lang.String> ranges)
      • toStrings

        public static java.util.List<java.lang.String> toStrings​(java.util.List<? extends ResidueRange> ranges)
      • toString

        public static java.lang.String toString​(java.util.List<? extends ResidueRange> ranges)