66 return assm_acc +
"#" +
mode;
73 bool isUseSeqconfigService)
87 if(isUseSeqconfigService) {
90 string host =
"www.ncbi.nlm.nih.gov";
91 string path =
"/projects/sviewer/seqconfig.cgi";
97 string url =
"https://" + host + path +
"?" + params;
105 if(res && res->CanGetAssemblies() && !res->GetAssemblies().empty()) {
106 gc_assembly = res->GetAssemblies().front();
109 }
NCBI_CATCH(
"Could not retrieve assembly information");
114 gc_assembly = gencoll_service->GetAssembly(assm_acc,
mode);
120 if(
nullptr != errors)
123 catch(
const exception& e) {
125 if(
nullptr != errors)
129 perflog.
AddParameter(
"Assembly source",
"GenColl error");
143 if(gc_assembly && gc_assembly->
GetAccession() != assm_acc) {
160 string sGuessTimeout(reg.GetString(
"gencoll",
"timeout",
"5"));
163 timeout.
sec = timeout_sec >= 0 ? (unsigned)timeout_sec : (timeout_sec_reg ? timeout_sec_reg : 5);
165 gencoll_service->SetTimeout(&timeout);
167 int retries = reg.GetInt(
"gencoll",
"retries", 1);
168 gencoll_service->SetTryLimit((
unsigned)retries);
170 return gencoll_service;
182 text_id = handle.GetInitialSeqIdOrNull().IsNull() ?
"" : handle.GetInitialSeqIdOrNull()->GetSeqIdString();
191 if(tmol == CBioseq_Handle::TMol::eMol_rna || tmol == CBioseq_Handle::TMol::eMol_aa) {
219 perflog.
AddParameter(
"AssmAccs source",
"no guess attempt");
232 AssmAccs = iCacheHit->second;
252 if (reply && reply->CanGetAssemblies()) {
253 for (
auto i: reply->GetAssemblies()) {
254 if (
i->CanGetAssembly()) {
255 AssmAccs.push_back(
i->GetAssembly().GetAccession());
265 LOG_POST(
Error <<
"Call to GenColl timed out when guessing assembly for ID: " << seqAcc);
281 for(
auto &iAssmAccs: assm_accs) {
282 sAssmAcc = iAssmAccs;
284 if (assembly.NotNull()) {
285 assemblies.push_back(assembly);
288 LOG_POST(
Warning <<
"Call to GenColl failed for assembly " << sAssmAcc);
293 LOG_POST(
Warning <<
"Call to GenColl failed for assembly " << sAssmAcc <<
" :" << e.
what());
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
string GetAccession() const
Retrieve the accession for this assembly.
static void GetAssmsInfo(const TAssmAccs &assm_accs, const string &mode, TAssemblies &assemblies, IGencollSvcErrors *errors=nullptr)
query GenColl for assembly information, return list of assemblies mode is as described above for GetG...
map< string, CRef< objects::CGC_Assembly > > m_GC_Assembly_cache
mutex to sync our internals
CRef< objects::CGC_Assembly > GetGCAssembly(const string &assm_acc, bool use_caching, const string &mode, IGencollSvcErrors *errors=nullptr, bool isUseSeqconfigService=false)
static bool isGenCollSequence(const objects::CBioseq_Handle &handle)
static CRef< CGencollSvc > GetInstance(void)
static CRef< objects::CGenomicCollectionsService > GetGenCollService(int timeout_sec=-1)
static TSeqAccToAssmAccsCache sm_SeqAccToAssmAccsCache
EGencollSvcStatus GetAssmAccs(const objects::CBioseq_Handle &handle, objects::EGCClient_GetAssemblyBySequenceFilter filter, bool isOne, TAssmAccs &AssmAccs)
get all assembly accessions for a given sequence and filter if isOne == 1, return only the best one a...
list< CRef< objects::CGC_Assembly > > TAssemblies
CNcbiIstream & GetResponseStream()
static CNcbiApplication * Instance(void)
Singleton method.
CObjectIStreamAsnBinary –.
virtual void ReportError(const string &accession, const string &error)=0
const_iterator end() const
const_iterator find(const key_type &key) const
static string s_MakeCacheKey(const string &assm_acc, const string &mode)
DEFINE_CLASS_STATIC_FAST_MUTEX(CGencollSvc::sm_SeqAccToAssmAccsCacheMutex)
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
#define NCBI_CATCH(message)
Catch CExceptions as well This macro is deprecated - use *_X or *_XX variant instead of it.
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
static EAccessionInfo IdentifyAccession(const CTempString &accession, TParseFlags flags=fParse_AnyRaw)
Deduces information from a bare accession a la WHICH_db_accession; may report false negatives on prop...
EAccessionInfo
For IdentifyAccession (below)
@ eContent
Untagged human-readable accession or the like.
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
@ eGetId_Best
return the "best" gi (uses FindBestScore(), with CSeq_id::CalculateScore() as the score function
bool NotNull(void) const THROWS_NONE
Check if pointer is not null – same effect as NotEmpty().
CRef< C > Ref(C *object)
Helper functions to get CRef<> and CConstRef<> objects.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static unsigned int StringToUInt(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to unsigned int.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
static string URLEncode(const CTempString str, EUrlEncode flag=eUrlEnc_SkipMarkChars)
URL-encode string.
@ fConvErr_NoThrow
Do not throw an exception on error.
@ eNocase
Case insensitive compare.
unsigned int usec
microseconds (modulo 1,000,000)
const TAccession & GetAccession(void) const
Get the Accession member data.
bool CanGetAccession(void) const
Check if it is safe to call GetAccession method.
EGCClient_GetAssemblyBySequenceFilter
This is a bitfield. All values are powers of two.
EMol
molecule class in living organism
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.