void scan_seq( char *seq, size_t seq_len, uint *count_array );
void rescan_seq( char *seq, size_t seq_len, uint *count_array, size_t cutoff );
void scan_list( list_sl *list, uint *count_array );
-void rescan_list( list_sl *list, uint *count_array, size_t pos, size_t cutoff );
+void rescan_list( list_sl *list, uint *count_array, size_t pos, size_t cutoff, uint *output_array );
bitblock *bitblock_new();
uint blocks2motif( uchar bin1, uchar bin2, ushort dist );
void count_array_print( uint *count_array, size_t nmemb, size_t cutoff );
node_sl *new_node = NULL;
node_sl *old_node = NULL;
list_sl *list = list_sl_new();
+ uint *output_array = NULL;
+
+ output_array = mem_get_zero( sizeof( uint ) * ( seq_len + 1 ) );
for ( i = 0; seq[ i ]; i++ )
{
{
// bitblock_list_print( list ); /* DEBUG */
- rescan_list( list, count_array, i, cutoff );
+ rescan_list( list, count_array, i, cutoff, output_array );
mem_free( &list->first->val );
{
// bitblock_list_print( list ); /* DEBUG */
- rescan_list( list, count_array, i, cutoff );
+ rescan_list( list, count_array, i, cutoff, output_array );
}
list_sl_destroy( &list );
+
+ for ( i = 0; i < seq_len; i++ ) {
+ printf( "%zu\t%u\n", i, output_array[ i ] );
+ }
+
+ free( output_array );
}
}
-void rescan_list( list_sl *list, uint *count_array, size_t pos, size_t cutoff )
+void rescan_list( list_sl *list, uint *count_array, size_t pos, size_t cutoff, uint *output_array )
{
/* Martin A. Hansen, September 2008 */
bitblock *block1 = NULL;
bitblock *block2 = NULL;
int i = 0;
+ int k = 0;
ushort dist = 0;
uint motif_bin = 0;
uint j = 0;
count = count_array[ motif_bin ];
- if ( count > cutoff ) {
- printf( "%zu\t%u\t%u\n", pos + j, motif_bin, count );
+ if ( count > cutoff )
+ {
+ // printf( "%zu\t%u\t%u\n", pos + j, motif_bin, count );
+
+ for ( k = 0; k < BLOCK_SIZE_NT - 1; k++ )
+ {
+ output_array[ pos - j + k - BLOCK_SIZE_NT ] += count;
+ output_array[ pos + k - dist - BLOCK_SIZE_NT ] += count;
+ }
}
}
group|g=s
priority|p=f
use_score|u
- visibility|v=s
+ visibility|V=s
color|c=s
chunk_size|C=s
);
push @options, qw(
stream_in|I=s
stream_out|O=s
- verbose
+ verbose|v
help|?
);
$phastcons_file = Maasha::Config::genome_phastcons( $options->{ "genome" } );
$phastcons_index = Maasha::Config::genome_phastcons_index( $options->{ "genome" } );
- $index = Maasha::UCSC::phastcons_index_retrieve( $phastcons_index );
+ $index = Maasha::UCSC::fixedstep_index_retrieve( $phastcons_index );
$fh_phastcons = Maasha::Common::read_open( $phastcons_file );
while ( $record = get_record( $in ) )
{
if ( $record->{ "CHR" } and $record->{ "CHR_BEG" } and $record->{ "CHR_END" } )
{
- $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" } );
push @{ $AoA }, [ @{ $scores } ];
}