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; }
static void close_BaseCalls( BaseCalls *tab ) { close_BaseCalls_cmn( &tab->cmn ); rgn_free( &tab->rgn ); free_array_file( &tab->PreBaseFrames ); free_array_file( &tab->PulseIndex ); free_array_file( &tab->WidthInFrames ); }
static rc_t consensus_loader( ld_context *lctx, const char * table_name, bool cache_content ) { uint32_t col_idx[ consensus_tab_count ]; rc_t rc = add_columns( lctx->cursor, consensus_tab_count, -1, col_idx, consensus_tab_names ); if ( rc == 0 ) { rc = VCursorOpen( lctx->cursor ); if ( rc != 0 ) LOGERR( klogErr, rc, "cannot open cursor on consensus-table" ); else { BaseCalls_cmn ConsensusTab; const INSDC_SRA_platform_id platform = SRA_PLATFORM_PACBIO_SMRT; rc = VCursorDefault ( lctx->cursor, col_idx[ consensus_tab_PLATFORM ], sizeof platform * 8, &platform, 0, 1 ); if ( rc != 0 ) LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for platform-column" ); else { const INSDC_SRA_read_filter filter = SRA_READ_FILTER_PASS; rc = VCursorDefault ( lctx->cursor, col_idx[ consensus_tab_READ_FILTER ], sizeof filter * 8, &filter, 0, 1 ); if ( rc != 0 ) LOGERR( klogErr, rc, "cannot set cursor-default on consensus-table for read-filter-column" ); } if ( rc == 0 ) rc = open_BaseCalls_cmn( lctx->hdf5_dir, &ConsensusTab, true, "PulseData/ConsensusBaseCalls", 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 = zmw_for_each( &ConsensusTab.zmw, lctx, col_idx, NULL, true, consensus_load_spot, &ConsensusTab ); else rc = RC( rcExe, rcNoTarg, rcAllocating, rcParam, rcInvalid ); close_BaseCalls_cmn( &ConsensusTab ); } } } return rc; }