{
if ( $record->{ "REC_TYPE" } eq "BED" )
{
- $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "CHR" }, $record->{ "CHR_BEG" }, $record->{ "CHR_END" }, $options->{ "flank" } );
}
elsif ( $record->{ "REC_TYPE" } eq "PSL" )
{
- $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
}
elsif ( $record->{ "REC_TYPE" } eq "BLAST" )
{
- $scores = Maasha::UCSC::phastcons_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
+ $scores = Maasha::UCSC::fixedstep_index_lookup( $index, $fh_phastcons, $record->{ "S_ID" }, $record->{ "S_BEG" }, $record->{ "S_END" }, $options->{ "flank" } );
}
$record->{ "PHASTCONS" } = join ",", @{ $scores } if @{ $scores };
use Maasha::Matrix;
use constant {
- CHR_BEG => 0,
- NEXT_CHR_BEG => 1,
+ FS_CHR_BEG => 0,
+ FS_NEXT_CHR_BEG => 1,
+ FS_CHR_END => 2,
+ FS_INDEX_BEG => 3,
+ FS_INDEX_LEN => 4,
+
+ CHR => 0,
+ CHR_BEG => 1,
CHR_END => 2,
- INDEX_BEG => 3,
- INDEX_LEN => 4,
-
- CHR => 0,
- CHR_BEG => 1,
- CHR_END => 2,
- Q_ID => 3,
- SCORE => 4,
- STRAND => 5,
- THICK_BEG => 6,
- THICK_END => 7,
- ITEMRGB => 8,
- BLOCKCOUNT => 9,
- BLOCKSIZES => 10,
- Q_BEGS => 11,
+ Q_ID => 3,
+ SCORE => 4,
+ STRAND => 5,
+ THICK_BEG => 6,
+ THICK_END => 7,
+ ITEMRGB => 8,
+ BLOCKCOUNT => 9,
+ BLOCKSIZES => 10,
+ Q_BEGS => 11,
};
@ISA = qw( Exporter );
foreach $chr ( keys %index )
{
for ( $i = 0; $i < @{ $index{ $chr } } - 1; $i++ ) {
- $index{ $chr }->[ $i ]->[ NEXT_CHR_BEG ] = $index{ $chr }->[ $i + 1 ]->[ 0 ];
+ $index{ $chr }->[ $i ]->[ FS_NEXT_CHR_BEG ] = $index{ $chr }->[ $i + 1 ]->[ 0 ];
}
- $index{ $chr }->[ -1 ]->[ NEXT_CHR_BEG ] = $index{ $chr }->[ -1 ]->[ CHR_END ] + 1;
+ $index{ $chr }->[ -1 ]->[ FS_NEXT_CHR_BEG ] = $index{ $chr }->[ -1 ]->[ FS_CHR_END ] + 1;
}
return wantarray ? %index : \%index;
$chr_beg -= $flank;
$chr_end += $flank;
-# print "chr_beg->$chr_beg chr_end->$chr_end flank->$flank\n";
+ # print "chr_beg->$chr_beg chr_end->$chr_end flank->$flank\n";
if ( exists $index->{ $chr } )
{
if ( $index_beg == $index_end )
{
- $beg = Maasha::Calc::max( $chr_beg, $index->{ $chr }->[ $index_beg ]->[ CHR_BEG ] );
- $end = Maasha::Calc::min( $chr_end, $index->{ $chr }->[ $index_end ]->[ CHR_END ] );
+ $beg = Maasha::Calc::max( $chr_beg, $index->{ $chr }->[ $index_beg ]->[ FS_CHR_BEG ] );
+ $end = Maasha::Calc::min( $chr_end, $index->{ $chr }->[ $index_end ]->[ FS_CHR_END ] );
- if ( $beg <= $index->{ $chr }->[ $index_beg ]->[ CHR_END ] and $end >= $index->{ $chr }->[ $index_beg ]->[ CHR_BEG ] )
+ if ( $beg <= $index->{ $chr }->[ $index_beg ]->[ FS_CHR_END ] and $end >= $index->{ $chr }->[ $index_beg ]->[ FS_CHR_BEG ] )
{
@vals = split "\n", Maasha::Common::file_read(
$fh,
- $index->{ $chr }->[ $index_beg ]->[ INDEX_BEG ] + 6 * ( $beg - $index->{ $chr }->[ $index_beg ]->[ CHR_BEG ] ),
+ $index->{ $chr }->[ $index_beg ]->[ FS_INDEX_BEG ] + 6 * ( $beg - $index->{ $chr }->[ $index_beg ]->[ FS_CHR_BEG ] ),
6 * ( $end - $beg + 1 ),
);
}
}
else
{
- $beg = Maasha::Calc::max( $chr_beg, $index->{ $chr }->[ $index_beg ]->[ CHR_BEG ] );
+ $beg = Maasha::Calc::max( $chr_beg, $index->{ $chr }->[ $index_beg ]->[ FS_CHR_BEG ] );
# print Dumper( $beg, $index->{ $chr }->[ $index_beg ] );
-# print Dumper( "next", $index->{ $chr }->[ $index_beg ]->[ NEXT_CHR_BEG ] );
+# print Dumper( "next", $index->{ $chr }->[ $index_beg ]->[ FS_NEXT_CHR_BEG ] );
# beg next
# v v
# |||||||||.......
- if ( $beg <= $index->{ $chr }->[ $index_beg ]->[ CHR_END ] )
+ if ( $beg <= $index->{ $chr }->[ $index_beg ]->[ FS_CHR_END ] )
{
@vals = split "\n", Maasha::Common::file_read(
$fh,
- $index->{ $chr }->[ $index_beg ]->[ INDEX_BEG ] + 6 * ( $beg - $index->{ $chr }->[ $index_beg ]->[ CHR_BEG ] ),
- 6 * ( $index->{ $chr }->[ $index_beg ]->[ CHR_END ] - $beg + 1 ),
+ $index->{ $chr }->[ $index_beg ]->[ FS_INDEX_BEG ] + 6 * ( $beg - $index->{ $chr }->[ $index_beg ]->[ FS_CHR_BEG ] ),
+ 6 * ( $index->{ $chr }->[ $index_beg ]->[ FS_CHR_END ] - $beg + 1 ),
);
for ( $c = 0; $c < @vals; $c++ ) {
}
}
- $end = Maasha::Calc::min( $chr_end, $index->{ $chr }->[ $index_end ]->[ CHR_END ] );
+ $end = Maasha::Calc::min( $chr_end, $index->{ $chr }->[ $index_end ]->[ FS_CHR_END ] );
- if ( $end <= $index->{ $chr }->[ $index_end ]->[ CHR_END ] )
+ if ( $end <= $index->{ $chr }->[ $index_end ]->[ FS_CHR_END ] )
{
@vals = split "\n", Maasha::Common::file_read(
$fh,
- $index->{ $chr }->[ $index_end ]->[ INDEX_BEG ],
- 6 * ( $end - $index->{ $chr }->[ $index_end ]->[ CHR_BEG ] + 1 ),
+ $index->{ $chr }->[ $index_end ]->[ FS_INDEX_BEG ],
+ 6 * ( $end - $index->{ $chr }->[ $index_end ]->[ FS_CHR_BEG ] + 1 ),
);
for ( $c = 0; $c < @vals; $c++ ) {
- $scores->[ $c + $index->{ $chr }->[ $index_end ]->[ CHR_BEG ] - $chr_beg ] = $vals[ $c ];
+ $scores->[ $c + $index->{ $chr }->[ $index_end ]->[ FS_CHR_BEG ] - $chr_beg ] = $vals[ $c ];
}
}
{
@vals = split "\n", Maasha::Common::file_read(
$fh,
- $index->{ $chr }->[ $i ]->[ INDEX_BEG ],
- 6 * ( $index->{ $chr }->[ $i ]->[ CHR_END ] - $index->{ $chr }->[ $i ]->[ CHR_BEG ] + 1 ),
+ $index->{ $chr }->[ $i ]->[ FS_INDEX_BEG ],
+ 6 * ( $index->{ $chr }->[ $i ]->[ FS_CHR_END ] - $index->{ $chr }->[ $i ]->[ FS_CHR_BEG ] + 1 ),
);
for ( $c = 0; $c < @vals; $c++ ) {
- $scores->[ $c + $index->{ $chr }->[ $i ]->[ CHR_BEG ] - $chr_beg ] = $vals[ $c ];
+ $scores->[ $c + $index->{ $chr }->[ $i ]->[ FS_CHR_BEG ] - $chr_beg ] = $vals[ $c ];
}
}
}