unique_ptr<CObjectOStream>
m_Os;
113unique_ptr<CFastaOstream>
m_Os;
125 virtual void Init(
void);
126 virtual int Run(
void);
127 virtual void Exit(
void);
161arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
162 "Retrieve sequences in a varietu of formats");
164arg_desc->AddDefaultKey(
"o",
"Output",
165 "Filename for output",
169arg_desc->AddDefaultKey(
"t",
"Type",
170 "Output type. Options are:\n" 176 "6 = quality scores\n" 177 "7 = Entrez DocSums\n" 178 "8 = FASTA reverse complement\n",
181arg_desc->SetConstraint(
"t",
184arg_desc->AddKey(
"g",
"GI",
185 "GI to for single entry to process",
187arg_desc->AddOptionalKey(
"s",
"SeqId",
188 "Fasta style SeqId to process",
190arg_desc->SetDependency(
"s",
194arg_desc->AddOptionalKey(
"q",
"Query",
195 "Use an entrez query to generate the input list",
197arg_desc->SetDependency(
"q",
201arg_desc->AddFlag(
"dp",
"Query is for protein database");
202arg_desc->AddFlag(
"dn",
"Query is for nucleotide database");
217 int type= args[
"t"].AsInteger();
251unique_ptr<IOutputFormatter> formatter(
x_GetFormatter(ostr, args));
254 if(args[
"g"] || args[
"s"]) {
255 if( !formatter.get() ) {
257 "formatter type not understood or not handled");
266 else if(args[
"s"]) {
273 "failed to retrieve sequence: "+ idh.
AsString());
276formatter->Format(bsh);
278 else if(args[
"q"]) {
279 if( !formatter.get() ) {
281 "formatter type not understood or not handled");
284 string query= args[
"q"].AsString();
286vector<TEntrezId> uids;
291 else if(args[
"dn"]) {
296 "one of -dp or -dn must be provided to " 297 "indicate the database of interest");
300 ITERATE(vector<TEntrezId>, it, uids) {
305 "failed to retrieve sequence: "+ idh.
AsString());
308formatter->Format(bsh);
316 "input options not yet supported");
338 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.
static void AddArgumentDescriptions(CArgDescriptions &arg_desc, TLoaders loaders=fDefault)
Add a standard set of arguments used to configure the object manager.
Class for querying via E-Utils.
Uint8 Search(const string &db, const string &term, vector< objects::CSeq_id_Handle > &uids, const string &xml_path=kEmptyStr)
FASTA-format output; see also ReadFasta in <objtools/readers/fasta.hpp>
virtual void Exit(void)
Cleanup on application exit.
virtual void Init(void)
Initialize the application.
static IOutputFormatter * x_GetFormatter(CNcbiOstream &ostr, const CArgs &args)
virtual int Run(void)
Run the application.
COutput_Fasta(CNcbiOstream &ostr)
unique_ptr< CFastaOstream > m_Os
virtual void Format(const CBioseq_Handle &bsh)
COutput_SerialFormat(CNcbiOstream &ostr, ESerialDataFormat fmt)
unique_ptr< CObjectOStream > m_Os
virtual void Format(const CBioseq_Handle &bsh)
virtual void Format(const CBioseq_Handle &)=0
virtual ~IOutputFormatter()
IOutputFormatter(CNcbiOstream &ostr)
#define ENTREZ_ID_TO(T, entrez_id)
#define GI_FROM(T, value)
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.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const CNcbiArguments & GetArguments(void) const
Get the application's cached unprocessed command-line arguments.
@ eExcludes
One argument excludes another.
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
@ eInteger
Convertible into an integer number (int or Int8)
#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 CSeq_id_Handle GetHandle(const CSeq_id &id)
Normal way of getting a handle, works for any seq-id.
string AsString(void) const
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output 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.
CConstRef< CSeq_entry > GetCompleteSeq_entry(void) const
Complete and get const reference to the seq-entry.
CSeq_entry_Handle GetTopLevelEntry(void) const
Get top level Seq-entry handle.
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
int main(int argc, const char *argv[])
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
CRef< objects::CObjectManager > om
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