Package org.biojava.nbio.structure
Class ResidueRangeAndLength
java.lang.Object
org.biojava.nbio.structure.ResidueRange
org.biojava.nbio.structure.ResidueRangeAndLength
- Direct Known Subclasses:
AugmentedResidueRange
A chain, a start residue, and an end residue.
Also stores a length. Because of insertion codes, this length is not necessarily
end − start
.-
Field Summary
Fields inherited from class org.biojava.nbio.structure.ResidueRange
CHAIN_REGEX, RANGE_REGEX
-
Constructor Summary
ConstructorDescriptionResidueRangeAndLength
(String chain, String start, String end, int length) ResidueRangeAndLength
(String chain, ResidueNumber start, ResidueNumber end, int length) -
Method Summary
Modifier and TypeMethodDescriptionstatic int
Calculates the combined number of residues of the ResidueRanges inrrs
.boolean
int
int
hashCode()
iterator
(AtomPositionMap map) Returns a new Iterator over everyResidueNumber
in this ResidueRange.static ResidueRangeAndLength
parse
(String s, AtomPositionMap map) Parses a residue range.static List<ResidueRangeAndLength>
parseMultiple
(String s, AtomPositionMap map) static List<ResidueRangeAndLength>
parseMultiple
(List<String> ranges, AtomPositionMap map) Methods inherited from class org.biojava.nbio.structure.ResidueRange
contains, getChainId, getEnd, getResidue, getStart, multiIterator, multiIterator, parse, parseMultiple, parseMultiple, toString, toString, toStrings
-
Constructor Details
-
ResidueRangeAndLength
-
ResidueRangeAndLength
-
-
Method Details
-
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.- Overrides:
iterator
in classResidueRange
-
calcLength
Calculates the combined number of residues of the ResidueRanges inrrs
. 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 thelength
of one or more ResidueRange is null- See Also:
-
parse
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, useResidueRange.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
-
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
.
-
getLength
public int getLength()- Returns:
- The number of residues in this ResidueRange
-
equals
- Overrides:
equals
in classResidueRange
-
hashCode
public int hashCode()- Overrides:
hashCode
in classResidueRange
-