30 virtual void Init(
void);
31 virtual int Run(
void);
43 arg_desc->SetUsageContext(
GetArguments().GetProgramBasename(),
44 "makes compartments from protein BLAST m8");
48 arg_desc->AddDefaultKey(
"ifmt",
"InputFormat",
52 arg_desc->SetConstraint(
"ifmt",
54 "tabular",
"seq-align",
"seq-align-set",
"seq-annot"));
56 arg_desc->AddFlag(
"hits",
67 ostr << ++last_id <<
'\t' << subj <<
'\t' <<
query <<
'\t';
68 ostr <<
i->from+1 <<
'\t' <<
i->to+1 <<
'\t' << (
i->strand?
'+':
'-') <<
'\t';
69 ostr <<
i->covered_aa <<
'\t' <<
i->score <<
'\n';
75 bool hits,
int& last_id,
const string&
query,
const string& subj)
77 unique_ptr<CCompartmentAccessor<THit> > comps_ptr =
79 if (comps_ptr.get() ==
NULL)
95 }
while (comps.
GetNext(comphits));
102 return id.IsGi() ?
id.AsFastaString() :
id.GetSeqIdString(
true);
116 string ifmt = args[
"ifmt"].AsString();
117 bool hits = args[
"hits"];
125 while(getline(cin,
buf)) {
127 if (hit->GetQueryStrand() ==
false) {
132 if (new_q != old_q || new_s != old_s) {
133 DoCompartments(one_query_subj_pair_hitrefs, compart_options, hits, last_id, old_q, old_s);
135 one_query_subj_pair_hitrefs.clear();
139 one_query_subj_pair_hitrefs.push_back(hit);
142 DoCompartments(one_query_subj_pair_hitrefs, compart_options, hits, last_id, old_q, old_s);
151 int main(
int argc,
const char* argv[])
virtual void Init(void)
Initialize the application.
virtual int Run(void)
Run the application.
static void SetupArgDescriptions(CArgDescriptions *argdescr)
bool GetFirst(THitRefs &compartment)
Initialize iteration over the results.
bool GetNext(THitRefs &compartment)
Proceed with iteration over the results.
vector< THitRef > THitRefs
TCompartmentStructs MakeCompartments(const TCompartments &asn_representation, CCompartOptions compart_options)
CSplign::THitRefs THitRefs
vector< SCompartment > TCompartmentStructs
list< CRef< CSeq_annot > > TCompartments
TCompartments FormatAsAsn(CCompartmentAccessor< THit > *comparts_ptr, CCompartOptions compart_options, const vector< pair< THit::TCoord, THit::TCoord > > *gaps=NULL)
unique_ptr< CCompartmentAccessor< THit > > CreateCompartmentAccessor(const THitRefs &orig_hitrefs, CCompartOptions compart_options, const vector< pair< THit::TCoord, THit::TCoord > > *gaps=NULL)
Selects compartments.
int PdbBadRank(const CRef< CSeq_id > &id)
void PrintCompartments(int &last_id, const string &query, const string &subj, const TCompartmentStructs &compartments, ostream &ostr)
string GetSeqIdString(const CSeq_id &id)
int main(int argc, const char *argv[])
void DoCompartments(const CSplign::THitRefs &one_query_subj_pair_hitrefs, const CCompartOptions &compart_options, bool hits, int &last_id, const string &query, const string &subj)
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.
@ eString
An arbitrary string.
void SetDiagFilter(EDiagFilter what, const char *filter_str)
Set diagnostic filter.
@ eDiagFilter_All
for all non-FATAL
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static int FastaAARank(const CRef< CSeq_id > &id)
bool IsPdb(void) const
Check if variant Pdb is selected.
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
Defines command line argument related classes.
Defines unified interface to application:
NCBI C++ stream class wrappers for triggering between "new" and "old" C++ stream libraries.