new CGRange(contig, start, stop)
Create a CGRange
Name | Type | Description |
---|---|---|
contig |
Sequence |
The contig that contains the range. The contig provides the contig length |
start |
Number |
The start position. |
stop |
Number |
The stop position. |
Members
-
contigSequence
-
Get the sequence.
-
lengthNumber
-
Get the length of the range.
-
mapStartNumber
-
Get or set the range start using the entire map coordinates.
-
mapStopNumber
-
Get or set the range stop using the entire map coordinates.
-
middleNumber
-
Get the middle of the range.
-
sequenceSequence
-
Get the sequence.
-
startNumber
-
Get or set the range start. Start must be less than Stop unless the contig represents the entire map, in which case, wrapping is allowed. The value will be constrained between the 1 and the contig length.
-
stopNumber
-
Get or set the range stop. Stop must be greater than Start unless the contig represents the entire map, in which case, wrapping is allowed. The value will be constrained between the 1 and the contig length.
Methods
-
containsMapBp(position){Boolean}
-
Return true if the position in inside the range using map coordinates.
Name Type Description position
Number The position to check if it's in the range.
Returns:
Type Description Boolean -
copy(){Range}
-
Returns a copy of the Range.
Returns:
Type Description Range -
getStartPlus(value){Number}
-
Return the start of the range plus the value.
Name Type Description value
Number Number to add.
Returns:
Type Description Number -
getStopPlus(value){Number}
-
Return the stop of the range plus the value.
Name Type Description value
Number Number to add.
Returns:
Type Description Number -
isMapLength(){Boolean}
-
Return true if the range length is the same as the map sequence length
Returns:
Type Description Boolean -
isWrapped(){Boolean}
-
Return true if the range wraps around the end of the contig (ie. the stop is less than the start position)
Returns:
Type Description Boolean -
mergeWithRange(range2){Range}
-
Merge with the supplied range to give the biggest possible range. This may produce unexpected results of the ranges do not overlap. Both ranges must be on the same contig. If not, the CGRange calling this method will be returned.
Name Type Description range2
Range The range to merge with.
Returns:
Type Description Range -
normalize(value){Number}
-
Convert the value to be between the 1 and the contig length. Values will be constrained to the contig unless the Map Sequence only contains a single contig, in which case, values bigger or smaller than the sequence length will be wrappeed around. For example, if sequence length is 1000 and value is 1200, a value of 200 will be returned.
Name Type Description value
Number The number to normalize.
Returns:
Type Description Number -
overHalfMapLength(){Boolean}
-
Return true if the range length is over half the length of the sequence length
Returns:
Type Description Boolean -
overlapsMapRange(range2){Boolwan}
-
Returns true if the range overlaps with range2.
Name Type Description range2
Range The range with which to test overlap.
Returns:
Type Description Boolwan