arg_desc->SetUsageContext(
97 "Extract Genbank source qualifiers",
102arg_desc->AddOptionalKey(
"i",
"IDsFile",
103 "IDs file name. Defaults to stdin",
106arg_desc->AddOptionalKey(
"seq-entry",
"SeqEntryFile",
107 "File containing Seq-entry in ASN.1 format",
110arg_desc->SetDependency(
"seq-entry",
117arg_desc->AddOptionalKey(
"f",
"FieldsList",
120arg_desc->SetDependency(
"f",
124arg_desc->SetDependency(
"f",
128arg_desc->AddOptionalKey(
"F",
"FieldsFile",
131arg_desc->SetDependency(
"F",
135arg_desc->AddFlag(
"all-fields",
"List all fields");
139arg_desc->AddFlag(
"list-supported-fields",
140 "List in alphabetical order the fields that srcchk can display; ignore other arguments");
145arg_desc->AddOptionalKey(
"o",
"OutputFile",
146 "Output file name. Defaults to stdout",
151arg_desc->AddDefaultKey(
"delim",
"Delimiter",
165 if(args[
"list-supported-fields"]) {
167 sort(begin(sortedFields), end(sortedFields));
168 for(
const auto& field : sortedFields) {
169cout << field <<
"\n";
187 for(
size_tpos=0; pos < errorCount; ++pos) {
190 return(errorCount ? 1 : 0);
200 stringerror_msg = args[
"o"] ?
201 "Unable to open output file \""+ args[
"o"].AsString() +
"\".":
202 "Unable to write to stdout.";
209 conststreamsize maxLineSize(100);
210 charline[maxLineSize];
219pIfstr = args[
"i"] ? &args[
"i"].AsInputFile() : &cin;
221 catch(
conststd::exception&) {
222 stringerror_msg = args[
"i"] ?
223 "Unable to open ID file \""+ args[
"i"].AsString() +
"\".":
224 "Unable to read IDs from stdin.";
230vector<pair<string, CBioseq_Handle> > vecIdBsh;
231 while(!pIfstr->eof()) {
232pIfstr->getline(line, maxLineSize);
233 if(line[0] == 0 || line[0] ==
'#') {
241vecIdBsh.push_back(make_pair(
id,bsh));
247 stringerr_msg =
"Malformatted ID \""+
id+
"\"";
265 if(!args[
"seq-entry"]) {
270 stringerror_msg = args[
"o"] ?
271 "Unable to open output file \""+ args[
"o"].AsString() +
"\".":
272 "Unable to write to stdout.";
284 const char*
infile= args[
"seq-entry"].AsString().c_str();
288 string msg(
"Unable to open Seq-entry file \""+ args[
"seq-entry"].AsString() +
"\".");
300 string msg(
"Unable to process Seq-entry file \""+ args[
"seq-entry"].AsString() +
"\".");
317 if(args[
"all-fields"]) {
323 stringfieldString = args[
"f"].AsString();
328 conststreamsize maxLineSize(100);
329 charline[maxLineSize];
332pIfstr = &args[
"F"].AsInputFile();
334 catch(
conststd::exception&) {
337 "Unable to open fields file \""+ args[
"F"].AsString() +
"\".");
342 while(!pIfstr->eof()) {
343pIfstr->getline(line, maxLineSize);
344 if(line[0] == 0 || line[0] ==
'#') {
352 if(field ==
"id"|| field ==
"accession") {
356fields.push_back(field);
376 return&args[
"o"].AsOutputFile();
378 catch(
conststd::exception&) {
400<<
error.SeverityStr().c_str()
402<<
error.ErrorMessage().c_str()
410 int main(
intargc,
const char** argv)
static void SetupObjectManager(const CArgs &args, objects::CObjectManager &obj_mgr, TLoaders loaders=fDefault)
Set up the standard object manager data loaders according to the arguments provided above.
size_t Count() const override
const ILineError & GetError(size_t uPos) const override
0-based error retrieval.
bool xTryProcessSeqEntry(const CArgs &)
bool xTryProcessIdFile(const CArgs &)
CSrcWriter * xInitWriter(const CArgs &)
CRef< CSrcWriter > m_pWriter
CRef< CObjectManager > m_pObjMngr
CNcbiOstream * xInitOutputStream(const CArgs &)
void Init()
Initialize the application.
int Run()
Run the application.
CRef< CMessageListenerBase > m_pErrors
bool xGetDesiredFields(const CArgs &, vector< string > &)
void xDumpError(const ILineError &, std::ostream &)
static CSrcError * Create(ncbi::EDiagSev severity, const std::string &)
Used to generate tables showing qualifier-field entries occuring in the BioSources of instances of Bi...
static bool ValidateFields(const FIELDS &fields, ILineErrorListener *=nullptr)
Verify that each string in fields is a valid qualifier name.
static const FIELDS sAllSrcCheckFields
All possible fields processed by srchck application, in their canonical order.
static const FIELDS sDefaultSrcCheckFields
Default fields processed by srcchk application, in their canonical order.
void SetDelimiter(const string &delimiter)
Set the column delimiter for the output table.
virtual bool WriteBioseqHandles(const vector< pair< string, CBioseq_Handle > > &, const FIELDS &, CNcbiOstream &, ILineErrorListener *=nullptr)
Write a table of the specified qualifier-field entries found in the BioSources of a vector of Bioseqs...
virtual bool WriteSeqEntry(const CSeq_entry &, CScope &, CNcbiOstream &, bool=false)
Write a table of all qualifier-field entries occurring in the BioSources for a given Seq-entry,...
virtual bool PutError(const ILineError &)=0
Store error in the container, and return true if error was stored fine, and return false if the calle...
std::ofstream out("events_result.xml")
main entry point for tests
const CNcbiRegistry & GetConfig(void) const
Get the application's cached configuration parameters (read-only).
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 SetVersion(const CVersionInfo &version)
Set the version number for the program.
@ eTakeOwnership
An object can take ownership of another.
@ eExcludes
One argument excludes another.
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
@ eDiag_Error
Error message.
TErrCode GetErrCode(void) const
Get error code.
@ eSerial_AsnText
ASN.1 text.
static CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
@ eFormat
Contents not parsable as expected.
pair< TObjectPtr, TTypeInfo > ObjectInfo(C &obj)
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
void Reset(void)
Reset reference object.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
IO_PREFIX::ifstream CNcbiIfstream
Portable alias for ifstream.
static string PrintableString(const CTempString str, TPrintableMode mode=fNewLine_Quote|fNonAscii_Passthru)
Get a printable version of the specified string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
@ fNonAscii_Quote
Octal for all non-ASCII characters.
void CONNECT_Init(const IRWRegistry *reg=0, CRWLock *lock=0, TConnectInitFlags flag=eConnectInit_OwnNothing, FSSLSetup ssl=0)
Init [X]CONNECT library with the specified "reg" and "lock" (ownership for either or both can be deta...
constexpr auto sort(_Init &&init)
#define NCBI_SC_VERSION_PROXY
#define NCBI_TEAMCITY_BUILD_NUMBER_PROXY
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
int main(int argc, const char **argv)
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