<
classTRequest>
72 template<
classTRequest>
75 template<
classTRequest>
78 template<
classTRequest>
94s_GetCommand<CPSG_Request_Biodata> (
"biodata",
"Request biodata info and data by bio ID"),
95s_GetCommand<CPSG_Request_Blob> (
"blob",
"Request blob by blob ID"),
96s_GetCommand<CPSG_Request_Resolve> (
"resolve",
"Request biodata info by bio ID",
SCommand::fParallel),
97s_GetCommand<CPSG_Request_NamedAnnotInfo>(
"named_annot",
"Request named annotations info by bio ID(s)"),
98s_GetCommand<CPSG_Request_Chunk> (
"chunk",
"Request blob data chunk by chunk ID"),
99s_GetCommand<CPSG_Request_IpgResolve> (
"ipg_resolve",
"Request IPG info",
SCommand::fParallel),
100s_GetCommand<CPSG_Request_AccVerHistory> (
"acc_ver_history",
"Request accession version history"),
101s_GetCommand<SInteractive> (
"interactive",
"Interactive JSON-RPC mode",
SCommand::fParallel),
102s_GetCommand<SInteractiveSchema> (
"interactive_schema",
"Output JSON schema for JSON-RPC requests",
SCommand::fNoApi),
103s_GetCommand<SPerformance> (
"performance",
"Performance testing",
SCommand::fHidden),
114cmd_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
"PSG client");
118arg_desc->SetUsageContext(
"",
command.desc);
135 const auto& args =
GetArgs();
136 autoname = args.GetCommand();
146 return command.run(
this, args);
158 for(
auto i= data_flags.begin();
i!= data_flags.end(); ++
i) {
161 for(
autoj =
i+ 1; j != data_flags.end(); ++j) {
169 auto names= {
"First",
"Last",
"All"};
172 for(
stringname :
names) {
175 for(
stringexcluded :
names) {
176 if(name != excluded) {
182arg_desc.
AddAlias(
"latency",
"last-latency");
197arg_desc.
AddFlag(
"include-hup",
"Include HUP data");
198arg_desc.
AddFlag(
"https",
"Enable HTTPS");
200arg_desc.
AddFlag(
"verbose",
"Verbose output");
205 const autoname = blob_only ?
"blob-only":
"annot-only";
206 const autocomment = blob_only ?
"Output blob data only":
"Output annot info only";
207arg_desc.
AddFlag(name, comment);
213 template<
classTRequest>
220arg_desc.
AddFlag(
"no-bio-id-resolution",
"Do not try to resolve provided bio ID(s) before use");
231arg_desc.
AddAlias(
"id-file",
"input-file");
232arg_desc.
AddFlag(
"server-mode",
"Output one response per line");
236arg_desc.
AddFlag(
"no-bio-id-resolution",
"Do not try to resolve provided bio ID(s) before use");
255 voidCPsgClientApp::s_InitRequest<CPSG_Request_NamedAnnotInfo>(
CArgDescriptions& arg_desc)
261arg_desc.
AddFlag(
"no-bio-id-resolution",
"Do not try to resolve provided bio ID(s) before use");
286arg_desc.
AddFlag(
"server-mode",
"Output one response per line");
292 voidCPsgClientApp::s_InitRequest<CPSG_Request_AccVerHistory>(
CArgDescriptions& arg_desc)
304arg_desc.
AddFlag(
"server-mode",
"Output one JSON-RPC response per line and always output reply statuses");
305arg_desc.
AddFlag(
"echo",
"Echo all incoming requests");
324arg_desc.
AddFlag(
"local-queue",
"Whether user threads to use separate queues");
325arg_desc.
AddFlag(
"report-immediately",
"Whether to report metrics immediately (or at the end)");
334arg_desc.
AddFlag(
"single-doc",
"Treat input as a single JSON document (instead of one per line)");
341 if(args[
"io-threads"].
HasValue()) {
342 autoio_threads = args[
"io-threads"].AsInteger();
346 if(args[
"requests-per-io"].
HasValue()) {
347 autorequests_per_io = args[
"requests-per-io"].AsInteger();
349}
else if(parallel) {
353 if(args[
"max-streams"].
HasValue()) {
354 automax_streams = args[
"max-streams"].AsInteger();
358 if(args[
"use-cache"].
HasValue()) {
359 autouse_cache = args[
"use-cache"].AsString();
363 if(args[
"timeout"].
HasValue()) {
364 autotimeout = args[
"timeout"].AsInteger();
365TPSG_RequestTimeout::SetDefault(timeout);
369TPSG_Https::SetDefault(
true);
372 if(args[
"debug-printout"].
HasValue()) {
373 autodebug_printout = args[
"debug-printout"].AsString();
377 if(args[
"test-identity"].
HasValue()) {
378 const auto&
test_identity= args[
"test-identity"].AsString();
386 template<
classTParams>
389 template<
class... TInitArgs>
392args[
"service"].
HasValue() ? args[
"service"].AsString() :
string(),
395std::forward<TInitArgs>(init_args)...
412args[
"debug-printout"].
HasValue(),
430 return(args.
Exist(
"blob-only") && args[
"blob-only"].HasValue()) ||
431(args.
Exist(
"annot-only") && args[
"annot-only"].HasValue());
436 if(args.
Exist(
"output-fmt") && args[
"output-fmt"].HasValue()) {
437 const auto&
format= args[
"output-fmt"].AsString();
450 template<
classTParams>
453 template<
class... TInitArgs>
457args[
"rate"].AsDouble(),
458 max(1,
min(10, args[
"worker-threads"].AsInteger())),
459args[
"input-file"].AsString() ==
"-",
460args[
"server-mode"].AsBoolean(),
461std::forward<TInitArgs>(init_args)...
487 static_cast<size_t>(args[
"preview-size"].AsInt8()),
489args[
"one-server"].HasValue(),
490args[
"testing"].HasValue()
506 static_cast<size_t>(args[
"user-threads"].AsInteger()),
507args[
"delay"].AsDouble(),
508args[
"local-queue"].AsBoolean(),
509args[
"report-immediately"].AsBoolean(),
535 voidForEachTSE(
TExcludeexclude)
const;
539 auto GetSNPScaleLimit()
const{
return input[
"snp-scale-limit"].HasValue() ? objects::CSeq_id::GetSNPScaleLimit_Value(
input[
"snp-scale-limit"].AsString()) : CPSG_Request_NamedAnnotInfo::ESNPScaleLimit::eSNPScaleLimit_Default; }
540 voidSetRequestFlags(shared_ptr<CPSG_Request> request)
const;
546 return[&](
const string& name) {
547 return input[name].HasValue();
553 const size_t n=
input.GetNExtra();
557 for(
size_t i= 1;
i<=
n; ++
i) {
561rv.emplace_back(
input[
i].AsString());
570 const auto&
id=
input[
"ID"].AsString();
571 const auto& last_modified =
input[
"last-modified"];
572 returnlast_modified.HasValue() ?
CPSG_BlobId(
id, last_modified.AsInt8()) : id;
577 return{
input[
"ID2_CHUNK"].AsInteger(),
input[
"ID2_INFO"].AsString() };
584 autoblob_ids =
input[
"exclude-blob"].GetStringList();
586 for(
const auto& blob_id : blob_ids) {
598 template<
classTRequest>
601 autorequest = SRequestBuilder::Build<TRequest>(args);
606 intCPsgClientApp::RunRequest<CPSG_Request_Resolve>(
const CArgs& args)
608 const autosingle_request = args[
"ID"].HasValue();
610 if(single_request) {
611 autorequest = SRequestBuilder::Build<CPSG_Request_Resolve>(args);
619 intCPsgClientApp::RunRequest<CPSG_Request_IpgResolve>(
const CArgs& args)
621 const autosingle_request = args[
"protein"].HasValue() || args[
"ipg"].HasValue() || args[
"nucleotide"].HasValue();
623 if(single_request) {
624 autorequest = SRequestBuilder::Build<CPSG_Request_IpgResolve>(args);
632 intCPsgClientApp::RunRequest<SInteractive>(
const CArgs& args)
636 if(params_builder.
testing) {
637GetRWConfig().SetValue(
"log",
"issued_subhit_limit", 0);
644 intCPsgClientApp::RunRequest<SInteractiveSchema>(
const CArgs& args)
646 SIoRedirectorior(cout, args[
"output-file"].AsOutputFile());
652 intCPsgClientApp::RunRequest<SPerformance>(
const CArgs& args)
659 intCPsgClientApp::RunRequest<SJsonCheck>(
const CArgs& args)
661 const auto&
schema= args[
"schema-file"];
662 const autosingle_doc = args[
"single-doc"].HasValue();
667 template<
classTRequest>
670 return{ std::move(name), std::move(desc), s_InitRequest<TRequest>, s_RunRequest<TRequest>,
flags};
673 int main(
intargc,
const char* argv[])
static const NStr::TNumToStringFlags kFlags
CCommandArgDescriptions â.
bool Write(std::ostream &out, TJson_Write_Flags flags=fJson_Write_IndentWithSpace, unsigned int indent_char_count=4) const
Write JSON data into a stream.
Bio-id (such as accession)
static void SetTestIdentity(const string &identity)
CNullable< string > TNucleotide
Request to the PSG server (see "CPSG_Request_*" below)
static int OneRequest(const SOneRequestParams ¶ms, shared_ptr< CPSG_Request > request)
static int ParallelProcessing(const TParams ¶ms, istream &is=cin)
static CJson_Document RequestSchema()
static int Performance(const SPerformanceParams ¶ms)
static int JsonCheck(istream *schema_is, bool single_doc)
int RunRequest(const CArgs &args)
static void s_InitRequest(CArgDescriptions &arg_desc)
virtual int Run()
Run the application.
static int s_RunRequest(CPsgClientApp *that, const CArgs &args)
virtual void Init()
Initialize the application.
vector< SCommand > m_Commands
static SCommand s_GetCommand(string name, string desc, int flags=SCommand::eDefault)
CTimeout â Timeout interval.
static const struct name_t names[]
static const char * schema
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
void AddFlag(const string &name, const string &comment, CBoolEnum< EFlagValue > set_value=eFlagHasValueIfSet, TFlags flags=0)
Add description for flag argument.
void AddExtra(unsigned n_mandatory, unsigned n_optional, const string &comment, EType type, TFlags flags=0)
Add description for the extra, unnamed positional arguments.
void SetConstraint(const string &name, const CArgAllow *constraint, EConstraintNegate negate=eConstraint)
Set additional user defined constraint on argument value.
void SetDependency(const string &arg1, EDependency dep, const string &arg2)
Define a dependency.
bool Exist(const string &name) const
Check existence of argument description.
void AddKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for mandatory key.
void AddAlias(const string &alias, const string &arg_name)
Add argument alias.
void AddPositional(const string &name, const string &comment, EType type, TFlags flags=0)
Add description for mandatory positional argument.
void AddOptionalKey(const string &name, const string &synopsis, const string &comment, EType type, TFlags flags=0)
Add description for optional key without default value.
void AddOptionalPositional(const string &name, const string &comment, EType type, TFlags flags=0)
Add description for optional positional argument without default value.
void AddDefaultKey(const string &name, const string &synopsis, const string &comment, EType type, const string &default_value, TFlags flags=0, const string &env_var=kEmptyStr, const char *display_value=nullptr)
Add description for optional key with default value.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ fHidden
Hide it in Usage.
@ eHidden
Hide command in Usage.
@ eRequires
One argument requires another.
@ eExcludes
One argument excludes another.
@ eNoSortCommands
On PrintUsage, keep commands unsorted.
@ eCommandOptional
Command is not necessary.
@ eInt8
Convertible into an integer number (Int8 only)
@ eInputFile
Name of file (must exist and be readable)
@ eDouble
Convertible into a floating point number (double)
@ eDataSize
Integer number with possible "software" qualifiers (KB, KiB, et al)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
static bool StrToSeverityLevel(const char *str_sev, EDiagSev &sev)
Get severity from string.
@ eDiag_Warning
Warning message.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
static string & ToLower(string &str)
Convert string to lower case â string& version.
@ eDefault
Default timeout (to be interpreted by the client code)
unsigned int
A callback function used to compare two keys in a database.
The blob sat and sat key Both must be positive integers</td > n< td > Non empty string The interpretation of the blob id depends on a processor Cassandra n processor expects the following format
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
@ Default
Substitute always (default)
vector< CPSG_BioId > CPSG_BioIds
EPSG_BioIdResolution
Whether to try to resolve provided seq-ids before use.
@ Resolve
Try to resolve provided seq-ids.
@ NoResolve
Use provided seq-ids as is.
void s_AddLatencyOptions(CArgDescriptions &arg_desc)
void s_InitPsgOptions(CArgDescriptions &arg_desc)
void s_InitDataOnly(CArgDescriptions &arg_desc, bool blob_only=true)
void s_InitDataFlags(CArgDescriptions &arg_desc)
void s_SetPsgDefaults(const CArgs &args, bool parallel)
int main(int argc, const char *argv[])
SBase(const CArgs &args, TInitArgs &&... init_args)
SBatchResolve(const CArgs &args)
SInteractive(const CArgs &args)
static size_t GetDataLimit(const CArgValue &value)
CLogLatencies::EWhich GetLatency(const CArgs &args)
static ESerialDataFormat GetDataOnlyOutputFormat(const CArgs &args)
SOneRequest(const CArgs &args)
static bool GetDataOnlyEnabled(const CArgs &args)
SParallelProcessing(const CArgs &args, TInitArgs &&... init_args)
SPerformance(const CArgs &args)
SCommand(string n, string d, TInit i, TRun r, int f)
function< void(CArgDescriptions &)> TInit
function< int(CPsgClientApp *, const CArgs &)> TRun
SIoRedirector(ios &what, ios &to)
static void SetImplicitDefault(const T &value)
static void SetDefault(const T &value)
Arbitrary request URL arguments.
SPSG_UserArgs GetUserArgs() const
CPSG_BioId GetBioId() const
auto GetAccSubstitution() const
auto GetBioIdType() const
vector< string > GetNamedAnnots() const
CTimeout GetResendTimeout() const
auto GetNucleotide() const
EPSG_BioIdResolution GetBioIdResolution() const
auto GetSNPScaleLimit() const
static CPSG_BioId::TType GetBioIdType(const string &type)
function< void(string)> TExclude
static EPSG_AccSubstitution GetAccSubstitution(const string &acc_substitution)
static SResolveParams GetResolveParams(const TInput &input)
static const initializer_list< SInfoFlag > & GetInfoFlags()
static const initializer_list< SDataFlag > & GetDataFlags()
function< bool(const string &)> TSpecified
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4