org.utgenome.gwt.utgb.client.track
Class TrackWindow
java.lang.Object
org.utgenome.gwt.utgb.client.track.TrackWindow
- All Implemented Interfaces:
- Serializable, Comparable<TrackWindow>
public class TrackWindow
- extends Object
- implements Serializable, Comparable<TrackWindow>
TrackWindow
manages a track-window size and a region on the genome displayed in the window. An instance of
TrackWindow is immutable, so you can safely copy a reference of TrackWindow to preserve a current track window state.
- Author:
- leo
- See Also:
- Serialized Form
TrackWindow
public TrackWindow()
TrackWindow
public TrackWindow(int pixelWidth,
int startIndexOnGenome,
int endIndexOnGenome)
TrackWindow
public TrackWindow(TrackWindow other)
convertToPixelX
public int convertToPixelX(int indexOnGenome)
- calculate the X position (pixel address) in a track window of a given index on genome.
- Parameters:
indexOnGenome
-
- Returns:
- relative X position in a window (0 origin).
convertToPixelXDouble
public double convertToPixelXDouble(int indexOnGenome)
convertToGenomePosition
public int convertToGenomePosition(int xOnWindow)
- Parameters:
xOnWindow
- calculate the genome index of a given x position in the current window
- Returns:
- genome position
convertToPixelLength
public int convertToPixelLength(int rangeOnGenome)
getPixelLengthPerBase
public double getPixelLengthPerBase()
- Returns:
- pixel length / (genome end - genome start);
getPixelWidth
public int getPixelWidth()
- Returns:
- the window size
getSequenceLength
public int getSequenceLength()
- Returns:
- the sequence width
getViewStartOnGenome
public int getViewStartOnGenome()
getViewEndOnGenome
public int getViewEndOnGenome()
getStartOnGenome
public int getStartOnGenome()
- Returns:
- start position on the genome currently displayed in the window
getEndOnGenome
public int getEndOnGenome()
- Returns:
- end position on the genome currently displayed in the window
sameRangeWith
public boolean sameRangeWith(TrackWindow window)
isReverseStrand
public boolean isReverseStrand()
isPositiveStrand
public boolean isPositiveStrand()
newWindow
public TrackWindow newWindow(int newStartOnGenome,
int newEndOnGenome)
scroll
public TrackWindow scroll(int startDiff)
newPixelWidthWindow
public TrackWindow newPixelWidthWindow(int pixelSize)
contains
public boolean contains(TrackWindow other)
overlapWith
public boolean overlapWith(GenomeRange g)
overlapWith
public boolean overlapWith(TrackWindow other)
hasSameScaleWith
public boolean hasSameScaleWith(TrackWindow other)
mask
public TrackWindow mask(TrackWindow mask)
compareTo
public int compareTo(TrackWindow o)
- Specified by:
compareTo
in interface Comparable<TrackWindow>
equals
public boolean equals(Object o)
- Overrides:
equals
in class Object
center
public int center()
hashCode
public int hashCode()
- Overrides:
hashCode
in class Object
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2007-2012 utgenome.org. All Rights Reserved.