sub track_ruler
{
- my ( $cookie, # browser cookie
+ # Martin A. Hansen, November 2009.
+
+ # Create a track with a ruler of tics and positions for
+ # the browser window.
+
+ my ( $cookie, # browser cookie
) = @_;
+ # Returns a list.
+
my ( $beg, $end, $factor, $step, $i, $txt, $x, @ruler );
$beg = $cookie->{ 'NAV_START' };
$step = 10;
- while ( ( $end - $beg ) / $step > 20 )
- {
+ while ( ( $end - $beg ) / $step > 20 ) {
$step *= 5;
}
{
if ( ( $i % $step ) == 0 )
{
- $txt = Maasha::Calc::commify( $i ) . "|";
+ $txt = Maasha::Calc::commify( $i ) . "|"; # TODO reverse this so |123 instead of 123|
$x = sprintf( "%.0f", ( $i - $beg - length $txt ) * $factor );
if ( $x > 0 and $x + ( $cookie->{ 'RULER_FONT_SIZE' } * length $txt ) < $cookie->{ 'IMG_WIDTH' } )
sub track_seq
{
+ # Martin A. Hansen, November 2009.
+
+ # Create a sequence track by extracting the appropriate
+ # stretch of sequence from the sequence file.
+
my ( $cookie, # browser cookie
) = @_;
+ # Returns a list.
+
my ( $file, $fh, $seq, @chars, $factor, $i, @seq_list );
if ( $cookie->{ 'NAV_END' } - $cookie->{ 'NAV_START' } + 1 <= 220 )
sub track_feature
{
- my ( $track,
- $cookie,
+ # Martin A. Hansen, November 2009.
+
+ # Create a track with features. If there are more than $cookie->FEAT_MAX
+ # features the track created will be a histogram, else linear.
+
+ my ( $track, # path to kiss file with track data
+ $cookie, # cookie hash
) = @_;
# Returns a list.
$cookie->{ 'TRACK_OFFSET' } += 10;
- if ( $count > 5000 )
+ if ( $count > $cookie->{ 'FEAT_MAX' } )
{
$entries = Maasha::KISS::kiss_index_get_blocks( $index, $start, $end );
push @{ $features }, track_feature_histogram( $cookie, $start, $end, $entries );
sub track_feature_linear
{
+ # Martin A. Hansen, November 2009.
+
+ # Create a linear feature track where the granularity depends
+ # on the lenght of the features and the browser window width.
+
my ( $cookie, # hashref with image draw metrics
$beg, # base window beg
$end, # base window end
sub feature_align
{
- # 17:A>T
+ # Martin A. Hansen, November 2009.
+
+ # Add to feature track alignment info if the granularity is
+ # sufficient.
+ # TODO: The printing of chars is imprecise.
my ( $entry, # Partial KISS entry
$beg, # base window beg
sub track_feature_histogram
{
+ # Martin A. Hansen, November 2009.
+
+ # Create a feature track as a histogram using information
+ # from the index only thus avoiding to load features from the
+ # file.
+
my ( $cookie, # hashref with image draw metrics
- $min, # minimum base position
- $max, # maximum base position
- $blocks, # list of blocks
+ $min, # minimum base position
+ $max, # maximum base position
+ $blocks, # list of blocks
) = @_;
# Returns a list.
sub path_seq
{
- my ( $cookie,
+ # Martin A. Hansen, November 2009.
+
+ # Returns the path to the sequence file for a specified
+ # contig as written in the cookie.
+
+ my ( $cookie, # cookie hash
) = @_;
# Returns a string.
sub path_tracks
{
- my ( $cookie,
+ # Martin A. Hansen, November 2009.
+
+ # Returns a list of paths to all tracks for a specified
+ # contig as written in the cookie.
+
+ my ( $cookie, # cookie path
) = @_;
# Returns a list.
- #
+
my ( $path, @tracks );
die qq(ERROR: no USER in cookie.\n) if not $cookie->{ 'USER' };