Package org.biojava.bio.seq.projection
Class ProjectionUtils
java.lang.Object
org.biojava.bio.seq.projection.ProjectionUtils
Some common things you want to do while projecting features.
- Since:
- 1.3
- Author:
- Thomas Down, Matthew Pocock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Location
flipLocation
(Location oldLoc, int translation) Flip a location.static StrandedFeature.Strand
static Location
revertLocation
(Location oldLoc, int translation, boolean oppositeStrand) Revert a location, translating and flipping as required.static Location
transformLocation
(Location oldLoc, int translation, boolean oppositeStrand) Transform a location, translating and flipping as required.
-
Constructor Details
-
ProjectionUtils
public ProjectionUtils()
-
-
Method Details
-
transformLocation
Transform a location, translating and flipping as required.If oppositeStrand is false, this is equivalent to translating the location. If it is true, this is equivalent to flipping it.
- Parameters:
oldLoc
- the Location to transformtranslation
- the translation to applyoppositeStrand
- wether or not this is a flip- Returns:
- the transformed location
-
revertLocation
Revert a location, translating and flipping as required.If oppositeStrand is false, this is equivalent to un-translating the location. If it is true, this is equivalent to (un)flipping it.
- Parameters:
oldLoc
- the Location to reverttranslation
- the translation to unapplyoppositeStrand
- wether or not this is a flip- Returns:
- the reverted location
-
flipLocation
Flip a location.All points
p
map totranslation - p
. Clearly, this mapping is its own inverse. If you wish to flip all locations between 1 and length, you should use a translation of length + 1. In general, if you wish to flip all features between x and y, you should use a translation of x + y.- Parameters:
oldLoc
- the Location to fliptranslation
- the translation to use- Returns:
- the flipped Location
-
flipStrand
-