Package org.biojava.bio.seq.projection
Class ProjectionUtils
- java.lang.Object
-
- org.biojava.bio.seq.projection.ProjectionUtils
-
public class ProjectionUtils extends Object
Some common things you want to do while projecting features.- Since:
- 1.3
- Author:
- Thomas Down, Matthew Pocock
-
-
Constructor Summary
Constructors Constructor Description ProjectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Location
flipLocation(Location oldLoc, int translation)
Flip a location.static StrandedFeature.Strand
flipStrand(StrandedFeature.Strand s)
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 Detail
-
ProjectionUtils
public ProjectionUtils()
-
-
Method Detail
-
transformLocation
public static Location transformLocation(Location oldLoc, int translation, boolean oppositeStrand)
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
public static Location revertLocation(Location oldLoc, int translation, boolean oppositeStrand)
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
public static Location flipLocation(Location oldLoc, int translation)
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
public static StrandedFeature.Strand flipStrand(StrandedFeature.Strand s)
-
-