Esempio n. 1
0
static p_search_result setup_searcher_16_test( char * query_string, char * db_file, size_t hit_count ) {
    set_max_compute_capability( COMPUTE_ON_SSE2 );

    mat_init_constant_scoring( 1, -1 );
    init_symbol_translation( NUCLEOTIDE, FORWARD_STRAND, 3, 3 );

    p_query query = query_read_from_string( query_string );

    s_init( NEEDLEMAN_WUNSCH, BIT_WIDTH_16, query );

    ssa_db_init( concat( "./tests/testdata/", db_file ) );

    gapO = -1;
    gapE = -1;

    adp_init( hit_count );

    p_search_result res = s_search( &hit_count );

    minheap_sort( res->heap );

    query_free( query );

    return res;
}
Esempio n. 2
0
    }END_TEST

static void test_searcher_overflow_to_64bit( int search_type ) {
    init_constant_scores( 127, -1 );
    init_symbol_translation( AMINOACID, FORWARD_STRAND, 3, 3 );
    p_query query = query_read_from_file( "./tests/testdata/NP_009305.1.fas" );

    s_init( search_type, BIT_WIDTH_8, query );

    ssa_db_init( "./tests/testdata/NP_009305.1.fas" );

    gapO = -1;
    gapE = -1;

    size_t hit_count = 1;
    adp_init( hit_count );

    p_search_result res = s_search( &hit_count );

    minheap_sort( res->heap );

    query_free( query );

    ck_assert_int_eq( hit_count, res->heap->count );

    ck_assert_int_eq( 1, res->overflow_8_bit_count );
    ck_assert_int_eq( 1, res->overflow_16_bit_count );

    int result[2] = { 67818, 0 };

    test_result( res, result, 2 );
}
Esempio n. 3
0
    }END_TEST

static p_search_result setup_BLOSUM62_test( int bit_width, int search_type, size_t hit_count ) {
    init_symbol_translation( AMINOACID, FORWARD_STRAND, 3, 3 );
    mat_init_buildin( BLOSUM62 );

    p_query query = query_read_from_string(
            "HPEVYILIIPGFGIISHVVSTYSKKPVFGEISMVYAMASIGLLGFLVWSHHMYIVGLDADTRAYFTSATMIIAIPTGIKI" );

    s_init( search_type, bit_width, query );

    ssa_db_init( concat( "./tests/testdata/", "short_AA.fas" ) );

    gapO = -1;
    gapE = -1;

    adp_init( hit_count );

    p_search_result res = s_search( &hit_count );

    minheap_sort( res->heap );

    query_free( query );

    ck_assert_int_eq( hit_count, res->heap->count );

    return res;
}
Esempio n. 4
0
/** =========================================================================
 */
struct ssa_db *ssa_db_smdb_init(uint64_t guid_to_lid_num_recs,
				uint64_t node_num_recs,
				uint64_t link_num_recs,
				uint64_t port_num_recs,
				uint64_t pkey_num_recs,
				uint64_t lft_top_num_recs,
				uint64_t lft_block_num_recs)
{
	struct ssa_db *p_ssa_db;
	uint64_t num_recs_arr[SSA_TABLE_ID_MAX];
	uint64_t num_field_recs_arr[SSA_TABLE_ID_MAX];
	size_t recs_size_arr[SSA_TABLE_ID_MAX];

	num_recs_arr[SSA_TABLE_ID_SUBNET_OPTS] = 1; /* subnet options - single record */
	num_recs_arr[SSA_TABLE_ID_GUID_TO_LID] = guid_to_lid_num_recs;
	num_recs_arr[SSA_TABLE_ID_NODE] = node_num_recs;
	num_recs_arr[SSA_TABLE_ID_LINK] = link_num_recs;
	num_recs_arr[SSA_TABLE_ID_PORT] = port_num_recs;
	num_recs_arr[SSA_TABLE_ID_PKEY] = pkey_num_recs;
	num_recs_arr[SSA_TABLE_ID_LFT_TOP] = lft_top_num_recs;
	num_recs_arr[SSA_TABLE_ID_LFT_BLOCK] = lft_block_num_recs;

	recs_size_arr[SSA_TABLE_ID_SUBNET_OPTS] = sizeof(struct ep_subnet_opts_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_GUID_TO_LID] = sizeof(struct ep_guid_to_lid_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_NODE] = sizeof(struct ep_node_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_LINK] = sizeof(struct ep_link_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_PORT] = sizeof(struct ep_port_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_PKEY] = sizeof(uint16_t);
	recs_size_arr[SSA_TABLE_ID_LFT_TOP] = sizeof(struct ep_lft_top_tbl_rec);
	recs_size_arr[SSA_TABLE_ID_LFT_BLOCK] = sizeof(struct ep_lft_block_tbl_rec);

	num_field_recs_arr[SSA_TABLE_ID_SUBNET_OPTS] = SSA_FIELD_ID_SUBNET_OPTS_MAX;
	num_field_recs_arr[SSA_TABLE_ID_GUID_TO_LID] = SSA_FIELD_ID_GUID_TO_LID_MAX;
	num_field_recs_arr[SSA_TABLE_ID_NODE] = SSA_FIELD_ID_NODE_MAX;
	num_field_recs_arr[SSA_TABLE_ID_LINK] = SSA_FIELD_ID_LINK_MAX;
	num_field_recs_arr[SSA_TABLE_ID_PORT] = SSA_FIELD_ID_PORT_MAX;
	num_field_recs_arr[SSA_TABLE_ID_PKEY] = DB_VARIABLE_SIZE; /* variabled size records */
	num_field_recs_arr[SSA_TABLE_ID_LFT_TOP] = SSA_FIELD_ID_LFT_TOP_MAX;
	num_field_recs_arr[SSA_TABLE_ID_LFT_BLOCK] = SSA_FIELD_ID_LFT_BLOCK_MAX;

	p_ssa_db = ssa_db_create(num_recs_arr, recs_size_arr, num_field_recs_arr, SSA_TABLE_ID_MAX);

	ssa_db_init(p_ssa_db, "SMDB", 12 /*just some db_id */, def_tbl, dataset_tbl,
		    field_dataset_tbl, field_tbl);

	return p_ssa_db;
}
Esempio n. 5
0
struct ssa_db *ssa_ipdb_create(uint64_t epoch, uint64_t num_recs[IPDB_TBL_ID_MAX])
{
    struct ssa_db *ipdb = NULL;
    uint64_t num_field_recs_arr[IPDB_TBL_ID_MAX] = {};
    size_t recs_size_arr[IPDB_TBL_ID_MAX] = {};

    recs_size_arr[IPDB_TBL_ID_IPv4]	= sizeof(struct ipdb_ipv4);
    recs_size_arr[IPDB_TBL_ID_IPv6]	= sizeof(struct ipdb_ipv6);
    recs_size_arr[IPDB_TBL_ID_NAME]	= sizeof(struct ipdb_name);

    num_field_recs_arr[IPDB_TBL_ID_IPv4] = IPDB_FIELD_ID_IPv4_MAX;
    num_field_recs_arr[IPDB_TBL_ID_IPv6] = IPDB_FIELD_ID_IPv6_MAX;
    num_field_recs_arr[IPDB_TBL_ID_NAME] = IPDB_FIELD_ID_NAME_MAX;

    ipdb = ssa_db_alloc(num_recs, recs_size_arr,
                        num_field_recs_arr, IPDB_TBL_ID_MAX);

    ssa_db_init(ipdb, "IPDB", 11 /*just some db_id */, epoch, ip_def_tbl,
                ip_dataset_tbl, ip_field_dataset_tbl, ip_field_tbl);

    return ipdb;
}
Esempio n. 6
0
static p_search_result setup_searcher_test( int bit_width, int search_type, char * query_string, char * db_file,
        size_t hit_count, int symtype, int strands ) {
    init_symbol_translation( symtype, strands, 3, 3 );
    mat_init_constant_scoring( 1, -1 );
    p_query query = query_read_from_string( query_string );

    s_init( search_type, bit_width, query );

    ssa_db_init( concat( "./tests/testdata/", db_file ) );

    gapO = -1;
    gapE = -1;

    adp_init( hit_count );

    p_search_result res = s_search( &hit_count );

    minheap_sort( res->heap );

    query_free( query );

    return res;
}