コード例 #1
0
ファイル: ref_regions.c プロジェクト: Bhumi28/sra-tools
static void merge_close_ranges_and_create_filter( struct reference_region * self, uint64_t merge_diff )
{
    uint32_t n = VectorLength( &self->ranges );
    uint32_t i = 0;
    struct reference_range * a = NULL;
    while ( i < n )
    {
        struct reference_range * b = VectorGet ( &self->ranges, i );
        bool remove = false;
        if ( a != NULL )
        {
            /* get the distance between a and b */
            uint64_t d = range_distance( a, b );
            remove = ( d < merge_diff );
            if ( remove )
            {
                struct reference_range * r;

                /* add the gap to the skip-vector of a */
                struct skip_range * sr = make_skip_range( a->end + 1, b->start - 1 );
                VectorAppend ( &( a->skip ), NULL, sr );

                /* expand a to merge with b */
                a->end = b->end;

                /* remove b */
                VectorRemove ( &self->ranges, i, (void**)&r );
                free( r );
                n--;
            }
        }
        if ( !remove )
        {
            a = b;
            ++i;
        }
    }
}
コード例 #2
0
ファイル: distance.hpp プロジェクト: jhellrung/sake
inline typename ::sake::range_difference< R const >::type
adl(R const & r)
{ return range_distance(r); }