Package org.biojava.nbio.structure
Class ResidueRange
java.lang.Object
org.biojava.nbio.structure.ResidueRange
- Direct Known Subclasses:
ResidueRangeAndLength
A chain, a start residue, and an end residue.
Chain may be null when referencing a single-chain structure; for multi-chain
structures omitting the chain is an error. Start and/or end may also be null,
which is interpreted as the first and last residues in the chain, respectively.
- Author:
- dmyerstu
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionResidueRange
(String chain, String start, String end) ResidueRange
(String chain, ResidueNumber start, ResidueNumber end) -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(ResidueNumber residueNumber, AtomPositionMap map) boolean
getEnd()
getResidue
(int positionInRange, AtomPositionMap map) Returns the ResidueNumber that is at positionpositionInRange
in this ResidueRange.getStart()
int
hashCode()
iterator
(AtomPositionMap map) Returns a new Iterator over everyResidueNumber
in this ResidueRange.static Iterator<ResidueNumber>
multiIterator
(AtomPositionMap map, List<? extends ResidueRange> rrs) Returns a new Iterator over everyResidueNumber
in the list of ResidueRanges.static Iterator<ResidueNumber>
multiIterator
(AtomPositionMap map, ResidueRange... rrs) Returns a new Iterator over everyResidueNumber
in the list of ResidueRanges.static ResidueRange
Parse the residue range from a string.static List<ResidueRange>
static List<ResidueRange>
parseMultiple
(List<String> ranges) toString()
static String
toString
(List<? extends ResidueRange> ranges) toStrings
(List<? extends ResidueRange> ranges)
-
Field Details
-
RANGE_REGEX
-
CHAIN_REGEX
-
-
Constructor Details
-
ResidueRange
-
ResidueRange
-
-
Method Details
-
parse
Parse the residue range from a string. Several formats are accepted:- chain.start-end
- chain.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
- Parameters:
s
- residue string to parse- Returns:
- The unique ResidueRange corresponding to
s
-
parseMultiple
- 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:
-
equals
-
getChainId
-
getEnd
-
getStart
-
hashCode
public int hashCode() -
toString
-
getResidue
Returns the ResidueNumber that is at positionpositionInRange
in this ResidueRange.- Returns:
- The ResidueNumber, or false if it does not exist or is not within this ResidueRange
-
contains
- Returns:
- True if and only if
residueNumber
is within this ResidueRange
-
iterator
Returns a new Iterator over everyResidueNumber
in this ResidueRange. Stores the contents ofmap
until the iterator is finished, so calling code should set the iterator tonull
if it did not finish. -
multiIterator
Returns a new Iterator over everyResidueNumber
in the list of ResidueRanges. Stores the contents ofmap
until the iterator is finished, so calling code should set the iterator tonull
if it did not finish. -
multiIterator
public static Iterator<ResidueNumber> multiIterator(AtomPositionMap map, List<? extends ResidueRange> rrs) Returns a new Iterator over everyResidueNumber
in the list of ResidueRanges. Stores the contents ofmap
until the iterator is finished, so calling code should set the iterator tonull
if it did not finish. -
parseMultiple
-
toStrings
-
toString
-