(
boolpipe =
false,
boolserver =
false) :
85 template<
classTItem,
class... TArgs>
100 template<
classTItem>
103 template<
classTItem,
class... TArgs>
109 void Fill(shared_ptr<CPSG_BlobData> blob_data);
110 void Fill(shared_ptr<CPSG_BlobInfo> blob_info);
111 void Fill(shared_ptr<CPSG_SkippedBlob> skipped_blob);
112 void Fill(shared_ptr<CPSG_BioseqInfo> bioseq_info);
113 void Fill(shared_ptr<CPSG_NamedAnnotInfo> named_annot_info);
114 void Fill(shared_ptr<CPSG_NamedAnnotStatus> named_annot_status);
115 void Fill(shared_ptr<CPSG_PublicComment> public_comment);
116 void Fill(shared_ptr<CPSG_Processor> processor);
117 void Fill(shared_ptr<CPSG_IpgInfo> ipg_info);
118 void Fill(shared_ptr<CPSG_AccVerHistory> acc_ver_history);
123 template<
classTReplyItem>
124 void Set(
const char* name, shared_ptr<TReplyItem>& reply_item)
126 if(
autoblob_id = reply_item->template GetId<CPSG_BlobId> ())
Set(name, *blob_id);
127 else if(
autochunk_id = reply_item->template GetId<CPSG_ChunkId>())
Set(name, *chunk_id);
130 template<
typenameT>
133 template<
typenameT>
136 template<
typenameT>
139 template<
typenameT>
140 static void Set(
CJson_Object& obj,
const char* name,
constoptional<T>& v) {
if(v)
Set(obj[name], *v); }
144 static void Set(TNode node,
T&& v) {
Set(node.SetValue(), std::forward<T>(v)); }
147 static void Set(
CJson_Nodenode,
constvector<CPSG_BioId>& bio_ids);
202 SParams(std::move(s), rf, std::move(ua)),
216 SParams(std::move(s), rf, std::move(ua)),
249 SInteractiveParams(
strings, CPSG_Request::TFlags rf,
SPSG_UserArgsua,
double r,
intwt,
boolp,
boolsrv,
size_tdl,
size_tps,
boole,
boolos,
bool t) :
268 SParams(std::move(s), rf, std::move(ua)),
276 template<
classTParams>
290 SImpl(
constTParams& params);
306 void Init(
constTParams& params);
314 template<
classTMethod,
class... TArgs>
315 SThread(TMethod method, TArgs&&... args) :
m_Thread(method, std::forward<TArgs>(args)...) {}
332 template<
classTParams>
335 static int JsonCheck(istream* schema_is,
boolsingle_doc);
340 template<
classTCreateContext>
341 staticvector<shared_ptr<CPSG_Request>>
ReadCommands(TCreateContext create_context,
size_treport_progress_after = 0);
343 static bool ReadLine(
string& line, istream& is = cin,
boolsingle_doc =
false);
349 template<
classTParams>
352 using namespacechrono;
356 autowait = params.rate > 0 ? 1s / params.rate : 0s;
362parallel_processing(std::move(line));
365this_thread::sleep_for(wait);
368 if(++
n>= params.rate) {
369 autonow = system_clock::now();
370wait -= (now - start) /
n- 1s / params.rate;
384 template<
classTRequest,
classTInput,
class... TArgs>
385 staticshared_ptr<TRequest> Build(
constTInput&
input, TArgs&&... args);
387 template<
classTInput,
class... TArgs>
388 staticshared_ptr<CPSG_Request> Build(
const string& name,
constTInput&
input, TArgs&&... args);
390 static constinitializer_list<SDataFlag>& GetDataFlags();
391 static constinitializer_list<SInfoFlag>& GetInfoFlags();
393 template<
classTInput>
400 template<
classTInput>
403 template<
classTRequest>
422vector<string> GetNamedAnnots()
const;
426 voidForEachTSE(
TExcludeexclude)
const;
428 auto GetIpg()
const{
return input.has(
"ipg") ?
input[
"ipg"].GetValue().GetInt8() : 0; }
430 auto GetSNPScaleLimit()
const{
return input.has(
"snp_scale_limit") ? objects::CSeq_id::GetSNPScaleLimit_Value(
input[
"snp_scale_limit"].GetValue().GetString()) : CPSG_Request_NamedAnnotInfo::ESNPScaleLimit::eSNPScaleLimit_Default; }
432 voidSetRequestFlags(shared_ptr<CPSG_Request> request)
const;
439 template<
classTRequest>
446user_context(std::move(uc)),
447request_context(std::move(rc))
450 template<
class... TArgs>
453 returnmake_shared<TRequest>(std::forward<TArgs>(args)..., std::move(user_context), std::move(request_context));
456 template<
classTReader>
457shared_ptr<TRequest>
Build(
constTReader& reader);
459 template<
classTReader>
462 static voidIncludeData(shared_ptr<TRequest> request,
TSpecifiedspecified);
467 return[&](
const string& name) {
468 return input.has(
"include_data") && (name ==
input[
"include_data"].GetValue().GetString());
476 return[&](
const string& name) {
477 if(!reader.
input.
has(
"include_info"))
return false;
479 autoinclude_info = reader.
input[
"include_info"].
GetArray();
481 returnfind_if(include_info.begin(), include_info.end(), equals_to) != include_info.end();
488 template<
classTInput>
493 return{ reader.GetBioIdType(), TImpl::GetIncludeInfo(TImpl::GetSpecified(reader)), reader.GetAccSubstitution(), reader.GetBioIdResolution() };
496 template<
classTRequest,
classTInput,
class... TArgs>
501reader.SetRequestFlags(rv);
502rv->SetUserArgs(reader.GetUserArgs());
506 template<
classTInput,
class... TArgs>
509 if(name ==
"biodata") {
510 returnBuild<CPSG_Request_Biodata>(
input, std::forward<TArgs>(args)...);
511}
else if(name ==
"blob") {
512 returnBuild<CPSG_Request_Blob>(
input, std::forward<TArgs>(args)...);
513}
else if(name ==
"resolve") {
514 returnBuild<CPSG_Request_Resolve>(
input, std::forward<TArgs>(args)...);
515}
else if(name ==
"named_annot") {
516 returnBuild<CPSG_Request_NamedAnnotInfo>(
input, std::forward<TArgs>(args)...);
517}
else if(name ==
"chunk") {
518 returnBuild<CPSG_Request_Chunk>(
input, std::forward<TArgs>(args)...);
519}
else if(name ==
"ipg_resolve") {
520 returnBuild<CPSG_Request_IpgResolve>(
input, std::forward<TArgs>(args)...);
521}
else if(name ==
"acc_ver_history") {
522 returnBuild<CPSG_Request_AccVerHistory>(
input, std::forward<TArgs>(args)...);
523}
else if(name ==
"raw") {
524 returnBuild<CRawRequest>(
input, std::forward<TArgs>(args)...);
531 template<
classTReader>
534 autobio_id = reader.GetBioId();
535 autobio_id_resolution = reader.GetBioIdResolution();
536 autorequest = Create(std::move(bio_id), bio_id_resolution);
537 autospecified = GetSpecified(reader);
538IncludeData(request, specified);
539 autoexclude = [&](
stringblob_id) { request->ExcludeTSE(blob_id); };
540reader.ForEachTSE(exclude);
541request->SetAccSubstitution(reader.GetAccSubstitution());
542 const autoresend_timeout = reader.GetResendTimeout();
544 if(!resend_timeout.IsDefault()) {
545request->SetResendTimeout(resend_timeout);
552 template<
classTReader>
555 autobio_id = reader.GetBioId();
556 autobio_id_resolution = reader.GetBioIdResolution();
557 autorequest = Create(std::move(bio_id), bio_id_resolution);
558 autospecified = GetSpecified(reader);
559 const autoinclude_info = GetIncludeInfo(specified);
560request->IncludeInfo(include_info);
561request->SetAccSubstitution(reader.GetAccSubstitution());
566 template<
classTReader>
569 autoblob_id = reader.GetBlobId();
570 autorequest = Create(std::move(blob_id));
571 autospecified = GetSpecified(reader);
572IncludeData(request, specified);
577 template<
classTReader>
580 autobio_ids = reader.GetBioIds();
581 autonamed_annots = reader.GetNamedAnnots();
582 autobio_id_resolution = reader.GetBioIdResolution();
583 autorequest = Create(std::move(bio_ids), std::move(named_annots), bio_id_resolution);
584 autospecified = GetSpecified(reader);
585IncludeData(request, specified);
586request->SetAccSubstitution(reader.GetAccSubstitution());
587request->SetSNPScaleLimit(reader.GetSNPScaleLimit());
592 template<
classTReader>
595 autochunk_id = reader.GetChunkId();
596 returnCreate(std::move(chunk_id));
600 template<
classTReader>
603 autoprotein = reader.GetProtein();
604 autoipg = reader.GetIpg();
605 autonucleotide = reader.GetNucleotide();
606 returnCreate(std::move(protein), ipg, std::move(nucleotide));
610 template<
classTReader>
613 autobio_id = reader.GetBioId();
614 returnCreate(std::move(bio_id));
618 template<
classTReader>
624 template<
classTRequest>
627 for(
const auto&
f: GetDataFlags()) {
628 if(specified(
f.name)) {
629request->IncludeData(
f.value);
637 if(acc_substitution ==
"limited") {
639}
else if(acc_substitution ==
"never") {
void AddMessage(const SPSG_Message &message)
static void SetDataLimit(size_t value)
static void Set(CJson_Object &obj, const char *name, T &&v)
static bool sm_SetReplyType
static auto sm_PreviewSize
void Set(const char *name, shared_ptr< TReplyItem > &reply_item)
static void Set(CJson_Object &obj, const char *name, const CNullable< T > &v)
static void Set(CJson_Value value, Int4 v)
void Set(const char *name, T &&v)
static void Set(CJson_Value value, bool v)
static CJsonResponse NewItem(const shared_ptr< CPSG_ReplyItem > &reply_item)
void AddRequestID(TItem, EDoNotAddRequestID)
static void Set(CJson_Value value, const string &v)
static void SetReplyType(bool value)
void AddMessage(EDoNotAddRequestID=eDoNotAddRequestID)
static void Set(CJson_Value value, double v)
static void Set(CJson_Value value, Uint4 v)
void Fill(EPSG_Status status, shared_ptr< CPSG_Reply >)
static void Set(CJson_Object &obj, const char *name, const optional< T > &v)
static void Set(CJson_Value value, const char *v)
static void SetPreviewSize(size_t value)
static void Set(TNode node, T &&v)
static void Set(CJson_Value value, Uint8 v)
static void Set(CJson_Value value, Int8 v)
void AddRequestID(TItem item, TArgs &&... args)
CJson_ConstArray GetArray(void) const
Get JSON array contents of the node.
CJson_ConstValue GetValue(void) const
Get JSON value contents of the node.
bool has(const CJson_Node::TKeyType &name) const
Test if an element with this name exists in the object.
TStringType GetString(void) const
CJson_Object SetObject(void)
Get JSON object contents of the node.
Template class allowing to store a value or null (unassigned) state.
Bio-id (such as accession)
static shared_ptr< CPSG_Request > CreateRawRequest(string abs_path_ref, shared_ptr< void > user_context, CRef< CRequestContext > request_context)
A queue to retrieve data (accession resolution info; bio-sequence; annotation blobs) from the storage...
EIncludeData
Specify which info and data is needed.
CNullable< string > TNucleotide
EIncludeInfo
Specify which info and data is needed Some processors may provide more than the flags prescribe Alway...
Request to the PSG server (see "CPSG_Request_*" below)
CParallelProcessing(const TParams ¶ms)
void operator()(string line)
list< SThread > m_Threads
list< CPSG_EventLoop > m_PsgQueues
static bool ReadLine(string &line, istream &is=cin, bool single_doc=false)
static vector< shared_ptr< CPSG_Request > > ReadCommands(TCreateContext create_context, size_t report_progress_after=0)
static int OneRequest(const SOneRequestParams ¶ms, shared_ptr< CPSG_Request > request)
static int ParallelProcessing(const TParams ¶ms, istream &is=cin)
static CParallelProcessing< SBatchResolveParams > CreateParallelProcessing(const SBatchResolveParams ¶ms)
static CJson_Document RequestSchema()
static int Performance(const SPerformanceParams ¶ms)
static int JsonCheck(istream *schema_is, bool single_doc)
CTimeout â Timeout interval.
static SQLCHAR output[256]
bool IsNull(void) const
Check if the object is unassigned.
const TValue & GetValue(void) const
Get a const reference to the current value.
EDiagSev
Severity level for the posted diagnostics.
ESerialDataFormat
Data file format.
int32_t Int4
4-byte (32-bit) signed integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
int64_t Int8
8-byte (64-bit) signed integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
@ eDefault
Default timeout (to be interpreted by the client code)
E_Choice
Choice variants.
unsigned int TJson_Write_Flags
@ fJson_Write_NoIndentation
do not use indentation
@ fJson_Write_IndentWithSpace
use space (' ') symbol for indentation
@ fJson_Write_NoEol
do not write end-of-line symbol
chrono::system_clock::time_point time_point
const GenericPointer< typename T::ValueType > T2 value
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double df(double x_, const double &y_)
EPSG_AccSubstitution
Whether and how to substitute version-less primary seq-ids with the "more unique" secondary seq-ids.
@ Never
No substitution whatsoever - return exact raw accession info.
@ Default
Substitute always (default)
@ Limited
Substitute only if the resolved record's seq_id_type is GI(12)
EPSG_Status
Retrieval result.
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.
SImpl(const TParams ¶ms)
void(*)(SJsonOut &, EPSG_Status, const shared_ptr< CPSG_ReplyItem > &) TItemComplete
void(*)(SJsonOut &, EPSG_Status, const shared_ptr< CPSG_Reply > &) TReplyComplete
void Init(const TParams ¶ms)
TReplyComplete GetReplyComplete()
TItemComplete GetItemComplete()
void Process(string line)
void Submitter(CPSG_Queue &output)
CPSG_WaitingQueue< string > m_InputQueue
void(*)(SJsonOut &, const shared_ptr< CPSG_ReplyItem > &) TNewItem
SThread(TMethod method, TArgs &&... args)
SBatchResolveParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua, double r, int wt, bool p, bool srv, SResolveParams resolve_params)
CPSG_Request_Biodata::EIncludeData value
CPSG_Request_Resolve::EIncludeInfo value
SInteractiveParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua, double r, int wt, bool p, bool srv, size_t dl, size_t ps, bool e, bool os, bool t)
const size_t preview_size
static string GetService(string service, bool one_server)
const TJson_Write_Flags m_Flags
SJsonOut(bool pipe=false, bool server=false)
SJsonOut & operator<<(const CJson_Document &doc)
const ESerialDataFormat output_format
const CLogLatencies::EWhich which
SOneRequestParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua, CLogLatencies::EWhich lw, bool ld, bool de, bool dm, ESerialDataFormat df)
Arbitrary request URL arguments.
SParallelProcessingParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua, double r, int wt, bool p, bool srv)
const SPSG_UserArgs user_args
SParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua)
static EDiagSev min_severity
const CPSG_Request::TFlags request_flags
SPerformanceParams(string s, CPSG_Request::TFlags rf, SPSG_UserArgs ua, size_t ut, double d, bool lq, bool ri)
const size_t user_threads
const bool report_immediately
shared_ptr< void > user_context
SImpl(shared_ptr< void > uc={}, CRef< CRequestContext > rc={})
shared_ptr< TRequest > Build(const TReader &reader)
static void IncludeData(shared_ptr< TRequest > request, TSpecified specified)
CRef< CRequestContext > request_context
static CPSG_Request_Resolve::TIncludeInfo GetIncludeInfo(TSpecified specified)
auto Create(TArgs &&... args)
static TSpecified GetSpecified(const TReader &reader)
EPSG_BioIdResolution GetBioIdResolution() const
auto GetSNPScaleLimit() const
auto GetNucleotide() const
auto GetAbsPathRef() const
CTimeout GetResendTimeout() const
const CJson_ConstObject & input
SPSG_UserArgs GetUserArgs() const
auto GetAccSubstitution() const
SReader(const CJson_ConstObject &i)
CPSG_BioId GetBioId() const
function< void(string)> TExclude
static shared_ptr< TRequest > Build(const TInput &input, TArgs &&... args)
static EPSG_AccSubstitution GetAccSubstitution(const string &acc_substitution)
static SResolveParams GetResolveParams(const TInput &input)
function< bool(const string &)> TSpecified
const EPSG_BioIdResolution bio_id_resolution
const CPSG_Request_Resolve::TIncludeInfo include_info
const CPSG_BioId::TType type
const EPSG_AccSubstitution acc_substitution
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