static rc_t vdb_info_print_xml_uint64( const char * tag, const uint64_t value ) { if ( value != 0 ) return KOutMsg( "<%s>%lu<%s>\n", tag, value, tag ); else return 0; }
rc_t CC Usage (const Args * args) { const char * progname = UsageDefaultName; const char * fullpath = UsageDefaultName; rc_t rc; if (args == NULL) rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull); else rc = ArgsProgram (args, &fullpath, &progname); UsageSummary (progname); KOutMsg ("\n" "Option:\n"); HelpOptionLine (ALIAS_FORCE, OPTION_FORCE, NULL, force_usage); HelpOptionLine (ALIAS_PRESERVE, OPTION_PRESERVE, NULL, preserve_usage); HelpOptionLine (ALIAS_RECURSE, OPTION_RECURSE, NULL, recurse_usage); HelpOptionLine (ALIAS_TEST, OPTION_TEST, NULL, test_usage); HelpOptionsStandard (); HelpVersion (fullpath, KAppVersion()); return rc; }
static rc_t vdb_info_print_json_s( const char * tag, const char * value ) { if ( value[ 0 ] != 0 ) return KOutMsg( "\"%s\":\"%s\",\n", tag, value ); else return 0; }
static rc_t copy_metadata_attribs ( const KMDataNode *snode, KMDataNode *dnode, const char *node_path, const bool show_meta ) { KNamelist *attrs; uint32_t i, count; rc_t rc = KMDataNodeListAttr ( snode, & attrs ); DISP_RC( rc, "copy_metadata_child:KMDataNodeListAttr(src) failed" ); if ( rc != 0 ) return rc; rc = KNamelistCount ( attrs, & count ); for ( i = 0; rc == 0 && i < count; ++ i ) { const char *attr; rc = KNamelistGet ( attrs, i, & attr ); if ( rc == 0 ) { char buffer [ 1024 ]; size_t bytes; /* test for attr existence */ rc = KMDataNodeReadAttr ( dnode, attr, buffer, sizeof buffer, & bytes ); if ( rc != 0 ) { rc = KMDataNodeReadAttr ( snode, attr, buffer, sizeof buffer, & bytes ); if ( rc == 0 ) { if ( show_meta ) KOutMsg( "copy atr %s : %s\n", node_path, attr ); rc = KMDataNodeWriteAttr ( dnode, attr, buffer ); } } } DISP_RC( rc, "copy_metadata_child:failed to copy attribute" ); } KNamelistRelease ( attrs ); return rc; }
static rc_t vdb_info_print_xml_s( const char * tag, const char * value ) { if ( value[ 0 ] != 0 ) return KOutMsg( "<%s>%s</%s>\n", tag, value, tag ); else return 0; }
static rc_t CC pileup_v2_exit_ref_pos( ref_walker_data * rwd ) { pileup_v2_ctx * ctx = rwd->data; rc_t rc = KOutMsg( "%s\t%u\t%c\t%u\t", rwd->ref_name, rwd->pos + 1, rwd->ascii_ref_base, rwd->depth ); if ( rc == 0 ) rc = print_dyn_string( ctx->bases ); if ( rc == 0 && ctx->print_qual ) { rc = KOutMsg( "\t" ); if ( rc == 0 ) rc = print_dyn_string( ctx->qual ); } if ( rc == 0 ) rc = KOutMsg( "\n" ); return rc; }
static rc_t enter_vdbcopy_node( KMetadata *dst_meta, const bool show_meta ) { rc_t rc; KMDataNode *hist_node; if ( show_meta ) KOutMsg( "--- entering Copy entry...\n" ); rc = KMetadataOpenNodeUpdate ( dst_meta, &hist_node, "HISTORY" ); DISP_RC( rc, "enter_vdbcopy_node:KMetadataOpenNodeUpdate('HISTORY') failed" ); if ( rc == 0 ) { char event_name[ 32 ]; uint32_t index = get_child_count( hist_node ) + 1; rc = string_printf ( event_name, sizeof( event_name ), NULL, "EVENT_%u", index ); DISP_RC( rc, "enter_vdbcopy_node:string_printf(EVENT_NR) failed" ); if ( rc == 0 ) { KMDataNode *event_node; rc = KMDataNodeOpenNodeUpdate ( hist_node, &event_node, event_name ); DISP_RC( rc, "enter_vdbcopy_node:KMDataNodeOpenNodeUpdate('EVENT_NR') failed" ); if ( rc == 0 ) { rc = enter_date_name_vers( event_node ); KMDataNodeRelease ( event_node ); } } KMDataNodeRelease ( hist_node ); } return rc; }
rc_t CC Usage (const Args * args) { const char * progname = UsageDefaultName; const char * fullpath = UsageDefaultName; rc_t rc; if (args == NULL) rc = RC (rcApp, rcArgv, rcAccessing, rcSelf, rcNull); else rc = ArgsProgram (args, &fullpath, &progname); if (rc) progname = fullpath = UsageDefaultName; UsageSummary (progname); KOutMsg ("Options:\n"); HelpOptionLine (ALIAS_LITE, OPTION_LITE, NULL, lite_usage); #if USE_FORCE HelpOptionLine (ALIAS_FORCE, OPTION_FORCE, NULL, force_usage); #endif HelpOptionsStandard (); HelpVersion (fullpath, KAppVersion()); return rc; }
rc_t CC UsageSummary ( const char * progname ) { return KOutMsg ( "\n" "Usage:\n" " %s <sra-accession> <gtf-file> [options]\n" "\n", progname ); }
/* -------------------------------------------------------------------- */ rc_t temp_registry_merge( temp_registry * self, KDirectory * dir, const char * output_filename, size_t buf_size, bool show_progress, bool force, compress_t compress ) { rc_t rc = 0; if ( self == NULL ) rc = RC( rcVDB, rcNoTarg, rcConstructing, rcSelf, rcNull ); else if ( output_filename == NULL ) rc = RC( rcVDB, rcNoTarg, rcConstructing, rcParam, rcNull ); else { struct bg_progress * progress = NULL; if ( show_progress ) { rc = KOutMsg( "concat :" ); if ( rc == 0 ) { uint64_t total = total_size( dir, &self -> lists ); rc = bg_progress_make( &progress, total, 0, 0 ); /* progress_thread.c */ } } if ( rc == 0 ) { uint32_t first; uint32_t count = count_valid_entries( &self -> lists, &first ); /* above */ if ( count == 1 ) { /* we have only ONE set of files... */ VNamelist * l = VectorGet ( &self -> lists, first ); VNamelistReorder ( l, false ); rc = execute_concat( dir, output_filename, l, buf_size, progress, force, compress ); /* concatenator.c */ } else if ( count > 1 ) { /* we have MULTIPLE sets of files... */ cmn_merge cmn = { dir, output_filename, buf_size, progress, force, compress }; on_merge_ctx omc = { &cmn, 0 }; VectorInit( &omc . threads, 0, count ); VectorForEach ( &self -> lists, false, on_merge, &omc ); join_and_release_threads( &omc . threads ); /* helper.c */ } bg_progress_release( progress ); /* progress_thread.c ( ignores NULL )*/ } } return rc; }
rc_t CC UsageSummary ( const char * progname ) { return KOutMsg ("\n" "Usage:\n" " %s src-path dst-path [options]\n" "\n", progname); return 0; }
static rc_t CC on_history_path( const String * part, void *data ) { tool_options * options = data; rc_t rc = add_tool_options_path( options, part->addr ); if ( options -> detailed ) KOutMsg( "source: %S\n", part ); return rc; }
rc_t CC UsageSummary ( const char * progname ) { return KOutMsg ( "\n" "Usage:\n" " %s [options] -f <url | accession> -d <dst_path> -c no\n" "\n", progname ); }
rc_t CC Usage ( const Args * args ) { const char * progname = UsageDefaultName; const char * fullpath = UsageDefaultName; rc_t rc; if ( args == NULL ) rc = RC ( rcApp, rcArgv, rcAccessing, rcSelf, rcNull ); else { rc = ArgsProgram ( args, &fullpath, &progname ); if ( rc != 0 ) progname = fullpath = UsageDefaultName; rc = UsageSummary ( progname ); if ( rc != 0 ) { PLOGERR( klogErr, ( klogErr, rc, "UsageSummary() failed in $(func)", "func=%s", __func__ ) ); } else rc = KOutMsg ( "Options:\n" ); if ( rc == 0 ) { uint32_t idx, count = sizeof ToolOptions / sizeof ToolOptions [ 0 ]; for ( idx = 0; idx < count; ++idx ) { OptDef * o = &ToolOptions[ idx ]; HelpOptionLine ( o->aliases, o->name, NULL, o->help ); } } if ( rc == 0 ) rc = KOutMsg ( "\n" ); if ( rc == 0 ) { HelpOptionsStandard (); HelpVersion ( fullpath, KAppVersion() ); } } return rc; }
rc_t CC UsageSummary ( const char * progname ) { return KOutMsg ( "\n" "Usage:\n" " %s\n" "\n", progname ); }
static void CC print_header_callback( BSTNode *n, void *data ) { seq_id_node * node = ( seq_id_node * )n; hdr_print_ctx * hctx = ( hdr_print_ctx * )data; if ( hctx->rc == 0 ) { if ( hctx->use_seq_id ) hctx->rc = KOutMsg( "@SQ\tSN:%s\tLN:%u\n", node->seq_id, node->seq_len ); else { if ( cmp_pchar_0( node->seq_id, node->name ) == 0 ) hctx->rc = KOutMsg( "@SQ\tSN:%s\tLN:%u\n", node->name, node->seq_len ); else hctx->rc = KOutMsg( "@SQ\tSN:%s\tAS:%s\tLN:%u\n", node->name, node->seq_id, node->seq_len ); } } }
static rc_t report_ref_loc( const VDBManager *vdb_mgr, VFSManager * vfs_mgr, const char * seq_id ) { const String * path; rc_t rc = resolve_accession( vfs_mgr, seq_id, &path ); if ( rc == 0 ) { rc = KOutMsg( "location:\t%S\n", path ); if ( rc == 0 ) { uint32_t pt = VDBManagerPathType ( vdb_mgr, "%S", path ); const char * spt = path_type_2_str( pt ); rc = KOutMsg( "pathtype:\t%s\n", spt ); } free ( (void*) path ); } return rc; }
rc_t CC UsageSummary(const char *progname) { KOutMsg("Update user's NCBI VDB crypto password\n" "If not run with --quiet recommendations\n" "are given if errors are detected.\n" "\n"); return 0; }
static rc_t perform_unlock( visit_ctx * octx ) { rc_t rc = 0; unlock_data data; memset( &data, 0, sizeof data ); octx->data = &data; if ( rc == 0 ) rc = foreach_path( octx, on_unlock_path ); if ( rc == 0 ) rc = KOutMsg( "-----------------------------------\n" ); if ( rc == 0 ) rc = KOutMsg( "%,u lock-files removed\n", data.lock_count ); return rc; }
static rc_t vdb_fastq_loop_with_name( const p_dump_context ctx, const fastq_ctx * fctx ) { rc_t rc = 0; int64_t row_id; vdn_start( ctx->row_generator ); while ( vdn_next( ctx->row_generator, (uint64_t*)&row_id ) && rc == 0 ) { rc = Quitting(); if ( rc == 0 ) { uint32_t elem_bits, boff, row_len, name_len; const char * data; const char * name; rc = VCursorCellDataDirect( fctx->cursor, row_id, fctx->idx_name, &elem_bits, (const void**)&name, &boff, &name_len ); if ( rc != 0 ) vdb_fastq_row_error( "VCursorCellDataDirect( row#$(row_nr), NAME ) failed", rc, row_id ); else { rc = VCursorCellDataDirect( fctx->cursor, row_id, fctx->idx_read, &elem_bits, (const void**)&data, &boff, &row_len ); if ( rc != 0 ) vdb_fastq_row_error( "VCursorCellDataDirect( row#$(row_nr), READ ) failed", rc, row_id ); else { rc = KOutMsg( "@%s.%li %.*s length=%u\n%.*s\n", fctx->run_name, row_id, name_len, name, row_len, row_len, data ); if ( rc == 0 ) { rc = VCursorCellDataDirect( fctx->cursor, row_id, fctx->idx_qual, &elem_bits, (const void**)&data, &boff, &row_len ); if ( rc != 0 ) vdb_fastq_row_error( "VCursorCellDataDirect( row#$(row_nr), QUALITY ) failed", rc, row_id ); else rc = KOutMsg( "+%s.%li %.*s length=%u\n%.*s\n", fctx->run_name, row_id, name_len, name, row_len, row_len, data ); } } } } } return rc; }
static rc_t perform_report( visit_ctx * octx ) { rc_t rc = 0; report_data data; memset( &data, 0, sizeof data ); octx->data = &data; if ( octx->options->detailed ) rc = KOutMsg( "\n-----------------------------------\n" ); if ( rc == 0 ) rc = foreach_path( octx, on_report_path ); if ( rc == 0 ) rc = KOutMsg( "-----------------------------------\n" ); if ( rc == 0 ) rc = KOutMsg( "%,u cached file(s)\n", data.partial_count ); if ( rc == 0 ) rc = KOutMsg( "%,u complete file(s)\n", data.full_count ); if ( rc == 0 ) rc = KOutMsg( "%,u bytes in cached files\n", data.file_size ); if ( rc == 0 ) rc = KOutMsg( "%,u bytes used in cached files\n", data.used_file_size ); if ( rc == 0 ) rc = KOutMsg( "%,u lock files\n", data.lock_count ); return rc; }
rc_t CC UsageSummary (const char * progname) { return KOutMsg ( "Usage:\n" " %s [options] [<query> ...]\n" "\n" "Summary:\n" " Display VDB configuration information\n" "\n", progname); }
rc_t CC UsageSummary ( const char *prog_name ) { return KOutMsg ( "Usage: %s [options] src-object dst-object\n" " %s [options] src-object [src-object...] dst-dir\n" "\n" , prog_name , prog_name ); }
void debug_cigar_t( const struct cigar_t * c ) { if ( c != NULL ) { int i; for ( i = 0; i < c->length; ++i ) KOutMsg( "c[%d]: %d x %c\n", i, c->count[ i ], c->op[ i ] ); } }
rc_t CC UsageSummary (const char * progname) { return KOutMsg ( "Usage:\n" " %s [options] <db-path>\n" "\n" "Summary:\n" " Print database alignment information\n" "\n", progname); }
static void CC skiplist_report_cb( BSTNode *n, void *data ) { const struct skiplist_ref_node * node = ( const struct skiplist_ref_node * )n; uint32_t nr = VectorLength( &( node->skip_ranges ) ); KOutMsg( "\n-[%s]:\n", node->name ); if ( n == 0 ) KOutMsg( " no ranges!\n" ); else { uint32_t i; for ( i = 0; i < nr; ++i ) { const struct skip_range * sr = ( const struct skip_range * ) VectorGet ( &( node->skip_ranges ), i ); KOutMsg( " %u ... %u\n", sr->start, sr->end ); } } }
static rc_t print_headers_from_metadata( const VDatabase * db, bool * recalc, const char * path ) { const KMetadata * meta; rc_t rc = VDatabaseOpenMetadataRead( db, &meta ); if ( rc != 0 ) (void)PLOGERR( klogErr, ( klogErr, rc, "cannot open metadata from '$(t)'", "t=%s", path ) ); else { const KMDataNode * node; rc = KMetadataOpenNodeRead( meta, &node, "BAM_HEADER" ); if ( rc != 0 ) { if ( GetRCState( rc ) == rcNotFound ) { *recalc = true; rc = 0; } else (void)PLOGERR( klogErr, ( klogErr, rc, "cannot open meta-node 'BAM_HEADER' from '$(t)'", "t=%s", path ) ); } else { size_t offset = 0, num_read, remaining = ~0; char buffer[ 40960 ]; while ( rc == 0 && remaining > 0 ) { rc = KMDataNodeRead( node, offset, buffer, sizeof( buffer ), &num_read, &remaining ); if ( rc == 0 ) { rc = KOutMsg( "%.*s", ( uint32_t )num_read, buffer ); offset += num_read; } } if ( rc == 0 && buffer[ num_read - 1 ] != '\n' ) { rc = KOutMsg( "\n" ); } KMDataNodeRelease( node ); } KMetadataRelease( meta ); } return rc; }
rc_t dump_quality_33( samdump_opts * opts, char const *quality, uint32_t qual_len, bool reverse ) { rc_t rc = 0; bool quantize = ( opts->qual_quant != NULL ); uint32_t i; if ( reverse ) { if ( quantize ) { for ( i = 0; i < qual_len && rc == 0; ++i ) { uint32_t qual = quality[ qual_len - i - 1 ] - 33; char newValue = ( opts->qual_quant_matrix[ qual ] + 33 ); rc = KOutMsg( "%c", newValue ); } } else { for ( i = 0; i < qual_len && rc == 0; ++i ) { char qual = quality[ qual_len - i - 1 ]; rc = KOutMsg( "%c", qual ); } } } else { if ( quantize ) { for ( i = 0; i < qual_len && rc == 0; ++i ) { uint32_t qual = quality[ i ] - 33; char newValue = opts->qual_quant_matrix[ qual ] + 33; rc = KOutMsg( "%c", newValue ); } } else { rc = KOutMsg( "%.*s", qual_len, quality ); } } return rc; }
static rc_t vdi_report_repo_str( const KRepository * repo, const char * elem_name, repofunc f ) { if ( f != NULL ) { char buffer[ 4096 ]; rc_t rc = f( repo, buffer, sizeof buffer, NULL ); if ( rc == 0 ) return KOutMsg( " - %s : %s\n", elem_name, buffer ); } return 0; }
static rc_t vdb_fasta_loop_without_name( const p_dump_context ctx, const fastq_ctx * fctx ) { rc_t rc = 0; int64_t row_id; vdn_start( ctx->row_generator ); while ( vdn_next( ctx->row_generator, (uint64_t*)&row_id ) && rc == 0 ) { rc = Quitting(); if ( rc == 0 ) { uint32_t elem_bits, boff, row_len; const char * data; rc = VCursorCellDataDirect( fctx->cursor, row_id, fctx->idx_read, &elem_bits, (const void**)&data, &boff, &row_len ); if ( rc != 0 ) vdb_fastq_row_error( "VCursorCellDataDirect( row#$(row_nr), READ ) failed", rc, row_id ); else { uint32_t idx = 0; int32_t to_print = row_len; rc = KOutMsg( ">%s.%li %li length=%u\n", fctx->run_name, row_id, row_id, row_len ); if ( to_print > ctx->max_line_len ) to_print = ctx->max_line_len; while ( rc == 0 && to_print > 0 ) { rc = KOutMsg( "%.*s\n", to_print, &data[ idx ] ); if ( rc == 0 ) { idx += ctx->max_line_len; to_print = ( row_len - idx ); if ( to_print > ctx->max_line_len ) to_print = ctx->max_line_len; } } } } } return rc; }