Пример #1
0
rc_t load_consensus_src( con_ctx * sctx, KDirectory * hdf5_src )
{
    BaseCalls_cmn ConsensusTab;

    rc_t rc = 0;
    if ( sctx->lctx->check_src_obj )
        rc = check_src_objects( hdf5_src, consensus_groups_to_check, 
                                consensus_tables_to_check, false );
    if ( rc == 0 )
        rc = open_BaseCalls_cmn( hdf5_src, &ConsensusTab, true,
                                 "PulseData/ConsensusBaseCalls", sctx->lctx->cache_content, true );
    if ( rc == 0 )
    {
        uint64_t total_bases = zmw_total( &ConsensusTab.zmw );
        uint64_t total_spots = ConsensusTab.zmw.NumEvent.extents[ 0 ];

        KLogLevel tmp_lvl = KLogLevelGet();
        KLogLevelSet( klogInfo );
        PLOGMSG( klogInfo, ( klogInfo,
                 "loading consensus-table ( $(bases) bases / $(spots) spots ):",
                 "bases=%lu,spots=%lu", total_bases, total_spots ));
        KLogLevelSet( tmp_lvl );

        if ( !check_Consensus_totalcount( &ConsensusTab, total_bases ) )
            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
        else
            rc = zmw_for_each( &ConsensusTab.zmw, &sctx->lctx->xml_progress, sctx->cursor,
                               sctx->lctx->with_progress, sctx->col_idx, NULL,
                               true, consensus_load_spot, &ConsensusTab );
        close_BaseCalls_cmn( &ConsensusTab );
    }
    return rc;
}
Пример #2
0
rc_t load_passes( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
{
    rc_t rc = 0;
    if ( lctx->check_src_obj )
        rc = check_src_objects( hdf5_src, passes_groups_to_check, 
                                passes_tables_to_check, false );
    if ( rc == 0 )
        rc = load_table( database, hdf5_src, lctx, passes_schema_template, 
                         passes_table_to_create, passes_loader );
    return rc;
}
Пример #3
0
rc_t load_consensus( ld_context *lctx, bool cache_content, bool check_src_obj )
{
    rc_t rc = 0;
    if ( check_src_obj )
        rc = check_src_objects( lctx->hdf5_dir, consensus_groups_to_check, 
                                consensus_tables_to_check, false );
    if ( rc == 0 )
        rc = load_table( lctx, consensus_schema_template, 
                         consensus_table_to_create, consensus_loader, cache_content );
    return rc;
}
Пример #4
0
rc_t load_seq( VDatabase * database, KDirectory * hdf5_src, ld_context *lctx )
{
    rc_t rc = 0;
    if ( lctx->check_src_obj )
        rc = check_src_objects( hdf5_src, seq_groups_to_check, seq_tables_to_check, true );
    if ( rc == 0 )
        /* in pl-tools.c */
        rc = load_table( database, hdf5_src, lctx, seq_schema_template, 
                         seq_table_to_create, seq_loader );
    return rc;
}
Пример #5
0
rc_t rgn_open( const KDirectory *hdf5_dir, regions *rgn )
{
    rc_t rc;
    rgn_init( rgn );
    /* check if the necessary groups/tables are there */
    rc = check_src_objects( hdf5_dir, region_groups_to_check, 
                            region_tables_to_check, false );
    if ( rc == 0 )
    {
        /* open the region-table... */
        rc = open_element( hdf5_dir, &rgn->hdf5_regions,
                           region_groups_to_check[ 0 ], "Regions", 
                           REGIONS_BITSIZE, REGIONS_COLS, true, false, true );
        if ( rc == 0 )
            rc = rgn_read_complete_table( rgn );
    }
    if ( rc != 0 )
        rgn_free( rgn );
    return rc;
}
Пример #6
0
rc_t load_passes_src( pas_ctx * sctx, KDirectory * hdf5_src )
{
    Passes_src Passes;
    rc_t rc = 0;

    if ( sctx->lctx->check_src_obj )
        rc = check_src_objects( hdf5_src, passes_groups_to_check, 
                                passes_tables_to_check, false );
    if ( rc == 0 )
        rc = open_Passes_src( hdf5_src, &Passes, "PulseData/ConsensusBaseCalls/Passes",
                               sctx->lctx->cache_content );
    if ( rc == 0 )
    {
        if ( check_Passes_extents( &Passes ) )
            rc = passes_load_loop( sctx->lctx, sctx->cursor, &Passes, sctx->col_idx );
        else
            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
        close_Passes_src( &Passes );
    }
    return rc;
}
Пример #7
0
rc_t load_seq_src( seq_ctx * sctx, KDirectory * hdf5_src )
{
    rc_t rc = 0;
    if ( sctx->lctx->check_src_obj )
        rc = check_src_objects( hdf5_src, seq_groups_to_check, seq_tables_to_check, true );

    if ( rc == 0 && !sctx->src_open )
        rc = open_BaseCalls( hdf5_src, &sctx->BaseCallsTab, "PulseData/BaseCalls", sctx->lctx->cache_content, &sctx->rgn_present );
    if ( rc == 0 )
    {
        /* calculates the total number of bases, according to the zmw-table */
        uint64_t total_bases = zmw_total( &sctx->BaseCallsTab.cmn.zmw );
        /* calculates the total number of spots, according to the zmw-table */
        uint64_t total_spots = sctx->BaseCallsTab.cmn.zmw.NumEvent.extents[ 0 ];

        KLogLevel tmp_lvl = KLogLevelGet();
        KLogLevelSet( klogInfo );
        PLOGMSG( klogInfo, ( klogInfo,
                 "loading sequence-table ( $(bases) bases / $(spots) spots ):",
                 "bases=%lu,spots=%lu", total_bases, total_spots ));
        KLogLevelSet( tmp_lvl );

        /* checks that all tables, which are loaded do have the correct
           number of values (the number that the zmw-table requests) */
        if ( !check_BaseCall_totalcount( &sctx->BaseCallsTab, total_bases ) )
            rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid );
        else
        {
            region_type_mapping mapping;

            if ( sctx->rgn_present )
            {
                const KNamelist *region_types;
                /* read the meta-data-entry "RegionTypes" of the hdf5-regions-table
                   into a KNamelist */
                rc = KArrayFileGetMeta ( sctx->BaseCallsTab.rgn.hdf5_regions.af, "RegionTypes", &region_types );
                if ( rc != 0 )
                {
                    LOGERR( klogErr, rc, "cannot read Regions.RegionTypes" );
                }
                else
                {
                    /* extract the region-type-mapping out of the read KNamelist */
                    rc = rgn_extract_type_mappings( region_types, &mapping, false );
                    KNamelistRelease ( region_types );
                    if ( rc != 0 )
                    {
                        LOGERR( klogErr, rc, "cannot map regions-types" );
                    }
                }
            }

            if ( rc == 0 )
            {
                region_type_mapping *mapping_ptr = NULL;

                if ( sctx->rgn_present )
                    mapping_ptr = &mapping;

                /* call for every spot the function >seq_load_spot< */
                rc = zmw_for_each( &sctx->BaseCallsTab.cmn.zmw, &sctx->lctx->xml_progress, sctx->cursor,
                                   sctx->lctx->with_progress, sctx->col_idx, mapping_ptr, false,
                                   seq_load_spot, &sctx->BaseCallsTab );
            }

            if ( sctx->rgn_present )
                seq_load_info( &sctx->BaseCallsTab.rgn.stat );

            sctx->lctx->total_seq_bases += total_bases;
            sctx->lctx->total_seq_spots += total_spots;
        }   
        close_BaseCalls( &sctx->BaseCallsTab );
        sctx->src_open = false;
    }
    return rc;
}